#include <HBHEIsolatedNoiseAlgos.h>
Classes | |
struct | towercmp |
Public Member Functions | |
void | findNeighbors (const CaloTowerDetId &id, std::set< const PhysicsTower * > &neighbors) const |
void | findNeighbors (int ieta, int iphi, std::set< const PhysicsTower * > &neighbors) const |
void | findNeighbors (const PhysicsTower *twr, std::set< const PhysicsTower * > &neighbors) const |
const PhysicsTower * | findTower (int ieta, int iphi) const |
const PhysicsTower * | findTower (const CaloTowerDetId &id) 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 | |
PhysicsTower * | findTower (const CaloTowerDetId &id) |
PhysicsTower * | findTower (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, towercmp > | towers_ |
Definition at line 165 of file HBHEIsolatedNoiseAlgos.h.
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 130 of file HBHEIsolatedNoiseAlgos.cc.
References DetId::Ecal, EcalBarrel, EcalEndcap, edm::EventSetup::get(), CaloSubdetectorGeometry::getClosestCell(), CaloGeometry::getSubdetectorGeometry(), EcalRecHit::id(), HBHERecHit::id(), insert_(), reco::TrackExtrapolation::isValid(), point, reco::TrackExtrapolation::positions(), edm::ESHandle< T >::product(), CaloTowerConstituentsMap::towerOf(), reco::TrackExtrapolation::track(), ExpressReco_HICollisions_FallBack::track, ObjectValidatorAbs::validHit(), and ObjectValidatorAbs::validTrack().
{ // get some geometries edm::ESHandle<CaloGeometry> pG; evSetup.get<CaloGeometryRecord>().get(pG); const CaloGeometry* geo = pG.product(); const CaloSubdetectorGeometry* gEB = geo->getSubdetectorGeometry(DetId::Ecal,EcalBarrel); const CaloSubdetectorGeometry* gEE = geo->getSubdetectorGeometry(DetId::Ecal,EcalEndcap); // do the HCAL hits for(HBHERecHitCollection::const_iterator it=hbhehitcoll_h->begin(); it!=hbhehitcoll_h->end(); ++it) { const HBHERecHit* hit=&(*it); // check that the hit is valid if(!objectvalidator.validHit(*hit)) continue; // add the hit to the organizer CaloTowerDetId tid = ctcm.towerOf(hit->id()); insert_(tid, hit); } // do the EB hits for(EcalRecHitCollection::const_iterator it=ebhitcoll_h->begin(); it!=ebhitcoll_h->end(); ++it) { const EcalRecHit* hit=&(*it); if(!objectvalidator.validHit(*hit)) continue; CaloTowerDetId tid = ctcm.towerOf(hit->id()); insert_(tid, hit); } // do the EE hits for(EcalRecHitCollection::const_iterator it=eehitcoll_h->begin(); it!=eehitcoll_h->end(); ++it) { const EcalRecHit* hit=&(*it); if(!objectvalidator.validHit(*hit)) continue; CaloTowerDetId tid = ctcm.towerOf(hit->id()); insert_(tid, hit); } // do the tracks for(std::vector<reco::TrackExtrapolation>::const_iterator it=trackextrapcoll_h->begin(); it!=trackextrapcoll_h->end(); ++it) { const reco::TrackExtrapolation* extrap=&(*it); const reco::Track* track = &(*(extrap->track())); // validate track if(!objectvalidator.validTrack(*track)) continue; // need a valid extrapolation point if(extrap->positions().size()<=0 || !(extrap->isValid().front())) continue; // get the point const GlobalPoint point(extrap->positions().front().x(), extrap->positions().front().y(), extrap->positions().front().z()); if(std::fabs(point.eta())<1.479) { EBDetId cell = gEB->getClosestCell(point); CaloTowerDetId tid = ctcm.towerOf(cell); insert_(tid, track); } else { EEDetId cell = gEE->getClosestCell(point); CaloTowerDetId tid = ctcm.towerOf(cell); insert_(tid, track); } } return; }
virtual PhysicsTowerOrganizer::~PhysicsTowerOrganizer | ( | ) | [inline, virtual] |
Definition at line 182 of file HBHEIsolatedNoiseAlgos.h.
{}
void PhysicsTowerOrganizer::findNeighbors | ( | const CaloTowerDetId & | id, |
std::set< const PhysicsTower * > & | neighbors | ||
) | const |
Definition at line 253 of file HBHEIsolatedNoiseAlgos.cc.
References findTower(), ExpressReco_HICollisions_FallBack::id, CaloTowerDetId::ietaAbs(), CaloTowerDetId::iphi(), and CaloTowerDetId::zside().
Referenced by findNeighbors(), HBHEHitMapOrganizer::getHPDNeighbors(), and HBHEHitMapOrganizer::HBHEHitMapOrganizer().
{ // correct for the merging of the |ieta|=28-29 towers CaloTowerDetId id(tempid); if(tempid.ietaAbs()==29) id = CaloTowerDetId((tempid.ietaAbs()-1)*tempid.zside(), tempid.iphi()); std::vector<CaloTowerDetId> ids; // get the neighbor with higher iphi if(id.ietaAbs()<=20) { if(id.iphi()==72) ids.push_back(CaloTowerDetId(id.ieta(), 1)); else ids.push_back(CaloTowerDetId(id.ieta(), id.iphi()+1)); } else { if(id.iphi()==71) ids.push_back(CaloTowerDetId(id.ieta(), 1)); else ids.push_back(CaloTowerDetId(id.ieta(), id.iphi()+2)); } // get the neighbor with the lower iphi if(id.ietaAbs()<=20) { if(id.iphi()==1) ids.push_back(CaloTowerDetId(id.ieta(), 72)); else ids.push_back(CaloTowerDetId(id.ieta(), id.iphi()-1)); } else { if(id.iphi()==1) ids.push_back(CaloTowerDetId(id.ieta(), 71)); else ids.push_back(CaloTowerDetId(id.ieta(), id.iphi()-2)); } // get the neighbor with the higher ietaAbs if(id.ietaAbs()==20 && (id.iphi()%2)==0) ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), id.iphi()-1)); else ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), id.iphi())); // get the neighbor(s) with the lower ietaAbs if(id.ietaAbs()==21) { ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi())); ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()+1)); } else if(id.ietaAbs()==1) { ids.push_back(CaloTowerDetId(-id.ieta(), id.iphi())); } else { ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi())); } // get the neighbor with higher ieta and higher iphi if(id.ietaAbs()<=19 || (id.ietaAbs()==20 && (id.iphi()%2)==0)) { if(id.iphi()==72) ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), 1)); else ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), id.iphi()+1)); } else if(id.ietaAbs()>=21) { if(id.iphi()==71) ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), 1)); else ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), id.iphi()+2)); } // get the neighbor with higher ieta and lower iphi if(id.ietaAbs()<=19) { if(id.iphi()==1) ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), 72)); else ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), id.iphi()-1)); } else if(id.ietaAbs()>=21 || (id.ietaAbs()==20 && (id.iphi()%2)==1)) { if(id.iphi()==1) ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), 71)); else ids.push_back(CaloTowerDetId((id.ietaAbs()+1)*id.zside(), id.iphi()-2)); } // get the neighbor with lower ieta and higher iphi if(id.ietaAbs()==1) { if(id.iphi()==72) ids.push_back(CaloTowerDetId(-id.ieta(), 1)); else ids.push_back(CaloTowerDetId(-id.ieta(), id.iphi()+1)); } else if(id.ietaAbs()<=20) { if(id.iphi()==72) ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), 1)); else ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()+1)); } else if(id.ietaAbs()>=21) { if(id.iphi()==71) ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), 1)); else ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()+2)); } // get the neighbor with lower ieta and lower iphi if(id.ietaAbs()==1) { if(id.iphi()==1) ids.push_back(CaloTowerDetId(-id.ieta(), 72)); else ids.push_back(CaloTowerDetId(-id.ieta(), id.iphi()-1)); } else if(id.ietaAbs()<=20) { if(id.iphi()==1) ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), 72)); else ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()-1)); } else if(id.ietaAbs()>=22) { if(id.iphi()==1) ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), 71)); else ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()-2)); } else if(id.ietaAbs()==21) { if(id.iphi()==1) ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), 72)); else ids.push_back(CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()-1)); } // clear neighbors neighbors.clear(); // find the neighbors and add them to the eponymous set for(std::vector<CaloTowerDetId>::const_iterator it=ids.begin(); it!=ids.end(); ++it) { const PhysicsTower* twr=findTower(*it); if(twr) neighbors.insert(twr); } return; }
void PhysicsTowerOrganizer::findNeighbors | ( | const PhysicsTower * | twr, |
std::set< const PhysicsTower * > & | neighbors | ||
) | const |
Definition at line 351 of file HBHEIsolatedNoiseAlgos.cc.
References findNeighbors(), and PhysicsTower::id.
{ findNeighbors(twr->id, neighbors); return; }
void PhysicsTowerOrganizer::findNeighbors | ( | int | ieta, |
int | iphi, | ||
std::set< const PhysicsTower * > & | neighbors | ||
) | const |
Definition at line 357 of file HBHEIsolatedNoiseAlgos.cc.
References findNeighbors().
{ findNeighbors(CaloTowerDetId(ieta, iphi), neighbors); return; }
const PhysicsTower * PhysicsTowerOrganizer::findTower | ( | int | ieta, |
int | iphi | ||
) | const [inline] |
Definition at line 241 of file HBHEIsolatedNoiseAlgos.cc.
References findTower().
{ CaloTowerDetId tid(ieta, iphi); return findTower(tid); }
PhysicsTower * PhysicsTowerOrganizer::findTower | ( | int | ieta, |
int | iphi | ||
) | [private] |
Definition at line 247 of file HBHEIsolatedNoiseAlgos.cc.
References findTower().
{ CaloTowerDetId tid(ieta, iphi); return findTower(tid); }
PhysicsTower * PhysicsTowerOrganizer::findTower | ( | const CaloTowerDetId & | id | ) | [private] |
Definition at line 206 of file HBHEIsolatedNoiseAlgos.cc.
References PhysicsTower::id, ExpressReco_HICollisions_FallBack::id, and towers_.
{ // create dummy PhysicsTower PhysicsTower dummy; // correct for the merging of the |ieta|=28-29 towers if(id.ietaAbs()==29) dummy.id = CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()); else dummy.id=id; // search on the dummy std::set<PhysicsTower, towercmp>::iterator it=towers_.find(dummy); if(it==towers_.end()) return 0; // for whatever reason, I can't get a non-const out of the find method PhysicsTower &twr = const_cast<PhysicsTower&>(*it); return &twr; }
const PhysicsTower * PhysicsTowerOrganizer::findTower | ( | const CaloTowerDetId & | id | ) | const [inline] |
Definition at line 225 of file HBHEIsolatedNoiseAlgos.cc.
References PhysicsTower::id, ExpressReco_HICollisions_FallBack::id, and towers_.
Referenced by findNeighbors(), findTower(), HBHEHitMapOrganizer::getHPDNeighbors(), HBHEHitMapOrganizer::HBHEHitMapOrganizer(), and insert_().
{ // create dummy PhysicsTower PhysicsTower dummy; // correct for the merging of the |ieta|=28-29 towers if(id.ietaAbs()==29) dummy.id = CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()); else dummy.id=id; // search on the dummy std::set<PhysicsTower, towercmp>::iterator it=towers_.find(dummy); if(it==towers_.end()) return 0; return &(*it); }
void PhysicsTowerOrganizer::insert_ | ( | CaloTowerDetId & | id, |
const EcalRecHit * | hit | ||
) | [private] |
Definition at line 380 of file HBHEIsolatedNoiseAlgos.cc.
References PhysicsTower::ecalhits, findTower(), PhysicsTower::id, ExpressReco_HICollisions_FallBack::id, and towers_.
{ PhysicsTower* twr=findTower(id); if(twr==0) { PhysicsTower dummy; if(id.ietaAbs()==29) dummy.id = CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()); else dummy.id = id; dummy.ecalhits.insert(hit); towers_.insert(dummy); } else { twr->ecalhits.insert(hit); } return; }
void PhysicsTowerOrganizer::insert_ | ( | CaloTowerDetId & | id, |
const reco::Track * | hit | ||
) | [private] |
Definition at line 397 of file HBHEIsolatedNoiseAlgos.cc.
References findTower(), PhysicsTower::id, ExpressReco_HICollisions_FallBack::id, towers_, and PhysicsTower::tracks.
{ PhysicsTower* twr=findTower(id); if(twr==0) { PhysicsTower dummy; if(id.ietaAbs()==29) dummy.id = CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()); else dummy.id = id; dummy.tracks.insert(track); towers_.insert(dummy); } else { twr->tracks.insert(track); } return; }
void PhysicsTowerOrganizer::insert_ | ( | CaloTowerDetId & | id, |
const HBHERecHit * | hit | ||
) | [private] |
Definition at line 363 of file HBHEIsolatedNoiseAlgos.cc.
References findTower(), PhysicsTower::hcalhits, PhysicsTower::id, ExpressReco_HICollisions_FallBack::id, and towers_.
Referenced by PhysicsTowerOrganizer().
{ PhysicsTower* twr=findTower(id); if(twr==0) { PhysicsTower dummy; if(id.ietaAbs()==29) dummy.id = CaloTowerDetId((id.ietaAbs()-1)*id.zside(), id.iphi()); else dummy.id = id; dummy.hcalhits.insert(hit); towers_.insert(dummy); } else { twr->hcalhits.insert(hit); } return; }
std::set<PhysicsTower, towercmp> PhysicsTowerOrganizer::towers_ [private] |
Definition at line 203 of file HBHEIsolatedNoiseAlgos.h.
Referenced by findTower(), and insert_().