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
EgammaRecHitIsolation Class Reference

#include <EgammaRecHitIsolation.h>

Public Member Functions

void doFlagChecks (const std::vector< int > v)
 
void doSpikeRemoval (const EcalRecHitCollection *const recHits, const EcalChannelStatus *const chStatus, const int &severityLevelCut=3, const float &sevRecHitThresh=5.0, const EcalSeverityLevelAlgo::SpikeId &id=EcalSeverityLevelAlgo::kSwissCross, const float &spIdThresh=0.95)
 
 EgammaRecHitIsolation (double extRadius, double intRadius, double etaSlice, double etLow, double eLow, edm::ESHandle< CaloGeometry >, CaloRecHitMetaCollectionV *, DetId::Detector detector)
 
double getEnergySum (const reco::Candidate *emObject) const
 
double getEtSum (const reco::Candidate *emObject) const
 
void setUseNumCrystals (bool b=true)
 
void setVetoClustered (bool b=true)
 
 ~EgammaRecHitIsolation ()
 

Private Member Functions

double getSum_ (const reco::Candidate *, bool returnEt) const
 

Private Attributes

CaloRecHitMetaCollectionVcaloHits_
 
const EcalChannelStatuschStatus_
 
const EcalRecHitCollectionecalBarHits_
 
double eLow_
 
double etaSlice_
 
double etLow_
 
double extRadius_
 
double intRadius_
 
int severityLevelCut_
 
float severityRecHitThreshold_
 
EcalSeverityLevelAlgo::SpikeId spId_
 
float spIdThreshold_
 
const CaloSubdetectorGeometrysubdet_ [2]
 
edm::ESHandle< CaloGeometrytheCaloGeom_
 
bool useNumCrystals_
 
std::vector< int > v_chstatus_
 
bool vetoClustered_
 

Detailed Description

Definition at line 26 of file EgammaRecHitIsolation.h.

Constructor & Destructor Documentation

EgammaRecHitIsolation::EgammaRecHitIsolation ( double  extRadius,
double  intRadius,
double  etaSlice,
double  etLow,
double  eLow,
edm::ESHandle< CaloGeometry theCaloGeom,
CaloRecHitMetaCollectionV caloHits,
DetId::Detector  detector 
)

Definition at line 32 of file EgammaRecHitIsolation.cc.

References DetId::Ecal, EcalBarrel, EcalEndcap, CaloGeometry::getSubdetectorGeometry(), edm::ESHandle< class >::product(), subdet_, and theCaloGeom_.

