CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes | Friends
HcalSeverityLevelComputer Class Reference

#include <HcalSeverityLevelComputer.h>

Classes

class  HcalSeverityDefinition
 

Public Member Functions

bool dropChannel (const uint32_t &mystatus) const
 
int getSeverityLevel (const DetId &myid, const uint32_t &myflag, const uint32_t &mystatus) const
 
 HcalSeverityLevelComputer (const edm::ParameterSet &)
 
bool recoveredRecHit (const DetId &myid, const uint32_t &myflag) const
 
 ~HcalSeverityLevelComputer ()
 

Private Member Functions

bool getChStBit (HcalSeverityDefinition &mydef, const std::string &mybit)
 
bool getRecHitFlag (HcalSeverityDefinition &mydef, const std::string &mybit, int phase_)
 
void setAllRHMasks (const unsigned bitnumber, HcalSeverityDefinition &mydef)
 
void setBit (const unsigned bitnumber, uint32_t &where)
 

Private Attributes

HcalSeverityDefinitionDropChannel_
 
HcalSeverityDefinitionRecoveredRecHit_
 
std::vector< HcalSeverityDefinitionSevDef
 

Friends

std::ostream & operator<< (std::ostream &s, const HcalSeverityLevelComputer::HcalSeverityDefinition &def)
 

Detailed Description

Definition at line 25 of file HcalSeverityLevelComputer.h.

Constructor & Destructor Documentation

HcalSeverityLevelComputer::HcalSeverityLevelComputer ( const edm::ParameterSet iConfig)

Definition at line 138 of file HcalSeverityLevelComputer.cc.

References DropChannel_, relativeConstraints::empty, getChStBit(), edm::ParameterSet::getParameter(), getRecHitFlag(), gen::k, RecoveredRecHit_, SevDef, HcalSeverityLevelComputer::HcalSeverityDefinition::sevLevel, and AlCaHLTBitMon_QueryRunRegistry::string.

