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 92 of file EcalTools.cc.

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

Referenced by isNextToDeadFromNeighbours().

92  {
93  DetId nid;
94  if (id.subdetId() == EcalBarrel)
95  nid = EBDetId::offsetBy(id, dx, dy);
96  else if (id.subdetId() == EcalEndcap)
97  nid = EEDetId::offsetBy(id, dx, dy);
98 
99  if (!nid)
100  return false;
101 
102  EcalChannelStatus::const_iterator chIt = chs.find(nid);
103  uint16_t dbStatus = 0;
104  if (chIt != chs.end()) {
105  // note that
106  dbStatus = chIt->getStatusCode();
107  } else {
108  edm::LogError("EcalDBError") << "No channel status found for xtal " << id.rawId()
109  << "! something wrong with EcalChannelStatus in your DB? ";
110  }
111 
112  return (dbStatus >= chStatusThreshold);
113 }
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:17
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 56 of file EcalTools.cc.

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

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

56  {
58  es.get<EcalNextToDeadChannelRcd>().get(dch);
59 
61 
62  if (chIt != dch->end()) {
63  return *chIt;
64  } else {
65  edm::LogError("EcalDBError") << "No NextToDead status found for xtal " << id.rawId();
66  }
67 
68  return false;
69 }
std::vector< Item >::const_iterator const_iterator
T get() const
Definition: EventSetup.h:73
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().

71  {
72  if (deadNeighbour(id, chs, chStatusThreshold, 1, 0))
73  return true;
74  if (deadNeighbour(id, chs, chStatusThreshold, -1, 0))
75  return true;
76  if (deadNeighbour(id, chs, chStatusThreshold, 0, 1))
77  return true;
78  if (deadNeighbour(id, chs, chStatusThreshold, 0, -1))
79  return true;
80  if (deadNeighbour(id, chs, chStatusThreshold, 1, -1))
81  return true;
82  if (deadNeighbour(id, chs, chStatusThreshold, 1, 1))
83  return true;
84  if (deadNeighbour(id, chs, chStatusThreshold, -1, 1))
85  return true;
86  if (deadNeighbour(id, chs, chStatusThreshold, -1, -1))
87  return true;
88 
89  return false;
90 }
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:92
float EcalTools::recHitApproxEt ( const DetId  id,
const EcalRecHitCollection recHits 
)
staticprivate

Definition at line 139 of file EcalTools.cc.

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

Referenced by isHGCalDet(), and swissCross().

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

Definition at line 128 of file EcalTools.cc.

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

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

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

Definition at line 115 of file EcalTools.cc.

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

115  {
116  // in the barrel: di = dEta dj = dPhi
117  // in the endcap: di = dX dj = dY
118 
119  DetId nid;
120  if (id.subdetId() == EcalBarrel)
121  nid = EBDetId::offsetBy(id, di, dj);
122  else if (id.subdetId() == EcalEndcap)
123  nid = EEDetId::offsetBy(id, di, dj);
124 
125  return (nid == DetId(0) ? 0 : recHitE(nid, recHits));
126 }
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:17
static float recHitE(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:128
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(), StorageManager_cfg::e1, EcalBarrel, EcalEndcap, EBDetId::ieta(), recHitApproxEt(), recHitE(), and OccupancyTask_cfi::recHitThreshold.

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)
23  return 0;
24  // select recHits with Et above recHitThreshold
25  if (recHitApproxEt(id, recHits) < recHitThreshold)
26  return 0;
27  float s4 = 0;
28  float e1 = recHitE(id, recHits);
29  // protect against nan (if 0 threshold is given above)
30  if (e1 == 0)
31  return 0;
32  s4 += recHitE(id, recHits, 1, 0);
33  s4 += recHitE(id, recHits, -1, 0);
34  s4 += recHitE(id, recHits, 0, 1);
35  s4 += recHitE(id, recHits, 0, -1);
36  return 1 - s4 / e1;
37  } else if (id.subdetId() == EcalEndcap) {
38  EEDetId eeId(id);
39  // select recHits with E above recHitThreshold
40  float e1 = recHitE(id, recHits);
41  if (e1 < recHitThreshold)
42  return 0;
43  float s4 = 0;
44  // protect against nan (if 0 threshold is given above)
45  if (e1 == 0)
46  return 0;
47  s4 += recHitE(id, recHits, 1, 0);
48  s4 += recHitE(id, recHits, -1, 0);
49  s4 += recHitE(id, recHits, 0, 1);
50  s4 += recHitE(id, recHits, 0, -1);
51  return 1 - s4 / e1;
52  }
53  return 0;
54 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
static float recHitE(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:128
static float recHitApproxEt(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:139