CMS 3D CMS Logo

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

#include <HBHEIsolatedNoiseAlgos.h>

Classes

struct  towercmp
 

Public Member Functions

void findNeighbors (const CaloTowerDetId &id, std::set< const PhysicsTower * > &neighbors) const
 
void findNeighbors (const PhysicsTower *twr, std::set< const PhysicsTower * > &neighbors) const
 
void findNeighbors (int ieta, int iphi, std::set< const PhysicsTower * > &neighbors) const
 
const PhysicsTowerfindTower (const CaloTowerDetId &id) const
 
const PhysicsTowerfindTower (int ieta, int iphi) const
 
 PhysicsTowerOrganizer (const edm::Event &iEvent, const edm::EventSetup &evSetup, const edm::Handle< HBHERecHitCollection > &hbhehitcoll_h, const edm::Handle< EcalRecHitCollection > &ebhitcoll_h, const edm::Handle< EcalRecHitCollection > &eehitcoll_h, const edm::Handle< std::vector< reco::TrackExtrapolation > > &trackextrapcoll_h, const ObjectValidatorAbs &objectvalidator, const CaloTowerConstituentsMap &ctcm)
 
virtual ~PhysicsTowerOrganizer ()
 

Private Member Functions

PhysicsTowerfindTower (const CaloTowerDetId &id)
 
PhysicsTowerfindTower (int ieta, int iphi)
 
void insert_ (CaloTowerDetId &id, const EcalRecHit *hit)
 
void insert_ (CaloTowerDetId &id, const HBHERecHit *hit)
 
void insert_ (CaloTowerDetId &id, const reco::Track *hit)
 

Private Attributes

std::set< PhysicsTower, towercmptowers_
 

Detailed Description

Definition at line 170 of file HBHEIsolatedNoiseAlgos.h.

Constructor & Destructor Documentation

◆ PhysicsTowerOrganizer()

PhysicsTowerOrganizer::PhysicsTowerOrganizer ( const edm::Event iEvent,
const edm::EventSetup evSetup,
const edm::Handle< HBHERecHitCollection > &  hbhehitcoll_h,
const edm::Handle< EcalRecHitCollection > &  ebhitcoll_h,
const edm::Handle< EcalRecHitCollection > &  eehitcoll_h,
const edm::Handle< std::vector< reco::TrackExtrapolation > > &  trackextrapcoll_h,
const ObjectValidatorAbs objectvalidator,
const CaloTowerConstituentsMap ctcm 
)

Definition at line 151 of file HBHEIsolatedNoiseAlgos.cc.

159  {
160  // get some geometries
162  evSetup.get<CaloGeometryRecord>().get(pG);
163  const CaloGeometry* geo = pG.product();
166 
167  // do the HCAL hits
168  for (HBHERecHitCollection::const_iterator it = hbhehitcoll_h->begin(); it != hbhehitcoll_h->end(); ++it) {
169  const HBHERecHit* hit = &(*it);
170 
171  // check that the hit is valid
172  if (!objectvalidator.validHit(*hit))
173  continue;
174 
175  // add the hit to the organizer
176  CaloTowerDetId tid = ctcm.towerOf(hit->id());
177  insert_(tid, hit);
178  }
179 
180  // do the EB hits
181  for (EcalRecHitCollection::const_iterator it = ebhitcoll_h->begin(); it != ebhitcoll_h->end(); ++it) {
182  const EcalRecHit* hit = &(*it);
183 
184  if (!objectvalidator.validHit(*hit))
185  continue;
186  CaloTowerDetId tid = ctcm.towerOf(hit->id());
187  insert_(tid, hit);
188  }
189 
190  // do the EE hits
191  for (EcalRecHitCollection::const_iterator it = eehitcoll_h->begin(); it != eehitcoll_h->end(); ++it) {
192  const EcalRecHit* hit = &(*it);
193 
194  if (!objectvalidator.validHit(*hit))
195  continue;
196  CaloTowerDetId tid = ctcm.towerOf(hit->id());
197  insert_(tid, hit);
198  }
199 
200  // do the tracks
201  for (std::vector<reco::TrackExtrapolation>::const_iterator it = trackextrapcoll_h->begin();
202  it != trackextrapcoll_h->end();
203  ++it) {
204  const reco::TrackExtrapolation* extrap = &(*it);
205  const reco::Track* track = &(*(extrap->track()));
206 
207  // validate track
208  if (!objectvalidator.validTrack(*track))
209  continue;
210 
211  // get the point
212  if (extrap->positions().empty())
213  continue;
214  const GlobalPoint point(
215  extrap->positions().front().x(), extrap->positions().front().y(), extrap->positions().front().z());
216 
217  if (std::fabs(point.eta()) < 1.479) {
218  EBDetId cell = gEB->getClosestCell(point);
219  CaloTowerDetId tid = ctcm.towerOf(cell);
220  insert_(tid, track);
221  } else {
222  EEDetId cell = gEE->getClosestCell(point);
223  CaloTowerDetId tid = ctcm.towerOf(cell);
224  insert_(tid, track);
225  }
226  }
227 
228  return;
229 }