39  : // not used anymore, kept for compatibility
42  etaSlice_(etaSlice),
43  etLow_(etLow),
44  eLow_(eLow),
45  theCaloGeom_(theCaloGeom) ,
46  caloHits_(caloHits),
47  useNumCrystals_(false),
48  vetoClustered_(false),
49  ecalBarHits_(0),
50  chStatus_(0),
54  spIdThreshold_(0),
55  v_chstatus_(0)
56 {
57  //set up the geometry and selector
58  const CaloGeometry* caloGeom = theCaloGeom_.product();
61 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:43
const CaloSubdetectorGeometry * subdet_[2]
edm::ESHandle< CaloGeometry > theCaloGeom_
CaloRecHitMetaCollectionV * caloHits_
EcalSeverityLevelAlgo::SpikeId spId_
const EcalChannelStatus * chStatus_
const EcalRecHitCollection * ecalBarHits_
std::vector< int > v_chstatus_
T const * product() const
Definition: ESHandle.h:62
EgammaRecHitIsolation::~EgammaRecHitIsolation ( )

Definition at line 63 of file EgammaRecHitIsolation.cc.

64 {
65 }

Member Function Documentation

void EgammaRecHitIsolation::doFlagChecks ( const std::vector< int >  v)
inline

Definition at line 57 of file EgammaRecHitIsolation.h.

References python.multivaluedict::sort(), and v_chstatus_.

Referenced by GsfElectronAlgo::beginEvent().

57  {
58  v_chstatus_.clear();
59  v_chstatus_.insert(v_chstatus_.begin(),v.begin(),v.end());
60  std::sort( v_chstatus_.begin(), v_chstatus_.end() );
61  }
std::vector< int > v_chstatus_
mathSSE::Vec4< T > v
void EgammaRecHitIsolation::doSpikeRemoval ( const EcalRecHitCollection *const  recHits,
const EcalChannelStatus *const  chStatus,
const int &  severityLevelCut = 3,
const float &  sevRecHitThresh = 5.0,
const EcalSeverityLevelAlgo::SpikeId id = EcalSeverityLevelAlgo::kSwissCross,
const float &  spIdThresh = 0.95 
)
inline
double EgammaRecHitIsolation::getEnergySum ( const reco::Candidate emObject) const
inline

Definition at line 40 of file EgammaRecHitIsolation.h.

References getSum_().

Referenced by EgammaHLTEcalRecIsolationProducer::produce(), and EgammaEcalRecHitIsolationProducer::produce().

40 { return getSum_(emObject,false);}
double getSum_(const reco::Candidate *, bool returnEt) const
double EgammaRecHitIsolation::getEtSum ( const reco::Candidate emObject) const
inline
double EgammaRecHitIsolation::getSum_ ( const reco::Candidate emObject,
bool  returnEt 
) const
private

Definition at line 67 of file EgammaRecHitIsolation.cc.

References caloHits_, chStatus_, reco::deltaPhi(), CaloRecHit::detid(), ecalBarHits_, eLow_, CaloRecHitMetaCollectionV::end(), CaloRecHit::energy(), relval_parameters_module::energy, CastorDataFrameFilter_impl::energySum(), ExpressReco_HICollisions_FallBack::et, PV3DBase< T, PVType, FrameType >::eta(), eta(), etaSlice_, etLow_, extRadius_, spr::find(), CaloRecHitMetaCollectionV::find(), reco::Candidate::get(), edm::Ref< C, T, F >::get(), CaloSubdetectorGeometry::getCells(), i, intRadius_, j, PV3DBase< T, PVType, FrameType >::mag(), PV3DBase< T, PVType, FrameType >::perp(), phi, PV3DBase< T, PVType, FrameType >::phi(), position, edm::ESHandle< class >::product(), EcalSeverityLevelAlgo::severityLevel(), severityLevelCut_, severityRecHitThreshold_, spId_, spIdThreshold_, mathSSE::sqrt(), subdet_, theCaloGeom_, useNumCrystals_, v_chstatus_, and vetoClustered_.

Referenced by getEnergySum(), and getEtSum().

68 {
69 
70  double energySum = 0.;
71  if (caloHits_){
72  //Take the SC position
74  math::XYZPoint theCaloPosition = sc.get()->position();
75  GlobalPoint pclu (theCaloPosition.x () ,
76  theCaloPosition.y () ,
77  theCaloPosition.z () );
78  double etaclus = pclu.eta();
79  double phiclus = pclu.phi();
80  double r2 = intRadius_*intRadius_;
81 
82 
83  std::vector< std::pair<DetId, float> >::const_iterator rhIt;
84 
85 
86  for(int subdetnr=0; subdetnr<=1 ; subdetnr++){ // look in barrel and endcap
87  CaloSubdetectorGeometry::DetIdSet chosen = subdet_[subdetnr]->getCells(pclu,extRadius_);// select cells around cluster
89  for (CaloSubdetectorGeometry::DetIdSet::const_iterator i = chosen.begin ();i!= chosen.end ();++i){//loop selected cells
90 
91  j=caloHits_->find(*i); // find selected cell among rechits
92  if( j!=caloHits_->end()){ // add rechit only if available
93  const GlobalPoint & position = theCaloGeom_.product()->getPosition(*i);
94  double eta = position.eta();
95  double phi = position.phi();
96  double etaDiff = eta - etaclus;
97  double phiDiff= reco::deltaPhi(phi,phiclus);
98  double energy = j->energy();
99 
100  if(useNumCrystals_) {
101  if( fabs(etaclus) < 1.479 ) { // Barrel num crystals, crystal width = 0.0174
102  if ( fabs(etaDiff) < 0.0174*etaSlice_) continue;
103  if ( sqrt(etaDiff*etaDiff + phiDiff*phiDiff) < 0.0174*intRadius_) continue;
104  } else { // Endcap num crystals, crystal width = 0.00864*fabs(sinh(eta))
105  if ( fabs(etaDiff) < 0.00864*fabs(sinh(eta))*etaSlice_) continue;
106  if ( sqrt(etaDiff*etaDiff + phiDiff*phiDiff) < 0.00864*fabs(sinh(eta))*intRadius_) continue;
107  }
108  } else {
109  if ( fabs(etaDiff) < etaSlice_) continue; // jurassic strip cut
110  if ( etaDiff*etaDiff + phiDiff*phiDiff < r2) continue; // jurassic exclusion cone cut
111  }
112 
113  //Check if RecHit is in SC
114  if(vetoClustered_) {
115 
116  //Loop over basic clusters:
117  bool isClustered = false;
118  for(reco::CaloCluster_iterator bcIt = sc->clustersBegin();bcIt != sc->clustersEnd(); ++bcIt) {
119  for(rhIt = (*bcIt)->hitsAndFractions().begin();rhIt != (*bcIt)->hitsAndFractions().end(); ++rhIt) {
120  if( rhIt->first == *i ) isClustered = true;
121  if( isClustered ) break;
122  }
123  if( isClustered ) break;
124  } //end loop over basic clusters
125 
126  if(isClustered) continue;
127  } //end if removeClustered
128 
129  //Severity level check
130  if( severityLevelCut_!=-1 && ecalBarHits_ && //make sure we have a barrel rechit
131  EcalSeverityLevelAlgo::severityLevel( //call the severity level method
132  EBDetId(j->detid()), //passing the EBDetId
133  *ecalBarHits_, //the rechit collection in order to calculate the swiss crss
134  *chStatus_, //and the EcalChannelRecHitRcd
135  severityRecHitThreshold_, //only consider rechits with ET >
136  spId_, //the SpikeId method (currently kE1OverE9 or kSwissCross)
137  spIdThreshold_ //cut value for above
138  ) >= severityLevelCut_) continue; //then if the severity level is too high, we continue to the next rechit
139 
140  //Check based on flags to protect from recovered channels from non-read towers
141  //Assumption is that v_chstatus_ is empty unless doFlagChecks() has been called
142  std::vector<int>::const_iterator vit = std::find( v_chstatus_.begin(), v_chstatus_.end(), ((EcalRecHit*)(&*j))->recoFlag() );
143  if ( vit != v_chstatus_.end() ) continue; // the recHit has to be excluded from the iso sum
144 
145 
146  double et = energy*position.perp()/position.mag();
147  if ( fabs(et) > etLow_ && fabs(energy) > eLow_){ //Changed energy --> fabs(energy)
148  if(returnEt) energySum+=et;
149  else energySum+=energy;
150  }
151 
152  } //End if not end of list
153  } //End loop over rechits
154  } //End loop over barrel/endcap
155  } //End if caloHits_
156  return energySum;
157 }
virtual const_iterator find(const DetId &id) const
find by id (default version is very slow unsorted find)
int i
Definition: DBlmapReader.cc:9
const CaloSubdetectorGeometry * subdet_[2]
edm::ESHandle< CaloGeometry > theCaloGeom_
CaloRecHitMetaCollectionV * caloHits_
T perp() const
Definition: PV3DBase.h:66
const DetId & detid() const
Definition: CaloRecHit.h:21
EcalSeverityLevelAlgo::SpikeId spId_
Geom::Phi< T > phi() const
Definition: PV3DBase.h:63
const EcalChannelStatus * chStatus_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
T eta() const
static int position[TOTALCHAMBERS][3]
Definition: ReadPGInfo.cc:509
const_iterator end() const
get the ending iterator
virtual DetIdSet getCells(const GlobalPoint &r, double dR) const
Get a list of all cells within a dR of the given cell.
T mag() const
Definition: PV3DBase.h:61
float energy() const
Definition: CaloRecHit.h:19
T sqrt(T t)
Definition: SSEVec.h:28
int j
Definition: DBlmapReader.cc:9
const EcalRecHitCollection * ecalBarHits_
double deltaPhi(double phi1, double phi2)
Definition: deltaPhi.h:12
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:13
std::vector< int > v_chstatus_
T const * product() const
Definition: ESHandle.h:62
T eta() const
Definition: PV3DBase.h:70
T get() const
get a component
Definition: Candidate.h:217
static int severityLevel(const DetId, const EcalRecHitCollection &, const EcalChannelStatus &, float recHitEtThreshold=5., SpikeId spId=kSwissCross, float spIdThreshold=0.95, float recHitEnergyThresholdForTiming=2., float recHitEnergyThresholdForEE=15, float spIdThresholdIEta85=0.999)
double energySum(const DataFrame &df, int fs, int ls)
T const * get() const
Returns C++ pointer to the item.
Definition: Ref.h:239
Definition: DDAxes.h:10
void EgammaRecHitIsolation::setUseNumCrystals ( bool  b = true)
inline
void EgammaRecHitIsolation::setVetoClustered ( bool  b = true)
inline

Member Data Documentation

CaloRecHitMetaCollectionV* EgammaRecHitIsolation::caloHits_
private

Definition at line 77 of file EgammaRecHitIsolation.h.

Referenced by getSum_().

const EcalChannelStatus* EgammaRecHitIsolation::chStatus_
private

Definition at line 82 of file EgammaRecHitIsolation.h.

Referenced by doSpikeRemoval(), and getSum_().

const EcalRecHitCollection* EgammaRecHitIsolation::ecalBarHits_
private

Definition at line 81 of file EgammaRecHitIsolation.h.

Referenced by doSpikeRemoval(), and getSum_().

double EgammaRecHitIsolation::eLow_
private

Definition at line 73 of file EgammaRecHitIsolation.h.

Referenced by getSum_().

double EgammaRecHitIsolation::etaSlice_
private

Definition at line 71 of file EgammaRecHitIsolation.h.

Referenced by getSum_().

double EgammaRecHitIsolation::etLow_
private

Definition at line 72 of file EgammaRecHitIsolation.h.

Referenced by getSum_().

double EgammaRecHitIsolation::extRadius_
private

Definition at line 69 of file EgammaRecHitIsolation.h.

Referenced by getSum_().

double EgammaRecHitIsolation::intRadius_
private

Definition at line 70 of file EgammaRecHitIsolation.h.

Referenced by getSum_().

int EgammaRecHitIsolation::severityLevelCut_
private

Definition at line 83 of file EgammaRecHitIsolation.h.

Referenced by doSpikeRemoval(), and getSum_().

float EgammaRecHitIsolation::severityRecHitThreshold_
private

Definition at line 84 of file EgammaRecHitIsolation.h.

Referenced by doSpikeRemoval(), and getSum_().

EcalSeverityLevelAlgo::SpikeId EgammaRecHitIsolation::spId_
private

Definition at line 85 of file EgammaRecHitIsolation.h.

Referenced by doSpikeRemoval(), and getSum_().

float EgammaRecHitIsolation::spIdThreshold_
private

Definition at line 86 of file EgammaRecHitIsolation.h.

Referenced by doSpikeRemoval(), and getSum_().

const CaloSubdetectorGeometry* EgammaRecHitIsolation::subdet_[2]
private

Definition at line 90 of file EgammaRecHitIsolation.h.

Referenced by EgammaRecHitIsolation(), and getSum_().

edm::ESHandle<CaloGeometry> EgammaRecHitIsolation::theCaloGeom_
private

Definition at line 76 of file EgammaRecHitIsolation.h.

Referenced by EgammaRecHitIsolation(), and getSum_().

bool EgammaRecHitIsolation::useNumCrystals_
private

Definition at line 79 of file EgammaRecHitIsolation.h.

Referenced by getSum_(), and setUseNumCrystals().

std::vector<int> EgammaRecHitIsolation::v_chstatus_
private

Definition at line 87 of file EgammaRecHitIsolation.h.

Referenced by doFlagChecks(), and getSum_().

bool EgammaRecHitIsolation::vetoClustered_
private

Definition at line 80 of file EgammaRecHitIsolation.h.

Referenced by getSum_(), and setVetoClustered().