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