References edm::SortedCollection< T, SORT >::begin(), DetId::Ecal, EcalBarrel, EcalEndcap, edm::SortedCollection< T, SORT >::end(), edm::EventSetup::get(), get, CaloSubdetectorGeometry::getClosestCell(), CaloGeometry::getSubdetectorGeometry(), hit::id, insert_(), point, reco::TrackExtrapolation::positions(), edm::ESHandle< T >::product(), CaloTowerConstituentsMap::towerOf(), reco::TrackExtrapolation::track(), HLT_2018_cff::track, ObjectValidatorAbs::validHit(), and ObjectValidatorAbs::validTrack().

◆ ~PhysicsTowerOrganizer()

virtual PhysicsTowerOrganizer::~PhysicsTowerOrganizer ( )
inlinevirtual

Definition at line 185 of file HBHEIsolatedNoiseAlgos.h.

185 {}

Member Function Documentation

◆ findNeighbors() [1/3]

void PhysicsTowerOrganizer::findNeighbors ( const CaloTowerDetId id,
std::set< const PhysicsTower * > &  neighbors 
) const

Definition at line 280 of file HBHEIsolatedNoiseAlgos.cc.

281  {
282  // correct for the merging of the |ieta|=28-29 towers
283  CaloTowerDetId id(tempid);
284  if (tempid.ietaAbs() == 29)
285  id = CaloTowerDetId((tempid.ietaAbs() - 1) * tempid.zside(), tempid.iphi());
286 
287  std::vector<CaloTowerDetId> ids;
288  // get the neighbor with higher iphi
289  if (id.ietaAbs() <= 20) {
290  if (id.iphi() == 72)
291  ids.push_back(CaloTowerDetId(id.ieta(), 1));
292  else
293  ids.push_back(CaloTowerDetId(id.ieta(), id.iphi() + 1));
294  } else {
295  if (id.iphi() == 71)
296  ids.push_back(CaloTowerDetId(id.ieta(), 1));
297  else
298  ids.push_back(CaloTowerDetId(id.ieta(), id.iphi() + 2));
299  }
300 
301  // get the neighbor with the lower iphi
302  if (id.ietaAbs() <= 20) {
303  if (id.iphi() == 1)
304  ids.push_back(CaloTowerDetId(id.ieta(), 72));
305  else
306  ids.push_back(CaloTowerDetId(id.ieta(), id.iphi() - 1));
307  } else {
308  if (id.iphi() == 1)
309  ids.push_back(CaloTowerDetId(id.ieta(), 71));
310  else
311  ids.push_back(CaloTowerDetId(id.ieta(), id.iphi() - 2));
312  }
313 
314  // get the neighbor with the higher ietaAbs
315  if (id.ietaAbs() == 20 && (id.iphi() % 2) == 0)
316  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), id.iphi() - 1));
317  else
318  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), id.iphi()));
319 
320  // get the neighbor(s) with the lower ietaAbs
321  if (id.ietaAbs() == 21) {
322  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi()));
323  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi() + 1));
324  } else if (id.ietaAbs() == 1) {
325  ids.push_back(CaloTowerDetId(-id.ieta(), id.iphi()));
326  } else {
327  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi()));
328  }
329 
330  // get the neighbor with higher ieta and higher iphi
331  if (id.ietaAbs() <= 19 || (id.ietaAbs() == 20 && (id.iphi() % 2) == 0)) {
332  if (id.iphi() == 72)
333  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), 1));
334  else
335  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), id.iphi() + 1));
336  } else if (id.ietaAbs() >= 21) {
337  if (id.iphi() == 71)
338  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), 1));
339  else
340  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), id.iphi() + 2));
341  }
342 
343  // get the neighbor with higher ieta and lower iphi
344  if (id.ietaAbs() <= 19) {
345  if (id.iphi() == 1)
346  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), 72));
347  else
348  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), id.iphi() - 1));
349  } else if (id.ietaAbs() >= 21 || (id.ietaAbs() == 20 && (id.iphi() % 2) == 1)) {
350  if (id.iphi() == 1)
351  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), 71));
352  else
353  ids.push_back(CaloTowerDetId((id.ietaAbs() + 1) * id.zside(), id.iphi() - 2));
354  }
355 
356  // get the neighbor with lower ieta and higher iphi
357  if (id.ietaAbs() == 1) {
358  if (id.iphi() == 72)
359  ids.push_back(CaloTowerDetId(-id.ieta(), 1));
360  else
361  ids.push_back(CaloTowerDetId(-id.ieta(), id.iphi() + 1));
362  } else if (id.ietaAbs() <= 20) {
363  if (id.iphi() == 72)
364  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), 1));
365  else
366  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi() + 1));
367  } else if (id.ietaAbs() >= 21) {
368  if (id.iphi() == 71)
369  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), 1));
370  else
371  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi() + 2));
372  }
373 
374  // get the neighbor with lower ieta and lower iphi
375  if (id.ietaAbs() == 1) {
376  if (id.iphi() == 1)
377  ids.push_back(CaloTowerDetId(-id.ieta(), 72));
378  else
379  ids.push_back(CaloTowerDetId(-id.ieta(), id.iphi() - 1));
380  } else if (id.ietaAbs() <= 20) {
381  if (id.iphi() == 1)
382  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), 72));
383  else
384  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi() - 1));
385  } else if (id.ietaAbs() >= 22) {
386  if (id.iphi() == 1)
387  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), 71));
388  else
389  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi() - 2));
390  } else if (id.ietaAbs() == 21) {
391  if (id.iphi() == 1)
392  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), 72));
393  else
394  ids.push_back(CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi() - 1));
395  }
396 
397  // clear neighbors
398  neighbors.clear();
399 
400  // find the neighbors and add them to the eponymous set
401  for (std::vector<CaloTowerDetId>::const_iterator it = ids.begin(); it != ids.end(); ++it) {
402  const PhysicsTower* twr = findTower(*it);
403  if (twr)
404  neighbors.insert(twr);
405  }
406 
407  return;
408 }

