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 EcalNextToDeadChannel &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 18 of file EcalTools.h.

Member Function Documentation

◆ deadNeighbour()

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

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

Referenced by isNextToDeadFromNeighbours().

87  {
88  DetId nid;
89  if (id.subdetId() == EcalBarrel)
90  nid = EBDetId::offsetBy(id, dx, dy);
91  else if (id.subdetId() == EcalEndcap)
92  nid = EEDetId::offsetBy(id, dx, dy);
93 
94  if (!nid)
95  return false;
96 
98  uint16_t dbStatus = 0;
99  if (chIt != chs.end()) {
100  // note that
101  dbStatus = chIt->getStatusCode();
102  } else {
103  edm::LogError("EcalDBError") << "No channel status found for xtal " << id.rawId()
104  << "! something wrong with EcalChannelStatus in your DB? ";
105  }
106 
107  return (dbStatus >= chStatusThreshold);
108 }
Log< level::Error, false > LogError
EEDetId offsetBy(int nrStepsX, int nrStepsY) const
Definition: EEDetId.cc:391
const_iterator find(uint32_t rawId) const
Definition: DetId.h:17
std::vector< Item >::const_iterator const_iterator
EBDetId offsetBy(int nrStepsEta, int nrStepsPhi) const
Definition: EBDetId.cc:50
const_iterator end() const

◆ isHGCalDet()

static bool EcalTools::isHGCalDet ( DetId::Detector  thedet)
inlinestatic

◆ isNextToBoundary()

static bool EcalTools::isNextToBoundary ( const DetId id)
static

true if near a crack or ecal border

◆ isNextToDead()

bool EcalTools::isNextToDead ( const DetId id,
const EcalNextToDeadChannel 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 54 of file EcalTools.cc.

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

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

54  {
55  EcalNextToDeadChannel::const_iterator chIt = dch.find(id);
56 
57  if (chIt != dch.end()) {
58  return *chIt;
59  } else {
60  edm::LogError("EcalDBError") << "No NextToDead status found for xtal " << id.rawId();
61  }
62 
63  return false;
64 }
Log< level::Error, false > LogError
std::vector< Item >::const_iterator const_iterator

◆ isNextToDeadFromNeighbours()

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

References deadNeighbour().

Referenced by EcalNextToDeadChannelESProducer::setupNextToDeadChannels().

66  {
67  if (deadNeighbour(id, chs, chStatusThreshold, 1, 0))
68  return true;
69  if (deadNeighbour(id, chs, chStatusThreshold, -1, 0))
70  return true;
71  if (deadNeighbour(id, chs, chStatusThreshold, 0, 1))
72  return true;
73  if (deadNeighbour(id, chs, chStatusThreshold, 0, -1))
74  return true;
75  if (deadNeighbour(id, chs, chStatusThreshold, 1, -1))
76  return true;
77  if (deadNeighbour(id, chs, chStatusThreshold, 1, 1))
78  return true;
79  if (deadNeighbour(id, chs, chStatusThreshold, -1, 1))
80  return true;
81  if (deadNeighbour(id, chs, chStatusThreshold, -1, -1))
82  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:87

◆ recHitApproxEt()

float EcalTools::recHitApproxEt ( const DetId  id,
const EcalRecHitCollection recHits 
)
staticprivate

Definition at line 134 of file EcalTools.cc.

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

Referenced by swissCross().

134  {
135  // for the time being works only for the barrel
136  if (id.subdetId() == EcalBarrel) {
137  return recHitE(id, recHits) / cosh(EBDetId::approxEta(id));
138  }
139  return 0;
140 }
float approxEta() const
Definition: EBDetId.h:102
static float recHitE(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:123

◆ recHitE() [1/2]

float EcalTools::recHitE ( const DetId  id,
const EcalRecHitCollection recHits 
)
staticprivate

Definition at line 123 of file EcalTools.cc.

References ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, and FastTrackerRecHitMaskProducer_cfi::recHits.

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

123  {
124  if (id == DetId(0)) {
125  return 0;
126  } else {
128  if (it != recHits.end())
129  return (*it).energy();
130  }
131  return 0;
132 }
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: DetId.h:17

◆ recHitE() [2/2]

float EcalTools::recHitE ( const DetId  id,
const EcalRecHitCollection recHits,
int  dEta,
int  dPhi 
)
staticprivate

Definition at line 110 of file EcalTools.cc.

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

110  {
111  // in the barrel: di = dEta dj = dPhi
112  // in the endcap: di = dX dj = dY
113 
114  DetId nid;
115  if (id.subdetId() == EcalBarrel)
116  nid = EBDetId::offsetBy(id, di, dj);
117  else if (id.subdetId() == EcalEndcap)
118  nid = EEDetId::offsetBy(id, di, dj);
119 
120  return (nid == DetId(0) ? 0 : recHitE(nid, recHits));
121 }
EEDetId offsetBy(int nrStepsX, int nrStepsY) const
Definition: EEDetId.cc:391
Definition: DetId.h:17
static float recHitE(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:123
EBDetId offsetBy(int nrStepsEta, int nrStepsPhi) const
Definition: EBDetId.cc:50

◆ swissCross()

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

References funct::abs(), StorageManager_cfg::e1, EcalBarrel, EcalEndcap, EBDetId::ieta(), recHitApproxEt(), recHitE(), FastTrackerRecHitMaskProducer_cfi::recHits, OccupancyTask_cfi::recHitThreshold, and photons_cff::s4.

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

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