CMS 3D CMS Logo

List of all members | Static Public Member Functions | Static Private Member Functions
EcalTools Class Reference

#include <EcalTools.h>

Static Public Member Functions

static bool deadNeighbour (const DetId &id, const EcalChannelStatus &chs, int chStatusThreshold, int dx, int dy)
 return true if the channel at offsets dx,dy is dead More...
 
static bool isHGCalDet (DetId::Detector thedet)
 identify HGCal cells More...
 
static bool isNextToBoundary (const DetId &id)
 true if near a crack or ecal border More...
 
static bool isNextToDead (const DetId &id, const edm::EventSetup &es)
 true if the channel is near a dead one (in the 3x3) More...
 
static bool isNextToDeadFromNeighbours (const DetId &id, const EcalChannelStatus &chs, int chStatusThreshold)
 same as isNextToDead, but will use information from the neighbour More...
 
static float swissCross (const DetId &id, const EcalRecHitCollection &recHits, float recHitThreshold, bool avoidIeta85=true)
 the good old 1-e4/e1. Ignore hits below recHitThreshold More...
 

Static Private Member Functions

static float recHitApproxEt (const DetId id, const EcalRecHitCollection &recHits)
 
static float recHitE (const DetId id, const EcalRecHitCollection &recHits)
 
static float recHitE (const DetId id, const EcalRecHitCollection &recHits, int dEta, int dPhi)
 

Detailed Description

Definition at line 17 of file EcalTools.h.

Member Function Documentation

bool EcalTools::deadNeighbour ( const DetId id,
const EcalChannelStatus chs,
int  chStatusThreshold,
int  dx,
int  dy 
)
static

return true if the channel at offsets dx,dy is dead

Definition at line 88 of file EcalTools.cc.

References EcalBarrel, EcalEndcap, EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), EBDetId::offsetBy(), and EEDetId::offsetBy().

Referenced by isNextToDeadFromNeighbours().

91  {
92 
93 
94  DetId nid;
95  if( id.subdetId() == EcalBarrel) nid = EBDetId::offsetBy( id, dx, dy );
96  else if( id.subdetId() == EcalEndcap) nid = EEDetId::offsetBy( id, dx, dy );
97 
98  if (!nid) return false;
99 
100  EcalChannelStatus::const_iterator chIt = chs.find( nid );
101  uint16_t dbStatus = 0;
102  if ( chIt != chs.end() ) {
103  // note that
104  dbStatus = chIt->getStatusCode() ;
105  } else {
106  edm::LogError("EcalDBError")
107  << "No channel status found for xtal "
108  << id.rawId()
109  << "! something wrong with EcalChannelStatus in your DB? ";
110  }
111 
112  return (dbStatus>=chStatusThreshold );
113 
114 }
EEDetId offsetBy(int nrStepsX, int nrStepsY) const
Definition: EEDetId.cc:391
EBDetId offsetBy(int nrStepsEta, int nrStepsPhi) const
Definition: EBDetId.cc:50
Definition: DetId.h:18
std::vector< Item >::const_iterator const_iterator
const_iterator find(uint32_t rawId) const
const_iterator end() const
static bool EcalTools::isHGCalDet ( DetId::Detector  thedet)
inlinestatic
static bool EcalTools::isNextToBoundary ( const DetId id)
static

true if near a crack or ecal border

bool EcalTools::isNextToDead ( const DetId id,
const edm::EventSetup es 
)
static

true if the channel is near a dead one (in the 3x3)

This function will use the ChannelStatus record to determine if the channel is next to a dead one, using bit 12 of the channel status word

Definition at line 52 of file EcalTools.cc.

References EcalCondObjectContainer< T >::end(), EcalCondObjectContainer< T >::find(), and edm::EventSetup::get().

Referenced by InterestingDetIdCollectionProducer::produce(), and InterestingDetIdFromSuperClusterProducer::produce().

52  {
53 
55  es.get<EcalNextToDeadChannelRcd>().get(dch);
56 
58 
59  if ( chIt != dch->end() ) {
60  return *chIt;
61  } else {
62  edm::LogError("EcalDBError")
63  << "No NextToDead status found for xtal "
64  << id.rawId() ;
65  }
66 
67  return false;
68 
69 }
std::vector< Item >::const_iterator const_iterator
T get() const
Definition: EventSetup.h:71
const_iterator find(uint32_t rawId) const
const_iterator end() const
bool EcalTools::isNextToDeadFromNeighbours ( const DetId id,
const EcalChannelStatus chs,
int  chStatusThreshold 
)
static

same as isNextToDead, but will use information from the neighbour

Looks at neighbours in 3x3 and returns true if one of them has chStatus above chStatusThreshold. Use sparingly, slow. Normally isNextToDead() should be used instead.

Definition at line 71 of file EcalTools.cc.

References deadNeighbour().

Referenced by EcalNextToDeadChannelESProducer::setupNextToDeadChannels().