139 {
140  // initialize: get the levels and masks from the cfg:
141  typedef std::vector< edm::ParameterSet > myParameters;
142  myParameters myLevels = iConfig.getParameter<myParameters>((std::string)"SeverityLevels");
143 
144  unsigned int phase_ = iConfig.getParameter<unsigned int>("phase");
145 
146  // now run through the parameter set vector:
147  for ( myParameters::iterator itLevels = myLevels.begin(); itLevels != myLevels.end(); ++itLevels)
148  {
149  // create the basic object
150  HcalSeverityDefinition mydef;
151 
152  // get the level:
153  mydef.sevLevel = itLevels->getParameter<int>("Level");
154 
155  // get the RecHitFlags:
156  std::vector<std::string> myRecHitFlags =
157  itLevels->getParameter<std::vector <std::string> > ("RecHitFlags");
158 
159  // get channel statuses:
160  std::vector<std::string> myChStatuses =
161  itLevels->getParameter<std::vector <std::string> > ("ChannelStatus");
162 
163  // now translate the RecHitFlags and the ChannelStatuses into a mask each:
164  // create counters for invalid flags to be able to catch cases where a definition consists only of invalid bit names:
165  unsigned int bvalid = 0;
166  unsigned int bnonempty = 0;
167  // channel status:
168  for (unsigned k=0; k < myChStatuses.size(); k++)
169  {
170  if (myChStatuses[k].empty()) break; // empty string
171  bnonempty++;
172  bvalid+=getChStBit(mydef, myChStatuses[k]);
173  }
174  // RecHitFlag:
175  // HBHEStatusFlag, HOStatusFlag, HFStatusFlag, ZDCStatusFlag, CalibrationFlag
176  for (unsigned k=0; k < myRecHitFlags.size(); k++)
177  {
178  if (myRecHitFlags[k].empty()) break; // empty string
179  bnonempty++;
180  bvalid+=getRecHitFlag(mydef, myRecHitFlags[k], phase_);
181  }
182 
183  // std::cout << "Made Severity Level:" << std::endl;
184  // std::cout << mydef << std::endl;
185 
186  // case where definition is made entirely out of invalid flags but not empty strings
187  if ((!bvalid) && (bnonempty))
188  {
189  edm::LogWarning ("HcalSeverityLevelComputer")
190  << "Warning: level " << mydef.sevLevel
191  << " consists of invalid definitions only: "
192  // << myRecHitFlags << "; " << myChStatuses
193  << " Ignoring definition.";
194  continue;
195  }
196 
197  // finally, append the masks to the mask vectors, sorting them according to level
198  std::vector<HcalSeverityDefinition>::iterator it = SevDef.begin();
199 
200  do
201  {
202  if (it == SevDef.end()) { SevDef.push_back(mydef); break; }
203 
204  if (it->sevLevel == mydef.sevLevel)
205  {
206  edm::LogWarning ("HcalSeverityLevelComputer")
207  << "HcalSeverityLevelComputer: Warning: level " << mydef.sevLevel
208  << " already defined. Ignoring new definition.";
209  break;
210  }
211 
212  if (it->sevLevel < mydef.sevLevel)
213  if (( (it+1) == SevDef.end()) || ( (it+1)->sevLevel > mydef.sevLevel ))
214  {
215  SevDef.insert(it+1, mydef);
216  break;
217  }
218 
219  it++;
220  }
221  while(it != SevDef.end());
222 
223  } //for (myParameters::iterator itLevels=myLevels.begin(); itLevels != myLevels.end(); ++itLevels)
224 
225  edm::LogInfo("HcalSeverityLevelComputer")
226  << "HcalSeverityLevelComputer - Summary of Severity Levels:" << std::endl;
227  for (std::vector<HcalSeverityDefinition>::iterator it = SevDef.begin(); it !=SevDef.end(); it++)
228  {
229  // debug: write the levels definitions on screen:
230  edm::LogInfo("HcalSeverityLevelComputer")
231  << (*it) << std::endl;
232  }
233 
234  //
235  // Now make the definition for recoveredRecHit
236  //
237  std::vector<std::string> myRecovered =
238  iConfig.getParameter<std::vector <std::string> > ("RecoveredRecHitBits");
239  RecoveredRecHit_ = new HcalSeverityDefinition();
240  for (unsigned k=0; k < myRecovered.size(); k++)
241  {
242  if (myRecovered[k].empty()) break;
243  getRecHitFlag( (*RecoveredRecHit_), myRecovered[k], phase_);
244  }
245 
246  //
247  // Now make the definition for dropChannel
248  //
249  std::vector<std::string> myDrop =
250  iConfig.getParameter<std::vector <std::string> > ("DropChannelStatusBits");
251  DropChannel_ = new HcalSeverityDefinition();
252  for (unsigned k=0; k < myDrop.size(); k++)
253  {
254  if (myDrop[k].empty()) break;
255  getChStBit( (*DropChannel_), myDrop[k]);
256  }
257 
258  edm::LogInfo("HcalSeverityLevelComputer")
259  << "HcalSeverityLevelComputer - Summary for Recovered RecHit bits: \n"
260  << (*RecoveredRecHit_) << std::endl
261  << "HcalSeverityLevelComputer - Summary for Drop the Channel bits: \n"
262  << (*DropChannel_) << std::endl;
263 
264 
265 } // HcalSeverityLevelComputer::HcalSeverityLevelComputer
T getParameter(std::string const &) const
bool getRecHitFlag(HcalSeverityDefinition &mydef, const std::string &mybit, int phase_)
std::vector< HcalSeverityDefinition > SevDef
HcalSeverityDefinition * RecoveredRecHit_
int k[5][pyjets_maxn]
HcalSeverityDefinition * DropChannel_
bool getChStBit(HcalSeverityDefinition &mydef, const std::string &mybit)
HcalSeverityLevelComputer::~HcalSeverityLevelComputer ( )

Definition at line 268 of file HcalSeverityLevelComputer.cc.

References DropChannel_, and RecoveredRecHit_.

269 {
270  delete DropChannel_;
271  delete RecoveredRecHit_;
272 }
HcalSeverityDefinition * RecoveredRecHit_
HcalSeverityDefinition * DropChannel_

Member Function Documentation

