12 constexpr
float c_cm_per_ns = 29.9792458;
47 float MinTimeHits[361];
49 float MaxTimeHits[361];
52 for (
int i = 0;
i < 361;
i++) {
55 MinTimeHits[
i] = 9999.;
56 MaxTimeHits[
i] = -9999.;
71 auto cell = (TheSubGeometry) ? (TheSubGeometry->getGeometry(
id)) :
nullptr;
76 int iPhi = EcalID.
iphi();
81 SumE[iPhi] +=
hit->energy();
85 MinTimeHits[iPhi] =
time < MinTimeHits[iPhi] ?
time : MinTimeHits[iPhi];
86 MaxTimeHits[iPhi] =
time > MaxTimeHits[iPhi] ?
time : MaxTimeHits[iPhi];
92 for (
int iPhi = 1; iPhi < 361; iPhi++) {
95 PhiWedge wedge(SumE[iPhi], iPhi, NumHits[iPhi], MinTimeHits[iPhi], MaxTimeHits[iPhi]);
100 std::vector<const EcalRecHit*> Hits;
108 int Hit_iPhi = EcalID.iphi();
110 if (Hit_iPhi != iPhi)
112 Hits.push_back(&(*
hit));
115 float MinusToPlus = 0.;
116 float PlusToMinus = 0.;
117 for (
unsigned int i = 0;
i < Hits.size();
i++) {
120 int ieta_i = EcalID_i.
ieta();
121 for (
unsigned int j = (
i + 1);
j < Hits.size();
j++) {
124 int ieta_j = EcalID_j.
ieta();
126 PlusToMinus += TMath::Abs(ieta_j - ieta_i);
128 MinusToPlus += TMath::Abs(ieta_j - ieta_i);
132 float PlusZOriginConfidence = (PlusToMinus + MinusToPlus) ? PlusToMinus / (PlusToMinus + MinusToPlus) : -1.;
138 std::vector<float> vShowerShapes_Roundness;
139 std::vector<float> vShowerShapes_Angle;
140 if (TheSuperClusters.
isValid()) {
141 for (reco::SuperClusterCollection::const_iterator cluster = TheSuperClusters->begin();
142 cluster != TheSuperClusters->end();
144 if (
abs(cluster->eta()) <= 1.48) {
145 vector<float> shapes = EcalClusterTools::roundnessBarrelSuperClusters(*cluster, (*TheEBRecHits.
product()));
146 float roundness = shapes[0];
147 float angle = shapes[1];
152 bool BelongsToPhoton =
false;
154 for (reco::PhotonCollection::const_iterator iPhoton = ThePhotons->begin(); iPhoton != ThePhotons->end();
157 if (TheClusterRef == iPhoton->superCluster()) {
158 BelongsToPhoton =
true;
165 if (BelongsToPhoton) {
169 vShowerShapes_Roundness.push_back(shapes[0]);
170 vShowerShapes_Angle.push_back(shapes[1]);
172 vShowerShapes_Roundness.push_back(-1.);
173 vShowerShapes_Angle.push_back(-1.);
178 TheRoundnessFiller.
insert(TheSuperClusters, vShowerShapes_Roundness.begin(), vShowerShapes_Roundness.end());
179 TheRoundnessFiller.fill();
182 TheAngleFiller.
insert(TheSuperClusters, vShowerShapes_Angle.begin(), vShowerShapes_Angle.end());
183 TheAngleFiller.fill();
197 std::vector<HaloClusterCandidateECAL> haloclustercands_EB;
200 std::vector<HaloClusterCandidateECAL> haloclustercands_EE;
206 return TheEcalHaloData;
212 float et_thresh_seedrh) {
213 std::vector<HaloClusterCandidateECAL> TheHaloClusterCandsEB;
216 for (
size_t ihit = 0; ihit < ecalrechitcoll->
size(); ++ihit) {
219 const EcalRecHit& rechit = (*ecalrechitcoll)[ihit];
223 double rhet = rechit.
energy() *
sqrt(rhpos.perp2() / rhpos.mag2());
224 if (rhet < et_thresh_seedrh)
226 double eta = rhpos.eta();
227 double phi = rhpos.phi();
231 int nbcrystalsameeta(0);
232 double timediscriminator(0);
233 double etstrip_iphiseedplus1(0), etstrip_iphiseedminus1(0);
237 for (
size_t jhit = 0; jhit < ecalrechitcoll->
size(); ++jhit) {
238 const EcalRecHit& rechitj = (*ecalrechitcoll)[jhit];
242 double etaj = rhposj.eta();
243 double phij = rhposj.phi();
245 double deta =
eta - etaj;
252 double rhetj = rechitj.
energy() *
sqrt(rhposj.perp2() / rhposj.mag2());
267 etstrip_iphiseedplus1 += rhetj;
269 etstrip_iphiseedminus1 += rhetj;
279 double rhtj = rechitj.
time();
281 int rhietaj = detj.
ieta();
282 timediscriminator += std::log10(rhetj) *
283 (rhtj + 0.5 * (
sqrt(16900 + 9 * rhietaj * rhietaj) - 3 *
std::abs(rhietaj)) / c_cm_per_ns);
291 for (
size_t jhit = 0; jhit < hbherechitcoll->
size(); ++jhit) {
292 const HBHERecHit& rechitj = (*hbherechitcoll)[jhit];
294 double rhetj = rechitj.
energy() *
sqrt(rhposj.perp2() / rhposj.mag2());
297 double etaj = rhposj.eta();
298 double phij = rhposj.phi();
299 double deta =
eta - etaj;
305 hoe += rhetj / etcluster;
331 TheHaloClusterCandsEB.push_back(clustercand);
334 return TheHaloClusterCandsEB;
340 float et_thresh_seedrh) {
341 std::vector<HaloClusterCandidateECAL> TheHaloClusterCandsEE;
345 for (
size_t ihit = 0; ihit < ecalrechitcoll->
size(); ++ihit) {
348 const EcalRecHit& rechit = (*ecalrechitcoll)[ihit];
351 double rhet = rechit.
energy() *
sqrt(rhpos.perp2() / rhpos.mag2());
352 if (rhet < et_thresh_seedrh)
354 double eta = rhpos.eta();
355 double phi = rhpos.phi();
356 double rhr =
sqrt(rhpos.perp2());
360 double timediscriminator(0);
362 int nbcrystalssmallt(0);
363 int nbcrystalshight(0);
366 for (
size_t jhit = 0; jhit < ecalrechitcoll->
size(); ++jhit) {
367 const EcalRecHit& rechitj = (*ecalrechitcoll)[jhit];
372 if (rhposj.z() * rhpos.z() < 0)
375 double etaj = rhposj.eta();
376 double phij = rhposj.phi();
383 double rhetj = rechitj.
energy() *
sqrt(rhposj.perp2() / rhposj.mag2());
401 double rhtj = rechitj.
time();
411 double corrt_j = rhtj +
sqrt(rhposj.x() * rhposj.x() + rhposj.y() * rhposj.y() + 320. * 320.) / c_cm_per_ns -
416 timediscriminator += 0.5 * (
pow((corrt_j - 0.3) / 0.4, 2) -
pow((corrt_j - 0.) / 0.4, 2));
427 for (
size_t jhit = 0; jhit < hbherechitcoll->
size(); ++jhit) {
428 const HBHERecHit& rechitj = (*hbherechitcoll)[jhit];
432 if (rhposj.z() * rhpos.z() < 0)
438 double rhetj = rechitj.
energy() *
sqrt(rhposj.perp2() / rhposj.mag2());
442 double phij = rhposj.phi();
446 double rhrj =
sqrt(rhposj.perp2());
450 h2oe += rhetj / etcluster;
470 bool isbeamhalofrompattern =
474 bool isbeamhalofrompattern_hlt =
478 TheHaloClusterCandsEE.push_back(clustercand);
481 return TheHaloClusterCandsEE;
void setTimeDiscriminator(double x)
void setH2overE(double x)
edm::ValueMap< float > & GetShowerShapesRoundness()
int getNbLateCrystals() const
edm::ESGetToken< CaloGeometry, CaloGeometryRecord > geoToken_
EcalHaloAlgo(edm::ConsumesCollector iC)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void setClusterSize(int x)
edm::RefVector< reco::SuperClusterCollection > & GetSuperClusters()
int iphi() const
get the crystal iphi
edm::ValueMap< float > & GetShowerShapesAngle()
double getEtStripIPhiSeedMinus1() const
T const * product() const
void insert(const H &h, I begin, I end)
std::vector< EcalRecHit >::const_iterator const_iterator
void setNbLateCrystals(int x)
int getNbofCrystalsInEta() const
bool EEClusterShapeandTimeStudy_OTBH(reco::HaloClusterCandidateECAL hcand, bool ishlt)
constexpr float energy() const
void setIsHaloFromPattern(bool x)
int ieta() const
get the crystal ieta
float ESRecHitEnergyThreshold
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
void setNbEarlyCrystals(int x)
void setEtStripIPhiSeedMinus1(double x)
void setClusterEt(double x)
void setSeedTime(double x)
void setHaloClusterCandidatesEE(const std::vector< HaloClusterCandidateECAL > &x)
Abs< T >::type abs(const T &t)
void SetPlusZOriginConfidence(float x)
math::XYZPoint Point
point in the space
void setHaloClusterCandidatesEB(const std::vector< HaloClusterCandidateECAL > &x)
double getTimeDiscriminator() const
std::vector< reco::HaloClusterCandidateECAL > GetHaloClusterCandidateEB(edm::Handle< EcalRecHitCollection > &ecalrechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)
const_iterator begin() const
double getSeedTime() const
float EERecHitEnergyThreshold
void setSeedEta(double x)
const_iterator end() const
std::vector< reco::HaloClusterCandidateECAL > GetHaloClusterCandidateEE(edm::Handle< EcalRecHitCollection > &ecalrechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)
constexpr HcalDetId id() const
get the id
float EBRecHitEnergyThreshold
constexpr uint32_t rawId() const
get the raw id
XYZPointD XYZPoint
point in space with cartesian internal representation
void setSeedPhi(double x)
bool EEClusterShapeandTimeStudy_ITBH(reco::HaloClusterCandidateECAL hcand, bool ishlt)
reco::EcalHaloData Calculate(const CaloGeometry &TheCaloGeometry, edm::Handle< reco::PhotonCollection > &ThePhotons, edm::Handle< reco::SuperClusterCollection > &TheSuperClusters, edm::Handle< EBRecHitCollection > &TheEBRecHits, edm::Handle< EERecHitCollection > &TheEERecHits, edm::Handle< ESRecHitCollection > &TheESRecHits, edm::Handle< HBHERecHitCollection > &TheHBHERecHits, const edm::EventSetup &TheSetup)
DetId id() const
get the id
math::XYZPoint getPosition(const DetId &id, reco::Vertex::Point vtx)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
bool CompareTime(const EcalRecHit *x, const EcalRecHit *y)
void setBeamHaloRecHitsCandidates(edm::RefVector< EcalRecHitCollection > x)
bool EBClusterShapeandTimeStudy(reco::HaloClusterCandidateECAL hcand, bool ishlt)
int getClusterSize() const
void setIsHaloFromPattern_HLT(bool x)
double getEtStripIPhiSeedPlus1() const
int getNbEarlyCrystals() const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
const std::vector< PhiWedge > & GetPhiWedges() const
void setNbofCrystalsInEta(double x)
void setEtStripIPhiSeedPlus1(double x)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)