CMS 3D CMS Logo

HcalOnlineHarvesting.cc
Go to the documentation of this file.
2 
3 using namespace hcaldqm;
4 using namespace hcaldqm::constants;
5 
7  : DQHarvester(ps), _nBad(0), _nTotal(0), _reportSummaryMap(nullptr) {
8  // NOTE: I will leave Run Summary Generators in place
9  // just not triggering on endJob!
10  _vsumgen.resize(nSummary);
11  _vnames.resize(nSummary);
12  _vmarks.resize(nSummary);
13  for (uint32_t i = 0; i < _vmarks.size(); i++)
14  _vmarks[i] = false;
15  _vnames[fRaw] = "RawTask";
16  _vnames[fDigi] = "DigiTask";
17  _vnames[fReco] = "RecHitTask";
18  _vnames[fTP] = "TPTask";
19  _vnames[fPedestal] = "PedestalTask";
20 
21  auto iC = consumesCollector();
22  _vsumgen[fRaw] = new hcaldqm::RawRunSummary("RawRunHarvesting", _vnames[fRaw], ps, iC);
23  _vsumgen[fDigi] = new hcaldqm::DigiRunSummary("DigiRunHarvesting", _vnames[fDigi], ps, iC);
24  _vsumgen[fReco] = new hcaldqm::RecoRunSummary("RecoRunHarvesting", _vnames[fReco], ps, iC);
25  _vsumgen[fTP] = new hcaldqm::TPRunSummary("TPRunHarvesting", _vnames[fTP], ps, iC);
26  _vsumgen[fPedestal] = new hcaldqm::PedestalRunSummary("PedestalRunHarvesting", _vnames[fPedestal], ps, iC);
27 
28  _thresh_bad_bad = ps.getUntrackedParameter("thresh_bad_bad", 0.05);
29 }
30 
31 /* virtual */ void HcalOnlineHarvesting::beginRun(edm::Run const& r, edm::EventSetup const& es) {
32  DQHarvester::beginRun(r, es);
33  for (std::vector<DQClient*>::const_iterator it = _vsumgen.begin(); it != _vsumgen.end(); ++it)
34  (*it)->beginRun(r, es);
35 }
36 
39  edm::LuminosityBlock const&,
40  edm::EventSetup const&) {
41  // DETERMINE WHICH MODULES ARE PRESENT IN DATA
42  if (ig.get(_subsystem + "/" + _vnames[fRaw] + "/EventsTotal") != nullptr)
43  _vmarks[fRaw] = true;
44  if (ig.get(_subsystem + "/" + _vnames[fDigi] + "/EventsTotal") != nullptr)
45  _vmarks[fDigi] = true;
46  if (ig.get(_subsystem + "/" + _vnames[fTP] + "/EventsTotal") != nullptr)
47  _vmarks[fTP] = true;
48  if (ig.get(_subsystem + "/" + _vnames[fReco] + "/EventsTotal") != nullptr)
49  _vmarks[fReco] = true;
50  if (ig.get(_subsystem + "/" + _vnames[fPedestal] + "/EventsTotal") != nullptr)
51  _vmarks[fPedestal] = true;
52 
53  // CREATE SUMMARY REPORT MAP FED vs LS and LOAD MODULE'S SUMMARIES
54  // NOTE: THIS STATEMENTS WILL BE EXECUTED ONLY ONCE!
55  if (!_reportSummaryMap) {
56  ig.setCurrentFolder(_subsystem + "/EventInfo");
58  ib.book2D("reportSummaryMap", "reportSummaryMap", _maxLS, 1, _maxLS + 1, _vFEDs.size(), 0, _vFEDs.size());
59  for (uint32_t i = 0; i < _vFEDs.size(); i++) {
60  char name[5];
61  sprintf(name, "%d", _vFEDs[i]);
63  }
64  // set LS bit to mark Xaxis as LS axis
66 
67  // INITIALIZE ALL THE MODULES
68  for (uint32_t i = 0; i < _vnames.size(); i++)
70  "SummaryvsLS",
74 
75  // LOAD ONLY THOSE MODULES THAT ARE PRESENT IN DATA
76  for (uint32_t i = 0; i < _vmarks.size(); i++) {
77  if (_vmarks[i])
78  _vcSummaryvsLS[i].load(ig, _subsystem);
79  }
80 
81  // Create a map of bad channels and fill
83  "KnownBadChannels",
88  0);
90  for (uintCompactMap::const_iterator it = _xQuality.begin(); it != _xQuality.end(); ++it)
92 
93  ig.setCurrentFolder(_subsystem + "/EventInfo");
94  _runSummary = ib.book2D("runSummary", "runSummary", 1, 0, 1, 1, 0, 1);
95  }
96 
97  int ifed = 0;
99  if (_ptype != fOffline) { // hidefed2crate
100  for (std::vector<uint32_t>::const_iterator it = _vhashFEDs.begin(); it != _vhashFEDs.end(); ++it) {
101  HcalElectronicsId eid(*it);
103  for (uint32_t im = 0; im < _vmarks.size(); im++)
104  if (_vmarks[im]) {
105  int x = _vcSummaryvsLS[im].getBinContent(eid, _currentLS);
107  fSum += flag;
108  }
109  _reportSummaryMap->setBinContent(_currentLS, ifed + 1, int(fSum._state));
110  ifed++;
111  fTotal += fSum;
112  }
113  }
114 
115  // update the Run Summary
116  // ^^^TEMPORARY AT THIS POINT!
117  if (fTotal._state == hcaldqm::flag::fBAD)
118  _nBad++;
119  _nTotal++;
120  if (double(_nBad) / double(_nTotal) >= _thresh_bad_bad)
122  else if (fTotal._state == hcaldqm::flag::fNCDAQ)
124  else
126 
127  // HF TDC TP efficiency
128  if (_vmarks[fTP]) {
129  MonitorElement* meOccupancy_HF_depth = ig.get("Hcal/TPTask/OccupancyDataHF_depth/OccupancyDataHF_depth");
130  MonitorElement* meOccupancyNoTDC_HF_depth =
131  ig.get("Hcal/TPTask/OccupancyEmulHFNoTDC_depth/OccupancyEmulHFNoTDC_depth");
132  MonitorElement* meOccupancy_HF_ieta = ig.get("Hcal/TPTask/OccupancyDataHF_ieta/OccupancyDataHF_ieta");
133  MonitorElement* meOccupancyNoTDC_HF_ieta =
134  ig.get("Hcal/TPTask/OccupancyEmulHFNoTDC_ieta/OccupancyEmulHFNoTDC_ieta");
135 
136  if (meOccupancy_HF_depth && meOccupancyNoTDC_HF_depth && meOccupancy_HF_ieta && meOccupancyNoTDC_HF_ieta) {
137  TH2F* hOccupancy_HF_depth = meOccupancy_HF_depth->getTH2F();
138  TH2F* hOccupancyNoTDC_HF_depth = meOccupancyNoTDC_HF_depth->getTH2F();
139  TH1D* hOccupancy_HF_ieta = meOccupancy_HF_ieta->getTH1D();
140  TH1D* hOccupancyNoTDC_HF_ieta = meOccupancyNoTDC_HF_ieta->getTH1D();
141 
142  TH2F* hEfficiency_HF_depth = (TH2F*)hOccupancy_HF_depth->Clone();
143  hEfficiency_HF_depth->Divide(hOccupancyNoTDC_HF_depth);
144  TH1D* hEfficiency_HF_ieta = (TH1D*)hOccupancy_HF_ieta->Clone();
145  hEfficiency_HF_ieta->Divide(hOccupancyNoTDC_HF_ieta);
146 
147  ib.setCurrentFolder("Hcal/TPTask");
148 
149  MonitorElement* meEfficiency_HF_depth = ib.book2D("TDCCutEfficiency_depth", hEfficiency_HF_depth);
150  meEfficiency_HF_depth->setEfficiencyFlag();
151  MonitorElement* meEfficiency_HF_ieta = ib.book1DD("TDCCutEfficiency_ieta", hEfficiency_HF_ieta);
152  meEfficiency_HF_ieta->setEfficiencyFlag();
153 
154  delete hEfficiency_HF_depth;
155  delete hEfficiency_HF_ieta;
156  }
157  }
158 }
159 
160 /*
161  * NO END JOB PROCESSING FOR ONLINE!
162  */
164 
ContainerXXX< uint32_t > _xQuality
Definition: DQHarvester.h:48
std::vector< uint32_t > _vhashFEDs
Definition: DQHarvester.h:46
std::vector< bool > _vmarks
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
HcalOnlineHarvesting(edm::ParameterSet const &)
virtual CompactMap::const_iterator begin()
Definition: ContainerXXX.h:69
State _state
Definition: Flag.h:62
hcaldqm::Container2D _cKnownBadChannels_depth
T getUntrackedParameter(std::string const &, T const &) const
virtual CompactMap::const_iterator end()
Definition: ContainerXXX.h:70
virtual TH2F * getTH2F() const
std::vector< std::string > _vnames
ProcessingType _ptype
Definition: DQModule.h:44
void _dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
MonitorElement * _reportSummaryMap
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual TH1D * getTH1D() const
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
HcalElectronicsMap const * _emap
Definition: DQHarvester.h:35
void beginRun(edm::Run const &, edm::EventSetup const &) override
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
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
void _dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
virtual TH1 * getTH1() const
std::vector< hcaldqm::DQClient * > _vsumgen
MonitorElement * _runSummary
void fill(HcalDetId const &) override
Definition: Container2D.cc:52
std::string _subsystem
Definition: DQModule.h:49
float x
int const BIT_OFFSET
Definition: Constants.h:282
int const BIT_AXIS_LS
Definition: Constants.h:286
std::vector< int > _vFEDs
Definition: DQHarvester.h:45
std::vector< hcaldqm::ContainerSingle2D > _vcSummaryvsLS
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:567
Readout chain identification for Hcal.
Definition: Run.h:45
ib
Definition: cuy.py:661