References findTower(), triggerObjects_cff::id, LEDCalibrationChannels::ieta, CaloTowerDetId::ietaAbs(), CaloTowerDetId::iphi(), LEDCalibrationChannels::iphi, CaloTowerDetId::zside(), and ecaldqm::zside().

Referenced by findNeighbors(), HBHEHitMapOrganizer::getHPDNeighbors(), and HBHEHitMapOrganizer::HBHEHitMapOrganizer().

◆ findNeighbors() [2/3]

void PhysicsTowerOrganizer::findNeighbors ( const PhysicsTower twr,
std::set< const PhysicsTower * > &  neighbors 
) const

Definition at line 410 of file HBHEIsolatedNoiseAlgos.cc.

410  {
411  findNeighbors(twr->id, neighbors);
412  return;
413 }

References findNeighbors(), and PhysicsTower::id.

◆ findNeighbors() [3/3]

void PhysicsTowerOrganizer::findNeighbors ( int  ieta,
int  iphi,
std::set< const PhysicsTower * > &  neighbors 
) const

Definition at line 415 of file HBHEIsolatedNoiseAlgos.cc.

415  {
416  findNeighbors(CaloTowerDetId(ieta, iphi), neighbors);
417  return;
418 }

References findNeighbors(), LEDCalibrationChannels::ieta, and LEDCalibrationChannels::iphi.

◆ findTower() [1/4]

PhysicsTower * PhysicsTowerOrganizer::findTower ( const CaloTowerDetId id)
private

Definition at line 231 of file HBHEIsolatedNoiseAlgos.cc.

