test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RawRunSummary.cc
Go to the documentation of this file.
2 
3 namespace hcaldqm
4 {
6  std::string const& taskname, edm::ParameterSet const& ps) :
7  DQClient(name, taskname, ps), _booked(false)
8  {}
9 
10  /* virtual */ void RawRunSummary::beginRun(edm::Run const& r,
11  edm::EventSetup const& es)
12  {
13  DQClient::beginRun(r,es);
14 
15  if (_ptype!=fOffline)
16  return;
17 
18  // INITIALIZE WHAT NEEDS TO BE INITIALIZE ONLY ONCE!
23  FIBER_uTCA_MIN1, FIBERCH_MIN, false).rawId());
25  _vhashVME); // filter out VME
27  _vhashuTCA); // filter out uTCA
28 
29  // INTIALIZE CONTAINERS ACTING AS HOLDERS OF RUN INFORAMTION
50  _cBadQuality_depth.initialize(_name, "BadQuality",
55 
59  // BOOK CONTAINERSXXX
61  }
62 
63  /*
64  * END OF LUMINOSITY HARVESTING
65  * RAW FORMAT HAS ONLY LUMI BASED FLAGS!
66  * THEREFORE STEPS ARE:
67  * 1) LOAD CONTAINERS YOU NEED (MUST BE LUMI BASED)
68  * 2) ANALYZE
69  * 3) GENERATE SUMMARY FLAGS AND PUSH THEM
70  */
73  edm::EventSetup const& es)
74  {
75  DQClient::endLuminosityBlock(ib, ig, lb, es);
76 
77  if (_ptype!=fOffline)
78  return;
79 
80  // INITIALIZE WHAT YOU NEED
81  LSSummary lssum; // summary for this LS
82  lssum._LS = _currentLS; // set the LS
83 
84  // RESET CONTAINERS USED FOR ANALYSIS OF THIS LS
86 
87  // INITIALIZE LUMI BASED HISTOGRAMS
88  Container2D cEvnMsm_ElectronicsVME,cEvnMsm_ElectronicsuTCA;
89  Container2D cBcnMsm_ElectronicsVME,cBcnMsm_ElectronicsuTCA;
90  Container2D cBadQuality_depth;
91  cEvnMsm_ElectronicsVME.initialize(_taskname, "EvnMsm",
96  cBcnMsm_ElectronicsVME.initialize(_taskname, "BcnMsm",
101  cEvnMsm_ElectronicsuTCA.initialize(_taskname, "EvnMsm",
106  cBcnMsm_ElectronicsuTCA.initialize(_taskname, "BcnMsm",
111  cBadQuality_depth.initialize(_taskname, "BadQuality",
116 
117  // LOAD LUMI BASED HISTOGRAMS
118  cEvnMsm_ElectronicsVME.load(ig, _emap, _filter_uTCA, _subsystem);
119  cBcnMsm_ElectronicsVME.load(ig, _emap, _filter_uTCA, _subsystem);
120  cEvnMsm_ElectronicsuTCA.load(ig, _emap, _filter_VME, _subsystem);
121  cBcnMsm_ElectronicsuTCA.load(ig, _emap, _filter_VME, _subsystem);
122  cBadQuality_depth.load(ig, _emap, _subsystem);
123 
124  // BOOK for the very first time
125  if (!_booked)
126  {
132  _booked=true;
133  }
134 
135  // ANALYZE THIS LS
136  // iterate over all channels
137  std::vector<HcalGenericDetId> gids = _emap->allPrecisionId();
138  for (std::vector<HcalGenericDetId>::const_iterator it=gids.begin();
139  it!=gids.end(); ++it)
140  {
141  if (!it->isHcalDetId())
142  continue;
143  HcalDetId did = HcalDetId(it->rawId());
145 
146  _xBadQ.get(eid)+=cBadQuality_depth.getBinContent(did);
147  _cBadQuality_depth.fill(did, cBadQuality_depth.getBinContent(did));
148  if (eid.isVMEid())
149  {
150  _xEvn.get(eid)+=cEvnMsm_ElectronicsVME.getBinContent(eid);
151  _xBcn.get(eid)+=cBcnMsm_ElectronicsVME.getBinContent(eid);
152 
154  cEvnMsm_ElectronicsVME.getBinContent(eid));
156  cBcnMsm_ElectronicsVME.getBinContent(eid));
157  }
158  else
159  {
160  _xEvn.get(eid)+=cEvnMsm_ElectronicsuTCA.getBinContent(eid);
161  _xBcn.get(eid)+=cBcnMsm_ElectronicsuTCA.getBinContent(eid);
162 
164  cEvnMsm_ElectronicsuTCA.getBinContent(eid));
166  cBcnMsm_ElectronicsuTCA.getBinContent(eid));
167  }
168  }
169 
170 
171  // GENERATE THE SUMMARY FOR THIS LS AND STORE IT
172  std::vector<flag::Flag> vtmpflags; // tmp summary flags vector
173  vtmpflags.resize(nRawFlag);
174  vtmpflags[fEvnMsm]=flag::Flag("EvnMsm");
175  vtmpflags[fBcnMsm]=flag::Flag("BcnMsm");
176  vtmpflags[fBadQ]=flag::Flag("BadQ");
177  for (std::vector<uint32_t>::const_iterator it=_vhashFEDs.begin();
178  it!=_vhashFEDs.end(); ++it)
179  {
180  HcalElectronicsId eid(*it);
181 
182  // reset all the tmp flags to fNA
183  // MUST DO IT NOW! AS NCDAQ MIGHT OVERWRITE IT!
184  for (std::vector<flag::Flag>::iterator ft=vtmpflags.begin();
185  ft!=vtmpflags.end(); ++ft)
186  ft->reset();
187 
188  // check if this FED was @cDAQ
189  std::vector<uint32_t>::const_iterator cit=std::find(
190  _vcdaqEids.begin(), _vcdaqEids.end(), *it);
191  if (cit==_vcdaqEids.end())
192  {
193  // was not @cDAQ, set all the flags for this FED as fNCDAQ
194  for (std::vector<flag::Flag>::iterator ft=vtmpflags.begin();
195  ft!=vtmpflags.end(); ++ft)
196  ft->_state = flag::fNCDAQ;
197 
198  // push all the flags for this FED
199  // IMPORTANT!!!
200  lssum._vflags.push_back(vtmpflags);
201  continue;
202  }
203 
204  // here only if was registered at cDAQ
205  if (utilities::isFEDHBHE(eid) || utilities::isFEDHF(eid) ||
206  utilities::isFEDHO(eid))
207  {
208  if (_xEvn.get(eid)>0)
209  vtmpflags[fEvnMsm]._state = flag::fBAD;
210  else
211  vtmpflags[fEvnMsm]._state = flag::fGOOD;
212  if (_xBcn.get(eid)>0)
213  vtmpflags[fBcnMsm]._state = flag::fBAD;
214  else
215  vtmpflags[fBcnMsm]._state = flag::fGOOD;
216  if (_xBadQ.get(eid)>0)
217  vtmpflags[fBadQ]._state = flag::fBAD;
218  else
219  vtmpflags[fBadQ]._state = flag::fGOOD;
220  }
221 
222  // push all the flags for this FED
223  lssum._vflags.push_back(vtmpflags);
224  }
225 
226  // push all flags for all FEDs for this LS
227  _vflagsLS.push_back(lssum);
228  }
229 
230  /*
231  * END JOB
232  * BOOK THE SUMMARY CONTAINERS, SET THE FLAGS
233  * RETURN THE LIST OF FLAGS FOR THIS DATATIER
234  */
235  /* virtual */ std::vector<flag::Flag> RawRunSummary::endJob(
237  {
238 
239  if (_ptype!=fOffline)
240  return std::vector<flag::Flag>();
241 
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 
251  // INITIALIZE AND BOOK SUMMARY CONTAINERS
252  ContainerSingle2D cSummaryvsLS; // summary per FED: flag vs LS
253  Container2D cSummaryvsLS_FED; // LS based flags vs LS for each FED
254  cSummaryvsLS.initialize(_name, "SummaryvsLS",
258  cSummaryvsLS_FED.initialize(_name, "SummaryvsLS",
261  new quantity::FlagQuantity(vflagsLS),
263  cSummaryvsLS_FED.book(ib, _emap, _subsystem);
264  cSummaryvsLS.book(ib, _subsystem);
265 
266  /*
267  * Iterate over each FED
268  * Iterate over each LS SUmmary
269  * Iterate over all flags
270  * set...
271  */
272 
273  std::vector<flag::Flag> sumflags; // flag per FED
274  int ifed=0;
275  for (std::vector<uint32_t>::const_iterator it=_vhashFEDs.begin();
276  it!=_vhashFEDs.end(); ++it)
277  {
278  flag::Flag fSumRun("RAW"); // summary flag for this FED
279  HcalElectronicsId eid(*it);
280 
281  // ITERATE OVER EACH LS
282  for (std::vector<LSSummary>::const_iterator itls=_vflagsLS.begin();
283  itls!=_vflagsLS.end(); ++itls)
284  {
285  // fill histograms per LS
286  int iflag=0;
287  flag::Flag fSumLS("RAW");
288  for (std::vector<flag::Flag>::const_iterator ft=
289  itls->_vflags[ifed].begin(); ft!=itls->_vflags[ifed].end();
290  ++ft)
291  {
292  // Flag vs LS per FEd
293  cSummaryvsLS_FED.setBinContent(eid, itls->_LS, int(iflag),
294  ft->_state);
295  fSumLS+=(*ft);
296  iflag++;
297  }
298  // FED vs LS
299  cSummaryvsLS.setBinContent(eid, itls->_LS, fSumLS._state);
300  fSumRun+=fSumLS;
301  }
302 
303  // push the summary flag for this FED for the whole RUN
304  sumflags.push_back(fSumRun);
305 
306  // increment the fed counter
307  ifed++;
308  }
309 
310  return sumflags;
311  }
312 }
std::vector< uint32_t > _vcdaqEids
Definition: DQClient.h:64
Container2D _cEvnMsm_ElectronicsVME
Definition: RawRunSummary.h:35
virtual void setBinContent(HcalDetId const &, int)
Definition: Container2D.cc:235
int const CRATE_VME_MIN
Definition: Constants.h:60
int ib
Definition: cuy.py:660
filter::HashFilter _filter_VME
Definition: RawRunSummary.h:32
void initialize(HcalElectronicsMap const *, ElectronicsMapType etype=fHcalElectronicsMap)
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
std::vector< uint32_t > _vhashFEDs
Definition: DQClient.h:58
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: DQClient.cc:15
State _state
Definition: Flag.h:79
Container2D _cBadQuality_depth
Definition: RawRunSummary.h:37
std::string _taskname
Definition: DQClient.h:47
ContainerXXX< uint32_t > _xBadQ
Definition: RawRunSummary.h:42
Container2D _cEvnMsm_ElectronicsuTCA
Definition: RawRunSummary.h:35
int const SPIGOT_MIN
Definition: Constants.h:85
Container2D _cBcnMsm_ElectronicsuTCA
Definition: RawRunSummary.h:36
HcalElectronicsMap const * _emap
Definition: DQClient.h:54
virtual void reset()
Definition: ContainerXXX.h:342
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
int const FIBER_VME_MIN
Definition: Constants.h:90
std::vector< int > _vFEDsuTCA
Definition: RawRunSummary.h:31
int const FIBERCH_MIN
Definition: Constants.h:100
virtual void book(DQMStore::IBooker &, std::string subsystem="Hcal", std::string aux="")
virtual void fill(HcalDetId const &)
Definition: Container2D.cc:59
ProcessingType _ptype
Definition: DQModule.h:59
virtual void setBinContent(int, int, int)
virtual void endLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
Definition: DQClient.cc:84
electronicsmap::ElectronicsMap _ehashmap
Definition: RawRunSummary.h:27
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:32
int const FIBER_uTCA_MIN1
Definition: Constants.h:93
std::vector< HcalGenericDetId > allPrecisionId() const
filter::HashFilter _filter_uTCA
Definition: RawRunSummary.h:32
RawRunSummary(std::string const &, std::string const &, edm::ParameterSet const &)
Definition: RawRunSummary.cc:5
ContainerXXX< uint32_t > _xEvn
Definition: RawRunSummary.h:42
std::string _name
Definition: DQModule.h:57
std::vector< std::vector< flag::Flag > > _vflags
Definition: DQClient.h:43
int const CRATE_uTCA_MIN
Definition: Constants.h:65
std::vector< uint32_t > _vhashuTCA
Definition: RawRunSummary.h:30
Container2D _cBcnMsm_ElectronicsVME
Definition: RawRunSummary.h:36
bool isFEDHBHE(HcalElectronicsId const &)
Definition: Utilities.cc:124
virtual void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="")
Definition: Container2D.cc:895
virtual void book(HcalElectronicsMap const *)
Definition: ContainerXXX.h:93
virtual void initialize(std::string const &folder, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
std::vector< int > _vFEDs
Definition: DQClient.h:57
virtual void load(DQMStore *, HcalElectronicsMap const *, std::string const &subsystem="Hcal", std::string const &aux="", std::string const &prepend="", DQMStore::OpenRunDirs mode=DQMStore::StripRunDirs)
Definition: Container1D.cc:596
ContainerXXX< uint32_t > _xBcn
Definition: RawRunSummary.h:42
virtual std::vector< flag::Flag > endJob(DQMStore::IBooker &, DQMStore::IGetter &)
virtual STDTYPE & get(HcalDetId const &)
Definition: ContainerXXX.h:243
std::string _subsystem
Definition: DQModule.h:64
bool isFEDHO(HcalElectronicsId const &)
Definition: Utilities.cc:171
std::vector< LSSummary > _vflagsLS
Definition: RawRunSummary.h:25
volatile std::atomic< bool > shutdown_flag false
virtual void initialize(hashfunctions::HashType, int debug=0)
Definition: ContainerXXX.h:85
virtual void initialize(FilterType ftype, HashType htype, std::vector< uint32_t > const &)
Definition: HashFilter.cc:26
std::vector< int > _vFEDsVME
Definition: RawRunSummary.h:31
std::vector< uint32_t > _vhashVME
Definition: RawRunSummary.h:30
Readout chain identification for Hcal.
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
bool isFEDHF(HcalElectronicsId const &)
Definition: Utilities.cc:146
int const SLOT_uTCA_MIN
Definition: Constants.h:72
Definition: Run.h:43
virtual double getBinContent(HcalDetId const &)
Definition: Container2D.cc:184