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

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

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 }

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

Referenced by isNextToDeadFromNeighbours().

◆ 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 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.

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 }

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

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

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

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 }

References deadNeighbour().

Referenced by EcalNextToDeadChannelESProducer::setupNextToDeadChannels().

◆ recHitApproxEt()

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

Definition at line 139 of file EcalTools.cc.

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 }

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

Referenced by swissCross().

◆ recHitE() [1/2]

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

Definition at line 128 of file EcalTools.cc.

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 }

References FastTrackerRecHitMaskProducer_cfi::recHits.

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

◆ recHitE() [2/2]

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

Definition at line 115 of file EcalTools.cc.

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 }

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

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

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
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 }

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

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

EcalCondObjectContainer::end
const_iterator end() const
Definition: EcalCondObjectContainer.h:76
edm::SortedCollection< EcalRecHit >::const_iterator
std::vector< EcalRecHit >::const_iterator const_iterator
Definition: SortedCollection.h:80
EBDetId::approxEta
float approxEta() const
Definition: EBDetId.h:102
EBDetId
Definition: EBDetId.h:17
DetId::Hcal
Definition: DetId.h:28
EcalBarrel
Definition: EcalSubdetector.h:10
EcalTools::recHitApproxEt
static float recHitApproxEt(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:139
DetId
Definition: DetId.h:17
DetId::HGCalHSi
Definition: DetId.h:33
DetId::HGCalEE
Definition: DetId.h:32
EEDetId::offsetBy
EEDetId offsetBy(int nrStepsX, int nrStepsY) const
Definition: EEDetId.cc:391
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
OccupancyTask_cfi.recHitThreshold
recHitThreshold
Definition: OccupancyTask_cfi.py:4
edm::ESHandle
Definition: DTSurvey.h:22
EcalCondObjectContainer::find
const_iterator find(uint32_t rawId) const
Definition: EcalCondObjectContainer.h:53
EcalTools::deadNeighbour
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
EcalTools::recHitE
static float recHitE(const DetId id, const EcalRecHitCollection &recHits)
Definition: EcalTools.cc:128
EEDetId
Definition: EEDetId.h:14
EcalEndcap
Definition: EcalSubdetector.h:10
FastTrackerRecHitMaskProducer_cfi.recHits
recHits
Definition: FastTrackerRecHitMaskProducer_cfi.py:8
edm::LogError
Definition: MessageLogger.h:183
StorageManager_cfg.e1
e1
Definition: StorageManager_cfg.py:16
PVValHelper::dy
Definition: PVValidationHelpers.h:49
EBDetId::offsetBy
EBDetId offsetBy(int nrStepsEta, int nrStepsPhi) const
Definition: EBDetId.cc:50
get
#define get
DetId::HGCalHSc
Definition: DetId.h:34
EcalCondObjectContainer< EcalChannelStatusCode >::const_iterator
std::vector< Item >::const_iterator const_iterator
Definition: EcalCondObjectContainer.h:19
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DetId::Forward
Definition: DetId.h:30
PVValHelper::dx
Definition: PVValidationHelpers.h:48
EcalNextToDeadChannelRcd
Definition: EcalNextToDeadChannelRcd.h:12