231  {
232  // create dummy PhysicsTower
234 
235  // correct for the merging of the |ieta|=28-29 towers
236  if (id.ietaAbs() == 29)
237  dummy.id = CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi());
238  else
239  dummy.id = id;
240 
241  // search on the dummy
242  std::set<PhysicsTower, towercmp>::iterator it = towers_.find(dummy);
243 
244  if (it == towers_.end())
245  return nullptr;
246 
247  // for whatever reason, I can't get a non-const out of the find method
248  PhysicsTower& twr = const_cast<PhysicsTower&>(*it);
249  return &twr;
250 }

References triggerObjects_cff::id, LEDCalibrationChannels::iphi, towers_, and ecaldqm::zside().

◆ findTower() [2/4]

const PhysicsTower * PhysicsTowerOrganizer::findTower ( const CaloTowerDetId id) const
inline

Definition at line 252 of file HBHEIsolatedNoiseAlgos.cc.

252  {
253  // create dummy PhysicsTower
255 
256  // correct for the merging of the |ieta|=28-29 towers
257  if (id.ietaAbs() == 29)
258  dummy.id = CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi());
259  else
260  dummy.id = id;
261 
262  // search on the dummy
263  std::set<PhysicsTower, towercmp>::iterator it = towers_.find(dummy);
264 
265  if (it == towers_.end())
266  return nullptr;
267  return &(*it);
268 }

References triggerObjects_cff::id, LEDCalibrationChannels::iphi, towers_, and ecaldqm::zside().

Referenced by findNeighbors(), findTower(), HBHEHitMapOrganizer::getHPDNeighbors(), HBHEHitMapOrganizer::HBHEHitMapOrganizer(), and insert_().

◆ findTower() [3/4]

PhysicsTower * PhysicsTowerOrganizer::findTower ( int  ieta,
int  iphi 
)
private

Definition at line 275 of file HBHEIsolatedNoiseAlgos.cc.

275  {
276  CaloTowerDetId tid(ieta, iphi);
277  return findTower(tid);
278 }

References findTower(), LEDCalibrationChannels::ieta, and LEDCalibrationChannels::iphi.

◆ findTower() [4/4]

const PhysicsTower * PhysicsTowerOrganizer::findTower ( int  ieta,
int  iphi 
) const
inline

Definition at line 270 of file HBHEIsolatedNoiseAlgos.cc.

270  {
271  CaloTowerDetId tid(ieta, iphi);
272  return findTower(tid);
273 }

References findTower(), LEDCalibrationChannels::ieta, and LEDCalibrationChannels::iphi.

◆ insert_() [1/3]

void PhysicsTowerOrganizer::insert_ ( CaloTowerDetId id,
const EcalRecHit hit 
)
private

Definition at line 436 of file HBHEIsolatedNoiseAlgos.cc.

436  {
437  PhysicsTower* twr = findTower(id);
438  if (twr == nullptr) {
440  if (id.ietaAbs() == 29)
441  dummy.id = CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi());
442  else
443  dummy.id = id;
444  dummy.ecalhits.insert(hit);
445  towers_.insert(dummy);
446  } else {
447  twr->ecalhits.insert(hit);
448  }
449  return;
450 }

References PhysicsTower::ecalhits, findTower(), triggerObjects_cff::id, LEDCalibrationChannels::iphi, towers_, and ecaldqm::zside().

◆ insert_() [2/3]

void PhysicsTowerOrganizer::insert_ ( CaloTowerDetId id,
const HBHERecHit hit 
)
private

Definition at line 420 of file HBHEIsolatedNoiseAlgos.cc.

420  {
421  PhysicsTower* twr = findTower(id);
422  if (twr == nullptr) {
424  if (id.ietaAbs() == 29)
425  dummy.id = CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi());
426  else
427  dummy.id = id;
428  dummy.hcalhits.insert(hit);
429  towers_.insert(dummy);
430  } else {
431  twr->hcalhits.insert(hit);
432  }
433  return;
434 }

References findTower(), PhysicsTower::hcalhits, triggerObjects_cff::id, LEDCalibrationChannels::iphi, towers_, and ecaldqm::zside().

Referenced by PhysicsTowerOrganizer().

◆ insert_() [3/3]

void PhysicsTowerOrganizer::insert_ ( CaloTowerDetId id,
const reco::Track hit 
)
private

Definition at line 452 of file HBHEIsolatedNoiseAlgos.cc.

