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 137 of file HcalSeverityLevelComputer.cc.

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

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

References DropChannel_, and RecoveredRecHit_.

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

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

Definition at line 329 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().

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

Definition at line 366 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().

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

Definition at line 360 of file HcalSeverityLevelComputer.cc.

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

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

Friends And Related Function Documentation

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

Definition at line 375 of file HcalSeverityLevelComputer.cc.

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

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().