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  auto iC = consumesCollector();
21  if (std::find(_summaryList.begin(), _summaryList.end(), fRaw) != _summaryList.end()) {
22  _sumgen[fRaw] = new hcaldqm::RawRunSummary("RawRunHarvesting", _sumnames[fRaw], ps, iC);
23  }
24  if (std::find(_summaryList.begin(), _summaryList.end(), fDigi) != _summaryList.end()) {
25  _sumgen[fDigi] = new hcaldqm::DigiRunSummary("DigiRunHarvesting", _sumnames[fDigi], ps, iC);
26  }
27  if (std::find(_summaryList.begin(), _summaryList.end(), fReco) != _summaryList.end()) {
28  _sumgen[fReco] = new hcaldqm::RecoRunSummary("RecoRunHarvesting", _sumnames[fReco], ps, iC);
29  }
30  if (std::find(_summaryList.begin(), _summaryList.end(), fTP) != _summaryList.end()) {
31  _sumgen[fTP] = new hcaldqm::TPRunSummary("TPRunHarvesting", _sumnames[fTP], ps, iC);
32  }
33 }
34 
35 /* virtual */ void HcalOfflineHarvesting::beginRun(edm::Run const& r, edm::EventSetup const& es) {
36  DQHarvester::beginRun(r, es);
37 
38  for (auto& it_sum : _summaryList) {
39  _sumgen[it_sum]->beginRun(r, es);
40  }
41 }
42 
43 //
44 // For OFFLINE there is no per LS evaluation
45 //
48  edm::LuminosityBlock const& lb,
49  edm::EventSetup const& es) {
50  for (auto& it_sum : _summaryList) {
51  if (ig.get(_subsystem + "/" + _sumnames[it_sum] + "/EventsTotal") != nullptr) {
52  _summarks[it_sum] = true;
53  }
54  }
55 
56  // CALL ALL THE HARVESTERS
57  for (auto& it_sum : _summaryList) {
58  // run only if have to
59  if (_summarks[it_sum]) {
60  (_sumgen[it_sum])->endLuminosityBlock(ib, ig, lb, es);
61  }
62  }
63 }
64 
65 //
66 // Evaluate and Generate Run Summary
67 //
69  // OBTAIN/SET WHICH MODULES ARE PRESENT
70  std::map<Summary, std::string> datatier_names;
71  datatier_names[fRaw] = "RAW";
72  datatier_names[fDigi] = "DIGI";
73  datatier_names[fReco] = "RECO";
74  datatier_names[fTP] = "TP";
75 
76  int num = 0;
77  std::map<std::string, int> datatiers;
78  for (auto& it_sum : _summaryList) {
79  if (_summarks[it_sum]) {
80  datatiers.insert(std::pair<std::string, int>(datatier_names[it_sum], num));
81  ++num;
82  }
83  }
84 
85  // CREATE THE REPORT SUMMARY MAP
86  // num is #modules
87  // datatiers - std map [DATATIER_NAME] -> [positional value [0,num-1]]
88  // -> bin wise +1 should be
89  if (!_reportSummaryMap) {
90  ib.setCurrentFolder(_subsystem + "/EventInfo");
92  ib.book2D("reportSummaryMap", "reportSummaryMap", _vCrates.size(), 0, _vCrates.size(), num, 0, num);
93  // x axis labels
94 
95  for (uint32_t i = 0; i < _vCrates.size(); i++) {
96  char name[5];
97  sprintf(name, "%d", _vCrates[i]);
99  }
100  // y axis lables
101  for (std::map<std::string, int>::const_iterator it = datatiers.begin(); it != datatiers.end(); ++it) {
102  std::string name = it->first;
103  int value = it->second;
105  }
106  }
107 
108  // iterate over all summary generators and get the flags
109  for (auto& it_sum : _summaryList) {
110  // IF MODULE IS NOT PRESENT IN DATA SKIP
111  if (!_summarks[it_sum]) {
112  continue;
113  }
114 
115  // OBTAIN ALL THE FLAGS FOR THIS MODULE
116  // AND SET THE REPORT STATUS MAP
117  // NOTE AGAIN: datatiers map [DATATIER]->[value not bin!]+1 therefore
118  if (_debug > 0) {
119  std::cout << _sumnames[it_sum] << std::endl;
120  }
121  std::vector<hcaldqm::flag::Flag> flags = (_sumgen[it_sum])->endJob(ib, ig);
122  if (_debug > 0) {
123  std::cout << "********************" << std::endl;
124  std::cout << "SUMMARY" << std::endl;
125  }
126  for (uint32_t icrate = 0; icrate < _vCrates.size(); icrate++) {
127  _reportSummaryMap->setBinContent(icrate + 1, datatiers[flags[icrate]._name] + 1, (int)flags[icrate]._state);
128  if (_debug > 0) {
129  std::cout << "Crate=" << _vCrates[icrate] << std::endl;
130  std::cout << flags[icrate]._name << " " << flags[icrate]._state << std::endl;
131  }
132  }
133  }
134 }
135 
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
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:47
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:68
HcalOfflineHarvesting::fTP
Definition: HcalOfflineHarvesting.h:53
HcalOfflineHarvesting
Definition: HcalOfflineHarvesting.py:1
hcaldqm::DQModule::_name
std::string _name
Definition: DQModule.h:42
HcalOfflineHarvesting::HcalOfflineHarvesting
HcalOfflineHarvesting(edm::ParameterSet const &)
Definition: HcalOfflineHarvesting.cc:7
hcaldqm::DigiRunSummary
Definition: DigiRunSummary.h:9
edm::ParameterSet
Definition: ParameterSet.h:47
hcaldqm::DQModule::_debug
int _debug
Definition: DQModule.h:45
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:762
HcalOfflineHarvesting::fReco
Definition: HcalOfflineHarvesting.h:53
cuy.ib
ib
Definition: cuy.py:661
edm::EventSetup
Definition: EventSetup.h:58
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
EgammaValidation_cff.num
num
Definition: EgammaValidation_cff.py:33
hcaldqm::DQModule::_subsystem
std::string _subsystem
Definition: DQModule.h:49
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:35
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:682
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:673
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:46
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:13168
hcaldqm::filter
Definition: HashFilter.h:18
hcaldqm::RecoRunSummary
Definition: RecoRunSummary.h:8