CMS 3D CMS Logo

EgammaHcalIsolation.cc
Go to the documentation of this file.
1 //*****************************************************************************
2 // File: EgammaHcalIsolation.cc
3 // ----------------------------------------------------------------------------
4 // OrigAuth: Matthias Mozer
5 // Institute: IIHE-VUB
6 //=============================================================================
7 //*****************************************************************************
8 //ROOT includes
9 #include <Math/VectorUtil.h>
10 
11 //CMSSW includes
19 
20 double scaleToE(const double &eta) { return 1.; }
21 double scaleToEt(const double &eta) { return std::sin(2. * std::atan(std::exp(-eta))); }
22 
23 EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule,
24  double extRadius,
25  InclusionRule intIncRule,
26  double intRadius,
27  const arrayHB &eThresHB,
28  const arrayHB &etThresHB,
29  int maxSeverityHB,
30  const arrayHE &eThresHE,
31  const arrayHE &etThresHE,
32  int maxSeverityHE,
33  const HBHERecHitCollection &mhbhe,
34  edm::ESHandle<CaloGeometry> caloGeometry,
35  edm::ESHandle<HcalTopology> hcalTopology,
39  : extIncRule_(extIncRule),
40  extRadius_(extRadius * extRadius),
41  intIncRule_(intIncRule),
42  intRadius_(intRadius * intRadius),
43  maxSeverityHB_(maxSeverityHB),
44  maxSeverityHE_(maxSeverityHE),
45  mhbhe_(mhbhe),
46  caloGeometry_(*caloGeometry.product()),
47  hcalTopology_(*hcalTopology.product()),
48  hcalChStatus_(*hcalChStatus.product()),
49  hcalSevLvlComputer_(*hcalSevLvlComputer.product()),
50  towerMap_(*towerMap.product()) {
51  eThresHB_ = eThresHB;
52  etThresHB_ = etThresHB;
53  eThresHE_ = eThresHE;
54  etThresHE_ = etThresHE;
55 
56  // make some adjustments for the BC rules
57  if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) {
58  extRadius_ = 0.;
59  intRadius_ = 0.;
60  } else if (extIncRule_ == InclusionRule::withinConeAroundCluster and
61  intIncRule_ == InclusionRule::isBehindClusterSeed) {
62  intRadius_ = 0.;
63  } else if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::isBehindClusterSeed) {
64  edm::LogWarning("EgammaHcalIsolation")
65  << " external and internal rechit inclusion rules can't both be isBehindClusterSeed."
66  << " Setting both to withinConeAroundCluster!";
67  extIncRule_ = InclusionRule::withinConeAroundCluster;
68  intIncRule_ = InclusionRule::withinConeAroundCluster;
69  }
70 }
71 
72 EgammaHcalIsolation::EgammaHcalIsolation(InclusionRule extIncRule,
73  double extRadius,
74  InclusionRule intIncRule,
75  double intRadius,
76  const arrayHB &eThresHB,
77  const arrayHB &etThresHB,
78  int maxSeverityHB,
79  const arrayHE &eThresHE,
80  const arrayHE &etThresHE,
81  int maxSeverityHE,
82  const HBHERecHitCollection &mhbhe,
83  const CaloGeometry &caloGeometry,
84  const HcalTopology &hcalTopology,
85  const HcalChannelQuality &hcalChStatus,
86  const HcalSeverityLevelComputer &hcalSevLvlComputer,
87  const CaloTowerConstituentsMap &towerMap)
88  : extIncRule_(extIncRule),
89  extRadius_(extRadius * extRadius),
90  intIncRule_(intIncRule),
91  intRadius_(intRadius * intRadius),
92  maxSeverityHB_(maxSeverityHB),
93  maxSeverityHE_(maxSeverityHE),
94  mhbhe_(mhbhe),
95  caloGeometry_(caloGeometry),
96  hcalTopology_(hcalTopology),
97  hcalChStatus_(hcalChStatus),
98  hcalSevLvlComputer_(hcalSevLvlComputer),
99  towerMap_(towerMap) {
100  eThresHB_ = eThresHB;
101  etThresHB_ = etThresHB;
102  eThresHE_ = eThresHE;
103  etThresHE_ = etThresHE;
104 
105  // make some adjustments for the BC rules
106  if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::withinConeAroundCluster) {
107  extRadius_ = 0.;
108  intRadius_ = 0.;
109  } else if (extIncRule_ == InclusionRule::withinConeAroundCluster and
110  intIncRule_ == InclusionRule::isBehindClusterSeed) {
111  intRadius_ = 0.;
112  } else if (extIncRule_ == InclusionRule::isBehindClusterSeed and intIncRule_ == InclusionRule::isBehindClusterSeed) {
113  edm::LogWarning("EgammaHcalIsolation")
114  << " external and internal rechit inclusion rules can't both be isBehindClusterSeed."
115  << " Setting both to withinConeAroundCluster!";
116  extIncRule_ = InclusionRule::withinConeAroundCluster;
117  intIncRule_ = InclusionRule::withinConeAroundCluster;
118  }
119 }
120 
122  const HBHERecHit &hit,
123  int depth,
124  int ieta,
125  int iphi,
126  int include_or_exclude,
127  double (*scale)(const double &)) const {
128  const auto phit = caloGeometry_.getPosition(hit.detid());
129 
132  return 0.;
133 
134  const HcalDetId hid(hit.detid());
135  const int hd = hid.depth(), he = hid.ieta(), hp = hid.iphi();
136  const int h1 = hd - 1;
137 
138  if ((hid.subdet() == HcalBarrel and (hd < 1 or hd > int(eThresHB_.size()))) or
139  (hid.subdet() == HcalEndcap and (hd < 1 or hd > int(eThresHE_.size()))))
140  edm::LogWarning("EgammaHcalIsolation")
141  << " hit in subdet " << hid.subdet() << " has an unaccounted for depth of " << hd << "!!";
142 
143  if (include_or_exclude == -1 and (he != ieta or hp != iphi))
144  return 0.;
145 
146  if (include_or_exclude == 1 and (he == ieta and hp == iphi))
147  return 0.;
148 
149  const bool right_depth = (depth == 0 or hd == depth);
150  if (!right_depth)
151  return 0.;
152 
153  DetId did = hcalTopology_.idFront(hid);
154  const uint32_t flag = hit.flags();
155  const uint32_t dbflag = hcalChStatus_.getValues(did)->getValue();
157  bool recovered = hcalSevLvlComputer_.recoveredRecHit(did, flag);
158 
159  const double het = hit.energy() * scaleToEt(phit.eta());
160  const bool goodHB = hid.subdet() == HcalBarrel and (severity <= maxSeverityHB_ or recovered) and
161  hit.energy() > eThresHB_[h1] and het > etThresHB_[h1];
162  const bool goodHE = hid.subdet() == HcalEndcap and (severity <= maxSeverityHE_ or recovered) and
163  hit.energy() > eThresHE_[h1] and het > etThresHE_[h1];
164 
165  if (goodHB or goodHE)
166  return hit.energy() * scale(phit.eta());
167 
168  return 0.;
169 }
170 
172  int depth,
173  int ieta,
174  int iphi,
175  int include_or_exclude,
176  double (*scale)(const double &)) const {
177  double sum = 0.;
178  for (const auto &hit : mhbhe_)
179  sum += goodHitEnergy(pclu, hit, depth, ieta, iphi, include_or_exclude, scale);
180 
181  return sum;
182 }
EgammaHcalIsolation::intIncRule_
InclusionRule intIncRule_
Definition: EgammaHcalIsolation.h:155
EgammaHcalIsolation::etThresHB_
arrayHB etThresHB_
Definition: EgammaHcalIsolation.h:159
HcalSeverityLevelComputer::recoveredRecHit
bool recoveredRecHit(const DetId &myid, const uint32_t &myflag) const
Definition: HcalSeverityLevelComputer.cc:363
HcalTopology::idFront
HcalDetId idFront(const HcalDetId &id) const
Definition: HcalTopology.h:170
MessageLogger.h
L1EGammaCrystalsEmulatorProducer_cfi.scale
scale
Definition: L1EGammaCrystalsEmulatorProducer_cfi.py:10
EgammaHcalIsolation::extIncRule_
InclusionRule extIncRule_
Definition: EgammaHcalIsolation.h:153
EgammaHcalIsolation::InclusionRule::withinConeAroundCluster
CaloGeometry::getPosition
GlobalPoint getPosition(const DetId &id) const
Get the position of a given detector id.
Definition: CaloGeometry.cc:50
electronEcalRecHitIsolationLcone_cfi.extRadius
extRadius
Definition: electronEcalRecHitIsolationLcone_cfi.py:16
HBHERecHit
Definition: HBHERecHit.h:13
HcalTopology
Definition: HcalTopology.h:26
edm::SortedCollection
Definition: SortedCollection.h:49
TrackingGeometry.h
HcalDetId::depth
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
HcalChannelQuality
Definition: HcalChannelQuality.h:17
HcalBarrel
Definition: HcalAssistant.h:33
EgammaHcalIsolation::hcalChStatus_
const HcalChannelQuality & hcalChStatus_
Definition: EgammaHcalIsolation.h:169
EgammaHcalIsolation::etThresHE_
arrayHE etThresHE_
Definition: EgammaHcalIsolation.h:163
RecoCandidate.h
edm::LogWarning
Log< level::Warning, false > LogWarning
Definition: MessageLogger.h:122
EgammaHcalIsolation::caloGeometry_
const CaloGeometry & caloGeometry_
Definition: EgammaHcalIsolation.h:167
HcalCondObjectContainer::getValues
const Item * getValues(DetId fId, bool throwOnFail=true) const
Definition: HcalCondObjectContainer.h:159
funct::sin
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
scaleToE
double scaleToE(const double &eta)
Definition: EgammaHcalIsolation.cc:20
LEDCalibrationChannels.iphi
iphi
Definition: LEDCalibrationChannels.py:64
DetId
Definition: DetId.h:17
CaloGeometry
Definition: CaloGeometry.h:21
trackingPlots.hp
hp
Definition: trackingPlots.py:1231
PVValHelper::eta
Definition: PVValidationHelpers.h:70
EgammaHcalIsolation::extRadius_
double extRadius_
Definition: EgammaHcalIsolation.h:154
HcalSeverityLevelComputer
Definition: HcalSeverityLevelComputer.h:24
CaloTowerConstituentsMap
Definition: CaloTowerConstituentsMap.h:18
edm::ESHandle< CaloGeometry >
Point3DBase< float, GlobalTag >
EgammaHcalIsolation::maxSeverityHE_
int maxSeverityHE_
Definition: EgammaHcalIsolation.h:164
LEDCalibrationChannels.depth
depth
Definition: LEDCalibrationChannels.py:65
HcalSeverityLevelComputer::getSeverityLevel
int getSeverityLevel(const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
Definition: HcalSeverityLevelComputer.cc:304
HcalChannelStatus::getValue
uint32_t getValue() const
Definition: HcalChannelStatus.h:60
TrackerDigiGeometryRecord.h
LEDCalibrationChannels.ieta
ieta
Definition: LEDCalibrationChannels.py:63
scaleToEt
double scaleToEt(const double &eta)
Definition: EgammaHcalIsolation.cc:21
deltaR.h
HcalDetId.h
HcalDetId
Definition: HcalDetId.h:12
EgammaHcalIsolation::getHcalSum
double getHcalSum(const GlobalPoint &pclu, int depth, int ieta, int iphi, int include_or_exclude, double(*scale)(const double &)) const
Definition: EgammaHcalIsolation.cc:171
EgammaHcalIsolation::intRadius_
double intRadius_
Definition: EgammaHcalIsolation.h:156
EgammaHcalIsolation::EgammaHcalIsolation
EgammaHcalIsolation(InclusionRule extIncRule, double extRadius, InclusionRule intIncRule, double intRadius, const arrayHB &eThresHB, const arrayHB &etThresHB, int maxSeverityHB, const arrayHE &eThresHE, const arrayHE &etThresHE, int maxSeverityHE, const HBHERecHitCollection &mhbhe, edm::ESHandle< CaloGeometry > caloGeometry, edm::ESHandle< HcalTopology > hcalTopology, edm::ESHandle< HcalChannelQuality > hcalChStatus, edm::ESHandle< HcalSeverityLevelComputer > hcalSevLvlComputer, edm::ESHandle< CaloTowerConstituentsMap > towerMap)
EgammaHcalIsolation::eThresHB_
arrayHB eThresHB_
Definition: EgammaHcalIsolation.h:158
hcalSimParameters_cfi.he
he
Definition: hcalSimParameters_cfi.py:79
HLTMuonOfflineAnalyzer_cfi.deltaR2
deltaR2
Definition: HLTMuonOfflineAnalyzer_cfi.py:105
HcalEndcap
Definition: HcalAssistant.h:34
EgammaHcalIsolation::maxSeverityHB_
int maxSeverityHB_
Definition: EgammaHcalIsolation.h:160
ErrorSummaryFilter_cfi.severity
severity
Definition: ErrorSummaryFilter_cfi.py:5
electronHcalTowerIsolationLcone_cfi.intRadius
intRadius
Definition: electronHcalTowerIsolationLcone_cfi.py:5
or
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
EgammaHcalIsolation::hcalSevLvlComputer_
const HcalSeverityLevelComputer & hcalSevLvlComputer_
Definition: EgammaHcalIsolation.h:170
EgammaHcalIsolation::mhbhe_
const HBHERecHitCollection & mhbhe_
Definition: EgammaHcalIsolation.h:166
EgammaHcalIsolation::eThresHE_
arrayHE eThresHE_
Definition: EgammaHcalIsolation.h:162
EgammaHcalIsolation::hcalTopology_
const HcalTopology & hcalTopology_
Definition: EgammaHcalIsolation.h:168
EgammaHcalIsolation::goodHitEnergy
double goodHitEnergy(const GlobalPoint &pclu, const HBHERecHit &hit, int depth, int ieta, int iphi, int include_or_exclude, double(*scale)(const double &)) const
Definition: EgammaHcalIsolation.cc:121
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
hit
Definition: SiStripHitEffFromCalibTree.cc:88
RemoveAddSevLevel.flag
flag
Definition: RemoveAddSevLevel.py:117
EgammaHcalIsolation.h