CMS 3D CMS Logo

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

#include <HBHEIsolatedNoiseAlgos.h>

Public Member Functions

void getDiHits (std::vector< HBHEHitMap > &v, double energy) const
 
void getHPDs (std::vector< HBHEHitMap > &v, double energy) const
 
void getMonoHits (std::vector< HBHEHitMap > &v, double energy) const
 
void getRBXs (std::vector< HBHEHitMap > &v, double energy) const
 
 HBHEHitMapOrganizer (const edm::Handle< HBHERecHitCollection > &hbhehitcoll_h, const ObjectValidatorAbs &objvalidator, const PhysicsTowerOrganizer &pto, const HcalFrontEndMap *hfemap)
 
virtual ~HBHEHitMapOrganizer ()
 

Private Member Functions

void getHPDNeighbors (const HBHERecHit *hit, std::vector< const HBHERecHit * > &neighbors, const PhysicsTowerOrganizer &pto)
 

Private Attributes

std::vector< HBHEHitMapdihits_
 
const HcalFrontEndMaphfemap_
 
std::map< int, HBHEHitMaphpds_
 
std::vector< HBHEHitMapmonohits_
 
std::map< int, HBHEHitMaprbxs_
 

Detailed Description

Definition at line 334 of file HBHEIsolatedNoiseAlgos.h.

Constructor & Destructor Documentation

HBHEHitMapOrganizer::HBHEHitMapOrganizer ( const edm::Handle< HBHERecHitCollection > &  hbhehitcoll_h,
const ObjectValidatorAbs objvalidator,
const PhysicsTowerOrganizer pto,
const HcalFrontEndMap hfemap 
)

Definition at line 717 of file HBHEIsolatedNoiseAlgos.cc.

References edm::SortedCollection< T, SORT >::begin(), dihits_, edm::SortedCollection< T, SORT >::end(), CaloRecHit::energy(), PhysicsTowerOrganizer::findNeighbors(), PhysicsTowerOrganizer::findTower(), getHPDNeighbors(), hfemap_, hpds_, HBHERecHit::id(), HcalDetId::ieta(), HBHEHitMap::insert(), HcalDetId::iphi(), HcalFrontEndMap::lookupRBXIndex(), HcalFrontEndMap::lookupRMIndex(), monohits_, rbxs_, and ObjectValidatorAbs::validHit().