bool HcalSeverityLevelComputer::dropChannel ( const uint32_t &  mystatus) const
bool HcalSeverityLevelComputer::getChStBit ( HcalSeverityDefinition mydef,
const std::string &  mybit 
)
private

Definition at line 9 of file HcalSeverityLevelComputer.cc.

References HcalSeverityLevelComputer::HcalSeverityDefinition::chStatusMask, HcalChannelStatus::HcalBadLaserSignal, HcalChannelStatus::HcalCellCaloTowerMask, HcalChannelStatus::HcalCellCaloTowerProb, HcalChannelStatus::HcalCellDead, HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummary, HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummaryR45, HcalChannelStatus::HcalCellHot, HcalChannelStatus::HcalCellMask, HcalChannelStatus::HcalCellOff, HcalChannelStatus::HcalCellStabErr, HcalChannelStatus::HcalCellTimErr, HcalChannelStatus::HcalCellTrigMask, and setBit().

Referenced by HcalSeverityLevelComputer().

11 {
12  if (mybit == "HcalCellOff") setBit(HcalChannelStatus::HcalCellOff, mydef.chStatusMask);
13  else if (mybit == "HcalCellMask") setBit(HcalChannelStatus::HcalCellMask, mydef.chStatusMask);
14  else if (mybit == "HcalCellDead") setBit(HcalChannelStatus::HcalCellDead, mydef.chStatusMask);
15  else if (mybit == "HcalCellHot") setBit(HcalChannelStatus::HcalCellHot, mydef.chStatusMask);
16  else if (mybit == "HcalCellStabErr") setBit(HcalChannelStatus::HcalCellStabErr, mydef.chStatusMask);
17  else if (mybit == "HcalCellTimErr") setBit(HcalChannelStatus::HcalCellTimErr, mydef.chStatusMask);
18  else if (mybit == "HcalCellTrigMask") setBit(HcalChannelStatus::HcalCellTrigMask, mydef.chStatusMask);
19  else if (mybit == "HcalCellCaloTowerMask") setBit(HcalChannelStatus::HcalCellCaloTowerMask, mydef.chStatusMask);
20  else if (mybit == "HcalCellCaloTowerProb") setBit(HcalChannelStatus::HcalCellCaloTowerProb, mydef.chStatusMask);
21  else if (mybit == "HcalCellExcludeFromHBHENoiseSummary") setBit(HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummary, mydef.chStatusMask);
22  else if (mybit == "HcalCellExcludeFromHBHENoiseSummaryR45") setBit(HcalChannelStatus::HcalCellExcludeFromHBHENoiseSummaryR45, mydef.chStatusMask);
23  else if (mybit == "HcalBadLaserSignal") setBit(HcalChannelStatus::HcalBadLaserSignal, mydef.chStatusMask);
24  else
25  { // error: unrecognized channel status name
26  edm::LogWarning ("HcalSeverityLevelComputer")
27  << "HcalSeverityLevelComputer: Error: ChannelStatusFlag >>" << mybit
28  << "<< unknown. Ignoring.";
29  return false;
30  }
31  return true;
32 }
void setBit(const unsigned bitnumber, uint32_t &where)
bool HcalSeverityLevelComputer::getRecHitFlag ( HcalSeverityDefinition mydef,
const std::string &  mybit,
int  phase_ 
)
private

Definition at line 34 of file HcalSeverityLevelComputer.cc.

