CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
HcalHaloAlgo Class Reference

#include <HcalHaloAlgo.h>

Public Member Functions

reco::HcalHaloData Calculate (const CaloGeometry &TheCaloGeometry, edm::Handle< HBHERecHitCollection > &TheHBHERecHits, edm::Handle< CaloTowerCollection > &TheCaloTowers, edm::Handle< EBRecHitCollection > &TheEBRecHits, edm::Handle< EERecHitCollection > &TheEERecHits, const edm::EventSetup &TheSetup)
 
reco::HcalHaloData Calculate (const CaloGeometry &TheCaloGeometry, edm::Handle< HBHERecHitCollection > &TheHBHERecHits, edm::Handle< EBRecHitCollection > &TheEBRecHits, edm::Handle< EERecHitCollection > &TheEERecHits, const edm::EventSetup &TheSetup)
 
std::vector< reco::HaloClusterCandidateHCALGetHaloClusterCandidateHB (edm::Handle< EcalRecHitCollection > &ebrechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)
 
std::vector< reco::HaloClusterCandidateHCALGetHaloClusterCandidateHE (edm::Handle< EcalRecHitCollection > &eerechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)
 
float GetHBRecHitEnergyThreshold ()
 
float GetHERecHitEnergyThreshold ()
 
float GetPhiWedgeEnergyThreshold ()
 
int GetPhiWedgeNHitsThreshold ()
 
bool HBClusterShapeandTimeStudy (reco::HaloClusterCandidateHCAL hcand, bool ishlt)
 
 HcalHaloAlgo ()
 
bool HEClusterShapeandTimeStudy (reco::HaloClusterCandidateHCAL hcand, bool ishlt)
 
void SetPhiWedgeEnergyThreshold (float SumE)
 
void SetPhiWedgeNHitsThreshold (int nhits)
 
void SetPhiWedgeThresholds (float SumE, int nhits)
 
void SetRecHitEnergyThresholds (float HB, float HE)
 
 ~HcalHaloAlgo ()
 

Private Member Functions

math::XYZPoint getPosition (const DetId &id, reco::Vertex::Point vtx)
 

Private Attributes

const CaloGeometrygeo_
 
float HBRecHitEnergyThreshold
 
float HERecHitEnergyThreshold
 
const HcalGeometryhgeo_
 
int NHitsThreshold
 
float SumEnergyThreshold
 

Detailed Description

Definition at line 41 of file HcalHaloAlgo.h.

Constructor & Destructor Documentation

HcalHaloAlgo::HcalHaloAlgo ( )

Definition at line 23 of file HcalHaloAlgo.cc.

References HBRecHitEnergyThreshold, HERecHitEnergyThreshold, NHitsThreshold, and SumEnergyThreshold.

23  : geo_(0), hgeo_(0)
24 {
27  SumEnergyThreshold = 0.;
28  NHitsThreshold = 0;
29 }
float HERecHitEnergyThreshold
Definition: HcalHaloAlgo.h:80
const CaloGeometry * geo_
Definition: HcalHaloAlgo.h:86
float HBRecHitEnergyThreshold
Definition: HcalHaloAlgo.h:79
const HcalGeometry * hgeo_
Definition: HcalHaloAlgo.h:87
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:83
int NHitsThreshold
Definition: HcalHaloAlgo.h:84
HcalHaloAlgo::~HcalHaloAlgo ( )
inline

Definition at line 46 of file HcalHaloAlgo.h.

References Calculate().

46 {}

Member Function Documentation

HcalHaloData HcalHaloAlgo::Calculate ( const CaloGeometry TheCaloGeometry,
edm::Handle< HBHERecHitCollection > &  TheHBHERecHits,
edm::Handle< CaloTowerCollection > &  TheCaloTowers,
edm::Handle< EBRecHitCollection > &  TheEBRecHits,
edm::Handle< EERecHitCollection > &  TheEERecHits,
const edm::EventSetup TheSetup 
)

Definition at line 36 of file HcalHaloAlgo.cc.

References funct::abs(), Abs(), edm::SortedCollection< T, SORT >::begin(), CompareTime(), CompareTowers(), CaloTower::emEt(), edm::SortedCollection< T, SORT >::end(), F(), geo_, edm::EventSetup::get(), GetHaloClusterCandidateHB(), GetHaloClusterCandidateHE(), reco::HcalHaloData::GetPhiWedges(), reco::HcalHaloData::getProblematicStrips(), CaloGeometry::getSubdetectorGeometry(), CaloTower::hadEt(), HBRecHitEnergyThreshold, DetId::Hcal, HcalBarrel, HcalEndcap, HERecHitEnergyThreshold, hgeo_, mps_fire::i, hit::id, CaloTower::id(), HcalDetId::ieta(), CaloTower::ieta(), CaloTower::iphi(), hpstanc_transforms::max, NHitsThreshold, CaloTower::numProblematicHcalCells(), edm::ESHandle< T >::product(), reco::HcalHaloData::setHaloClusterCandidatesHB(), reco::HcalHaloData::setHaloClusterCandidatesHE(), reco::PhiWedge::SetPlusZOriginConfidence(), digi_MixPreMix_cfi::strip, SumEnergyThreshold, and ntuplemaker::time.

Referenced by Calculate(), reco::HcalHaloDataProducer::produce(), and ~HcalHaloAlgo().