721  : hfemap_(hfemap)
722 {
723  // loop over the hits
724  for(HBHERecHitCollection::const_iterator it=hbhehitcoll_h->begin(); it!=hbhehitcoll_h->end(); ++it) {
725  const HBHERecHit *hit=&(*it);
726  if(!objvalidator.validHit(*hit)) continue;
727 
728  // get the Physics Tower and the neighbors
729  const PhysicsTower* tower=pto.findTower(hit->id().ieta(), hit->id().iphi());
730 
731  std::set<const PhysicsTower*> neighbors;
732  pto.findNeighbors(hit->id().ieta(), hit->id().iphi(), neighbors);
733 
734  // organize the RBXs
735  int rbxidnum = hfemap_->lookupRBXIndex(hit->id());
736  rbxs_[rbxidnum].insert(hit, tower, neighbors);
737 
738  // organize the HPDs
739  int hpdidnum = hfemap_->lookupRMIndex(hit->id());
740  hpds_[hpdidnum].insert(hit, tower, neighbors);
741 
742 
743  // organize the dihits
744  std::vector<const HBHERecHit*> hpdneighbors;
745  getHPDNeighbors(hit, hpdneighbors, pto);
746 
747  if(hpdneighbors.size()==1) {
748  std::vector<const HBHERecHit*> hpdneighborsneighbors;
749  getHPDNeighbors(hpdneighbors[0], hpdneighborsneighbors, pto);
750 
751  if(hpdneighborsneighbors.size()==1 && hpdneighborsneighbors[0]==hit && hit->energy()>hpdneighbors[0]->energy()) {
752  // we've found two hits who are neighbors in the same HPD, but who have no other
753  // neighbors (in the same HPD) in common. In order not to double-count, we
754  // require that the first hit has more energy
755 
756  const PhysicsTower* tower2=pto.findTower(hpdneighbors[0]->id().ieta(), hpdneighbors[0]->id().iphi());
757  std::set<const PhysicsTower*> neighbors2;
758  pto.findNeighbors(hpdneighbors[0]->id().ieta(), hpdneighbors[0]->id().iphi(), neighbors2);
759 
760  HBHEHitMap dihit;
761  dihit.insert(hit, tower, neighbors);
762  dihit.insert(hpdneighbors[0], tower2, neighbors2);
763  dihits_.push_back(dihit);
764  }
765  } else if(hpdneighbors.empty()) {
766 
767  // organize the monohits
768  HBHEHitMap monohit;
769  monohit.insert(hit, tower, neighbors);
770  monohits_.push_back(monohit);
771  }
772 
773  } // finished looping over HBHERecHits
774  return;
775 }
constexpr float energy() const
Definition: CaloRecHit.h:31
void getHPDNeighbors(const HBHERecHit *hit, std::vector< const HBHERecHit * > &neighbors, const PhysicsTowerOrganizer &pto)
std::vector< HBHEHitMap > dihits_
HcalDetId id() const
get the id
Definition: HBHERecHit.h:42
const int lookupRMIndex(DetId fId) const
std::vector< T >::const_iterator const_iterator
void insert(const HBHERecHit *hit, const PhysicsTower *twr, std::set< const PhysicsTower * > &neighbors)
const PhysicsTower * findTower(const CaloTowerDetId &id) const
const int lookupRBXIndex(DetId fId) const
std::map< int, HBHEHitMap > rbxs_
virtual bool validHit(const HBHERecHit &) const =0
int ieta() const
get the cell ieta
Definition: HcalDetId.h:159
std::map< int, HBHEHitMap > hpds_
const_iterator end() const
int iphi() const
get the cell iphi
Definition: HcalDetId.h:161
std::vector< HBHEHitMap > monohits_
const HcalFrontEndMap * hfemap_
void findNeighbors(const CaloTowerDetId &id, std::set< const PhysicsTower * > &neighbors) const
const_iterator begin() const
virtual HBHEHitMapOrganizer::~HBHEHitMapOrganizer ( )
inlinevirtual

Definition at line 342 of file HBHEIsolatedNoiseAlgos.h.

References findQualityFiles::v.

342 {}

Member Function Documentation

void HBHEHitMapOrganizer::getDiHits ( std::vector< HBHEHitMap > &  v,
double  energy 
) const

Definition at line 795 of file HBHEIsolatedNoiseAlgos.cc.

References dihits_.

Referenced by HBHEIsolatedNoiseReflagger::produce().

796 {
797  for(std::vector<HBHEHitMap>::const_iterator it=dihits_.begin(); it!=dihits_.end(); ++it) {
798  if(it->hitEnergy()>energy) v.push_back(*it);
799  }
800  return;
801 }
std::vector< HBHEHitMap > dihits_
void HBHEHitMapOrganizer::getHPDNeighbors ( const HBHERecHit hit,
std::vector< const HBHERecHit * > &  neighbors,
const PhysicsTowerOrganizer pto 
)
private

Definition at line 813 of file HBHEIsolatedNoiseAlgos.cc.

References PhysicsTowerOrganizer::findNeighbors(), PhysicsTowerOrganizer::findTower(), hfemap_, HBHERecHit::id(), HcalDetId::ieta(), HcalDetId::iphi(), HcalFrontEndMap::lookupRMIndex(), and groupFilesInBlocks::temp.

Referenced by HBHEHitMapOrganizer().