References HcalCaloFlagLabels::ADCSaturationBit, HcalCaloFlagLabels::AddedSimHcalNoise, HcalSeverityLevelComputer::HcalSeverityDefinition::CalibFlagMask, HcalCaloFlagLabels::CalibrationBit, HcalCaloFlagLabels::Fraction2TS, HcalSeverityLevelComputer::HcalSeverityDefinition::HBHEFlagMask, HcalPhase1FlagLabels::HBHEFlatNoise, HcalCaloFlagLabels::HBHEFlatNoise, HcalPhase1FlagLabels::HBHEHpdHitMultiplicity, HcalCaloFlagLabels::HBHEHpdHitMultiplicity, HcalPhase1FlagLabels::HBHEIsolatedNoise, HcalCaloFlagLabels::HBHEIsolatedNoise, HcalPhase1FlagLabels::HBHENegativeNoise, HcalCaloFlagLabels::HBHENegativeNoise, HcalPhase1FlagLabels::HBHEOOTPU, HcalCaloFlagLabels::HBHEOOTPU, HcalPhase1FlagLabels::HBHEPulseFitBit, HcalCaloFlagLabels::HBHEPulseFitBit, HcalCaloFlagLabels::HBHEPulseShape, HcalPhase1FlagLabels::HBHESpikeNoise, HcalCaloFlagLabels::HBHESpikeNoise, HcalCaloFlagLabels::HBHETimingShapedCutsBits, HcalCaloFlagLabels::HBHETimingTrustBits, HcalCaloFlagLabels::HBHETriangleNoise, HcalPhase1FlagLabels::HBHETS4TS5Noise, HcalCaloFlagLabels::HBHETS4TS5Noise, HcalPhase1FlagLabels::HFAnomalousHit, HcalCaloFlagLabels::HFDigiTime, HcalSeverityLevelComputer::HcalSeverityDefinition::HFFlagMask, HcalCaloFlagLabels::HFInTimeWindow, HcalPhase1FlagLabels::HFLongShort, HcalCaloFlagLabels::HFLongShort, HcalPhase1FlagLabels::HFPET, HcalCaloFlagLabels::HFPET, HcalPhase1FlagLabels::HFS8S1Ratio, HcalCaloFlagLabels::HFS8S1Ratio, HcalPhase1FlagLabels::HFSignalAsymmetry, HcalCaloFlagLabels::HFTimingTrustBits, HcalCaloFlagLabels::HOBit, HcalSeverityLevelComputer::HcalSeverityDefinition::HOFlagMask, HcalCaloFlagLabels::HSCP_ExpFit, HcalCaloFlagLabels::HSCP_FracLeader, HcalCaloFlagLabels::HSCP_OuterEnergy, HcalCaloFlagLabels::HSCP_R1R2, HcalCaloFlagLabels::PresampleADC, setAllRHMasks(), setBit(), HcalCaloFlagLabels::TimingAddedBit, HcalCaloFlagLabels::TimingErrorBit, HcalPhase1FlagLabels::TimingFromTDC, HcalCaloFlagLabels::TimingSubtractedBit, HcalPhase1FlagLabels::UserDefinedBit0, HcalCaloFlagLabels::UserDefinedBit0, HcalCaloFlagLabels::ZDCBit, and HcalSeverityLevelComputer::HcalSeverityDefinition::ZDCFlagMask.

Referenced by HcalSeverityLevelComputer().