37 {
38 
39  HcalHaloData TheHcalHaloData;
40 
41  // Store Energy sum of rechits as a function of iPhi (iPhi goes from 1 to 72)
42  float SumE[73];
43  // Store Number of rechits as a function of iPhi
44  int NumHits[73];
45  // Store minimum time of rechit as a function of iPhi
46  float MinTimeHits[73];
47  // Store maximum time of rechit as a function of iPhi
48  float MaxTimeHits[73];
49  for(unsigned int i = 0 ; i < 73 ; i++ )
50  {
51  SumE[i] = 0;
52  NumHits[i]= 0;
53  MinTimeHits[i] = 0.;
54  MaxTimeHits[i] = 0.;
55  }
56 
57  for( HBHERecHitCollection::const_iterator hit = TheHBHERecHits->begin() ; hit != TheHBHERecHits->end() ; hit++ )
58  {
59  HcalDetId id = HcalDetId(hit->id());
60  switch ( id.subdet() )
61  {
62  case HcalBarrel:
63  if(hit->energy() < HBRecHitEnergyThreshold )continue;
64  break;
65  case HcalEndcap:
66  if(hit->energy() < HERecHitEnergyThreshold ) continue;
67  break;
68  default:
69  continue;
70  }
71 
72  int iEta = id.ieta();
73  int iPhi = id.iphi();
74  if(iPhi < 73 && TMath::Abs(iEta) < 23 )
75  {
76  SumE[iPhi]+= hit->energy();
77  NumHits[iPhi] ++;
78 
79  float time = hit->time();
80  MinTimeHits[iPhi] = time < MinTimeHits[iPhi] ? time : MinTimeHits[iPhi];
81  MaxTimeHits[iPhi] = time > MaxTimeHits[iPhi] ? time : MaxTimeHits[iPhi];
82  }
83  }
84 
85  for( int iPhi = 1 ; iPhi < 73 ; iPhi++ )
86  {
87  if( SumE[iPhi] >= SumEnergyThreshold && NumHits[iPhi] > NHitsThreshold )
88  {
89  // Build PhiWedge and store to HcalHaloData if energy or #hits pass thresholds
90  PhiWedge wedge(SumE[iPhi], iPhi, NumHits[iPhi], MinTimeHits[iPhi], MaxTimeHits[iPhi]);
91 
92  // Loop over rechits again to calculate direction based on timing info
93  std::vector<const HBHERecHit*> Hits;
94  for( HBHERecHitCollection::const_iterator hit = TheHBHERecHits->begin() ; hit != TheHBHERecHits->end() ; hit++ )
95  {
96 
97  HcalDetId id = HcalDetId(hit->id());
98  if( id.iphi() != iPhi ) continue;
99  if( TMath::Abs(id.ieta() ) > 22 ) continue; // has to overlap geometrically w/ HB
100  switch ( id.subdet() )
101  {
102  case HcalBarrel:
103  if(hit->energy() < HBRecHitEnergyThreshold )continue;
104  break;
105  case HcalEndcap:
106  if(hit->energy() < HERecHitEnergyThreshold ) continue;
107  break;
108  default:
109  continue;
110  }
111  Hits.push_back(&(*hit));
112  }
113 
114  std::sort( Hits.begin() , Hits.end() , CompareTime);
115  float MinusToPlus = 0.;
116  float PlusToMinus = 0.;
117  for( unsigned int i = 0 ; i < Hits.size() ; i++ )
118  {
119  HcalDetId id_i = HcalDetId(Hits[i]->id() );
120  int ieta_i = id_i.ieta();
121  for( unsigned int j = (i+1) ; j < Hits.size() ; j++ )
122  {
123  HcalDetId id_j = HcalDetId(Hits[j]->id() );
124  int ieta_j = id_j.ieta();
125  if( ieta_i > ieta_j ) PlusToMinus += TMath::Abs(ieta_i - ieta_j ) ;
126  else MinusToPlus += TMath::Abs(ieta_i - ieta_j);
127  }
128  }
129  float PlusZOriginConfidence = (PlusToMinus + MinusToPlus )? PlusToMinus / ( PlusToMinus + MinusToPlus ) : -1. ;
130  wedge.SetPlusZOriginConfidence( PlusZOriginConfidence );
131  TheHcalHaloData.GetPhiWedges().push_back( wedge );
132  }
133  }
134 
135 
136  // Don't use HF.
137  int maxAbsIEta = 29;
138 
139 
140  std::map<int, float> iPhiHadEtMap;
141  std::vector<const CaloTower*> sortedCaloTowers;
142  for(CaloTowerCollection::const_iterator tower = TheCaloTowers->begin(); tower != TheCaloTowers->end(); tower++) {
143  if(std::abs(tower->ieta()) > maxAbsIEta) continue;
144 
145  int iPhi = tower->iphi();
146  if(!iPhiHadEtMap.count(iPhi)) iPhiHadEtMap[iPhi] = 0.0;
147  iPhiHadEtMap[iPhi] += tower->hadEt();
148 
149  if(tower->numProblematicHcalCells() > 0) sortedCaloTowers.push_back(&(*tower));
150 
151  }
152 
153 
154  // Sort towers such that lowest iphi and ieta are first, highest last, and towers
155  // with same iphi value are consecutive. Then we can do everything else in one loop.
156  std::sort(sortedCaloTowers.begin(), sortedCaloTowers.end(), CompareTowers);
157 
159 
160 
161  int prevIEta = -99, prevIPhi = -99;
162  float prevHadEt = 0.;
163  float prevEmEt = 0.;
164  std::pair<uint8_t, CaloTowerDetId> prevPair, towerPair;
165  bool wasContiguous = true;
166 
167  // Loop through and store a vector of pairs (problematicCells, DetId) for each contiguous strip we find
168  for(unsigned int i = 0; i < sortedCaloTowers.size(); i++) {
169  const CaloTower* tower = sortedCaloTowers[i];
170 
171  towerPair = std::make_pair((uint8_t)tower->numProblematicHcalCells(), tower->id());
172 
173  bool newIPhi = tower->iphi() != prevIPhi;
174  bool isContiguous = tower->ieta() == 1 ? tower->ieta() - 2 == prevIEta : tower->ieta() - 1 == prevIEta;
175 
176  isContiguous = isContiguous || (tower->ieta() == -maxAbsIEta);
177  if(newIPhi) isContiguous = false;
178 
179  if(!wasContiguous && isContiguous) {
180  strip.cellTowerIds.push_back(prevPair);
181  strip.cellTowerIds.push_back(towerPair);
182  strip.hadEt += prevHadEt + tower->hadEt();
183  strip.emEt += prevEmEt + tower->emEt();
184  }
185 
186  if(wasContiguous && isContiguous) {
187  strip.cellTowerIds.push_back(towerPair);
188  strip.hadEt += tower->hadEt();
189  strip.emEt += tower->emEt();
190  }
191 
192  if((wasContiguous && !isContiguous) || i == sortedCaloTowers.size()-1) { //ended the strip, so flush it
193 
194  if(strip.cellTowerIds.size() > 3) {
195 
196  int iPhi = strip.cellTowerIds.at(0).second.iphi();
197  int iPhiLower = (iPhi == 1) ? 72 : iPhi - 1;
198  int iPhiUpper = (iPhi == 72) ? 1 : iPhi + 1;
199 
200  float energyRatio = 0.0;
201  if(iPhiHadEtMap.count(iPhiLower)) energyRatio += iPhiHadEtMap[iPhiLower];
202  if(iPhiHadEtMap.count(iPhiUpper)) energyRatio += iPhiHadEtMap[iPhiUpper];
203  iPhiHadEtMap[iPhi] = std::max(iPhiHadEtMap[iPhi], 0.001F);
204 
205  energyRatio /= iPhiHadEtMap[iPhi];
206  strip.energyRatio = energyRatio;
207 
208  TheHcalHaloData.getProblematicStrips().push_back( strip );
209 
210  }
211  strip = HaloTowerStrip();
212  }
213 
214  wasContiguous = isContiguous;
215  prevPair = towerPair;
216  prevEmEt = tower->emEt();
217  prevIPhi = tower->iphi();
218  prevIEta = tower->ieta();
219  prevHadEt = tower->hadEt();
220  }
221 
223  TheSetup.get<CaloGeometryRecord>().get(pGeo);
224  geo_ = pGeo.product();
225  hgeo_ = dynamic_cast<const HcalGeometry*>(geo_->getSubdetectorGeometry(DetId::Hcal, 1));
226 
227  //Halo cluster building:
228  //Various clusters are built, depending on the subdetector.
229  //In barrel, one looks for deposits narrow in phi.
230  //In endcaps, one looks for localized deposits (dr condition in EE where r =sqrt(dphi*dphi+deta*deta)
231  //E/H condition is also applied.
232  //The halo cluster building step targets a large efficiency (ideally >99%) for beam halo deposits.
233  //These clusters are used as input for the halo pattern finding methods in HcalHaloAlgo and for the CSC-calo matching methods in GlobalHaloAlgo.
234 
235  //Et threshold hardcoded for now. Might one to get it from config
236 
237  std::vector<HaloClusterCandidateHCAL> haloclustercands_HB;
238  haloclustercands_HB= GetHaloClusterCandidateHB(TheEBRecHits , TheHBHERecHits, 5);
239 
240  std::vector<HaloClusterCandidateHCAL> haloclustercands_HE;
241  haloclustercands_HE= GetHaloClusterCandidateHE(TheEERecHits , TheHBHERecHits, 10);
242 
243  TheHcalHaloData.setHaloClusterCandidatesHB(haloclustercands_HB);
244  TheHcalHaloData.setHaloClusterCandidatesHE(haloclustercands_HE);
245 
246 
247  return TheHcalHaloData;
248 
249 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:45
float HERecHitEnergyThreshold
Definition: HcalHaloAlgo.h:80
void setHaloClusterCandidatesHB(const std::vector< HaloClusterCandidateHCAL > &x)
Definition: HcalHaloData.h:61
int ieta() const
Definition: CaloTower.h:185
double hadEt() const
Definition: CaloTower.h:116
std::vector< HBHERecHit >::const_iterator const_iterator
int iphi() const
Definition: CaloTower.h:187
std::vector< reco::HaloClusterCandidateHCAL > GetHaloClusterCandidateHE(edm::Handle< EcalRecHitCollection > &eerechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)
const CaloGeometry * geo_
Definition: HcalHaloAlgo.h:86
T Abs(T a)
Definition: MathUtil.h:49
int ieta() const
get the cell ieta
Definition: HcalDetId.h:56
void setHaloClusterCandidatesHE(const std::vector< HaloClusterCandidateHCAL > &x)
Definition: HcalHaloData.h:62
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool CompareTime(const HBHERecHit *x, const HBHERecHit *y)
Definition: HcalHaloAlgo.cc:18
unsigned int id
const_iterator end() const
CaloTowerDetId id() const
Definition: CaloTower.h:103
unsigned int numProblematicHcalCells() const
Definition: CaloTower.h:202
const T & get() const
Definition: EventSetup.h:55
bool CompareTowers(const CaloTower *x, const CaloTower *y)
Definition: HcalHaloAlgo.cc:19
float HBRecHitEnergyThreshold
Definition: HcalHaloAlgo.h:79
const HcalGeometry * hgeo_
Definition: HcalHaloAlgo.h:87
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:83
const std::vector< HaloTowerStrip > & getProblematicStrips() const
Definition: HcalHaloData.h:52
const std::vector< PhiWedge > & GetPhiWedges() const
Definition: HcalHaloData.h:48
int NHitsThreshold
Definition: HcalHaloAlgo.h:84
static uInt32 F(BLOWFISH_CTX *ctx, uInt32 x)
Definition: blowfish.cc:281
T const * product() const
Definition: ESHandle.h:86
double emEt() const
Definition: CaloTower.h:115
const_iterator begin() const
std::vector< reco::HaloClusterCandidateHCAL > GetHaloClusterCandidateHB(edm::Handle< EcalRecHitCollection > &ebrechitcoll, edm::Handle< HBHERecHitCollection > &hbherechitcoll, float et_thresh_seedrh)
HcalHaloData HcalHaloAlgo::Calculate ( const CaloGeometry TheCaloGeometry,
edm::Handle< HBHERecHitCollection > &  TheHBHERecHits,
edm::Handle< EBRecHitCollection > &  TheEBRecHits,
edm::Handle< EERecHitCollection > &  TheEERecHits,
const edm::EventSetup TheSetup 
)

Definition at line 31 of file HcalHaloAlgo.cc.

References Calculate().

31  {
33  return Calculate(TheCaloGeometry, TheHBHERecHits, TheCaloTowers,TheEBRecHits,TheEERecHits,TheSetup);
34 }
reco::HcalHaloData Calculate(const CaloGeometry &TheCaloGeometry, edm::Handle< HBHERecHitCollection > &TheHBHERecHits, edm::Handle< CaloTowerCollection > &TheCaloTowers, edm::Handle< EBRecHitCollection > &TheEBRecHits, edm::Handle< EERecHitCollection > &TheEERecHits, const edm::EventSetup &TheSetup)
Definition: HcalHaloAlgo.cc:36
std::vector< HaloClusterCandidateHCAL > HcalHaloAlgo::GetHaloClusterCandidateHB ( edm::Handle< EcalRecHitCollection > &  ebrechitcoll,
edm::Handle< HBHERecHitCollection > &  hbherechitcoll,
float  et_thresh_seedrh 
)

Definition at line 258 of file HcalHaloAlgo.cc.

References funct::abs(), hiPixelPairStep_cff::deltaPhi, CaloRecHit::energy(), EcalRecHit::energy(), PVValHelper::eta, getPosition(), HBClusterShapeandTimeStudy(), HBHERecHit::id(), EcalRecHit::id(), phi, edm::RefVector< C, T, F >::push_back(), reco::HaloClusterCandidateHCAL::setBeamHaloRecHitsCandidates(), reco::HaloClusterCandidateHCAL::setClusterEt(), reco::HaloClusterCandidateHCAL::setEoverH(), reco::HaloClusterCandidateHCAL::setEtStripPhiSeedMinus1(), reco::HaloClusterCandidateHCAL::setEtStripPhiSeedPlus1(), reco::HaloClusterCandidateHCAL::setIsHaloFromPattern(), reco::HaloClusterCandidateHCAL::setIsHaloFromPattern_HLT(), reco::HaloClusterCandidateHCAL::setNbTowersInEta(), reco::HaloClusterCandidateHCAL::setSeedEt(), reco::HaloClusterCandidateHCAL::setSeedEta(), reco::HaloClusterCandidateHCAL::setSeedPhi(), reco::HaloClusterCandidateHCAL::setSeedR(), reco::HaloClusterCandidateHCAL::setSeedTime(), reco::HaloClusterCandidateHCAL::setSeedZ(), reco::HaloClusterCandidateHCAL::setTimeDiscriminatorITBH(), reco::HaloClusterCandidateHCAL::setTimeDiscriminatorOTBH(), edm::SortedCollection< T, SORT >::size(), mathSSE::sqrt(), CaloRecHit::time(), and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by Calculate(), and GetPhiWedgeNHitsThreshold().

258  {
259 
260  std::vector<HaloClusterCandidateHCAL> TheHaloClusterCandsHB;
261 
262  reco::Vertex::Point vtx(0,0,0);
263 
264  for(size_t ihit = 0; ihit<hbherechitcoll->size(); ++ ihit){
265  HaloClusterCandidateHCAL clustercand;
266 
267  const HBHERecHit & rechit = (*hbherechitcoll)[ ihit ];
268  math::XYZPoint rhpos = getPosition(rechit.id(),vtx);
269  //Et condition
270  double rhet = rechit.energy()* sqrt(rhpos.perp2()/rhpos.mag2());
271  if(rhet<et_thresh_seedrh) continue;
272  if(std::abs(rhpos.z())>zseparation_HBHE) continue;
273  double eta = rhpos.eta();
274  double phi = rhpos.phi();
275 
276  bool isiso = true;
277  double etcluster(0);
278  int nbtowerssameeta(0);
279  double timediscriminatorITBH(0),timediscriminatorOTBH(0);
280  double etstrip_phiseedplus1(0), etstrip_phiseedminus1(0);
281 
282  //Building the cluster
284  for(size_t jhit = 0; jhit<hbherechitcoll->size(); ++ jhit){
285  const HBHERecHit & rechitj = (*hbherechitcoll)[ jhit ];
286  HBHERecHitRef rhRef(hbherechitcoll,jhit);
287  math::XYZPoint rhposj = getPosition(rechitj.id(),vtx);
288  double rhetj = rechitj.energy()* sqrt(rhposj.perp2()/rhposj.mag2());
289  if(rhetj<2) continue;
290  if(std::abs(rhposj.z())>zseparation_HBHE) continue;
291  double etaj = rhposj.eta();
292  double phij = rhposj.phi();
293  double deta = eta - etaj;
294  double dphi = deltaPhi(phi,phij);
295  if(std::abs(deta)>0.4) continue;//This means +/-4 towers in eta
296  if(std::abs(dphi)>0.2) continue;//This means +/-2 towers in phi
297  if(std::abs(dphi)>0.1&&std::abs(deta)<0.2){isiso=false;break;}//The strip should be isolated
298  if(std::abs(dphi)>0.1)continue;
299  if(std::abs(dphi)<0.05) nbtowerssameeta++;
300  if(dphi>0.05) etstrip_phiseedplus1+=rhetj;
301  if(dphi<-0.05) etstrip_phiseedminus1+=rhetj;
302 
303  etcluster+=rhetj;
304  //Timing discriminator
305  //We assign a weight to the rechit defined as:
306  //Log10(Et)*f(T,R,Z)
307  //where f(T,R,Z) is the separation curve between halo-like and IP-like times.
308  //The time difference between a deposit from a outgoing IT halo and a deposit coming from a particle emitted at the IP is given by:
309  //dt= ( - sqrt(R^2+z^2) + |z| )/c
310  // For OT beam halo, the time difference is:
311  //dt= ( 25 + sqrt(R^2+z^2) + |z| )/c
312  //only consider the central part of HB as things get hard at large z.
313  //The best fitted value for R leads to 240 cm (IT) and 330 cm (OT)
314  double rhtj = rechitj.time();
315  timediscriminatorITBH+= std::log10( rhetj )* ( rhtj +0.5*(sqrt(240.*240.+rhposj.z()*rhposj.z()) -std::abs(rhposj.z()))/c_cm_per_ns);
316  if(std::abs(rhposj.z())<300) timediscriminatorOTBH+= std::log10( rhetj )* ( rhtj -0.5*(25-(sqrt(330.*330.+rhposj.z()*rhposj.z()) +std::abs(rhposj.z()))/c_cm_per_ns) );
317  bhrhcandidates.push_back(rhRef);
318  }
319  //Isolation conditions
320  if(!isiso) continue;
321  if(etstrip_phiseedplus1/etcluster>0.2&& etstrip_phiseedminus1/etcluster>0.2) continue;
322 
323  //Calculate E/H
324  double eoh(0);
325  for(size_t jhit = 0; jhit<ecalrechitcoll->size(); ++ jhit){
326  const EcalRecHit & rechitj = (*ecalrechitcoll)[ jhit ];
327  math::XYZPoint rhposj = getPosition(rechitj.id(),vtx);
328  double rhetj = rechitj.energy()* sqrt(rhposj.perp2()/rhposj.mag2());
329  if(rhetj<2) continue;
330  double etaj = rhposj.eta();
331  double phij = rhposj.phi();
332  if(std::abs(eta-etaj)>0.2) continue;
333  if(std::abs(deltaPhi(phi,phij))>0.2) continue;
334  eoh+=rhetj/etcluster;
335  }
336  //E/H condition
337  if(eoh>0.1) continue;
338 
339 
340  clustercand.setClusterEt(etcluster);
341  clustercand.setSeedEt(rhet);
342  clustercand.setSeedEta(eta);
343  clustercand.setSeedPhi(phi);
344  clustercand.setSeedZ(rhpos.Z());
345  clustercand.setSeedR(sqrt(rhpos.perp2()));
346  clustercand.setSeedTime(rechit.time());
347  clustercand.setEoverH(eoh);
348  clustercand.setNbTowersInEta(nbtowerssameeta);
349  clustercand.setEtStripPhiSeedPlus1(etstrip_phiseedplus1);
350  clustercand.setEtStripPhiSeedMinus1(etstrip_phiseedminus1);
351  clustercand.setTimeDiscriminatorITBH(timediscriminatorITBH);
352  clustercand.setTimeDiscriminatorOTBH(timediscriminatorOTBH);
353  clustercand.setBeamHaloRecHitsCandidates(bhrhcandidates);
354 
355  bool isbeamhalofrompattern = HBClusterShapeandTimeStudy(clustercand,false);
356  clustercand.setIsHaloFromPattern(isbeamhalofrompattern);
357  bool isbeamhalofrompattern_hlt = HBClusterShapeandTimeStudy(clustercand,true);
358  clustercand.setIsHaloFromPattern_HLT(isbeamhalofrompattern_hlt);
359 
360 
361  TheHaloClusterCandsHB.push_back(clustercand);
362  }
363 
364  return TheHaloClusterCandsHB;
365 }
HcalDetId id() const
get the id
Definition: HBHERecHit.h:25
float time() const
Definition: CaloRecHit.h:19
bool HBClusterShapeandTimeStudy(reco::HaloClusterCandidateHCAL hcand, bool ishlt)
float energy() const
Definition: CaloRecHit.h:17
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float energy() const
Definition: EcalRecHit.h:68
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
DetId id() const
get the id
Definition: EcalRecHit.h:77
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
size_type size() const
math::XYZPoint getPosition(const DetId &id, reco::Vertex::Point vtx)
void setBeamHaloRecHitsCandidates(edm::RefVector< HBHERecHitCollection > x)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:69
std::vector< HaloClusterCandidateHCAL > HcalHaloAlgo::GetHaloClusterCandidateHE ( edm::Handle< EcalRecHitCollection > &  eerechitcoll,
edm::Handle< HBHERecHitCollection > &  hbherechitcoll,
float  et_thresh_seedrh 
)

Definition at line 368 of file HcalHaloAlgo.cc.

References funct::abs(), hiPixelPairStep_cff::deltaPhi, runTauDisplay::dr, CaloRecHit::energy(), EcalRecHit::energy(), PVValHelper::eta, getPosition(), HEClusterShapeandTimeStudy(), HBHERecHit::id(), EcalRecHit::id(), phi, edm::RefVector< C, T, F >::push_back(), reco::HaloClusterCandidateHCAL::setBeamHaloRecHitsCandidates(), reco::HaloClusterCandidateHCAL::setClusterEt(), reco::HaloClusterCandidateHCAL::setClusterSize(), reco::HaloClusterCandidateHCAL::setEoverH(), reco::HaloClusterCandidateHCAL::setEtStripPhiSeedMinus1(), reco::HaloClusterCandidateHCAL::setEtStripPhiSeedPlus1(), reco::HaloClusterCandidateHCAL::setH1overH123(), reco::HaloClusterCandidateHCAL::setIsHaloFromPattern(), reco::HaloClusterCandidateHCAL::setIsHaloFromPattern_HLT(), reco::HaloClusterCandidateHCAL::setSeedEt(), reco::HaloClusterCandidateHCAL::setSeedEta(), reco::HaloClusterCandidateHCAL::setSeedPhi(), reco::HaloClusterCandidateHCAL::setSeedR(), reco::HaloClusterCandidateHCAL::setSeedTime(), reco::HaloClusterCandidateHCAL::setSeedZ(), reco::HaloClusterCandidateHCAL::setTimeDiscriminator(), edm::SortedCollection< T, SORT >::size(), mathSSE::sqrt(), CaloRecHit::time(), and badGlobalMuonTaggersAOD_cff::vtx.

Referenced by Calculate(), and GetPhiWedgeNHitsThreshold().

368  {
369 
370  std::vector<HaloClusterCandidateHCAL> TheHaloClusterCandsHE;
371 
372  reco::Vertex::Point vtx(0,0,0);
373 
374  for(size_t ihit = 0; ihit<hbherechitcoll->size(); ++ ihit){
375  HaloClusterCandidateHCAL clustercand;
376 
377  const HBHERecHit & rechit = (*hbherechitcoll)[ ihit ];
378  math::XYZPoint rhpos = getPosition(rechit.id(),vtx);
379  //Et condition
380  double rhet = rechit.energy()* sqrt(rhpos.perp2()/rhpos.mag2());
381  if(rhet<et_thresh_seedrh) continue;
382  if(std::abs(rhpos.z())<zseparation_HBHE) continue;
383  double eta = rhpos.eta();
384  double phi = rhpos.phi();
385  double rhr = sqrt(rhpos.perp2());
386  bool isiso = true;
387  double etcluster(0),hdepth1(0);
388  int clustersize(0);
389  double etstrip_phiseedplus1(0), etstrip_phiseedminus1(0);
390 
391  //Building the cluster
393  for(size_t jhit = 0; jhit<hbherechitcoll->size(); ++ jhit){
394  const HBHERecHit & rechitj = (*hbherechitcoll)[ jhit ];
395  HBHERecHitRef rhRef(hbherechitcoll,jhit);
396  math::XYZPoint rhposj = getPosition(rechitj.id(),vtx);
397  double rhetj = rechitj.energy()* sqrt(rhposj.perp2()/rhposj.mag2());
398  if(rhetj<2) continue;
399  if(std::abs(rhposj.z())<zseparation_HBHE) continue;
400  if(rhpos.z()*rhposj.z()<0) continue;
401  double phij = rhposj.phi();
402  double dphi = deltaPhi(phi,phij);
403  if(std::abs(dphi)>0.4) continue;
404  double rhrj = sqrt(rhposj.perp2());
405  if(std::abs( rhr-rhrj )>50) continue;
406  if(std::abs(dphi)>0.2 ||std::abs( rhr-rhrj )>20 ){isiso=false;break;}//The deposit should be isolated
407  if(dphi>0.05) etstrip_phiseedplus1+=rhetj;
408  if(dphi<-0.05) etstrip_phiseedminus1+=rhetj;
409  clustersize++;
410  etcluster+=rhetj;
411  if(std::abs( rhposj.z())<405 )hdepth1+=rhetj;
412  //No timing condition for now in HE
413  bhrhcandidates.push_back(rhRef);
414  }
415  //Isolation conditions
416  if(!isiso) continue;
417  if(etstrip_phiseedplus1/etcluster>0.1&& etstrip_phiseedminus1/etcluster>0.1) continue;
418 
419  //Calculate E/H
420  double eoh(0);
421  for(size_t jhit = 0; jhit<ecalrechitcoll->size(); ++ jhit){
422  const EcalRecHit & rechitj = (*ecalrechitcoll)[ jhit ];
423  math::XYZPoint rhposj = getPosition(rechitj.id(),vtx);
424  double rhetj = rechitj.energy()* sqrt(rhposj.perp2()/rhposj.mag2());
425  if(rhetj<2) continue;
426  if(rhpos.z()*rhposj.z()<0) continue;
427  double etaj = rhposj.eta();
428  double phij = rhposj.phi();
429  double dr = sqrt( (eta-etaj)*(eta-etaj)+deltaPhi(phi,phij)*deltaPhi(phi,phij));
430  if(dr>0.3) continue;
431 
432  eoh+=rhetj/etcluster;
433  }
434  //E/H condition
435  if(eoh>0.1) continue;
436 
437 
438  clustercand.setClusterEt(etcluster);
439  clustercand.setSeedEt(rhet);
440  clustercand.setSeedEta(eta);
441  clustercand.setSeedPhi(phi);
442  clustercand.setSeedZ(rhpos.Z());
443  clustercand.setSeedR(sqrt(rhpos.perp2()));
444  clustercand.setSeedTime(rechit.time());
445  clustercand.setEoverH(eoh);
446  clustercand.setH1overH123(hdepth1/etcluster);
447  clustercand.setClusterSize(clustersize);
448  clustercand.setEtStripPhiSeedPlus1(etstrip_phiseedplus1);
449  clustercand.setEtStripPhiSeedMinus1(etstrip_phiseedminus1);
450  clustercand.setTimeDiscriminator(0);
451  clustercand.setBeamHaloRecHitsCandidates(bhrhcandidates);
452 
453  bool isbeamhalofrompattern = HEClusterShapeandTimeStudy(clustercand,false);
454  clustercand.setIsHaloFromPattern(isbeamhalofrompattern);
455  bool isbeamhalofrompattern_hlt = HEClusterShapeandTimeStudy(clustercand,true);
456  clustercand.setIsHaloFromPattern_HLT(isbeamhalofrompattern_hlt);
457 
458 
459  TheHaloClusterCandsHE.push_back(clustercand);
460  }
461 
462  return TheHaloClusterCandsHE;
463 }
HcalDetId id() const
get the id
Definition: HBHERecHit.h:25
float time() const
Definition: CaloRecHit.h:19
float energy() const
Definition: CaloRecHit.h:17
T sqrt(T t)
Definition: SSEVec.h:18
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
float energy() const
Definition: EcalRecHit.h:68
math::XYZPoint Point
point in the space
Definition: Vertex.h:39
DetId id() const
get the id
Definition: EcalRecHit.h:77
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
size_type size() const
math::XYZPoint getPosition(const DetId &id, reco::Vertex::Point vtx)
void setBeamHaloRecHitsCandidates(edm::RefVector< HBHERecHitCollection > x)
void push_back(value_type const &ref)
Add a Ref<C, T> to the RefVector.
Definition: RefVector.h:69
bool HEClusterShapeandTimeStudy(reco::HaloClusterCandidateHCAL hcand, bool ishlt)
float HcalHaloAlgo::GetHBRecHitEnergyThreshold ( )
inline

Definition at line 62 of file HcalHaloAlgo.h.

References HBRecHitEnergyThreshold.

62 { return HBRecHitEnergyThreshold;}
float HBRecHitEnergyThreshold
Definition: HcalHaloAlgo.h:79
float HcalHaloAlgo::GetHERecHitEnergyThreshold ( )
inline

Definition at line 63 of file HcalHaloAlgo.h.

References HERecHitEnergyThreshold.

63 { return HERecHitEnergyThreshold;}
float HERecHitEnergyThreshold
Definition: HcalHaloAlgo.h:80
float HcalHaloAlgo::GetPhiWedgeEnergyThreshold ( )
inline

Definition at line 66 of file HcalHaloAlgo.h.

References SumEnergyThreshold.

66 { return SumEnergyThreshold;}
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:83
int HcalHaloAlgo::GetPhiWedgeNHitsThreshold ( )
inline
math::XYZPoint HcalHaloAlgo::getPosition ( const DetId id,
reco::Vertex::Point  vtx 
)
private

Definition at line 516 of file HcalHaloAlgo.cc.

References geo_, CaloGeometry::getPosition(), HcalGeometry::getPosition(), DetId::Hcal, hgeo_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by GetHaloClusterCandidateHB(), and GetHaloClusterCandidateHE().

516  {
517 
519  if (id.det() == DetId::Hcal) {
520  pos = hgeo_->getPosition(id);
521  } else {
522  pos = GlobalPoint(geo_->getPosition(id));
523  }
524  math::XYZPoint posV(pos.x() - vtx.x(),pos.y() - vtx.y(),pos.z() - vtx.z());
525  return posV;
526 }
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
T y() const
Definition: PV3DBase.h:63
const CaloGeometry * geo_
Definition: HcalHaloAlgo.h:86
T z() const
Definition: PV3DBase.h:64
const GlobalPoint & getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:70
GlobalPoint getPosition(const DetId &id) const
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
const HcalGeometry * hgeo_
Definition: HcalHaloAlgo.h:87
T x() const
Definition: PV3DBase.h:62
bool HcalHaloAlgo::HBClusterShapeandTimeStudy ( reco::HaloClusterCandidateHCAL  hcand,
bool  ishlt 
)

Definition at line 467 of file HcalHaloAlgo.cc.

References reco::HaloClusterCandidateHCAL::getEtStripPhiSeedMinus1(), reco::HaloClusterCandidateHCAL::getEtStripPhiSeedPlus1(), reco::HaloClusterCandidateHCAL::getNbTowersInEta(), reco::HaloClusterCandidateHCAL::getSeedEt(), reco::HaloClusterCandidateHCAL::getTimeDiscriminatorITBH(), reco::HaloClusterCandidateHCAL::getTimeDiscriminatorOTBH(), and reco::HaloClusterCandidateHCAL::setIsHaloFromPattern().

Referenced by GetHaloClusterCandidateHB(), and GetPhiWedgeNHitsThreshold().

467  {
468  //Conditions on the central strip size in eta.
469  //For low size, extra conditions on seed et, isolation and cluster timing
470  //Here we target both IT and OT beam halo. Two separate discriminators were built for the two cases.
471 
472  if(hcand.getSeedEt()<10)return false;
473 
474  if(hcand.getNbTowersInEta()<3) return false;
475  //Isolation criteria for very short eta strips
476  if(hcand.getNbTowersInEta()==3 && (hcand.getEtStripPhiSeedPlus1()>0.1 || hcand.getEtStripPhiSeedMinus1()>0.1) ) return false;
477  if(hcand.getNbTowersInEta()<=5 && (hcand.getEtStripPhiSeedPlus1()>0.1 && hcand.getEtStripPhiSeedMinus1()>0.1) ) return false;
478 
479  //Timing conditions for short eta strips
480  if(hcand.getNbTowersInEta()==3 && hcand.getTimeDiscriminatorITBH()>=0.) return false;
481  if(hcand.getNbTowersInEta()<=6 && hcand.getTimeDiscriminatorITBH()>=5. &&hcand.getTimeDiscriminatorOTBH()<0.) return false;
482 
483  //For HLT, only use conditions without timing
484  if(ishlt && hcand.getNbTowersInEta()<7) return false;
485 
486  hcand.setIsHaloFromPattern(true);
487 
488  return true;
489 }
bool HcalHaloAlgo::HEClusterShapeandTimeStudy ( reco::HaloClusterCandidateHCAL  hcand,
bool  ishlt 
)

Definition at line 493 of file HcalHaloAlgo.cc.

References reco::HaloClusterCandidateHCAL::getH1overH123(), reco::HaloClusterCandidateHCAL::getSeedEt(), reco::HaloClusterCandidateHCAL::getSeedR(), and reco::HaloClusterCandidateHCAL::setIsHaloFromPattern().

Referenced by GetHaloClusterCandidateHE(), and GetPhiWedgeNHitsThreshold().

493  {
494  //Conditions on H1/H123 to spot halo interacting only in one HCAL layer.
495  //For R> about 170cm, HE has only one layer and this condition cannot be applied
496  //Note that for R>170 cm, the halo is in CSC acceptance and will most likely be spotted by the CSC-calo matching method
497  //A method to identify halos interacting in both H1 and H2/H3 at low R is still missing.
498 
499  if(hcand.getSeedEt()<20)return false;
500  if(hcand.getSeedR()>170) return false;
501 
502  if(hcand.getH1overH123()>0.02 &&hcand.getH1overH123()<0.98) return false;
503 
504  //This method is one of the ones with the highest fake rate: in JetHT dataset, it happens in around 0.1% of the cases that a low pt jet (pt= 20) leaves all of its energy in only one HCAL layer.
505  //At HLT, one only cares about large deposits from BH that would lead to a MET/SinglePhoton trigger to be fired.
506  //Rising the seed Et threshold at HLT has therefore little impact on the HLT performances but ensures that possible controversial events are still recorded.
507  if(ishlt && hcand.getSeedEt()<50)return false;
508 
509  hcand.setIsHaloFromPattern(true);
510 
511  return true;
512 
513 }
void HcalHaloAlgo::SetPhiWedgeEnergyThreshold ( float  SumE)
inline

Definition at line 57 of file HcalHaloAlgo.h.

References SumEnergyThreshold.

57 { SumEnergyThreshold = SumE ;}
float SumEnergyThreshold
Definition: HcalHaloAlgo.h:83
void HcalHaloAlgo::SetPhiWedgeNHitsThreshold ( int  nhits)
inline

Definition at line 58 of file HcalHaloAlgo.h.

References nhits, and NHitsThreshold.

void HcalHaloAlgo::SetPhiWedgeThresholds ( float  SumE,
int  nhits 
)
inline

Definition at line 59 of file HcalHaloAlgo.h.

References nhits, NHitsThreshold, and SumEnergyThreshold.

Referenced by reco::HcalHaloDataProducer::produce().

void HcalHaloAlgo::SetRecHitEnergyThresholds ( float  HB,
float  HE 
)
inline

Member Data Documentation

const CaloGeometry* HcalHaloAlgo::geo_
private

Definition at line 86 of file HcalHaloAlgo.h.

Referenced by Calculate(), and getPosition().

float HcalHaloAlgo::HBRecHitEnergyThreshold
private
float HcalHaloAlgo::HERecHitEnergyThreshold
private
const HcalGeometry* HcalHaloAlgo::hgeo_
private

Definition at line 87 of file HcalHaloAlgo.h.

Referenced by Calculate(), and getPosition().

int HcalHaloAlgo::NHitsThreshold
private
float HcalHaloAlgo::SumEnergyThreshold
private