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;
70 cell = TheSubGeometry->getGeometry(
id);
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++ )
94 if( SumE[iPhi] >= SumEnergyThreshold && NumHits[iPhi] > NHitsThreshold )
97 PhiWedge wedge(SumE[iPhi], iPhi, NumHits[iPhi], MinTimeHits[iPhi], MaxTimeHits[iPhi]);
102 std::vector<const EcalRecHit*> Hits;
105 if (
hit->energy() < EBRecHitEnergyThreshold )
continue;
110 int Hit_iPhi = EcalID.iphi();
112 if( Hit_iPhi != iPhi )
continue;
113 Hits.push_back( &(*
hit) );
116 std::sort( Hits.begin() , Hits.end(),
CompareTime);
117 float MinusToPlus = 0.;
118 float PlusToMinus = 0.;
119 for(
unsigned int i = 0 ;
i < Hits.size() ;
i++ )
123 int ieta_i = EcalID_i.
ieta();
124 for(
unsigned int j = (
i+1) ;
j < Hits.size() ;
j++ )
128 int ieta_j = EcalID_j.
ieta();
129 if( ieta_i > ieta_j ) PlusToMinus +=
TMath::Abs(ieta_j - ieta_i );
130 else MinusToPlus +=
TMath::Abs(ieta_j -ieta_i) ;
134 float PlusZOriginConfidence = (PlusToMinus+MinusToPlus) ? PlusToMinus / (PlusToMinus+MinusToPlus) : -1.;
140 std::vector<float> vShowerShapes_Roundness;
141 std::vector<float> vShowerShapes_Angle ;
142 if(TheSuperClusters.
isValid()){
143 for(reco::SuperClusterCollection::const_iterator cluster = TheSuperClusters->begin() ; cluster != TheSuperClusters->end() ; cluster++ )
145 if(
abs(cluster->eta()) <= 1.48 )
147 vector<float> shapes = EcalClusterTools::roundnessBarrelSuperClusters( *cluster, (*TheEBRecHits.
product()));
148 float roundness = shapes[0];
149 float angle = shapes[1];
152 if( (roundness >=0 && roundness < GetRoundnessCut()) && angle >= 0 && angle < GetAngleCut() )
155 bool BelongsToPhoton =
false;
158 for(reco::PhotonCollection::const_iterator iPhoton = ThePhotons->begin() ; iPhoton != ThePhotons->end() ; iPhoton++ )
161 if ( TheClusterRef == iPhoton->superCluster() )
163 BelongsToPhoton =
true;
170 if( BelongsToPhoton )
175 vShowerShapes_Roundness.push_back(shapes[0]);
176 vShowerShapes_Angle.push_back(shapes[1]);
180 vShowerShapes_Roundness.push_back(-1.);
181 vShowerShapes_Angle.push_back(-1.);
187 TheRoundnessFiller.
insert( TheSuperClusters, vShowerShapes_Roundness.begin(), vShowerShapes_Roundness.end() );
188 TheRoundnessFiller.fill();
191 TheAngleFiller.
insert( TheSuperClusters, vShowerShapes_Angle.begin() , vShowerShapes_Angle.end() );
192 TheAngleFiller.fill();
211 std::vector<HaloClusterCandidateECAL> haloclustercands_EB;
212 haloclustercands_EB= GetHaloClusterCandidateEB(TheEBRecHits , TheHBHERecHits, 5);
214 std::vector<HaloClusterCandidateECAL> haloclustercands_EE;
215 haloclustercands_EE= GetHaloClusterCandidateEE(TheEERecHits , TheHBHERecHits, 10);
220 return TheEcalHaloData;
228 std::vector<HaloClusterCandidateECAL> TheHaloClusterCandsEB;
231 for(
size_t ihit = 0; ihit<ecalrechitcoll->
size(); ++ ihit){
234 const EcalRecHit & rechit = (*ecalrechitcoll)[ ihit ];
238 double rhet = rechit.
energy() *
sqrt(rhpos.perp2()/rhpos.mag2());
239 if(rhet<et_thresh_seedrh)
continue;
240 double eta = rhpos.eta();
241 double phi = rhpos.phi();
245 int nbcrystalsameeta(0);
246 double timediscriminator(0);
247 double etstrip_iphiseedplus1(0), etstrip_iphiseedminus1(0);
251 for(
size_t jhit = 0; jhit<ecalrechitcoll->
size(); ++ jhit){
252 const EcalRecHit & rechitj = (*ecalrechitcoll)[ jhit ];
256 double etaj = rhposj.eta();
257 double phij = rhposj.phi();
259 double deta = eta - etaj;
264 double rhetj = rechitj.
energy()*
sqrt(rhposj.perp2()/rhposj.mag2());
266 if(rhetj<1)
continue;
268 if(rhetj<2)
continue;
270 if(
std::abs(dphi)>0.03){isiso=
false;
break;}
271 if(
std::abs(dphi)<0.01) nbcrystalsameeta++;
272 if(dphi>0.01) etstrip_iphiseedplus1+=rhetj;
273 if(dphi<-0.01) etstrip_iphiseedminus1+=rhetj;
283 double rhtj = rechitj.
time();
285 int rhietaj= detj.
ieta();
286 timediscriminator+= std::log10( rhetj )* ( rhtj +0.5*(
sqrt(16900+9*rhietaj*rhietaj)-3*
std::abs(rhietaj))/c_cm_per_ns );
294 for(
size_t jhit = 0; jhit<hbherechitcoll->
size(); ++ jhit){
295 const HBHERecHit & rechitj = (*hbherechitcoll)[ jhit ];
297 double rhetj = rechitj.
energy()*
sqrt(rhposj.perp2()/rhposj.mag2());
298 if(rhetj<2)
continue;
299 double etaj = rhposj.eta();
300 double phij = rhposj.phi();
301 double deta = eta - etaj;
305 hoe+=rhetj/etcluster;
308 if(hoe>0.1)
continue;
326 bool isbeamhalofrompattern = EBClusterShapeandTimeStudy(clustercand,
false);
329 bool isbeamhalofrompattern_hlt = EBClusterShapeandTimeStudy(clustercand,
true);
333 TheHaloClusterCandsEB.push_back(clustercand);
336 return TheHaloClusterCandsEB;
344 std::vector<HaloClusterCandidateECAL> TheHaloClusterCandsEE;
348 for(
size_t ihit = 0; ihit<ecalrechitcoll->
size(); ++ ihit){
351 const EcalRecHit & rechit = (*ecalrechitcoll)[ ihit ];
354 double rhet = rechit.
energy()*
sqrt(rhpos.perp2()/rhpos.mag2());
355 if(rhet<et_thresh_seedrh)
continue;
356 double eta = rhpos.eta();
357 double phi = rhpos.phi();
358 double rhr =
sqrt(rhpos.perp2());
362 double timediscriminator(0);
364 int nbcrystalssmallt(0);
365 int nbcrystalshight(0);
368 for(
size_t jhit = 0; jhit<ecalrechitcoll->
size(); ++ jhit){
369 const EcalRecHit & rechitj = (*ecalrechitcoll)[ jhit ];
374 if(rhposj.z()*rhpos.z()<0)
continue;
376 double etaj = rhposj.eta();
377 double phij = rhposj.phi();
383 double rhetj = rechitj.
energy()*
sqrt(rhposj.perp2()/rhposj.mag2());
385 if(rhetj<1)
continue;
387 if(rhetj<2)
continue;
390 if(dr>0.05){isiso=
false;
break;}
396 double rhtj=rechitj.
time();
399 if(rhtj>1) nbcrystalshight++;
400 if(rhtj<0) nbcrystalssmallt++;
404 double corrt_j = rhtj +
sqrt(rhposj.x()*rhposj.x()+rhposj.y()*rhposj.y() + 320.*320.)/c_cm_per_ns - 320./c_cm_per_ns;
408 timediscriminator+= 0.5*(
pow( (corrt_j-0.3)/0.4,2)-
pow( (corrt_j-0.)/0.4,2));
419 for(
size_t jhit = 0; jhit<hbherechitcoll->
size(); ++ jhit){
420 const HBHERecHit & rechitj = (*hbherechitcoll)[ jhit ];
424 if(rhposj.z()*rhpos.z()<0)
continue;
426 if(
std::abs(rhposj.z())<425)
continue;
428 double rhetj = rechitj.
energy()*
sqrt(rhposj.perp2()/rhposj.mag2());
429 if(rhetj<2)
continue;
431 double phij = rhposj.phi();
434 double rhrj =
sqrt(rhposj.perp2());
437 h2oe+=rhetj/etcluster;
440 if(h2oe>0.1)
continue;
457 bool isbeamhalofrompattern = EEClusterShapeandTimeStudy_ITBH(clustercand,
false) || EEClusterShapeandTimeStudy_OTBH(clustercand,
false);
460 bool isbeamhalofrompattern_hlt = EEClusterShapeandTimeStudy_ITBH(clustercand,
true) || EEClusterShapeandTimeStudy_OTBH(clustercand,
true);
463 TheHaloClusterCandsEE.push_back(clustercand);
466 return TheHaloClusterCandsEE;
487 if(ishlt && hcand.
getSeedEt()<10)
return false;
504 if(ishlt)
return false;
519 if(hcand.
getSeedR()<100)
return false;
525 if(ishlt)
return false;
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)
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
uint32_t rawId() const
get the raw 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)
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)