Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LHCb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LHCb
LHCb
Commits
ca5d23d0
Commit
ca5d23d0
authored
2 weeks ago
by
Maarten Van Veghel
Browse files
Options
Downloads
Patches
Plain Diff
speed up NeutralProtoPAlg
parent
e572ccb5
Branches
mveghel-splitphotonsfix
No related tags found
1 merge request
!5001
Fix no cluster for SplitPhoton hypos
Pipeline
#11605826
passed
2 weeks ago
Stage: test
Stage: .post
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Event/RecreatePIDTools/src/NeutralProtoPAlg.cpp
+21
-35
21 additions, 35 deletions
Event/RecreatePIDTools/src/NeutralProtoPAlg.cpp
with
21 additions
and
35 deletions
Event/RecreatePIDTools/src/NeutralProtoPAlg.cpp
+
21
−
35
View file @
ca5d23d0
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
#include
"CaloDet/DeCalorimeter.h"
#include
"CaloDet/DeCalorimeter.h"
#include
"CaloFutureInterfaces/ICaloFutureHypoEstimator.h"
#include
"CaloFutureInterfaces/ICaloFutureHypoEstimator.h"
#include
"CaloFutureUtils/CaloFutureAlgUtils.h"
#include
"CaloFutureUtils/CaloFutureAlgUtils.h"
#include
"CaloFutureUtils/CaloMomentum.h"
#include
"CaloFutureUtils/NeutralClassifierUtils.h"
#include
"CaloFutureUtils/NeutralClassifierUtils.h"
#include
"CaloFutureUtils/TrackUtils.h"
#include
"CaloFutureUtils/TrackUtils.h"
#include
"Core/FloatComparison.h"
#include
"Core/FloatComparison.h"
...
@@ -130,39 +131,14 @@ LHCb::NeutralProtoPAlg::operator()( const LHCb::CaloHypos& hypos_from_mergedPi0s
...
@@ -130,39 +131,14 @@ LHCb::NeutralProtoPAlg::operator()( const LHCb::CaloHypos& hypos_from_mergedPi0s
auto
tableview
=
tracktable
.
buildView
();
auto
tableview
=
tracktable
.
buildView
();
auto
neutralview
=
neutralitytable
.
buildView
();
auto
neutralview
=
neutralitytable
.
buildView
();
// wrapper around data map getter, to include track match table the estimator doesn't have access to
auto
getData
=
[
&
](
auto
const
*
hypo
)
{
// hypo data
auto
data
=
m_estimator
->
get_data
(
ecal
,
hcal
,
*
hypo
);
// track relation
using
namespace
LHCb
::
Calo
::
Enum
;
auto
it
=
data
.
find
(
DataType
::
CellID
);
auto
cellid
=
(
it
!=
data
.
end
()
)
?
static_cast
<
unsigned
>
(
it
->
second
)
:
0u
;
auto
cluster
=
clusters
.
find
(
LHCb
::
Detector
::
Calo
::
CellID
(
cellid
)
);
if
(
cluster
!=
clusters
.
end
()
)
{
auto
cls_idx
=
cluster
->
indices
().
cast
();
auto
clsview
=
tableview
.
scalar
()[
cls_idx
];
auto
ntrview
=
neutralview
.
scalar
()[
cls_idx
];
if
(
clsview
.
hasRelation
()
)
data
[
DataType
::
ClusterMatch
]
=
clsview
.
relation
().
template
get
<
LHCb
::
Calo
::
TrackUtils
::
ClusterMatch
>().
cast
();
if
(
ntrview
.
hasRelation
()
)
data
[
DataType
::
ClusterNeutrality
]
=
ntrview
.
relation
().
template
get
<
LHCb
::
Calo
::
NeutralClassifierUtils
::
TrackMatchClassifier
>().
cast
();
}
return
data
;
};
// -- reset mass storage
// -- reset mass storage
std
::
map
<
const
int
,
double
>
mass_per_cell
=
{
{}
};
std
::
map
<
const
int
,
double
>
mass_per_cell
=
{
{}
};
// Get masses
// Get masses
for
(
const
auto
*
hypo
:
hypos_from_mergedPi0s
)
{
for
(
const
auto
*
hypo
:
hypos_from_mergedPi0s
)
{
if
(
!
hypo
)
continue
;
auto
cluster
=
LHCb
::
CaloFutureAlgUtils
::
ClusterFromHypo
(
*
hypo
);
using
namespace
LHCb
::
Calo
::
Enum
;
if
(
!
cluster
)
continue
;
// The call to process is happening twice for mergedPi0s, should be made smarter.
LHCb
::
Calo
::
Momentum
mom
(
hypo
);
auto
data
=
getData
(
hypo
);
mass_per_cell
[
cluster
->
seed
().
all
()]
=
mom
.
mass
();
const
int
cellCode
=
data
.
at
(
DataType
::
CellID
);
auto
it
=
data
.
find
(
DataType
::
HypoM
);
mass_per_cell
[
cellCode
]
=
(
it
!=
data
.
end
()
?
it
->
second
:
Default
);
}
}
//------ loop over all caloHypo containers
//------ loop over all caloHypo containers
...
@@ -175,7 +151,6 @@ LHCb::NeutralProtoPAlg::operator()( const LHCb::CaloHypos& hypos_from_mergedPi0s
...
@@ -175,7 +151,6 @@ LHCb::NeutralProtoPAlg::operator()( const LHCb::CaloHypos& hypos_from_mergedPi0s
// == Loop over CaloHypos
// == Loop over CaloHypos
for
(
const
auto
*
hypo
:
hypos
)
{
for
(
const
auto
*
hypo
:
hypos
)
{
if
(
!
hypo
)
{
continue
;
}
count
++
;
count
++
;
// == create and store the corresponding ProtoParticle
// == create and store the corresponding ProtoParticle
...
@@ -189,13 +164,24 @@ LHCb::NeutralProtoPAlg::operator()( const LHCb::CaloHypos& hypos_from_mergedPi0s
...
@@ -189,13 +164,24 @@ LHCb::NeutralProtoPAlg::operator()( const LHCb::CaloHypos& hypos_from_mergedPi0s
const
auto
hypothesis
=
hypo
->
hypothesis
();
const
auto
hypothesis
=
hypo
->
hypothesis
();
auto
data
=
getData
(
hypo
);
// hypo data
auto
data
=
m_estimator
->
get_data
(
ecal
,
hcal
,
*
hypo
);
// track relation
using
namespace
LHCb
::
Calo
::
Enum
;
auto
it
=
data
.
find
(
DataType
::
CellID
);
unsigned
cellid
=
(
it
!=
data
.
end
()
)
?
static_cast
<
unsigned
>
(
it
->
second
)
:
Default
;
auto
cluster
=
clusters
.
find
(
LHCb
::
Detector
::
Calo
::
CellID
(
cellid
)
);
if
(
cluster
!=
clusters
.
end
()
)
{
auto
clsview
=
tableview
.
scalar
()[
cluster
->
indices
().
cast
()];
if
(
clsview
.
hasRelation
()
)
data
[
DataType
::
ClusterMatch
]
=
clsview
.
relation
().
template
get
<
LHCb
::
Calo
::
TrackUtils
::
ClusterMatch
>().
cast
();
}
// create NeutralPID object
// create NeutralPID object
auto
pid
=
std
::
make_unique
<
LHCb
::
NeutralPID
>
();
auto
pid
=
std
::
make_unique
<
LHCb
::
NeutralPID
>
();
pid
->
setCaloNeutralID
(
LHCb
::
Detector
::
Calo
::
CellID
(
cellid
)
);
auto
cellidcode
=
data
.
find
(
DataType
::
CellID
)
!=
data
.
end
()
?
data
.
find
(
DataType
::
CellID
)
->
second
:
Default
;
pid
->
setCaloNeutralID
(
LHCb
::
Detector
::
Calo
::
CellID
(
(
unsigned
)
cellidcode
)
);
auto
set
=
[
&
](
auto
fn
,
const
DataType
t
)
{
auto
set
=
[
&
](
auto
fn
,
const
DataType
t
)
{
auto
i
=
data
.
find
(
t
);
auto
i
=
data
.
find
(
t
);
...
@@ -204,7 +190,7 @@ LHCb::NeutralProtoPAlg::operator()( const LHCb::CaloHypos& hypos_from_mergedPi0s
...
@@ -204,7 +190,7 @@ LHCb::NeutralProtoPAlg::operator()( const LHCb::CaloHypos& hypos_from_mergedPi0s
// add data to NeutralPID object
// add data to NeutralPID object
if
(
hypothesis
==
LHCb
::
CaloHypo
::
Hypothesis
::
Photon
||
hypothesis
==
LHCb
::
CaloHypo
::
Hypothesis
::
Pi0Merged
)
{
if
(
hypothesis
==
LHCb
::
CaloHypo
::
Hypothesis
::
Photon
||
hypothesis
==
LHCb
::
CaloHypo
::
Hypothesis
::
Pi0Merged
)
{
const
auto
it
=
mass_per_cell
.
find
(
cellid
code
);
const
auto
it
=
mass_per_cell
.
find
(
cellid
);
if
(
it
!=
mass_per_cell
.
end
()
)
pid
->
setClusterMass
(
it
->
second
);
if
(
it
!=
mass_per_cell
.
end
()
)
pid
->
setClusterMass
(
it
->
second
);
}
}
set
(
&
LHCb
::
NeutralPID
::
setCaloNeutralEcal
,
DataType
::
ClusterE
);
set
(
&
LHCb
::
NeutralPID
::
setCaloNeutralEcal
,
DataType
::
ClusterE
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment