RecoEcal
EgammaClusterAlgos
src
Multi5x5BremRecoveryClusterAlgo.cc
Go to the documentation of this file.
1
#include "
RecoEcal/EgammaClusterAlgos/interface/Multi5x5BremRecoveryClusterAlgo.h
"
2
#include "
RecoEcal/EgammaCoreTools/interface/BremRecoveryPhiRoadAlgo.h
"
3
#include "
FWCore/MessageLogger/interface/MessageLogger.h
"
4
5
reco::SuperClusterCollection
Multi5x5BremRecoveryClusterAlgo::makeSuperClusters
(
6
const
reco::CaloClusterPtrVector
& clustersCollection) {
7
const
float
etaBorder = 1.479;
8
superclusters_v
.clear();
9
10
// create vectors of references to clusters of a specific origin...
11
reco::CaloClusterPtrVector
islandClustersBarrel_v;
12
reco::CaloClusterPtrVector
islandClustersEndCap_v;
13
14
// ...and populate them:
15
for
(
auto
const
& cluster_p : clustersCollection) {
16
if
(cluster_p->algo() ==
reco::CaloCluster::multi5x5
) {
17
if
(fabs(cluster_p->position().eta()) < etaBorder) {
18
islandClustersBarrel_v.
push_back
(cluster_p);
19
}
else
{
20
islandClustersEndCap_v.
push_back
(cluster_p);
21
}
22
}
23
}
24
25
// make the superclusters from the Barrel clusters - Island
26
makeIslandSuperClusters
(islandClustersBarrel_v,
eb_rdeta_
,
eb_rdphi_
);
27
// make the superclusters from the EndCap clusters - Island
28
makeIslandSuperClusters
(islandClustersEndCap_v,
ec_rdeta_
,
ec_rdphi_
);
29
30
return
superclusters_v
;
31
}
32
33
#include "
DataFormats/Math/interface/Vector3D.h
"
34
35
void
Multi5x5BremRecoveryClusterAlgo::makeIslandSuperClusters
(
reco::CaloClusterPtrVector
& clusters_v,
36
double
etaRoad,
37
double
phiRoad) {
38
if
(clusters_v.
empty
())
39
return
;
40
41
const
auto
clustersSize = clusters_v.
size
();
42
assert
(clustersSize > 0);
43
44
bool
usedSeed[clustersSize];
45
for
(
auto
ic = 0
U
; ic < clustersSize; ++ic)
46
usedSeed[ic] =
false
;
47
48
float
eta
[clustersSize],
phi
[clustersSize],
et
[clustersSize];
49
for
(
auto
ic = 0
U
; ic < clustersSize; ++ic) {
50
eta
[ic] = clusters_v[ic]->eta();
51
phi
[ic] = clusters_v[ic]->phi();
52
et
[ic] = clusters_v[ic]->energy() *
sin
(clusters_v[ic]->
position
().
theta
());
53
}
54
55
for
(
auto
is = 0
U
; is < clustersSize; ++is) {
56
// check this seed was not already used
57
if
(usedSeed[is])
58
continue
;
59
auto
const
& currentSeed = clusters_v[is];
60
61
// Does our highest energy cluster have high enough energy?
62
// changed this to continue from break (to be robust against the order of sorting of the seed clusters)
63
if
(
et
[is] <
seedTransverseEnergyThreshold
)
64
continue
;
65
66
// if yes, make it a seed for a new SuperCluster:
67
double
energy
= (currentSeed)->
energy
();
68
math::XYZVector
position_(
69
(currentSeed)->
position
().
X
(), (currentSeed)->
position
().
Y
(), (currentSeed)->
position
().
Z
());
70
position_ *=
energy
;
71
usedSeed[is] =
true
;
72
73
LogTrace
(
"EcalClusters"
) <<
"*****************************"
;
74
LogTrace
(
"EcalClusters"
) <<
"******NEW SUPERCLUSTER*******"
;
75
LogTrace
(
"EcalClusters"
) <<
"Seed R = "
<< (currentSeed)->
position
().Rho();
76
77
reco::CaloClusterPtrVector
constituentClusters;
78
constituentClusters.
push_back
(currentSeed);
79
auto
ic = is + 1;
80
81
while
(ic < clustersSize) {
82
auto
const
& currentCluster = clusters_v[ic];
83
84
// if dynamic phi road is enabled then compute the phi road for a cluster
85
// of energy of existing clusters + the candidate cluster.
86
if
(
dynamicPhiRoad_
)
87
phiRoad =
phiRoadAlgo_
->
endcapPhiRoad
(
energy
+ (currentCluster)->
energy
());
88
89
auto
dphi = [](
float
p1
,
float
p2
) {
90
auto
dp
=
std::abs
(
p1
-
p2
);
91
if
(
dp
>
float
(
M_PI
))
92
dp
-=
float
(2 *
M_PI
);
93
return
std::abs
(
dp
);
94
};
95
96
auto
match
= [&](
int
i
,
int
j
) {
97
return
(dphi(
phi
[
i
],
phi
[
j
]) < phiRoad) & (
std::abs
(
eta
[
i
] -
eta
[
j
]) < etaRoad);
98
};
99
100
// does the cluster match the phi road for this candidate supercluster
101
if
(!usedSeed[ic] &&
match
(is, ic)) {
102
// add basic cluster to supercluster constituents
103
constituentClusters.
push_back
(currentCluster);
104
energy
+= (currentCluster)->
energy
();
105
position_ += (currentCluster)->
energy
() *
math::XYZVector
((currentCluster)->
position
().
X
(),
106
(currentCluster)->
position
().
Y
(),
107
(currentCluster)->
position
().
Z
());
108
// remove cluster from vector of available clusters
109
usedSeed[ic] =
true
;
110
LogTrace
(
"EcalClusters"
) <<
"Cluster R = "
<< (currentCluster)->
position
().Rho();
111
}
112
++ic;
113
}
114
115
position_ /=
energy
;
116
117
LogTrace
(
"EcalClusters"
) <<
"Final SuperCluster R = "
<< position_.Rho();
118
119
reco::SuperCluster
newSuperCluster(
120
energy
,
math::XYZPoint
(position_.X(), position_.Y(), position_.Z()), currentSeed, constituentClusters);
121
122
superclusters_v
.push_back(newSuperCluster);
123
LogTrace
(
"EcalClusters"
) <<
"created a new supercluster of: "
;
124
LogTrace
(
"EcalClusters"
) <<
"Energy = "
<< newSuperCluster.
energy
();
125
LogTrace
(
"EcalClusters"
) <<
"Position in (R, phi, theta) = ("
<< newSuperCluster.
position
().Rho() <<
", "
126
<< newSuperCluster.
position
().phi() <<
", "
<< newSuperCluster.
position
().theta() <<
")"
;
127
}
128
129
clusters_v.
clear
();
130
}
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition:
CaloCluster.h:154
edm::PtrVectorBase::size
size_type size() const
Size of the RefVector.
Definition:
PtrVectorBase.h:75
EgHLTOffHistBins_cfi.et
et
Definition:
EgHLTOffHistBins_cfi.py:8
Multi5x5BremRecoveryClusterAlgo::makeIslandSuperClusters
void makeIslandSuperClusters(reco::CaloClusterPtrVector &clusters_v, double etaRoad, double phiRoad)
Definition:
Multi5x5BremRecoveryClusterAlgo.cc:35
Multi5x5BremRecoveryClusterAlgo::eb_rdphi_
double eb_rdphi_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:59
mps_fire.i
i
Definition:
mps_fire.py:429
SiStripOfflineCRack_cfg.p2
p2
Definition:
SiStripOfflineCRack_cfg.py:140
MessageLogger.h
dqmiolumiharvest.j
j
Definition:
dqmiolumiharvest.py:66
BremRecoveryPhiRoadAlgo.h
edm::PtrVector::push_back
void push_back(Ptr< T > const &iPtr)
Definition:
PtrVector.h:149
Calorimetry_cff.dp
dp
Definition:
Calorimetry_cff.py:158
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
X
#define X(str)
Definition:
MuonsGrabber.cc:38
PVValHelper::eta
Definition:
PVValidationHelpers.h:70
Multi5x5BremRecoveryClusterAlgo::ec_rdeta_
double ec_rdeta_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:60
cms::cuda::assert
assert(be >=bs)
DDAxes::phi
mitigatedMETSequence_cff.U
U
Definition:
mitigatedMETSequence_cff.py:36
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:234
edm::PtrVectorBase::empty
bool empty() const
Is the RefVector empty.
Definition:
PtrVectorBase.h:72
LaserDQM_cfg.p1
p1
Definition:
LaserDQM_cfg.py:42
reco::SuperClusterCollection
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
Definition:
SuperClusterFwd.h:9
funct::abs
Abs< T >::type abs(const T &t)
Definition:
Abs.h:22
reco::SuperCluster
Definition:
SuperCluster.h:18
Multi5x5BremRecoveryClusterAlgo::ec_rdphi_
double ec_rdphi_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:61
M_PI
#define M_PI
Definition:
BXVectorInputProducer.cc:50
Multi5x5BremRecoveryClusterAlgo::seedTransverseEnergyThreshold
double seedTransverseEnergyThreshold
Definition:
Multi5x5BremRecoveryClusterAlgo.h:63
HCALHighEnergyHPDFilter_cfi.energy
energy
Definition:
HCALHighEnergyHPDFilter_cfi.py:5
Multi5x5BremRecoveryClusterAlgo::dynamicPhiRoad_
bool dynamicPhiRoad_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:64
reco::CaloCluster::energy
double energy() const
cluster energy
Definition:
CaloCluster.h:149
Multi5x5BremRecoveryClusterAlgo::superclusters_v
reco::SuperClusterCollection superclusters_v
Definition:
Multi5x5BremRecoveryClusterAlgo.h:67
BremRecoveryPhiRoadAlgo::endcapPhiRoad
double endcapPhiRoad(double energy)
Definition:
BremRecoveryPhiRoadAlgo.cc:36
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition:
Vector3D.h:31
math::XYZPoint
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition:
Point3D.h:12
Multi5x5BremRecoveryClusterAlgo.h
edm::PtrVectorBase::clear
void clear()
Clear the PtrVector.
Definition:
PtrVectorBase.h:81
Vector3D.h
position
static int position[264][3]
Definition:
ReadPGInfo.cc:289
Multi5x5BremRecoveryClusterAlgo::eb_rdeta_
double eb_rdeta_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:58
dqmMemoryStats.float
float
Definition:
dqmMemoryStats.py:127
reco::CaloCluster::multi5x5
Definition:
CaloCluster.h:38
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition:
Utils.h:10
edm::PtrVector< CaloCluster >
BeamSpotPI::Y
Definition:
BeamSpotPayloadInspectorHelper.h:35
theta
Geom::Theta< T > theta() const
Definition:
Basic3DVectorLD.h:150
BeamSpotPI::Z
Definition:
BeamSpotPayloadInspectorHelper.h:36
Multi5x5BremRecoveryClusterAlgo::phiRoadAlgo_
BremRecoveryPhiRoadAlgo * phiRoadAlgo_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:65
Multi5x5BremRecoveryClusterAlgo::makeSuperClusters
reco::SuperClusterCollection makeSuperClusters(const reco::CaloClusterPtrVector &clusters)
Definition:
Multi5x5BremRecoveryClusterAlgo.cc:5
Generated for CMSSW Reference Manual by
1.8.14