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 
28 
29 #include <math.h>
30 
31 #include <iostream>
32 using namespace std;
33 //=============================================================================================================
34 //
35 // -- Constructor
36 //
38  bool Tier0Flag) :
39  offlineXMLfile_(offlineXMLfile),
40  Tier0Flag_(Tier0Flag) {
41  edm::LogInfo("SiPixelActionExecutor") <<
42  " Creating SiPixelActionExecutor " << "\n" ;
43  configParser_ = 0;
44  configWriter_ = 0;
45  qtHandler_ = 0;
46  ndet_ = 0;
47  //collationDone = false;
48 }
49 //=============================================================================================================
50 //
51 // -- Destructor
52 //
54  edm::LogInfo("SiPixelActionExecutor") <<
55  " Deleting SiPixelActionExecutor " << "\n" ;
56  if (configParser_) delete configParser_;
57  if (configWriter_) delete configWriter_;
58  if (qtHandler_) delete qtHandler_;
59 }
60 //=============================================================================================================
61 //
62 // -- Read Configuration File
63 //
65  string localPath;
66  if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
67  else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
68  if (configParser_ == 0) {
71  }
72 }
73 //=============================================================================================================
74 //
75 // -- Read Configuration File
76 //
78  int& sum_barrel_freq,
79  int& sum_endcap_freq,
80  int& sum_grandbarrel_freq,
81  int& sum_grandendcap_freq,
82  int& message_limit_,
83  int& source_type_,
84  int& calib_type_) {
85  //printing cout<<"Entering SiPixelActionExecutor::readConfiguration..."<<endl;
86  string localPath;
87  if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
88  else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
89  if (configParser_ == 0) {
92  }
93 
94  if (!configParser_->getFrequencyForTrackerMap(tkmap_freq)){
95  cout << "SiPixelActionExecutor::readConfiguration: Failed to read TrackerMap configuration parameters!! ";
96  return false;
97  }
98  if (!configParser_->getFrequencyForBarrelSummary(sum_barrel_freq)){
99  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Barrel Summary configuration parameters!! " << "\n" ;
100  return false;
101  }
102  if (!configParser_->getFrequencyForEndcapSummary(sum_endcap_freq)){
103  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Endcap Summary configuration parameters!! " << "\n" ;
104  return false;
105  }
106  if (!configParser_->getFrequencyForGrandBarrelSummary(sum_grandbarrel_freq)){
107  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Grand Barrel Summary configuration parameters!! " << "\n" ;
108  return false;
109  }
110  if (!configParser_->getFrequencyForGrandEndcapSummary(sum_grandendcap_freq)){
111  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Grand Endcap Summary configuration parameters!! " << "\n" ;
112  return false;
113  }
114  if (!configParser_->getMessageLimitForQTests(message_limit_)){
115  edm::LogInfo("SiPixelActionExecutor") << "Failed to read QTest Message Limit" << "\n" ;
116  return false;
117  }
118  if (!configParser_->getSourceType(source_type_)){
119  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Source Type" << "\n" ;
120  return false;
121  }
122  if (!configParser_->getCalibType(calib_type_)){
123  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Calib Type" << "\n" ;
124  return false;
125  }
126  //printing cout<<"...leaving SiPixelActionExecutor::readConfiguration..."<<endl;
127  return true;
128 }
129 //=============================================================================================================
130 bool SiPixelActionExecutor::readConfiguration(int& tkmap_freq, int& summary_freq) {
131  //printing cout<<"Entering SiPixelActionExecutor::readConfiguration..."<<endl;
132  string localPath;
133  if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
134  else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
135  if (configParser_ == 0) {
138  }
139 
140  if (!configParser_->getFrequencyForTrackerMap(tkmap_freq)){
141  cout << "SiPixelActionExecutor::readConfiguration: Failed to read TrackerMap configuration parameters!! ";
142  return false;
143  }
144  if (!configParser_->getFrequencyForBarrelSummary(summary_freq)){
145  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Summary configuration parameters!! " << "\n" ;
146  return false;
147  }
148  //printing cout<<"...leaving SiPixelActionExecutor::readConfiguration..."<<endl;
149  return true;
150 }
151 //=============================================================================================================
152 // -- Create Tracker Map
153 //
155  string mEName,
156  string theTKType)
157 {
158 
159  SiPixelTrackerMapCreator tkmap_creator(mEName,theTKType,offlineXMLfile_);
160  tkmap_creator.create(bei);
161 
162 /* cout << ACYellow << ACBold
163  << "[SiPixelActionExecutor::createTkMap()]"
164  << ACPlain
165  << " Tracker map created (type:"
166  << theTKType
167  << ")"
168  << endl;
169 */
170 }
171 
172 //=============================================================================================================
173 void SiPixelActionExecutor::createSummary(DQMStore* bei, bool isUpgrade) {
174  //cout<<"entering SiPixelActionExecutor::createSummary..."<<endl;
175  string barrel_structure_name;
176  vector<string> barrel_me_names;
177  string localPath;
178  if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
179  else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
180 // cout<<"*********************ATTENTION! LOCALPATH= "<<localPath<<endl;
181  if (configParser_ == 0) {
184  }
185  if (!configParser_->getMENamesForBarrelSummary(barrel_structure_name, barrel_me_names)){
186  cout << "SiPixelActionExecutor::createSummary: Failed to read Barrel Summary configuration parameters!! ";
187  return;
188  }
190 // cout<<"++++++++++++++++++++++++++SOURCE TYPE= "<<source_type_<<endl;
191  bei->setCurrentFolder("Pixel/");
192  //bei->cd();
193  fillSummary(bei, barrel_structure_name, barrel_me_names, true, isUpgrade); // Barrel
194  bei->setCurrentFolder("Pixel/");
195  //bei->cd();
196  string endcap_structure_name;
197  vector<string> endcap_me_names;
198  if (!configParser_->getMENamesForEndcapSummary(endcap_structure_name, endcap_me_names)){
199  edm::LogInfo("SiPixelActionExecutor") << "Failed to read Endcap Summary configuration parameters!! " << "\n" ;
200  return;
201  }
202 
203 // cout << "--- Processing endcap" << endl;
204 
205  bei->setCurrentFolder("Pixel/");
206  //bei->cd();
207  fillSummary(bei, endcap_structure_name, endcap_me_names, false, isUpgrade); // Endcap
208  bei->setCurrentFolder("Pixel/");
209  //if(!Tier0Flag_) fillDeviations(bei);
210  bei->setCurrentFolder("Pixel/");
211  //bei->cd();
212  if(source_type_==0||source_type_==5 || source_type_ == 20){//do this only if RawData source is present
213  string federror_structure_name;
214  vector<string> federror_me_names;
215  if (!configParser_->getMENamesForFEDErrorSummary(federror_structure_name, federror_me_names)){
216  cout << "SiPixelActionExecutor::createSummary: Failed to read FED Error Summary configuration parameters!! ";
217  return;
218  }
219  bei->setCurrentFolder("Pixel/");
220  //bei->cd();
221  fillFEDErrorSummary(bei, federror_structure_name, federror_me_names);
222  bei->setCurrentFolder("Pixel/");
223  //bei->cd();
224  }
225  //createLayout(bei);
226  //string fname = "test.xml";
227  // configWriter_->write(fname);
228  if (configWriter_) delete configWriter_;
229  configWriter_ = 0;
230 // cout<<"leaving SiPixelActionExecutor::createSummary..."<<endl;
231 }
232 
233 //=============================================================================================================
235  int nBPixModules;
236  if (isUpgrade) {nBPixModules=1184;} else {nBPixModules=768;}
237 
238  bei->cd();
239  bei->setCurrentFolder("Pixel/Barrel");
240  DEV_adc_Barrel = bei->book1D("DEV_adc_Barrel","Deviation from reference;Module;<adc_ref>-<adc>",nBPixModules,0.,nBPixModules);
241  DEV_ndigis_Barrel = bei->book1D("DEV_ndigis_Barrel","Deviation from reference;Module;<ndigis_ref>-<ndigis>",nBPixModules,0.,nBPixModules);
242  DEV_charge_Barrel = bei->book1D("DEV_charge_Barrel","Deviation from reference;Module;<charge_ref>-<charge>",nBPixModules,0.,nBPixModules);
243  DEV_nclusters_Barrel = bei->book1D("DEV_nclusters_Barrel","Deviation from reference;Module;<nclusters_ref>-<nclusters>",nBPixModules,0.,nBPixModules);
244  DEV_size_Barrel = bei->book1D("DEV_size_Barrel","Deviation from reference;Module;<size_ref>-<size>",nBPixModules,0.,nBPixModules);
245  bei->cd();
246  bei->setCurrentFolder("Pixel/Endcap");
247  DEV_adc_Endcap = bei->book1D("DEV_adc_Endcap","Deviation from reference;Module;<adc_ref>-<adc>",672,0.,672.);
248  DEV_ndigis_Endcap = bei->book1D("DEV_ndigis_Endcap","Deviation from reference;Module;<ndigis_ref>-<ndigis>",672,0.,672.);
249  DEV_charge_Endcap = bei->book1D("DEV_charge_Endcap","Deviation from reference;Module;<charge_ref>-<charge>",672,0.,672.);
250  DEV_nclusters_Endcap = bei->book1D("DEV_nclusters_Endcap","Deviation from reference;Module;<nclusters_ref>-<nclusters>",672,0.,672.);
251  DEV_size_Endcap = bei->book1D("DEV_size_Endcap","Deviation from reference;Module;<size_ref>-<size>",672,0.,672.);
252  bei->cd();
253 }
254 
255 
257  int n = 768;
258  MonitorElement* me1; MonitorElement* me2;
259  MonitorElement* me3; MonitorElement* me4;
260  MonitorElement* me5;
261  TH1* ref1; TH1* ref2;
262  TH1* ref3; TH1* ref4;
263  TH1* ref5;
264  MonitorElement* dev1; MonitorElement* dev2;
265  MonitorElement* dev3; MonitorElement* dev4;
266  MonitorElement* dev5;
267  me1 = bei->get("Pixel/Barrel/SUMDIG_adc_Barrel");
268  ref1 = me1->getRefTH1();
269  dev1 = bei->get("Pixel/Barrel/DEV_adc_Barrel");
270  me2 = bei->get("Pixel/Barrel/SUMDIG_ndigis_Barrel");
271  ref2 = me2->getRefTH1();
272  dev2 = bei->get("Pixel/Barrel/DEV_ndigis_Barrel");
273  me3 = bei->get("Pixel/Barrel/SUMCLU_charge_Barrel");
274  ref3 = me3->getRefTH1();
275  dev3 = bei->get("Pixel/Barrel/DEV_charge_Barrel");
276  me4 = bei->get("Pixel/Barrel/SUMCLU_nclusters_Barrel");
277  ref4 = me4->getRefTH1();
278  dev4 = bei->get("Pixel/Barrel/DEV_nclusters_Barrel");
279  me5 = bei->get("Pixel/Barrel/SUMCLU_size_Barrel");
280  ref5 = me5->getRefTH1();
281  dev5 = bei->get("Pixel/Barrel/DEV_size_Barrel");
282  for(int i=1; i!=n+1; i++){
283  float ref_value; float new_value;
284  // Barrel adc:
285  if(me1)if(ref1)if(dev1){
286  new_value = me1->getBinContent(i);
287  ref_value = ref1->GetBinContent(i);
288  dev1->setBinContent(i,ref_value-new_value);
289  }
290  //Barrel ndigis:
291  if(me2)if(ref2)if(dev2){
292  new_value = me2->getBinContent(i);
293  ref_value = ref2->GetBinContent(i);
294  dev2->setBinContent(i,ref_value-new_value);
295  }
296  // Barrel cluster charge:
297  if(me3)if(ref3)if(dev3){
298  new_value = me3->getBinContent(i);
299  ref_value = ref3->GetBinContent(i);
300  dev3->setBinContent(i,ref_value-new_value);
301  }
302  // Barrel nclusters:
303  if(me4)if(ref4)if(dev4){
304  new_value = me4->getBinContent(i);
305  ref_value = ref4->GetBinContent(i);
306  dev4->setBinContent(i,ref_value-new_value);
307  }
308  // Barrel cluster size:
309  if(me5)if(ref5)if(dev5){
310  new_value = me5->getBinContent(i);
311  ref_value = ref5->GetBinContent(i);
312  dev5->setBinContent(i,ref_value-new_value);
313  }
314  }
315 
316  int nn = 672;
317  MonitorElement* me11; MonitorElement* me12;
318  MonitorElement* me13; MonitorElement* me14;
319  MonitorElement* me15;
320  TH1* ref11; TH1* ref12;
321  TH1* ref13; TH1* ref14;
322  TH1* ref15;
323  MonitorElement* dev11; MonitorElement* dev12;
324  MonitorElement* dev13; MonitorElement* dev14;
325  MonitorElement* dev15;
326  me11 = bei->get("Pixel/Endcap/SUMDIG_adc_Endcap");
327  ref11 = me11->getRefTH1();
328  dev11 = bei->get("Pixel/Endcap/DEV_adc_Endcap");
329  me12 = bei->get("Pixel/Endcap/SUMDIG_ndigis_Endcap");
330  ref12 = me12->getRefTH1();
331  dev12 = bei->get("Pixel/Endcap/DEV_ndigis_Endcap");
332  me13 = bei->get("Pixel/Endcap/SUMCLU_charge_Endcap");
333  ref13 = me13->getRefTH1();
334  dev13 = bei->get("Pixel/Endcap/DEV_charge_Endcap");
335  me14 = bei->get("Pixel/Endcap/SUMCLU_nclusters_Endcap");
336  ref14 = me14->getRefTH1();
337  dev14 = bei->get("Pixel/Endcap/DEV_nclusters_Endcap");
338  me15 = bei->get("Pixel/Endcap/SUMCLU_size_Endcap");
339  ref15 = me15->getRefTH1();
340  dev15 = bei->get("Pixel/Endcap/DEV_size_Endcap");
341  for(int i=1; i!=nn+1; i++){
342  float ref_value; float new_value;
343  // Endcap adc:
344  if(me11)if(ref11)if(dev11){
345  new_value = me11->getBinContent(i);
346  ref_value = ref11->GetBinContent(i);
347  dev11->setBinContent(i,ref_value-new_value);
348  }
349  //Endcap ndigis:
350  if(me12)if(ref12)if(dev12){
351  new_value = me12->getBinContent(i);
352  ref_value = ref12->GetBinContent(i);
353  dev12->setBinContent(i,ref_value-new_value);
354  }
355  // Endcap cluster charge:
356  if(me13)if(ref13)if(dev13){
357  new_value = me13->getBinContent(i);
358  ref_value = ref13->GetBinContent(i);
359  dev13->setBinContent(i,ref_value-new_value);
360  }
361  // Endcap nclusters:
362  if(me14)if(ref14)if(dev14){
363  new_value = me14->getBinContent(i);
364  ref_value = ref14->GetBinContent(i);
365  dev14->setBinContent(i,ref_value-new_value);
366  }
367  // Endcap cluster size:
368  if(me15)if(ref15)if(dev15){
369  new_value = me15->getBinContent(i);
370  ref_value = ref15->GetBinContent(i);
371  dev15->setBinContent(i,ref_value-new_value);
372  }
373  }
374 }
375 
376 //=============================================================================================================
377 
378 void SiPixelActionExecutor::GetBladeSubdirs(DQMStore* bei, vector<string>& blade_subdirs) {
379  blade_subdirs.clear();
380 // cout << "BladeSubdirs::" << bei->pwd() << endl;
381  vector<string> panels = bei->getSubdirs();
382  vector<string> modules;
383  for (vector<string>::const_iterator it = panels.begin(); it != panels.end(); it++) {
384  bei->cd(*it);
385  modules = bei->getSubdirs();
386  for (vector<string>::const_iterator m_it = modules.begin(); m_it != modules.end(); m_it++) {
387 // cout << "Would have added " << (*m_it) << "." << endl;
388  blade_subdirs.push_back(*m_it);
389  }
390  }
391 // cout << "Got Blade subdirs" << endl;
392 }
393 
394 
395 //=============================================================================================================
396 
397 void SiPixelActionExecutor::fillSummary(DQMStore* bei, string dir_name, vector<string>& me_names, bool isbarrel, bool isUpgrade)
398 {
399 
400 
401  //cout<<"entering SiPixelActionExecutor::fillSummary..."<<endl;
402  string currDir = bei->pwd();
403  //cout<<"currDir= "<<currDir<<endl;
404  string prefix;
405  if(source_type_==0) prefix="SUMRAW";
406  else if (source_type_==1) prefix="SUMDIG";
407  else if (source_type_==2) prefix="SUMCLU";
408  else if (source_type_==3) prefix="SUMTRK";
409  else if (source_type_==4) prefix="SUMHIT";
410  else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
411  else if (source_type_==20) prefix="SUMOFF";
412  if (currDir.find(dir_name) != string::npos) {
413  vector<MonitorElement*> sum_mes;
414  for (vector<string>::const_iterator iv = me_names.begin();
415  iv != me_names.end(); iv++) {
416  if(source_type_==5||source_type_==6){
417  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
418  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
419  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
420  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
421  prefix="SUMRAW";
422  else if((*iv)=="ndigis"||(*iv)=="adc")
423  prefix="SUMDIG";
424  else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||
425  (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
426  (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
427  prefix="SUMCLU";
428  if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
429  else if((*iv)=="residualX"||(*iv)=="residualY")
430  prefix="SUMTRK";
431  else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
432  prefix="SUMHIT";
433  else if((*iv)=="Gain1d"||(*iv)=="GainChi2NDF1d"||
434  (*iv)=="GainChi2Prob1d"||(*iv)=="Pedestal1d"||
435  (*iv)=="GainNPoints1d"||(*iv)=="GainHighPoint1d"||
436  (*iv)=="GainLowPoint1d"||(*iv)=="GainEndPoint1d"||
437  (*iv)=="GainFitResult2d"||(*iv)=="GainDynamicRange2d"||
438  (*iv)=="GainSaturate2d"||
439  (*iv)=="ScurveChi2ProbSummary"||(*iv)=="ScurveFitResultSummary"||
440  (*iv)=="ScurveSigmasSummary"||(*iv)=="ScurveThresholdSummary"||
441  (*iv)=="pixelAliveSummary" || (*iv) == "SiPixelErrorsCalibDigis")
442  prefix="SUMCAL";
443  }
444  MonitorElement* temp; string tag;
445  if((*iv).find("residual")!=string::npos){ // track residuals
446  tag = prefix + "_" + (*iv) + "_mean_"
447  + currDir.substr(currDir.find(dir_name));
448  temp = getSummaryME(bei, tag, isUpgrade);
449  sum_mes.push_back(temp);
450  tag = prefix + "_" + (*iv) + "_RMS_"
451  + currDir.substr(currDir.find(dir_name));
452  temp = getSummaryME(bei, tag, isUpgrade);
453  sum_mes.push_back(temp);
454  }else if(prefix == "SUMCAL"){ // calibrations
455  if((*iv)=="Gain1d" || (*iv)=="GainChi2NDF1d" || (*iv)=="GainChi2Prob1d" ||
456  (*iv)=="GainNPoints1d" || (*iv)=="GainHighPoint1d" ||
457  (*iv)=="GainLowPoint1d" || (*iv)=="GainEndPoint1d" ||
458  (*iv)=="GainDynamicRange2d" || (*iv)=="GainSaturate2d" ||
459  (*iv)=="Pedestal1d" ||
460  (*iv)=="ScurveChi2ProbSummary" || (*iv)=="ScurveFitResultSummary" ||
461  (*iv)=="ScurveSigmasSummary" || (*iv)=="ScurveThresholdSummary"){
462  tag = prefix + "_" + (*iv) + "_mean_"
463  + currDir.substr(currDir.find(dir_name));
464  temp = getSummaryME(bei, tag, isUpgrade);
465  sum_mes.push_back(temp);
466  tag = prefix + "_" + (*iv) + "_RMS_"
467  + currDir.substr(currDir.find(dir_name));
468  temp = getSummaryME(bei, tag, isUpgrade);
469  sum_mes.push_back(temp);
470  }else if((*iv) == "SiPixelErrorsCalibDigis"){
471  tag = prefix + "_" + (*iv) + "_NCalibErrors_"
472  + currDir.substr(currDir.find(dir_name));
473  temp = getSummaryME(bei, tag, isUpgrade);
474  sum_mes.push_back(temp);
475  }else if((*iv)=="GainFitResult2d"){
476  tag = prefix + "_" + (*iv) + "_NNegativeFits_"
477  + currDir.substr(currDir.find(dir_name));
478  temp = getSummaryME(bei, tag, isUpgrade);
479  sum_mes.push_back(temp);
480  }else if((*iv)=="pixelAliveSummary"){
481  tag = prefix + "_" + (*iv) + "_FracOfPerfectPix_"
482  + currDir.substr(currDir.find(dir_name));
483  temp = getSummaryME(bei, tag, isUpgrade);
484  sum_mes.push_back(temp);
485  tag = prefix + "_" + (*iv) + "_mean_"
486  + currDir.substr(currDir.find(dir_name));
487  temp = getSummaryME(bei, tag, isUpgrade);
488  sum_mes.push_back(temp);
489  }
490  }else{
491  tag = prefix + "_" + (*iv) + "_" + currDir.substr(currDir.find(dir_name));
492  temp = getSummaryME(bei, tag, isUpgrade);
493  sum_mes.push_back(temp);
494  if((*iv)=="ndigis"){
495  tag = prefix + "_" + (*iv) + "FREQ_"
496  + currDir.substr(currDir.find(dir_name));
497  temp = getSummaryME(bei, tag, isUpgrade);
498  sum_mes.push_back(temp);
499  }
500  if(prefix=="SUMDIG" && (*iv)=="adc"){
501  tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name));
502  temp = bei->book1D(tag.c_str(), tag.c_str(),128, 0., 256.);
503  sum_mes.push_back(temp);
504  }
505  if(prefix=="SUMCLU" && (*iv)=="charge"){
506  tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name));
507  temp = bei->book1D(tag.c_str(), tag.c_str(),100, 0., 200.); // To look to get the size automatically
508  sum_mes.push_back(temp);
509  }
510  }
511  }
512  if (sum_mes.size() == 0) {
513  edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ;
514  return;
515  }
516  vector<string> subdirs = bei->getSubdirs();
517 //Blade
518  if(dir_name.find("Blade_") == 0) GetBladeSubdirs(bei, subdirs);
519 
520  int ndet = 0;
521  for (vector<string>::const_iterator it = subdirs.begin();
522  it != subdirs.end(); it++) {
523  if (prefix!="SUMOFF" && (*it).find("Module_") == string::npos) continue;
524  if (prefix=="SUMOFF" && (*it).find(isbarrel?"Layer_":"Disk_") == string::npos) continue;
525  bei->cd(*it);
526  ndet++;
527 
528  vector<string> contents = bei->getMEs();
529 
530  for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin();
531  isum != sum_mes.end(); isum++) {
532  for (vector<string>::const_iterator im = contents.begin();
533  im != contents.end(); im++) {
534  string sname = ((*isum)->getName());
535  string tname = " ";
536  tname = sname.substr(7,(sname.find("_",7)-6));
537  if(sname.find("ALLMODS_adcCOMB_")!=string::npos) tname = "adc_";
538  if(sname.find("ALLMODS_chargeCOMB_")!=string::npos) tname = "charge_";
539  if(sname.find("_charge_")!=string::npos && sname.find("Track_")==string::npos) tname = "charge_";
540  if(sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos) tname = "nclusters_";
541  if(sname.find("_size_")!=string::npos && sname.find("Track_")==string::npos) tname = "size_";
542  if(sname.find("_charge_OffTrack_")!=string::npos) tname = "charge_OffTrack_";
543  if(sname.find("_nclusters_OffTrack_")!=string::npos) tname = "nclusters_OffTrack_";
544  if(sname.find("_size_OffTrack_")!=string::npos) tname = "size_OffTrack_";
545  if(sname.find("_sizeX_OffTrack_")!=string::npos) tname = "sizeX_OffTrack_";
546  if(sname.find("_sizeY_OffTrack_")!=string::npos) tname = "sizeY_OffTrack_";
547  if(sname.find("_charge_OnTrack_")!=string::npos) tname = "charge_OnTrack_";
548  if(sname.find("_nclusters_OnTrack_")!=string::npos) tname = "nclusters_OnTrack_";
549  if(sname.find("_size_OnTrack_")!=string::npos) tname = "size_OnTrack_";
550  if(sname.find("_sizeX_OnTrack_")!=string::npos) tname = "sizeX_OnTrack_";
551  if(sname.find("_sizeY_OnTrack_")!=string::npos) tname = "sizeY_OnTrack_";
552  //if(sname.find("ALLMODS")!=string::npos) cout<<"sname and tname= "<<sname<<","<<tname<<endl;
553  if(tname.find("FREQ")!=string::npos) tname = "ndigis_";
554  if (((*im)).find(tname) == 0) {
555  string fullpathname = bei->pwd() + "/" + (*im);
556  //cout<<"!!!!!!!!!!!!!!!!!!!!!!SNAME= "<<sname<<endl;
557  MonitorElement * me = bei->get(fullpathname);
558 
559  if (me){
560  if(sname.find("_charge")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue;
561  if(sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue;
562  if(sname.find("_size")!=string::npos && sname.find("Track_")==string::npos && me->getName().find("Track_")!=string::npos) continue;
563 //cout<<"tell me the sname and me name: "<<sname<<" , "<<me->getName()<<endl;
564  // fill summary histos:
565  if (sname.find("_RMS_")!=string::npos &&
566  sname.find("GainDynamicRange2d")==string::npos &&
567  sname.find("GainSaturate2d")==string::npos){
568  (*isum)->Fill(ndet, me->getRMS());
569  }else if (sname.find("GainDynamicRange2d")!=string::npos ||
570  sname.find("GainSaturate2d")!=string::npos){
571  float SumOfEntries=0.; float SumOfSquaredEntries=0.; int SumOfPixels=0;
572  for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){
573  SumOfEntries+=me->getBinContent(cols,rows);
574  SumOfSquaredEntries+=(me->getBinContent(cols,rows))*(me->getBinContent(cols,rows));
575  SumOfPixels++;
576  }
577 
578  float MeanInZ = SumOfEntries / float(SumOfPixels);
579  float RMSInZ = sqrt(SumOfSquaredEntries/float(SumOfPixels));
580  if(sname.find("_mean_")!=string::npos) (*isum)->Fill(ndet, MeanInZ);
581  if(sname.find("_RMS_")!=string::npos) (*isum)->Fill(ndet, RMSInZ);
582  }else if (sname.find("_FracOfPerfectPix_")!=string::npos){
583  //printing cout<<"nbins = "<<me->getNbinsX()<<" , "<<me->getBinContent(me->getNbinsX()-1)<<" , "<<me->getBinContent(me->getNbinsX())<<endl;
584  float nlast = me->getBinContent(me->getNbinsX());
585  float nall = (me->getTH1F())->Integral(1,11);
586  //printing cout << nall << endl;
587  (*isum)->Fill(ndet, nlast/nall);
588  }else if (sname.find("_NCalibErrors_")!=string::npos ||
589  sname.find("FREQ_")!=string::npos){
590  float nall = me->getEntries();
591  (*isum)->Fill(ndet, nall);
592  }else if (sname.find("GainFitResult2d")!=string::npos){
593  int NegFitPixels=0;
594  for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){
595  if(me->getBinContent(cols,rows)<0.) NegFitPixels++;
596  }
597  (*isum)->Fill(ndet, float(NegFitPixels));
598  }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos ||
599  (sname.find("ALLMODS_chargeCOMB_")!=string::npos && me->getName().find("Track_")==string::npos)){
600  (*isum)->getTH1F()->Add(me->getTH1F());
601  }else if (sname.find("_NErrors_")!=string::npos){
602  string path1 = fullpathname;
603  path1 = path1.replace(path1.find("NErrors"),7,"errorType");
604  MonitorElement * me1 = bei->get(path1);
605  bool notReset=true;
606  if(me1){
607  for(int jj=1; jj<16; jj++){
608  if(me1->getBinContent(jj)>0.){
609  if(jj==6){ //errorType=30 (reset)
610  string path2 = path1;
611  path2 = path2.replace(path2.find("errorType"),9,"TBMMessage");
612  MonitorElement * me2 = bei->get(path2);
613  if(me2) if(me2->getBinContent(6)>0. || me2->getBinContent(7)>0.) notReset=false;
614  }
615  }
616  }
617  }
618  if(notReset) (*isum)->Fill(ndet, me1->getEntries());
619  }else if ((sname.find("_charge_")!=string::npos && sname.find("Track_")==string::npos &&
620  me->getName().find("Track_")==string::npos) ||
621  (sname.find("_charge_")!=string::npos && sname.find("_OnTrack_")!=string::npos &&
622  me->getName().find("_OnTrack_")!=string::npos) ||
623  (sname.find("_charge_")!=string::npos && sname.find("_OffTrack_")!=string::npos &&
624  me->getName().find("_OffTrack_")!=string::npos) ||
625  (sname.find("_nclusters_")!=string::npos && sname.find("Track_")==string::npos &&
626  me->getName().find("Track_")==string::npos) ||
627  (sname.find("_nclusters_")!=string::npos && sname.find("_OnTrack_")!=string::npos &&
628  me->getName().find("_OnTrack_")!=string::npos) ||
629  (sname.find("_nclusters_")!=string::npos && sname.find("_OffTrack_")!=string::npos &&
630  me->getName().find("_OffTrack_")!=string::npos) ||
631  (sname.find("_size")!=string::npos && sname.find("Track_")==string::npos &&
632  me->getName().find("Track_")==string::npos) ||
633  (sname.find("_size")!=string::npos && sname.find("_OnTrack_")!=string::npos &&
634  me->getName().find("_OnTrack_")!=string::npos) ||
635  (sname.find("_size")!=string::npos && sname.find("_OffTrack_")!=string::npos &&
636  me->getName().find("_OffTrack_")!=string::npos)){
637  (*isum)->Fill(ndet, me->getMean());
638  }else if(sname.find("_charge_")==string::npos && sname.find("_nclusters_")==string::npos && sname.find("_size")==string::npos){
639  (*isum)->Fill(ndet, me->getMean());
640  //std::cout<<bei->pwd()<<"/"<<(*isum)->getName()<<" , "<<ndet<<" , "<<me->getMean()<<" , "<<(*isum)->getBinContent(ndet)<<std::endl;
641  }
642 
643  // set titles:
644  if(prefix=="SUMOFF"){
645  (*isum)->setAxisTitle(isbarrel?"Ladders":"Blades",1);
646  }else if(sname.find("ALLMODS_adcCOMB_")!=string::npos){
647  (*isum)->setAxisTitle("Digi charge [ADC]",1);
648  }else if(sname.find("ALLMODS_chargeCOMB_")!=string::npos){
649  (*isum)->setAxisTitle("Cluster charge [kilo electrons]",1);
650  }else{
651  (*isum)->setAxisTitle("Modules",1);
652  }
653  string title = " ";
654  if (sname.find("_RMS_")!=string::npos){
655  title = "RMS of " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
656  }else if (sname.find("_FracOfPerfectPix_")!=string::npos){
657  title = "FracOfPerfectPix " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
658  }else if(sname.find("_NCalibErrors_")!=string::npos){
659  title = "Number of CalibErrors " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
660  }else if(sname.find("_NNegativeFits_")!=string::npos){
661  title = "Number of pixels with neg. fit result " + sname.substr(7,(sname.find("_",7)-7)) + " per module";
662  }else if (sname.find("FREQ_")!=string::npos){
663  title = "NEvents with digis per module";
664  }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos){
665  title = "NDigis";
666  }else if (sname.find("ALLMODS_chargeCOMB_")!=string::npos){
667  title = "NClusters";
668  }else if (sname.find("_NErrors_")!=string::npos){
669  if(prefix=="SUMOFF" && isbarrel) title = "Total number of errors per Ladder";
670  else if(prefix=="SUMOFF" && !isbarrel) title = "Total number of errors per Blade";
671  else title = "Total number of errors per Module";
672  }else{
673  if(prefix=="SUMOFF") title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + (isbarrel?" per Ladder":" per Blade");
674  else title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + " per Module";
675  }
676  (*isum)->setAxisTitle(title,2);
677  }
678  break;
679  }
680  }
681  }
682  bei->goUp();
683  if(dir_name.find("Blade") == 0) bei->goUp(); // Going up a second time if we are processing the Blade
684  } // end for it (subdirs)
685  } else {
686  vector<string> subdirs = bei->getSubdirs();
687  // printing cout << "#\t" << bei->pwd() << endl;
688  if(isbarrel)
689  {
690 
691  for (vector<string>::const_iterator it = subdirs.begin();
692  it != subdirs.end(); it++) {
693  // cout << "##\t" << bei->pwd() << "\t" << (*it) << endl;
694  if((bei->pwd()).find("Endcap")!=string::npos ||
695  (bei->pwd()).find("AdditionalPixelErrors")!=string::npos) bei->goUp();
696  bei->cd(*it);
697  if((*it).find("Endcap")!=string::npos ||
698  (*it).find("AdditionalPixelErrors")!=string::npos) continue;
699  fillSummary(bei, dir_name, me_names, true, isUpgrade); // Barrel
700  bei->goUp();
701  }
702  string grandbarrel_structure_name;
703  vector<string> grandbarrel_me_names;
704  if (!configParser_->getMENamesForGrandBarrelSummary(grandbarrel_structure_name, grandbarrel_me_names)){
705  cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Barrel Summary configuration parameters!! ";
706  return;
707  }
708  fillGrandBarrelSummaryHistos(bei, grandbarrel_me_names, isUpgrade);
709 
710  }
711  else // Endcap
712  {
713 
714  for (vector<string>::const_iterator it = subdirs.begin();
715  it != subdirs.end(); it++) {
716  // cout << "##\t" << bei->pwd() << "\t" << (*it) << endl;
717  if((bei->pwd()).find("Barrel")!=string::npos ||
718  (bei->pwd()).find("AdditionalPixelErrors")!=string::npos) bei->goUp();
719  bei->cd((*it));
720  if ((*it).find("Barrel")!=string::npos ||
721  (*it).find("AdditionalPixelErrors")!=string::npos) continue;
722  fillSummary(bei, dir_name, me_names, false, isUpgrade); // Endcap
723  bei->goUp();
724  }
725  string grandendcap_structure_name;
726  vector<string> grandendcap_me_names;
727  if (!configParser_->getMENamesForGrandEndcapSummary(grandendcap_structure_name, grandendcap_me_names)){
728  cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Endcap Summary configuration parameters!! ";
729  return;
730  }
731  fillGrandEndcapSummaryHistos(bei, grandendcap_me_names, isUpgrade);
732 
733 
734  }
735  }
736 // cout<<"...leaving SiPixelActionExecutor::fillSummary!"<<endl;
737 
738  // End of cleanup
739 
740 
741 }
742 
743 //=============================================================================================================
745  string dir_name,
746  vector<string>& me_names) {
747  //printing cout<<"entering SiPixelActionExecutor::fillFEDErrorSummary..."<<endl;
748  string currDir = bei->pwd();
749  string prefix;
750  if(source_type_==0) prefix="SUMRAW";
751  else if(source_type_==20) prefix="SUMOFF";
752 
753  if (currDir.find(dir_name) != string::npos) {
754  vector<MonitorElement*> sum_mes;
755  for (vector<string>::const_iterator iv = me_names.begin();
756  iv != me_names.end(); iv++) {
757  bool isBooked = false;
758  vector<string> contents = bei->getMEs();
759  for (vector<string>::const_iterator im = contents.begin(); im != contents.end(); im++)
760  if ((*im).find(*iv) != string::npos) isBooked = true;
761  if(source_type_==5||source_type_==6){
762  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
763  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
764  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
765  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap"||
766  (*iv)=="FedChLErrArray"||(*iv)=="FedChNErrArray"||(*iv)=="FedETypeNErrArray")
767  prefix="SUMRAW";
768  }
769  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
770  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
771  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
772  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap"){
773  string tag = prefix + "_" + (*iv) + "_FEDErrors";
774  MonitorElement* temp = getFEDSummaryME(bei, tag);
775  sum_mes.push_back(temp);
776  }else if((*iv)=="FedChLErrArray"||(*iv)=="FedChNErrArray"||(*iv)=="FedETypeNErrArray"){
777  string tag = prefix + "_" + (*iv);
779  if((*iv)=="FedChLErrArray") {if (!isBooked) temp = bei->book2D("FedChLErrArray","Type of last error",40,-0.5,39.5,37,0.,37.);
780  else{
781  string fullpathname = bei->pwd() + "/" + (*iv);
782  temp = bei->get(fullpathname);
783  temp->Reset();}} //If I don't reset this one, then I instead start adding error codes..
784  if((*iv)=="FedChNErrArray") {if (!isBooked) temp = bei->book2D("FedChNErrArray","Total number of errors",40,-0.5,39.5,37,0.,37.);
785  else{
786  string fullpathname = bei->pwd() + "/" + (*iv);
787  temp = bei->get(fullpathname);
788  temp->Reset();}} //If I don't reset this one, then I instead start adding error codes..
789  if((*iv)=="FedETypeNErrArray"){
790  if(!isBooked){
791  temp = bei->book2D("FedETypeNErrArray","Number of each error type",40,-0.5,39.5,21,0.,21.);
792  temp->setBinLabel(1,"ROC of 25",2);
793  temp->setBinLabel(2,"Gap word",2);
794  temp->setBinLabel(3,"Dummy word",2);
795  temp->setBinLabel(4,"FIFO full",2);
796  temp->setBinLabel(5,"Timeout",2);
797  temp->setBinLabel(6,"Stack full",2);
798  temp->setBinLabel(7,"Pre-cal issued",2);
799  temp->setBinLabel(8,"Trigger clear or sync",2);
800  temp->setBinLabel(9,"No token bit",2);
801  temp->setBinLabel(10,"Overflow",2);
802  temp->setBinLabel(11,"FSM error",2);
803  temp->setBinLabel(12,"Invalid #ROCs",2);
804  temp->setBinLabel(13,"Event number",2);
805  temp->setBinLabel(14,"Slink header",2);
806  temp->setBinLabel(15,"Slink trailer",2);
807  temp->setBinLabel(16,"Event size",2);
808  temp->setBinLabel(17,"Invalid channel#",2);
809  temp->setBinLabel(18,"ROC value",2);
810  temp->setBinLabel(19,"Dcol or pixel value",2);
811  temp->setBinLabel(20,"Readout order",2);
812  temp->setBinLabel(21,"CRC error",2);
813  }
814  else{
815  string fullpathname = bei->pwd() + "/" + (*iv);
816  temp = bei->get(fullpathname);
817  temp->Reset();} //If I don't reset this one, then I instead start adding error codes..
818  }
819  sum_mes.push_back(temp);
820  }
821  }
822  if (sum_mes.size() == 0) {
823  edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ;
824  return;
825  }
826  vector<string> subdirs = bei->getSubdirs();
827  int ndet = 0;
828  for (vector<string>::const_iterator it = subdirs.begin();
829  it != subdirs.end(); it++) {
830  if ( (*it).find("FED_") == string::npos) continue;
831  bei->cd(*it);
832  string fedid = (*it).substr((*it).find("_")+1);
833  std::istringstream isst;
834  isst.str(fedid);
835  isst>>ndet; ndet++;
836  vector<string> contents = bei->getMEs();
837 
838  for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin();
839  isum != sum_mes.end(); isum++) {
840  for (vector<string>::const_iterator im = contents.begin();
841  im != contents.end(); im++) {
842  if(((*im).find("FedChNErrArray_")!=std::string::npos && (*isum)->getName().find("FedChNErrArray")!=std::string::npos) ||
843  ((*im).find("FedChLErrArray_")!=std::string::npos && (*isum)->getName().find("FedChLErrArray")!=std::string::npos) ||
844  ((*im).find("FedETypeNErrArray_")!=std::string::npos && (*isum)->getName().find("FedETypeNErrArray")!=std::string::npos)){
845  string fullpathname = bei->pwd() + "/" + (*im);
846  MonitorElement * me = bei->get(fullpathname);
847  if(me && me->getIntValue()>0){
848  for(int i=0; i!=37; i++){
849  int n = (*im).find("_"); n++;
850  string channel_str = (*im).substr(n);
851  std::istringstream jsst;
852  jsst.str(channel_str);
853  int channel=-1;
854  jsst>>channel;
855  if(channel==i){
856  if((*im).find("FedETypeNErrArray_")!=std::string::npos && i<21) (*isum)->Fill(ndet-1,i,me->getIntValue());
857  else (*isum)->Fill(ndet-1,i,me->getIntValue());
858  }
859  }
860  }
861  }
862  string sname = ((*isum)->getName());
863  string tname = " ";
864  tname = sname.substr(7,(sname.find("_",7)-6));
865  if (((*im)).find(tname) == 0) {
866  string fullpathname = bei->pwd() + "/" + (*im);
867  MonitorElement * me = bei->get(fullpathname);
868 
869  if (me){
870  if(me->getMean()>0.){
871  if (sname.find("_NErrors_")!=string::npos){
872  string path1 = fullpathname;
873  path1 = path1.replace(path1.find("NErrors"),7,"errorType");
874  MonitorElement * me1 = bei->get(path1);
875  bool notReset=true;
876  if(me1){
877  for(int jj=1; jj<16; jj++){
878  if(me1->getBinContent(jj)>0.){
879  if(jj==6){ //errorType=30 (reset)
880  string path2 = path1;
881  path2 = path2.replace(path2.find("errorType"),9,"TBMMessage");
882  MonitorElement * me2 = bei->get(path2);
883  if(me2) if(me2->getBinContent(6)>0. || me2->getBinContent(7)>0.) notReset=false;
884  }
885  }
886  }
887  }
888  if(notReset) (*isum)->setBinContent(ndet, (*isum)->getBinContent(ndet) + me1->getEntries());
889  }else (*isum)->setBinContent(ndet, (*isum)->getBinContent(ndet) + me->getEntries());
890  }
891  (*isum)->setAxisTitle("FED #",1);
892  string title = " ";
893  title = sname.substr(7,(sname.find("_",7)-7)) + " per FED";
894  (*isum)->setAxisTitle(title,2);
895  }
896  break;
897  }
898  }
899  }
900  bei->goUp();
901  }
902  } else {
903  vector<string> subdirs = bei->getSubdirs();
904  for (vector<string>::const_iterator it = subdirs.begin();
905  it != subdirs.end(); it++) {
906  if((*it).find("Endcap")!=string::npos ||
907  (*it).find("Barrel")!=string::npos) continue;
908  bei->cd(*it);
909  fillFEDErrorSummary(bei, dir_name, me_names);
910  bei->goUp();
911  }
912  }
913  //printing cout<<"...leaving SiPixelActionExecutor::fillFEDErrorSummary!"<<endl;
914 }
915 
916 
917 //=============================================================================================================
919  vector<string>& me_names,
920  bool isUpgrade) {
921 // cout<<"Entering SiPixelActionExecutor::fillGrandBarrelSummaryHistos...:"<<me_names.size()<<endl;
922  vector<MonitorElement*> gsum_mes;
923  string currDir = bei->pwd();
924  string path_name = bei->pwd();
925  string dir_name = path_name.substr(path_name.find_last_of("/")+1);
926 // cout<<"I am in "<<path_name<<" now."<<endl;
927  if ((dir_name.find("DQMData") == 0) ||
928  (dir_name.find("Pixel") == 0) ||
929  (dir_name.find("AdditionalPixelErrors") == 0) ||
930  (dir_name.find("Endcap") == 0) ||
931  (dir_name.find("HalfCylinder") == 0) ||
932  (dir_name.find("Disk") == 0) ||
933  (dir_name.find("Blade") == 0) ||
934  (dir_name.find("Panel") == 0) ) return;
935  vector<string> subdirs = bei->getSubdirs();
936  int nDirs = subdirs.size();
937  int iDir =0;
938  int nbin = 0;
939  int nbin_i = 0;
940  int nbin_subdir = 0;
941  int cnt=0;
942  bool first_subdir = true;
943  for (vector<string>::const_iterator it = subdirs.begin();
944  it != subdirs.end(); it++) {
945  cnt++;
946  bei->cd(*it);
947 // cout << "--- " << cnt << "\t" << bei->pwd() << endl;
948  vector<string> contents = bei->getMEs();
949 
950  bei->goUp();
951 
952  string prefix;
953  if(source_type_==0) prefix="SUMRAW";
954  else if (source_type_==1) prefix="SUMDIG";
955  else if (source_type_==2) prefix="SUMCLU";
956  else if (source_type_==3) prefix="SUMTRK";
957  else if (source_type_==4) prefix="SUMHIT";
958  else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
959  else if (source_type_==20) prefix="SUMOFF";
960 
961 
962  for (vector<string>::const_iterator im = contents.begin();
963  im != contents.end(); im++) {
964 // cout<<"A: iterating over "<<(*im)<<" now:"<<endl;
965  for (vector<string>::const_iterator iv = me_names.begin();
966  iv != me_names.end(); iv++) {
967  string var = "_" + (*iv) + "_";
968 // cout<<"\t B: iterating over "<<(*iv)<<" now, var is set to: "<<var<<endl;
969  if ((*im).find(var) != string::npos) {
970  if((var=="_charge_" || var=="_nclusters_" || var=="_size_" || var=="_sizeX_" || var=="_sizeY_") &&
971  (*im).find("Track_")!=string::npos) continue;
972 // cout << "Looking into " << (*iv) << endl;
973  string full_path = (*it) + "/" +(*im);
974  MonitorElement * me = bei->get(full_path.c_str());
975  if (!me) continue;
976  if(source_type_==5||source_type_==6){
977  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
978  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
979  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
980  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
981  prefix="SUMRAW";
982  else if((*iv)=="ndigis"||(*iv)=="adc" ||
983  (*iv)=="ndigisFREQ" || (*iv)=="adcCOMB")
984  prefix="SUMDIG";
985  else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
986  (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
987  (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
988  prefix="SUMCLU";
989  if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
990  else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
991  (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
992  prefix="SUMTRK";
993  else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
994  prefix="SUMHIT";
995  else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
996  (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
997  (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
998  (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
999  (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
1000  (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
1001  (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
1002  (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
1003  (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
1004  (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
1005  (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
1006  (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
1007  (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
1008  (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
1009  (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
1010  (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix" ||
1011  (*iv)=="SiPixelErrorsCalibDigis_NCalibErrors" )
1012  prefix="SUMCAL";
1013  } // end source_type if
1014 
1015  // bugfix: gsum_mes is filled using the contents of me_names. Proceeding with each entry in me_names.
1016  /*
1017  int actual_size = gsum_mes.size();
1018  int wanted_size = me_names.size();
1019  // printing cout << actual_size << "\t" << wanted_size << endl;
1020  if (actual_size != wanted_size) { */
1021  if (first_subdir && !isUpgrade){
1022 // bool create_me = true;
1023  nbin = me->getTH1F()->GetNbinsX();
1024  string me_name = prefix + "_" + (*iv) + "_" + dir_name;
1025  if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
1026  else if(prefix=="SUMOFF" && dir_name=="Barrel") nbin=192;
1027  else if((*iv)=="adcCOMB") nbin=256;
1028  else if(dir_name=="Barrel") nbin=768;
1029  else if(prefix=="SUMOFF" && dir_name.find("Shell")!=string::npos) nbin=48;
1030  else if(dir_name.find("Shell")!=string::npos) nbin=192;
1031  else nbin=nbin*nDirs;
1032 
1033  getGrandSummaryME(bei, nbin, me_name, gsum_mes);
1034  } else if (first_subdir && isUpgrade){
1035 // bool create_me = true;
1036  nbin = me->getTH1F()->GetNbinsX();
1037  string me_name = prefix + "_" + (*iv) + "_" + dir_name;
1038  if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
1039  else if(prefix=="SUMOFF" && dir_name=="Barrel") nbin=296;
1040  else if((*iv)=="adcCOMB") nbin=256;
1041  else if(dir_name=="Barrel") nbin=1184;
1042  else if(prefix=="SUMOFF" && dir_name.find("Shell")!=string::npos) nbin=74;
1043  else if(dir_name.find("Shell")!=string::npos) nbin=296;
1044  else nbin=nbin*nDirs;
1045 
1046  getGrandSummaryME(bei, nbin, me_name, gsum_mes);
1047  }
1048  /*
1049  for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
1050  igm !=gsum_mes.end(); igm++) {
1051  // To be further optimized
1052  if( (*iv).find("Clust") != string::npos && (*igm)->getName().find(me_name) != string::npos ) create_me = false; //cout << "Already have it" << endl;
1053  }
1054 
1055  // printing cout<<"me_name to be created= "<<me_name<<endl;
1056  if(create_me) getGrandSummaryME(bei, nbin, me_name, gsum_mes);
1057  }
1058  */
1059  // end bugfix: gsum_mes.
1060 
1061 
1062  for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
1063  igm != gsum_mes.end(); igm++) {
1064 // cout<<"\t \t C: iterating over "<<(*igm)->getName()<<" now:"<<endl;
1065  if ((*igm)->getName().find(var) != string::npos) {
1066 // cout<<"\t \t D: Have the correct var now!"<<endl;
1067  if(prefix=="SUMOFF") (*igm)->setAxisTitle("Ladders",1);
1068  else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
1069  else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Cluster charge [kilo electrons]",1);
1070  else (*igm)->setAxisTitle("Modules",1);
1071 
1072  // Setting title
1073 
1074  string title="";
1075  if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMOFF") title = "Total number of errors per Ladder";
1076  else if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMRAW") title = "Total number of errors per Module";
1077  else if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Ladder";
1078  else if((*igm)->getName().find("FREQ_") != string::npos && prefix!="SUMOFF") title = "NEvents with digis per Module";
1079  else if((*igm)->getName().find("FREQ_") != string::npos && prefix=="SUMOFF") title = "NEvents with digis per Ladder/Blade";
1080  else if((*igm)->getName().find("adcCOMB_") != string::npos) title = "NDigis";
1081  else if((*igm)->getName().find("chargeCOMB_") != string::npos) title = "NClusters";
1082  else title = "mean " + (*iv) + " per Module";
1083  (*igm)->setAxisTitle(title,2);
1084 
1085  // Setting binning
1086  if (!isUpgrade) {
1087  if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
1088  nbin_subdir=128;
1089  }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
1090  nbin_subdir=100;
1091  }else if((*igm)->getName().find("Ladder") != string::npos){
1092  nbin_i=0; nbin_subdir=4;
1093  }else if((*igm)->getName().find("Layer") != string::npos){
1094  nbin_i=(cnt-1)*4; nbin_subdir=4;
1095  }else if((*igm)->getName().find("Shell") != string::npos){
1096  if(prefix!="SUMOFF"){
1097  if(iDir==0){ nbin_i=0; nbin_subdir=40; }
1098  else if(iDir==1){ nbin_i=40; nbin_subdir=64; }
1099  else if(iDir==2){ nbin_i=104; nbin_subdir=88; }
1100  }else{
1101  if(iDir==0){ nbin_i=0; nbin_subdir=10; }
1102  else if(iDir==1){ nbin_i=10; nbin_subdir=16; }
1103  else if(iDir==2){ nbin_i=26; nbin_subdir=22; }
1104  }
1105  }else if((*igm)->getName().find("Barrel") != string::npos){
1106  if(prefix!="SUMOFF"){
1107  if(iDir==0){ nbin_i=0; nbin_subdir=192; }
1108  else if(iDir==1){ nbin_i=192; nbin_subdir=192; }
1109  else if(iDir==2){ nbin_i=384; nbin_subdir=192; }
1110  else if(iDir==3){ nbin_i=576; nbin_subdir=192; }
1111  }else{
1112  if(iDir==0){ nbin_i=0; nbin_subdir=48; }
1113  else if(iDir==1){ nbin_i=48; nbin_subdir=48; }
1114  else if(iDir==2){ nbin_i=96; nbin_subdir=48; }
1115  else if(iDir==3){ nbin_i=144; nbin_subdir=48; }
1116  }
1117  }
1118  } else if (isUpgrade) {
1119  if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
1120  nbin_subdir=128;
1121  }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
1122  nbin_subdir=100;
1123  }else if((*igm)->getName().find("Ladder") != string::npos){
1124  nbin_i=0; nbin_subdir=4;
1125  }else if((*igm)->getName().find("Layer") != string::npos){
1126  nbin_i=(cnt-1)*4; nbin_subdir=4;
1127  }else if((*igm)->getName().find("Shell") != string::npos){
1128  if(prefix!="SUMOFF"){
1129  if(iDir==0){ nbin_i=0; nbin_subdir=24; }//40(2*20)-->24(2*12)
1130  else if(iDir==1){ nbin_i=24; nbin_subdir=56; }//64(32*2)-->56(2*28)
1131  else if(iDir==2){ nbin_i=80; nbin_subdir=88; }//88(44*2)-->same88(44*2)
1132  else if(iDir==3){ nbin_i=168; nbin_subdir=128; }
1133  }else{
1134  if(iDir==0){ nbin_i=0; nbin_subdir=6; }//10-->6
1135  else if(iDir==1){ nbin_i=6; nbin_subdir=14; }//16-->14
1136  else if(iDir==2){ nbin_i=20; nbin_subdir=22; }//22-->same22
1137  else if(iDir==3){ nbin_i=42; nbin_subdir=32; }
1138  }
1139  }else if((*igm)->getName().find("Barrel") != string::npos){
1140  if(prefix!="SUMOFF"){
1141  if(iDir==0){ nbin_i=0; nbin_subdir=296; }//192=76 8/4-->296=1184/4
1142  else if(iDir==1){ nbin_i=296; nbin_subdir=296; }//296*2,*3,*4=1184
1143  else if(iDir==2){ nbin_i=592; nbin_subdir=296; }
1144  else if(iDir==3){ nbin_i=888; nbin_subdir=296; }
1145  else if(iDir==4){ nbin_i=1184; nbin_subdir=296; }
1146  }else{
1147  if(iDir==0){ nbin_i=0; nbin_subdir=74; }//48=192/4-->74=296/4
1148  else if(iDir==1){ nbin_i=74; nbin_subdir=74; }//74*2,...*4=296
1149  else if(iDir==2){ nbin_i=148; nbin_subdir=74; }
1150  else if(iDir==3){ nbin_i=222; nbin_subdir=74; }
1151  else if(iDir==4){ nbin_i=296; nbin_subdir=74; }
1152  }
1153  }
1154  }
1155 
1156  if((*igm)->getName().find("ndigisFREQ")==string::npos)
1157  {
1158  if(((*igm)->getName().find("adcCOMB")!=string::npos && me->getName().find("adcCOMB")!=string::npos)
1159  || ((*igm)->getName().find("chargeCOMB")!=string::npos && me->getName().find("chargeCOMB")!=string::npos))
1160  {
1161  (*igm)->getTH1F()->Add(me->getTH1F());
1162  }else if(((*igm)->getName().find("charge_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1163  me->getName().find("charge_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1164  ((*igm)->getName().find("nclusters_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1165  me->getName().find("nclusters_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1166  ((*igm)->getName().find("size_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1167  me->getName().find("size_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1168  ((*igm)->getName().find("charge_OffTrack_")!=string::npos && me->getName().find("charge_OffTrack_")!=string::npos) ||
1169  ((*igm)->getName().find("nclusters_OffTrack_")!=string::npos && me->getName().find("nclusters_OffTrack_")!=string::npos) ||
1170  ((*igm)->getName().find("size_OffTrack_")!=string::npos && me->getName().find("size_OffTrack_")!=string::npos) ||
1171  ((*igm)->getName().find("charge_OnTrack_")!=string::npos && me->getName().find("charge_OnTrack_")!=string::npos) ||
1172  ((*igm)->getName().find("nclusters_OnTrack_")!=string::npos && me->getName().find("nclusters_OnTrack_")!=string::npos) ||
1173  ((*igm)->getName().find("size_OnTrack_")!=string::npos && me->getName().find("size_OnTrack_")!=string::npos) ||
1174  ((*igm)->getName().find("charge_")==string::npos && (*igm)->getName().find("nclusters_")==string::npos &&
1175  (*igm)->getName().find("size_")==string::npos)){
1176  for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
1177  }
1178  }
1179  else if(me->getName().find("ndigisFREQ")!=string::npos)
1180  {
1181  for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
1182  }
1183  } // end var in igm (gsum_mes)
1184  } // end igm loop
1185  } // end var in im (contents)
1186  } // end of iv loop
1187  } // end of im loop
1188  iDir++;
1189  first_subdir = false; // We are done processing the first directory, we don't add any new MEs in the future passes.
1190  } // end of it loop (subdirs)
1191 // cout<<"...leaving SiPixelActionExecutor::fillGrandBarrelSummaryHistos!"<<endl;
1192 }
1193 
1194 //=============================================================================================================
1196  vector<string>& me_names,
1197  bool isUpgrade) {
1198  //printing cout<<"Entering SiPixelActionExecutor::fillGrandEndcapSummaryHistos..."<<endl;
1199  vector<MonitorElement*> gsum_mes;
1200  string currDir = bei->pwd();
1201  string path_name = bei->pwd();
1202  string dir_name = path_name.substr(path_name.find_last_of("/")+1);
1203  if ((dir_name.find("DQMData") == 0) ||
1204  (dir_name.find("Pixel") == 0) ||
1205  (dir_name.find("AdditionalPixelErrors") == 0) ||
1206  (dir_name.find("Barrel") == 0) ||
1207  (dir_name.find("Shell") == 0) ||
1208  (dir_name.find("Layer") == 0) ||
1209  (dir_name.find("Ladder") == 0) ) return;
1210  vector<string> subdirs = bei->getSubdirs();
1211  int iDir =0;
1212  int nbin = 0;
1213  int nbin_i = 0;
1214  int nbin_subdir = 0;
1215  int cnt=0;
1216  bool first_subdir = true;
1217  for (vector<string>::const_iterator it = subdirs.begin();
1218  it != subdirs.end(); it++) {
1219  cnt++;
1220  bei->cd(*it);
1221  vector<string> contents = bei->getMEs();
1222  bei->goUp();
1223 
1224  string prefix;
1225  if(source_type_==0) prefix="SUMRAW";
1226  else if (source_type_==1) prefix="SUMDIG";
1227  else if (source_type_==2) prefix="SUMCLU";
1228  else if (source_type_==3) prefix="SUMTRK";
1229  else if (source_type_==4) prefix="SUMHIT";
1230  else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
1231  else if (source_type_==20) prefix="SUMOFF";
1232 
1233  for (vector<string>::const_iterator im = contents.begin();
1234  im != contents.end(); im++) {
1235  for (vector<string>::const_iterator iv = me_names.begin();
1236  iv != me_names.end(); iv++) {
1237  string var = "_" + (*iv) + "_";
1238  if ((*im).find(var) != string::npos) {
1239  if((var=="_charge_" || var=="_nclusters_" || var=="_size_" || var=="_sizeX_" || var=="_sizeY_") &&
1240  (*im).find("Track_")!=string::npos) continue;
1241  string full_path = (*it) + "/" +(*im);
1242  MonitorElement * me = bei->get(full_path.c_str());
1243  if (!me) continue;
1244  if(source_type_==5||source_type_==6){
1245  if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
1246  (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
1247  (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
1248  (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap")
1249  prefix="SUMRAW";
1250  else if((*iv)=="ndigis"||(*iv)=="adc" ||
1251  (*iv)=="ndigisFREQ"||(*iv)=="adcCOMB")
1252  prefix="SUMDIG";
1253  else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
1254  (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
1255  (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
1256  prefix="SUMCLU";
1257  if(currDir.find("Track")!=string::npos) prefix="SUMTRK";
1258  else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
1259  (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
1260  prefix="SUMTRK";
1261  else if((*iv)=="ClustX"||(*iv)=="ClustY"||(*iv)=="nRecHits"||(*iv)=="ErrorX"||(*iv)=="ErrorY")
1262  prefix="SUMHIT";
1263  else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
1264  (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
1265  (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
1266  (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
1267  (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
1268  (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
1269  (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
1270  (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
1271  (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
1272  (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
1273  (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
1274  (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
1275  (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
1276  (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
1277  (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
1278  (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix"||
1279  (*iv) == "SiPixelErrorsCalibDigis_NCalibErrors")
1280  prefix="SUMCAL";
1281  }
1282 
1283  // bugfix: gsum_mes is filled using the contents of me_names. Proceeding with each entry in me_names.
1284  /*
1285  int actual_size = gsum_mes.size();
1286  int wanted_size = me_names.size();
1287  if (actual_size != wanted_size) { */
1288  if (first_subdir && !isUpgrade){
1289 // bool create_me = true;
1290  nbin = me->getTH1F()->GetNbinsX();
1291  string me_name = prefix + "_" + (*iv) + "_" + dir_name;
1292  if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
1293  else if(prefix=="SUMOFF" && dir_name=="Endcap") nbin=96;
1294  else if(dir_name=="Endcap") nbin=672;
1295  else if(prefix=="SUMOFF" && dir_name.find("HalfCylinder")!=string::npos) nbin=24;
1296  else if(dir_name.find("HalfCylinder")!=string::npos) nbin=168;
1297  else if(prefix=="SUMOFF" && dir_name.find("Disk")!=string::npos) nbin=12;
1298  else if(dir_name.find("Disk")!=string::npos) nbin=84;
1299  else if(dir_name.find("Blade")!=string::npos) nbin=7;
1300  //else if(dir_name.find("Panel_1")!=string::npos) nbin=4;
1301  //else if(dir_name.find("Panel_2")!=string::npos) nbin=3;
1302  //cout << dir_name.c_str() << "\t" << nbin << endl;
1303  getGrandSummaryME(bei, nbin, me_name, gsum_mes);
1304  } else if(first_subdir && isUpgrade){
1305  nbin = me->getTH1F()->GetNbinsX();
1306  string me_name = prefix + "_" + (*iv) + "_" + dir_name;
1307  if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
1308  else if(prefix=="SUMOFF" && dir_name=="Endcap") nbin=336;
1309  else if(dir_name=="Endcap") nbin=672;
1310  else if(prefix=="SUMOFF" && dir_name.find("HalfCylinder")!=string::npos) nbin=84;
1311  else if(dir_name.find("HalfCylinder")!=string::npos) nbin=168;
1312  else if(prefix=="SUMOFF" && dir_name.find("Disk")!=string::npos) nbin=28;
1313  else if(dir_name.find("Disk")!=string::npos) nbin=56;
1314  else if(dir_name.find("Blade")!=string::npos) nbin=2;
1315  getGrandSummaryME(bei, nbin, me_name, gsum_mes);
1316  }
1317  /*
1318 
1319  for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
1320  igm !=gsum_mes.end(); igm++) {
1321  // To be further optimized
1322  if( (*iv).find("Clust") != string::npos && (*igm)->getName().find(me_name) != string::npos ) create_me = false; //cout << "Already have it" << endl;
1323  }
1324 
1325  // printing cout<<"me_name to be created= "<<me_name<<endl;
1326  if(create_me) getGrandSummaryME(bei, nbin, me_name, gsum_mes);
1327  }
1328  */
1329  // end bugfix: gsum_mes.
1330 
1331  for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
1332  igm != gsum_mes.end(); igm++) {
1333  if ((*igm)->getName().find(var) != string::npos) {
1334  if(prefix=="SUMOFF") (*igm)->setAxisTitle("Blades",1);
1335  else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
1336  else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Cluster charge [kilo electrons]",1);
1337  else (*igm)->setAxisTitle("Modules",1);
1338  string title="";
1339  if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMOFF") title = "Total number of errors per Blade";
1340  else if((*igm)->getName().find("NErrors_") != string::npos && prefix=="SUMRAW") title = "Total number of errors per Module";
1341  else if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Blade";
1342  else if((*igm)->getName().find("FREQ_") != string::npos) title = "NEvents with digis per Module";
1343  else if((*igm)->getName().find("adcCOMB_")!=string::npos) title = "NDigis";
1344  else if((*igm)->getName().find("chargeCOMB_")!=string::npos) title = "NClusters";
1345  else title = "mean " + (*iv) + " per Module";
1346  (*igm)->setAxisTitle(title,2);
1347  nbin_i=0;
1348  if (!isUpgrade) {
1349  if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
1350  nbin_subdir=128;
1351  }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
1352  nbin_subdir=100;
1353  }else if((*igm)->getName().find("Panel_") != string::npos){
1354  nbin_subdir=7;
1355 // }else if((*igm)->getName().find("Panel_1") != string::npos){
1356 // nbin_subdir=4;
1357 // }else if((*igm)->getName().find("Panel_2") != string::npos){
1358 // nbin_subdir=3;
1359  }else if((*igm)->getName().find("Blade") != string::npos){
1360  if((*im).find("_1") != string::npos) nbin_subdir=4;
1361  if((*im).find("_2") != string::npos) {nbin_i=4; nbin_subdir=3;}
1362  }else if((*igm)->getName().find("Disk") != string::npos){
1363  nbin_i=((cnt-1)%12)*7; nbin_subdir=7;
1364  }else if((*igm)->getName().find("HalfCylinder") != string::npos){
1365  if(prefix!="SUMOFF"){
1366  nbin_subdir=84;
1367  if((*im).find("_2") != string::npos) nbin_i=84;
1368  }else{
1369  nbin_subdir=12;
1370  if((*im).find("_2") != string::npos) nbin_i=12;
1371  }
1372  }else if((*igm)->getName().find("Endcap") != string::npos){
1373  if(prefix!="SUMOFF"){
1374  nbin_subdir=168;
1375  if((*im).find("_mO") != string::npos) nbin_i=168;
1376  if((*im).find("_pI") != string::npos) nbin_i=336;
1377  if((*im).find("_pO") != string::npos) nbin_i=504;
1378  }else{
1379  nbin_subdir=24;
1380  if((*im).find("_mO") != string::npos) nbin_i=24;
1381  if((*im).find("_pI") != string::npos) nbin_i=48;
1382  if((*im).find("_pO") != string::npos) nbin_i=72;
1383  }
1384  }
1385  } else if (isUpgrade) {
1386  if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
1387  nbin_subdir=128;
1388  }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
1389  nbin_subdir=100;
1390  }else if((*igm)->getName().find("Panel_") != string::npos){
1391  nbin_subdir=2;
1392  // }else if((*igm)->getName().find("Panel_1") != string::npos){
1393  // nbin_subdir=4;
1394  // }else if((*igm)->getName().find("Panel_2") != string::npos){
1395  // nbin_subdir=3;
1396  }else if((*igm)->getName().find("Blade") != string::npos){
1397  if((*im).find("_1") != string::npos) nbin_subdir=1;
1398  if((*im).find("_2") != string::npos) {nbin_i=1; nbin_subdir=1;}
1399  }else if((*igm)->getName().find("Disk") != string::npos){
1400  nbin_i=((cnt-1)%28)*2; nbin_subdir=2;
1401  }else if((*igm)->getName().find("HalfCylinder") != string::npos){
1402  if(prefix!="SUMOFF"){
1403  nbin_subdir=56;
1404  if((*im).find("_2") != string::npos) nbin_i=56;
1405  if((*im).find("_3") != string::npos) nbin_i=112;
1406  }else{
1407  nbin_subdir=28;
1408  if((*im).find("_2") != string::npos) nbin_i=28;
1409  if((*im).find("_3") != string::npos) nbin_i=56;
1410  }
1411  }else if((*igm)->getName().find("Endcap") != string::npos){
1412  if(prefix!="SUMOFF"){
1413  nbin_subdir=168;
1414  if((*im).find("_mO") != string::npos) nbin_i=168;
1415  if((*im).find("_pI") != string::npos) nbin_i=336;
1416  if((*im).find("_pO") != string::npos) nbin_i=504;
1417  }else{
1418  nbin_subdir=84;
1419  if((*im).find("_mO") != string::npos) nbin_i=84;
1420  if((*im).find("_pI") != string::npos) nbin_i=168;
1421  if((*im).find("_pO") != string::npos) nbin_i=252;
1422  }
1423  }
1424  }
1425 
1426  // for (int k = 1; k < nbin_subdir+1; k++) {
1427  if((*igm)->getName().find("ndigisFREQ")==string::npos){
1428  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)){
1429  (*igm)->getTH1F()->Add(me->getTH1F());
1430  }else if(((*igm)->getName().find("charge_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1431  me->getName().find("charge_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1432  ((*igm)->getName().find("nclusters_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1433  me->getName().find("nclusters_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1434  ((*igm)->getName().find("size_")!=string::npos && (*igm)->getName().find("Track_")==string::npos &&
1435  me->getName().find("size_")!=string::npos && me->getName().find("Track_")==string::npos) ||
1436  ((*igm)->getName().find("charge_OffTrack_")!=string::npos && me->getName().find("charge_OffTrack_")!=string::npos) ||
1437  ((*igm)->getName().find("nclusters_OffTrack_")!=string::npos && me->getName().find("nclusters_OffTrack_")!=string::npos) ||
1438  ((*igm)->getName().find("size_OffTrack_")!=string::npos && me->getName().find("size_OffTrack_")!=string::npos) ||
1439  ((*igm)->getName().find("charge_OnTrack_")!=string::npos && me->getName().find("charge_OnTrack_")!=string::npos) ||
1440  ((*igm)->getName().find("nclusters_OnTrack_")!=string::npos && me->getName().find("nclusters_OnTrack_")!=string::npos) ||
1441  ((*igm)->getName().find("size_OnTrack_")!=string::npos && me->getName().find("size_OnTrack_")!=string::npos) ||
1442  ((*igm)->getName().find("charge_")==string::npos && (*igm)->getName().find("nclusters_")==string::npos &&
1443  (*igm)->getName().find("size_")==string::npos)){
1444  for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
1445  }
1446  }else if(me->getName().find("ndigisFREQ")!=string::npos){
1447  for (int k = 1; k < nbin_subdir+1; k++) if(me->getBinContent(k) > 0) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
1448  }
1449  // }// for
1450 
1451  }
1452  }
1453  }
1454  }
1455  }
1456 
1457  iDir++;
1458  first_subdir = false; // We are done processing the first directory, we don't add any new MEs in the future passes.
1459  } // end for it (subdirs)
1460 }
1461 //=============================================================================================================
1462 //
1463 // -- Get Summary ME
1464 //
1466  int nbin,
1467  string& me_name,
1468  vector<MonitorElement*> & mes) {
1469  //printing cout<<"Entering SiPixelActionExecutor::getGrandSummaryME for: "<<me_name<<endl;
1470  if((bei->pwd()).find("Pixel")==string::npos) return; // If one doesn't find pixel
1471  vector<string> contents = bei->getMEs();
1472 
1473  for (vector<string>::const_iterator it = contents.begin();
1474  it != contents.end(); it++) {
1475  //printing cout<<"in grand summary me: "<<me_name<<","<<(*it)<<endl;
1476  if ((*it).find(me_name) == 0) {
1477  string fullpathname = bei->pwd() + "/" + me_name;
1478  // cout << "###\t" << fullpathname << endl;
1479  MonitorElement* me = bei->get(fullpathname);
1480 
1481  if (me) {
1482  // cout<<"Found grand ME: "<<fullpathname<<endl;
1483  me->Reset();
1484  mes.push_back(me);
1485  // if printing cout<<"reset and add the following me: "<<me->getName()<<endl;
1486  return;
1487  }
1488  }
1489  }
1490 
1491  // MonitorElement* temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),nbin,1.,nbin+1.);
1492  // if (temp_me) mes.push_back(temp_me);
1493  MonitorElement* temp_me(0);
1494  if(me_name.find("ALLMODS_adcCOMB_")!=string::npos) temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),128,0,256);
1495  else if(me_name.find("ALLMODS_chargeCOMB_")!=string::npos) temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),100,0,200);
1496  else temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),nbin,1.,nbin+1.);
1497  if (temp_me) mes.push_back(temp_me);
1498 
1499  // if(temp_me) cout<<"finally found grand ME: "<<me_name<<endl;
1500 }
1501 
1502 
1503 //=============================================================================================================
1504 //
1505 // -- Get Summary ME
1506 //
1508  string me_name,
1509  bool isUpgrade) {
1510  //printing cout<<"Entering SiPixelActionExecutor::getSummaryME for: "<<me_name<<endl;
1511  MonitorElement* me = 0;
1512  if((bei->pwd()).find("Pixel")==string::npos) return me;
1513  vector<string> contents = bei->getMEs();
1514 
1515  for (vector<string>::const_iterator it = contents.begin();
1516  it != contents.end(); it++) {
1517  if ((*it).find(me_name) == 0) {
1518  string fullpathname = bei->pwd() + "/" + (*it);
1519  me = bei->get(fullpathname);
1520 
1521  if (me) {
1522  //printing cout<<"got this ME: "<<fullpathname<<endl;
1523  me->Reset();
1524  return me;
1525  }
1526  }
1527  }
1528  contents.clear();
1529 // cout << me_name.c_str()
1530 // << "\t" << ((me_name.find("SUMOFF")==string::npos)?"true":"false")
1531 // << "\t" << ((me_name.find("Blade_")!= string::npos)?"true":"false")
1532 // << "\t" << ((me_name.find("Layer1_")!=string::npos)?"true":"false")
1533 // << "\t" << ((me_name.find("Layer2_")!=string::npos)?"true":"false")
1534 // << "\t" << ((me_name.find("Layer3_")!=string::npos)?"true":"false")
1535 // << "\t" << ((me_name.find("Disk_")!=string::npos)?"true":"false")
1536 // << endl;
1537  if (!isUpgrade) {
1538  if(me_name.find("SUMOFF")==string::npos){
1539  if(me_name.find("Blade_")!=string::npos)me = bei->book1D(me_name.c_str(), me_name.c_str(),7,1.,8.);
1540  else me = bei->book1D(me_name.c_str(), me_name.c_str(),4,1.,5.);
1541 // if(me_name.find("Panel_2")!=string::npos) me = bei->book1D(me_name.c_str(), me_name.c_str(),3,1.,4.);
1542 // else me = bei->book1D(me_name.c_str(), me_name.c_str(),4,1.,5.);
1543  }else if(me_name.find("Layer_1")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),10,1.,11.);
1544  }else if(me_name.find("Layer_2")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),16,1.,17.);
1545  }else if(me_name.find("Layer_3")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),22,1.,23.);
1546  }else if(me_name.find("Disk_")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),12,1.,13.);
1547  }
1548  }//endifNOTUpgrade
1549  else if (isUpgrade) {
1550  if(me_name.find("SUMOFF")==string::npos){
1551  if(me_name.find("Blade_")!=string::npos)me = bei->book1D(me_name.c_str(), me_name.c_str(),2,1.,3.);
1552  else me = bei->book1D(me_name.c_str(), me_name.c_str(),1,1.,2.);
1553  // if(me_name.find("Panel_2")!=string::npos) me = bei->book1D(me_name.c_str(), me_name.c_str(),3,1.,4.);
1554  // else me = bei->book1D(me_name.c_str(), me_name.c_str(),4,1.,5.);
1555  }else if(me_name.find("Layer_1")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),6,1.,7.);
1556  }else if(me_name.find("Layer_2")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),14,1.,15.);
1557  }else if(me_name.find("Layer_3")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),22,1.,23.);
1558  }else if(me_name.find("Layer_4")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),32,1.,33.);
1559  }else if(me_name.find("Disk_")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),28,1.,29.);
1560  }
1561  }//endifUpgrade
1562 
1563 
1564  // if(me) cout<<"Finally got this ME: "<<me_name<<endl;
1565  //if(me_name.find("ALLMODS_adc_")!=string::npos) me = bei->book1D(me_name.c_str(), me_name.c_str(),256, 0., 256.);
1566 
1567  //printing cout<<"...leaving SiPixelActionExecutor::getSummaryME!"<<endl;
1568  return me;
1569 }
1570 
1571 
1572 //=============================================================================================================
1574  string me_name) {
1575  //printing cout<<"Entering SiPixelActionExecutor::getFEDSummaryME..."<<endl;
1576  MonitorElement* me = 0;
1577  if((bei->pwd()).find("Pixel")==string::npos) return me;
1578  vector<string> contents = bei->getMEs();
1579 
1580  for (vector<string>::const_iterator it = contents.begin();
1581  it != contents.end(); it++) {
1582  if ((*it).find(me_name) == 0) {
1583  string fullpathname = bei->pwd() + "/" + (*it);
1584 
1585  me = bei->get(fullpathname);
1586 
1587  if (me) {
1588  //printing cout<<"got the ME: "<<fullpathname<<endl;
1589  me->Reset();
1590  return me;
1591  }
1592  }
1593  }
1594  contents.clear();
1595  me = bei->book1D(me_name.c_str(), me_name.c_str(),40,-0.5,39.5);
1596  //if(me) cout<<"finally got the ME: "<<me_name<<endl;
1597  return me;
1598  //printing cout<<"...leaving SiPixelActionExecutor::getFEDSummaryME!"<<endl;
1599 }
1600 
1601 //=============================================================================================================
1602 void SiPixelActionExecutor::bookOccupancyPlots(DQMStore* bei, bool hiRes, bool isbarrel) // Polymorphism
1603 {
1604  if(Tier0Flag_) return;
1605  vector<string> subdirs = bei->getSubdirs();
1606  for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++)
1607  {
1608  if(isbarrel && (*it).find("Barrel")==string::npos) continue;
1609  if(!isbarrel && (*it).find("Endcap")==string::npos) continue;
1610 
1611  if((*it).find("Module_")!=string::npos) continue;
1612  if((*it).find("Panel_")!=string::npos) continue;
1613  if((*it).find("Ladder_")!=string::npos) continue;
1614  if((*it).find("Blade_")!=string::npos) continue;
1615  if((*it).find("Layer_")!=string::npos) continue;
1616  if((*it).find("Disk_")!=string::npos) continue;
1617  bei->cd(*it);
1618  bookOccupancyPlots(bei, hiRes, isbarrel);
1619  if(!hiRes){
1620  //occupancyprinting cout<<"booking low res barrel occ plot now!"<<endl;
1621  OccupancyMap = bei->book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (4 pix per bin)",isbarrel?208:130,0.,isbarrel?416.:260.,80,0.,160.);
1622  }else{
1623  //occupancyprinting cout<<"booking high res barrel occ plot now!"<<endl;
1624  OccupancyMap = bei->book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (1 pix per bin)",isbarrel?416:260,0.,isbarrel?416.:260.,160,0.,160.);
1625  }
1626  OccupancyMap->setAxisTitle("Columns",1);
1627  OccupancyMap->setAxisTitle("Rows",2);
1628 
1629  bei->goUp();
1630 
1631  }
1632 
1633 
1634 
1635 }
1636 //=============================================================================================================
1638 
1639  if(Tier0Flag_) return;
1640  // Barrel
1641  bei->cd();
1642  bei->setCurrentFolder("Pixel");
1643  this->bookOccupancyPlots(bei, hiRes, true);
1644 
1645  // Endcap
1646  bei->cd();
1647  bei->setCurrentFolder("Pixel");
1648  this->bookOccupancyPlots(bei, hiRes, false);
1649 
1650 }
1651 
1653  //std::cout<<"entering SiPixelActionExecutor::createOccupancy..."<<std::endl;
1654  if(Tier0Flag_) return;
1655  bei->cd();
1656  fillOccupancy(bei, true);
1657  bei->cd();
1658  fillOccupancy(bei, false);
1659  bei->cd();
1660  //std::cout<<"leaving SiPixelActionExecutor::createOccupancy..."<<std::endl;
1661 }
1662 
1663 //=============================================================================================================
1664 
1666 {
1667  //occupancyprinting cout<<"entering SiPixelActionExecutor::fillOccupancy..."<<std::endl;
1668  if(Tier0Flag_) return;
1669  string currDir = bei->pwd();
1670  string dname = currDir.substr(currDir.find_last_of("/")+1);
1671  //occupancyprinting cout<<"currDir= "<<currDir<< " , dname= "<<dname<<std::endl;
1672 
1673  if(dname.find("Layer_")!=string::npos || dname.find("Disk_")!=string::npos){
1674  vector<string> meVec = bei->getMEs();
1675  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
1676  string full_path = currDir + "/" + (*it);
1677  if(full_path.find("hitmap_siPixelDigis")!=string::npos){ // If we have the hitmap ME
1678  MonitorElement * me = bei->get(full_path);
1679  if (!me) continue;
1680  //occupancyprinting cout << full_path << endl;
1681  string path = full_path;
1682  while (path.find_last_of("/") != 5) // Stop before Pixel/
1683  {
1684  path = path.substr(0,path.find_last_of("/"));
1685  // cout << "\t" << path << endl;
1686  OccupancyMap = bei->get(path + "/" + (isbarrel?"barrel":"endcap") + "OccupancyMap");
1687 
1688  if(OccupancyMap){
1689  for(int i=1; i!=me->getNbinsX()+1; i++) for(int j=1; j!=me->getNbinsY()+1; j++){
1690  float previous = OccupancyMap->getBinContent(i,j);
1691  OccupancyMap->setBinContent(i,j,previous + me->getBinContent(i,j));
1692  }
1693  OccupancyMap->getTH2F()->SetEntries(OccupancyMap->getTH2F()->Integral());
1694  }
1695 
1696  }
1697  }
1698 
1699  }
1700  //bei->goUp();
1701  } else {
1702  //occupancyprinting cout<<"finding subdirs now"<<std::endl;
1703  vector<string> subdirs = bei->getSubdirs();
1704  for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
1705  bei->cd(*it);
1706  //occupancyprinting cout<<"now I am in "<<bei->pwd()<<std::endl;
1707  if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
1708  //occupancyprinting cout<<"calling myself again "<<std::endl;
1709  fillOccupancy(bei, isbarrel);
1710  bei->goUp();
1711  }
1712  }
1713 
1714  //occupancyprinting cout<<"leaving SiPixelActionExecutor::fillOccupancy..."<<std::endl;
1715 
1716 }
1717 //=============================================================================================================
1718 
1719 //
1720 // -- Tracker Map
1721 //
1722 
1724 {
1725  bei->setCurrentFolder("Pixel/Barrel");
1726  std::string partB[] = { "Layer_1", "Layer_2", "Layer_3"};
1727  bei->book2D("TRKMAP_" + name + "_" + partB[0], "TRKMAP_" + name + "_" + partB[0], 20, 1., 21., 8, 1., 9.);
1728  bei->book2D("TRKMAP_" + name + "_" + partB[1], "TRKMAP_" + name + "_" + partB[1], 32, 1., 33., 8, 1., 9.);
1729  bei->book2D("TRKMAP_" + name + "_" + partB[2], "TRKMAP_" + name + "_" + partB[2], 44, 1., 45., 8, 1., 9.);
1730 
1731  bei->setCurrentFolder("Pixel/Endcap");
1732  std::string partE[] = { "Disc_1_M", "Disc_2_M", "Disc_1_P", "Disc_2_P" };
1733  for(Int_t p = 0 ; p < NCyl ; p++)
1734  bei->book2D("TRKMAP_" + name + "_" + partE[p], "TRKMAP_" + name + "_" + partE[p], 24, 1., 25., 7, 1., 8.);
1735 }
1736 
1737 
1739 {
1740 // cout << "Starting with SiPixelActionExecutor::createMaps" << endl;
1741 
1742  Double_t mapB[NLev1][NLev2][NLev3][NLev4];
1743  bei->setCurrentFolder("Pixel/Barrel/");
1744  createMap(mapB, type, bei, ff, true);
1745  Double_t minB = mapMin(mapB, true);
1746  Double_t maxB = mapMax(mapB, true);
1747 
1748 
1749  Double_t mapE[NLev1][NLev2][NLev3][NLev4];
1750  bei->setCurrentFolder("Pixel/Endcap/");
1751  createMap(mapE, type, bei, ff, false);
1752  Double_t minE = mapMin(mapE, false);
1753  Double_t maxE = mapMax(mapE, false);
1754 
1755  Double_t min = minE<=minB?minE:minB;
1756  Double_t max = maxE>=maxB?maxE:maxB;
1757  if(!min)
1758  min = -0.01;
1759 
1760  // prephistosB(histB, mapB, type, min, max);
1761  // prephistosE(histE, mapE, type, min, max);
1762 
1763 
1764  MonitorElement* meB[NLayer];
1765  // TH2F* histB[NLayer];
1766  MonitorElement* meE[NCyl];
1767  // TH2F* histE[NCyl];
1768  bei->setCurrentFolder("Pixel/Barrel");
1769  prephistosB(meB, bei, mapB, name, min, max);
1770  bei->setCurrentFolder("Pixel/Endcap");
1771  prephistosE(meE, bei, mapE, name, min, max);
1772 
1773 // cout << "Done with SiPixelActionExecutor::createMaps" << endl;
1774 }
1775 
1776 //=============================================================================================================
1777 
1779 {
1780  // cout << "Starting with SiPixelActionExecutor::createMap" << endl;
1781  //int createMap(Double_t map[][NLev2][NLev3][NLev4], TString type, TDirectoryFile* dirMain, funcType ff){
1782  vector<string> dirLev1 = bei->getSubdirs();
1783  Int_t i = 0;
1784  for (vector<string>::const_iterator it = dirLev1.begin(); it != dirLev1.end(); it++) // goes over HalfCylinders in Endcap and over Shells in Barrel
1785  {
1786  //cout << "Current Directory: " << *it << endl;
1787  bei->cd(*it);
1788  vector<string> dirLev2 = bei->getSubdirs();
1789  Int_t j = 0;
1790  for (vector<string>::const_iterator it2 = dirLev2.begin(); it2 != dirLev2.end(); it2++) // goes over Disks in Endcap and over Layers in Barrel
1791  {
1792  //cout << "Current Directory: " << *it2 << endl;
1793  bei->cd(*it2);
1794  Int_t k = 0;
1795  vector<string> dirLev3 = bei->getSubdirs();
1796  for (vector<string>::const_iterator it3 = dirLev3.begin(); it3 != dirLev3.end(); it3++) // goes over Blades in Endcap and over Ladders in Barrel
1797  {
1798  //cout << "Current Directory: " << *it3 << endl;
1799  bei->cd(*it3);
1800  if(Tier0Flag_)
1801  for (Int_t l = 0; l < NLev4; l++)
1802  getData(map, type, bei, ff, i, j, k, l);
1803  else
1804  {
1805  Int_t l = 0;
1806  vector<string> dirLev4 = bei->getSubdirs();
1807  for (vector<string>::const_iterator it4 = dirLev4.begin(); it4 != dirLev4.end(); it4++)
1808  {
1809  // cout << "Current Directory: " << *it4 << endl;
1810  bei->cd(*it4);
1811  if (isBarrel)
1812  getData(map, type, bei, ff, i, j, k, l++);
1813  else
1814  {
1815  vector<string> dirLev5 = bei->getSubdirs();
1816  for (vector<string>::const_iterator it5 = dirLev5.begin(); it5 != dirLev5.end(); it5++)
1817  {
1818  // cout << "Current Directory: " << *it5 << endl;
1819  bei->cd(*it5);
1820  getData(map, type, bei, ff, i, j, k, l++);
1821  }
1822  }
1823  }
1824  }
1825  k++;
1826  }
1827  j++;
1828  }
1829  i++;
1830  }
1831 
1832  // cout << "Done with SiPixelActionExecutor::createMap" << endl;
1833  return 0;
1834 }
1835 
1836 //=============================================================================================================
1837 
1838 void SiPixelActionExecutor::getData(Double_t map[][NLev2][NLev3][NLev4], std::string type, DQMStore* bei, funcType ff, Int_t i, Int_t j, Int_t k, Int_t l) {
1839 
1840 // cout << "Starting with SiPixelActionExecutor::getData" << endl;
1841  vector<string> contents = bei->getMEs();
1842  for (vector<string>::const_iterator im = contents.begin(); im != contents.end(); im++)
1843  {
1844  if((*im).find(type + "_") == string::npos){
1845  // cout << "Skip";
1846  continue; // Searching for specific type
1847  }
1848  //cout << "Name: " << *im << endl;
1849  std::string fullpathname = bei->pwd() + "/" + (*im);
1850  MonitorElement* me = bei->get(fullpathname);
1851 
1852  if (me) {
1853  TH1F* histo = me->getTH1F();
1854 
1855  Int_t nbins = histo->GetNbinsX();
1856  // cout << "# of bins: " << nbins << endl;
1857  switch (ff){
1858  case EachBinContent:
1859  map[i][j][k][l] = histo->GetBinContent(l + 1);
1860  break;
1861 
1862  case Entries:
1863  map[i][j][k][l] = histo->GetEntries();
1864  break;
1865 
1866  case Mean:
1867  map[i][j][k][l] = histo->GetMean();
1868  break;
1869 
1870  case Sum:
1871  {
1872  Double_t sum = 0;
1873  for(Int_t m = 0; m < nbins; m++)
1874  sum += histo->GetBinContent(m + 1);
1875  map[i][j][k][l] = sum;
1876  }
1877  break;
1878 
1879  case WeightedSum:
1880  {
1881  Double_t sum = 0;
1882  for(Int_t m = 0; m < nbins; m++)
1883  sum += histo->GetBinContent(m + 1) * histo->GetBinLowEdge(m + 1);
1884  map[i][j][k][l] = sum;
1885  }
1886  break;
1887 
1888  default:
1889  map[i][j][k][l] = 0;
1890  }
1891  }}
1892 // cout << "Done with SiPixelActionExecutor::getData" << endl;
1893 }
1894 
1895 //=============================================================================================================
1896 
1897 void SiPixelActionExecutor::prephistosB(MonitorElement* me[NLayer], DQMStore *bei, const Double_t map[][NLev2][NLev3][NLev4],std::string name, Double_t min, Double_t max){
1898  // cout << "Starting with SiPixelActionExecutor::prephistosB" << endl;
1899  std::string part[] = { "Layer_1", "Layer_2", "Layer_3"};
1900  std::string path = bei->pwd();
1901  for (Int_t i = 0; i < NLayer; i++)
1902  {
1903  std::string fullpath = path + "/" + "TRKMAP_" + name + "_" + part[i];
1904  MonitorElement* temp = bei->get(fullpath);
1905  if(temp)
1906  me[i] = temp;
1907  else
1908  cout << "Problem: " << fullpath << endl;
1909  }
1910 
1911  for(Int_t p = 0 ; p < NLayer ; p++){
1912  for(Int_t b = 0 ; b < (10 + 6 * p); b++)
1913  for(Int_t i = 0 ; i < NModuleB ; i++){
1914  me[p]->getTH2F()->SetBinContent(b + 1, i + 1, map[0][p][b][i]);
1915  me[p]->getTH2F()->SetBinContent(b + 1, i + 1 + NModuleB, map[1][p][b][i]);
1916  me[p]->getTH2F()->SetBinContent(b + 1 + 10 + 6 * p, i + 1, map[2][p][b][i]);
1917  me[p]->getTH2F()->SetBinContent(b + 1 + 10 + 6 * p, i + 1 + NModuleB, map[3][p][b][i]);
1918  }
1919  me[p]->getTH2F()->SetMinimum(min);
1920  me[p]->getTH2F()->SetMaximum(max);
1921  }
1922  // cout << "Done with SiPixelActionExecutor::prephistosB" << endl;
1923 }
1924 
1925 //=============================================================================================================
1926 
1927 void SiPixelActionExecutor::prephistosE(MonitorElement* me[NCyl], DQMStore *bei, const Double_t map[][NLev2][NLev3][NLev4], std::string name, Double_t min, Double_t max){
1928  // cout << "Starting with SiPixelActionExecutor::prephistosE" << endl;
1929  std::string part[] = { "Disc_1_M", "Disc_2_M", "Disc_1_P", "Disc_2_P" };
1930  std::string path = bei->pwd();
1931  for (Int_t i = 0; i < NCyl; i++)
1932  {
1933  std::string fullpath = path + "/" + "TRKMAP_" + name + "_" + part[i];
1934  MonitorElement* temp = bei->get(fullpath);
1935  if(temp)
1936  {
1937  me[i] = temp;
1938  me[i]->getTH2F()->SetMinimum(min);
1939  me[i]->getTH2F()->SetMaximum(max);
1940  }
1941  else
1942  cout << "Problem: " << fullpath << endl;
1943  }
1944 
1945  for(Int_t c = 0 ; c < NCyl ; c += 2)
1946  for(Int_t d = 0 ; d < NDisk ; d++)
1947  for(Int_t b = 0 ; b < NBlade ; b++){
1948  me[c + d]->getTH2F()->SetBinContent(b + 1, 1, map[c][d][b][0]);
1949  me[c + d]->getTH2F()->SetBinContent(b + 1, 2, map[c][d][b][4]);
1950  me[c + d]->getTH2F()->SetBinContent(b + 1, 3, map[c][d][b][1]);
1951  me[c + d]->getTH2F()->SetBinContent(b + 1, 4, map[c][d][b][5]);
1952  me[c + d]->getTH2F()->SetBinContent(b + 1, 5, map[c][d][b][2]);
1953  me[c + d]->getTH2F()->SetBinContent(b + 1, 6, map[c][d][b][6]);
1954  me[c + d]->getTH2F()->SetBinContent(b + 1, 7, map[c][d][b][3]);
1955 
1956  me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 1, map[c + 1][d][b][0]);
1957  me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 2, map[c + 1][d][b][4]);
1958  me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 3, map[c + 1][d][b][1]);
1959  me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 4, map[c + 1][d][b][5]);
1960  me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 5, map[c + 1][d][b][2]);
1961  me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 6, map[c + 1][d][b][6]);
1962  me[c + d]->getTH2F()->SetBinContent(2 * NBlade - b, 7, map[c + 1][d][b][3]);
1963  }
1964  // cout << "Done with SiPixelActionExecutor::prephistosE" << endl;
1965 }
1966 
1967 
1968 //=============================================================================================================
1969 Double_t SiPixelActionExecutor::mapMin(const Double_t map[][NLev2][NLev3][NLev4], bool isBarrel){
1970 
1971  Double_t min = map[0][0][0][0];
1972 
1973  for(Int_t p = 0 ; p < NLev1 ; p++)
1974  for(Int_t d = 0 ; d < (isBarrel?3:2) ; d++)
1975  for(Int_t b = 0 ; b < (isBarrel?(d*6+10):12) ; b++)
1976  for(Int_t i = 0 ; i < (isBarrel?4:7); i++){
1977  if(map[p][d][b][i] < min)
1978  min = map[p][d][b][i];
1979  }
1980  // cout << "Done with SiPixelActionExecutor::mapMin" << endl;
1981  return min;
1982 }
1983 
1984 //=============================================================================================================
1985 
1986 Double_t SiPixelActionExecutor::mapMax(const Double_t map[][NLev2][NLev3][NLev4], bool isBarrel){
1987 
1988  Double_t max = map[0][0][0][0];
1989 
1990  for(Int_t p = 0 ; p < NLev1 ; p++)
1991  for(Int_t d = 0 ; d < (isBarrel?3:2); d++)
1992  for(Int_t b = 0 ; b < (isBarrel?(d*6+10):12); b++)
1993  for(Int_t i = 0 ; i < (isBarrel?4:7); i++)
1994  if(map[p][d][b][i] > max)
1995  max = map[p][d][b][i];
1996  // cout << "Done with SiPixelActionExecutor::mapMax" << endl;
1997  return max;
1998 }
1999 
2000 
2001 //=============================================================================================================
2002 
2003 //
2004 // -- Setup Quality Tests
2005 //
2007  //printing cout<<"Entering SiPixelActionExecutor::setupQTests: "<<endl;
2008 
2009  bei->cd();
2010  bei->cd("Pixel");
2011 
2012  string localPath;
2013  if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_qualitytest.xml");
2014  else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_qualitytest_config.xml");
2015  if(!qtHandler_){
2016  qtHandler_ = new QTestHandle();
2017  }
2018  if(!qtHandler_->configureTests(edm::FileInPath(localPath).fullPath(),bei)){
2019  qtHandler_->attachTests(bei,false);
2020  bei->cd();
2021  }else{
2022  cout << " Problem setting up quality tests "<<endl;
2023  }
2024 
2025  //printing cout<<" leaving SiPixelActionExecutor::setupQTests. "<<endl;
2026 }
2027 //=============================================================================================================
2028 //
2029 // -- Check Status of Quality Tests
2030 //
2032  //printing cout<<"Entering SiPixelActionExecutor::checkQTestResults..."<<endl;
2033 
2034  int messageCounter=0;
2035  string currDir = bei->pwd();
2036  vector<string> contentVec;
2037  bei->getContents(contentVec);
2039  // cout << calib_type_ << endl;
2041  for (vector<string>::iterator it = contentVec.begin();
2042  it != contentVec.end(); it++) {
2043  vector<string> contents;
2044  int nval = SiPixelUtility::getMEList((*it), contents);
2045  if (nval == 0) continue;
2046  for (vector<string>::const_iterator im = contents.begin();
2047  im != contents.end(); im++) {
2048 
2049  MonitorElement * me = bei->get((*im));
2050  if (me) {
2051  me->runQTests();
2052  // get all warnings associated with me
2053  vector<QReport*> warnings = me->getQWarnings();
2054  for(vector<QReport *>::const_iterator wi = warnings.begin();
2055  wi != warnings.end(); ++wi) {
2056  messageCounter++;
2057  if(messageCounter<message_limit_) {
2058  //edm::LogWarning("SiPixelQualityTester::checkTestResults") <<
2059  // " *** Warning for " << me->getName() <<
2060  // "," << (*wi)->getMessage() << "\n";
2061 
2062  edm::LogWarning("SiPixelActionExecutor::checkQTestResults") << " *** Warning for " << me->getName() << ","
2063  << (*wi)->getMessage() << " " << me->getMean()
2064  << " " << me->getRMS() << me->hasWarning()
2065  << endl;
2066  }
2067  }
2068  warnings=vector<QReport*>();
2069  // get all errors associated with me
2070  vector<QReport *> errors = me->getQErrors();
2071  for(vector<QReport *>::const_iterator ei = errors.begin();
2072  ei != errors.end(); ++ei) {
2073 
2074  float empty_mean = me->getMean();
2075  float empty_rms = me->getRMS();
2076  if((empty_mean != 0 && empty_rms != 0) || (calib_type_ == 0)){
2077  messageCounter++;
2078  if(messageCounter<=message_limit_) {
2079  //edm::LogError("SiPixelQualityTester::checkTestResults") <<
2080  // " *** Error for " << me->getName() <<
2081  // "," << (*ei)->getMessage() << "\n";
2082 
2083  edm::LogWarning("SiPixelActionExecutor::checkQTestResults") << " *** Error for " << me->getName() << ","
2084  << (*ei)->getMessage() << " " << me->getMean()
2085  << " " << me->getRMS()
2086  << endl;
2087  }
2088  }
2089  }
2090  errors=vector<QReport*>();
2091  }
2092  me=0;
2093  }
2094  nval=int(); contents=vector<string>();
2095  }
2096  LogDebug("SiPixelActionExecutor::checkQTestResults") <<"messageCounter: "<<messageCounter<<" , message_limit: "<<message_limit_<<endl;
2097  // if (messageCounter>=message_limit_)
2098  // edm::LogWarning("SiPixelActionExecutor::checkQTestResults") << "WARNING: too many QTest failures! Giving up after "<<message_limit_<<" messages."<<endl;
2099  contentVec=vector<string>(); currDir=string(); messageCounter=int();
2100  //printing cout<<"...leaving SiPixelActionExecutor::checkQTestResults!"<<endl;
2101 }
2102 
2103 //=============================================================================================================
2105  if (configWriter_ == 0) {
2107  if (!configWriter_->init()) return;
2108  }
2109  string currDir = bei->pwd();
2110  if (currDir.find("Layer") != string::npos) {
2111  string name = "Default";
2112  configWriter_->createLayout(name);
2114  fillLayout(bei);
2115  } else {
2116  vector<string> subdirs = bei->getSubdirs();
2117  for (vector<string>::const_iterator it = subdirs.begin();
2118  it != subdirs.end(); it++) {
2119  bei->cd(*it);
2120  createLayout(bei);
2121  bei->goUp();
2122  }
2123  }
2124 }
2125 
2126 //=============================================================================================================
2128 
2129  static int icount = 0;
2130  string currDir = bei->pwd();
2131  if (currDir.find("Ladder_") != string::npos) {
2132 
2133  vector<string> contents = bei->getMEs();
2134 
2135  for (vector<string>::const_iterator im = contents.begin();
2136  im != contents.end(); im++) {
2137  if ((*im).find("Clusters") != string::npos) {
2138  icount++;
2139  if (icount != 0 && icount%6 == 0) {
2141  }
2142  ostringstream full_path;
2143  full_path << "test/" << currDir << "/" << *im ;
2144  string element = "monitorable";
2145  string element_name = full_path.str();
2146  configWriter_->createColumn(element, element_name);
2147  }
2148  }
2149  } else {
2150  vector<string> subdirs = bei->getSubdirs();
2151  for (vector<string>::const_iterator it = subdirs.begin();
2152  it != subdirs.end(); it++) {
2153  bei->cd(*it);
2154  fillLayout(bei);
2155  bei->goUp();
2156  }
2157  }
2158 }
2159 
2160 //=============================================================================================================
2161 //
2162 // -- Get TkMap ME names
2163 //
2164 int SiPixelActionExecutor::getTkMapMENames(std::vector<std::string>& names) {
2165  if (tkMapMENames.size() == 0) return 0;
2166  for (vector<string>::iterator it = tkMapMENames.begin();
2167  it != tkMapMENames.end(); it++) {
2168  names.push_back(*it) ;
2169  }
2170  return names.size();
2171 }
2172 
2173 //=============================================================================================================
2176  //printing cout<<"Going to dump module IDs now!"<<endl;
2177  bei->cd();
2178  dumpBarrelModIds(bei,eSetup);
2179  bei->cd();
2180  dumpEndcapModIds(bei,eSetup);
2181  bei->cd();
2182  //printing cout<<"Done dumping module IDs!"<<endl;
2183 }
2184 
2185 
2186 //=============================================================================================================
2188  string currDir = bei->pwd();
2189  string dir_name = "Ladder_";
2190  eSetup.get<SiPixelFedCablingMapRcd>().get(theCablingMap);
2191  int fedId=-1; int linkId=-1;
2192  if (currDir.find(dir_name) != string::npos) {
2193  vector<string> subdirs = bei->getSubdirs();
2194  for (vector<string>::const_iterator it = subdirs.begin();
2195  it != subdirs.end(); it++) {
2196  if ( (*it).find("Module_") == string::npos) continue;
2197  bei->cd(*it);
2198  ndet_++;
2199  // long version:
2200  //cout<<"Ndet: "<<ndet_<<" , Module: "<<bei->pwd();
2201  // short version:
2202  cout<<bei->pwd();
2203  vector<string> contents = bei->getMEs();
2204  bool first_me = false;
2205  int detId = -999;
2206  for (vector<string>::const_iterator im = contents.begin();
2207  im != contents.end(); im++) {
2208  if(first_me) break;
2209  string mEName = (*im);
2210  string detIdString = mEName.substr((mEName.find_last_of("_"))+1,9);
2211  std::istringstream isst;
2212  isst.str(detIdString);
2213  if(mEName.find("_3")!=string::npos) isst>>detId;
2214  }
2215  bei->goUp();
2216  // long version:
2217  //cout<<" , detector ID: "<<detId;
2218  // short version:
2219  cout<<" "<<detId;
2220  for(int fedid=0; fedid<=40; ++fedid){
2221  SiPixelFrameConverter converter(theCablingMap.product(),fedid);
2222  uint32_t newDetId = detId;
2223  if(converter.hasDetUnit(newDetId)){
2224  fedId=fedid;
2225  break;
2226  }
2227  }
2228  if(fedId==-1) continue;
2231  assert(detId >= 0);
2232  sipixelobjects::DetectorIndex detector = {static_cast<unsigned int>(detId), 1, 1};
2233  formatter.toCabling(cabling,detector);
2234  linkId = cabling.link;
2235  // long version:
2236  //cout<<" , FED ID: "<<fedId<<" , Link ID: "<<linkId<<endl;
2237  // short version:
2238  cout<<" "<<fedId<<" "<<linkId<<endl;
2239  }
2240  } else {
2241  vector<string> subdirs = bei->getSubdirs();
2242  for (vector<string>::const_iterator it = subdirs.begin();
2243  it != subdirs.end(); it++) {
2244  if((*it).find("Endcap")!=string::npos) continue;
2245  bei->cd(*it);
2246  dumpBarrelModIds(bei,eSetup);
2247  bei->goUp();
2248  }
2249  }
2250 }
2251 
2252 //=============================================================================================================
2254  string currDir = bei->pwd();
2255  string dir_name = "Panel_";
2256  eSetup.get<SiPixelFedCablingMapRcd>().get(theCablingMap);
2257  int fedId=-1; int linkId=-1;
2258  if (currDir.find(dir_name) != string::npos) {
2259  vector<string> subdirs = bei->getSubdirs();
2260  for (vector<string>::const_iterator it = subdirs.begin();
2261  it != subdirs.end(); it++) {
2262  if ( (*it).find("Module_") == string::npos) continue;
2263  bei->cd(*it);
2264  ndet_++;
2265  // long version:
2266  //cout<<"Ndet: "<<ndet_<<" , Module: "<<bei->pwd();
2267  // short version:
2268  cout<<bei->pwd();
2269  vector<string> contents = bei->getMEs();
2270  bool first_me = false;
2271  int detId = -999;
2272  for (vector<string>::const_iterator im = contents.begin();
2273  im != contents.end(); im++) {
2274  if(first_me) break;
2275  string mEName = (*im);
2276  string detIdString = mEName.substr((mEName.find_last_of("_"))+1,9);
2277  std::istringstream isst;
2278  isst.str(detIdString);
2279  if(mEName.find("_3")!=string::npos) isst>>detId;
2280  }
2281  bei->goUp();
2282  // long version:
2283  //cout<<" , detector ID: "<<detId;
2284  // short version:
2285  cout<<" "<<detId;
2286  for(int fedid=0; fedid<=40; ++fedid){
2287  SiPixelFrameConverter converter(theCablingMap.product(),fedid);
2288  uint32_t newDetId = detId;
2289  if(converter.hasDetUnit(newDetId)){
2290  fedId=fedid;
2291  break;
2292  }
2293  }
2294  if(fedId==-1) continue;
2297  assert(detId >= 0);
2298  sipixelobjects::DetectorIndex detector = {static_cast<unsigned int>(detId), 1, 1};
2299  formatter.toCabling(cabling,detector);
2300  linkId = cabling.link;
2301  // long version:
2302  //cout<<" , FED ID: "<<fedId<<" , Link ID: "<<linkId<<endl;
2303  // short version:
2304  cout<<" "<<fedId<<" "<<linkId<<endl;
2305  }
2306  } else {
2307  vector<string> subdirs = bei->getSubdirs();
2308  for (vector<string>::const_iterator it = subdirs.begin();
2309  it != subdirs.end(); it++) {
2310  if((bei->pwd()).find("Barrel")!=string::npos) bei->goUp();
2311  bei->cd((*it));
2312  if((*it).find("Barrel")!=string::npos) continue;
2313  dumpEndcapModIds(bei,eSetup);
2314  bei->goUp();
2315  }
2316  }
2317 
2318 }
2319 
2320 //=============================================================================================================
2323  //printing cout<<"Going to dump module IDs now!"<<endl;
2324  bei->cd();
2325  dumpBarrelRefValues(bei,eSetup);
2326  bei->cd();
2327  dumpEndcapRefValues(bei,eSetup);
2328  bei->cd();
2329  //printing cout<<"Done dumping module IDs!"<<endl;
2330 }
2331 
2332 
2333 //=============================================================================================================
2335  MonitorElement* me;
2336  me = bei->get("Pixel/Barrel/SUMDIG_adc_Barrel");
2337  if(me){
2338  std::cout<<"SUMDIG_adc_Barrel: "<<std::endl;
2339  for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2340  }
2341  me = bei->get("Pixel/Barrel/SUMDIG_ndigis_Barrel");
2342  if(me){
2343  std::cout<<"SUMDIG_ndigis_Barrel: "<<std::endl;
2344  for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2345  }
2346  me = bei->get("Pixel/Barrel/SUMCLU_charge_Barrel");
2347  if(me){
2348  std::cout<<"SUMCLU_charge_Barrel: "<<std::endl;
2349  for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2350  }
2351  me = bei->get("Pixel/Barrel/SUMCLU_nclusters_Barrel");
2352  if(me){
2353  std::cout<<"SUMCLU_nclusters_Barrel: "<<std::endl;
2354  for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2355  }
2356  me = bei->get("Pixel/Barrel/SUMCLU_size_Barrel");
2357  if(me){
2358  std::cout<<"SUMCLU_size_Barrel: "<<std::endl;
2359  for(int i=1; i!=769; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2360  }
2361 }
2362 
2363 //=============================================================================================================
2365  MonitorElement* me;
2366  me = bei->get("Pixel/Endcap/SUMDIG_adc_Endcap");
2367  if(me){
2368  std::cout<<"SUMDIG_adc_Endcap: "<<std::endl;
2369  for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2370  }
2371  me = bei->get("Pixel/Endcap/SUMDIG_ndigis_Endcap");
2372  if(me){
2373  std::cout<<"SUMDIG_ndigis_Endcap: "<<std::endl;
2374  for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2375  }
2376  me = bei->get("Pixel/Endcap/SUMCLU_charge_Endcap");
2377  if(me){
2378  std::cout<<"SUMCLU_charge_Endcap: "<<std::endl;
2379  for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2380  }
2381  me = bei->get("Pixel/Endcap/SUMCLU_nclusters_Endcap");
2382  if(me){
2383  std::cout<<"SUMCLU_nclusters_Endcap: "<<std::endl;
2384  for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2385  }
2386  me = bei->get("Pixel/Endcap/SUMCLU_size_Endcap");
2387  if(me){
2388  std::cout<<"SUMCLU_size_Endcap: "<<std::endl;
2389  for(int i=1; i!=673; i++) std::cout<<i<<" "<<me->getBinContent(i)<<std::endl;
2390  }
2391 }
2392 
2393 //=============================================================================================================
2394 
2396  // Barrel
2397  bei->cd();
2398  bei->setCurrentFolder("Pixel/Barrel");
2399  if (!isUpgrade) {
2400  if(Tier0Flag_){
2401  HitEfficiency_L1 = bei->book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;Module;Ladder",8,-4,4,20,-10.,10.);
2402  HitEfficiency_L2 = bei->book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;Module;Ladder",8,-4,4,32,-16.,16.);
2403  HitEfficiency_L3 = bei->book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;Module;Ladder",8,-4,4,44,-22.,22.);
2404  }else{
2405  HitEfficiency_L1 = bei->book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;Module;Ladder",8,-4.,4.,20,-10.,10.);
2406  HitEfficiency_L2 = bei->book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;Module;Ladder",8,-4.,4.,32,-16.,16.);
2407  HitEfficiency_L3 = bei->book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;Module;Ladder",8,-4.,4.,44,-22.,22.);
2408  }
2409  }//endifNOTUpgrade
2410  else if (isUpgrade) {
2411  if(Tier0Flag_){
2412  HitEfficiency_L1 = bei->book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;z-side;Ladder",2,-1.,1.,12,-6.,6.);
2413  HitEfficiency_L2 = bei->book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;z-side;Ladder",2,-1.,1.,28,-14.,14.);
2414  HitEfficiency_L3 = bei->book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;z-side;Ladder",2,-1.,1.,44,-22.,22.);
2415  HitEfficiency_L4 = bei->book2D("HitEfficiency_L4","Hit Efficiency in Barrel_Layer4;z-side;Ladder",2,-1.,1.,64,-32.,32.);
2416  }else{
2417  HitEfficiency_L1 = bei->book2D("HitEfficiency_L1","Hit Efficiency in Barrel_Layer1;Module;Ladder",8,-4.,4.,12,-6.,6.);
2418  HitEfficiency_L2 = bei->book2D("HitEfficiency_L2","Hit Efficiency in Barrel_Layer2;Module;Ladder",8,-4.,4.,28,-14.,14.);
2419  HitEfficiency_L3 = bei->book2D("HitEfficiency_L3","Hit Efficiency in Barrel_Layer3;Module;Ladder",8,-4.,4.,44,-22.,22.);
2420  HitEfficiency_L4 = bei->book2D("HitEfficiency_L4","Hit Efficiency in Barrel_Layer4;Module;Ladder",8,-4.,4.,64,-32.,32.);
2421  }
2422  }//endifUpgrade
2423  // Endcap
2424  bei->cd();
2425  bei->setCurrentFolder("Pixel/Endcap");
2426  if (!isUpgrade) {
2427  if(Tier0Flag_){
2428  HitEfficiency_Dp1 = bei->book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;",24,-12.,12.,1,0.,1.);
2429  HitEfficiency_Dp2 = bei->book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;",24,-12.,12.,1,0.,1.);
2430  HitEfficiency_Dm1 = bei->book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;",24,-12.,12.,1,0.,1.);
2431  HitEfficiency_Dm2 = bei->book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;",24,-12.,12.,1,0.,1.);
2432  }else{
2433  HitEfficiency_Dp1 = bei->book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;Modules",24,-12.,12.,7,1.,8.);
2434  HitEfficiency_Dp2 = bei->book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;Modules",24,-12.,12.,7,1.,8.);
2435  HitEfficiency_Dm1 = bei->book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;Modules",24,-12.,12.,7,1.,8.);
2436  HitEfficiency_Dm2 = bei->book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;Modules",24,-12.,12.,7,1.,8.);
2437  }
2438  } else if (isUpgrade) {
2439  if(Tier0Flag_){
2440  HitEfficiency_Dp1 = bei->book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;",28,-17.,11.,1,0.,1.);
2441  HitEfficiency_Dp2 = bei->book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;",28,-17.,11.,1,0.,1.);
2442  HitEfficiency_Dp3 = bei->book2D("HitEfficiency_Dp3","Hit Efficiency in Endcap_Disk_p3;Blades;",28,-17.,11.,1,0.,1.);
2443  HitEfficiency_Dm1 = bei->book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;",28,-17.,11.,1,0.,1.);
2444  HitEfficiency_Dm2 = bei->book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;",28,-17.,11.,1,0.,1.);
2445  HitEfficiency_Dm3 = bei->book2D("HitEfficiency_Dm3","Hit Efficiency in Endcap_Disk_m3;Blades;",28,-17.,11.,1,0.,1.);
2446  }else{
2447  HitEfficiency_Dp1 = bei->book2D("HitEfficiency_Dp1","Hit Efficiency in Endcap_Disk_p1;Blades;Modules",28,-17.,11.,2,1.,3.);
2448  HitEfficiency_Dp2 = bei->book2D("HitEfficiency_Dp2","Hit Efficiency in Endcap_Disk_p2;Blades;Modules",28,-17.,11.,2,1.,3.);
2449  HitEfficiency_Dp3 = bei->book2D("HitEfficiency_Dp3","Hit Efficiency in Endcap_Disk_p3;Blades;Modules",28,-17.,11.,2,1.,3.);
2450  HitEfficiency_Dm1 = bei->book2D("HitEfficiency_Dm1","Hit Efficiency in Endcap_Disk_m1;Blades;Modules",28,-17.,11.,2,1.,3.);
2451  HitEfficiency_Dm2 = bei->book2D("HitEfficiency_Dm2","Hit Efficiency in Endcap_Disk_m2;Blades;Modules",28,-17.,11.,2,1.,3.);
2452  HitEfficiency_Dm3 = bei->book2D("HitEfficiency_Dm3","Hit Efficiency in Endcap_Disk_m3;Blades;Modules",28,-17.,11.,2,1.,3.);
2453  }
2454  }//endif(isUpgrade)
2455 }
2456 
2457 //=============================================================================================================
2458 
2460  //std::cout<<"entering SiPixelActionExecutor::createEfficiency..."<<std::endl;
2461  bei->cd();
2462  fillEfficiency(bei, true, isUpgrade); // Barrel
2463  bei->cd();
2464  fillEfficiency(bei, false, isUpgrade); // Endcap
2465  bei->cd();
2466  //std::cout<<"leaving SiPixelActionExecutor::createEfficiency..."<<std::endl;
2467 }
2468 
2469 //=============================================================================================================
2470 
2471 void SiPixelActionExecutor::fillEfficiency(DQMStore* bei, bool isbarrel, bool isUpgrade){
2472  //cout<<"entering SiPixelActionExecutor::fillEfficiency..."<<std::endl;
2473  string currDir = bei->pwd();
2474  string dname = currDir.substr(currDir.find_last_of("/")+1);
2475  //cout<<"currDir= "<<currDir<< " , dname= "<<dname<<std::endl;
2476 
2477  if(Tier0Flag_){ // Offline
2478  if(isbarrel && dname.find("Ladder_")!=string::npos){
2479  if (!isUpgrade) {
2480  vector<string> meVec = bei->getMEs();
2481  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
2482  string full_path = currDir + "/" + (*it);
2483 
2484  if(full_path.find("missingMod_")!=string::npos){ // If we have missing hits ME
2485 
2486  //Get the MEs that contain missing and valid hits
2487  MonitorElement * missing = bei->get(full_path);
2488  if (!missing) continue;
2489  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
2490  MonitorElement * valid = bei->get(new_path);
2491  if (!valid) continue;
2492  //int binx = 0;
2493  int biny = 0;
2494  //get the ladder number
2495 
2496  if(dname.find("01")!=string::npos){ biny = 1;}else if(dname.find("02")!=string::npos){ biny = 2;}
2497  else if(dname.find("03")!=string::npos){ biny = 3;}else if(dname.find("04")!=string::npos){ biny = 4;}
2498  else if(dname.find("05")!=string::npos){ biny = 5;}else if(dname.find("06")!=string::npos){ biny = 6;}
2499  else if(dname.find("07")!=string::npos){ biny = 7;}else if(dname.find("08")!=string::npos){ biny = 8;}
2500  else if(dname.find("09")!=string::npos){ biny = 9;}else if(dname.find("10")!=string::npos){ biny = 10;}
2501  else if(dname.find("11")!=string::npos){ biny = 11;}else if(dname.find("12")!=string::npos){ biny = 12;}
2502  else if(dname.find("13")!=string::npos){ biny = 13;}else if(dname.find("14")!=string::npos){ biny = 14;}
2503  else if(dname.find("15")!=string::npos){ biny = 15;}else if(dname.find("16")!=string::npos){ biny = 16;}
2504  else if(dname.find("17")!=string::npos){ biny = 17;}else if(dname.find("18")!=string::npos){ biny = 18;}
2505  else if(dname.find("19")!=string::npos){ biny = 19;}else if(dname.find("20")!=string::npos){ biny = 20;}
2506  else if(dname.find("21")!=string::npos){ biny = 21;}else if(dname.find("22")!=string::npos){ biny = 22;}
2507 
2508  if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
2509  if(currDir.find("Layer_1")!=string::npos){ biny = biny + 10;}
2510  else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 16;}
2511 
2512  else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
2513 
2514  }
2515 
2516 
2517 
2518  int start=1;
2519  //define start depending on p or m
2520 
2521  if(currDir.find("Shell_m")!=string::npos){ start = 1;}else{ start = 5;}
2522  for(int i=start; i<start+5;i++){
2523  float hitEfficiency = -1.0;
2524  float missingHits=0;
2525  float validHits=0;
2526  missingHits=missing->getBinContent(i);
2527  validHits=valid->getBinContent(i);
2528  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
2529  if(currDir.find("Layer_1")!=string::npos){
2530  HitEfficiency_L1 = bei->get("Pixel/Barrel/HitEfficiency_L1");
2531  if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(i, biny,(float)hitEfficiency);
2532  }
2533  else if(currDir.find("Layer_2")!=string::npos){
2534  HitEfficiency_L2 = bei->get("Pixel/Barrel/HitEfficiency_L2");
2535  if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(i, biny,(float)hitEfficiency);
2536  }
2537  else if(currDir.find("Layer_3")!=string::npos){
2538  HitEfficiency_L3 = bei->get("Pixel/Barrel/HitEfficiency_L3");
2539  if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(i, biny,(float)hitEfficiency);
2540  }
2541 
2542  }
2543 
2544  }
2545  }
2546  }//endifNOTUpgradeInBPix
2547  else if (isUpgrade) {
2548  vector<string> meVec = bei->getMEs();
2549  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
2550  string full_path = currDir + "/" + (*it);
2551  if(full_path.find("missing_")!=string::npos){ // If we have missing hits ME
2552  MonitorElement * me = bei->get(full_path);
2553  if (!me) continue;
2554  float missingHits = me->getEntries();
2555  //if(currDir.find("Barrel/Shell_mI/Layer_1/Ladder_09F")!=string::npos) cout<<"missingHits= "<<missingHits<<endl;
2556  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
2557  me = bei->get(new_path);
2558  if (!me) continue;
2559  float validHits = me->getEntries();
2560  //if(currDir.find("Barrel/Shell_mI/Layer_1/Ladder_09F")!=string::npos) cout<<"validHits= "<<validHits<<endl;
2561  float hitEfficiency = -1.;
2562  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
2563  //if(currDir.find("Barrel/Shell_mI/Layer_1/Ladder_09F")!=string::npos) cout<<"hitEfficiency= "<<hitEfficiency<<endl;
2564  int binx = 0; int biny = 0;
2565  if(currDir.find("Shell_m")!=string::npos){ binx = 1;}else{ binx = 2;}
2566  if(dname.find("01")!=string::npos){ biny = 1;}else if(dname.find("02")!=string::npos){ biny = 2;}
2567  else if(dname.find("03")!=string::npos){ biny = 3;}else if(dname.find("04")!=string::npos){ biny = 4;}
2568  else if(dname.find("05")!=string::npos){ biny = 5;}else if(dname.find("06")!=string::npos){ biny = 6;}
2569  else if(dname.find("07")!=string::npos){ biny = 7;}else if(dname.find("08")!=string::npos){ biny = 8;}
2570  else if(dname.find("09")!=string::npos){ biny = 9;}else if(dname.find("10")!=string::npos){ biny = 10;}
2571  else if(dname.find("11")!=string::npos){ biny = 11;}else if(dname.find("12")!=string::npos){ biny = 12;}
2572  else if(dname.find("13")!=string::npos){ biny = 13;}else if(dname.find("14")!=string::npos){ biny = 14;}
2573  else if(dname.find("15")!=string::npos){ biny = 15;}else if(dname.find("16")!=string::npos){ biny = 16;}
2574  else if(dname.find("17")!=string::npos){ biny = 17;}else if(dname.find("18")!=string::npos){ biny = 18;}
2575  else if(dname.find("19")!=string::npos){ biny = 19;}else if(dname.find("20")!=string::npos){ biny = 20;}
2576  else if(dname.find("21")!=string::npos){ biny = 21;}else if(dname.find("22")!=string::npos){ biny = 22;}
2577  else if(dname.find("23")!=string::npos){ biny = 23;}else if(dname.find("24")!=string::npos){ biny = 24;}
2578  else if(dname.find("25")!=string::npos){ biny = 25;}else if(dname.find("25")!=string::npos){ biny = 25;}
2579  else if(dname.find("26")!=string::npos){ biny = 26;}else if(dname.find("27")!=string::npos){ biny = 27;}
2580  else if(dname.find("28")!=string::npos){ biny = 28;}else if(dname.find("29")!=string::npos){ biny = 29;}
2581  else if(dname.find("30")!=string::npos){ biny = 30;}else if(dname.find("31")!=string::npos){ biny = 31;}
2582  else if(dname.find("32")!=string::npos){ biny = 32;}
2583  if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
2584  if(currDir.find("Layer_1")!=string::npos){ biny = biny + 6;}
2585  else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 14;}
2586  else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
2587  else if(currDir.find("Layer_4")!=string::npos){ biny = biny + 32;}
2588  }
2589  if(currDir.find("Layer_1")!=string::npos){
2590  HitEfficiency_L1 = bei->get("Pixel/Barrel/HitEfficiency_L1");
2591  if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(binx, biny,(float)hitEfficiency);
2592  //if(currDir.find("Barrel/Shell_mI/Layer_1/Ladder_09F")!=string::npos) cout<<"setting bin ("<<binx<<","<<biny<<") with "<<(float)hitEfficiency<<endl;
2593  }else if(currDir.find("Layer_2")!=string::npos){
2594  HitEfficiency_L2 = bei->get("Pixel/Barrel/HitEfficiency_L2");
2595  if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(binx, biny,(float)hitEfficiency);
2596  }else if(currDir.find("Layer_3")!=string::npos){
2597  HitEfficiency_L3 = bei->get("Pixel/Barrel/HitEfficiency_L3");
2598  if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(binx, biny,(float)hitEfficiency);
2599  }else if(currDir.find("Layer_4")!=string::npos){
2600  HitEfficiency_L4 = bei->get("Pixel/Barrel/HitEfficiency_L4");
2601  if(HitEfficiency_L4) HitEfficiency_L4->setBinContent(binx, biny,(float)hitEfficiency);
2602  }
2603  }
2604  }
2605  }//endifUpgradeInBPix
2606  }else if(!isbarrel && dname.find("Blade_")!=string::npos && !isUpgrade){
2607  vector<string> meVec = bei->getMEs();
2608  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
2609  string full_path = currDir + "/" + (*it);
2610  if(full_path.find("missing_")!=string::npos){ // If we have missing hits ME
2611  MonitorElement * me = bei->get(full_path);
2612  if (!me) continue;
2613  float missingHits = me->getEntries();
2614  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
2615  me = bei->get(new_path);
2616  if (!me) continue;
2617  float validHits = me->getEntries();
2618  float hitEfficiency = -1.;
2619  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
2620  int binx = 0; int biny = 1;
2621  if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
2622  else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
2623  else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
2624  else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
2625  else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
2626  else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
2627  if(currDir.find("HalfCylinder_mI")!=string::npos || currDir.find("HalfCylinder_pI")!=string::npos){ binx = binx + 12;}
2628  else{
2629  if(binx==1) binx = 12;
2630  else if(binx==2) binx = 11;
2631  else if(binx==3) binx = 10;
2632  else if(binx==4) binx = 9;
2633  else if(binx==5) binx = 8;
2634  else if(binx==6) binx = 7;
2635  else if(binx==7) binx = 6;
2636  else if(binx==8) binx = 5;
2637  else if(binx==9) binx = 4;
2638  else if(binx==10) binx = 3;
2639  else if(binx==11) binx = 2;
2640  else if(binx==12) binx = 1;
2641  }
2642  if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2643  HitEfficiency_Dm1 = bei->get("Pixel/Endcap/HitEfficiency_Dm1");
2644  if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny, (float)hitEfficiency);
2645  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2646  HitEfficiency_Dm2 = bei->get("Pixel/Endcap/HitEfficiency_Dm2");
2647  if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny, (float)hitEfficiency);
2648  }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2649  HitEfficiency_Dp1 = bei->get("Pixel/Endcap/HitEfficiency_Dp1");
2650  if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny, (float)hitEfficiency);
2651  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2652  HitEfficiency_Dp2 = bei->get("Pixel/Endcap/HitEfficiency_Dp2");
2653  if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny, (float)hitEfficiency);
2654  }
2655  //std::cout<<"EFFI: "<<currDir<<" , x: "<<binx<<" , y: "<<biny<<std::endl;
2656  }
2657  }
2658  }else if(!isbarrel && dname.find("Blade_")!=string::npos && isUpgrade){
2659  vector<string> meVec = bei->getMEs();
2660  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
2661  string full_path = currDir + "/" + (*it);
2662  if(full_path.find("missing_")!=string::npos){ // If we have missing hits ME
2663  MonitorElement * me = bei->get(full_path);
2664  if (!me) continue;
2665  float missingHits = me->getEntries();
2666  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
2667  me = bei->get(new_path);
2668  if (!me) continue;
2669  float validHits = me->getEntries();
2670  float hitEfficiency = -1.;
2671  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
2672  int binx = 0; int biny = 1;
2673  if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
2674  else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
2675  else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
2676  else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
2677  else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
2678  else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
2679  else if(currDir.find("13")!=string::npos){ binx = 13;}else if(currDir.find("14")!=string::npos){ binx = 14;}
2680  else if(currDir.find("15")!=string::npos){ binx = 15;}else if(currDir.find("16")!=string::npos){ binx = 16;}
2681  else if(currDir.find("17")!=string::npos){ binx = 17;}
2682  if(currDir.find("HalfCylinder_mI")!=string::npos || currDir.find("HalfCylinder_pI")!=string::npos){ binx = binx + 12;}
2683  else{
2684  if(binx==1) binx = 17;
2685  else if(binx==2) binx = 16;
2686  else if(binx==3) binx = 15;
2687  else if(binx==4) binx = 14;
2688  else if(binx==5) binx = 13;
2689  else if(binx==6) binx = 12;
2690  else if(binx==7) binx = 11;
2691  else if(binx==8) binx = 10;
2692  else if(binx==9) binx = 9;
2693  else if(binx==10) binx = 8;
2694  else if(binx==11) binx = 7;
2695  else if(binx==12) binx = 6;
2696  else if(binx==13) binx = 5;
2697  else if(binx==14) binx = 4;
2698  else if(binx==15) binx = 3;
2699  else if(binx==16) binx = 2;
2700  else if(binx==17) binx = 1;
2701  }
2702  if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2703  HitEfficiency_Dm1 = bei->get("Pixel/Endcap/HitEfficiency_Dm1");
2704  if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny, (float)hitEfficiency);
2705  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2706  HitEfficiency_Dm2 = bei->get("Pixel/Endcap/HitEfficiency_Dm2");
2707  if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny, (float)hitEfficiency);
2708  }else if(currDir.find("Disk_3")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2709  HitEfficiency_Dm3 = bei->get("Pixel/Endcap/HitEfficiency_Dm3");
2710  if(HitEfficiency_Dm3) HitEfficiency_Dm3->setBinContent(binx, biny, (float)hitEfficiency);
2711  }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2712  HitEfficiency_Dp1 = bei->get("Pixel/Endcap/HitEfficiency_Dp1");
2713  if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny, (float)hitEfficiency);
2714  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2715  HitEfficiency_Dp2 = bei->get("Pixel/Endcap/HitEfficiency_Dp2");
2716  if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny, (float)hitEfficiency);
2717  }else if(currDir.find("Disk_3")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2718  HitEfficiency_Dp3 = bei->get("Pixel/Endcap/HitEfficiency_Dp3");
2719  if(HitEfficiency_Dp3) HitEfficiency_Dp3->setBinContent(binx, biny, (float)hitEfficiency);
2720  }
2721  //std::cout<<"EFFI: "<<currDir<<" , x: "<<binx<<" , y: "<<biny<<std::endl;
2722  }
2723  }
2724  }else{
2725  //cout<<"finding subdirs now"<<std::endl;
2726  vector<string> subdirs = bei->getSubdirs();
2727  for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
2728  bei->cd(*it);
2729  //cout<<"now I am in "<<bei->pwd()<<std::endl;
2730  if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
2731  //cout<<"calling myself again "<<std::endl;
2732  fillEfficiency(bei, isbarrel, isUpgrade);
2733  bei->goUp();
2734  }
2735  }
2736  }else{ // Online
2737  if(dname.find("Module_")!=string::npos){
2738  vector<string> meVec = bei->getMEs();
2739  for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
2740  string full_path = currDir + "/" + (*it);
2741  if(full_path.find("missing_")!=string::npos){ // If we have missing hits ME
2742  MonitorElement * me = bei->get(full_path);
2743  if (!me) continue;
2744  float missingHits = me->getEntries();
2745  string new_path = full_path.replace(full_path.find("missing"),7,"valid");
2746  me = bei->get(new_path);
2747  if (!me) continue;
2748  float validHits = me->getEntries();
2749  float hitEfficiency = -1.;
2750  if(validHits + missingHits > 0.) hitEfficiency = validHits / (validHits + missingHits);
2751  int binx = 0; int biny = 0;
2752  if(isbarrel){
2753  if(currDir.find("Shell_m")!=string::npos){
2754  if(currDir.find("Module_4")!=string::npos){ binx = 1;}else if(currDir.find("Module_3")!=string::npos){ binx = 2;}
2755  if(currDir.find("Module_2")!=string::npos){ binx = 3;}else if(currDir.find("Module_1")!=string::npos){ binx = 4;}
2756  }else if(currDir.find("Shell_p")!=string::npos){
2757  if(currDir.find("Module_1")!=string::npos){ binx = 5;}else if(currDir.find("Module_2")!=string::npos){ binx = 6;}
2758  if(currDir.find("Module_3")!=string::npos){ binx = 7;}else if(currDir.find("Module_4")!=string::npos){ binx = 8;}
2759  }
2760  if (!isUpgrade) {
2761  if(currDir.find("01")!=string::npos){ biny = 1;}else if(currDir.find("02")!=string::npos){ biny = 2;}
2762  else if(currDir.find("03")!=string::npos){ biny = 3;}else if(currDir.find("04")!=string::npos){ biny = 4;}
2763  else if(currDir.find("05")!=string::npos){ biny = 5;}else if(currDir.find("06")!=string::npos){ biny = 6;}
2764  else if(currDir.find("07")!=string::npos){ biny = 7;}else if(currDir.find("08")!=string::npos){ biny = 8;}
2765  else if(currDir.find("09")!=string::npos){ biny = 9;}else if(currDir.find("10")!=string::npos){ biny = 10;}
2766  else if(currDir.find("11")!=string::npos){ biny = 11;}else if(currDir.find("12")!=string::npos){ biny = 12;}
2767  else if(currDir.find("13")!=string::npos){ biny = 13;}else if(currDir.find("14")!=string::npos){ biny = 14;}
2768  else if(currDir.find("15")!=string::npos){ biny = 15;}else if(currDir.find("16")!=string::npos){ biny = 16;}
2769  else if(currDir.find("17")!=string::npos){ biny = 17;}else if(currDir.find("18")!=string::npos){ biny = 18;}
2770  else if(currDir.find("19")!=string::npos){ biny = 19;}else if(currDir.find("20")!=string::npos){ biny = 20;}
2771  else if(currDir.find("21")!=string::npos){ biny = 21;}else if(currDir.find("22")!=string::npos){ biny = 22;}
2772  if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
2773  if(currDir.find("Layer_1")!=string::npos){ biny = biny + 10;}
2774  else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 16;}
2775  else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
2776  }
2777  }
2778  else if (isUpgrade) {
2779  if(currDir.find("01")!=string::npos){ biny = 1;}else if(currDir.find("02")!=string::npos){ biny = 2;}
2780  else if(currDir.find("03")!=string::npos){ biny = 3;}else if(currDir.find("04")!=string::npos){ biny = 4;}
2781  else if(currDir.find("05")!=string::npos){ biny = 5;}else if(currDir.find("06")!=string::npos){ biny = 6;}
2782  else if(currDir.find("07")!=string::npos){ biny = 7;}else if(currDir.find("08")!=string::npos){ biny = 8;}
2783  else if(currDir.find("09")!=string::npos){ biny = 9;}else if(currDir.find("10")!=string::npos){ biny = 10;}
2784  else if(currDir.find("11")!=string::npos){ biny = 11;}else if(currDir.find("12")!=string::npos){ biny = 12;}
2785  else if(currDir.find("13")!=string::npos){ biny = 13;}else if(currDir.find("14")!=string::npos){ biny = 14;}
2786  else if(currDir.find("15")!=string::npos){ biny = 15;}else if(currDir.find("16")!=string::npos){ biny = 16;}
2787  else if(currDir.find("17")!=string::npos){ biny = 17;}else if(currDir.find("18")!=string::npos){ biny = 18;}
2788  else if(currDir.find("19")!=string::npos){ biny = 19;}else if(currDir.find("20")!=string::npos){ biny = 20;}
2789  else if(currDir.find("21")!=string::npos){ biny = 21;}else if(currDir.find("22")!=string::npos){ biny = 22;}
2790  else if(currDir.find("23")!=string::npos){ biny = 23;}else if(currDir.find("24")!=string::npos){ biny = 24;}
2791  else if(currDir.find("25")!=string::npos){ biny = 25;}else if(currDir.find("25")!=string::npos){ biny = 25;}
2792  else if(currDir.find("26")!=string::npos){ biny = 26;}else if(currDir.find("27")!=string::npos){ biny = 27;}
2793  else if(currDir.find("28")!=string::npos){ biny = 28;}else if(currDir.find("29")!=string::npos){ biny = 29;}
2794  else if(currDir.find("30")!=string::npos){ biny = 30;}else if(currDir.find("31")!=string::npos){ biny = 31;}
2795  else if(currDir.find("32")!=string::npos){ biny = 32;}
2796  if(currDir.find("Shell_mO")!=string::npos || currDir.find("Shell_pO")!=string::npos){
2797  if(currDir.find("Layer_1")!=string::npos){ biny = biny + 6;}
2798  else if(currDir.find("Layer_2")!=string::npos){ biny = biny + 14;}
2799  else if(currDir.find("Layer_3")!=string::npos){ biny = biny + 22;}
2800  else if(currDir.find("Layer_4")!=string::npos){ biny = biny + 32;}
2801  }
2802  }
2803  }else{ //endcap
2804  if (!isUpgrade) {
2805  if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
2806  else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
2807  else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
2808  else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
2809  else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
2810  else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
2811  if(currDir.find("HalfCylinder_mO")!=string::npos || currDir.find("HalfCylinder_pO")!=string::npos){ binx = binx + 12;}
2812  if(currDir.find("Panel_1/Module_1")!=string::npos){ biny = 1;}else if(currDir.find("Panel_2/Module_1")!=string::npos){ biny = 2;}
2813  else if(currDir.find("Panel_1/Module_2")!=string::npos){ biny = 3;}else if(currDir.find("Panel_2/Module_2")!=string::npos){ biny = 4;}
2814  else if(currDir.find("Panel_1/Module_3")!=string::npos){ biny = 5;}else if(currDir.find("Panel_2/Module_3")!=string::npos){ biny = 6;}
2815  else if(currDir.find("Panel_1/Module_4")!=string::npos){ biny = 7;}
2816  } else if (isUpgrade) {
2817  if(currDir.find("01")!=string::npos){ binx = 1;}else if(currDir.find("02")!=string::npos){ binx = 2;}
2818  else if(currDir.find("03")!=string::npos){ binx = 3;}else if(currDir.find("04")!=string::npos){ binx = 4;}
2819  else if(currDir.find("05")!=string::npos){ binx = 5;}else if(currDir.find("06")!=string::npos){ binx = 6;}
2820  else if(currDir.find("07")!=string::npos){ binx = 7;}else if(currDir.find("08")!=string::npos){ binx = 8;}
2821  else if(currDir.find("09")!=string::npos){ binx = 9;}else if(currDir.find("10")!=string::npos){ binx = 10;}
2822  else if(currDir.find("11")!=string::npos){ binx = 11;}else if(currDir.find("12")!=string::npos){ binx = 12;}
2823  else if(currDir.find("13")!=string::npos){ binx = 13;}else if(currDir.find("14")!=string::npos){ binx = 14;}
2824  else if(currDir.find("15")!=string::npos){ binx = 15;}else if(currDir.find("16")!=string::npos){ binx = 16;}
2825  else if(currDir.find("17")!=string::npos){ binx = 17;}
2826  if(currDir.find("HalfCylinder_mO")!=string::npos || currDir.find("HalfCylinder_pO")!=string::npos){ binx = binx + 17;}
2827  if(currDir.find("Panel_1/Module_1")!=string::npos){ biny = 1;}else if(currDir.find("Panel_2/Module_1")!=string::npos){ biny = 2;}
2828  }//endif(isUpgrade)
2829  }
2830 
2831  if(currDir.find("Layer_1")!=string::npos){
2832  HitEfficiency_L1 = bei->get("Pixel/Barrel/HitEfficiency_L1");
2833  if(HitEfficiency_L1) HitEfficiency_L1->setBinContent(binx, biny,(float)hitEfficiency);
2834  }else if(currDir.find("Layer_2")!=string::npos){
2835  HitEfficiency_L2 = bei->get("Pixel/Barrel/HitEfficiency_L2");
2836  if(HitEfficiency_L2) HitEfficiency_L2->setBinContent(binx, biny,(float)hitEfficiency);
2837  }else if(currDir.find("Layer_3")!=string::npos){
2838  HitEfficiency_L3 = bei->get("Pixel/Barrel/HitEfficiency_L3");
2839  if(HitEfficiency_L3) HitEfficiency_L3->setBinContent(binx, biny,(float)hitEfficiency);
2840  }else if( isUpgrade && (currDir.find("Layer_4")!=string::npos) ){
2841  HitEfficiency_L4 = bei->get("Pixel/Barrel/HitEfficiency_L4");
2842  if(HitEfficiency_L4) HitEfficiency_L4->setBinContent(binx, biny,(float)hitEfficiency);
2843  }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2844  HitEfficiency_Dm1 = bei->get("Pixel/Endcap/HitEfficiency_Dm1");
2845  if(HitEfficiency_Dm1) HitEfficiency_Dm1->setBinContent(binx, biny,(float)hitEfficiency);
2846  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2847  HitEfficiency_Dm2 = bei->get("Pixel/Endcap/HitEfficiency_Dm2");
2848  if(HitEfficiency_Dm2) HitEfficiency_Dm2->setBinContent(binx, biny,(float)hitEfficiency);
2849  }else if(currDir.find("Disk_3")!=string::npos && currDir.find("HalfCylinder_m")!=string::npos){
2850  HitEfficiency_Dm3 = bei->get("Pixel/Endcap/HitEfficiency_Dm3");
2851  if(HitEfficiency_Dm3) HitEfficiency_Dm3->setBinContent(binx, biny,(float)hitEfficiency);
2852  }else if(currDir.find("Disk_1")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2853  HitEfficiency_Dp1 = bei->get("Pixel/Endcap/HitEfficiency_Dp1");
2854  if(HitEfficiency_Dp1) HitEfficiency_Dp1->setBinContent(binx, biny,(float)hitEfficiency);
2855  }else if(currDir.find("Disk_2")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2856  HitEfficiency_Dp2 = bei->get("Pixel/Endcap/HitEfficiency_Dp2");
2857  if(HitEfficiency_Dp2) HitEfficiency_Dp2->setBinContent(binx, biny,(float)hitEfficiency);
2858  }else if(currDir.find("Disk_3")!=string::npos && currDir.find("HalfCylinder_p")!=string::npos){
2859  HitEfficiency_Dp3 = bei->get("Pixel/Endcap/HitEfficiency_Dp3");
2860  if(HitEfficiency_Dp3) HitEfficiency_Dp3->setBinContent(binx, biny,(float)hitEfficiency);
2861  }
2862  }
2863  }
2864  }else{
2865  //cout<<"finding subdirs now"<<std::endl;
2866  vector<string> subdirs = bei->getSubdirs();
2867  for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
2868  bei->cd(*it);
2869  //cout<<"now I am in "<<bei->pwd()<<std::endl;
2870  if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
2871  //cout<<"calling myself again "<<std::endl;
2872  fillEfficiency(bei, isbarrel, isUpgrade);
2873  bei->goUp();
2874  }
2875  }
2876  } // end online/offline
2877 
2878  //cout<<"leaving SiPixelActionExecutor::fillEfficiency..."<<std::endl;
2879 
2880 }
#define LogDebug(id)
void dumpRefValues(DQMStore *bei, edm::EventSetup const &eSetup)
type
Definition: HCALResponse.h:21
dictionary missing
Definition: combine.py:4
#define NLev1
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
void bookDeviations(DQMStore *bei, bool isUpgrade)
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 getData(Double_t map[][3][22][7], std::string type, DQMStore *bei, funcType ff, Int_t i, Int_t j, Int_t k, Int_t l)
bool init()
Write XML file.
void dumpBarrelRefValues(DQMStore *bei, edm::EventSetup const &eSetup)
void fillGrandBarrelSummaryHistos(DQMStore *bei, std::vector< std::string > &me_names, bool isUpgrade)
MonitorElement * HitEfficiency_Dp3
std::vector< std::string > getSubdirs(void) const
Definition: DQMStore.cc:1659
static const HistoName names[]
Double_t mapMin(const Double_t map[][3][22][7], bool isBarrel)
TH1 * getRefTH1(void) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
void fillOccupancy(DQMStore *bei, bool isbarrel)
void getDocument(std::string configFile, bool UseDB=false)
Methor that parses the xml file configFile.
void cd(void)
go to top directory (ie. root)
Definition: DQMStore.cc:644
void createTkMap(DQMStore *bei, std::string mEName, std::string theTKType)
static char const * tname
Definition: GTSchema.h:13
static int getMEList(std::string name, std::vector< std::string > &values)
#define NDisk
MonitorElement * HitEfficiency_L4
#define NCyl
void createColumn(std::string &element, std::string &name)
MonitorElement * DEV_size_Barrel
MonitorElement * HitEfficiency_L3
void createMaps(DQMStore *bei, std::string type, std::string name, funcType ff)
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)
void bookOccupancyPlots(DQMStore *bei, bool hiRes, bool isbarrel)
SiPixelConfigParser * configParser_
void runQTests(void)
run all quality tests
void createEfficiency(DQMStore *bei, bool isUpgrade)
MonitorElement * DEV_nclusters_Barrel
#define NBlade
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
void attachTests(DQMStore *bei, bool verboseQT=true)
Attaches the quality tests to the MonitorElement.
Definition: QTestHandle.cc:62
void dumpBarrelModIds(DQMStore *bei, edm::EventSetup const &eSetup)
int createMap(Double_t map[][3][22][7], std::string type, DQMStore *bei, funcType ff, bool isBarrel)
MonitorElement * getSummaryME(DQMStore *bei, std::string me_name, bool isUpgrade)
void bookTrackerMaps(DQMStore *bei, std::string name)
void fillEfficiency(DQMStore *bei, bool isbarrel, bool isUpgrade)
Double_t mapMax(const Double_t map[][3][22][7], bool isBarrel)
void fillSummary(DQMStore *bei, std::string dir_name, std::vector< std::string > &me_names, bool isbarrel, bool isUpgrade)
bool getCalibType(int &u_freq)
void fillLayout(DQMStore *bei)
int getNbinsY(void) const
get # of bins in Y-axis
void setupQTests(DQMStore *bei)
void Fill(long long x)
std::vector< QReport * > getQErrors(void) const
get errors from last set of quality tests
#define NModuleB
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)
std::vector< std::string > tkMapMENames
bool hasWarning(void) const
true if at least of one of the quality tests returned a warning
void createOccupancy(DQMStore *bei)
bool getFrequencyForEndcapSummary(int &u_freq)
bool getMENamesForFEDErrorSummary(std::string &structure_name, std::vector< std::string > &me_names)
void bookEfficiency(DQMStore *bei, bool isUpgrade)
edm::ESHandle< SiPixelFedCablingMap > theCablingMap
void create(DQMStore *bei)
(Documentation under construction).
T sqrt(T t)
Definition: SSEVec.h:48
MonitorElement * DEV_adc_Endcap
void fillDeviations(DQMStore *bei)
bool getMENamesForGrandBarrelSummary(std::string &structure_name, std::vector< std::string > &me_names)
bool getFrequencyForBarrelSummary(int &u_freq)
bool getFrequencyForGrandEndcapSummary(int &u_freq)
void createLayout(DQMStore *bei)
MonitorElement * DEV_charge_Endcap
int j
Definition: DBlmapReader.cc:9
void fillGrandEndcapSummaryHistos(DQMStore *bei, std::vector< std::string > &me_names, bool isUpgrade)
void createSummary(DQMStore *bei, bool isUpgrade)
bool getMENamesForBarrelSummary(std::string &structure_name, std::vector< std::string > &me_names)
T min(T a, T b)
Definition: MathUtil.h:58
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1708
std::vector< MonitorElement * > getContents(const std::string &path) const
Definition: DQMStore.cc:1737
int getTkMapMENames(std::vector< std::string > &names)
void dumpEndcapModIds(DQMStore *bei, edm::EventSetup const &eSetup)
int k[5][pyjets_maxn]
SiPixelActionExecutor(bool offlineXMLfile, bool Tier0Flag)
MonitorElement * DEV_charge_Barrel
MonitorElement * HitEfficiency_Dm3
#define NLev3
#define NLev2
void dumpEndcapRefValues(DQMStore *bei, edm::EventSetup const &eSetup)
void GetBladeSubdirs(DQMStore *bei, std::vector< std::string > &blade_subdirs)
bool getMessageLimitForQTests(int &u_freq)
MonitorElement * HitEfficiency_L1
part
Definition: HCALResponse.h:20
int64_t getIntValue(void) const
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
TH1F * getTH1F(void) const
double b
Definition: hdecay.h:120
MonitorElement * DEV_nclusters_Endcap
MonitorElement * HitEfficiency_Dp1
std::vector< std::string > getMEs(void) const
get list of (non-dir) MEs of current directory
Definition: DQMStore.cc:1682
bool getSourceType(int &u_freq)
MonitorElement * DEV_size_Endcap
double getBinContent(int binx) const
get content of bin (1-D)
int nlast
Definition: AMPTWrapper.h:47
bool configureTests(const std::string &configFile, DQMStore *bei, bool UseDB=false)
Parses Config File and configures the quality tests.
Definition: QTestHandle.cc:35
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
tuple formatter
Definition: fff_deleter.py:293
#define NLayer
std::vector< QReport * > getQWarnings(void) const
get warnings from last set of quality tests
int getNbinsX(void) const
get # of bins in X-axis
void goUp(void)
equivalent to &quot;cd ..&quot;
Definition: DQMStore.cc:678
void createLayout(std::string &name)
void prephistosE(MonitorElement *me[4], DQMStore *bei, const Double_t map[][3][22][7], std::string name, Double_t min, Double_t max)
tuple cout
Definition: gather_cfg.py:121
MonitorElement * getFEDSummaryME(DQMStore *bei, std::string me_name)
MonitorElement * HitEfficiency_Dp2
bool getFrequencyForTrackerMap(int &u_freq)
std::string fullPath() const
Definition: FileInPath.cc:165
void getGrandSummaryME(DQMStore *bei, int nbin, std::string &me_name, std::vector< MonitorElement * > &mes)
void prephistosB(MonitorElement *me[4], DQMStore *bei, const Double_t map[][3][22][7], std::string name, Double_t min, Double_t max)
TH2F * getTH2F(void) const
MonitorElement * DEV_ndigis_Endcap
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1082
MonitorElement * HitEfficiency_Dm1
void checkQTestResults(DQMStore *bei)
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 setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667
MonitorElement * DEV_adc_Barrel
void dumpModIds(DQMStore *bei, edm::EventSetup const &eSetup)
void fillFEDErrorSummary(DQMStore *bei, std::string dir_name, std::vector< std::string > &me_names)
#define NLev4
const std::string & pwd(void) const
Definition: DQMStore.cc:639