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::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, const CaloGeometry &geo)
 
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 171 of file HBHEIsolatedNoiseAlgos.h.

Constructor & Destructor Documentation

◆ PhysicsTowerOrganizer()

PhysicsTowerOrganizer::PhysicsTowerOrganizer ( 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,
const CaloGeometry geo 
)

Definition at line 151 of file HBHEIsolatedNoiseAlgos.cc.

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

References edm::SortedCollection< T, SORT >::begin(), DetId::Ecal, EcalBarrel, EcalEndcap, edm::SortedCollection< T, SORT >::end(), CaloSubdetectorGeometry::getClosestCell(), CaloGeometry::getSubdetectorGeometry(), hit::id, insert_(), point, reco::TrackExtrapolation::positions(), CaloTowerConstituentsMap::towerOf(), reco::TrackExtrapolation::track(), HLT_FULL_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 276 of file HBHEIsolatedNoiseAlgos.cc.

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

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 406 of file HBHEIsolatedNoiseAlgos.cc.

406  {
407  findNeighbors(twr->id, neighbors);
408  return;
409 }

References findNeighbors(), and PhysicsTower::id.

◆ findNeighbors() [3/3]

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

Definition at line 411 of file HBHEIsolatedNoiseAlgos.cc.

411  {
412  findNeighbors(CaloTowerDetId(ieta, iphi), neighbors);
413  return;
414 }

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

◆ findTower() [1/4]

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

Definition at line 227 of file HBHEIsolatedNoiseAlgos.cc.

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

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 248 of file HBHEIsolatedNoiseAlgos.cc.

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

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 271 of file HBHEIsolatedNoiseAlgos.cc.

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

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

◆ findTower() [4/4]

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

Definition at line 266 of file HBHEIsolatedNoiseAlgos.cc.

266  {
267  CaloTowerDetId tid(ieta, iphi);
268  return findTower(tid);
269 }

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

◆ insert_() [1/3]

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

Definition at line 432 of file HBHEIsolatedNoiseAlgos.cc.

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

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 416 of file HBHEIsolatedNoiseAlgos.cc.

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

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 448 of file HBHEIsolatedNoiseAlgos.cc.

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

References findTower(), triggerObjects_cff::id, LEDCalibrationChannels::iphi, towers_, HLT_FULL_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_().

EcalRecHit
Definition: EcalRecHit.h:15
PhysicsTower::hcalhits
std::set< const HBHERecHit * > hcalhits
Definition: HBHEIsolatedNoiseAlgos.h:156
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
HLT_FULL_cff.track
track
Definition: HLT_FULL_cff.py:11779
hit::id
unsigned int id
Definition: SiStripHitEffFromCalibTree.cc:92
ecaldqm::zside
int zside(DetId const &)
Definition: EcalDQMCommonUtils.cc:189
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:158
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
PhysicsTowerOrganizer::findTower
const PhysicsTower * findTower(const CaloTowerDetId &id) const
Definition: HBHEIsolatedNoiseAlgos.cc:248
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
PhysicsTower::id
CaloTowerDetId id
Definition: HBHEIsolatedNoiseAlgos.h:155
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:157
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
PhysicsTower
Definition: HBHEIsolatedNoiseAlgos.h:154
PhysicsTowerOrganizer::insert_
void insert_(CaloTowerDetId &id, const HBHERecHit *hit)
Definition: HBHEIsolatedNoiseAlgos.cc:416
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:31
CaloSubdetectorGeometry
Definition: CaloSubdetectorGeometry.h:22
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:276
CaloTowerDetId
Definition: CaloTowerDetId.h:12