23 EBRecHitEnergyThreshold = 0.;
24 EERecHitEnergyThreshold = 0.;
25 ESRecHitEnergyThreshold = 0.;
26 SumEnergyThreshold = 0.;
42 float MinTimeHits[361];
44 float MaxTimeHits[361];
47 for(
int i = 0 ;
i < 361 ;
i++ )
51 MinTimeHits[
i] = 9999.;
52 MaxTimeHits[
i] = -9999.;
59 if (
hit->energy() < EBRecHitEnergyThreshold )
continue;
67 auto cell = (TheSubGeometry) ? (TheSubGeometry->getGeometry(
id)) :
nullptr;
73 int iPhi = EcalID.
iphi();
78 SumE[iPhi] +=
hit->energy();
82 MinTimeHits[iPhi] = time < MinTimeHits[iPhi] ? time : MinTimeHits[iPhi];
83 MaxTimeHits[iPhi] = time > MaxTimeHits[iPhi] ? time : MaxTimeHits[iPhi];
89 for(
int iPhi = 1 ; iPhi < 361; iPhi++ )
91 if( SumE[iPhi] >= SumEnergyThreshold && NumHits[iPhi] > NHitsThreshold )
94 PhiWedge wedge(SumE[iPhi], iPhi, NumHits[iPhi], MinTimeHits[iPhi], MaxTimeHits[iPhi]);
99 std::vector<const EcalRecHit*> Hits;
102 if (
hit->energy() < EBRecHitEnergyThreshold )
continue;
107 int Hit_iPhi = EcalID.iphi();
109 if( Hit_iPhi != iPhi )
continue;
110 Hits.push_back( &(*
hit) );
114 float MinusToPlus = 0.;
115 float PlusToMinus = 0.;
116 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++ )
125 int ieta_j = EcalID_j.
ieta();
126 if( ieta_i > ieta_j ) PlusToMinus +=
TMath::Abs(ieta_j - ieta_i );
127 else MinusToPlus +=
TMath::Abs(ieta_j -ieta_i) ;
131 float PlusZOriginConfidence = (PlusToMinus+MinusToPlus) ? PlusToMinus / (PlusToMinus+MinusToPlus) : -1.;
137 std::vector<float> vShowerShapes_Roundness;
138 std::vector<float> vShowerShapes_Angle ;
139 if(TheSuperClusters.
isValid()){
140 for(reco::SuperClusterCollection::const_iterator cluster = TheSuperClusters->begin() ; cluster != TheSuperClusters->end() ; cluster++ )
142 if(
abs(cluster->eta()) <= 1.48 )
144 vector<float> shapes = EcalClusterTools::roundnessBarrelSuperClusters( *cluster, (*TheEBRecHits.
product()));
145 float roundness = shapes[0];
146 float angle = shapes[1];
149 if( (roundness >=0 && roundness < GetRoundnessCut()) && angle >= 0 && angle < GetAngleCut() )
152 bool BelongsToPhoton =
false;
155 for(reco::PhotonCollection::const_iterator iPhoton = ThePhotons->begin() ; iPhoton != ThePhotons->end() ; iPhoton++ )
158 if ( TheClusterRef == iPhoton->superCluster() )
160 BelongsToPhoton =
true;
167 if( BelongsToPhoton )
172 vShowerShapes_Roundness.push_back(shapes[0]);
173 vShowerShapes_Angle.push_back(shapes[1]);
177 vShowerShapes_Roundness.push_back(-1.);
178 vShowerShapes_Angle.push_back(-1.);
184 TheRoundnessFiller.
insert( TheSuperClusters, vShowerShapes_Roundness.begin(), vShowerShapes_Roundness.end() );
185 TheRoundnessFiller.fill();
188 TheAngleFiller.
insert( TheSuperClusters, vShowerShapes_Angle.begin() , vShowerShapes_Angle.end() );
189 TheAngleFiller.fill();
205 std::vector<HaloClusterCandidateECAL> haloclustercands_EB;
206 haloclustercands_EB= GetHaloClusterCandidateEB(TheEBRecHits , TheHBHERecHits, 5);
208 std::vector<HaloClusterCandidateECAL> haloclustercands_EE;
209 haloclustercands_EE= GetHaloClusterCandidateEE(TheEERecHits , TheHBHERecHits, 10);
214 return TheEcalHaloData;
222 std::vector<HaloClusterCandidateECAL> TheHaloClusterCandsEB;
225 for(
size_t ihit = 0; ihit<ecalrechitcoll->
size(); ++ ihit){
228 const EcalRecHit & rechit = (*ecalrechitcoll)[ ihit ];
232 double rhet = rechit.
energy() *
sqrt(rhpos.perp2()/rhpos.mag2());
233 if(rhet<et_thresh_seedrh)
continue;
234 double eta = rhpos.eta();
235 double phi = rhpos.phi();
239 int nbcrystalsameeta(0);
240 double timediscriminator(0);
241 double etstrip_iphiseedplus1(0), etstrip_iphiseedminus1(0);
245 for(
size_t jhit = 0; jhit<ecalrechitcoll->
size(); ++ jhit){
246 const EcalRecHit & rechitj = (*ecalrechitcoll)[ jhit ];
250 double etaj = rhposj.eta();
251 double phij = rhposj.phi();
253 double deta = eta - etaj;
258 double rhetj = rechitj.
energy()*
sqrt(rhposj.perp2()/rhposj.mag2());
260 if(rhetj<1)
continue;
262 if(rhetj<2)
continue;
264 if(
std::abs(dphi)>0.03){isiso=
false;
break;}
265 if(
std::abs(dphi)<0.01) nbcrystalsameeta++;
266 if(dphi>0.01) etstrip_iphiseedplus1+=rhetj;
267 if(dphi<-0.01) etstrip_iphiseedminus1+=rhetj;
277 double rhtj = rechitj.
time();
279 int rhietaj= detj.
ieta();
280 timediscriminator+= std::log10( rhetj )* ( rhtj +0.5*(
sqrt(16900+9*rhietaj*rhietaj)-3*
std::abs(rhietaj))/c_cm_per_ns );
288 for(
size_t jhit = 0; jhit<hbherechitcoll->
size(); ++ jhit){
289 const HBHERecHit & rechitj = (*hbherechitcoll)[ jhit ];
291 double rhetj = rechitj.
energy()*
sqrt(rhposj.perp2()/rhposj.mag2());
292 if(rhetj<2)
continue;
293 double etaj = rhposj.eta();
294 double phij = rhposj.phi();
295 double deta = eta - etaj;
299 hoe+=rhetj/etcluster;
302 if(hoe>0.1)
continue;
320 bool isbeamhalofrompattern = EBClusterShapeandTimeStudy(clustercand,
false);
323 bool isbeamhalofrompattern_hlt = EBClusterShapeandTimeStudy(clustercand,
true);
327 TheHaloClusterCandsEB.push_back(clustercand);
330 return TheHaloClusterCandsEB;
338 std::vector<HaloClusterCandidateECAL> TheHaloClusterCandsEE;
342 for(
size_t ihit = 0; ihit<ecalrechitcoll->
size(); ++ ihit){
345 const EcalRecHit & rechit = (*ecalrechitcoll)[ ihit ];
348 double rhet = rechit.
energy()*
sqrt(rhpos.perp2()/rhpos.mag2());
349 if(rhet<et_thresh_seedrh)
continue;
350 double eta = rhpos.eta();
351 double phi = rhpos.phi();
352 double rhr =
sqrt(rhpos.perp2());
356 double timediscriminator(0);
358 int nbcrystalssmallt(0);
359 int nbcrystalshight(0);
362 for(
size_t jhit = 0; jhit<ecalrechitcoll->
size(); ++ jhit){
363 const EcalRecHit & rechitj = (*ecalrechitcoll)[ jhit ];
368 if(rhposj.z()*rhpos.z()<0)
continue;
370 double etaj = rhposj.eta();
371 double phij = rhposj.phi();
377 double rhetj = rechitj.
energy()*
sqrt(rhposj.perp2()/rhposj.mag2());
379 if(rhetj<1)
continue;
381 if(rhetj<2)
continue;
384 if(dr>0.05){isiso=
false;
break;}
390 double rhtj=rechitj.
time();
393 if(rhtj>1) nbcrystalshight++;
394 if(rhtj<0) nbcrystalssmallt++;
398 double corrt_j = rhtj +
sqrt(rhposj.x()*rhposj.x()+rhposj.y()*rhposj.y() + 320.*320.)/c_cm_per_ns - 320./c_cm_per_ns;
402 timediscriminator+= 0.5*(
pow( (corrt_j-0.3)/0.4,2)-
pow( (corrt_j-0.)/0.4,2));
413 for(
size_t jhit = 0; jhit<hbherechitcoll->
size(); ++ jhit){
414 const HBHERecHit & rechitj = (*hbherechitcoll)[ jhit ];
418 if(rhposj.z()*rhpos.z()<0)
continue;
420 if(
std::abs(rhposj.z())<425)
continue;
422 double rhetj = rechitj.
energy()*
sqrt(rhposj.perp2()/rhposj.mag2());
423 if(rhetj<2)
continue;
425 double phij = rhposj.phi();
428 double rhrj =
sqrt(rhposj.perp2());
431 h2oe+=rhetj/etcluster;
434 if(h2oe>0.1)
continue;
451 bool isbeamhalofrompattern = EEClusterShapeandTimeStudy_ITBH(clustercand,
false) || EEClusterShapeandTimeStudy_OTBH(clustercand,
false);
454 bool isbeamhalofrompattern_hlt = EEClusterShapeandTimeStudy_ITBH(clustercand,
true) || EEClusterShapeandTimeStudy_OTBH(clustercand,
true);
457 TheHaloClusterCandsEE.push_back(clustercand);
460 return TheHaloClusterCandsEE;
481 if(ishlt && hcand.
getSeedEt()<10)
return false;
498 if(ishlt)
return false;
513 if(hcand.
getSeedR()<100)
return false;
519 if(ishlt)
return false;
constexpr float energy() const
int getClusterSize() const
void setTimeDiscriminator(double x)
void setH2overE(double x)
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
edm::ValueMap< float > & GetShowerShapesRoundness()
int getNbLateCrystals() const
int getNbEarlyCrystals() const
const std::vector< PhiWedge > & GetPhiWedges() const
void setClusterSize(int x)
edm::RefVector< reco::SuperClusterCollection > & GetSuperClusters()
double getTimeDiscriminator() const
edm::ValueMap< float > & GetShowerShapesAngle()
HcalDetId id() const
get the id
void insert(const H &h, I begin, I end)
constexpr uint32_t rawId() const
get the raw id
std::vector< EcalRecHit >::const_iterator const_iterator
void setNbLateCrystals(int x)
bool EEClusterShapeandTimeStudy_OTBH(reco::HaloClusterCandidateECAL hcand, bool ishlt)
void setIsHaloFromPattern(bool x)
int iphi() const
get the crystal iphi
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)
std::vector< reco::HaloClusterCandidateECAL > GetHaloClusterCandidateEB(edm::Handle< EcalRecHitCollection > &ecalrechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)
int ieta() const
get the crystal ieta
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)
double getEtStripIPhiSeedPlus1() const
DetId id() const
get the id
T const * product() const
int getNbofCrystalsInEta() const
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)
math::XYZPoint getPosition(const DetId &id, reco::Vertex::Point vtx)
double getEtStripIPhiSeedMinus1() const
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)
double getSeedTime() const
void setIsHaloFromPattern_HLT(bool x)
T const * product() const
Power< A, B >::type pow(const A &a, const B &b)
const_iterator begin() const
void setNbofCrystalsInEta(double x)
void setEtStripIPhiSeedPlus1(double x)
T angle(T x1, T y1, T z1, T x2, T y2, T z2)