73  {
74 
75  if (deadNeighbour(id,chs, chStatusThreshold, 1, 0)) return true;
76  if (deadNeighbour(id,chs, chStatusThreshold,-1, 0)) return true;
77  if (deadNeighbour(id,chs, chStatusThreshold, 0, 1)) return true;
78  if (deadNeighbour(id,chs, chStatusThreshold, 0,-1)) return true;
79  if (deadNeighbour(id,chs, chStatusThreshold, 1,-1)) return true;
80  if (deadNeighbour(id,chs, chStatusThreshold, 1, 1)) return true;
81  if (deadNeighbour(id,chs, chStatusThreshold,-1, 1)) return true;
82  if (deadNeighbour(id,chs, chStatusThreshold,-1,-1)) return true;
83 
84  return false;
85 }
static bool deadNeighbour(const DetId &id, const EcalChannelStatus &chs, int chStatusThreshold, int dx, int dy)
return true if the channel at offsets dx,dy is dead
Definition: EcalTools.cc:88
float EcalTools::recHitApproxEt ( const DetId  id,
const EcalRecHitCollection recHits 
)
staticprivate

Definition at line 142 of file EcalTools.cc.

References EBDetId::approxEta(), EcalBarrel, and recHitE().

Referenced by isHGCalDet(), and swissCross().

142  {
143  // for the time being works only for the barrel
144  if ( id.subdetId() == EcalBarrel ) {
145  return recHitE( id, recHits ) / cosh( EBDetId::approxEta( id ) );
146  }
147  return 0;
148 }
float approxEta() const
Definition: EBDetId.h:102
static float recHitE(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:132
float EcalTools::recHitE ( const DetId  id,
const EcalRecHitCollection recHits 
)
staticprivate

Definition at line 132 of file EcalTools.cc.

References edm::SortedCollection< T, SORT >::end(), and edm::SortedCollection< T, SORT >::find().

Referenced by isHGCalDet(), recHitApproxEt(), recHitE(), and swissCross().

132  {
133  if ( id == DetId(0) ) {
134  return 0;
135  } else {
136  EcalRecHitCollection::const_iterator it = recHits.find( id );
137  if ( it != recHits.end() ) return (*it).energy();
138  }
139  return 0;
140 }
std::vector< EcalRecHit >::const_iterator const_iterator
const_iterator end() const
Definition: DetId.h:18
iterator find(key_type k)
float EcalTools::recHitE ( const DetId  id,
const EcalRecHitCollection recHits,
int  dEta,
int  dPhi 
)
staticprivate

Definition at line 118 of file EcalTools.cc.

References EcalBarrel, EcalEndcap, EBDetId::offsetBy(), EEDetId::offsetBy(), and recHitE().

121 {
122  // in the barrel: di = dEta dj = dPhi
123  // in the endcap: di = dX dj = dY
124 
125  DetId nid;
126  if( id.subdetId() == EcalBarrel) nid = EBDetId::offsetBy( id, di, dj );
127  else if( id.subdetId() == EcalEndcap) nid = EEDetId::offsetBy( id, di, dj );
128 
129  return ( nid == DetId(0) ? 0 : recHitE( nid, recHits ) );
130 }
EEDetId offsetBy(int nrStepsX, int nrStepsY) const
Definition: EEDetId.cc:391
EBDetId offsetBy(int nrStepsEta, int nrStepsPhi) const
Definition: EBDetId.cc:50
Definition: DetId.h:18
static float recHitE(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:132
float EcalTools::swissCross ( const DetId id,
const EcalRecHitCollection recHits,
float  recHitThreshold,
bool  avoidIeta85 = true 
)
static

the good old 1-e4/e1. Ignore hits below recHitThreshold

Definition at line 11 of file EcalTools.cc.

References funct::abs(), EcalBarrel, EcalEndcap, EBDetId::ieta(), recHitApproxEt(), and recHitE().

Referenced by ZeeCandidateFilter::filter(), HiSpikeCleaner::produce(), and ecaldqm::RecoSummaryTask::runOnRecHits().

14  {
15  // compute swissCross
16  if ( id.subdetId() == EcalBarrel ) {
17  EBDetId ebId( id );
18  // avoid recHits at |eta|=85 where one side of the neighbours is missing
19  // (may improve considering also eta module borders, but no
20  // evidence for the time being that there the performance is
21  // different)
22  if ( abs(ebId.ieta())==85 && avoidIeta85) return 0;
23  // select recHits with Et above recHitThreshold
24  if ( recHitApproxEt( id, recHits ) < recHitThreshold ) return 0;
25  float s4 = 0;
26  float e1 = recHitE( id, recHits );
27  // protect against nan (if 0 threshold is given above)
28  if ( e1 == 0 ) return 0;
29  s4 += recHitE( id, recHits, 1, 0 );
30  s4 += recHitE( id, recHits, -1, 0 );
31  s4 += recHitE( id, recHits, 0, 1 );
32  s4 += recHitE( id, recHits, 0, -1 );
33  return 1 - s4 / e1;
34  } else if ( id.subdetId() == EcalEndcap ) {
35  EEDetId eeId( id );
36  // select recHits with E above recHitThreshold
37  float e1 = recHitE( id, recHits );
38  if ( e1 < recHitThreshold ) return 0;
39  float s4 = 0;
40  // protect against nan (if 0 threshold is given above)
41  if ( e1 == 0 ) return 0;
42  s4 += recHitE( id, recHits, 1, 0 );
43  s4 += recHitE( id, recHits, -1, 0 );
44  s4 += recHitE( id, recHits, 0, 1 );
45  s4 += recHitE( id, recHits, 0, -1 );
46  return 1 - s4 / e1;
47  }
48  return 0;
49 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static float recHitE(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:132
static float recHitApproxEt(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:142