CMS 3D CMS Logo

HcalOfflineHarvesting.cc
Go to the documentation of this file.
2 
3 using namespace hcaldqm;
4 using namespace hcaldqm::constants;
5 using namespace hcaldqm::filter;
6 
8  : DQHarvester(ps), _reportSummaryMap(nullptr) {
9  _summaryList.push_back(fTP);
10  _summaryList.push_back(fDigi);
11  _summaryList.push_back(fReco);
12  _sumnames[fRaw] = "RawTask";
13  _sumnames[fDigi] = "DigiTask";
14  _sumnames[fReco] = "RecHitTask";
15  _sumnames[fTP] = "TPTask";
16  for (auto& it_sum : _summaryList) {
17  _summarks[it_sum] = false;
18  }
19 
20  if (std::find(_summaryList.begin(), _summaryList.end(), fRaw) != _summaryList.end()) {
21  _sumgen[fRaw] = new hcaldqm::RawRunSummary("RawRunHarvesting", _sumnames[fRaw], ps);
22  }
23  if (std::find(_summaryList.begin(), _summaryList.end(), fDigi) != _summaryList.end()) {
24  _sumgen[fDigi] = new hcaldqm::DigiRunSummary("DigiRunHarvesting", _sumnames[fDigi], ps);
25  }
26  if (std::find(_summaryList.begin(), _summaryList.end(), fReco) != _summaryList.end()) {
27  _sumgen[fReco] = new hcaldqm::RecoRunSummary("RecoRunHarvesting", _sumnames[fReco], ps);
28  }
29  if (std::find(_summaryList.begin(), _summaryList.end(), fTP) != _summaryList.end()) {
30  _sumgen[fTP] = new hcaldqm::TPRunSummary("TPRunHarvesting", _sumnames[fTP], ps);
31  }
32 }
33 
34 /* virtual */ void HcalOfflineHarvesting::beginRun(edm::Run const& r, edm::EventSetup const& es) {
35  DQHarvester::beginRun(r, es);
36 
37  for (auto& it_sum : _summaryList) {
38  _sumgen[it_sum]->beginRun(r, es);
39  }
40 }
41 
42 //
43 // For OFFLINE there is no per LS evaluation
44 //
47  edm::LuminosityBlock const& lb,
48  edm::EventSetup const& es) {
49  for (auto& it_sum : _summaryList) {
50  if (ig.get(_subsystem + "/" + _sumnames[it_sum] + "/EventsTotal") != nullptr) {
51  _summarks[it_sum] = true;
52  }
53  }
54 
55  // CALL ALL THE HARVESTERS
56  for (auto& it_sum : _summaryList) {
57  // run only if have to
58  if (_summarks[it_sum]) {
59  (_sumgen[it_sum])->endLuminosityBlock(ib, ig, lb, es);
60  }
61  }
62 }
63 
64 //
65 // Evaluate and Generate Run Summary
66 //
68  // OBTAIN/SET WHICH MODULES ARE PRESENT
69  std::map<Summary, std::string> datatier_names;
70  datatier_names[fRaw] = "RAW";
71  datatier_names[fDigi] = "DIGI";
72  datatier_names[fReco] = "RECO";
73  datatier_names[fTP] = "TP";
74 
75  int num = 0;
76  std::map<std::string, int> datatiers;
77  for (auto& it_sum : _summaryList) {
78  if (_summarks[it_sum]) {
79  datatiers.insert(std::pair<std::string, int>(datatier_names[it_sum], num));
80  ++num;
81  }
82  }
83 
84  // CREATE THE REPORT SUMMARY MAP
85  // num is #modules
86  // datatiers - std map [DATATIER_NAME] -> [positional value [0,num-1]]
87  // -> bin wise +1 should be
88  if (!_reportSummaryMap) {
89  ib.setCurrentFolder(_subsystem + "/EventInfo");
91  ib.book2D("reportSummaryMap", "reportSummaryMap", _vCrates.size(), 0, _vCrates.size(), num, 0, num);
92  // x axis labels
93 
94  for (uint32_t i = 0; i < _vCrates.size(); i++) {
95  char name[5];
96  sprintf(name, "%d", _vCrates[i]);
98  }
99  // y axis lables
100  for (std::map<std::string, int>::const_iterator it = datatiers.begin(); it != datatiers.end(); ++it) {
101  std::string name = it->first;
102  int value = it->second;
104  }
105  }
106 
107  // iterate over all summary generators and get the flags
108  for (auto& it_sum : _summaryList) {
109  // IF MODULE IS NOT PRESENT IN DATA SKIP
110  if (!_summarks[it_sum]) {
111  continue;
112  }
113 
114  // OBTAIN ALL THE FLAGS FOR THIS MODULE
115  // AND SET THE REPORT STATUS MAP
116  // NOTE AGAIN: datatiers map [DATATIER]->[value not bin!]+1 therefore
117  if (_debug > 0) {
118  std::cout << _sumnames[it_sum] << std::endl;
119  }
120  std::vector<hcaldqm::flag::Flag> flags = (_sumgen[it_sum])->endJob(ib, ig);
121  if (_debug > 0) {
122  std::cout << "********************" << std::endl;
123  std::cout << "SUMMARY" << std::endl;
124  }
125  for (uint32_t icrate = 0; icrate < _vCrates.size(); icrate++) {
126  _reportSummaryMap->setBinContent(icrate + 1, datatiers[flags[icrate]._name] + 1, (int)flags[icrate]._state);
127  if (_debug > 0) {
128  std::cout << "Crate=" << _vCrates[icrate] << std::endl;
129  std::cout << flags[icrate]._name << " " << flags[icrate]._state << std::endl;
130  }
131  }
132  }
133 }
134 
edm::one::EDProducerBase::endJob
virtual void endJob()
Definition: EDProducerBase.h:109
HcalOfflineHarvesting::_sumgen
std::map< Summary, hcaldqm::DQClient * > _sumgen
Definition: HcalOfflineHarvesting.h:59
mps_fire.i
i
Definition: mps_fire.py:428
hcaldqm::constants
Definition: Constants.h:9
edm::LuminosityBlock
Definition: LuminosityBlock.h:50
edm::Run
Definition: Run.h:45
hcaldqm
Definition: Constants.h:8
gather_cfg.cout
cout
Definition: gather_cfg.py:144
HcalOfflineHarvesting.h
HcalOfflineHarvesting::_summarks
std::map< Summary, bool > _summarks
Definition: HcalOfflineHarvesting.h:60
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
Definition: RawRunSummary.h:8
HcalOfflineHarvesting::fRaw
Definition: HcalOfflineHarvesting.h:53
hcaldqm::DQHarvester::_vCrates
std::vector< int > _vCrates
Definition: DQHarvester.h:41
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
HcalOfflineHarvesting::_dqmEndJob
void _dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override
Definition: HcalOfflineHarvesting.cc:67
HcalOfflineHarvesting::fTP
Definition: HcalOfflineHarvesting.h:53
HcalOfflineHarvesting
Definition: HcalOfflineHarvesting.py:1
hcaldqm::DQModule::_name
std::string _name
Definition: DQModule.h:41
HcalOfflineHarvesting::HcalOfflineHarvesting
HcalOfflineHarvesting(edm::ParameterSet const &)
Definition: HcalOfflineHarvesting.cc:7
hcaldqm::DigiRunSummary
Definition: DigiRunSummary.h:9
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
hcaldqm::DQModule::_debug
int _debug
Definition: DQModule.h:44
value
Definition: value.py:1
dqm::impl::MonitorElement::setBinLabel
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)
Definition: MonitorElement.cc:771
HcalOfflineHarvesting::fReco
Definition: HcalOfflineHarvesting.h:53
cuy.ib
ib
Definition: cuy.py:662
edm::EventSetup
Definition: EventSetup.h:58
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:34
hcaldqm::DQModule::_subsystem
std::string _subsystem
Definition: DQModule.h:48
HcalOfflineHarvesting::_summaryList
std::vector< Summary > _summaryList
Definition: HcalOfflineHarvesting.h:55
alignCSCRings.r
r
Definition: alignCSCRings.py:93
HcalOfflineHarvesting::beginRun
void beginRun(edm::Run const &, edm::EventSetup const &) override
Definition: HcalOfflineHarvesting.cc:34
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:691
HcalOfflineHarvesting::fDigi
Definition: HcalOfflineHarvesting.h:53
dqm::implementation::IGetter
Definition: DQMStore.h:484
HcalOfflineHarvesting.name
name
Definition: HcalOfflineHarvesting.py:8
dqm::implementation::IGetter::get
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:651
dqm::implementation::IBooker
Definition: DQMStore.h:43
hcaldqm::DQHarvester
Definition: DQHarvester.h:17
hcaldqm::TPRunSummary
Definition: TPRunSummary.h:8
HcalOfflineHarvesting::_sumnames
std::map< Summary, std::string > _sumnames
Definition: HcalOfflineHarvesting.h:61
HcalOfflineHarvesting::_dqmEndLuminosityBlock
void _dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &) override
Definition: HcalOfflineHarvesting.cc:45
DQMEDHarvester::endLuminosityBlock
void endLuminosityBlock(edm::LuminosityBlock const &, edm::EventSetup const &) final
Definition: DQMEDHarvester.h:132
HcalOfflineHarvesting::_reportSummaryMap
MonitorElement * _reportSummaryMap
Definition: HcalOfflineHarvesting.h:64
HLT_FULL_cff.flags
flags
Definition: HLT_FULL_cff.py:13150
hcaldqm::filter
Definition: HashFilter.h:18
hcaldqm::RecoRunSummary
Definition: RecoRunSummary.h:8