814 {
815  std::set<const PhysicsTower*> temp;
816  pto.findNeighbors(hit->id().ieta(), hit->id().iphi(), temp);
817 
818  // make sure to include the same tower that the hit is in
819  temp.insert(pto.findTower(hit->id().ieta(), hit->id().iphi()));
820 
821  // loop over the rechits in the temp neighbors
822  for(std::set<const PhysicsTower*>::const_iterator it1=temp.begin(); it1!=temp.end(); ++it1) {
823  for(std::set<const HBHERecHit*>::const_iterator it2=(*it1)->hcalhits.begin(); it2!=(*it1)->hcalhits.end(); ++it2) {
824  const HBHERecHit* hit2(*it2);
825  if(hit!=hit2 && hfemap_->lookupRMIndex(hit->id())==hfemap_->lookupRMIndex(hit2->id())) {
826  neighbors.push_back(hit2);
827  }
828  }
829  }
830  return;
831 }
HcalDetId id() const
get the id
Definition: HBHERecHit.h:42
const int lookupRMIndex(DetId fId) const
const PhysicsTower * findTower(const CaloTowerDetId &id) const
int ieta() const
get the cell ieta
Definition: HcalDetId.h:159
int iphi() const
get the cell iphi
Definition: HcalDetId.h:161
const HcalFrontEndMap * hfemap_
void findNeighbors(const CaloTowerDetId &id, std::set< const PhysicsTower * > &neighbors) const
void HBHEHitMapOrganizer::getHPDs ( std::vector< HBHEHitMap > &  v,
double  energy 
) const

Definition at line 786 of file HBHEIsolatedNoiseAlgos.cc.

References HBHEHitMap::hitEnergy(), hpds_, and genParticles_cff::map.

Referenced by HBHEIsolatedNoiseReflagger::produce().

787 {
788  for(std::map<int, HBHEHitMap>::const_iterator it=hpds_.begin(); it!=hpds_.end(); ++it) {
789  const HBHEHitMap &map=it->second;
790  if(map.hitEnergy()>energy) v.push_back(map);
791  }
792  return;
793 }
std::map< int, HBHEHitMap > hpds_
double hitEnergy(void) const
void HBHEHitMapOrganizer::getMonoHits ( std::vector< HBHEHitMap > &  v,
double  energy 
) const

Definition at line 803 of file HBHEIsolatedNoiseAlgos.cc.

References monohits_.

Referenced by HBHEIsolatedNoiseReflagger::produce().

804 {
805  for(std::vector<HBHEHitMap>::const_iterator it=monohits_.begin(); it!=monohits_.end(); ++it) {
806  if(it->hitEnergy()>energy) v.push_back(*it);
807  }
808  return;
809 }
std::vector< HBHEHitMap > monohits_
void HBHEHitMapOrganizer::getRBXs ( std::vector< HBHEHitMap > &  v,
double  energy 
) const

Definition at line 777 of file HBHEIsolatedNoiseAlgos.cc.

References HBHEHitMap::hitEnergy(), genParticles_cff::map, and rbxs_.

Referenced by HBHEIsolatedNoiseReflagger::produce().

778 {
779  for(std::map<int, HBHEHitMap>::const_iterator it=rbxs_.begin(); it!=rbxs_.end(); ++it) {
780  const HBHEHitMap &map=it->second;
781  if(map.hitEnergy()>energy) v.push_back(map);
782  }
783  return;
784 }
std::map< int, HBHEHitMap > rbxs_
double hitEnergy(void) const

Member Data Documentation

std::vector<HBHEHitMap> HBHEHitMapOrganizer::dihits_
private

Definition at line 353 of file HBHEIsolatedNoiseAlgos.h.

Referenced by getDiHits(), and HBHEHitMapOrganizer().

const HcalFrontEndMap* HBHEHitMapOrganizer::hfemap_
private

Definition at line 351 of file HBHEIsolatedNoiseAlgos.h.

Referenced by getHPDNeighbors(), and HBHEHitMapOrganizer().

std::map<int, HBHEHitMap> HBHEHitMapOrganizer::hpds_
private

Definition at line 352 of file HBHEIsolatedNoiseAlgos.h.

Referenced by getHPDs(), and HBHEHitMapOrganizer().

std::vector<HBHEHitMap> HBHEHitMapOrganizer::monohits_
private

Definition at line 353 of file HBHEIsolatedNoiseAlgos.h.

Referenced by getMonoHits(), and HBHEHitMapOrganizer().

std::map<int, HBHEHitMap> HBHEHitMapOrganizer::rbxs_
private

Definition at line 352 of file HBHEIsolatedNoiseAlgos.h.

Referenced by getRBXs(), and HBHEHitMapOrganizer().