37 {
38  if(phase==1) // Phase 1 Rechit flags
39  {
40  // HB, HE ++++++++++++++++++++
41  if (mybit == "HBHEHpdHitMultiplicity") setBit(HcalPhase1FlagLabels::HBHEHpdHitMultiplicity, mydef.HBHEFlagMask);
42  else if (mybit == "HBHEIsolatedNoise") setBit(HcalPhase1FlagLabels::HBHEIsolatedNoise, mydef.HBHEFlagMask );
43  else if (mybit == "HBHEFlatNoise") setBit(HcalPhase1FlagLabels::HBHEFlatNoise, mydef.HBHEFlagMask);
44  else if (mybit == "HBHESpikeNoise") setBit(HcalPhase1FlagLabels::HBHESpikeNoise, mydef.HBHEFlagMask);
45  else if (mybit == "HBHETS4TS5Noise") setBit(HcalPhase1FlagLabels::HBHETS4TS5Noise, mydef.HBHEFlagMask);
46  else if (mybit == "HBHENegativeNoise") setBit(HcalPhase1FlagLabels::HBHENegativeNoise, mydef.HBHEFlagMask);
47  else if (mybit == "HBHEPulseFitBit") setBit(HcalPhase1FlagLabels::HBHEPulseFitBit, mydef.HBHEFlagMask);
48  else if (mybit == "HBHEOOTPU") setBit(HcalPhase1FlagLabels::HBHEOOTPU, mydef.HBHEFlagMask);
49 
50  // HF ++++++++++++++++++++
51  else if (mybit == "HFLongShort") setBit(HcalPhase1FlagLabels::HFLongShort, mydef.HFFlagMask);
52  else if (mybit == "HFS8S1Ratio") setBit(HcalPhase1FlagLabels::HFS8S1Ratio, mydef.HFFlagMask);
53  else if (mybit == "HFPET") setBit(HcalPhase1FlagLabels::HFPET, mydef.HFFlagMask);
54  else if (mybit == "HFSignalAsymmetry") setBit(HcalPhase1FlagLabels::HFSignalAsymmetry, mydef.HFFlagMask);
55  else if (mybit == "HFAnomalousHit") setBit(HcalPhase1FlagLabels::HFAnomalousHit, mydef.HFFlagMask);
56 
57  // Common subdetector bits ++++++++++++++++++++++
58  else if (mybit == "TimingFromTDC") setAllRHMasks(HcalPhase1FlagLabels::TimingFromTDC, mydef);
59  else if (mybit == "UserDefinedBit0") setAllRHMasks(HcalPhase1FlagLabels::UserDefinedBit0, mydef);
60 
61  // unknown -------------------
62  else
63  {
64  // error: unrecognized flag name
65  edm::LogWarning ("HcalSeverityLevelComputer")
66  << "HcalSeverityLevelComputer: Error: RecHitFlag >>" << mybit
67  << "<< unknown. Ignoring.";
68  return false;
69  }
70  }
71  else // Phase 0 Rechit flags
72  {
73  // HB, HE ++++++++++++++++++++
74  if (mybit == "HBHEHpdHitMultiplicity") setBit(HcalCaloFlagLabels::HBHEHpdHitMultiplicity, mydef.HBHEFlagMask);
75  else if (mybit == "HBHEPulseShape") setBit(HcalCaloFlagLabels::HBHEPulseShape, mydef.HBHEFlagMask);
76  else if (mybit == "HSCP_R1R2") setBit(HcalCaloFlagLabels::HSCP_R1R2, mydef.HBHEFlagMask);
77  else if (mybit == "HSCP_FracLeader") setBit(HcalCaloFlagLabels::HSCP_FracLeader, mydef.HBHEFlagMask);
78  else if (mybit == "HSCP_OuterEnergy") setBit(HcalCaloFlagLabels::HSCP_OuterEnergy, mydef.HBHEFlagMask);
79  else if (mybit == "HSCP_ExpFit") setBit(HcalCaloFlagLabels::HSCP_ExpFit, mydef.HBHEFlagMask);
80  else if (mybit == "HBHEFlatNoise") setBit(HcalCaloFlagLabels::HBHEFlatNoise, mydef.HBHEFlagMask);
81  else if (mybit == "HBHESpikeNoise") setBit(HcalCaloFlagLabels::HBHESpikeNoise, mydef.HBHEFlagMask);
82  else if (mybit == "HBHETriangleNoise") setBit(HcalCaloFlagLabels::HBHETriangleNoise, mydef.HBHEFlagMask);
83  else if (mybit == "HBHETS4TS5Noise") setBit(HcalCaloFlagLabels::HBHETS4TS5Noise, mydef.HBHEFlagMask);
84  else if (mybit == "HBHENegativeNoise") setBit(HcalCaloFlagLabels::HBHENegativeNoise, mydef.HBHEFlagMask);
85  else if (mybit == "HBHEPulseFitBit") setBit(HcalCaloFlagLabels::HBHEPulseFitBit, mydef.HBHEFlagMask);
86  else if (mybit == "HBHEOOTPU") setBit(HcalCaloFlagLabels::HBHEOOTPU, mydef.HBHEFlagMask);
87 
88 
89  // These are multi-bit counters; we may have to revisit how to set them in the SLComputer in the future
90  else if (mybit=="HBHETimingTrustBits") setBit(HcalCaloFlagLabels::HBHETimingTrustBits, mydef.HBHEFlagMask );
91  else if (mybit=="HBHETimingShapedCutsBits") setBit(HcalCaloFlagLabels::HBHETimingShapedCutsBits, mydef.HBHEFlagMask);
92  else if (mybit=="HBHEIsolatedNoise") setBit(HcalCaloFlagLabels::HBHEIsolatedNoise, mydef.HBHEFlagMask );
93 
94  // HO ++++++++++++++++++++
95  else if (mybit == "HOBit") setBit(HcalCaloFlagLabels::HOBit, mydef.HOFlagMask);
96 
97  // HF ++++++++++++++++++++
98  else if (mybit == "HFLongShort") setBit(HcalCaloFlagLabels::HFLongShort, mydef.HFFlagMask);
99  else if (mybit == "HFDigiTime") setBit(HcalCaloFlagLabels::HFDigiTime, mydef.HFFlagMask);
100  else if (mybit == "HFInTimeWindow") setBit(HcalCaloFlagLabels::HFInTimeWindow, mydef.HFFlagMask);
101  else if (mybit == "HFS8S1Ratio") setBit(HcalCaloFlagLabels::HFS8S1Ratio, mydef.HFFlagMask);
102  else if (mybit == "HFPET") setBit(HcalCaloFlagLabels::HFPET, mydef.HFFlagMask);
103  else if (mybit == "HFTimingTrustBits") setBit(HcalCaloFlagLabels::HFTimingTrustBits, mydef.HFFlagMask); // multi-bit counter
104 
105  // ZDC ++++++++++++++++++++
106  else if (mybit == "ZDCBit") setBit(HcalCaloFlagLabels::ZDCBit, mydef.ZDCFlagMask);
107 
108  // Calib ++++++++++++++++++++
109  else if (mybit == "CalibrationBit") setBit(HcalCaloFlagLabels::CalibrationBit, mydef.CalibFlagMask);
110 
111  // Common subdetector bits ++++++++++++++++++++++
112  else if (mybit == "TimingSubtractedBit") setAllRHMasks(HcalCaloFlagLabels::TimingSubtractedBit, mydef);
113  else if (mybit == "TimingAddedBit") setAllRHMasks(HcalCaloFlagLabels::TimingAddedBit, mydef);
114  else if (mybit == "TimingErrorBit") setAllRHMasks(HcalCaloFlagLabels::TimingErrorBit, mydef);
115  else if (mybit == "ADCSaturationBit") setAllRHMasks(HcalCaloFlagLabels::ADCSaturationBit, mydef);
116  else if (mybit== "AddedSimHcalNoise") setAllRHMasks(HcalCaloFlagLabels::AddedSimHcalNoise, mydef);
117 
118  else if (mybit == "UserDefinedBit0") setAllRHMasks(HcalCaloFlagLabels::UserDefinedBit0, mydef);
119 
120 
121  // additional defined diagnostic bits; not currently used for rejection
122  else if (mybit == "PresampleADC") setAllRHMasks(HcalCaloFlagLabels::PresampleADC, mydef);
123  else if (mybit == "Fraction2TS") setAllRHMasks(HcalCaloFlagLabels::Fraction2TS, mydef); // should deprecate this at some point; it's been replaced by PresampleADC
124 
125  // unknown -------------------
126  else
127  {
128  // error: unrecognized flag name
129  edm::LogWarning ("HcalSeverityLevelComputer")
130  << "HcalSeverityLevelComputer: Error: RecHitFlag >>" << mybit
131  << "<< unknown. Ignoring.";
132  return false;
133  }
134  }
135  return true;
136 }
void setBit(const unsigned bitnumber, uint32_t &where)
void setAllRHMasks(const unsigned bitnumber, HcalSeverityDefinition &mydef)
int HcalSeverityLevelComputer::getSeverityLevel ( const DetId myid,
const uint32_t &  myflag,
const uint32_t &  mystatus 
) const

