CMS 3D CMS Logo

RawRunSummary.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm {
4  using namespace constants;
6  : DQClient(name, taskname, ps), _booked(false) {}
7 
8  /* virtual */ void RawRunSummary::beginRun(edm::Run const& r, edm::EventSetup const& es) {
10 
11  if (_ptype != fOffline)
12  return;
13 
14  // INITIALIZE WHAT NEEDS TO BE INITIALIZE ONLY ONCE!
16  _vhashVME.push_back(
20  _vhashVME); // filter out VME
22  _vhashuTCA); // filter out uTCA
23 
24  // INTIALIZE CONTAINERS ACTING AS HOLDERS OF RUN INFORAMTION
26  "EvnMsm",
31  0);
33  "BcnMsm",
38  0);
40  "EvnMsm",
45  0);
47  "BcnMsm",
52  0);
54  "BadQuality",
59  0);
60 
64  // BOOK CONTAINERSXXX
65  _xEvn.book(_emap);
66  _xBcn.book(_emap);
67  _xBadQ.book(_emap);
68  }
69 
70  /*
71  * END OF LUMINOSITY HARVESTING
72  * RAW FORMAT HAS ONLY LUMI BASED FLAGS!
73  * THEREFORE STEPS ARE:
74  * 1) LOAD CONTAINERS YOU NEED (MUST BE LUMI BASED)
75  * 2) ANALYZE
76  * 3) GENERATE SUMMARY FLAGS AND PUSH THEM
77  */
80  edm::LuminosityBlock const& lb,
81  edm::EventSetup const& es) {
82  DQClient::endLuminosityBlock(ib, ig, lb, es);
83 
84  if (_ptype != fOffline)
85  return;
86 
87  // INITIALIZE WHAT YOU NEED
88  LSSummary lssum; // summary for this LS
89  lssum._LS = _currentLS; // set the LS
90 
91  // RESET CONTAINERS USED FOR ANALYSIS OF THIS LS
92  _xEvn.reset();
93  _xBcn.reset();
94  _xBadQ.reset();
95 
96  // INITIALIZE LUMI BASED HISTOGRAMS
97  Container2D cEvnMsm_ElectronicsVME, cEvnMsm_ElectronicsuTCA;
98  Container2D cBcnMsm_ElectronicsVME, cBcnMsm_ElectronicsuTCA;
99  Container2D cBadQuality_depth;
100  cEvnMsm_ElectronicsVME.initialize(_taskname,
101  "EvnMsm",
106  0);
107  cBcnMsm_ElectronicsVME.initialize(_taskname,
108  "BcnMsm",
113  0);
114  cEvnMsm_ElectronicsuTCA.initialize(_taskname,
115  "EvnMsm",
120  0);
121  cBcnMsm_ElectronicsuTCA.initialize(_taskname,
122  "BcnMsm",
127  0);
128  cBadQuality_depth.initialize(_taskname,
129  "BadQuality",
134  0);
135 
136  // LOAD LUMI BASED HISTOGRAMS
137  cEvnMsm_ElectronicsVME.load(ig, _emap, _filter_uTCA, _subsystem);
138  cBcnMsm_ElectronicsVME.load(ig, _emap, _filter_uTCA, _subsystem);
139  cEvnMsm_ElectronicsuTCA.load(ig, _emap, _filter_VME, _subsystem);
140  cBcnMsm_ElectronicsuTCA.load(ig, _emap, _filter_VME, _subsystem);
141  cBadQuality_depth.load(ig, _emap, _subsystem);
142  MonitorElement* meNumEvents = ig.get(_subsystem + "/RunInfo/NumberOfEvents");
143  int numEvents = meNumEvents->getBinContent(1);
144 
145  // BOOK for the very first time
146  if (!_booked) {
152  _booked = true;
153  }
154 
155  // ANALYZE THIS LS
156  // iterate over all channels
157  std::vector<HcalGenericDetId> gids = _emap->allPrecisionId();
158  for (std::vector<HcalGenericDetId>::const_iterator it = gids.begin(); it != gids.end(); ++it) {
159  if (!it->isHcalDetId())
160  continue;
161  HcalDetId did = HcalDetId(it->rawId());
163 
164  _xBadQ.get(eid) += cBadQuality_depth.getBinContent(did);
165  _cBadQuality_depth.fill(did, cBadQuality_depth.getBinContent(did));
166  if (eid.isVMEid()) {
167  _xEvn.get(eid) += cEvnMsm_ElectronicsVME.getBinContent(eid);
168  _xBcn.get(eid) += cBcnMsm_ElectronicsVME.getBinContent(eid);
169 
170  _cEvnMsm_ElectronicsVME.fill(eid, cEvnMsm_ElectronicsVME.getBinContent(eid));
171  _cBcnMsm_ElectronicsVME.fill(eid, cBcnMsm_ElectronicsVME.getBinContent(eid));
172  } else {
173  _xEvn.get(eid) += cEvnMsm_ElectronicsuTCA.getBinContent(eid);
174  _xBcn.get(eid) += cBcnMsm_ElectronicsuTCA.getBinContent(eid);
175 
176  _cEvnMsm_ElectronicsuTCA.fill(eid, cEvnMsm_ElectronicsuTCA.getBinContent(eid));
177  _cBcnMsm_ElectronicsuTCA.fill(eid, cBcnMsm_ElectronicsuTCA.getBinContent(eid));
178  }
179  }
180 
181  // GENERATE THE SUMMARY FOR THIS LS AND STORE IT
182  std::vector<flag::Flag> vtmpflags; // tmp summary flags vector
183  vtmpflags.resize(nRawFlag);
184  vtmpflags[fEvnMsm] = flag::Flag("EvnMsm");
185  vtmpflags[fBcnMsm] = flag::Flag("BcnMsm");
186  vtmpflags[fBadQ] = flag::Flag("BadQ");
187  for (std::vector<uint32_t>::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) {
188  HcalElectronicsId eid(*it);
189 
190  // reset all the tmp flags to fNA
191  // MUST DO IT NOW! AS NCDAQ MIGHT OVERWRITE IT!
192  for (std::vector<flag::Flag>::iterator ft = vtmpflags.begin(); ft != vtmpflags.end(); ++ft)
193  ft->reset();
194 
195  // check if this FED was @cDAQ
196  std::vector<uint32_t>::const_iterator cit = std::find(_vcdaqEids.begin(), _vcdaqEids.end(), *it);
197  if (cit == _vcdaqEids.end()) {
198  // was not @cDAQ, set all the flags for this FED as fNCDAQ
199  for (std::vector<flag::Flag>::iterator ft = vtmpflags.begin(); ft != vtmpflags.end(); ++ft)
200  ft->_state = flag::fNCDAQ;
201 
202  // push all the flags for this FED
203  // IMPORTANT!!!
204  lssum._vflags.push_back(vtmpflags);
205  continue;
206  }
207 
208  // here only if was registered at cDAQ
210  if (_xEvn.get(eid) > 0)
211  vtmpflags[fEvnMsm]._state = flag::fBAD;
212  else
213  vtmpflags[fEvnMsm]._state = flag::fGOOD;
214  if (_xBcn.get(eid) > 0)
215  vtmpflags[fBcnMsm]._state = flag::fBAD;
216  else
217  vtmpflags[fBcnMsm]._state = flag::fGOOD;
218  if (double(_xBadQ.get(eid)) > double(12 * numEvents))
219  vtmpflags[fBadQ]._state = flag::fBAD;
220  else if (_xBadQ.get(eid) > 0)
221  vtmpflags[fBadQ]._state = flag::fPROBLEMATIC;
222  else
223  vtmpflags[fBadQ]._state = flag::fGOOD;
224  }
225 
226  // push all the flags for this FED
227  lssum._vflags.push_back(vtmpflags);
228  }
229 
230  // push all flags for all FEDs for this LS
231  _vflagsLS.push_back(lssum);
232  }
233 
234  /*
235  * END JOB
236  * BOOK THE SUMMARY CONTAINERS, SET THE FLAGS
237  * RETURN THE LIST OF FLAGS FOR THIS DATATIER
238  */
239  /* virtual */ std::vector<flag::Flag> RawRunSummary::endJob(DQMStore::IBooker& ib, DQMStore::IGetter& ig) {
240  if (_ptype != fOffline)
241  return std::vector<flag::Flag>();
242 
243  // PREPARE LS BASED FLAGS to use it for booking
244  std::vector<flag::Flag> vflagsLS;
245  vflagsLS.resize(nRawFlag);
246  vflagsLS[fEvnMsm] = flag::Flag("EvnMsm");
247  vflagsLS[fBcnMsm] = flag::Flag("BcnMsm");
248  vflagsLS[fBadQ] = flag::Flag("BadQ");
249 
250  // INITIALIZE AND BOOK SUMMARY CONTAINERS
251  ContainerSingle2D cSummaryvsLS; // summary per FED: flag vs LS
252  Container2D cSummaryvsLS_FED; // LS based flags vs LS for each FED
253  cSummaryvsLS.initialize(_name,
254  "SummaryvsLS",
258  0);
259  cSummaryvsLS_FED.initialize(_name,
260  "SummaryvsLS",
263  new quantity::FlagQuantity(vflagsLS),
265  0);
266  cSummaryvsLS_FED.book(ib, _emap, _subsystem);
267  cSummaryvsLS.book(ib, _subsystem);
268 
269  /*
270  * Iterate over each FED
271  * Iterate over each LS SUmmary
272  * Iterate over all flags
273  * set...
274  */
275 
276  std::vector<flag::Flag> sumflags; // flag per FED
277  int ifed = 0;
278  for (std::vector<uint32_t>::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) {
279  flag::Flag fSumRun("RAW"); // summary flag for this FED
280  HcalElectronicsId eid(*it);
281 
282  // ITERATE OVER EACH LS
283  for (std::vector<LSSummary>::const_iterator itls = _vflagsLS.begin(); itls != _vflagsLS.end(); ++itls) {
284  // fill histograms per LS
285  int iflag = 0;
286  flag::Flag fSumLS("RAW");
287  for (std::vector<flag::Flag>::const_iterator ft = itls->_vflags[ifed].begin(); ft != itls->_vflags[ifed].end();
288  ++ft) {
289  // Flag vs LS per FEd
290  cSummaryvsLS_FED.setBinContent(eid, itls->_LS, int(iflag), ft->_state);
291  fSumLS += (*ft);
292  iflag++;
293  }
294  // FED vs LS
295  cSummaryvsLS.setBinContent(eid, itls->_LS, fSumLS._state);
296  fSumRun += fSumLS;
297  }
298 
299  // push the summary flag for this FED for the whole RUN
300  sumflags.push_back(fSumRun);
301 
302  // increment the fed counter
303  ifed++;
304  }
305 
306  return sumflags;
307  }
308 } // namespace hcaldqm
hcaldqm::flag::Flag
Definition: Flag.h:24
hcaldqm::quantity::FEDQuantity
Definition: ElectronicsQuantity.h:356
hcaldqm::DQClient::_vcdaqEids
std::vector< uint32_t > _vcdaqEids
Definition: DQClient.h:70
hcaldqm::RawRunSummary::nRawFlag
Definition: RawRunSummary.h:41
hcaldqm::ContainerXXX::initialize
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:81
RawRunSummary.h
hcaldqm::flag::Flag::_state
State _state
Definition: Flag.h:62
hcaldqm::Container1D::load
virtual void load(DQMStore::IGetter &, HcalElectronicsMap const *, std::string const &subsystem="Hcal", std::string const &aux="")
Definition: Container1D.cc:450
hcaldqm::Container2D::initialize
virtual void initialize(std::string const &folder, hashfunctions::HashType, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:25
funct::false
false
Definition: Factorize.h:29
hcaldqm::quantity::FlagQuantity
Definition: ValueQuantity.h:364
hcaldqm::electronicsmap::ElectronicsMap::lookup
uint32_t lookup(DetId const &)
Definition: ElectronicsMap.cc:122
hcaldqm::quantity::fSlotuTCA
Definition: ElectronicsQuantity.h:21
hcaldqm::RawRunSummary::endLuminosityBlock
void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: RawRunSummary.cc:78
hcaldqm::DQClient
Definition: DQClient.h:23
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
hcaldqm::quantity::ValueQuantity
Definition: ValueQuantity.h:309
hcaldqm::hashfunctions::fElectronics
Definition: HashFunctions.h:145
hcaldqm::DQClient::_vhashFEDs
std::vector< uint32_t > _vhashFEDs
Definition: DQClient.h:64
hcaldqm::flag::fGOOD
Definition: Flag.h:17
hcaldqm
Definition: Constants.h:8
hcaldqm::RawRunSummary::_ehashmap
electronicsmap::ElectronicsMap _ehashmap
Definition: RawRunSummary.h:24
hcaldqm::RawRunSummary::_cEvnMsm_ElectronicsVME
Container2D _cEvnMsm_ElectronicsVME
Definition: RawRunSummary.h:32
hcaldqm::electronicsmap::ElectronicsMap::initialize
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
Definition: ElectronicsMap.cc:6
hcaldqm::constants::SPIGOT_MIN
const int SPIGOT_MIN
Definition: Constants.h:118
hcaldqm::constants::SLOT_uTCA_MIN
const int SLOT_uTCA_MIN
Definition: Constants.h:105
hcaldqm::constants::FIBER_uTCA_MIN1
const int FIBER_uTCA_MIN1
Definition: Constants.h:126
hcaldqm::RawRunSummary::_vflagsLS
std::vector< LSSummary > _vflagsLS
Definition: RawRunSummary.h:22
dqm::legacy::MonitorElement
Definition: MonitorElement.h:462
constants
hcaldqm::ContainerSingle2D
Definition: ContainerSingle2D.h:20
hcaldqm::DQClient::endLuminosityBlock
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQClient.cc:98
hcaldqm::hashfunctions::fFED
Definition: HashFunctions.h:136
hcaldqm::DQModule::_ptype
ProcessingType _ptype
Definition: DQModule.h:43
hcaldqm::flag::fBAD
Definition: Flag.h:19
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
hcaldqm::RawRunSummary::fEvnMsm
Definition: RawRunSummary.h:41
hcaldqm::DQClient::_vFEDs
std::vector< int > _vFEDs
Definition: DQClient.h:63
hcaldqm::hashfunctions::fdepth
Definition: HashFunctions.h:131
HcalElectronicsMap::allPrecisionId
std::vector< HcalGenericDetId > allPrecisionId() const
Definition: HcalElectronicsMap.cc:139
hcaldqm::quantity::fieta
Definition: DetectorQuantity.h:15
hcaldqm::RawRunSummary::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: RawRunSummary.cc:8
hcaldqm::DQClient::_taskname
std::string _taskname
Definition: DQClient.h:49
hcaldqm::quantity::fiphi
Definition: DetectorQuantity.h:14
hcaldqm::DQModule::_currentLS
int _currentLS
Definition: DQModule.h:52
hcaldqm::Container2D::getBinContent
double getBinContent(HcalDetId const &) override
Definition: Container2D.cc:132
hcaldqm::RawRunSummary::_cEvnMsm_ElectronicsuTCA
Container2D _cEvnMsm_ElectronicsuTCA
Definition: RawRunSummary.h:32
hcaldqm::ContainerXXX::reset
virtual void reset()
Definition: ContainerXXX.h:292
hcaldqm::constants::CRATE_uTCA_MIN
const int CRATE_uTCA_MIN
Definition: Constants.h:98
hcaldqm::RawRunSummary::_filter_uTCA
filter::HashFilter _filter_uTCA
Definition: RawRunSummary.h:29
hcaldqm::filter::HashFilter::initialize
virtual void initialize(FilterType ftype, hashfunctions::HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:17
hcaldqm::DQClient::beginRun
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:13
hcaldqm::constants::FIBER_VME_MIN
const int FIBER_VME_MIN
Definition: Constants.h:123
HcalElectronicsId
Readout chain identification for Hcal.
Definition: HcalElectronicsId.h:32
hcaldqm::DQModule::_name
std::string _name
Definition: DQModule.h:41
hcaldqm::RawRunSummary::endJob
std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: RawRunSummary.cc:239
hcaldqm::constants::FIBERCH_MIN
const int FIBERCH_MIN
Definition: Constants.h:132
hcaldqm::DQClient::_maxProcessedLS
int _maxProcessedLS
Definition: DQClient.h:53
hcaldqm::quantity::DetectorQuantity
Definition: DetectorQuantity.h:59
hcaldqm::utilities::isFEDHF
bool isFEDHF(HcalElectronicsId const &)
Definition: Utilities.cc:156
hcaldqm::Container2D::setBinContent
void setBinContent(HcalDetId const &, int) override
Definition: Container2D.cc:163
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
hcaldqm::quantity::fN
Definition: ValueQuantity.h:11
hcaldqm::RawRunSummary::_xEvn
ContainerXXX< uint32_t > _xEvn
Definition: RawRunSummary.h:39
hcaldqm::RawRunSummary::_vFEDsuTCA
std::vector< int > _vFEDsuTCA
Definition: RawRunSummary.h:28
hcaldqm::RawRunSummary::_xBadQ
ContainerXXX< uint32_t > _xBadQ
Definition: RawRunSummary.h:39
edm::ParameterSet
Definition: ParameterSet.h:47
hcaldqm::Container2D::book
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:558
hcaldqm::RawRunSummary::_cBcnMsm_ElectronicsuTCA
Container2D _cBcnMsm_ElectronicsuTCA
Definition: RawRunSummary.h:33
hcaldqm::Container2D::fill
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
hcaldqm::RawRunSummary::_cBcnMsm_ElectronicsVME
Container2D _cBcnMsm_ElectronicsVME
Definition: RawRunSummary.h:33
hcaldqm::RawRunSummary::fBadQ
Definition: RawRunSummary.h:41
hcaldqm::RawRunSummary::fBcnMsm
Definition: RawRunSummary.h:41
HcalDetId
Definition: HcalDetId.h:12
runTauDisplay.eid
eid
Definition: runTauDisplay.py:298
cuy.ib
ib
Definition: cuy.py:662
edm::EventSetup
Definition: EventSetup.h:58
hcaldqm::quantity::fSpigot
Definition: ElectronicsQuantity.h:23
hcaldqm::RawRunSummary::_vhashuTCA
std::vector< uint32_t > _vhashuTCA
Definition: RawRunSummary.h:27
hcaldqm::RawRunSummary::_vhashVME
std::vector< uint32_t > _vhashVME
Definition: RawRunSummary.h:27
hcaldqm::RawRunSummary::_filter_VME
filter::HashFilter _filter_VME
Definition: RawRunSummary.h:29
hcaldqm::DQModule::_subsystem
std::string _subsystem
Definition: DQModule.h:48
alignCSCRings.r
r
Definition: alignCSCRings.py:93
hcaldqm::flag::fPROBLEMATIC
Definition: Flag.h:18
hcaldqm::quantity::ElectronicsQuantity
Definition: ElectronicsQuantity.h:333
hcaldqm::RawRunSummary::RawRunSummary
RawRunSummary(std::string const &, std::string const &, edm::ParameterSet const &)
Definition: RawRunSummary.cc:5
hcaldqm::RawRunSummary::_cBadQuality_depth
Container2D _cBadQuality_depth
Definition: RawRunSummary.h:34
hcaldqm::electronicsmap::fD2EHashMap
Definition: ElectronicsMap.h:25
hcaldqm::DQClient::_emap
const HcalElectronicsMap * _emap
Definition: DQClient.h:56
hcaldqm::utilities::isFEDHBHE
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:142
dqm::implementation::IGetter
Definition: DQMStore.h:484
nanoDQM_cff.Flag
Flag
Definition: nanoDQM_cff.py:65
hcaldqm::ContainerSingle2D::setBinContent
virtual void setBinContent(int, int, int)
Definition: ContainerSingle2D.cc:154
simpleEdmComparison.numEvents
numEvents
Definition: simpleEdmComparison.py:139
hcaldqm::ContainerSingle2D::book
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
Definition: ContainerSingle2D.cc:68
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
hcaldqm::utilities::isFEDHO
bool isFEDHO(HcalElectronicsId const &)
Definition: Utilities.cc:180
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
hcaldqm::ContainerXXX::book
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:87
hcaldqm::ContainerXXX::get
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:197
dqm::implementation::IBooker
Definition: DQMStore.h:43
hcaldqm::RawRunSummary::_booked
bool _booked
Definition: RawRunSummary.h:36
hcaldqm::ContainerSingle2D::initialize
virtual void initialize(std::string const &folder, quantity::Quantity *, quantity::Quantity *, quantity::Quantity *qz=new quantity::ValueQuantity(quantity::fN), int debug=0)
Definition: ContainerSingle2D.cc:46
hcaldqm::flag::fNCDAQ
Definition: Flag.h:15
hcaldqm::RawRunSummary::_xBcn
ContainerXXX< uint32_t > _xBcn
Definition: RawRunSummary.h:39
hcaldqm::quantity::fState
Definition: ValueQuantity.h:47
hcaldqm::RawRunSummary::_vFEDsVME
std::vector< int > _vFEDsVME
Definition: RawRunSummary.h:28
dqm::impl::MonitorElement::getBinContent
virtual double getBinContent(int binx) const
get content of bin (1-D)
Definition: MonitorElement.cc:592
hcaldqm::constants::CRATE_VME_MIN
const int CRATE_VME_MIN
Definition: Constants.h:93
hcaldqm::filter::fFilter
Definition: HashFilter.h:19
hcaldqm::fOffline
Definition: DQModule.h:26
hcaldqm::Container2D
Definition: Container2D.h:19
hcaldqm::quantity::LumiSection
Definition: ValueQuantity.h:390