CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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(NULL)
9 {
10  _vsumgen.resize(nSummary);
11  _vmarks.resize(nSummary);
12  _vnames.resize(nSummary);
13  _vnames[fRaw]="RawTask";
14  _vnames[fDigi]="DigiTask";
15  _vnames[fReco]="RecHitTask";
16  _vnames[fTP]="TPTask";
17  for (uint32_t i=0; i<_vmarks.size(); i++)
18  _vmarks[i]=false;
19 
20  _vsumgen[fRaw]=new hcaldqm::RawRunSummary("RawRunHarvesting", _vnames[fRaw],ps);
21  _vsumgen[fDigi]=new hcaldqm::DigiRunSummary("DigiRunHarvesting", _vnames[fDigi],ps);
22  _vsumgen[fReco]=new hcaldqm::RecoRunSummary("RecoRunHarvesting", _vnames[fReco],ps);
23  _vsumgen[fTP]=new hcaldqm::TPRunSummary("TPRunHarvesting", _vnames[fTP],ps);
24 }
25 
27  edm::Run const& r, edm::EventSetup const& es)
28 {
29  DQHarvester::beginRun(r,es);
30 
31  for (std::vector<DQClient*>::const_iterator it=_vsumgen.begin();
32  it!=_vsumgen.end(); ++it)
33  (*it)->beginRun(r,es);
34 }
35 
36 //
37 // For OFFLINE there is no per LS evaluation
38 //
42  edm::EventSetup const& es)
43 {
44  if (ig.get(_subsystem+"/"+_vnames[fRaw]+"/EventsTotal")!=NULL)
45  _vmarks[fRaw]=true;
46  if (ig.get(_subsystem+"/"+_vnames[fDigi]+"/EventsTotal")!=NULL)
47  _vmarks[fDigi]=true;
48  if (ig.get(_subsystem+"/"+_vnames[fTP]+"/EventsTotal")!=NULL)
49  _vmarks[fTP]=true;
50  if (ig.get(_subsystem+"/"+_vnames[fReco]+"/EventsTotal")!=NULL)
51  _vmarks[fReco]=true;
52 
53  // CALL ALL THE HARVESTERS
54  int ii=0;
55  for (std::vector<DQClient*>::const_iterator it=_vsumgen.begin();
56  it!=_vsumgen.end(); ++it)
57  {
58  // run only if have to
59  if (_vmarks[ii])
60  (*it)->endLuminosityBlock(ib,ig,lb,es);
61  ii++;
62  }
63 }
64 
65 //
66 // Evaluate and Generate Run Summary
67 //
70 {
71  // OBTAIN/SET WHICH MODULES ARE PRESENT
72  int num=0; std::map<std::string, int> datatiers;
73  if (_vmarks[fRaw])
74  {
75  datatiers.insert(std::pair<std::string, int>("RAW",num));
76  num++;
77  }
78  if (_vmarks[fDigi])
79  {
80  datatiers.insert(std::pair<std::string, int>("DIGI",num));
81  num++;
82  }
83  if (_vmarks[fTP])
84  {
85  datatiers.insert(std::pair<std::string, int>("TP",num));
86  num++;
87  }
88  if (_vmarks[fReco])
89  {
90  datatiers.insert(std::pair<std::string, int>("RECO",num));
91  num++;
92  }
93 
94  // CREATE THE REPORT SUMMARY MAP
95  // num is #modules
96  // datatiers - std map [DATATIER_NAME] -> [positional value [0,num-1]]
97  // -> bin wise +1 should be
98  if (!_reportSummaryMap)
99  {
100  ib.setCurrentFolder(_subsystem+"/EventInfo");
101  _reportSummaryMap = ib.book2D("reportSummaryMap", "reportSummaryMap",
102  _vFEDs.size(), 0, _vFEDs.size(), num,0,num);
103  // x axis labels
104 
105  for (uint32_t i=0; i<_vFEDs.size(); i++)
106  {
107  char name[5];
108  sprintf(name, "%d", _vFEDs[i]);
109  _reportSummaryMap->setBinLabel(i+1, name, 1);
110  }
111  // y axis lables
112  for (std::map<std::string, int>::const_iterator
113  it=datatiers.begin(); it!=datatiers.end(); ++it)
114  {
115  std::string name = it->first;
116  int value = it->second;
117  _reportSummaryMap->setBinLabel(value+1, name, 2);
118  }
119  }
120 
121  // iterate over all summary generators and get the flags
122  int ii=0;
123  for (std::vector<DQClient*>::const_iterator it=_vsumgen.begin();
124  it!=_vsumgen.end(); ++it)
125  {
126  // IF MODULE IS NOT PRESENT IN DATA SKIP
127  if (!_vmarks[ii])
128  {ii++;continue;}
129 
130  // OBTAIN ALL THE FLAGS FOR THIS MODULE
131  // AND SET THE REPORT STATUS MAP
132  // NOTE AGAIN: datatiers map [DATATIER]->[value not bin!]+1 therefore
133  if (_debug>0)
134  std::cout << _vnames[ii] << std::endl;
135  std::vector<hcaldqm::flag::Flag> flags = (*it)->endJob(ib,ig);
136  if (_debug>0)
137  {
138  std::cout << "********************" << std::endl;
139  std::cout << "SUMMARY" << std::endl;
140  }
141  for (uint32_t ifed=0; ifed<_vFEDs.size(); ifed++)
142  {
144  datatiers[flags[ifed]._name]+1, (int)flags[ifed]._state);
145  if (_debug>0)
146  {
147  std::cout << "FED=" << _vFEDs[ifed] << std::endl;
148  std::cout << flags[ifed]._name << " " << flags[ifed]._state
149  <<std::endl;
150  }
151  }
152  ii++;
153  }
154 }
155 
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
int ib
Definition: cuy.py:660
std::vector< bool > _vmarks
HcalOfflineHarvesting(edm::ParameterSet const &)
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:304
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
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)
std::vector< Variable::Flags > flags
Definition: MVATrainer.cc:135
#define NULL
Definition: scimark2.h:8
int ii
Definition: cuy.py:588
MonitorElement * _reportSummaryMap
virtual void _dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &)
std::vector< std::string > _vnames
virtual void _dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &)
std::string _name
Definition: DQModule.h:57
std::vector< hcaldqm::DQClient * > _vsumgen
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:276
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
std::string _subsystem
Definition: DQModule.h:64
tuple cout
Definition: gather_cfg.py:145
std::vector< int > _vFEDs
Definition: DQHarvester.h:38
virtual void beginRun(edm::Run const &, edm::EventSetup const &)
Definition: Run.h:43