Definition at line 275 of file HcalSeverityLevelComputer.cc.

References HcalGenericDetId::genericSubdet(), HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenCalibration, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalGenericDetId::HcalGenZDC, mps_fire::i, and SevDef.

Referenced by AlCaHOCalibProducer::fillHOStore(), reco::HcalNoiseInfoProducer::fillrechits(), CaloTowersCreationAlgo::hcalChanStatusForCaloTower(), HcalRecHitsAnalyzer::hcalSevLvl(), HcalHF_PETalgorithm::HFSetFlagFromPET(), HcalHF_S9S1algorithm::HFSetFlagFromS9S1(), EgammaHLTHcalIsolation::passCleaning_(), PFCTRecHitProducer::produce(), HcalHitSelection::skim(), PFRecHitQTestHCALChannel::test(), and ObjectValidator::validHit().

277 {
278  uint32_t myRecHitMask;
279  HcalGenericDetId myId(myid);
280  HcalGenericDetId::HcalGenericSubdetector mysubdet = myId.genericSubdet();
281 
282  // for (unsigned i=(SevDef.size()-1); i >= 0; i--) // Wrong
283  // Since i is unsigned, i >= 0 is always true,
284  // and the loop termination condition is never reached.
285  // We offset the loop index by one to fix this.
286  for (size_t j=(SevDef.size()); j > 0; j--)
287  {
288  size_t i = j - 1;
289  switch (mysubdet)
290  {
292  myRecHitMask = SevDef[i].HBHEFlagMask; break;
293  case HcalGenericDetId::HcalGenOuter : myRecHitMask = SevDef[i].HOFlagMask; break;
294  case HcalGenericDetId::HcalGenForward : myRecHitMask = SevDef[i].HFFlagMask; break;
295  case HcalGenericDetId::HcalGenZDC : myRecHitMask = SevDef[i].ZDCFlagMask; break;
296  case HcalGenericDetId::HcalGenCalibration : myRecHitMask = SevDef[i].CalibFlagMask; break;
297  default: myRecHitMask = 0;
298  }
299 
300  // for debugging:
301 // std::cout << std::hex << " SLD: RHMask 0x" << myRecHitMask
302 // << " chstmask 0x" << SevDef[i].chStatusMask
303 // << " RHmask & myflag 0x" << (myRecHitMask&myflag)
304 // << " chstmask & mystatus 0x" << (SevDef[i].chStatusMask&mystatus)
305 // << std::dec << " level = " << SevDef[i].sevLevel << std::endl;
306 
307  // true if:
308  // rechitmask empty and chstatusmask empty
309  // rechitmask empty and chstatusmask&mychstat true
310  // chstatusmask empty and rechitmask&myflag true
311  // rechitmask&myflag true OR chstatusmask&mychstat true
312 
313 
314  // if ( ( ( (!myRecHitMask) || (myRecHitMask & myflag) ) &&
315  if ( ( ( ( !SevDef[i].HBHEFlagMask
316  && !SevDef[i].HOFlagMask
317  && !SevDef[i].HFFlagMask
318  && !SevDef[i].ZDCFlagMask
319  && !SevDef[i].CalibFlagMask )
320  || (myRecHitMask & myflag) )
321  && ( (!SevDef[i].chStatusMask) || (SevDef[i].chStatusMask & mystatus) ) )
322  || ( (myRecHitMask & myflag) || (SevDef[i].chStatusMask & mystatus) ) )
323  return SevDef[i].sevLevel;
324 
325  }
326 
327  return -100; // default value, if no definition applies
328 }
std::vector< HcalSeverityDefinition > SevDef
bool HcalSeverityLevelComputer::recoveredRecHit ( const DetId myid,
const uint32_t &  myflag 
) const

