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 {
9 
10  // NOTE: I will leave Run Summary Generators in place
11  // just not triggering on endJob!
12  _vsumgen.resize(nSummary);
13  _vnames.resize(nSummary);
14  _vmarks.resize(nSummary);
15  for (uint32_t i=0; i<_vmarks.size(); i++)
16  _vmarks[i]=false;
17  _vnames[fRaw]="RawTask";
18  _vnames[fDigi]="DigiTask";
19  _vnames[fReco]="RecHitTask";
20  _vnames[fTP]="TPTask";
21  _vnames[fPedestal]="PedestalTask";
22 
23  _vsumgen[fRaw] = new hcaldqm::RawRunSummary("RawRunHarvesting",
24  _vnames[fRaw], ps);
25  _vsumgen[fDigi] = new hcaldqm::DigiRunSummary("DigiRunHarvesting",
26  _vnames[fDigi],ps);
27  _vsumgen[fReco] = new hcaldqm::RecoRunSummary("RecoRunHarvesting",
28  _vnames[fReco], ps);
29  _vsumgen[fTP] = new hcaldqm::TPRunSummary("TPRunHarvesting",
30  _vnames[fTP], ps);
31  _vsumgen[fPedestal] = new hcaldqm::PedestalRunSummary("PedestalRunHarvesting",
32  _vnames[fPedestal], ps);
33 
34  _thresh_bad_bad = ps.getUntrackedParameter("thresh_bad_bad", 0.05);
35 }
36 
37 /* virtual */ void HcalOnlineHarvesting::beginRun(
38  edm::Run const& r, edm::EventSetup const& es)
39 {
40  DQHarvester::beginRun(r,es);
41  for (std::vector<DQClient*>::const_iterator it=_vsumgen.begin();
42  it!=_vsumgen.end(); ++it)
43  (*it)->beginRun(r,es);
44 }
45 
49  edm::EventSetup const&)
50 {
51  // DETERMINE WHICH MODULES ARE PRESENT IN DATA
52  if (ig.get(_subsystem+"/"+_vnames[fRaw]+"/EventsTotal")!=nullptr)
53  _vmarks[fRaw]=true;
54  if (ig.get(_subsystem+"/"+_vnames[fDigi]+"/EventsTotal")!=nullptr)
55  _vmarks[fDigi]=true;
56  if (ig.get(_subsystem+"/"+_vnames[fTP]+"/EventsTotal")!=nullptr)
57  _vmarks[fTP]=true;
58  if (ig.get(_subsystem+"/"+_vnames[fReco]+"/EventsTotal")!=nullptr)
59  _vmarks[fReco]=true;
60  if (ig.get(_subsystem+"/"+_vnames[fPedestal]+"/EventsTotal")!=nullptr)
61  _vmarks[fPedestal]=true;
62 
63  // CREATE SUMMARY REPORT MAP FED vs LS and LOAD MODULE'S SUMMARIES
64  // NOTE: THIS STATEMENTS WILL BE EXECUTED ONLY ONCE!
65  if (!_reportSummaryMap)
66  {
67  ig.setCurrentFolder(_subsystem+"/EventInfo");
68  _reportSummaryMap = ib.book2D("reportSummaryMap", "reportSummaryMap",
69  _maxLS, 1, _maxLS+1, _vFEDs.size(), 0, _vFEDs.size());
70  for (uint32_t i=0; i<_vFEDs.size(); i++)
71  {
72  char name[5];
73  sprintf(name, "%d", _vFEDs[i]);
74  _reportSummaryMap->setBinLabel(i+1, name, 2);
75  }
76  // set LS bit to mark Xaxis as LS axis
78 
79  // INITIALIZE ALL THE MODULES
80  for (uint32_t i=0; i<_vnames.size(); i++)
82  "SummaryvsLS",
86 
87  // LOAD ONLY THOSE MODULES THAT ARE PRESENT IN DATA
88  for (uint32_t i=0; i<_vmarks.size(); i++)
89  {
90  if (_vmarks[i])
91  _vcSummaryvsLS[i].load(ig, _subsystem);
92  }
93 
94  // Create a map of bad channels and fill
95  _cKnownBadChannels_depth.initialize("RunInfo", "KnownBadChannels",
101  for (uintCompactMap::const_iterator it=_xQuality.begin();
102  it!=_xQuality.end(); ++it)
104 
105  ig.setCurrentFolder(_subsystem+"/EventInfo");
106  _runSummary = ib.book2D("runSummary", "runSummary",
107  1, 0, 1, 1, 0, 1);
108  }
109 
110  int ifed=0;
111  hcaldqm::flag::Flag fTotal("Status", hcaldqm::flag::fNCDAQ);
112  if (_ptype != fOffline) { // hidefed2crate
113  for (std::vector<uint32_t>::const_iterator it=_vhashFEDs.begin();
114  it!=_vhashFEDs.end(); ++it)
115  {
116  HcalElectronicsId eid(*it);
118  for (uint32_t im=0; im<_vmarks.size(); im++)
119  if (_vmarks[im])
120  {
121  int x = _vcSummaryvsLS[im].getBinContent(eid, _currentLS);
123  fSum+=flag;
124  }
125  _reportSummaryMap->setBinContent(_currentLS, ifed+1, int(fSum._state));
126  ifed++;
127  fTotal+=fSum;
128  }
129  }
130 
131  // update the Run Summary
132  // ^^^TEMPORARY AT THIS POINT!
133  if (fTotal._state==hcaldqm::flag::fBAD) _nBad++;
134  _nTotal++;
135  if (double(_nBad)/double(_nTotal)>=_thresh_bad_bad)
137  else if (fTotal._state==hcaldqm::flag::fNCDAQ)
139  else
141 
142  // HF TDC TP efficiency
143  if (_vmarks[fTP]) {
144  MonitorElement* meOccupancy_HF_depth = ig.get("Hcal/TPTask/OccupancyDataHF_depth/OccupancyDataHF_depth");
145  MonitorElement* meOccupancyNoTDC_HF_depth = ig.get("Hcal/TPTask/OccupancyEmulHFNoTDC_depth/OccupancyEmulHFNoTDC_depth");
146  MonitorElement* meOccupancy_HF_ieta = ig.get("Hcal/TPTask/OccupancyDataHF_ieta/OccupancyDataHF_ieta");
147  MonitorElement* meOccupancyNoTDC_HF_ieta = ig.get("Hcal/TPTask/OccupancyEmulHFNoTDC_ieta/OccupancyEmulHFNoTDC_ieta");
148 
149  if (meOccupancy_HF_depth && meOccupancyNoTDC_HF_depth && meOccupancy_HF_ieta && meOccupancyNoTDC_HF_ieta) {
150  TH2F* hOccupancy_HF_depth = meOccupancy_HF_depth->getTH2F();
151  TH2F* hOccupancyNoTDC_HF_depth = meOccupancyNoTDC_HF_depth->getTH2F();
152  TH1F* hOccupancy_HF_ieta = meOccupancy_HF_ieta->getTH1F();
153  TH1F* hOccupancyNoTDC_HF_ieta = meOccupancyNoTDC_HF_ieta->getTH1F();
154 
155  TH2F *hEfficiency_HF_depth = (TH2F*)hOccupancy_HF_depth->Clone();
156  hEfficiency_HF_depth->Divide(hOccupancyNoTDC_HF_depth);
157  TH1F *hEfficiency_HF_ieta = (TH1F*)hOccupancy_HF_ieta->Clone();
158  hEfficiency_HF_ieta->Divide(hOccupancyNoTDC_HF_ieta);
159 
160  ib.setCurrentFolder("Hcal/TPTask");
161 
162  MonitorElement* meEfficiency_HF_depth = ib.book2D("TDCCutEfficiency_depth", hEfficiency_HF_depth);
163  meEfficiency_HF_depth->setEfficiencyFlag();
164  MonitorElement* meEfficiency_HF_ieta = ib.book1D("TDCCutEfficiency_ieta", hEfficiency_HF_ieta);
165  meEfficiency_HF_ieta->setEfficiencyFlag();
166 
167  delete hEfficiency_HF_depth;
168  delete hEfficiency_HF_ieta;
169  }
170  }
171 }
172 
173 /*
174  * NO END JOB PROCESSING FOR ONLINE!
175  */
177  DQMStore::IGetter& ig)
178 {}
179 
ContainerXXX< uint32_t > _xQuality
Definition: DQHarvester.h:45
T getUntrackedParameter(std::string const &, T const &) const
std::vector< uint32_t > _vhashFEDs
Definition: DQHarvester.h:43
void setBinContent(int binx, double content)
set content of bin (1-D)
std::vector< bool > _vmarks
TH1F * getTH1F() const
HcalOnlineHarvesting(edm::ParameterSet const &)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:307
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
virtual CompactMap::const_iterator begin()
Definition: ContainerXXX.h:75
State _state
Definition: Flag.h:79
TH1 * getTH1() const
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)
hcaldqm::Container2D _cKnownBadChannels_depth
#define nullptr
virtual CompactMap::const_iterator end()
Definition: ContainerXXX.h:77
std::vector< std::string > _vnames
ProcessingType _ptype
Definition: DQModule.h:59
void setEfficiencyFlag()
void _dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
MonitorElement * _reportSummaryMap
std::vector< hcaldqm::DQClient * > _vsumgen
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
virtual void initialize(std::string const &folder, hashfunctions::HashType, Quantity *, Quantity *, Quantity *qz=new ValueQuantity(quantity::fN), int debug=0)
Definition: Container2D.cc:32
TH2F * getTH2F() const
HcalElectronicsMap const * _emap
Definition: DQHarvester.h:32
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
void beginRun(edm::Run const &, edm::EventSetup const &) override
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
void _dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:349
MonitorElement * _runSummary
void fill(HcalDetId const &) override
Definition: Container2D.cc:59
std::string _subsystem
Definition: DQModule.h:64
int const BIT_OFFSET
Definition: Constants.h:314
int const BIT_AXIS_LS
Definition: Constants.h:318
std::vector< int > _vFEDs
Definition: DQHarvester.h:42
std::vector< hcaldqm::ContainerSingle2D > _vcSummaryvsLS
void book(DQMStore::IBooker &, HcalElectronicsMap const *, std::string subsystem="Hcal", std::string aux="") override
Definition: Container2D.cc:895
Readout chain identification for Hcal.
Definition: Run.h:43
ib
Definition: cuy.py:660