CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual ~HBHEHitMapOrganizer ()
 

Private Member Functions

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

Private Attributes

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

Detailed Description

Definition at line 332 of file HBHEIsolatedNoiseAlgos.h.

Constructor & Destructor Documentation

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

Definition at line 711 of file HBHEIsolatedNoiseAlgos.cc.

References dihits_, CaloRecHit::energy(), PhysicsTowerOrganizer::findNeighbors(), PhysicsTowerOrganizer::findTower(), getHPDNeighbors(), hpds_, HBHERecHit::id(), HcalDetId::ieta(), HcalHPDRBXMap::indexHPD(), HcalHPDRBXMap::indexRBX(), HBHEHitMap::insert(), HcalDetId::iphi(), monohits_, rbxs_, and ObjectValidatorAbs::validHit().

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

Definition at line 339 of file HBHEIsolatedNoiseAlgos.h.

339 {}

Member Function Documentation

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

Definition at line 787 of file HBHEIsolatedNoiseAlgos.cc.

References dihits_, and relval_parameters_module::energy.

Referenced by HBHEIsolatedNoiseReflagger::produce().

788 {
789  for(std::vector<HBHEHitMap>::const_iterator it=dihits_.begin(); it!=dihits_.end(); ++it) {
790  if(it->hitEnergy()>energy) v.push_back(*it);
791  }
792  return;
793 }
std::vector< HBHEHitMap > dihits_
void HBHEHitMapOrganizer::getHPDNeighbors ( const HBHERecHit hit,
std::vector< const HBHERecHit * > &  neighbors,
const PhysicsTowerOrganizer pto 
)
private

Definition at line 805 of file HBHEIsolatedNoiseAlgos.cc.

References PhysicsTowerOrganizer::findNeighbors(), PhysicsTowerOrganizer::findTower(), HBHERecHit::id(), HcalDetId::ieta(), HcalHPDRBXMap::indexHPD(), HcalDetId::iphi(), and groupFilesInBlocks::temp.

Referenced by HBHEHitMapOrganizer().

806 {
807  std::set<const PhysicsTower*> temp;
808  pto.findNeighbors(hit->id().ieta(), hit->id().iphi(), temp);
809 
810  // make sure to include the same tower that the hit is in
811  temp.insert(pto.findTower(hit->id().ieta(), hit->id().iphi()));
812 
813  // loop over the rechits in the temp neighbors
814  for(std::set<const PhysicsTower*>::const_iterator it1=temp.begin(); it1!=temp.end(); ++it1) {
815  for(std::set<const HBHERecHit*>::const_iterator it2=(*it1)->hcalhits.begin(); it2!=(*it1)->hcalhits.end(); ++it2) {
816  const HBHERecHit* hit2(*it2);
817  if(hit!=hit2 && HcalHPDRBXMap::indexHPD(hit->id())==HcalHPDRBXMap::indexHPD(hit2->id())) {
818  neighbors.push_back(hit2);
819  }
820  }
821  }
822  return;
823 }
HcalDetId id() const
Definition: HBHERecHit.h:23
const PhysicsTower * findTower(const CaloTowerDetId &id) const
int ieta() const
get the cell ieta
Definition: HcalDetId.h:36
int iphi() const
get the cell iphi
Definition: HcalDetId.h:38
static int indexHPD(const HcalDetId &)
void findNeighbors(const CaloTowerDetId &id, std::set< const PhysicsTower * > &neighbors) const
void HBHEHitMapOrganizer::getHPDs ( std::vector< HBHEHitMap > &  v,
double  energy 
) const

Definition at line 778 of file HBHEIsolatedNoiseAlgos.cc.

References relval_parameters_module::energy, HBHEHitMap::hitEnergy(), hpds_, and python.multivaluedict::map().

Referenced by HBHEIsolatedNoiseReflagger::produce().

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

Definition at line 795 of file HBHEIsolatedNoiseAlgos.cc.

References relval_parameters_module::energy, and monohits_.

Referenced by HBHEIsolatedNoiseReflagger::produce().

796 {
797  for(std::vector<HBHEHitMap>::const_iterator it=monohits_.begin(); it!=monohits_.end(); ++it) {
798  if(it->hitEnergy()>energy) v.push_back(*it);
799  }
800  return;
801 }
std::vector< HBHEHitMap > monohits_
void HBHEHitMapOrganizer::getRBXs ( std::vector< HBHEHitMap > &  v,
double  energy 
) const

Definition at line 769 of file HBHEIsolatedNoiseAlgos.cc.

References relval_parameters_module::energy, HBHEHitMap::hitEnergy(), python.multivaluedict::map(), and rbxs_.

Referenced by HBHEIsolatedNoiseReflagger::produce().

770 {
771  for(std::map<int, HBHEHitMap>::const_iterator it=rbxs_.begin(); it!=rbxs_.end(); ++it) {
772  const HBHEHitMap &map=it->second;
773  if(map.hitEnergy()>energy) v.push_back(map);
774  }
775  return;
776 }
std::map< int, HBHEHitMap > rbxs_
double hitEnergy(void) const

Member Data Documentation

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

Definition at line 349 of file HBHEIsolatedNoiseAlgos.h.

Referenced by getDiHits(), and HBHEHitMapOrganizer().

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

Definition at line 348 of file HBHEIsolatedNoiseAlgos.h.

Referenced by getHPDs(), and HBHEHitMapOrganizer().

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

Definition at line 349 of file HBHEIsolatedNoiseAlgos.h.

Referenced by getMonoHits(), and HBHEHitMapOrganizer().

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

Definition at line 348 of file HBHEIsolatedNoiseAlgos.h.

Referenced by getRBXs(), and HBHEHitMapOrganizer().