Definition at line 330 of file HcalSeverityLevelComputer.cc.

References HcalSeverityLevelComputer::HcalSeverityDefinition::CalibFlagMask, HcalGenericDetId::genericSubdet(), HcalSeverityLevelComputer::HcalSeverityDefinition::HBHEFlagMask, HcalGenericDetId::HcalGenBarrel, HcalGenericDetId::HcalGenCalibration, HcalGenericDetId::HcalGenEndcap, HcalGenericDetId::HcalGenForward, HcalGenericDetId::HcalGenOuter, HcalGenericDetId::HcalGenZDC, HcalSeverityLevelComputer::HcalSeverityDefinition::HFFlagMask, HcalSeverityLevelComputer::HcalSeverityDefinition::HOFlagMask, RecoveredRecHit_, and HcalSeverityLevelComputer::HcalSeverityDefinition::ZDCFlagMask.

Referenced by reco::HcalNoiseInfoProducer::fillrechits(), CaloTowersCreationAlgo::hcalChanStatusForCaloTower(), EgammaHLTHcalIsolation::passCleaning_(), and ObjectValidator::validHit().

331 {
332  uint32_t myRecHitMask;
333  HcalGenericDetId myId(myid);
334  HcalGenericDetId::HcalGenericSubdetector mysubdet = myId.genericSubdet();
335 
336  switch (mysubdet)
337  {
339  myRecHitMask = RecoveredRecHit_->HBHEFlagMask; break;
340  case HcalGenericDetId::HcalGenOuter : myRecHitMask = RecoveredRecHit_->HOFlagMask; break;
341  case HcalGenericDetId::HcalGenForward : myRecHitMask = RecoveredRecHit_->HFFlagMask; break;
342  case HcalGenericDetId::HcalGenZDC : myRecHitMask = RecoveredRecHit_->ZDCFlagMask; break;
344  default: myRecHitMask = 0;
345  }
346 
347  if (myRecHitMask & myflag)
348  return true;
349 
350  return false;
351 }
HcalSeverityDefinition * RecoveredRecHit_
void HcalSeverityLevelComputer::setAllRHMasks ( const unsigned  bitnumber,
HcalSeverityDefinition mydef 
)
private

