test
Main Page
Namespaces
Classes
Package Documentation
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Pages
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
(
const
reco::CaloClusterPtrVector
& clustersCollection)
6
{
7
8
const
float
etaBorder = 1.479;
9
superclusters_v
.clear();
10
11
// create vectors of references to clusters of a specific origin...
12
reco::CaloClusterPtrVector
islandClustersBarrel_v;
13
reco::CaloClusterPtrVector
islandClustersEndCap_v;
14
15
// ...and populate them:
16
for
(
auto
const
& cluster_p : clustersCollection)
17
{
18
if
(cluster_p->algo() ==
reco::CaloCluster::multi5x5
)
19
{
20
if
(fabs(cluster_p->position().eta()) < etaBorder)
21
{
22
islandClustersBarrel_v.
push_back
(cluster_p);
23
}
24
else
25
{
26
islandClustersEndCap_v.
push_back
(cluster_p);
27
}
28
}
29
}
30
31
// make the superclusters from the Barrel clusters - Island
32
makeIslandSuperClusters
(islandClustersBarrel_v,
eb_rdeta_
,
eb_rdphi_
);
33
// make the superclusters from the EndCap clusters - Island
34
makeIslandSuperClusters
(islandClustersEndCap_v,
ec_rdeta_
,
ec_rdphi_
);
35
36
return
superclusters_v
;
37
}
38
39
#include "
DataFormats/Math/interface/Vector3D.h
"
40
41
void
Multi5x5BremRecoveryClusterAlgo::makeIslandSuperClusters
(
reco::CaloClusterPtrVector
&clusters_v,
42
double
etaRoad,
double
phiRoad)
43
{
44
if
(clusters_v.
empty
())
return
;
45
46
const
auto
clustersSize = clusters_v.
size
();
47
assert
(clustersSize>0);
48
49
bool
usedSeed[clustersSize];
50
for
(
auto
ic=0U; ic<clustersSize; ++ic) usedSeed[ic]=
false
;
51
52
float
eta
[clustersSize],
phi
[clustersSize], et[clustersSize];
53
for
(
auto
ic=0U; ic<clustersSize; ++ic) {
54
eta[ic]=clusters_v[ic]->eta();
55
phi[ic]=clusters_v[ic]->phi();
56
et[ic]=clusters_v[ic]->energy() *
sin
(clusters_v[ic]->
position
().
theta
());
57
}
58
59
for
(
auto
is=0U; is<clustersSize; ++is) {
60
// check this seed was not already used
61
if
(usedSeed[is])
continue
;
62
auto
const
& currentSeed = clusters_v[is];
63
64
// Does our highest energy cluster have high enough energy?
65
// changed this to continue from break (to be robust against the order of sorting of the seed clusters)
66
if
(et[is] <
seedTransverseEnergyThreshold
)
continue
;
67
68
// if yes, make it a seed for a new SuperCluster:
69
double
energy
= (currentSeed)->
energy
();
70
math::XYZVector
position_((currentSeed)->
position
().
X
(),
71
(currentSeed)->
position
().Y(),
72
(currentSeed)->
position
().
Z
());
73
position_ *=
energy
;
74
usedSeed[is]=
true
;
75
76
LogTrace
(
"EcalClusters"
) <<
"*****************************"
;
77
LogTrace
(
"EcalClusters"
) <<
"******NEW SUPERCLUSTER*******"
;
78
LogTrace
(
"EcalClusters"
) <<
"Seed R = "
<< (currentSeed)->
position
().Rho();
79
80
reco::CaloClusterPtrVector
constituentClusters;
81
constituentClusters.
push_back
(currentSeed);
82
auto
ic = is + 1;
83
84
while
(ic < clustersSize) {
85
auto
const
& currentCluster = clusters_v[ic];
86
87
// if dynamic phi road is enabled then compute the phi road for a cluster
88
// of energy of existing clusters + the candidate cluster.
89
if
(
dynamicPhiRoad_
)
90
phiRoad =
phiRoadAlgo_
->
endcapPhiRoad
(energy + (currentCluster)->
energy
());
91
92
auto
dphi = [](
float
p1
,
float
p2
) {
93
auto
dp
=
std::abs
(p1-
p2
);
if
(
dp
>
float
(
M_PI
))
dp
-=float(2*
M_PI
);
94
return
std::abs
(
dp
);
95
};
96
97
auto
match
= [&](
int
i
,
int
j
) {
98
return
(dphi(phi[i],phi[
j
])< phiRoad) & (
std::abs
(eta[i]-eta[j])< etaRoad);
99
};
100
101
// does the cluster match the phi road for this candidate supercluster
102
if
(!usedSeed[ic] &&
match
(is,ic)) {
103
104
// add basic cluster to supercluster constituents
105
constituentClusters.
push_back
(currentCluster);
106
energy += (currentCluster)->
energy
();
107
position_ += (currentCluster)->
energy
() *
math::XYZVector
((currentCluster)->
position
().
X
(),
108
(currentCluster)->
position
().Y(),
109
(currentCluster)->
position
().
Z
()
110
);
111
// remove cluster from vector of available clusters
112
usedSeed[ic]=
true
;
113
LogTrace
(
"EcalClusters"
) <<
"Cluster R = "
<< (currentCluster)->
position
().Rho();
114
}
115
++ic;
116
}
117
118
position_ /=
energy
;
119
120
LogTrace
(
"EcalClusters"
) <<
"Final SuperCluster R = "
<< position_.Rho();
121
122
reco::SuperCluster
newSuperCluster(energy,
123
math::XYZPoint
(position_.X(), position_.Y(), position_.Z()),
124
currentSeed,
125
constituentClusters);
126
127
superclusters_v
.push_back(newSuperCluster);
128
LogTrace
(
"EcalClusters"
) <<
"created a new supercluster of: "
;
129
LogTrace
(
"EcalClusters"
) <<
"Energy = "
<< newSuperCluster.
energy
();
130
LogTrace
(
"EcalClusters"
) <<
"Position in (R, phi, theta) = ("
131
<< newSuperCluster.
position
().Rho() <<
", "
132
<< newSuperCluster.
position
().phi() <<
", "
133
<< newSuperCluster.
position
().theta() <<
")"
;
134
135
136
}
137
138
clusters_v.
clear
();
139
140
}
Gflash::Z
const double Z[kNumberCalorimeter]
Definition:
GflashNameSpace.h:58
reco::CaloCluster::position
const math::XYZPoint & position() const
cluster centroid position
Definition:
CaloCluster.h:126
i
int i
Definition:
DBlmapReader.cc:9
Multi5x5BremRecoveryClusterAlgo::makeIslandSuperClusters
void makeIslandSuperClusters(reco::CaloClusterPtrVector &clusters_v, double etaRoad, double phiRoad)
Definition:
Multi5x5BremRecoveryClusterAlgo.cc:41
MessageLogger.h
Multi5x5BremRecoveryClusterAlgo::eb_rdphi_
double eb_rdphi_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:69
edm::PtrVectorBase::size
size_type size() const
Size of the RefVector.
Definition:
PtrVectorBase.h:74
BremRecoveryPhiRoadAlgo.h
edm::PtrVector::push_back
void push_back(Ptr< T > const &iPtr)
Definition:
PtrVector.h:141
funct::sin
Sin< T >::type sin(const T &t)
Definition:
Sin.h:22
assert
assert(m_qm.get())
edm::PtrVectorBase::empty
bool empty() const
Is the RefVector empty.
Definition:
PtrVectorBase.h:71
theta
Geom::Theta< T > theta() const
Definition:
Basic3DVectorLD.h:170
X
#define X(str)
Definition:
MuonsGrabber.cc:48
Multi5x5BremRecoveryClusterAlgo::ec_rdeta_
double ec_rdeta_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:70
DDAxes::phi
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
j
int j
Definition:
DBlmapReader.cc:9
reco::CaloCluster::energy
double energy() const
cluster energy
Definition:
CaloCluster.h:121
reco::SuperCluster
Definition:
SuperCluster.h:19
Multi5x5BremRecoveryClusterAlgo::ec_rdphi_
double ec_rdphi_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:71
p2
double p2[4]
Definition:
TauolaWrapper.h:90
LogTrace
#define LogTrace(id)
Definition:
MessageLogger.h:502
eta
Definition:
HIMultiTrackSelector.h:42
M_PI
#define M_PI
Definition:
BXVectorInputProducer.cc:51
Multi5x5BremRecoveryClusterAlgo::seedTransverseEnergyThreshold
double seedTransverseEnergyThreshold
Definition:
Multi5x5BremRecoveryClusterAlgo.h:73
Multi5x5BremRecoveryClusterAlgo::dynamicPhiRoad_
bool dynamicPhiRoad_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:74
Multi5x5BremRecoveryClusterAlgo::superclusters_v
reco::SuperClusterCollection superclusters_v
Definition:
Multi5x5BremRecoveryClusterAlgo.h:77
BremRecoveryPhiRoadAlgo::endcapPhiRoad
double endcapPhiRoad(double energy)
Definition:
BremRecoveryPhiRoadAlgo.cc:42
math::XYZVector
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition:
Vector3D.h:30
reco::dp
auto dp
Definition:
deltaR.h:22
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:80
p1
double p1[4]
Definition:
TauolaWrapper.h:89
Vector3D.h
position
static int position[264][3]
Definition:
ReadPGInfo.cc:509
Multi5x5BremRecoveryClusterAlgo::eb_rdeta_
double eb_rdeta_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:68
reco::CaloCluster::multi5x5
Definition:
CaloCluster.h:32
relval_parameters_module.energy
string energy
Definition:
relval_parameters_module.py:29
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 >
Multi5x5BremRecoveryClusterAlgo::phiRoadAlgo_
BremRecoveryPhiRoadAlgo * phiRoadAlgo_
Definition:
Multi5x5BremRecoveryClusterAlgo.h:75
Multi5x5BremRecoveryClusterAlgo::makeSuperClusters
reco::SuperClusterCollection makeSuperClusters(const reco::CaloClusterPtrVector &clusters)
Definition:
Multi5x5BremRecoveryClusterAlgo.cc:5
Generated for CMSSW Reference Manual by
1.8.5