452  {
453  PhysicsTower* twr = findTower(id);
454  if (twr == nullptr) {
456  if (id.ietaAbs() == 29)
457  dummy.id = CaloTowerDetId((id.ietaAbs() - 1) * id.zside(), id.iphi());
458  else
459  dummy.id = id;
460  dummy.tracks.insert(track);
461  towers_.insert(dummy);
462  } else {
463  twr->tracks.insert(track);
464  }
465  return;
466 }

References findTower(), triggerObjects_cff::id, LEDCalibrationChannels::iphi, towers_, HLT_2018_cff::track, PhysicsTower::tracks, and ecaldqm::zside().

Member Data Documentation

◆ towers_

std::set<PhysicsTower, towercmp> PhysicsTowerOrganizer::towers_
private

Definition at line 206 of file HBHEIsolatedNoiseAlgos.h.

Referenced by findTower(), and insert_().

edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
EcalRecHit
Definition: EcalRecHit.h:15
PhysicsTower::hcalhits
std::set< const HBHERecHit * > hcalhits
Definition: HBHEIsolatedNoiseAlgos.h:155
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
CaloGeometryRecord
Definition: CaloGeometryRecord.h:30
EBDetId
Definition: EBDetId.h:17
HBHERecHit
Definition: HBHERecHit.h:13
CaloGeometry::getSubdetectorGeometry
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
PhysicsTower::tracks
std::set< const reco::Track * > tracks
Definition: HBHEIsolatedNoiseAlgos.h:157
ObjectValidatorAbs::validHit
virtual bool validHit(const HBHERecHit &) const =0
EcalBarrel
Definition: EcalSubdetector.h:10
PhysicsTowerOrganizer::towers_
std::set< PhysicsTower, towercmp > towers_
Definition: HBHEIsolatedNoiseAlgos.h:206
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
CaloGeometry
Definition: CaloGeometry.h:21
PhysicsTowerOrganizer::findTower
const PhysicsTower * findTower(const CaloTowerDetId &id) const
Definition: HBHEIsolatedNoiseAlgos.cc:252
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
edm::SortedCollection::begin
const_iterator begin() const
Definition: SortedCollection.h:262
reco::TrackExtrapolation::track
reco::TrackRef const & track() const
Definition: TrackExtrapolation.h:41
reco::Track
Definition: Track.h:27
edm::ESHandle< CaloGeometry >
PhysicsTower::id
CaloTowerDetId id
Definition: HBHEIsolatedNoiseAlgos.h:154
Point3DBase< float, GlobalTag >
EEDetId
Definition: EEDetId.h:14
EcalEndcap
Definition: EcalSubdetector.h:10
reco::TrackExtrapolation::positions
std::vector< Point > const & positions() const
Definition: TrackExtrapolation.h:42
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
PhysicsTower::ecalhits
std::set< const EcalRecHit * > ecalhits
Definition: HBHEIsolatedNoiseAlgos.h:156
CaloTowerConstituentsMap::towerOf
CaloTowerDetId towerOf(const DetId &id) const
Get the tower id for this det id (or null if not known)
Definition: CaloTowerConstituentsMap.cc:26
CaloSubdetectorGeometry::getClosestCell
virtual DetId getClosestCell(const GlobalPoint &r) const
Definition: CaloSubdetectorGeometry.cc:44
DetId::Ecal
Definition: DetId.h:27
get
#define get
PhysicsTower
Definition: HBHEIsolatedNoiseAlgos.h:153
PhysicsTowerOrganizer::insert_
void insert_(CaloTowerDetId &id, const HBHERecHit *hit)
Definition: HBHEIsolatedNoiseAlgos.cc:420
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
HLT_2018_cff.track
track
Definition: HLT_2018_cff.py:10352
reco::TrackExtrapolation
Definition: TrackExtrapolation.h:22
dummy
Definition: DummySelector.h:38
point
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5
hit
Definition: SiStripHitEffFromCalibTree.cc:88
ObjectValidatorAbs::validTrack
virtual bool validTrack(const reco::Track &) const =0
PhysicsTowerOrganizer::findNeighbors
void findNeighbors(const CaloTowerDetId &id, std::set< const PhysicsTower * > &neighbors) const
Definition: HBHEIsolatedNoiseAlgos.cc:280
CaloTowerDetId
Definition: CaloTowerDetId.h:12