CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiPixelActionExecutor.cc
Go to the documentation of this file.
1 //#define printing false
2 //#define occupancyprinting false
3 
19 
20 #include <math.h>
21 
22 #include <iostream>
23 using namespace std;
24 //=============================================================================================================
25 //
26 // -- Constructor
27 //
29  bool Tier0Flag) :
30  offlineXMLfile_(offlineXMLfile),
31  Tier0Flag_(Tier0Flag) {
32  edm::LogInfo("SiPixelActionExecutor") <<
33  " Creating SiPixelActionExecutor " << "\n" ;
34  configParser_ = 0;
35  configWriter_ = 0;
36  ndet_ = 0;
37  //collationDone = false;
38 }
39 //=============================================================================================================
40 //
41 // -- Destructor
42 //
44  edm::LogInfo("SiPixelActionExecutor") <<
45  " Deleting SiPixelActionExecutor " << "\n" ;
46  if (configParser_) delete configParser_;
47  if (configWriter_) delete configWriter_;
48 }
49 //=============================================================================================================
50 //
51 // -- Read Configuration File
52 //
54  string localPath;
55  if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
56  else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
57  if (configParser_ == 0) {
60  }
61 }
62 //=============================================================================================================
63 //
64 // -- Read Configuration File
65 //
67  int& sum_barrel_freq,
68  int& sum_endcap_freq,
69  int& sum_grandbarrel_freq,
70  int& sum_grandendcap_freq,
71  int& message_limit_,
72  int& source_type_,
73  int& calib_type_) {
74  //printing cout<<"Entering SiPixelActionExecutor::readConfiguration..."<<endl;
75  string localPath;
76  if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
77  else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
78  if (configParser_ == 0) {
81  }
82 
83  if (!configParser_->getFrequencyForTrackerMap(tkmap_freq)){
84  cout << "SiPixelActionExecutor::readConfiguration: Failed to read TrackerMap configuration parameters!! ";
85  return false;
86  }
87  if (!configParser_->getFrequencyForBarrelSummary(sum_barrel_freq)){
88  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Barrel Summary configuration parameters!! " << "\n" ;
89  return false;
90  }
91  if (!configParser_->getFrequencyForEndcapSummary(sum_endcap_freq)){
92  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Endcap Summary configuration parameters!! " << "\n" ;
93  return false;
94  }
95  if (!configParser_->getFrequencyForGrandBarrelSummary(sum_grandbarrel_freq)){
96  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Grand Barrel Summary configuration parameters!! " << "\n" ;
97  return false;
98  }
99  if (!configParser_->getFrequencyForGrandEndcapSummary(sum_grandendcap_freq)){
100  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Grand Endcap Summary configuration parameters!! " << "\n" ;
101  return false;
102  }
103  if (!configParser_->getMessageLimitForQTests(message_limit_)){
104  edm::LogInfo("SiPixelActionExecutor") << "Failed to read QTest Message Limit" << "\n" ;
105  return false;
106  }
107  if (!configParser_->getSourceType(source_type_)){
108  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Source Type" << "\n" ;
109  return false;
110  }
111  if (!configParser_->getCalibType(calib_type_)){
112  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Calib Type" << "\n" ;
113  return false;
114  }
115  //printing cout<<"...leaving SiPixelActionExecutor::readConfiguration..."<<endl;
116  return true;
117 }
118 //=============================================================================================================
119 bool SiPixelActionExecutor::readConfiguration(int& tkmap_freq, int& summary_freq) {
120  //printing cout<<"Entering SiPixelActionExecutor::readConfiguration..."<<endl;
121  string localPath;
122  if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
123  else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
124  if (configParser_ == 0) {
127  }
128 
129  if (!configParser_->getFrequencyForTrackerMap(tkmap_freq)){
130  cout << "SiPixelActionExecutor::readConfiguration: Failed to read TrackerMap configuration parameters!! ";
131  return false;
132  }
133  if (!configParser_->getFrequencyForBarrelSummary(summary_freq)){
134  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Summary configuration parameters!! " << "\n" ;
135  return false;
136  }
137  //printing cout<<"...leaving SiPixelActionExecutor::readConfiguration..."<<endl;
138  return true;
139 }
140 
141 //=============================================================================================================
143  //To be majorly overhauled and split into two, I guess.
144 
145  //cout<<"entering SiPixelActionExecutor::createSummary..."<<endl;
146  string barrel_structure_name;
147  vector<string> barrel_me_names;
148  string localPath;
149  if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
150  else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
151 // cout<<"*********************ATTENTION! LOCALPATH= "<<localPath<<endl;
152  if (configParser_ == 0) {
155  }
156  if (!configParser_->getMENamesForBarrelSummary(barrel_structure_name, barrel_me_names)){
157  cout << "SiPixelActionExecutor::createSummary: Failed to read Barrel Summary configuration parameters!! ";
158  return;
159  }
161 
162  iBooker.setCurrentFolder("Pixel/");
163  iGetter.setCurrentFolder("Pixel/");
164  fillSummary(iBooker, iGetter, barrel_structure_name, barrel_me_names, true, isUpgrade); // Barrel
165  iBooker.setCurrentFolder("Pixel/");
166  iGetter.setCurrentFolder("Pixel/");
167  string endcap_structure_name;
168  vector<string> endcap_me_names;
169  if (!configParser_->getMENamesForEndcapSummary(endcap_structure_name, endcap_me_names)){
170  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Endcap Summary configuration parameters!! " << "\n" ;
171  return;
172  }
173 
174 // cout << "--- Processing endcap" << endl;
175 
176  iBooker.setCurrentFolder("Pixel/");
177  iGetter.setCurrentFolder("Pixel/");
178 
179  fillSummary(iBooker,iGetter, endcap_structure_name, endcap_me_names, false, isUpgrade); // Endcap
180  iBooker.setCurrentFolder("Pixel/");
181  iGetter.setCurrentFolder("Pixel/");
182 
183  if(source_type_==0||source_type_==5 || source_type_ == 20){//do this only if RawData source is present
184  string federror_structure_name;
185  vector<string> federror_me_names;
186  if (!configParser_->getMENamesForFEDErrorSummary(federror_structure_name, federror_me_names)){
187  cout << "SiPixelActionExecutor::createSummary: Failed to read FED Error Summary configuration parameters!! ";
188  return;
189  }
190  iBooker.setCurrentFolder("Pixel/");
191  iGetter.setCurrentFolder("Pixel/");
192 
193  fillFEDErrorSummary(iBooker, iGetter, federror_structure_name, federror_me_names);
194  iBooker.setCurrentFolder("Pixel/");
195  iGetter.setCurrentFolder("Pixel/");
196  }
197  if (configWriter_) delete configWriter_;
198  configWriter_ = 0;
199 // cout<<"leaving SiPixelActionExecutor::createSummary..."<<endl;
200 }
201 
202 //=============================================================================================================
204  int nBPixModules;
205  if (isUpgrade) {nBPixModules=1184;} else {nBPixModules=768;}
206 
207  iBooker.cd();
208  iBooker.setCurrentFolder("Pixel/Barrel");
209  DEV_adc_Barrel = iBooker.book1D("DEV_adc_Barrel","Deviation from reference;Module;<adc_ref>-<adc>",nBPixModules,0.,nBPixModules);
210  DEV_ndigis_Barrel = iBooker.book1D("DEV_ndigis_Barrel","Deviation from reference;Module;<ndigis_ref>-<ndigis>",nBPixModules,0.,nBPixModules);
211  DEV_charge_Barrel = iBooker.book1D("DEV_charge_Barrel","Deviation from reference;Module;<charge_ref>-<charge>",nBPixModules,0.,nBPixModules);
212  DEV_nclusters_Barrel = iBooker.book1D("DEV_nclusters_Barrel","Deviation from reference;Module;<nclusters_ref>-<nclusters>",nBPixModules,0.,nBPixModules);
213  DEV_size_Barrel = iBooker.book1D("DEV_size_Barrel","Deviation from reference;Module;<size_ref>-<size>",nBPixModules,0.,nBPixModules);
214  iBooker.cd();
215  iBooker.setCurrentFolder("Pixel/Endcap");
216  DEV_adc_Endcap = iBooker.book1D("DEV_adc_Endcap","Deviation from reference;Module;<adc_ref>-<adc>",672,0.,672.);
217  DEV_ndigis_Endcap = iBooker.book1D("DEV_ndigis_Endcap","Deviation from reference;Module;<ndigis_ref>-<ndigis>",672,0.,672.);
218  DEV_charge_Endcap = iBooker.book1D("DEV_charge_Endcap","Deviation from reference;Module;<charge_ref>-<charge>",672,0.,672.);
219  DEV_nclusters_Endcap = iBooker.book1D("DEV_nclusters_Endcap","Deviation from reference;Module;<nclusters_ref>-<nclusters>",672,0.,672.);
220  DEV_size_Endcap = iBooker.book1D("DEV_size_Endcap","Deviation from reference;Module;<size_ref>-<size>",672,0.,672.);
221  iBooker.cd();
222 }
223 
224 
226  int n = 768;
227  MonitorElement* me1; MonitorElement* me2;
228  MonitorElement* me3; MonitorElement* me4;
229  MonitorElement* me5;
230  TH1* ref1; TH1* ref2;
231  TH1* ref3; TH1* ref4;
232  TH1* ref5;
233  MonitorElement* dev1; MonitorElement* dev2;
234  MonitorElement* dev3; MonitorElement* dev4;
235  MonitorElement* dev5;
236  me1 = iGetter.get("Pixel/Barrel/SUMDIG_adc_Barrel");
237  ref1 = me1->getRefTH1();
238  dev1 = iGetter.get("Pixel/Barrel/DEV_adc_Barrel");
239  me2 = iGetter.get("Pixel/Barrel/SUMDIG_ndigis_Barrel");
240  ref2 = me2->getRefTH1();
241  dev2 = iGetter.get("Pixel/Barrel/DEV_ndigis_Barrel");
242  me3 = iGetter.get("Pixel/Barrel/SUMCLU_charge_Barrel");
243  ref3 = me3->getRefTH1();
244  dev3 = iGetter.get("Pixel/Barrel/DEV_charge_Barrel");
245  me4 = iGetter.get("Pixel/Barrel/SUMCLU_nclusters_Barrel");
246  ref4 = me4->getRefTH1();
247  dev4 = iGetter.get("Pixel/Barrel/DEV_nclusters_Barrel");
248  me5 = iGetter.get("Pixel/Barrel/SUMCLU_size_Barrel");
249  ref5 = me5->getRefTH1();
250  dev5 = iGetter.get("Pixel/Barrel/DEV_size_Barrel");
251  for(int i=1; i!=n+1; i++){
252  float ref_value; float new_value;
253  // Barrel adc:
254  if(me1)if(ref1)if(dev1){
255  new_value = me1->getBinContent(i);
256  ref_value = ref1->GetBinContent(i);
257  dev1->setBinContent(i,ref_value-new_value);
258  }
259  //Barrel ndigis:
260  if(me2)if(ref2)if(dev2){
261  new_value = me2->getBinContent(i);
262  ref_value = ref2->GetBinContent(i);
263  dev2->setBinContent(i,ref_value-new_value);
264  }
265  // Barrel cluster charge:
266  if(me3)if(ref3)if(dev3){
267  new_value = me3->getBinContent(i);
268  ref_value = ref3->GetBinContent(i);
269  dev3->setBinContent(i,ref_value-new_value);
270  }
271  // Barrel nclusters:
272  if(me4)if(ref4)if(dev4){
273  new_value = me4->getBinContent(i);
274  ref_value = ref4->GetBinContent(i);
275  dev4->setBinContent(i,ref_value-new_value);
276  }
277  // Barrel cluster size:
278  if(me5)if(ref5)if(dev5){
279  new_value = me5->getBinContent(i);
280  ref_value = ref5->GetBinContent(i);
281  dev5->setBinContent(i,ref_value-new_value);
282  }
283  }
284 
285  int nn = 672;
286  MonitorElement* me11; MonitorElement* me12;
287  MonitorElement* me13; MonitorElement* me14;
288  MonitorElement* me15;
289  TH1* ref11; TH1* ref12;
290  TH1* ref13; TH1* ref14;
291  TH1* ref15;
292  MonitorElement* dev11; MonitorElement* dev12;
293  MonitorElement* dev13; MonitorElement* dev14;
294  MonitorElement* dev15;
295  me11 = iGetter.get("Pixel/Endcap/SUMDIG_adc_Endcap");
296  ref11 = me11->getRefTH1();
297  dev11 = iGetter.get("Pixel/Endcap/DEV_adc_Endcap");
298  me12 = iGetter.get("Pixel/Endcap/SUMDIG_ndigis_Endcap");
299  ref12 = me12->getRefTH1();
300  dev12 = iGetter.get("Pixel/Endcap/DEV_ndigis_Endcap");
301  me13 = iGetter.get("Pixel/Endcap/SUMCLU_charge_Endcap");
302  ref13 = me13->getRefTH1();
303  dev13 = iGetter.get("Pixel/Endcap/DEV_charge_Endcap");
304  me14 = iGetter.get("Pixel/Endcap/SUMCLU_nclusters_Endcap");
305  ref14 = me14->getRefTH1();
306  dev14 = iGetter.get("Pixel/Endcap/DEV_nclusters_Endcap");
307  me15 = iGetter.get("Pixel/Endcap/SUMCLU_size_Endcap");
308  ref15 = me15->getRefTH1();
309  dev15 = iGetter.get("Pixel/Endcap/DEV_size_Endcap");
310  for(int i=1; i!=nn+1; i++){
311  float ref_value; float new_value;
312  // Endcap adc:
313  if(me11)if(ref11)if(dev11){
314  new_value = me11->getBinContent(i);
315  ref_value = ref11->GetBinContent(i);
316  dev11->setBinContent(i,ref_value-new_value);
317  }
318  //Endcap ndigis:
319  if(me12)if(ref12)if(dev12){
320  new_value = me12->getBinContent(i);
321  ref_value = ref12->GetBinContent(i);
322  dev12->setBinContent(i,ref_value-new_value);
323  }
324  // Endcap cluster charge:
325  if(me13)if(ref13)if(dev13){
326  new_value = me13->getBinContent(i);
327  ref_value = ref13->GetBinContent(i);
328  dev13->setBinContent(i,ref_value-new_value);
329  }
330  // Endcap nclusters:
331  if(me14)if(ref14)if(dev14){
332  new_value = me14->getBinContent(i);
333  ref_value = ref14->GetBinContent(i);
334  dev14->setBinContent(i,ref_value-new_value);
335  }
336  // Endcap cluster size:
337  if(me15)if(ref15)if(dev15){
338  new_value = me15->getBinContent(i);
339  ref_value = ref15->GetBinContent(i);
340  dev15->setBinContent(i,ref_value-new_value);
341  }
342  }
343 }
344 
345 //=============================================================================================================
346 
347 void SiPixelActionExecutor::GetBladeSubdirs(DQMStore::IBooker & iBooker, DQMStore::IGetter & iGetter, vector<string>& blade_subdirs) {
348 
349  blade_subdirs.clear();
350  vector<string> panels = iGetter.getSubdirs();
351  vector<string> modules;
352  for (vector<string>::const_iterator it = panels.begin(); it != panels.end(); it++) {
353  iGetter.cd(*it);
354  iBooker.cd(*it);
355  modules = iGetter.getSubdirs();
356  for (vector<string>::const_iterator m_it = modules.begin(); m_it != modules.end(); m_it++) {
357  blade_subdirs.push_back(*m_it);
358  }
359  }
360 }
361 
362 
363 //=============================================================================================================
364 
365 void SiPixelActionExecutor::fillSummary(DQMStore::IBooker& iBooker, DQMStore::IGetter & iGetter, string dir_name, vector<string>& me_names, bool isbarrel, bool isUpgrade)
366 {
367 
368 
369  //cout<<"entering SiPixelActionExecutor::fillSummary..."<<endl;
370  string currDir = iBooker.pwd();
371  string prefix;
372  if(source_type_==0) prefix="SUMRAW";
373  else if (source_type_==1) prefix="SUMDIG";
374  else if (source_type_==2) prefix="SUMCLU";
375  else if (source_type_==3) prefix="SUMTRK";
376  else if (source_type_==4) prefix="SUMHIT";
377  else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
378  else if (source_type_==20) prefix="SUMOFF";
379  if (currDir.find(dir_name) != string::npos) {
380  vector<MonitorElement*> sum_mes;
381  for (vector<string>::const_iterator iv = me_names.begin();
382  iv != me_names.end(); iv++) {
383  if(source_type_==5||source_type_==6){
384  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
385  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
386  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
387  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
388  prefix="SUMRAW";
389  else if((*iv)=="ndigis"||(*iv)=="adc")
390  prefix="SUMDIG";
391  else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||
392  (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
393  (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
394  prefix="SUMCLU";
395  if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
396  else if((*iv)=="residualX"||(*iv)=="residualY")
397  prefix="SUMTRK";
398  else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
399  prefix="SUMHIT";
400  else if((*iv)=="Gain1d"||(*iv)=="GainChi2NDF1d"||
401  (*iv)=="GainChi2Prob1d"||(*iv)=="Pedestal1d"||
402  (*iv)=="GainNPoints1d"||(*iv)=="GainHighPoint1d"||
403  (*iv)=="GainLowPoint1d"||(*iv)=="GainEndPoint1d"||
404  (*iv)=="GainFitResult2d"||(*iv)=="GainDynamicRange2d"||
405  (*iv)=="GainSaturate2d"||
406  (*iv)=="ScurveChi2ProbSummary"||(*iv)=="ScurveFitResultSummary"||
407  (*iv)=="ScurveSigmasSummary"||(*iv)=="ScurveThresholdSummary"||
408  (*iv)=="pixelAliveSummary" || (*iv) == "SiPixelErrorsCalibDigis")
409  prefix="SUMCAL";
410  }
411  MonitorElement* temp; string tag;
412  if((*iv).find("residual")!=string::npos){ // track residuals
413  tag = prefix + "_" + (*iv) + "_mean_"
414  + currDir.substr(currDir.find(dir_name));
415  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
416  sum_mes.push_back(temp);
417  tag = prefix + "_" + (*iv) + "_RMS_"
418  + currDir.substr(currDir.find(dir_name));
419  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
420  sum_mes.push_back(temp);
421  }else if(prefix == "SUMCAL"){ // calibrations
422  if((*iv)=="Gain1d" || (*iv)=="GainChi2NDF1d" || (*iv)=="GainChi2Prob1d" ||
423  (*iv)=="GainNPoints1d" || (*iv)=="GainHighPoint1d" ||
424  (*iv)=="GainLowPoint1d" || (*iv)=="GainEndPoint1d" ||
425  (*iv)=="GainDynamicRange2d" || (*iv)=="GainSaturate2d" ||
426  (*iv)=="Pedestal1d" ||
427  (*iv)=="ScurveChi2ProbSummary" || (*iv)=="ScurveFitResultSummary" ||
428  (*iv)=="ScurveSigmasSummary" || (*iv)=="ScurveThresholdSummary"){
429  tag = prefix + "_" + (*iv) + "_mean_"
430  + currDir.substr(currDir.find(dir_name));
431  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
432  sum_mes.push_back(temp);
433  tag = prefix + "_" + (*iv) + "_RMS_"
434  + currDir.substr(currDir.find(dir_name));
435  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
436  sum_mes.push_back(temp);
437  }else if((*iv) == "SiPixelErrorsCalibDigis"){
438  tag = prefix + "_" + (*iv) + "_NCalibErrors_"
439  + currDir.substr(currDir.find(dir_name));
440  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
441  sum_mes.push_back(temp);
442  }else if((*iv)=="GainFitResult2d"){
443  tag = prefix + "_" + (*iv) + "_NNegativeFits_"
444  + currDir.substr(currDir.find(dir_name));
445  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
446  sum_mes.push_back(temp);
447  }else if((*iv)=="pixelAliveSummary"){
448  tag = prefix + "_" + (*iv) + "_FracOfPerfectPix_"
449  + currDir.substr(currDir.find(dir_name));
450  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
451  sum_mes.push_back(temp);
452  tag = prefix + "_" + (*iv) + "_mean_"
453  + currDir.substr(currDir.find(dir_name));
454  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
455  sum_mes.push_back(temp);
456  }
457  }else{
458  tag = prefix + "_" + (*iv) + "_" + currDir.substr(currDir.find(dir_name));
459  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
460  sum_mes.push_back(temp);
461  if((*iv)=="ndigis"){
462  tag = prefix + "_" + (*iv) + "FREQ_"
463  + currDir.substr(currDir.find(dir_name));
464  temp = getSummaryME(iBooker, iGetter, tag, isUpgrade);
465  sum_mes.push_back(temp);
466  }
467  if(prefix=="SUMDIG" && (*iv)=="adc"){
468  tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name));
469  temp = iBooker.book1D(tag.c_str(), tag.c_str(),128, 0., 256.);
470  sum_mes.push_back(temp);
471  }
472  if(prefix=="SUMCLU" && (*iv)=="charge"){
473  tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name));
474  temp = iBooker.book1D(tag.c_str(), tag.c_str(),100, 0., 200.); // To look to get the size automatically
475  sum_mes.push_back(temp);
476  }
477  }
478  }
479  if (sum_mes.size() == 0) {
480  edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ;
481  return;
482  }
483  vector<string> subdirs = iGetter.getSubdirs();
484  //Blade
485  if(dir_name.find("Blade_") == 0) GetBladeSubdirs(iBooker, iGetter, subdirs);
486 
487  int ndet = 0;
488  for (vector<string>::const_iterator it = subdirs.begin();
489  it != subdirs.end(); it++) {
490  if (prefix!="SUMOFF" && (*it).find("Module_") == string::npos) continue;
491  if (prefix=="SUMOFF" && (*it).find(isbarrel?"Layer_":"Disk_") == string::npos) continue;
492  iBooker.cd(*it);
493  iGetter.cd(*it);
494  ndet++;
495 
496  vector<string> contents = iGetter.getMEs();
497 
498  for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin();
499  isum != sum_mes.end(); isum++) {
500  for (vector<string>::const_iterator im = contents.begin();
501  im != contents.end(); im++) {
502  string sname = ((*isum)->getName());
503  string tname = " ";
504  tname = sname.substr(7,(sname.find("_",7)-6));
505  if(sname.find("ALLMODS_adcCOMB_")!=string::npos) tname = "adc_";
506  if(sname.find("ALLMODS_chargeCOMB_")!=string::npos) tname = "charge_";
507  if(sname.find("_charge_")!=string::npos && sname.find("Track_")==string::npos) tname = "charge_";
508  if(sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos) tname = "nclusters_";
509  if(sname.find("_size_")!=string::npos && sname.find("Track_")==string::npos) tname = "size_";
510  if(sname.find("_charge_OffTrack_")!=string::npos) tname = "charge_OffTrack_";
511  if(sname.find("_nclusters_OffTrack_")!=string::npos) tname = "nclusters_OffTrack_";
512  if(sname.find("_size_OffTrack_")!=string::npos) tname = "size_OffTrack_";
513  if(sname.find("_sizeX_OffTrack_")!=string::npos) tname = "sizeX_OffTrack_";
514  if(sname.find("_sizeY_OffTrack_")!=string::npos) tname = "sizeY_OffTrack_";
515  if(sname.find("_charge_OnTrack_")!=string::npos) tname = "charge_OnTrack_";
516  if(sname.find("_nclusters_OnTrack_")!=string::npos) tname = "nclusters_OnTrack_";
517  if(sname.find("_size_OnTrack_")!=string::npos) tname = "size_OnTrack_";
518  if(sname.find("_sizeX_OnTrack_")!=string::npos) tname = "sizeX_OnTrack_";
519  if(sname.find("_sizeY_OnTrack_")!=string::npos) tname = "sizeY_OnTrack_";
520  if(tname.find("FREQ")!=string::npos) tname = "ndigis_";
521  if (((*im)).find(tname) == 0) {
522  string fullpathname = iBooker.pwd() + "/" + (*im);
523  MonitorElement * me = iGetter.get(fullpathname);
524 
525  if (me){
526  if(sname.find("_charge")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue;
527  if(sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue;
528  if(sname.find("_size")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue;
529  // fill summary histos:
530  if (sname.find("_RMS_")!=string::npos &&
531  sname.find("GainDynamicRange2d")==string::npos &&
532  sname.find("GainSaturate2d")==string::npos){
533  (*isum)->Fill(ndet, me->getRMS());
534  }else if (sname.find("GainDynamicRange2d")!=string::npos ||
535  sname.find("GainSaturate2d")!=string::npos){
536  float SumOfEntries=0.; float SumOfSquaredEntries=0.; int SumOfPixels=0;
537  for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){
538  SumOfEntries+=me->getBinContent(cols,rows);
539  SumOfSquaredEntries+=(me->getBinContent(cols,rows))*(me->getBinContent(cols,rows));
540  SumOfPixels++;
541  }
542 
543  float MeanInZ = SumOfEntries / float(SumOfPixels);
544  float RMSInZ = sqrt(SumOfSquaredEntries/float(SumOfPixels));
545  if(sname.find("_mean_")!=string::npos) (*isum)->Fill(ndet, MeanInZ);
546  if(sname.find("_RMS_")!=string::npos) (*isum)->Fill(ndet, RMSInZ);
547  }else if (sname.find("_FracOfPerfectPix_")!=string::npos){
548  float nlast = me->getBinContent(me->getNbinsX());
549  float nall = (me->getTH1F())->Integral(1,11);
550  (*isum)->Fill(ndet, nlast/nall);
551  }else if (sname.find("_NCalibErrors_")!=string::npos ||
552  sname.find("FREQ_")!=string::npos){
553  float nall = me->getEntries();
554  (*isum)->Fill(ndet, nall);
555  }else if (sname.find("GainFitResult2d")!=string::npos){
556  int NegFitPixels=0;
557  for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){
558  if(me->getBinContent(cols,rows)<0.) NegFitPixels++;
559  }
560  (*isum)->Fill(ndet, float(NegFitPixels));
561  }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos ||
562  (sname.find("ALLMODS_chargeCOMB_")!=string::npos && me->getName().find("Track_")==string::npos)){
563  (*isum)->getTH1F()->Add(me->getTH1F());
564  }else if (sname.find("_NErrors_")!=string::npos){
565  string path1 = fullpathname;
566  path1 = path1.replace(path1.find("NErrors"),7,"errorType");
567  MonitorElement * me1 = iGetter.get(path1);
568  bool notReset=true;
569  if(me1){
570  for(int jj=1; jj<16; jj++){
571  if(me1->getBinContent(jj)>0.){
572  if(jj==6){ //errorType=30 (reset)
573  string path2 = path1;
574  path2 = path2.replace(path2.find("errorType"),9,"TBMMessage");
575  MonitorElement * me2 = iGetter.get(path2);
576  if(me2) if(me2->getBinContent(6)>0. || me2->getBinContent(7)>0.) notReset=false;
577  }
578  }
579  }
580  }
581  if(notReset) (*isum)->Fill(ndet, me1->getEntries());
582  }else if ((sname.find("_charge_")!=string::npos && sname.find("Track_")==string::npos &&
583  me->getName().find("Track_")==string::npos) ||
584  (sname.find("_charge_")!=string::npos && sname.find("_OnTrack_")!=string::npos &&
585  me->getName().find("_OnTrack_")!=string::npos) ||
586  (sname.find("_charge_")!=string::npos && sname.find("_OffTrack_")!=string::npos &&
587  me->getName().find("_OffTrack_")!=string::npos) ||
588  (sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos &&
589  me->getName().find("Track_")==string::npos) ||
590  (sname.find("_nclusters_")!=string::npos && sname.find("_OnTrack_")!=string::npos &&
591  me->getName().find("_OnTrack_")!=string::npos) ||
592  (sname.find("_nclusters_")!=string::npos && sname.find("_OffTrack_")!=string::npos &&
593  me->getName().find("_OffTrack_")!=string::npos) ||
594  (sname.find("_size")!=string::npos && sname.find("Track_")==string::npos &&
595  me->getName().find("Track_")==string::npos) ||
596  (sname.find("_size")!=string::npos && sname.find("_OnTrack_")!=string::npos &&
597  me->getName().find("_OnTrack_")!=string::npos) ||
598  (sname.find("_size")!=string::npos && sname.find("_OffTrack_")!=string::npos &&
599  me->getName().find("_OffTrack_")!=string::npos)){
600  (*isum)->Fill(ndet, me->getMean());
601  }else if(sname.find("_charge_")==string::npos && sname.find("_nclusters_")==string::npos && sname.find("_size")==string::npos){
602  (*isum)->Fill(ndet, me->getMean());
603  }
604 
605  // set titles:
606  if(prefix=="SUMOFF"){
607  (*isum)->setAxisTitle(isbarrel?"Ladders":"Blades",1);
608  }else if(sname.find("ALLMODS_adcCOMB_")!=string::npos){
609  (*isum)->setAxisTitle("Digi charge [ADC]",1);
610  }else if(sname.find("ALLMODS_chargeCOMB_")!=string::npos){
611  (*isum)->setAxisTitle("Cluster charge [kilo electrons]",1);
612  }else{
613  (*isum)->setAxisTitle("Modules",1);
614  }
615  string title = " ";
616  if (sname.find("_RMS_")!=string::npos){
617  title = "RMS of " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
618  }else if (sname.find("_FracOfPerfectPix_")!=string::npos){
619  title = "FracOfPerfectPix " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
620  }else if(sname.find("_NCalibErrors_")!=string::npos){
621  title = "Number of CalibErrors " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
622  }else if(sname.find("_NNegativeFits_")!=string::npos){
623  title = "Number of pixels with neg. fit result " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
624  }else if (sname.find("FREQ_")!=string::npos){
625  title = "NEvents with digis per module";
626  }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos){
627  title = "NDigis";
628  }else if (sname.find("ALLMODS_chargeCOMB_")!=string::npos){
629  title = "NClusters";
630  }else if (sname.find("_NErrors_")!=string::npos){
631  if(prefix=="SUMOFF" && isbarrel) title = "Total number of errors per Ladder";
632  else if(prefix=="SUMOFF" && !isbarrel) title = "Total number of errors per Blade";
633  else title = "Total number of errors per Module";
634  }else{
635  if(prefix=="SUMOFF") title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + (isbarrel?" per Ladder":" per Blade");
636  else title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + " per Module";
637  }
638  (*isum)->setAxisTitle(title,2);
639  }
640  break;
641  }
642  }
643  }
644  iBooker.goUp();
645  iGetter.setCurrentFolder(iBooker.pwd());
646  if(dir_name.find("Blade") == 0) {
647  iBooker.goUp(); // Going up a second time if we are processing the Blade
648  iGetter.setCurrentFolder(iBooker.pwd());
649  }
650  } // end for it (subdirs)
651  } else {
652  vector<string> subdirs = iGetter.getSubdirs();
653  // printing cout << "#\t" << iBooker.pwd() << endl;
654  if(isbarrel)
655  {
656 
657  for (vector<string>::const_iterator it = subdirs.begin();
658  it != subdirs.end(); it++) {
659  // cout << "##\t" << iBooker.pwd() << "\t" << (*it) << endl;
660  if((iBooker.pwd()).find("Endcap")!=string::npos ||
661  (iBooker.pwd()).find("AdditionalPixelErrors")!=string::npos) {
662  iBooker.goUp();
663  iGetter.setCurrentFolder(iBooker.pwd());
664  }
665  iBooker.cd(*it);
666  iGetter.cd(*it);
667  if((*it).find("Endcap")!=string::npos ||
668  (*it).find("AdditionalPixelErrors")!=string::npos) continue;
669  fillSummary(iBooker, iGetter, dir_name, me_names, true, isUpgrade); // Barrel
670  iBooker.goUp();
671  iGetter.setCurrentFolder(iBooker.pwd());
672  }
673  string grandbarrel_structure_name;
674  vector<string> grandbarrel_me_names;
675  if (!configParser_->getMENamesForGrandBarrelSummary(grandbarrel_structure_name, grandbarrel_me_names)){
676  cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Barrel Summary configuration parameters!! ";
677  return;
678  }
679  fillGrandBarrelSummaryHistos(iBooker, iGetter, grandbarrel_me_names, isUpgrade);
680 
681  }
682  else // Endcap
683  {
684 
685  for (vector<string>::const_iterator it = subdirs.begin();
686  it != subdirs.end(); it++) {
687  if((iBooker.pwd()).find("Barrel")!=string::npos ||
688  (iBooker.pwd()).find("AdditionalPixelErrors")!=string::npos){
689  iBooker.goUp();
690  iGetter.setCurrentFolder(iBooker.pwd());
691  }
692  iBooker.cd(*it);
693  iGetter.cd(*it);
694  if ((*it).find("Barrel")!=string::npos ||
695  (*it).find("AdditionalPixelErrors")!=string::npos) continue;
696  fillSummary(iBooker, iGetter, dir_name, me_names, false, isUpgrade); // Endcap
697  iBooker.goUp();
698  iGetter.setCurrentFolder(iBooker.pwd());
699  }
700  string grandendcap_structure_name;
701  vector<string> grandendcap_me_names;
702  if (!configParser_->getMENamesForGrandEndcapSummary(grandendcap_structure_name, grandendcap_me_names)){
703  cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Endcap Summary configuration parameters!! ";
704  return;
705  }
706  fillGrandEndcapSummaryHistos(iBooker, iGetter, grandendcap_me_names, isUpgrade);
707 
708 
709  }
710  }
711 // cout<<"...leaving SiPixelActionExecutor::fillSummary!"<<endl;
712 
713 }
714 
715 //=============================================================================================================
717  DQMStore::IGetter& iGetter,
718  string dir_name,
719  vector<string>& me_names) {
720  //printing cout<<"entering SiPixelActionExecutor::fillFEDErrorSummary..."<<endl;
721  string currDir = iBooker.pwd();
722  string prefix;
723  if(source_type_==0) prefix="SUMRAW";
724  else if(source_type_==20) prefix="SUMOFF";
725 
726  if (currDir.find(dir_name) != string::npos) {
727  vector<MonitorElement*> sum_mes;
728  for (vector<string>::const_iterator iv = me_names.begin();
729  iv != me_names.end(); iv++) {
730  bool isBooked = false;
731  vector<string> contents = iGetter.getMEs();
732  for (vector<string>::const_iterator im = contents.begin(); im != contents.end(); im++)
733  if ((*im).find(*iv) != string::npos) isBooked = true;
734  if(source_type_==5||source_type_==6){
735  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
736  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
737  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
738  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap"||
739  (*iv)=="FedChLErr"||(*iv)=="FedChNErr"||(*iv)=="FedETypeNErr")
740  prefix="SUMRAW";
741  }
742  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
743  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
744  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
745  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap"){
746  string tag = prefix + "_" + (*iv) + "_FEDErrors";
747  MonitorElement* temp = getFEDSummaryME(iBooker, iGetter, tag);
748  sum_mes.push_back(temp);
749  }else if((*iv)=="FedChLErr"||(*iv)=="FedChNErr"||(*iv)=="FedETypeNErr"){
750  string tag = prefix + "_" + (*iv);
752  if((*iv)=="FedChLErr") {if (!isBooked) temp = iBooker.book2D("FedChLErr","Type of last error",40,-0.5,39.5,37,0.,37.);
753  else{
754  string fullpathname = iBooker.pwd() + "/" + (*iv);
755  temp = iGetter.get(fullpathname);
756  temp->Reset();}} //If I don't reset this one, then I instead start adding error codes..
757  if((*iv)=="FedChNErr") {if (!isBooked) temp = iBooker.book2D("FedChNErr","Total number of errors",40,-0.5,39.5,37,0.,37.);
758  else{
759  string fullpathname = iBooker.pwd() + "/" + (*iv);
760  temp = iGetter.get(fullpathname);
761  temp->Reset();}} //If I don't reset this one, then I instead start adding error codes..
762  if((*iv)=="FedETypeNErr"){
763  if(!isBooked){
764  temp = iBooker.book2D("FedETypeNErr","Number of each error type",40,-0.5,39.5,21,0.,21.);
765  temp->setBinLabel(1,"ROC of 25",2);
766  temp->setBinLabel(2,"Gap word",2);
767  temp->setBinLabel(3,"Dummy word",2);
768  temp->setBinLabel(4,"FIFO full",2);
769  temp->setBinLabel(5,"Timeout",2);
770  temp->setBinLabel(6,"Stack full",2);
771  temp->setBinLabel(7,"Pre-cal issued",2);
772  temp->setBinLabel(8,"Trigger clear or sync",2);
773  temp->setBinLabel(9,"No token bit",2);
774  temp->setBinLabel(10,"Overflow",2);
775  temp->setBinLabel(11,"FSM error",2);
776  temp->setBinLabel(12,"Invalid #ROCs",2);
777  temp->setBinLabel(13,"Event number",2);
778  temp->setBinLabel(14,"Slink header",2);
779  temp->setBinLabel(15,"Slink trailer",2);
780  temp->setBinLabel(16,"Event size",2);
781  temp->setBinLabel(17,"Invalid channel#",2);
782  temp->setBinLabel(18,"ROC value",2);
783  temp->setBinLabel(19,"Dcol or pixel value",2);
784  temp->setBinLabel(20,"Readout order",2);
785  temp->setBinLabel(21,"CRC error",2);
786  }
787  else{
788  string fullpathname = iBooker.pwd() + "/" + (*iv);
789  temp = iGetter.get(fullpathname);
790  temp->Reset();} //If I don't reset this one, then I instead start adding error codes..
791  }
792  sum_mes.push_back(temp);
793  }
794  }
795  if (sum_mes.size() == 0) {
796  edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ;
797  return;
798  }
799  vector<string> subdirs = iGetter.getSubdirs();
800  int ndet = 0;
801  for (vector<string>::const_iterator it = subdirs.begin();
802  it != subdirs.end(); it++) {
803  if ( (*it).find("FED_") == string::npos) continue;
804  iBooker.cd(*it);
805  iGetter.cd(*it);
806  string fedid = (*it).substr((*it).find("_")+1);
807  std::istringstream isst;
808  isst.str(fedid);
809  isst>>ndet; ndet++;
810  vector<string> contents = iGetter.getMEs();
811 
812  for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin();
813  isum != sum_mes.end(); isum++) {
814  for (vector<string>::const_iterator im = contents.begin();
815  im != contents.end(); im++) {
816  if(((*im).find("FedChNErr")!=std::string::npos && (*isum)->getName().find("FedChNErr")!=std::string::npos) ||
817  ((*im).find("FedChLErr")!=std::string::npos && (*isum)->getName().find("FedChLErr")!=std::string::npos) ||
818  ((*im).find("FedETypeNErr")!=std::string::npos && (*isum)->getName().find("FedETypeNErr")!=std::string::npos)){
819  string fullpathname = iBooker.pwd() + "/" + (*im);
820  MonitorElement * me = iGetter.get(fullpathname);
821  if(me){
822  for(int i=0; i!=37; i++){
823  if((*im).find("FedETypeNErr")!=std::string::npos && i<21) (*isum)->Fill(ndet-1,i,me->getBinContent(i+1));
824  else (*isum)->Fill(ndet-1,i,me->getBinContent(i+1));
825  }
826  }
827  }
828  string sname = ((*isum)->getName());
829  string tname = " ";
830  tname = sname.substr(7,(sname.find("_",7)-6));
831  if (((*im)).find(tname) == 0) {
832  string fullpathname = iBooker.pwd() + "/" + (*im);
833  MonitorElement * me = iGetter.get(fullpathname);
834 
835  if (me){
836  if(me->getMean()>0.){
837  if (sname.find("_NErrors_")!=string::npos){
838  string path1 = fullpathname;
839  path1 = path1.replace(path1.find("NErrors"),7,"errorType");
840  MonitorElement * me1 = iGetter.get(path1);
841  bool notReset=true;
842  if(me1){
843  for(int jj=1; jj<16; jj++){
844  if(me1->getBinContent(jj)>0.){
845  if(jj==6){ //errorType=30 (reset)
846  string path2 = path1;
847  path2 = path2.replace(path2.find("errorType"),9,"TBMMessage");
848  MonitorElement * me2 = iGetter.get(path2);
849  if(me2) if(me2->getBinContent(6)>0. || me2->getBinContent(7)>0.) notReset=false;
850  }
851  }
852  }
853  }
854  if(notReset) (*isum)->setBinContent(ndet, (*isum)->getBinContent(ndet) + me1->getEntries());
855  }else (*isum)->setBinContent(ndet, (*isum)->getBinContent(ndet) + me->getEntries());
856  }
857  (*isum)->setAxisTitle("FED #",1);
858  string title = " ";
859  title = sname.substr(7,(sname.find("_",7)-7)) + " per FED";
860  (*isum)->setAxisTitle(title,2);
861  }
862  break;
863  }
864  }
865  }
866  iBooker.goUp();
867  iGetter.setCurrentFolder(iBooker.pwd());
868  }
869  } else {
870  vector<string> subdirs = iGetter.getSubdirs();
871  for (vector<string>::const_iterator it = subdirs.begin();
872  it != subdirs.end(); it++) {
873  if((*it).find("Endcap")!=string::npos ||
874  (*it).find("Barrel")!=string::npos) continue;
875  iBooker.cd(*it);
876  iGetter.cd(*it);
877  fillFEDErrorSummary(iBooker,iGetter, dir_name, me_names);
878  iBooker.goUp();
879  iGetter.setCurrentFolder(iBooker.pwd());
880  }
881  }
882  //printing cout<<"...leaving SiPixelActionExecutor::fillFEDErrorSummary!"<<endl;
883 }
884 
885 
886 //=============================================================================================================
888  DQMStore::IGetter & iGetter,
889  vector<string>& me_names,
890  bool isUpgrade) {
891 // cout<<"Entering SiPixelActionExecutor::fillGrandBarrelSummaryHistos...:"<<me_names.size()<<endl;
892  vector<MonitorElement*> gsum_mes;
893  string currDir = iBooker.pwd();
894  string path_name = iBooker.pwd();
895  string dir_name = path_name.substr(path_name.find_last_of("/")+1);
896  if ((dir_name.find("DQMData") == 0) ||
897  (dir_name.find("Pixel") == 0) ||
898  (dir_name.find("AdditionalPixelErrors") == 0) ||
899  (dir_name.find("Endcap") == 0) ||
900  (dir_name.find("HalfCylinder") == 0) ||
901  (dir_name.find("Disk") == 0) ||
902  (dir_name.find("Blade") == 0) ||
903  (dir_name.find("Panel") == 0) ) return;
904  vector<string> subdirs = iGetter.getSubdirs();
905  int nDirs = subdirs.size();
906  int iDir =0;
907  int nbin = 0;
908  int nbin_i = 0;
909  int nbin_subdir = 0;
910  int cnt=0;
911  bool first_subdir = true;
912  for (vector<string>::const_iterator it = subdirs.begin();
913  it != subdirs.end(); it++) {
914  cnt++;
915  iBooker.cd(*it);
916  iGetter.cd(*it);
917  vector<string> contents = iGetter.getMEs();
918 
919  iBooker.goUp();
920  iGetter.setCurrentFolder(iBooker.pwd());
921 
922  string prefix;
923  if(source_type_==0) prefix="SUMRAW";
924  else if (source_type_==1) prefix="SUMDIG";
925  else if (source_type_==2) prefix="SUMCLU";
926  else if (source_type_==3) prefix="SUMTRK";
927  else if (source_type_==4) prefix="SUMHIT";
928  else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
929  else if (source_type_==20) prefix="SUMOFF";
930 
931 
932  for (vector<string>::const_iterator im = contents.begin();
933  im != contents.end(); im++) {
934  for (vector<string>::const_iterator iv = me_names.begin();
935  iv != me_names.end(); iv++) {
936  string var = "_" + (*iv) + "_";
937  if ((*im).find(var) != string::npos) {
938  if((var=="_charge_" || var=="_nclusters_" || var=="_size_" || var=="_sizeX_" || var=="_sizeY_") &&
939  (*im).find("Track_")!=string::npos) continue;
940  string full_path = (*it) + "/" +(*im);
941  MonitorElement * me = iGetter.get(full_path.c_str());
942  if (!me) continue;
943  if(source_type_==5||source_type_==6){
944  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
945  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
946  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
947  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
948  prefix="SUMRAW";
949  else if((*iv)=="ndigis"||(*iv)=="adc" ||
950  (*iv)=="ndigisFREQ" || (*iv)=="adcCOMB")
951  prefix="SUMDIG";
952  else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
953  (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
954  (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
955  prefix="SUMCLU";
956  if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
957  else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
958  (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
959  prefix="SUMTRK";
960  else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
961  prefix="SUMHIT";
962  else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
963  (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
964  (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
965  (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
966  (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
967  (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
968  (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
969  (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
970  (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
971  (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
972  (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
973  (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
974  (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
975  (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
976  (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
977  (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix" ||
978  (*iv)=="SiPixelErrorsCalibDigis_NCalibErrors" )
979  prefix="SUMCAL";
980  } // end source_type if
981 
982  if (first_subdir && !isUpgrade){
983  nbin = me->getTH1F()->GetNbinsX();
984  string me_name = prefix + "_" + (*iv) + "_" + dir_name;
985  if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
986  else if(prefix=="SUMOFF" && dir_name=="Barrel") nbin=192;
987  else if((*iv)=="adcCOMB") nbin=256;
988  else if(dir_name=="Barrel") nbin=768;
989  else if(prefix=="SUMOFF" && dir_name.find("Shell")!=string::npos) nbin=48;
990  else if(dir_name.find("Shell")!=string::npos) nbin=192;
991  else nbin=nbin*nDirs;
992 
993  getGrandSummaryME(iBooker, iGetter, nbin, me_name, gsum_mes);
994  } else if (first_subdir && isUpgrade){
995  nbin = me->getTH1F()->GetNbinsX();
996  string me_name = prefix + "_" + (*iv) + "_" + dir_name;
997  if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
998  else if(prefix=="SUMOFF" && dir_name=="Barrel") nbin=296;
999  else if((*iv)=="adcCOMB") nbin=256;
1000  else if(dir_name=="Barrel") nbin=1184;
1001  else if(prefix=="SUMOFF" && dir_name.find("Shell")!=string::npos) nbin=74;
1002  else if(dir_name.find("Shell")!=string::npos) nbin=296;
1003  else nbin=nbin*nDirs;
1004 
1005  getGrandSummaryME(iBooker, iGetter, nbin, me_name, gsum_mes);
1006  }
1007 
1008  for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
1009  igm != gsum_mes.end(); igm++) {
1010  if ((*igm)->getName().find(var) != string::npos) {
1011  if(prefix=="SUMOFF") (*igm)->setAxisTitle("Ladders",1);
1012  else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
1013  else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Cluster charge [kilo electrons]",1);
1014  else (*igm)->setAxisTitle("Modules",1);
1015 
1016  // Setting title
1017 
1018  string title="";
1019  if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMOFF") title = "Total number of errors per Ladder";
1020  else if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMRAW") title = "Total number of errors per Module";
1021  else if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Ladder";
1022  else if((*igm)->getName().find("FREQ_") != string::npos && prefix!="SUMOFF") title = "NEvents with digis per Module";
1023  else if((*igm)->getName().find("FREQ_") != string::npos && prefix=="SUMOFF") title = "NEvents with digis per Ladder/Blade";
1024  else if((*igm)->getName().find("adcCOMB_") != string::npos) title = "NDigis";
1025  else if((*igm)->getName().find("chargeCOMB_") != string::npos) title = "NClusters";
1026  else title = "mean " + (*iv) + " per Module";
1027  (*igm)->setAxisTitle(title,2);
1028 
1029  // Setting binning
1030  if (!isUpgrade) {
1031  if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
1032  nbin_subdir=128;
1033  }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
1034  nbin_subdir=100;
1035  }else if((*igm)->getName().find("Ladder") != string::npos){
1036  nbin_i=0; nbin_subdir=4;
1037  }else if((*igm)->getName().find("Layer") != string::npos){
1038  nbin_i=(cnt-1)*4; nbin_subdir=4;
1039  }else if((*igm)->getName().find("Shell") != string::npos){
1040  if(prefix!="SUMOFF"){
1041  if(iDir==0){ nbin_i=0; nbin_subdir=40; }
1042  else if(iDir==1){ nbin_i=40; nbin_subdir=64; }
1043  else if(iDir==2){ nbin_i=104; nbin_subdir=88; }
1044  }else{
1045  if(iDir==0){ nbin_i=0; nbin_subdir=10; }
1046  else if(iDir==1){ nbin_i=10; nbin_subdir=16; }
1047  else if(iDir==2){ nbin_i=26; nbin_subdir=22; }
1048  }
1049  }else if((*igm)->getName().find("Barrel") != string::npos){
1050  if(prefix!="SUMOFF"){
1051  if(iDir==0){ nbin_i=0; nbin_subdir=192; }
1052  else if(iDir==1){ nbin_i=192; nbin_subdir=192; }
1053  else if(iDir==2){ nbin_i=384; nbin_subdir=192; }
1054  else if(iDir==3){ nbin_i=576; nbin_subdir=192; }
1055  }else{
1056  if(iDir==0){ nbin_i=0; nbin_subdir=48; }
1057  else if(iDir==1){ nbin_i=48; nbin_subdir=48; }
1058  else if(iDir==2){ nbin_i=96; nbin_subdir=48; }
1059  else if(iDir==3){ nbin_i=144; nbin_subdir=48; }
1060  }
1061  }
1062  } else if (isUpgrade) {
1063  if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
1064  nbin_subdir=128;
1065  }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
1066  nbin_subdir=100;
1067  }else if((*igm)->getName().find("Ladder") != string::npos){
1068  nbin_i=0; nbin_subdir=4;
1069  }else if((*igm)->getName().find("Layer") != string::npos){
1070  nbin_i=(cnt-1)*4; nbin_subdir=4;
1071  }else if((*igm)->getName().find("Shell") != string::npos){
1072  if(prefix!="SUMOFF"){
1073  if(iDir==0){ nbin_i=0; nbin_subdir=24; }//40(2*20)-->24(2*12)
1074  else if(iDir==1){ nbin_i=24; nbin_subdir=56; }//64(32*2)-->56(2*28)
1075  else if(iDir==2){ nbin_i=80; nbin_subdir=88; }//88(44*2)-->same88(44*2)
1076  else if(iDir==3){ nbin_i=168; nbin_subdir=128; }
1077  }else{
1078  if(iDir==0){ nbin_i=0; nbin_subdir=6; }//10-->6
1079  else if(iDir==1){ nbin_i=6; nbin_subdir=14; }//16-->14
1080  else if(iDir==2){ nbin_i=20; nbin_subdir=22; }//22-->same22
1081  else if(iDir==3){ nbin_i=42; nbin_subdir=32; }
1082  }
1083  }else if((*igm)->getName().find("Barrel") != string::npos){
1084  if(prefix!="SUMOFF"){
1085  if(iDir==0){ nbin_i=0; nbin_subdir=296; }//192=76 8/4-->296=1184/4
1086  else if(iDir==1){ nbin_i=296; nbin_subdir=296; }//296*2,*3,*4=1184
1087  else if(iDir==2){ nbin_i=592; nbin_subdir=296; }
1088  else if(iDir==3){ nbin_i=888; nbin_subdir=296; }
1089  else if(iDir==4){ nbin_i=1184; nbin_subdir=296; }
1090  }else{
1091  if(iDir==0){ nbin_i=0; nbin_subdir=74; }//48=192/4-->74=296/4
1092  else if(iDir==1){ nbin_i=74; nbin_subdir=74; }//74*2,...*4=296
1093  else if(iDir==2){ nbin_i=148; nbin_subdir=74; }
1094  else if(iDir==3){ nbin_i=222; nbin_subdir=74; }
1095  else if(iDir==4){ nbin_i=296; nbin_subdir=74; }
1096  }
1097  }
1098  }
1099 
1100  if((*igm)->getName().find("ndigisFREQ")==string::npos)
1101  {
1102  if(((*igm)->getName().find("adcCOMB")!=string::npos && me->getName().find("adcCOMB")!=string::npos)
1103  || ((*igm)->getName().find("chargeCOMB")!=string::npos && me->getName().find("chargeCOMB")!=string::npos))
1104  {
1105  (*igm)->getTH1F()->Add(me->getTH1F());
1106  }else if(((*igm)->getName().find("charge_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1107  me->getName().find("charge_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1108  ((*igm)->getName().find("nclusters_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1109  me->getName().find("nclusters_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1110  ((*igm)->getName().find("size_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1111  me->getName().find("size_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1112  ((*igm)->getName().find("charge_OffTrack_")!=string::npos && me->getName().find("charge_OffTrack_")!=string::npos) ||
1113  ((*igm)->getName().find("nclusters_OffTrack_")!=string::npos && me->getName().find("nclusters_OffTrack_")!=string::npos) ||
1114  ((*igm)->getName().find("size_OffTrack_")!=string::npos && me->getName().find("size_OffTrack_")!=string::npos) ||
1115  ((*igm)->getName().find("charge_OnTrack_")!=string::npos && me->getName().find("charge_OnTrack_")!=string::npos) ||
1116  ((*igm)->getName().find("nclusters_OnTrack_")!=string::npos && me->getName().find("nclusters_OnTrack_")!=string::npos) ||
1117  ((*igm)->getName().find("size_OnTrack_")!=string::npos && me->getName().find("size_OnTrack_")!=string::npos) ||
1118  ((*igm)->getName().find("charge_")==string::npos && (*igm)->getName().find("nclusters_")==string::npos &&
1119  (*igm)->getName().find("size_")==string::npos)){
1120  for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
1121  }
1122  }
1123  else if(me->getName().find("ndigisFREQ")!=string::npos)
1124  {
1125  for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
1126  }
1127  } // end var in igm (gsum_mes)
1128  } // end igm loop
1129  } // end var in im (contents)
1130  } // end of iv loop
1131  } // end of im loop
1132  iDir++;
1133  first_subdir = false; // We are done processing the first directory, we don't add any new MEs in the future passes.
1134  } // end of it loop (subdirs)
1135 // cout<<"...leaving SiPixelActionExecutor::fillGrandBarrelSummaryHistos!"<<endl;
1136 }
1137 
1138 //=============================================================================================================
1140  DQMStore::IGetter& iGetter,
1141  vector<string>& me_names,
1142  bool isUpgrade) {
1143  //printing cout<<"Entering SiPixelActionExecutor::fillGrandEndcapSummaryHistos..."<<endl;
1144  vector<MonitorElement*> gsum_mes;
1145  string currDir = iBooker.pwd();
1146  string path_name = iBooker.pwd();
1147  string dir_name = path_name.substr(path_name.find_last_of("/")+1);
1148  if ((dir_name.find("DQMData") == 0) ||
1149  (dir_name.find("Pixel") == 0) ||
1150  (dir_name.find("AdditionalPixelErrors") == 0) ||
1151  (dir_name.find("Barrel") == 0) ||
1152  (dir_name.find("Shell") == 0) ||
1153  (dir_name.find("Layer") == 0) ||
1154  (dir_name.find("Ladder") == 0) ) return;
1155  vector<string> subdirs = iGetter.getSubdirs();
1156  int iDir =0;
1157  int nbin = 0;
1158  int nbin_i = 0;
1159  int nbin_subdir = 0;
1160  int cnt=0;
1161  bool first_subdir = true;
1162  for (vector<string>::const_iterator it = subdirs.begin();
1163  it != subdirs.end(); it++) {
1164  cnt++;
1165  iBooker.cd(*it);
1166  iGetter.cd(*it);
1167  vector<string> contents = iGetter.getMEs();
1168  iBooker.goUp();
1169  iGetter.setCurrentFolder(iBooker.pwd());
1170 
1171  string prefix;
1172  if(source_type_==0) prefix="SUMRAW";
1173  else if (source_type_==1) prefix="SUMDIG";
1174  else if (source_type_==2) prefix="SUMCLU";
1175  else if (source_type_==3) prefix="SUMTRK";
1176  else if (source_type_==4) prefix="SUMHIT";
1177  else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
1178  else if (source_type_==20) prefix="SUMOFF";
1179 
1180  for (vector<string>::const_iterator im = contents.begin();
1181  im != contents.end(); im++) {
1182  for (vector<string>::const_iterator iv = me_names.begin();
1183  iv != me_names.end(); iv++) {
1184  string var = "_" + (*iv) + "_";
1185  if ((*im).find(var) != string::npos) {
1186  if((var=="_charge_" || var=="_nclusters_" || var=="_size_" || var=="_sizeX_" || var=="_sizeY_") &&
1187  (*im).find("Track_")!=string::npos) continue;
1188  string full_path = (*it) + "/" +(*im);
1189  MonitorElement * me = iGetter.get(full_path.c_str());
1190  if (!me) continue;
1191  if(source_type_==5||source_type_==6){
1192  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
1193  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
1194  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
1195  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
1196  prefix="SUMRAW";
1197  else if((*iv)=="ndigis"||(*iv)=="adc" ||
1198  (*iv)=="ndigisFREQ"||(*iv)=="adcCOMB")
1199  prefix="SUMDIG";
1200  else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
1201  (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
1202  (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
1203  prefix="SUMCLU";
1204  if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
1205  else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
1206  (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
1207  prefix="SUMTRK";
1208  else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
1209  prefix="SUMHIT";
1210  else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
1211  (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
1212  (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
1213  (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
1214  (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
1215  (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
1216  (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
1217  (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
1218  (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
1219  (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
1220  (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
1221  (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
1222  (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
1223  (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
1224  (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
1225  (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix"||
1226  (*iv) == "SiPixelErrorsCalibDigis_NCalibErrors")
1227  prefix="SUMCAL";
1228  }
1229 
1230  if (first_subdir && !isUpgrade){
1231  nbin = me->getTH1F()->GetNbinsX();
1232  string me_name = prefix + "_" + (*iv) + "_" + dir_name;
1233  if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
1234  else if(prefix=="SUMOFF" && dir_name=="Endcap") nbin=96;
1235  else if(dir_name=="Endcap") nbin=672;
1236  else if(prefix=="SUMOFF" && dir_name.find("HalfCylinder")!=string::npos) nbin=24;
1237  else if(dir_name.find("HalfCylinder")!=string::npos) nbin=168;
1238  else if(prefix=="SUMOFF" && dir_name.find("Disk")!=string::npos) nbin=12;
1239  else if(dir_name.find("Disk")!=string::npos) nbin=84;
1240  else if(dir_name.find("Blade")!=string::npos) nbin=7;
1241  getGrandSummaryME(iBooker, iGetter, nbin, me_name, gsum_mes);
1242  } else if(first_subdir && isUpgrade){
1243  nbin = me->getTH1F()->GetNbinsX();
1244  string me_name = prefix + "_" + (*iv) + "_" + dir_name;
1245  if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
1246  else if(prefix=="SUMOFF" && dir_name=="Endcap") nbin=336;
1247  else if(dir_name=="Endcap") nbin=672;
1248  else if(prefix=="SUMOFF" && dir_name.find("HalfCylinder")!=string::npos) nbin=84;
1249  else if(dir_name.find("HalfCylinder")!=string::npos) nbin=168;
1250  else if(prefix=="SUMOFF" && dir_name.find("Disk")!=string::npos) nbin=28;
1251  else if(dir_name.find("Disk")!=string::npos) nbin=56;
1252  else if(dir_name.find("Blade")!=string::npos) nbin=2;
1253  getGrandSummaryME(iBooker, iGetter, nbin, me_name, gsum_mes);
1254  }
1255 
1256  for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
1257  igm != gsum_mes.end(); igm++) {
1258  if ((*igm)->getName().find(var) != string::npos) {
1259  if(prefix=="SUMOFF") (*igm)->setAxisTitle("Blades",1);
1260  else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
1261  else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Cluster charge [kilo electrons]",1);
1262  else (*igm)->setAxisTitle("Modules",1);
1263  string title="";
1264  if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMOFF") title = "Total number of errors per Blade";
1265  else if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMRAW") title = "Total number of errors per Module";
1266  else if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Blade";
1267  else if((*igm)->getName().find("FREQ_") != string::npos) title = "NEvents with digis per Module";
1268  else if((*igm)->getName().find("adcCOMB_")!=string::npos) title = "NDigis";
1269  else if((*igm)->getName().find("chargeCOMB_")!=string::npos) title = "NClusters";
1270  else title = "mean " + (*iv) + " per Module";
1271  (*igm)->setAxisTitle(title,2);
1272  nbin_i=0;
1273  if (!isUpgrade) {
1274  if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
1275  nbin_subdir=128;
1276  }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
1277  nbin_subdir=100;
1278  }else if((*igm)->getName().find("Panel_") != string::npos){
1279  nbin_subdir=7;
1280  }else if((*igm)->getName().find("Blade") != string::npos){
1281  if((*im).find("_1") != string::npos) nbin_subdir=4;
1282  if((*im).find("_2") != string::npos) {nbin_i=4; nbin_subdir=3;}
1283  }else if((*igm)->getName().find("Disk") != string::npos){
1284  nbin_i=((cnt-1)%12)*7; nbin_subdir=7;
1285  }else if((*igm)->getName().find("HalfCylinder") != string::npos){
1286  if(prefix!="SUMOFF"){
1287  nbin_subdir=84;
1288  if((*im).find("_2") != string::npos) nbin_i=84;
1289  }else{
1290  nbin_subdir=12;
1291  if((*im).find("_2") != string::npos) nbin_i=12;
1292  }
1293  }else if((*igm)->getName().find("Endcap") != string::npos){
1294  if(prefix!="SUMOFF"){
1295  nbin_subdir=168;
1296  if((*im).find("_mO") != string::npos) nbin_i=168;
1297  if((*im).find("_pI") != string::npos) nbin_i=336;
1298  if((*im).find("_pO") != string::npos) nbin_i=504;
1299  }else{
1300  nbin_subdir=24;
1301  if((*im).find("_mO") != string::npos) nbin_i=24;
1302  if((*im).find("_pI") != string::npos) nbin_i=48;
1303  if((*im).find("_pO") != string::npos) nbin_i=72;
1304  }
1305  }
1306  } else if (isUpgrade) {
1307  if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
1308  nbin_subdir=128;
1309  }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
1310  nbin_subdir=100;
1311  }else if((*igm)->getName().find("Panel_") != string::npos){
1312  nbin_subdir=2;
1313  }else if((*igm)->getName().find("Blade") != string::npos){
1314  if((*im).find("_1") != string::npos) nbin_subdir=1;
1315  if((*im).find("_2") != string::npos) {nbin_i=1; nbin_subdir=1;}
1316  }else if((*igm)->getName().find("Disk") != string::npos){
1317  nbin_i=((cnt-1)%28)*2; nbin_subdir=2;
1318  }else if((*igm)->getName().find("HalfCylinder") != string::npos){
1319  if(prefix!="SUMOFF"){
1320  nbin_subdir=56;
1321  if((*im).find("_2") != string::npos) nbin_i=56;
1322  if((*im).find("_3") != string::npos) nbin_i=112;
1323  }else{
1324  nbin_subdir=28;
1325  if((*im).find("_2") != string::npos) nbin_i=28;
1326  if((*im).find("_3") != string::npos) nbin_i=56;
1327  }
1328  }else if((*igm)->getName().find("Endcap") != string::npos){
1329  if(prefix!="SUMOFF"){
1330  nbin_subdir=168;
1331  if((*im).find("_mO") != string::npos) nbin_i=168;
1332  if((*im).find("_pI") != string::npos) nbin_i=336;
1333  if((*im).find("_pO") != string::npos) nbin_i=504;
1334  }else{
1335  nbin_subdir=84;
1336  if((*im).find("_mO") != string::npos) nbin_i=84;
1337  if((*im).find("_pI") != string::npos) nbin_i=168;
1338  if((*im).find("_pO") != string::npos) nbin_i=252;
1339  }
1340  }
1341  }
1342 
1343  if((*igm)->getName().find("ndigisFREQ")==string::npos){
1344  if(((*igm)->getName().find("adcCOMB")!=string::npos && me->getName().find("adcCOMB")!=string::npos) || ((*igm)->getName().find("chargeCOMB")!=string::npos && me->getName().find("chargeCOMB")!=string::npos)){
1345  (*igm)->getTH1F()->Add(me->getTH1F());
1346  }else if(((*igm)->getName().find("charge_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1347  me->getName().find("charge_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1348  ((*igm)->getName().find("nclusters_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1349  me->getName().find("nclusters_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1350  ((*igm)->getName().find("size_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1351  me->getName().find("size_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1352  ((*igm)->getName().find("charge_OffTrack_")!=string::npos && me->getName().find("charge_OffTrack_")!=string::npos) ||
1353  ((*igm)->getName().find("nclusters_OffTrack_")!=string::npos && me->getName().find("nclusters_OffTrack_")!=string::npos) ||
1354  ((*igm)->getName().find("size_OffTrack_")!=string::npos && me->getName().find("size_OffTrack_")!=string::npos) ||
1355  ((*igm)->getName().find("charge_OnTrack_")!=string::npos && me->getName().find("charge_OnTrack_")!=string::npos) ||
1356  ((*igm)->getName().find("nclusters_OnTrack_")!=string::npos && me->getName().find("nclusters_OnTrack_")!=string::npos) ||
1357  ((*igm)->getName().find("size_OnTrack_")!=string::npos && me->getName().find("size_OnTrack_")!=string::npos) ||
1358  ((*igm)->getName().find("charge_")==string::npos && (*igm)->getName().find("nclusters_")==string::npos &&
1359  (*igm)->getName().find("size_")==string::npos)){
1360  for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
1361  }
1362  }else if(me->getName().find("ndigisFREQ")!=string::npos){
1363  for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
1364  }
1365  // }// for
1366 
1367  }
1368  }
1369  }
1370  }
1371  }
1372 
1373  iDir++;
1374  first_subdir = false; // We are done processing the first directory, we don't add any new MEs in the future passes.
1375  } // end for it (subdirs)
1376 }
1377 //=============================================================================================================
1378 //
1379 // -- Get Summary ME
1380 //
1382  DQMStore::IGetter & iGetter,
1383  int nbin,
1384  string& me_name,
1385  vector<MonitorElement*> & mes) {
1386  //printing cout<<"Entering SiPixelActionExecutor::getGrandSummaryME for: "<<me_name<<endl;
1387  if((iBooker.pwd()).find("Pixel")==string::npos) return; // If one doesn't find pixel
1388  vector<string> contents = iGetter.getMEs();
1389 
1390  for (vector<string>::const_iterator it = contents.begin();
1391  it != contents.end(); it++) {
1392  //printing cout<<"in grand summary me: "<<me_name<<","<<(*it)<<endl;
1393  if ((*it).find(me_name) == 0) {
1394  string fullpathname = iBooker.pwd() + "/" + me_name;
1395  MonitorElement* me = iGetter.get(fullpathname);
1396 
1397  if (me) {
1398  me->Reset();
1399  mes.push_back(me);
1400  return;
1401  }
1402  }
1403  }
1404 
1405  MonitorElement* temp_me(0);
1406  if(me_name.find("ALLMODS_adcCOMB_")!=string::npos) temp_me = iBooker.book1D(me_name.c_str(),me_name.c_str(),128,0,256);
1407  else if(me_name.find("ALLMODS_chargeCOMB_")!=string::npos) temp_me = iBooker.book1D(me_name.c_str(),me_name.c_str(),100,0,200);
1408  else temp_me = iBooker.book1D(me_name.c_str(),me_name.c_str(),nbin,1.,nbin+1.);
1409  if (temp_me) mes.push_back(temp_me);
1410 
1411  // if(temp_me) cout<<"finally found grand ME: "<<me_name<<endl;
1412 }
1413 
1414 
1415 //=============================================================================================================
1416 //
1417 // -- Get Summary ME
1418 //
1420  DQMStore::IGetter & iGetter,
1421  string me_name,
1422  bool isUpgrade) {
1423  //printing cout<<"Entering SiPixelActionExecutor::getSummaryME for: "<<me_name<<endl;
1424  MonitorElement* me = 0;
1425  if((iBooker.pwd()).find("Pixel")==string::npos) return me;
1426  vector<string> contents = iGetter.getMEs();
1427 
1428  for (vector<string>::const_iterator it = contents.begin();
1429  it != contents.end(); it++) {
1430  if ((*it).find(me_name) == 0) {
1431  string fullpathname = iBooker.pwd() + "/" + (*it);
1432  me = iGetter.get(fullpathname);
1433 
1434  if (me) {
1435  me->Reset();
1436  return me;
1437  }
1438  }
1439  }
1440  contents.clear();
1441  if (!isUpgrade) {
1442  if(me_name.find("SUMOFF")==string::npos){
1443  if(me_name.find("Blade_")!=string::npos)me = iBooker.book1D(me_name.c_str(), me_name.c_str(),7,1.,8.);
1444  else me = iBooker.book1D(me_name.c_str(), me_name.c_str(),4,1.,5.);
1445  }else if(me_name.find("Layer_1")!=string::npos){ me = iBooker.book1D(me_name.c_str(), me_name.c_str(),10,1.,11.);
1446  }else if(me_name.find("Layer_2")!=string::npos){ me = iBooker.book1D(me_name.c_str(), me_name.c_str(),16,1.,17.);
1447  }else if(me_name.find("Layer_3")!=string::npos){ me = iBooker.book1D(me_name.c_str(), me_name.c_str(),22,1.,23.);
1448  }else if(me_name.find("Disk_")!=string::npos){ me = iBooker.book1D(me_name.c_str(), me_name.c_str(),12,1.,13.);
1449  }
1450  }//endifNOTUpgrade
1451  else if (isUpgrade) {
1452  if(me_name.find("SUMOFF")==string::npos){
1453  if(me_name.find("Blade_")!=string::npos)me = iBooker.book1D(me_name.c_str(), me_name.c_str(),2,1.,3.);
1454  else me = iBooker.book1D(me_name.c_str(), me_name.c_str(),1,1.,2.);
1455  }else if(me_name.find("Layer_1")!=string::npos){ me = iBooker.book1D(me_name.c_str(), me_name.c_str(),6,1.,7.);
1456  }else if(me_name.find("Layer_2")!=string::npos){ me = iBooker.book1D(me_name.c_str(), me_name.c_str(),14,1.,15.);
1457  }else if(me_name.find("Layer_3")!=string::npos){ me = iBooker.book1D(me_name.c_str(), me_name.c_str(),22,1.,23.);
1458  }else if(me_name.find("Layer_4")!=string::npos){ me = iBooker.book1D(me_name.c_str(), me_name.c_str(),32,1.,33.);
1459  }else if(me_name.find("Disk_")!=string::npos){ me = iBooker.book1D(me_name.c_str(), me_name.c_str(),28,1.,29.);
1460  }
1461  }//endifUpgrade
1462 
1463  return me;
1464 }
1465 
1466 
1467 //=============================================================================================================
1469  DQMStore::IGetter & iGetter,
1470  string me_name) {
1471  //printing cout<<"Entering SiPixelActionExecutor::getFEDSummaryME..."<<endl;
1472  MonitorElement* me = 0;
1473  if((iBooker.pwd()).find("Pixel")==string::npos) return me;
1474  vector<string> contents = iGetter.getMEs();
1475 
1476  for (vector<string>::const_iterator it = contents.begin();
1477  it != contents.end(); it++) {
1478  if ((*it).find(me_name) == 0) {
1479  string fullpathname = iBooker.pwd() + "/" + (*it);
1480 
1481  me = iGetter.get(fullpathname);
1482 
1483  if (me) {
1484  me->Reset();
1485  return me;
1486  }
1487  }
1488  }
1489  contents.clear();
1490  me = iBooker.book1D(me_name.c_str(), me_name.c_str(),40,-0.5,39.5);
1491 
1492  return me;
1493 }
1494 
1495 //=============================================================================================================
1496 void SiPixelActionExecutor::bookOccupancyPlots(DQMStore::IBooker & iBooker, DQMStore::IGetter & iGetter, bool hiRes, bool isbarrel) // Polymorphism
1497 {
1498  if(Tier0Flag_) return;
1499  vector<string> subdirs = iGetter.getSubdirs();
1500  for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++)
1501  {
1502  if(isbarrel && (*it).find("Barrel")==string::npos) continue;
1503  if(!isbarrel && (*it).find("Endcap")==string::npos) continue;
1504 
1505  if((*it).find("Module_")!=string::npos) continue;
1506  if((*it).find("Panel_")!=string::npos) continue;
1507  if((*it).find("Ladder_")!=string::npos) continue;
1508  if((*it).find("Blade_")!=string::npos) continue;
1509  if((*it).find("Layer_")!=string::npos) continue;
1510  if((*it).find("Disk_")!=string::npos) continue;
1511  iBooker.cd(*it);
1512  iGetter.cd(*it);
1513  bookOccupancyPlots(iBooker, iGetter, hiRes, isbarrel);
1514  if(!hiRes){
1515  //occupancyprinting cout<<"booking low res barrel occ plot now!"<<endl;
1516  OccupancyMap = iBooker.book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (4 pix per bin)",isbarrel?208:130,0.,isbarrel?416.:260.,80,0.,160.);
1517  }else{
1518  //occupancyprinting cout<<"booking high res barrel occ plot now!"<<endl;
1519  OccupancyMap = iBooker.book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (1 pix per bin)",isbarrel?416:260,0.,isbarrel?416.:260.,160,0.,160.);
1520  }
1521  OccupancyMap->setAxisTitle("Columns",1);
1522  OccupancyMap->setAxisTitle("Rows",2);
1523 
1524  iBooker.goUp();
1525  iGetter.setCurrentFolder(iBooker.pwd());
1526 
1527  }
1528 
1529 
1530 
1531 }
1532 //=============================================================================================================
1534 
1535  if(Tier0Flag_) return;
1536  // Barrel
1537  iGetter.cd();
1538  iBooker.cd();
1539  iGetter.setCurrentFolder("Pixel");
1540  iBooker.setCurrentFolder("Pixel");
1541  this->bookOccupancyPlots(iBooker, iGetter, hiRes, true);
1542 
1543  // Endcap
1544  iGetter.cd();
1545  iBooker.cd();
1546  iGetter.setCurrentFolder("Pixel");
1547  iBooker.setCurrentFolder("Pixel");
1548  this->bookOccupancyPlots(iBooker, iGetter, hiRes, false);
1549 
1550 }
1551 
1553  //std::cout<<"entering SiPixelActionExecutor::createOccupancy..."<<std::endl;
1554  if(Tier0Flag_) return;
1555  iBooker.cd();
1556  iGetter.cd();
1557  fillOccupancy(iBooker,iGetter, true);
1558  iBooker.cd();
1559  iGetter.cd();
1560  fillOccupancy(iBooker,iGetter, false);
1561  iBooker.cd();
1562  iGetter.cd();
1563  //std::cout<<"leaving SiPixelActionExecutor::createOccupancy..."<<std::endl;
1564 }
1565 
1566 //=============================================================================================================
1567 
1569 {
1570  //occupancyprinting cout<<"entering SiPixelActionExecutor::fillOccupancy..."<<std::endl;
1571  if(Tier0Flag_) return;
1572  string currDir = iBooker.pwd();
1573  string dname = currDir.substr(currDir.find_last_of("/")+1);
1574 
1575  if(dname.find("Layer_")!=string::npos || dname.find("Disk_")!=string::npos){
1576  vector<string> meVec = iGetter.getMEs();
1577  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
1578  string full_path = currDir + "/" + (*it);
1579  if(full_path.find("hitmap_siPixelDigis")!=string::npos){ // If we have the hitmap ME
1580  MonitorElement * me = iGetter.get(full_path);
1581  if (!me) continue;
1582  string path = full_path;
1583  while (path.find_last_of("/") != 5) // Stop before Pixel/
1584  {
1585  path = path.substr(0,path.find_last_of("/"));
1586  // cout << "\t" << path << endl;
1587  OccupancyMap = iGetter.get(path + "/" + (isbarrel?"barrel":"endcap") + "OccupancyMap");
1588 
1589  if(OccupancyMap){
1590  for(int i=1; i!=me->getNbinsX()+1; i++) for(int j=1; j!=me->getNbinsY()+1; j++){
1591  float previous = OccupancyMap->getBinContent(i,j);
1592  OccupancyMap->setBinContent(i,j,previous + me->getBinContent(i,j));
1593  }
1594  OccupancyMap->getTH2F()->SetEntries(OccupancyMap->getTH2F()->Integral());
1595  }
1596 
1597  }
1598  }
1599 
1600  }
1601  } else {
1602  vector<string> subdirs = iGetter.getSubdirs();
1603  for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
1604  iGetter.cd(*it);
1605  iBooker.cd(*it);
1606  if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
1607  fillOccupancy(iBooker,iGetter, isbarrel);
1608  iBooker.goUp();
1609  iGetter.setCurrentFolder(iBooker.pwd());
1610  }
1611  }
1612 
1613  //occupancyprinting cout<<"leaving SiPixelActionExecutor::fillOccupancy..."<<std::endl;
1614 
1615 }
1616 
1617 //=============================================================================================================
1618 
1620  // Barrel
1621  iBooker.cd();
1622  iBooker.setCurrentFolder("Pixel/Barrel");
1623  if (!isUpgrade) {
1624  if(Tier0Flag_){
1625  HitEfficiency_L1 = iBooker.book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;Module;Ladder",8,-4,4,20,-10.,10.);
1626  HitEfficiency_L2 = iBooker.book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;Module;Ladder",8,-4,4,32,-16.,16.);
1627  HitEfficiency_L3 = iBooker.book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;Module;Ladder",8,-4,4,44,-22.,22.);
1628  }else{
1629  HitEfficiency_L1 = iBooker.book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;Module;Ladder",8,-4.,4.,20,-10.,10.);
1630  HitEfficiency_L2 = iBooker.book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;Module;Ladder",8,-4.,4.,32,-16.,16.);
1631  HitEfficiency_L3 = iBooker.book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;Module;Ladder",8,-4.,4.,44,-22.,22.);
1632  }
1633  }//endifNOTUpgrade
1634  else if (isUpgrade) {
1635  if(Tier0Flag_){
1636  HitEfficiency_L1 = iBooker.book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;z-side;Ladder",2,-1.,1.,12,-6.,6.);
1637  HitEfficiency_L2 = iBooker.book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;z-side;Ladder",2,-1.,1.,28,-14.,14.);
1638  HitEfficiency_L3 = iBooker.book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;z-side;Ladder",2,-1.,1.,44,-22.,22.);
1639  HitEfficiency_L4 = iBooker.book2D("HitEfficiency_L4","Hit Efficiency in Barrel_Layer4;z-side;Ladder",2,-1.,1.,64,-32.,32.);
1640  }else{
1641  HitEfficiency_L1 = iBooker.book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;Module;Ladder",8,-4.,4.,12,-6.,6.);
1642  HitEfficiency_L2 = iBooker.book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;Module;Ladder",8,-4.,4.,28,-14.,14.);
1643  HitEfficiency_L3 = iBooker.book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;Module;Ladder",8,-4.,4.,44,-22.,22.);
1644  HitEfficiency_L4 = iBooker.book2D("HitEfficiency_L4","Hit Efficiency in Barrel_Layer4;Module;Ladder",8,-4.,4.,64,-32.,32.);
1645  }
1646  }//endifUpgrade
1647  // Endcap
1648  iBooker.cd();
1649  iBooker.setCurrentFolder("Pixel/Endcap");
1650  if (!isUpgrade) {
1651  if(Tier0Flag_){
1652  HitEfficiency_Dp1 = iBooker.book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;",24,-12.,12.,1,0.,1.);
1653  HitEfficiency_Dp2 = iBooker.book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;",24,-12.,12.,1,0.,1.);
1654  HitEfficiency_Dm1 = iBooker.book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;",24,-12.,12.,1,0.,1.);
1655  HitEfficiency_Dm2 = iBooker.book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;",24,-12.,12.,1,0.,1.);
1656  }else{
1657  HitEfficiency_Dp1 = iBooker.book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;Modules",24,-12.,12.,7,1.,8.);
1658  HitEfficiency_Dp2 = iBooker.book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;Modules",24,-12.,12.,7,1.,8.);
1659  HitEfficiency_Dm1 = iBooker.book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;Modules",24,-12.,12.,7,1.,8.);
1660  HitEfficiency_Dm2 = iBooker.book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;Modules",24,-12.,12.,7,1.,8.);
1661  }
1662  } else if (isUpgrade) {
1663  if(Tier0Flag_){
1664  HitEfficiency_Dp1 = iBooker.book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;",28,-17.,11.,1,0.,1.);
1665  HitEfficiency_Dp2 = iBooker.book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;",28,-17.,11.,1,0.,1.);
1666  HitEfficiency_Dp3 = iBooker.book2D("HitEfficiency_Dp3","Hit Efficiency in Endcap_Disk_p3;Blades;",28,-17.,11.,1,0.,1.);
1667  HitEfficiency_Dm1 = iBooker.book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;",28,-17.,11.,1,0.,1.);
1668  HitEfficiency_Dm2 = iBooker.book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;",28,-17.,11.,1,0.,1.);
1669  HitEfficiency_Dm3 = iBooker.book2D("HitEfficiency_Dm3","Hit Efficiency in Endcap_Disk_m3;Blades;",28,-17.,11.,1,0.,1.);
1670  }else{
1671  HitEfficiency_Dp1 = iBooker.book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;Modules",28,-17.,11.,2,1.,3.);
1672  HitEfficiency_Dp2 = iBooker.book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;Modules",28,-17.,11.,2,1.,3.);
1673  HitEfficiency_Dp3 = iBooker.book2D("HitEfficiency_Dp3","Hit Efficiency in Endcap_Disk_p3;Blades;Modules",28,-17.,11.,2,1.,3.);
1674  HitEfficiency_Dm1 = iBooker.book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;Modules",28,-17.,11.,2,1.,3.);
1675  HitEfficiency_Dm2 = iBooker.book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;Modules",28,-17.,11.,2,1.,3.);
1676  HitEfficiency_Dm3 = iBooker.book2D("HitEfficiency_Dm3","Hit Efficiency in Endcap_Disk_m3;Blades;Modules",28,-17.,11.,2,1.,3.);
1677  }
1678  }//endif(isUpgrade)
1679 }
1680 
1681 //=============================================================================================================
1682 
1684  //std::cout<<"entering SiPixelActionExecutor::createEfficiency..."<<std::endl;
1685  iGetter.cd();
1686  iBooker.cd();
1687  fillEfficiency(iBooker, iGetter, true, isUpgrade); // Barrel
1688  iGetter.cd();
1689  iBooker.cd();
1690  fillEfficiency(iBooker, iGetter, false, isUpgrade); // Endcap
1691  iGetter.cd();
1692  iBooker.cd();
1693  //std::cout<<"leaving SiPixelActionExecutor::createEfficiency..."<<std::endl;
1694 }
1695 
1696 //=============================================================================================================
1697 
1698 void SiPixelActionExecutor::fillEfficiency(DQMStore::IBooker & iBooker, DQMStore::IGetter & iGetter, bool isbarrel, bool isUpgrade){
1699  //cout<<"entering SiPixelActionExecutor::fillEfficiency..."<<std::endl;
1700  string currDir = iBooker.pwd();
1701  string dname = currDir.substr(currDir.find_last_of("/")+1);
1702  //cout<<"currDir= "<<currDir<< " , dname= "<<dname<<std::endl;
1703 
1704  if(Tier0Flag_){ // Offline
1705  if(isbarrel && dname.find("Ladder_")!=string::npos){
1706  if (!isUpgrade) {
1707  vector<string> meVec = iGetter.getMEs();
1708  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
1709  string full_path = currDir + "/" + (*it);
1710 
1711  if(full_path.find("missingMod_")!=string::npos){ // If we have missing hits ME
1712 
1713  //Get the MEs that contain missing and valid hits
1714  MonitorElement * missing = iGetter.get(full_path);
1715  if (!missing) continue;
1716  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
1717  MonitorElement * valid = iGetter.get(new_path);
1718  if (!valid) continue;
1719  //int binx = 0;
1720  int biny = 0;
1721  //get the ladder number
1722 
1723  if(dname.find("01")!=string::npos){ biny = 1;}else if(dname.find("02")!=string::npos){ biny = 2;}
1724  else if(dname.find("03")!=string::npos){ biny = 3;}else if(dname.find("04")!=string::npos){ biny = 4;}
1725  else if(dname.find("05")!=string::npos){ biny = 5;}else if(dname.find("06")!=string::npos){ biny = 6;}
1726  else if(dname.find("07")!=string::npos){ biny = 7;}else if(dname.find("08")!=string::npos){ biny = 8;}
1727  else if(dname.find("09")!=string::npos){ biny = 9;}else if(dname.find("10")!=string::npos){ biny = 10;}
1728  else if(dname.find("11")!=string::npos){ biny = 11;}else if(dname.find("12")!=string::npos){ biny = 12;}
1729  else if(dname.find("13")!=string::npos){ biny = 13;}else if(dname.find("14")!=string::npos){ biny = 14;}
1730  else if(dname.find("15")!=string::npos){ biny = 15;}else if(dname.find("16")!=string::npos){ biny = 16;}
1731  else if(dname.find("17")!=string::npos){ biny = 17;}else if(dname.find("18")!=string::npos){ biny = 18;}
1732  else if(dname.find("19")!=string::npos){ biny = 19;}else if(dname.find("20")!=string::npos){ biny = 20;}
1733  else if(dname.find("21")!=string::npos){ biny = 21;}else if(dname.find("22")!=string::npos){ biny = 22;}
1734 
1735  if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
1736  if(currDir.find("Layer_1")!=string::npos){ biny = biny + 10;}
1737  else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 16;}
1738 
1739  else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
1740 
1741  }
1742 
1743 
1744 
1745  int start=1;
1746  //define start depending on p or m
1747 
1748  if(currDir.find("Shell_m")!=string::npos){ start = 1;}else{ start = 5;}
1749  for(int i=start; i<start+5;i++){
1750  float hitEfficiency = -1.0;
1751  float missingHits=0;
1752  float validHits=0;
1753  missingHits=missing->getBinContent(i);
1754  validHits=valid->getBinContent(i);
1755  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
1756  if(currDir.find("Layer_1")!=string::npos){
1757  HitEfficiency_L1 = iGetter.get("Pixel/Barrel/HitEfficiency_L1");
1758  if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(i, biny,(float)hitEfficiency);
1759  }
1760  else if(currDir.find("Layer_2")!=string::npos){
1761  HitEfficiency_L2 = iGetter.get("Pixel/Barrel/HitEfficiency_L2");
1762  if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(i, biny,(float)hitEfficiency);
1763  }
1764  else if(currDir.find("Layer_3")!=string::npos){
1765  HitEfficiency_L3 = iGetter.get("Pixel/Barrel/HitEfficiency_L3");
1766  if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(i, biny,(float)hitEfficiency);
1767  }
1768 
1769  }
1770 
1771  }
1772  }
1773  }//endifNOTUpgradeInBPix
1774  else if (isUpgrade) {
1775  vector<string> meVec = iGetter.getMEs();
1776  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
1777  string full_path = currDir + "/" + (*it);
1778  if(full_path.find("missing_")!=string::npos){ // If we have missing hits ME
1779  MonitorElement * me = iGetter.get(full_path);
1780  if (!me) continue;
1781  float missingHits = me->getEntries();
1782  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
1783  me = iGetter.get(new_path);
1784  if (!me) continue;
1785  float validHits = me->getEntries();
1786  float hitEfficiency = -1.;
1787  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
1788  int binx = 0; int biny = 0;
1789  if(currDir.find("Shell_m")!=string::npos){ binx = 1;}else{ binx = 2;}
1790  if(dname.find("01")!=string::npos){ biny = 1;}else if(dname.find("02")!=string::npos){ biny = 2;}
1791  else if(dname.find("03")!=string::npos){ biny = 3;}else if(dname.find("04")!=string::npos){ biny = 4;}
1792  else if(dname.find("05")!=string::npos){ biny = 5;}else if(dname.find("06")!=string::npos){ biny = 6;}
1793  else if(dname.find("07")!=string::npos){ biny = 7;}else if(dname.find("08")!=string::npos){ biny = 8;}
1794  else if(dname.find("09")!=string::npos){ biny = 9;}else if(dname.find("10")!=string::npos){ biny = 10;}
1795  else if(dname.find("11")!=string::npos){ biny = 11;}else if(dname.find("12")!=string::npos){ biny = 12;}
1796  else if(dname.find("13")!=string::npos){ biny = 13;}else if(dname.find("14")!=string::npos){ biny = 14;}
1797  else if(dname.find("15")!=string::npos){ biny = 15;}else if(dname.find("16")!=string::npos){ biny = 16;}
1798  else if(dname.find("17")!=string::npos){ biny = 17;}else if(dname.find("18")!=string::npos){ biny = 18;}
1799  else if(dname.find("19")!=string::npos){ biny = 19;}else if(dname.find("20")!=string::npos){ biny = 20;}
1800  else if(dname.find("21")!=string::npos){ biny = 21;}else if(dname.find("22")!=string::npos){ biny = 22;}
1801  else if(dname.find("23")!=string::npos){ biny = 23;}else if(dname.find("24")!=string::npos){ biny = 24;}
1802  else if(dname.find("25")!=string::npos){ biny = 25;}else if(dname.find("25")!=string::npos){ biny = 25;}
1803  else if(dname.find("26")!=string::npos){ biny = 26;}else if(dname.find("27")!=string::npos){ biny = 27;}
1804  else if(dname.find("28")!=string::npos){ biny = 28;}else if(dname.find("29")!=string::npos){ biny = 29;}
1805  else if(dname.find("30")!=string::npos){ biny = 30;}else if(dname.find("31")!=string::npos){ biny = 31;}
1806  else if(dname.find("32")!=string::npos){ biny = 32;}
1807  if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
1808  if(currDir.find("Layer_1")!=string::npos){ biny = biny + 6;}
1809  else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 14;}
1810  else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
1811  else if(currDir.find("Layer_4")!=string::npos){ biny = biny + 32;}
1812  }
1813  if(currDir.find("Layer_1")!=string::npos){
1814  HitEfficiency_L1 = iGetter.get("Pixel/Barrel/HitEfficiency_L1");
1815  if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(binx, biny,(float)hitEfficiency);
1816  }else if(currDir.find("Layer_2")!=string::npos){
1817  HitEfficiency_L2 = iGetter.get("Pixel/Barrel/HitEfficiency_L2");
1818  if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(binx, biny,(float)hitEfficiency);
1819  }else if(currDir.find("Layer_3")!=string::npos){
1820  HitEfficiency_L3 = iGetter.get("Pixel/Barrel/HitEfficiency_L3");
1821  if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(binx, biny,(float)hitEfficiency);
1822  }else if(currDir.find("Layer_4")!=string::npos){
1823  HitEfficiency_L4 = iGetter.get("Pixel/Barrel/HitEfficiency_L4");
1824  if(HitEfficiency_L4) HitEfficiency_L4->setBinContent(binx, biny,(float)hitEfficiency);
1825  }
1826  }
1827  }
1828  }//endifUpgradeInBPix
1829  }else if(!isbarrel && dname.find("Blade_")!=string::npos && !isUpgrade){
1830  vector<string> meVec = iGetter.getMEs();
1831  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
1832  string full_path = currDir + "/" + (*it);
1833  if(full_path.find("missing_")!=string::npos){ // If we have missing hits ME
1834  MonitorElement * me = iGetter.get(full_path);
1835  if (!me) continue;
1836  float missingHits = me->getEntries();
1837  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
1838  me = iGetter.get(new_path);
1839  if (!me) continue;
1840  float validHits = me->getEntries();
1841  float hitEfficiency = -1.;
1842  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
1843  int binx = 0; int biny = 1;
1844  if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
1845  else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
1846  else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
1847  else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
1848  else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
1849  else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
1850  if(currDir.find("HalfCylinder_mI")!=string::npos || currDir.find("HalfCylinder_pI")!=string::npos){ binx = binx + 12;}
1851  else{
1852  if(binx==1) binx = 12;
1853  else if(binx==2) binx = 11;
1854  else if(binx==3) binx = 10;
1855  else if(binx==4) binx = 9;
1856  else if(binx==5) binx = 8;
1857  else if(binx==6) binx = 7;
1858  else if(binx==7) binx = 6;
1859  else if(binx==8) binx = 5;
1860  else if(binx==9) binx = 4;
1861  else if(binx==10) binx = 3;
1862  else if(binx==11) binx = 2;
1863  else if(binx==12) binx = 1;
1864  }
1865  if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
1866  HitEfficiency_Dm1 = iGetter.get("Pixel/Endcap/HitEfficiency_Dm1");
1867  if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny, (float)hitEfficiency);
1868  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
1869  HitEfficiency_Dm2 = iGetter.get("Pixel/Endcap/HitEfficiency_Dm2");
1870  if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny, (float)hitEfficiency);
1871  }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
1872  HitEfficiency_Dp1 = iGetter.get("Pixel/Endcap/HitEfficiency_Dp1");
1873  if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny, (float)hitEfficiency);
1874  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
1875  HitEfficiency_Dp2 = iGetter.get("Pixel/Endcap/HitEfficiency_Dp2");
1876  if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny, (float)hitEfficiency);
1877  }
1878  }
1879  }
1880  }else if(!isbarrel && dname.find("Blade_")!=string::npos && isUpgrade){
1881  vector<string> meVec = iGetter.getMEs();
1882  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
1883  string full_path = currDir + "/" + (*it);
1884  if(full_path.find("missing_")!=string::npos){ // If we have missing hits ME
1885  MonitorElement * me = iGetter.get(full_path);
1886  if (!me) continue;
1887  float missingHits = me->getEntries();
1888  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
1889  me = iGetter.get(new_path);
1890  if (!me) continue;
1891  float validHits = me->getEntries();
1892  float hitEfficiency = -1.;
1893  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
1894  int binx = 0; int biny = 1;
1895  if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
1896  else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
1897  else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
1898  else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
1899  else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
1900  else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
1901  else if(currDir.find("13")!=string::npos){ binx = 13;}else if(currDir.find("14")!=string::npos){ binx = 14;}
1902  else if(currDir.find("15")!=string::npos){ binx = 15;}else if(currDir.find("16")!=string::npos){ binx = 16;}
1903  else if(currDir.find("17")!=string::npos){ binx = 17;}
1904  if(currDir.find("HalfCylinder_mI")!=string::npos || currDir.find("HalfCylinder_pI")!=string::npos){ binx = binx + 12;}
1905  else{
1906  if(binx==1) binx = 17;
1907  else if(binx==2) binx = 16;
1908  else if(binx==3) binx = 15;
1909  else if(binx==4) binx = 14;
1910  else if(binx==5) binx = 13;
1911  else if(binx==6) binx = 12;
1912  else if(binx==7) binx = 11;
1913  else if(binx==8) binx = 10;
1914  else if(binx==9) binx = 9;
1915  else if(binx==10) binx = 8;
1916  else if(binx==11) binx = 7;
1917  else if(binx==12) binx = 6;
1918  else if(binx==13) binx = 5;
1919  else if(binx==14) binx = 4;
1920  else if(binx==15) binx = 3;
1921  else if(binx==16) binx = 2;
1922  else if(binx==17) binx = 1;
1923  }
1924  if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
1925  HitEfficiency_Dm1 = iGetter.get("Pixel/Endcap/HitEfficiency_Dm1");
1926  if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny, (float)hitEfficiency);
1927  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
1928  HitEfficiency_Dm2 = iGetter.get("Pixel/Endcap/HitEfficiency_Dm2");
1929  if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny, (float)hitEfficiency);
1930  }else if(currDir.find("Disk_3")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
1931  HitEfficiency_Dm3 = iGetter.get("Pixel/Endcap/HitEfficiency_Dm3");
1932  if(HitEfficiency_Dm3) HitEfficiency_Dm3->setBinContent(binx, biny, (float)hitEfficiency);
1933  }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
1934  HitEfficiency_Dp1 = iGetter.get("Pixel/Endcap/HitEfficiency_Dp1");
1935  if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny, (float)hitEfficiency);
1936  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
1937  HitEfficiency_Dp2 = iGetter.get("Pixel/Endcap/HitEfficiency_Dp2");
1938  if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny, (float)hitEfficiency);
1939  }else if(currDir.find("Disk_3")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
1940  HitEfficiency_Dp3 = iGetter.get("Pixel/Endcap/HitEfficiency_Dp3");
1941  if(HitEfficiency_Dp3) HitEfficiency_Dp3->setBinContent(binx, biny, (float)hitEfficiency);
1942  }
1943  //std::cout<<"EFFI: "<<currDir<<" , x: "<<binx<<" , y: "<<biny<<std::endl;
1944  }
1945  }
1946  }else{
1947  vector<string> subdirs = iGetter.getSubdirs();
1948  for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
1949  iBooker.cd(*it);
1950  iGetter.cd(*it);
1951  if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
1952  fillEfficiency(iBooker, iGetter, isbarrel, isUpgrade);
1953  iBooker.goUp();
1954  iGetter.setCurrentFolder(iBooker.pwd());
1955  }
1956  }
1957  }else{ // Online
1958  if(dname.find("Module_")!=string::npos){
1959  vector<string> meVec = iGetter.getMEs();
1960  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
1961  string full_path = currDir + "/" + (*it);
1962  if(full_path.find("missing_")!=string::npos){ // If we have missing hits ME
1963  MonitorElement * me = iGetter.get(full_path);
1964  if (!me) continue;
1965  float missingHits = me->getEntries();
1966  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
1967  me = iGetter.get(new_path);
1968  if (!me) continue;
1969  float validHits = me->getEntries();
1970  float hitEfficiency = -1.;
1971  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
1972  int binx = 0; int biny = 0;
1973  if(isbarrel){
1974  if(currDir.find("Shell_m")!=string::npos){
1975  if(currDir.find("Module_4")!=string::npos){ binx = 1;}else if(currDir.find("Module_3")!=string::npos){ binx = 2;}
1976  if(currDir.find("Module_2")!=string::npos){ binx = 3;}else if(currDir.find("Module_1")!=string::npos){ binx = 4;}
1977  }else if(currDir.find("Shell_p")!=string::npos){
1978  if(currDir.find("Module_1")!=string::npos){ binx = 5;}else if(currDir.find("Module_2")!=string::npos){ binx = 6;}
1979  if(currDir.find("Module_3")!=string::npos){ binx = 7;}else if(currDir.find("Module_4")!=string::npos){ binx = 8;}
1980  }
1981  if (!isUpgrade) {
1982  if(currDir.find("01")!=string::npos){ biny = 1;}else if(currDir.find("02")!=string::npos){ biny = 2;}
1983  else if(currDir.find("03")!=string::npos){ biny = 3;}else if(currDir.find("04")!=string::npos){ biny = 4;}
1984  else if(currDir.find("05")!=string::npos){ biny = 5;}else if(currDir.find("06")!=string::npos){ biny = 6;}
1985  else if(currDir.find("07")!=string::npos){ biny = 7;}else if(currDir.find("08")!=string::npos){ biny = 8;}
1986  else if(currDir.find("09")!=string::npos){ biny = 9;}else if(currDir.find("10")!=string::npos){ biny = 10;}
1987  else if(currDir.find("11")!=string::npos){ biny = 11;}else if(currDir.find("12")!=string::npos){ biny = 12;}
1988  else if(currDir.find("13")!=string::npos){ biny = 13;}else if(currDir.find("14")!=string::npos){ biny = 14;}
1989  else if(currDir.find("15")!=string::npos){ biny = 15;}else if(currDir.find("16")!=string::npos){ biny = 16;}
1990  else if(currDir.find("17")!=string::npos){ biny = 17;}else if(currDir.find("18")!=string::npos){ biny = 18;}
1991  else if(currDir.find("19")!=string::npos){ biny = 19;}else if(currDir.find("20")!=string::npos){ biny = 20;}
1992  else if(currDir.find("21")!=string::npos){ biny = 21;}else if(currDir.find("22")!=string::npos){ biny = 22;}
1993  if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
1994  if(currDir.find("Layer_1")!=string::npos){ biny = biny + 10;}
1995  else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 16;}
1996  else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
1997  }
1998  }
1999  else if (isUpgrade) {
2000  if(currDir.find("01")!=string::npos){ biny = 1;}else if(currDir.find("02")!=string::npos){ biny = 2;}
2001  else if(currDir.find("03")!=string::npos){ biny = 3;}else if(currDir.find("04")!=string::npos){ biny = 4;}
2002  else if(currDir.find("05")!=string::npos){ biny = 5;}else if(currDir.find("06")!=string::npos){ biny = 6;}
2003  else if(currDir.find("07")!=string::npos){ biny = 7;}else if(currDir.find("08")!=string::npos){ biny = 8;}
2004  else if(currDir.find("09")!=string::npos){ biny = 9;}else if(currDir.find("10")!=string::npos){ biny = 10;}
2005  else if(currDir.find("11")!=string::npos){ biny = 11;}else if(currDir.find("12")!=string::npos){ biny = 12;}
2006  else if(currDir.find("13")!=string::npos){ biny = 13;}else if(currDir.find("14")!=string::npos){ biny = 14;}
2007  else if(currDir.find("15")!=string::npos){ biny = 15;}else if(currDir.find("16")!=string::npos){ biny = 16;}
2008  else if(currDir.find("17")!=string::npos){ biny = 17;}else if(currDir.find("18")!=string::npos){ biny = 18;}
2009  else if(currDir.find("19")!=string::npos){ biny = 19;}else if(currDir.find("20")!=string::npos){ biny = 20;}
2010  else if(currDir.find("21")!=string::npos){ biny = 21;}else if(currDir.find("22")!=string::npos){ biny = 22;}
2011  else if(currDir.find("23")!=string::npos){ biny = 23;}else if(currDir.find("24")!=string::npos){ biny = 24;}
2012  else if(currDir.find("25")!=string::npos){ biny = 25;}else if(currDir.find("25")!=string::npos){ biny = 25;}
2013  else if(currDir.find("26")!=string::npos){ biny = 26;}else if(currDir.find("27")!=string::npos){ biny = 27;}
2014  else if(currDir.find("28")!=string::npos){ biny = 28;}else if(currDir.find("29")!=string::npos){ biny = 29;}
2015  else if(currDir.find("30")!=string::npos){ biny = 30;}else if(currDir.find("31")!=string::npos){ biny = 31;}
2016  else if(currDir.find("32")!=string::npos){ biny = 32;}
2017  if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
2018  if(currDir.find("Layer_1")!=string::npos){ biny = biny + 6;}
2019  else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 14;}
2020  else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
2021  else if(currDir.find("Layer_4")!=string::npos){ biny = biny + 32;}
2022  }
2023  }
2024  }else{ //endcap
2025  if (!isUpgrade) {
2026  if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
2027  else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
2028  else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
2029  else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
2030  else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
2031  else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
2032  if(currDir.find("HalfCylinder_mO")!=string::npos || currDir.find("HalfCylinder_pO")!=string::npos){ binx = binx + 12;}
2033  if(currDir.find("Panel_1/Module_1")!=string::npos){ biny = 1;}else if(currDir.find("Panel_2/Module_1")!=string::npos){ biny = 2;}
2034  else if(currDir.find("Panel_1/Module_2")!=string::npos){ biny = 3;}else if(currDir.find("Panel_2/Module_2")!=string::npos){ biny = 4;}
2035  else if(currDir.find("Panel_1/Module_3")!=string::npos){ biny = 5;}else if(currDir.find("Panel_2/Module_3")!=string::npos){ biny = 6;}
2036  else if(currDir.find("Panel_1/Module_4")!=string::npos){ biny = 7;}
2037  } else if (isUpgrade) {
2038  if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
2039  else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
2040  else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
2041  else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
2042  else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
2043  else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
2044  else if(currDir.find("13")!=string::npos){ binx = 13;}else if(currDir.find("14")!=string::npos){ binx = 14;}
2045  else if(currDir.find("15")!=string::npos){ binx = 15;}else if(currDir.find("16")!=string::npos){ binx = 16;}
2046  else if(currDir.find("17")!=string::npos){ binx = 17;}
2047  if(currDir.find("HalfCylinder_mO")!=string::npos || currDir.find("HalfCylinder_pO")!=string::npos){ binx = binx + 17;}
2048  if(currDir.find("Panel_1/Module_1")!=string::npos){ biny = 1;}else if(currDir.find("Panel_2/Module_1")!=string::npos){ biny = 2;}
2049  }//endif(isUpgrade)
2050  }
2051 
2052  if(currDir.find("Layer_1")!=string::npos){
2053  HitEfficiency_L1 = iGetter.get("Pixel/Barrel/HitEfficiency_L1");
2054  if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(binx, biny,(float)hitEfficiency);
2055  }else if(currDir.find("Layer_2")!=string::npos){
2056  HitEfficiency_L2 = iGetter.get("Pixel/Barrel/HitEfficiency_L2");
2057  if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(binx, biny,(float)hitEfficiency);
2058  }else if(currDir.find("Layer_3")!=string::npos){
2059  HitEfficiency_L3 = iGetter.get("Pixel/Barrel/HitEfficiency_L3");
2060  if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(binx, biny,(float)hitEfficiency);
2061  }else if( isUpgrade && (currDir.find("Layer_4")!=string::npos) ){
2062  HitEfficiency_L4 = iGetter.get("Pixel/Barrel/HitEfficiency_L4");
2063  if(HitEfficiency_L4) HitEfficiency_L4->setBinContent(binx, biny,(float)hitEfficiency);
2064  }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2065  HitEfficiency_Dm1 = iGetter.get("Pixel/Endcap/HitEfficiency_Dm1");
2066  if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny,(float)hitEfficiency);
2067  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2068  HitEfficiency_Dm2 = iGetter.get("Pixel/Endcap/HitEfficiency_Dm2");
2069  if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny,(float)hitEfficiency);
2070  }else if(currDir.find("Disk_3")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2071  HitEfficiency_Dm3 = iGetter.get("Pixel/Endcap/HitEfficiency_Dm3");
2072  if(HitEfficiency_Dm3) HitEfficiency_Dm3->setBinContent(binx, biny,(float)hitEfficiency);
2073  }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2074  HitEfficiency_Dp1 = iGetter.get("Pixel/Endcap/HitEfficiency_Dp1");
2075  if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny,(float)hitEfficiency);
2076  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2077  HitEfficiency_Dp2 = iGetter.get("Pixel/Endcap/HitEfficiency_Dp2");
2078  if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny,(float)hitEfficiency);
2079  }else if(currDir.find("Disk_3")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2080  HitEfficiency_Dp3 = iGetter.get("Pixel/Endcap/HitEfficiency_Dp3");
2081  if(HitEfficiency_Dp3) HitEfficiency_Dp3->setBinContent(binx, biny,(float)hitEfficiency);
2082  }
2083  }
2084  }
2085  }else{
2086  //cout<<"finding subdirs now"<<std::endl;
2087  vector<string> subdirs = iGetter.getSubdirs();
2088  for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
2089  iBooker.cd(*it);
2090  iGetter.cd(*it);
2091  if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
2092  fillEfficiency(iBooker, iGetter, isbarrel, isUpgrade);
2093  iBooker.goUp();
2094  iGetter.setCurrentFolder(iBooker.pwd());
2095  }
2096  }
2097  } // end online/offline
2098  //cout<<"leaving SiPixelActionExecutor::fillEfficiency..."<<std::endl;
2099 }
dictionary missing
Definition: combine.py:4
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
tuple start
Check for commandline option errors.
Definition: dqm_diff.py:58
void cd(void)
Definition: DQMStore.cc:322
MonitorElement * HitEfficiency_Dp3
TH1 * getRefTH1(void) const
void fillDeviations(DQMStore::IGetter &iGetter)
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
void cd(void)
Definition: DQMStore.cc:266
MonitorElement * get(const std::string &path)
Definition: DQMStore.cc:302
void createEfficiency(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool isUpgrade)
static char const * tname
Definition: GTSchema.h:13
void getGrandSummaryME(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, int nbin, std::string &me_name, std::vector< MonitorElement * > &mes)
const std::string & pwd(void)
Definition: DQMStore.cc:282
MonitorElement * HitEfficiency_L4
MonitorElement * getFEDSummaryME(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, std::string me_name)
void bookOccupancyPlots(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool hiRes, bool isbarrel)
MonitorElement * DEV_size_Barrel
MonitorElement * HitEfficiency_L3
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)
SiPixelConfigParser * configParser_
MonitorElement * DEV_nclusters_Barrel
void fillGrandEndcapSummaryHistos(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, std::vector< std::string > &me_names, bool isUpgrade)
double isum
bool getMENamesForEndcapSummary(std::string &structure_name, std::vector< std::string > &me_names)
MonitorElement * HitEfficiency_Dm2
double getEntries(void) const
get # of entries
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * HitEfficiency_L2
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
bool getCalibType(int &u_freq)
int getNbinsY(void) const
get # of bins in Y-axis
void Fill(long long x)
void fillEfficiency(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool isbarrel, bool isUpgrade)
bool getMENamesForGrandEndcapSummary(std::string &structure_name, std::vector< std::string > &me_names)
SiPixelConfigWriter * configWriter_
tuple path
else: Piece not in the list, fine.
bool getFrequencyForGrandBarrelSummary(int &u_freq)
bool getFrequencyForEndcapSummary(int &u_freq)
bool getMENamesForFEDErrorSummary(std::string &structure_name, std::vector< std::string > &me_names)
void bookDeviations(DQMStore::IBooker &iBooker, bool isUpgrade)
T sqrt(T t)
Definition: SSEVec.h:48
void createSummary(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool isUpgrade)
MonitorElement * DEV_adc_Endcap
bool getMENamesForGrandBarrelSummary(std::string &structure_name, std::vector< std::string > &me_names)
bool getFrequencyForBarrelSummary(int &u_freq)
void fillFEDErrorSummary(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, std::string dir_name, std::vector< std::string > &me_names)
bool getFrequencyForGrandEndcapSummary(int &u_freq)
MonitorElement * DEV_charge_Endcap
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
int j
Definition: DBlmapReader.cc:9
bool getMENamesForBarrelSummary(std::string &structure_name, std::vector< std::string > &me_names)
MonitorElement * getSummaryME(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, std::string me_name, bool isUpgrade)
std::vector< std::string > getMEs(void)
Definition: DQMStore.cc:310
void fillOccupancy(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, bool isbarrel)
SiPixelActionExecutor(bool offlineXMLfile, bool Tier0Flag)
MonitorElement * DEV_charge_Barrel
MonitorElement * HitEfficiency_Dm3
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:274
void goUp(void)
Definition: DQMStore.cc:278
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
bool getMessageLimitForQTests(int &u_freq)
MonitorElement * HitEfficiency_L1
TH1F * getTH1F(void) const
MonitorElement * DEV_nclusters_Endcap
MonitorElement * HitEfficiency_Dp1
bool getSourceType(int &u_freq)
std::vector< std::string > getSubdirs(void)
Definition: DQMStore.cc:306
MonitorElement * DEV_size_Endcap
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:330
double getBinContent(int binx) const
get content of bin (1-D)
int nlast
Definition: AMPTWrapper.h:47
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
int getNbinsX(void) const
get # of bins in X-axis
tuple cout
Definition: gather_cfg.py:121
void createOccupancy(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter)
MonitorElement * HitEfficiency_Dp2
bool getFrequencyForTrackerMap(int &u_freq)
void fillGrandBarrelSummaryHistos(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, std::vector< std::string > &me_names, bool isUpgrade)
void fillSummary(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, std::string dir_name, std::vector< std::string > &me_names, bool isbarrel, bool isUpgrade)
TH2F * getTH2F(void) const
MonitorElement * DEV_ndigis_Endcap
void GetBladeSubdirs(DQMStore::IBooker &iBooker, DQMStore::IGetter &iGetter, std::vector< std::string > &blade_subdirs)
MonitorElement * HitEfficiency_Dm1
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void Reset(void)
reset ME (ie. contents, errors, etc)
MonitorElement * DEV_ndigis_Barrel
void bookEfficiency(DQMStore::IBooker &iBooker, bool isUpgrade)
MonitorElement * DEV_adc_Barrel