Definition at line 367 of file HcalSeverityLevelComputer.cc.

References HcalSeverityLevelComputer::HcalSeverityDefinition::CalibFlagMask, HcalSeverityLevelComputer::HcalSeverityDefinition::HBHEFlagMask, HcalSeverityLevelComputer::HcalSeverityDefinition::HFFlagMask, HcalSeverityLevelComputer::HcalSeverityDefinition::HOFlagMask, setBit(), and HcalSeverityLevelComputer::HcalSeverityDefinition::ZDCFlagMask.

Referenced by getRecHitFlag().

368 {
369  setBit(bitnumber, mydef.HBHEFlagMask);
370  setBit(bitnumber, mydef.HOFlagMask);
371  setBit(bitnumber, mydef.HFFlagMask);
372  setBit(bitnumber, mydef.ZDCFlagMask);
373  setBit(bitnumber, mydef.CalibFlagMask);
374 }
void setBit(const unsigned bitnumber, uint32_t &where)
void HcalSeverityLevelComputer::setBit ( const unsigned  bitnumber,
uint32_t &  where 
)
private

Definition at line 361 of file HcalSeverityLevelComputer.cc.

Referenced by getChStBit(), getRecHitFlag(), and setAllRHMasks().

362 {
363  uint32_t statadd = 0x1<<(bitnumber);
364  where = where|statadd;
365 }

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  s,
const HcalSeverityLevelComputer::HcalSeverityDefinition def 
)
friend

Definition at line 376 of file HcalSeverityLevelComputer.cc.

377 {
378  s << "Hcal Severity Level Definition, Level = " << def.sevLevel << std::endl;
379  s << std::hex << std::showbase;
380  s << " channel status mask = " << def.chStatusMask << std::endl;
381  s << " HBHEFlagMask = " << def.HBHEFlagMask << std::endl;
382  s << " HOFlagMask = " << def.HOFlagMask << std::endl;
383  s << " HFFlagMask = " << def.HFFlagMask << std::endl;
384  s << " ZDCFlagMask = " << def.ZDCFlagMask << std::endl;
385  s << " CalibFlagMask = " << def.CalibFlagMask << std::dec << std::noshowbase << std::endl;
386  return s;
387 }

Member Data Documentation

HcalSeverityDefinition* HcalSeverityLevelComputer::DropChannel_
private
HcalSeverityDefinition* HcalSeverityLevelComputer::RecoveredRecHit_
private
std::vector<HcalSeverityDefinition> HcalSeverityLevelComputer::SevDef
private

Definition at line 55 of file HcalSeverityLevelComputer.h.

Referenced by getSeverityLevel(), and HcalSeverityLevelComputer().