CMS 3D CMS Logo

SiPixelActionExecutor.cc

Go to the documentation of this file.
00001 //#define printing false
00002 //#define occupancyprinting false
00003 
00004 #include "DQM/SiPixelMonitorClient/interface/SiPixelActionExecutor.h"
00005 #include "DQM/SiPixelMonitorClient/interface/SiPixelUtility.h"
00006 #include "DQM/SiPixelMonitorClient/interface/SiPixelInformationExtractor.h"
00007 #include "DQM/SiPixelMonitorClient/interface/SiPixelTrackerMapCreator.h"
00008 #include "DQM/SiPixelMonitorClient/interface/ANSIColors.h"
00009 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00010 #include "FWCore/ParameterSet/interface/FileInPath.h"
00011 #include "DQMServices/Core/interface/DQMStore.h"
00012 #include "DQMServices/Core/interface/MonitorElement.h"
00013 
00014 #include <qstring.h>
00015 #include <qregexp.h>
00016 #include <math.h>
00017 
00018 #include <iostream>
00019 using namespace std;
00020 //=============================================================================================================
00021 //
00022 // -- Constructor
00023 // 
00024 SiPixelActionExecutor::SiPixelActionExecutor(bool offlineXMLfile) : offlineXMLfile_(offlineXMLfile) {
00025   edm::LogInfo("SiPixelActionExecutor") << 
00026     " Creating SiPixelActionExecutor " << "\n" ;
00027   configParser_ = 0;
00028   configWriter_ = 0;
00029   qtHandler_ = 0;  
00030   ndet_ = 0;
00031   //collationDone = false;
00032 }
00033 //=============================================================================================================
00034 //
00035 // --  Destructor
00036 // 
00037 SiPixelActionExecutor::~SiPixelActionExecutor() {
00038   edm::LogInfo("SiPixelActionExecutor") << 
00039     " Deleting SiPixelActionExecutor " << "\n" ;
00040   if (configParser_) delete configParser_;
00041   if (configWriter_) delete configWriter_;  
00042   if (qtHandler_) delete qtHandler_;
00043 }
00044 //=============================================================================================================
00045 //
00046 // -- Read Configuration File
00047 //
00048 void SiPixelActionExecutor::readConfiguration() {
00049   string localPath;
00050   if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
00051   else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
00052   if (configParser_ == 0) {
00053     configParser_ = new SiPixelConfigParser();
00054     configParser_->getDocument(edm::FileInPath(localPath).fullPath());
00055   }
00056 }
00057 //=============================================================================================================
00058 //
00059 // -- Read Configuration File
00060 //
00061 bool SiPixelActionExecutor::readConfiguration(int& tkmap_freq, 
00062                                               int& sum_barrel_freq, 
00063                                               int& sum_endcap_freq, 
00064                                               int& sum_grandbarrel_freq, 
00065                                               int& sum_grandendcap_freq, 
00066                                               int& message_limit_,
00067                                               int& source_type_,
00068                                               int& calib_type_) {
00069 //printing cout<<"Entering SiPixelActionExecutor::readConfiguration..."<<endl;
00070   string localPath;
00071   if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
00072   else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
00073   if (configParser_ == 0) {
00074     configParser_ = new SiPixelConfigParser();
00075     configParser_->getDocument(edm::FileInPath(localPath).fullPath());
00076   }
00077  
00078   if (!configParser_->getFrequencyForTrackerMap(tkmap_freq)){
00079     cout << "SiPixelActionExecutor::readConfiguration: Failed to read TrackerMap configuration parameters!! ";
00080     return false;
00081   }
00082   if (!configParser_->getFrequencyForBarrelSummary(sum_barrel_freq)){
00083     edm::LogInfo("SiPixelActionExecutor") << "Failed to read Barrel Summary configuration parameters!! " << "\n" ;
00084     return false;
00085   }
00086   if (!configParser_->getFrequencyForEndcapSummary(sum_endcap_freq)){
00087     edm::LogInfo("SiPixelActionExecutor")  << "Failed to read Endcap Summary configuration parameters!! " << "\n" ;
00088     return false;
00089   }
00090   if (!configParser_->getFrequencyForGrandBarrelSummary(sum_grandbarrel_freq)){
00091     edm::LogInfo("SiPixelActionExecutor") << "Failed to read Grand Barrel Summary configuration parameters!! " << "\n" ;
00092     return false;
00093   }
00094   if (!configParser_->getFrequencyForGrandEndcapSummary(sum_grandendcap_freq)){
00095     edm::LogInfo("SiPixelActionExecutor")  << "Failed to read Grand Endcap Summary configuration parameters!! " << "\n" ;
00096     return false;
00097   }
00098   if (!configParser_->getMessageLimitForQTests(message_limit_)){
00099     edm::LogInfo("SiPixelActionExecutor")  << "Failed to read QTest Message Limit" << "\n" ;
00100     return false;
00101   }
00102   if (!configParser_->getSourceType(source_type_)){
00103     edm::LogInfo("SiPixelActionExecutor")  << "Failed to read Source Type" << "\n" ;
00104     return false;
00105   }
00106   if (!configParser_->getCalibType(calib_type_)){
00107     edm::LogInfo("SiPixelActionExecutor")  << "Failed to read Calib Type" << "\n" ;
00108     return false;
00109   }
00110 //printing cout<<"...leaving SiPixelActionExecutor::readConfiguration..."<<endl;
00111   return true;
00112 }
00113 //=============================================================================================================
00114 bool SiPixelActionExecutor::readConfiguration(int& tkmap_freq, int& summary_freq) {
00115 //printing cout<<"Entering SiPixelActionExecutor::readConfiguration..."<<endl;
00116   string localPath;
00117   if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
00118   else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
00119   if (configParser_ == 0) {
00120     configParser_ = new SiPixelConfigParser();
00121     configParser_->getDocument(edm::FileInPath(localPath).fullPath());
00122   }
00123  
00124   if (!configParser_->getFrequencyForTrackerMap(tkmap_freq)){
00125     cout << "SiPixelActionExecutor::readConfiguration: Failed to read TrackerMap configuration parameters!! ";
00126     return false;
00127   }
00128   if (!configParser_->getFrequencyForBarrelSummary(summary_freq)){
00129     edm::LogInfo("SiPixelActionExecutor") << "Failed to read Summary configuration parameters!! " << "\n" ;
00130     return false;
00131   }
00132 //printing cout<<"...leaving SiPixelActionExecutor::readConfiguration..."<<endl;
00133   return true;
00134 }
00135 //=============================================================================================================
00136 // -- Create Tracker Map
00137 //
00138 void SiPixelActionExecutor::createTkMap(DQMStore* bei, 
00139                                         string mEName,
00140                                         string theTKType) 
00141 {
00142  
00143   SiPixelTrackerMapCreator tkmap_creator(mEName,theTKType,offlineXMLfile_);
00144   tkmap_creator.create(bei);
00145   
00146 //   cout << ACYellow << ACBold 
00147 //        << "[SiPixelActionExecutor::createTkMap()]"
00148 //        << ACPlain
00149 //        << " Tracker map created (type:" 
00150 //        << theTKType
00151 //        << ")"
00152 //        << endl;
00153 }
00154 
00155 //=============================================================================================================
00156 void SiPixelActionExecutor::createSummary(DQMStore* bei) {
00157 //printing cout<<"entering SiPixelActionExecutor::createSummary..."<<endl;
00158   string barrel_structure_name;
00159   vector<string> barrel_me_names;
00160   string localPath;
00161   if(offlineXMLfile_) localPath = string("DQM/SiPixelMonitorClient/test/sipixel_tier0_config.xml");
00162   else localPath = string("DQM/SiPixelMonitorClient/test/sipixel_monitorelement_config.xml");
00163   if (configParser_ == 0) {
00164     configParser_ = new SiPixelConfigParser();
00165     configParser_->getDocument(edm::FileInPath(localPath).fullPath());
00166   }
00167   if (!configParser_->getMENamesForBarrelSummary(barrel_structure_name, barrel_me_names)){
00168     cout << "SiPixelActionExecutor::createSummary: Failed to read Barrel Summary configuration parameters!! ";
00169     return;
00170   }
00171   configParser_->getSourceType(source_type_); 
00172   bei->setCurrentFolder("Pixel/");
00173   //bei->cd();
00174   fillSummary(bei, barrel_structure_name, barrel_me_names, true); // Barrel
00175   bei->setCurrentFolder("Pixel/");
00176   //bei->cd();
00177   string endcap_structure_name;
00178   vector<string> endcap_me_names;
00179   if (!configParser_->getMENamesForEndcapSummary(endcap_structure_name, endcap_me_names)){
00180     edm::LogInfo("SiPixelActionExecutor")  << "Failed to read Endcap Summary configuration parameters!! " << "\n" ;
00181     return;
00182   }
00183   bei->setCurrentFolder("Pixel/");
00184   //bei->cd();
00185   fillSummary(bei, endcap_structure_name, endcap_me_names, false); // Endcap
00186   bei->setCurrentFolder("Pixel/");
00187   //bei->cd();
00188   if(source_type_==0||source_type_==5 || source_type_ == 20){//do this only if RawData source is present
00189     string federror_structure_name;
00190     vector<string> federror_me_names;
00191     if (!configParser_->getMENamesForFEDErrorSummary(federror_structure_name, federror_me_names)){
00192       cout << "SiPixelActionExecutor::createSummary: Failed to read FED Error Summary configuration parameters!! ";
00193       return;
00194     }
00195     bei->setCurrentFolder("Pixel/");
00196     //bei->cd();
00197     fillFEDErrorSummary(bei, federror_structure_name, federror_me_names);
00198     bei->setCurrentFolder("Pixel/");
00199     //bei->cd();
00200   }
00201   //createLayout(bei);
00202   //string fname = "test.xml";
00203  // configWriter_->write(fname);
00204   if (configWriter_) delete configWriter_;
00205   configWriter_ = 0;
00206 //printing cout<<"leaving SiPixelActionExecutor::createSummary..."<<endl;
00207 }
00208 
00209 
00210 //=============================================================================================================
00211 
00212 void SiPixelActionExecutor::fillSummary(DQMStore* bei, string dir_name, vector<string>& me_names, bool isbarrel)
00213 {
00214 
00215   //printing cout<<"entering SiPixelActionExecutor::fillSummary..."<<endl;
00216   string currDir = bei->pwd();
00217   string prefix;
00218   if(source_type_==0) prefix="SUMRAW";
00219   else if (source_type_==1) prefix="SUMDIG";
00220   else if (source_type_==2) prefix="SUMCLU";
00221   else if (source_type_==3) prefix="SUMRES";
00222   else if (source_type_==4) prefix="SUMHIT";
00223   else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
00224   else if (source_type_==20) prefix="SUMOFF";
00225   if (currDir.find(dir_name) != string::npos)  {
00226     vector<MonitorElement*> sum_mes;
00227     for (vector<string>::const_iterator iv = me_names.begin();
00228          iv != me_names.end(); iv++) {
00229       if(source_type_==5||source_type_==6){
00230         if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00231            (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00232            (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00233            (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap") 
00234           prefix="SUMRAW";
00235         else if((*iv)=="ndigis"||(*iv)=="adc")
00236           prefix="SUMDIG";
00237         else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||
00238            (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
00239            (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
00240           prefix="SUMCLU";
00241         else if((*iv)=="residualX"||(*iv)=="residualY")
00242           prefix="SUMRES";
00243         else if((*iv)=="ClustX"||(*iv)=="ClustY")
00244           prefix="SUMHIT";
00245         else if((*iv)=="Gain1d"||(*iv)=="GainChi2NDF1d"||
00246            (*iv)=="GainChi2Prob1d"||(*iv)=="Pedestal1d"||
00247            (*iv)=="GainNPoints1d"||(*iv)=="GainHighPoint1d"||
00248            (*iv)=="GainLowPoint1d"||(*iv)=="GainEndPoint1d"||
00249            (*iv)=="GainFitResult2d"||(*iv)=="GainDynamicRange2d"||
00250            (*iv)=="GainSaturate2d"||
00251            (*iv)=="ScurveChi2ProbSummary"||(*iv)=="ScurveFitResultSummary"||
00252            (*iv)=="ScurveSigmasSummary"||(*iv)=="ScurveThresholdSummary"||
00253            (*iv)=="pixelAliveSummary"  || (*iv) == "SiPixelErrorsCalibDigis") 
00254           prefix="SUMCAL"; 
00255       }
00256       MonitorElement* temp; string tag;
00257       if((*iv).find("residual")!=string::npos){                           // track residuals
00258         tag = prefix + "_" + (*iv) + "_mean_" 
00259                                 + currDir.substr(currDir.find(dir_name));
00260         temp = getSummaryME(bei, tag);
00261         sum_mes.push_back(temp);
00262         tag = prefix + "_" + (*iv) + "_RMS_" 
00263                               + currDir.substr(currDir.find(dir_name));
00264         temp = getSummaryME(bei, tag);
00265         sum_mes.push_back(temp);
00266       }else if(prefix == "SUMCAL"){                  // calibrations
00267         if((*iv)=="Gain1d" || (*iv)=="GainChi2NDF1d" || (*iv)=="GainChi2Prob1d" ||
00268            (*iv)=="GainNPoints1d" || (*iv)=="GainHighPoint1d" ||
00269            (*iv)=="GainLowPoint1d" || (*iv)=="GainEndPoint1d" || 
00270            (*iv)=="GainDynamicRange2d" || (*iv)=="GainSaturate2d" ||
00271            (*iv)=="Pedestal1d" ||
00272            (*iv)=="ScurveChi2ProbSummary" || (*iv)=="ScurveFitResultSummary" ||
00273            (*iv)=="ScurveSigmasSummary" || (*iv)=="ScurveThresholdSummary"){                    
00274           tag = prefix + "_" + (*iv) + "_mean_" 
00275                                   + currDir.substr(currDir.find(dir_name));
00276           temp = getSummaryME(bei, tag);
00277           sum_mes.push_back(temp);
00278           tag = prefix + "_" + (*iv) + "_RMS_" 
00279                                   + currDir.substr(currDir.find(dir_name));
00280           temp = getSummaryME(bei, tag);
00281           sum_mes.push_back(temp);
00282         }else if((*iv) == "SiPixelErrorsCalibDigis"){
00283           tag = prefix + "_" + (*iv) + "_NCalibErrors_"
00284                                 + currDir.substr(currDir.find(dir_name));
00285           temp = getSummaryME(bei, tag);
00286           sum_mes.push_back(temp);
00287         }else if((*iv)=="GainFitResult2d"){
00288           tag = prefix + "_" + (*iv) + "_NNegativeFits_"
00289                                 + currDir.substr(currDir.find(dir_name));
00290           temp = getSummaryME(bei, tag);
00291           sum_mes.push_back(temp);
00292         }else if((*iv)=="pixelAliveSummary"){
00293           tag = prefix + "_" + (*iv) + "_FracOfPerfectPix_"
00294                                 + currDir.substr(currDir.find(dir_name));
00295           temp = getSummaryME(bei, tag);
00296           sum_mes.push_back(temp);
00297           tag = prefix + "_" + (*iv) + "_mean_"
00298                                 + currDir.substr(currDir.find(dir_name));
00299           temp = getSummaryME(bei, tag);
00300           sum_mes.push_back(temp);
00301         }
00302       }else{
00303         tag = prefix + "_" + (*iv) + "_" + currDir.substr(currDir.find(dir_name));
00304         temp = getSummaryME(bei, tag);
00305         sum_mes.push_back(temp);
00306         if((*iv)=="ndigis"){
00307           tag = prefix + "_" + (*iv) + "FREQ_" 
00308                                 + currDir.substr(currDir.find(dir_name));
00309           temp = getSummaryME(bei, tag);
00310           sum_mes.push_back(temp);
00311         }
00312         if(prefix=="SUMDIG" && (*iv)=="adc"){
00313           tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name));
00314           temp = bei->book1D(tag.c_str(), tag.c_str(),256, 0., 256.);
00315           sum_mes.push_back(temp);
00316         }
00317         if(prefix=="SUMCLU" && (*iv)=="charge"){
00318           tag = "ALLMODS_" + (*iv) + "COMB_" + currDir.substr(currDir.find(dir_name));
00319           temp = bei->book1D(tag.c_str(), tag.c_str(),500, 0., 500.); // To look to get the size automatically    
00320           sum_mes.push_back(temp);
00321         }
00322       }
00323     }
00324     if (sum_mes.size() == 0) {
00325       edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ;
00326       return;
00327     }
00328     vector<string> subdirs = bei->getSubdirs();
00329     int ndet = 0;
00330     for (vector<string>::const_iterator it = subdirs.begin();
00331        it != subdirs.end(); it++) {
00332       if (prefix!="SUMOFF" && (*it).find("Module_") == string::npos) continue;
00333       if (prefix=="SUMOFF" && (*it).find(isbarrel?"Layer_":"Disk_") == string::npos) continue;
00334       bei->cd(*it);
00335       ndet++;
00336       
00337       vector<string> contents = bei->getMEs(); 
00338       
00339       for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin();
00340            isum != sum_mes.end(); isum++) {
00341         for (vector<string>::const_iterator im = contents.begin();
00342              im != contents.end(); im++) {
00343           string sname = ((*isum)->getName());
00344           string tname = " ";
00345           tname = sname.substr(7,(sname.find("_",7)-6));
00346           if(sname.find("ALLMODS_adcCOMB_")!=string::npos) tname = "adc_";
00347           if(sname.find("ALLMODS_chargeCOMB_")!=string::npos) tname = "charge_";
00348           //if(sname.find("ALLMODS")!=string::npos) cout<<"sname and tname= "<<sname<<","<<tname<<endl;
00349           if(tname.find("FREQ")!=string::npos) tname = "ndigis_";
00350           if (((*im)).find(tname) == 0) {
00351             string fullpathname = bei->pwd() + "/" + (*im); 
00352 
00353             MonitorElement *  me = bei->get(fullpathname);
00354             
00355             if (me){ 
00356               if (sname.find("_RMS_")!=string::npos && 
00357                   sname.find("GainDynamicRange2d")==string::npos && 
00358                   sname.find("GainSaturate2d")==string::npos){
00359                 (*isum)->Fill(ndet, me->getRMS());
00360               }else if (sname.find("GainDynamicRange2d")!=string::npos ||
00361                        sname.find("GainSaturate2d")!=string::npos){
00362                 float SumOfEntries=0.; float SumOfSquaredEntries=0.; int SumOfPixels=0;
00363                 for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){
00364                   SumOfEntries+=me->getBinContent(cols,rows);
00365                   SumOfSquaredEntries+=(me->getBinContent(cols,rows))*(me->getBinContent(cols,rows));
00366                   SumOfPixels++;
00367                 }
00368                 float MeanInZ = SumOfEntries / float(SumOfPixels);
00369                 float RMSInZ = sqrt(SumOfSquaredEntries/float(SumOfPixels));
00370                 if(sname.find("_mean_")!=string::npos) (*isum)->Fill(ndet, MeanInZ);
00371                 if(sname.find("_RMS_")!=string::npos) (*isum)->Fill(ndet, RMSInZ);
00372               }else if (sname.find("_FracOfPerfectPix_")!=string::npos){
00373                 //printing cout<<"nbins = "<<me->getNbinsX()<<" , "<<me->getBinContent(me->getNbinsX()-1)<<" , "<<me->getBinContent(me->getNbinsX())<<endl;
00374                 float nlast = me->getBinContent(me->getNbinsX());
00375                 float nall = (me->getTH1F())->Integral(1,11);
00376                 //printing cout << nall << endl;
00377                 (*isum)->Fill(ndet, nlast/nall);
00378               }else if (sname.find("_NCalibErrors_")!=string::npos ||
00379                         sname.find("FREQ_")!=string::npos){
00380                 float nall = me->getEntries();
00381                 (*isum)->Fill(ndet, nall);
00382               }else if (sname.find("GainFitResult2d")!=string::npos){
00383                 int NegFitPixels=0;
00384                 for(int cols=1; cols!=me->getNbinsX()+1; cols++) for(int rows=1; rows!=me->getNbinsY()+1; rows++){
00385                   if(me->getBinContent(cols,rows)<0.) NegFitPixels++;
00386                 }
00387                 (*isum)->Fill(ndet, float(NegFitPixels));
00388               }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos){
00389                 (*isum)->getTH1F()->Add(me->getTH1F());
00390              }else if (sname.find("ALLMODS_chargeCOMB_")!=string::npos){
00391                 (*isum)->getTH1F()->Add(me->getTH1F());  
00392               }else{
00393                 (*isum)->Fill(ndet, me->getMean());
00394               }
00395               if(prefix=="SUMOFF"){
00396                 (*isum)->setAxisTitle(isbarrel?"Ladders":"Blades",1);
00397               }else if(sname.find("ALLMODS_adcCOMB_")!=string::npos){
00398                 (*isum)->setAxisTitle("Digi charge [ADC]",1);
00399              }else if(sname.find("ALLMODS_chargeCOMB_")!=string::npos){
00400                (*isum)->setAxisTitle("Digi charge [kElectrons]",1);
00401               }else{
00402                 (*isum)->setAxisTitle("Modules",1);
00403               }
00404               string title = " ";
00405               if (sname.find("_RMS_")!=string::npos){
00406                 title = "RMS of " + sname.substr(7,(sname.find("_",7)-7)) + " per module"; 
00407               }else if (sname.find("_FracOfPerfectPix_")!=string::npos){
00408                 title = "FracOfPerfectPix " + sname.substr(7,(sname.find("_",7)-7)) + " per module"; 
00409               }else if(sname.find("_NCalibErrors_")!=string::npos){
00410                 title = "Number of CalibErrors " + sname.substr(7,(sname.find("_",7)-7)) + " per module"; 
00411               }else if(sname.find("_NNegativeFits_")!=string::npos){
00412                 title = "Number of pixels with neg. fit result " + sname.substr(7,(sname.find("_",7)-7)) + " per module"; 
00413               }else if (sname.find("FREQ_")!=string::npos){
00414                 title = "NEvents with digis per module"; 
00415               }else if (sname.find("ALLMODS_adcCOMB_")!=string::npos){
00416                 title = "NDigis";
00417                }else if (sname.find("ALLMODS_chargeCOMB_")!=string::npos){
00418                title = "NDigis";
00419               }else{
00420                 if(prefix=="SUMOFF") title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + (isbarrel?" per Ladder":"per Blade"); 
00421                 else title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + " per Module"; 
00422               }
00423               (*isum)->setAxisTitle(title,2);
00424             }
00425             break;
00426           }
00427         }
00428       }
00429       bei->goUp();
00430     }
00431   } else {  
00432     vector<string> subdirs = bei->getSubdirs();
00433         if(isbarrel)
00434         {
00435         
00436         for (vector<string>::const_iterator it = subdirs.begin();
00437        it != subdirs.end(); it++) {
00438       if((bei->pwd()).find("Endcap")!=string::npos ||
00439          (bei->pwd()).find("AdditionalPixelErrors")!=string::npos) bei->goUp();
00440       bei->cd(*it);
00441       if((*it).find("Endcap")!=string::npos ||
00442          (*it).find("AdditionalPixelErrors")!=string::npos) continue;
00443       fillSummary(bei, dir_name, me_names, true); // Barrel
00444       bei->goUp();
00445     }
00446     string grandbarrel_structure_name;
00447     vector<string> grandbarrel_me_names;
00448     if (!configParser_->getMENamesForGrandBarrelSummary(grandbarrel_structure_name, grandbarrel_me_names)){
00449       cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Barrel Summary configuration parameters!! ";
00450       return;
00451     }
00452     fillGrandBarrelSummaryHistos(bei, grandbarrel_me_names);
00453 
00454         }
00455         else // Endcap
00456         {
00457 
00458     for (vector<string>::const_iterator it = subdirs.begin();
00459        it != subdirs.end(); it++) {
00460       if((bei->pwd()).find("Barrel")!=string::npos ||
00461          (bei->pwd()).find("AdditionalPixelErrors")!=string::npos) bei->goUp();
00462       bei->cd((*it));
00463       if ((*it).find("Barrel")!=string::npos ||
00464           (*it).find("AdditionalPixelErrors")!=string::npos) continue;
00465       fillSummary(bei, dir_name, me_names, false); // Endcap
00466       bei->goUp();
00467     }
00468     string grandendcap_structure_name;
00469     vector<string> grandendcap_me_names;
00470     if (!configParser_->getMENamesForGrandEndcapSummary(grandendcap_structure_name, grandendcap_me_names)){
00471       cout << "SiPixelActionExecutor::createSummary: Failed to read Grand Endcap Summary configuration parameters!! ";
00472       return;
00473     }
00474     fillGrandEndcapSummaryHistos(bei, grandendcap_me_names);
00475                 
00476 
00477         }
00478   }
00479   //printing cout<<"...leaving SiPixelActionExecutor::fillSummary!"<<endl;
00480 
00481 // End of cleanup
00482 
00483 
00484 }
00485 
00486 //=============================================================================================================
00487 void SiPixelActionExecutor::fillFEDErrorSummary(DQMStore* bei,
00488                                                 string dir_name,
00489                                                 vector<string>& me_names) {
00490   //printing cout<<"entering SiPixelActionExecutor::fillFEDErrorSummary..."<<endl;
00491   string currDir = bei->pwd();
00492   string prefix;
00493   if(source_type_==0) prefix="SUMRAW";
00494   else if(source_type_==20) prefix="SUMOFF";
00495   if (currDir.find(dir_name) != string::npos)  {
00496     vector<MonitorElement*> sum_mes;
00497     for (vector<string>::const_iterator iv = me_names.begin();
00498          iv != me_names.end(); iv++) {
00499       if(source_type_==5||source_type_==6){
00500         if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00501            (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00502            (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00503            (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap") 
00504           prefix="SUMRAW";
00505       }
00506       string tag = prefix + "_" + (*iv) + "_FEDErrors";
00507       MonitorElement* temp = getFEDSummaryME(bei, tag);
00508       sum_mes.push_back(temp);
00509     }
00510     if (sum_mes.size() == 0) {
00511       edm::LogInfo("SiPixelActionExecutor") << " Summary MEs can not be created" << "\n" ;
00512       return;
00513     }
00514     vector<string> subdirs = bei->getSubdirs();
00515     int ndet = 0;
00516     for (vector<string>::const_iterator it = subdirs.begin();
00517        it != subdirs.end(); it++) {
00518       if ( (*it).find("FED_") == string::npos) continue;
00519       bei->cd(*it);
00521       string fedid = (*it).substr((*it).find("_")+1);
00522       if(fedid=="0") ndet = 1;
00523       else if(fedid=="1") ndet = 2;
00524       else if(fedid=="2") ndet = 3;
00525       else if(fedid=="3") ndet = 4;
00526       else if(fedid=="4") ndet = 5;
00527       else if(fedid=="5") ndet = 6;
00528       else if(fedid=="6") ndet = 7;
00529       else if(fedid=="7") ndet = 8;
00530       else if(fedid=="8") ndet = 9;
00531       else if(fedid=="9") ndet = 10;
00532       else if(fedid=="10") ndet = 11;
00533       else if(fedid=="11") ndet = 12;
00534       else if(fedid=="12") ndet = 13;
00535       else if(fedid=="13") ndet = 14;
00536       else if(fedid=="14") ndet = 15;
00537       else if(fedid=="15") ndet = 16;
00538       else if(fedid=="16") ndet = 17;
00539       else if(fedid=="17") ndet = 18;
00540       else if(fedid=="18") ndet = 19;
00541       else if(fedid=="19") ndet = 20;
00542       else if(fedid=="20") ndet = 21;
00543       else if(fedid=="21") ndet = 22;
00544       else if(fedid=="22") ndet = 23;
00545       else if(fedid=="23") ndet = 24;
00546       else if(fedid=="24") ndet = 25;
00547       else if(fedid=="25") ndet = 26;
00548       else if(fedid=="26") ndet = 27;
00549       else if(fedid=="27") ndet = 28;
00550       else if(fedid=="28") ndet = 29;
00551       else if(fedid=="29") ndet = 30;
00552       else if(fedid=="30") ndet = 31;
00553       else if(fedid=="31") ndet = 32;
00554       else if(fedid=="32") ndet = 33;
00555       else if(fedid=="33") ndet = 34;
00556       else if(fedid=="34") ndet = 35;
00557       else if(fedid=="35") ndet = 36;
00558       else if(fedid=="36") ndet = 37;
00559       else if(fedid=="37") ndet = 38;
00560       else if(fedid=="38") ndet = 39;
00561       else if(fedid=="39") ndet = 40;
00562       vector<string> contents = bei->getMEs(); 
00563       
00564       for (vector<MonitorElement*>::const_iterator isum = sum_mes.begin();
00565            isum != sum_mes.end(); isum++) {
00566         for (vector<string>::const_iterator im = contents.begin();
00567              im != contents.end(); im++) {
00568           string sname = ((*isum)->getName());
00569           string tname = " ";
00570           tname = sname.substr(7,(sname.find("_",7)-6));
00571           if (((*im)).find(tname) == 0) {
00572             string fullpathname = bei->pwd() + "/" + (*im); 
00573             MonitorElement *  me = bei->get(fullpathname);
00574             
00575             if (me){ 
00576               (*isum)->Fill(ndet-1, me->getMean());
00577               (*isum)->setAxisTitle("FED #",1);
00578               string title = " ";
00579               title = "Mean " + sname.substr(7,(sname.find("_",7)-7)) + " per FED"; 
00580               (*isum)->setAxisTitle(title,2);
00581             }
00582             break;
00583           }
00584         }
00585       }
00586       bei->goUp();
00587     }
00588   } else {  
00589     vector<string> subdirs = bei->getSubdirs();
00590     for (vector<string>::const_iterator it = subdirs.begin();
00591        it != subdirs.end(); it++) {
00592       if((*it).find("Endcap")!=string::npos ||
00593          (*it).find("Barrel")!=string::npos) continue;
00594       bei->cd(*it);
00595       fillFEDErrorSummary(bei, dir_name, me_names);
00596       bei->goUp();
00597     }
00598   }
00599   //printing cout<<"...leaving SiPixelActionExecutor::fillFEDErrorSummary!"<<endl;
00600 }
00601 
00602 
00603 //=============================================================================================================
00604 void SiPixelActionExecutor::fillGrandBarrelSummaryHistos(DQMStore* bei,
00605                                                          vector<string>& me_names) {
00606 //printing cout<<"Entering SiPixelActionExecutor::fillGrandBarrelSummaryHistos..."<<endl;
00607   vector<MonitorElement*> gsum_mes;
00608   string path_name = bei->pwd();
00609   string dir_name =  path_name.substr(path_name.find_last_of("/")+1);
00610   if ((dir_name.find("DQMData") == 0) ||
00611       (dir_name.find("Pixel") == 0) ||
00612       (dir_name.find("AdditionalPixelErrors") == 0) ||
00613       (dir_name.find("Endcap") == 0) ||
00614       (dir_name.find("HalfCylinder") == 0) ||
00615       (dir_name.find("Disk") == 0) ||
00616       (dir_name.find("Blade") == 0) ||
00617       (dir_name.find("Panel") == 0) ) return;
00618   vector<string> subdirs = bei->getSubdirs();
00619   int nDirs = subdirs.size();
00620   int iDir =0;
00621   int nbin = 0;
00622   int nbin_i = 0; 
00623   int nbin_subdir = 0; 
00624   int cnt=0;
00625   for (vector<string>::const_iterator it = subdirs.begin();
00626        it != subdirs.end(); it++) {
00627     cnt++;
00628     bei->cd(*it);
00629 
00630     vector<string> contents = bei->getMEs();
00631     
00632     bei->goUp();
00633     
00634     string prefix;
00635     if(source_type_==0) prefix="SUMRAW";
00636     else if (source_type_==1) prefix="SUMDIG";
00637     else if (source_type_==2) prefix="SUMCLU";
00638     else if (source_type_==3) prefix="SUMRES";
00639     else if (source_type_==4) prefix="SUMHIT";
00640     else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
00641     else if (source_type_==20) prefix="SUMOFF";
00642   
00643     for (vector<string>::const_iterator im = contents.begin();
00644          im != contents.end(); im++) {
00645 //printing cout<<"A: iterating over "<<(*im)<<" now:"<<endl;
00646       for (vector<string>::const_iterator iv = me_names.begin();
00647            iv != me_names.end(); iv++) {
00648         string var = "_" + (*iv) + "_";
00649 //printing cout<<"\t B: iterating over "<<(*iv)<<" now, var is set to: "<<var<<endl;
00650         if ((*im).find(var) != string::npos) {
00651            string full_path = (*it) + "/" +(*im);
00652            MonitorElement * me = bei->get(full_path.c_str());
00653            if (!me) continue; 
00654            if(source_type_==5||source_type_==6){
00655              if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00656                 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00657                 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00658                 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap") 
00659                prefix="SUMRAW";
00660              else if((*iv)=="ndigis"||(*iv)=="adc" ||
00661                      (*iv)=="ndigisFREQ" || (*iv)=="adcCOMB")
00662                prefix="SUMDIG";
00663              else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
00664                      (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
00665                      (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
00666                prefix="SUMCLU";
00667              else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
00668                      (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
00669                prefix="SUMRES";
00670              else if((*iv)=="ClustX"||(*iv)=="ClustY")
00671                prefix="SUMHIT";
00672              else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
00673                      (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
00674                      (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
00675                      (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
00676                      (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
00677                      (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
00678                      (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
00679                      (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
00680                      (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
00681                      (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
00682                      (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
00683                      (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
00684                      (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
00685                      (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
00686                      (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
00687                      (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix" ||
00688                      (*iv)=="SiPixelErrorsCalibDigis_NCalibErrors" )
00689                prefix="SUMCAL";
00690            }
00691            int actual_size = gsum_mes.size();
00692            int wanted_size = me_names.size();
00693            if (actual_size !=  wanted_size) {
00694              nbin = me->getTH1F()->GetNbinsX();        
00695              string me_name = prefix + "_" + (*iv) + "_" + dir_name;
00696              if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
00697              else if(prefix=="SUMOFF" && dir_name=="Barrel") nbin=192;
00698              else if((*iv)=="adcCOMB") nbin=256;
00699              else if(dir_name=="Barrel") nbin=768;
00700              else if(prefix=="SUMOFF" && dir_name.find("Shell")!=string::npos) nbin=48;
00701              else if(dir_name.find("Shell")!=string::npos) nbin=192;
00702              else nbin=nbin*nDirs;
00703             //printing cout<<"me_name to be created= "<<me_name<<endl;
00704              getGrandSummaryME(bei, nbin, me_name, gsum_mes);
00705            }
00706            for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
00707                 igm != gsum_mes.end(); igm++) {
00708 //printing cout<<"\t \t C: iterating over "<<(*igm)->getName()<<" now:"<<endl;
00709              if ((*igm)->getName().find(var) != string::npos) {
00710                if(prefix=="SUMOFF") (*igm)->setAxisTitle("Ladders",1);
00711                else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
00712                else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [MeV]",1);
00713                else (*igm)->setAxisTitle("Modules",1);
00714                string title="";
00715                if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Ladder"; 
00716                else if((*igm)->getName().find("FREQ_") != string::npos) title = "NEvents with digis per Module"; 
00717                else if((*igm)->getName().find("COMB_") != string::npos) title = "NDigis";
00718                else title = "mean " + (*iv) + " per Module"; 
00719                (*igm)->setAxisTitle(title,2);
00720                if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
00721                  nbin_subdir=256;
00722               }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
00723                 nbin_subdir=500;
00724                }else if((*igm)->getName().find("Ladder") != string::npos){
00725                  nbin_i=0; nbin_subdir=4;
00726                }else if((*igm)->getName().find("Layer") != string::npos){
00727                  nbin_i=(cnt-1)*4; nbin_subdir=4;
00728                }else if((*igm)->getName().find("Shell") != string::npos){
00729                  if(prefix!="SUMOFF"){
00730                    if(iDir==0){ nbin_i=0; nbin_subdir=40; }
00731                    else if(iDir==1){ nbin_i=40; nbin_subdir=64; }
00732                    else if(iDir==2){ nbin_i=104; nbin_subdir=88; }
00733                  }else{
00734                    if(iDir==0){ nbin_i=0; nbin_subdir=10; }
00735                    else if(iDir==1){ nbin_i=10; nbin_subdir=16; }
00736                    else if(iDir==2){ nbin_i=26; nbin_subdir=22; }
00737                  }
00738                }else if((*igm)->getName().find("Barrel") != string::npos){
00739                  if(prefix!="SUMOFF"){
00740                    if(iDir==0){ nbin_i=0; nbin_subdir=192; }
00741                    else if(iDir==1){ nbin_i=192; nbin_subdir=192; }
00742                    else if(iDir==2){ nbin_i=384; nbin_subdir=192; }
00743                    else if(iDir==3){ nbin_i=576; nbin_subdir=192; }
00744                  }else{
00745                    if(iDir==0){ nbin_i=0; nbin_subdir=48; }
00746                    else if(iDir==1){ nbin_i=48; nbin_subdir=48; }
00747                    else if(iDir==2){ nbin_i=96; nbin_subdir=48; }
00748                    else if(iDir==3){ nbin_i=144; nbin_subdir=48; }
00749                  }
00750                }
00751 //             for (int k = 1; k < nbin_subdir+1; k++) {
00752                   if((*igm)->getName().find("ndigisFREQ")==string::npos){ 
00753                     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)){
00754 //                              cout << "C\t" << (*igm)->getName() << "\t" << me->getTH1F()->GetNbinsX() << "\t" << (*igm)->getTH1F()->GetNbinsX() << endl;
00755 //                              cout << "C\t" << (*igm)->getName() << "\t" << me->getTH1F()->GetBinLowEdge(1) << "\t" << (*igm)->getTH1F()->GetBinLowEdge(1) << endl;
00756 //                              cout << "C\t" << (*igm)->getName() << "\t" << me->getTH1F()->GetBinLowEdge(me->getTH1F()->GetNbinsX()) << "\t" << (*igm)->getTH1F()->GetBinLowEdge((*igm)->getTH1F()->GetNbinsX()) << endl;
00757                                 (*igm)->getTH1F()->Add(me->getTH1F());
00758 //                    float former = (*igm)->getBinContent(k);
00759 //                    float latest = me->getBinContent(k);
00760 //                    float now = former + latest;
00761 //                    (*igm)->setBinContent(k, now);
00762                     }else{
00763                       for (int k = 1; k < nbin_subdir+1; k++) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
00764                     }
00765                   }else if(me->getName().find("ndigisFREQ")!=string::npos){
00766                     for (int k = 1; k < nbin_subdir+1; k++) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
00767                   }
00768 //             }// for
00769              }
00770            }
00771         }
00772       }
00773     }
00774     iDir++;
00775   }
00776 //printing cout<<"...leaving SiPixelActionExecutor::fillGrandBarrelSummaryHistos!"<<endl;
00777 }
00778 
00779 //=============================================================================================================
00780 void SiPixelActionExecutor::fillGrandEndcapSummaryHistos(DQMStore* bei,
00781                                                          vector<string>& me_names) {
00782 //printing cout<<"Entering SiPixelActionExecutor::fillGrandEndcapSummaryHistos..."<<endl;
00783   vector<MonitorElement*> gsum_mes;
00784   string path_name = bei->pwd();
00785   
00786   string dir_name =  path_name.substr(path_name.find_last_of("/")+1);
00787   if ((dir_name.find("DQMData") == 0) ||
00788       (dir_name.find("Pixel") == 0) ||
00789       (dir_name.find("AdditionalPixelErrors") == 0) ||
00790       (dir_name.find("Barrel") == 0) ||
00791       (dir_name.find("Shell") == 0) ||
00792       (dir_name.find("Layer") == 0) ||
00793       (dir_name.find("Ladder") == 0) ) return;
00794   vector<string> subdirs = bei->getSubdirs();
00795   int iDir =0;
00796   int nbin = 0;
00797   int nbin_i = 0; 
00798   int nbin_subdir = 0; 
00799   int cnt=0;
00800   for (vector<string>::const_iterator it = subdirs.begin();
00801        it != subdirs.end(); it++) {
00802     cnt++;
00803     bei->cd(*it);
00804     vector<string> contents = bei->getMEs();
00805    
00806     bei->goUp();
00807     
00808     string prefix;
00809     if(source_type_==0) prefix="SUMRAW";
00810     else if (source_type_==1) prefix="SUMDIG";
00811     else if (source_type_==2) prefix="SUMCLU";
00812     else if (source_type_==3) prefix="SUMRES";
00813     else if (source_type_==4) prefix="SUMHIT";
00814     else if (source_type_>=7 && source_type_<20) prefix="SUMCAL";
00815     else if (source_type_==20) prefix="SUMOFF";
00816     
00817     for (vector<string>::const_iterator im = contents.begin();
00818          im != contents.end(); im++) {
00819       for (vector<string>::const_iterator iv = me_names.begin();
00820            iv != me_names.end(); iv++) {
00821         string var = "_" + (*iv) + "_";
00822         if ((*im).find(var) != string::npos) {
00823            string full_path = (*it) + "/" +(*im);
00824            MonitorElement * me = bei->get(full_path.c_str());
00825            if (!me) continue; 
00826            if(source_type_==5||source_type_==6){
00827              if((*iv)=="errorType"||(*iv)=="NErrors"||(*iv)=="fullType"||(*iv)=="chanNmbr"||
00828                 (*iv)=="TBMType"||(*iv)=="EvtNbr"||(*iv)=="evtSize"||(*iv)=="linkId"||
00829                 (*iv)=="ROCId"||(*iv)=="DCOLId"||(*iv)=="PXId"||(*iv)=="ROCNmbr"||
00830                 (*iv)=="TBMMessage"||(*iv)=="Type36Hitmap") 
00831                prefix="SUMRAW";
00832              else if((*iv)=="ndigis"||(*iv)=="adc" ||
00833                      (*iv)=="ndigisFREQ"||(*iv)=="adcCOMB")
00834                prefix="SUMDIG";
00835              else if((*iv)=="nclusters"||(*iv)=="x"||(*iv)=="y"||(*iv)=="charge"||(*iv)=="chargeCOMB"||
00836                      (*iv)=="size"||(*iv)=="sizeX"||(*iv)=="sizeY"||(*iv)=="minrow"||
00837                      (*iv)=="maxrow"||(*iv)=="mincol"||(*iv)=="maxcol")
00838                prefix="SUMCLU";
00839              else if((*iv)=="residualX_mean"||(*iv)=="residualY_mean"||
00840                      (*iv)=="residualX_RMS"||(*iv)=="residualY_RMS")
00841                prefix="SUMRES";
00842              else if((*iv)=="ClustX"||(*iv)=="ClustY")
00843                prefix="SUMHIT";
00844              else if((*iv)=="Gain1d_mean"||(*iv)=="GainChi2NDF1d_mean"||
00845                      (*iv)=="GainChi2Prob1d_mean"||(*iv)=="Pedestal1d_mean"||
00846                      (*iv)=="ScurveChi2ProbSummary_mean"||(*iv)=="ScurveFitResultSummary_mean"||
00847                      (*iv)=="ScurveSigmasSummary_mean"||(*iv)=="ScurveThresholdSummary_mean"||
00848                      (*iv)=="Gain1d_RMS"||(*iv)=="GainChi2NDF1d_RMS"||
00849                      (*iv)=="GainChi2Prob1d_RMS"||(*iv)=="Pedestal1d_RMS"||
00850                      (*iv)=="GainNPoints1d_mean" || (*iv)=="GainNPoints1d_RMS" ||
00851                      (*iv)=="GainHighPoint1d_mean" || (*iv)=="GainHighPoint1d_RMS" ||
00852                      (*iv)=="GainLowPoint1d_mean" || (*iv)=="GainLowPoint1d_RMS" ||
00853                      (*iv)=="GainEndPoint1d_mean" || (*iv)=="GainEndPoint1d_RMS" ||
00854                      (*iv)=="GainFitResult2d_mean" || (*iv)=="GainFitResult2d_RMS" ||
00855                      (*iv)=="GainDynamicRange2d_mean" || (*iv)=="GainDynamicRange2d_RMS" ||
00856                      (*iv)=="GainSaturate2d_mean" || (*iv)=="GainSaturate2d_RMS" ||
00857                      (*iv)=="ScurveChi2ProbSummary_RMS"||(*iv)=="ScurveFitResultSummary_RMS"||
00858                      (*iv)=="ScurveSigmasSummary_RMS"||(*iv)=="ScurveThresholdSummary_RMS"||
00859                      (*iv)=="pixelAliveSummary_mean"||(*iv)=="pixelAliveSummary_FracOfPerfectPix"|| 
00860                      (*iv) == "SiPixelErrorsCalibDigis_NCalibErrors")
00861                prefix="SUMCAL"; 
00862            }
00863            int actual_size = gsum_mes.size();
00864            int wanted_size = me_names.size();
00865            if (actual_size !=  wanted_size) {
00866              nbin = me->getTH1F()->GetNbinsX();        
00867              string me_name = prefix + "_" + (*iv) + "_" + dir_name;
00868              if((*iv)=="adcCOMB"||(*iv)=="chargeCOMB") me_name = "ALLMODS_" + (*iv) + "_" + dir_name;
00869              else if(prefix=="SUMOFF" && dir_name=="Endcap") nbin=96;
00870              else if(dir_name=="Endcap") nbin=672;
00871              else if(prefix=="SUMOFF" && dir_name.find("HalfCylinder")!=string::npos) nbin=24;
00872              else if(dir_name.find("HalfCylinder")!=string::npos) nbin=168;
00873              else if(prefix=="SUMOFF" && dir_name.find("Disk")!=string::npos) nbin=12;
00874              else if(dir_name.find("Disk")!=string::npos) nbin=84;
00875              else if(dir_name.find("Blade")!=string::npos) nbin=7;
00876              else if(dir_name.find("Panel_1")!=string::npos) nbin=4;
00877              else if(dir_name.find("Panel_2")!=string::npos) nbin=3;
00878              getGrandSummaryME(bei, nbin, me_name, gsum_mes);
00879            }
00880            for (vector<MonitorElement*>::const_iterator igm = gsum_mes.begin();
00881                 igm != gsum_mes.end(); igm++) { 
00882              if ((*igm)->getName().find(var) != string::npos) {
00883                if(prefix=="SUMOFF") (*igm)->setAxisTitle("Blades",1);
00884                else if((*igm)->getName().find("adcCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [ADC]",1);
00885                else if((*igm)->getName().find("chargeCOMB_")!=string::npos) (*igm)->setAxisTitle("Digi charge [MeV]",1);
00886                else (*igm)->setAxisTitle("Modules",1);
00887                string title="";
00888                if(prefix=="SUMOFF") title = "mean " + (*iv) + " per Blade"; 
00889                else if((*igm)->getName().find("FREQ_") != string::npos) title = "NEvents with digis per Module"; 
00890                else if((*igm)->getName().find("COMB_")!=string::npos) title = "NDigis";
00891                else title = "mean " + (*iv) + " per Module"; 
00892                (*igm)->setAxisTitle(title,2);
00893                nbin_i=0; 
00894                if((*igm)->getName().find("ALLMODS_adcCOMB_")!=string::npos){
00895                  nbin_subdir=256;
00896                   }else if((*igm)->getName().find("ALLMODS_chargeCOMB_")!=string::npos){
00897                 nbin_subdir=500;
00898                }else if((*igm)->getName().find("Panel_1") != string::npos){
00899                  nbin_subdir=4;
00900                }else if((*igm)->getName().find("Panel_2") != string::npos){
00901                  nbin_subdir=3;
00902                }else if((*igm)->getName().find("Blade") != string::npos){
00903                  if((*im).find("_1") != string::npos) nbin_subdir=4;
00904                  if((*im).find("_2") != string::npos) {nbin_i=4; nbin_subdir=3;}
00905                }else if((*igm)->getName().find("Disk") != string::npos){
00906                  nbin_i=((cnt-1)%12)*7; nbin_subdir=7;
00907                }else if((*igm)->getName().find("HalfCylinder") != string::npos){
00908                  if(prefix!="SUMOFF"){
00909                    nbin_subdir=84;
00910                    if((*im).find("_2") != string::npos) nbin_i=84;
00911                  }else{
00912                    nbin_subdir=12;
00913                    if((*im).find("_2") != string::npos) nbin_i=12;
00914                  }
00915                }else if((*igm)->getName().find("Endcap") != string::npos){
00916                  if(prefix!="SUMOFF"){
00917                    nbin_subdir=168;
00918                    if((*im).find("_mO") != string::npos) nbin_i=168;
00919                    if((*im).find("_pI") != string::npos) nbin_i=336;
00920                    if((*im).find("_pO") != string::npos) nbin_i=504;
00921                  }else{
00922                    nbin_subdir=24;
00923                    if((*im).find("_mO") != string::npos) nbin_i=24;
00924                    if((*im).find("_pI") != string::npos) nbin_i=48;
00925                    if((*im).find("_pO") != string::npos) nbin_i=72;
00926                  }
00927                }
00928 
00929 //             for (int k = 1; k < nbin_subdir+1; k++) {
00930                   if((*igm)->getName().find("ndigisFREQ")==string::npos){ 
00931                     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)){
00932 //                              cout << "aC\t" << (*igm)->getName() << "\t" << me->getTH1F()->GetNbinsX() << "\t" << (*igm)->getTH1F()->GetNbinsX() << endl;
00933                                 (*igm)->getTH1F()->Add(me->getTH1F());
00934 //                    float former = (*igm)->getBinContent(k);
00935 //                    float latest = me->getBinContent(k);
00936 //                    float now = former + latest;
00937 //                    (*igm)->setBinContent(k, now);
00938                     }else{
00939                       for (int k = 1; k < nbin_subdir+1; k++) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
00940                     }
00941                   }else if(me->getName().find("ndigisFREQ")!=string::npos){
00942                     for (int k = 1; k < nbin_subdir+1; k++) (*igm)->setBinContent(k+nbin_i, me->getBinContent(k));
00943                   }
00944 //             }// for
00945 
00946              }
00947            }
00948         }
00949       }
00950     } 
00951     iDir++;
00952   } 
00953 }
00954 //=============================================================================================================
00955 //
00956 // -- Get Summary ME
00957 //
00958 void SiPixelActionExecutor::getGrandSummaryME(DQMStore* bei,
00959                                               int nbin, 
00960                                               string& me_name, 
00961                                               vector<MonitorElement*> & mes) {
00962 //printing cout<<"Entering SiPixelActionExecutor::getGrandSummaryME for: "<<me_name<<endl;
00963   if((bei->pwd()).find("Pixel")==string::npos) return;
00964   vector<string> contents = bei->getMEs();
00965       
00966   for (vector<string>::const_iterator it = contents.begin();
00967        it != contents.end(); it++) {
00968        //printing cout<<"in grand summary me: "<<me_name<<","<<(*it)<<endl;
00969     if ((*it).find(me_name) == 0) {
00970       string fullpathname = bei->pwd() + "/" + me_name;
00971 
00972       MonitorElement* me = bei->get(fullpathname);
00973       
00974       if (me) {
00975 //      cout<<"Found grand ME: "<<fullpathname<<endl;
00976         me->Reset();
00977         mes.push_back(me);
00978         //printing cout<<"reset and add the following me: "<<me->getName()<<endl;
00979         return;
00980       }
00981     }
00982   }
00983 //  MonitorElement* temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),nbin,1.,nbin+1.);
00984 //  if (temp_me) mes.push_back(temp_me);
00985   MonitorElement* temp_me(0);
00986   if(me_name.find("ALLMODS_adcCOMB_")!=string::npos || me_name.find("ALLMODS_chargeCOMB_")!=string::npos) temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),nbin,0,nbin);
00987   else temp_me = bei->book1D(me_name.c_str(),me_name.c_str(),nbin,1.,nbin+1.);
00988   if (temp_me) mes.push_back(temp_me);
00989 
00990 //  if(temp_me) cout<<"finally found grand ME: "<<me_name<<endl;
00991 }
00992 
00993 
00994 //=============================================================================================================
00995 //
00996 // -- Get Summary ME
00997 //
00998 MonitorElement* SiPixelActionExecutor::getSummaryME(DQMStore* bei,
00999                                                     string me_name) {
01000 //printing cout<<"Entering SiPixelActionExecutor::getSummaryME for: "<<me_name<<endl;
01001   MonitorElement* me = 0;
01002   if((bei->pwd()).find("Pixel")==string::npos) return me;
01003   vector<string> contents = bei->getMEs();    
01004   
01005   for (vector<string>::const_iterator it = contents.begin();
01006        it != contents.end(); it++) {
01007     if ((*it).find(me_name) == 0) {
01008       string fullpathname = bei->pwd() + "/" + (*it); 
01009       me = bei->get(fullpathname);
01010       
01011       if (me) {
01012       //printing cout<<"got this ME: "<<fullpathname<<endl;
01013         me->Reset();
01014         return me;
01015       }
01016     }
01017   }
01018   contents.clear();
01019   
01020   if(me_name.find("SUMOFF")==string::npos){
01021     if(me_name.find("Panel_2")!=string::npos)  me = bei->book1D(me_name.c_str(), me_name.c_str(),3,1.,4.);
01022     else me = bei->book1D(me_name.c_str(), me_name.c_str(),4,1.,5.);
01023   }else if(me_name.find("Layer_1")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),10,1.,11.);
01024   }else if(me_name.find("Layer_2")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),16,1.,17.);
01025   }else if(me_name.find("Layer_3")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),22,1.,23.);
01026   }else if(me_name.find("Disk_")!=string::npos){ me = bei->book1D(me_name.c_str(), me_name.c_str(),12,1.,13.);
01027   }
01028   
01029 //  if(me) cout<<"Finally got this ME: "<<me_name<<endl;
01030   //if(me_name.find("ALLMODS_adc_")!=string::npos) me = bei->book1D(me_name.c_str(), me_name.c_str(),256, 0., 256.);
01031   
01032   //printing cout<<"...leaving SiPixelActionExecutor::getSummaryME!"<<endl;
01033   return me;
01034 }
01035 
01036 
01037 //=============================================================================================================
01038 MonitorElement* SiPixelActionExecutor::getFEDSummaryME(DQMStore* bei,
01039                                                        string me_name) {
01040 //printing cout<<"Entering SiPixelActionExecutor::getFEDSummaryME..."<<endl;
01041   MonitorElement* me = 0;
01042   if((bei->pwd()).find("Pixel")==string::npos) return me;
01043   vector<string> contents = bei->getMEs();
01044       
01045   for (vector<string>::const_iterator it = contents.begin();
01046        it != contents.end(); it++) {
01047     if ((*it).find(me_name) == 0) {
01048       string fullpathname = bei->pwd() + "/" + (*it); 
01049 
01050       me = bei->get(fullpathname);
01051       
01052       if (me) {
01053       //printing cout<<"got the ME: "<<fullpathname<<endl;
01054         me->Reset();
01055         return me;
01056       }
01057     }
01058   }
01059   contents.clear();
01060   me = bei->book1D(me_name.c_str(), me_name.c_str(),40,-0.5,39.5);
01061   //if(me) cout<<"finally got the ME: "<<me_name<<endl;
01062   return me;
01063   //printing cout<<"...leaving SiPixelActionExecutor::getFEDSummaryME!"<<endl;
01064 }
01065 
01066 //=============================================================================================================
01067 void SiPixelActionExecutor::bookOccupancyPlots(DQMStore* bei, bool hiRes, bool isbarrel) // Polymorphism
01068 {
01069 
01070         vector<string> subdirs = bei->getSubdirs();
01071         for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++)
01072         {
01073                 if(isbarrel && (*it).find("Barrel")==string::npos) continue;
01074                 if(!isbarrel && (*it).find("Endcap")==string::npos) continue;
01075                 
01076                 if((*it).find("Module_")!=string::npos) continue;
01077                 bei->cd(*it);
01078                 bookOccupancyPlots(bei, hiRes, isbarrel);
01079                 if(!hiRes){
01080                         //occupancyprinting cout<<"booking low res barrel occ plot now!"<<endl;
01081                         OccupancyMap = bei->book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (4 pix per bin)",isbarrel?208:130,0.,isbarrel?416.:260.,80,0.,160.);
01082                 }else{
01083                         //occupancyprinting cout<<"booking high res barrel occ plot now!"<<endl;
01084                         OccupancyMap = bei->book2D((isbarrel?"barrelOccupancyMap":"endcapOccupancyMap"),"Barrel Digi Occupancy Map (1 pix per bin)",isbarrel?416:260,0.,isbarrel?416.:260.,160,0.,160.);
01085                 }
01086                 OccupancyMap->setAxisTitle("Columns",1);
01087                 OccupancyMap->setAxisTitle("Rows",2);
01088 
01089                 bei->goUp();
01090 
01091         }
01092 
01093 
01094         
01095 }
01096 //=============================================================================================================
01097 void SiPixelActionExecutor::bookOccupancyPlots(DQMStore* bei, bool hiRes) {
01098 
01099         // Barrel
01100         bei->cd();
01101         bei->setCurrentFolder("Pixel");
01102         this->bookOccupancyPlots(bei, hiRes, true);
01103 
01104         // Endcap
01105         bei->cd();
01106         bei->setCurrentFolder("Pixel");
01107         this->bookOccupancyPlots(bei, hiRes, false);
01108 
01109 }
01110 
01111 void SiPixelActionExecutor::createOccupancy(DQMStore* bei) {
01112 //std::cout<<"entering SiPixelActionExecutor::createOccupancy..."<<std::endl;
01113   bei->cd();
01114   fillOccupancy(bei, true);
01115   bei->cd();
01116   fillOccupancy(bei, false);
01117   bei->cd();
01118 //std::cout<<"leaving SiPixelActionExecutor::createOccupancy..."<<std::endl;
01119 }
01120 
01121 //=============================================================================================================
01122 
01123 void SiPixelActionExecutor::fillOccupancy(DQMStore* bei, bool isbarrel)
01124 {
01125         //occupancyprinting cout<<"entering SiPixelActionExecutor::fillOccupancy..."<<std::endl;
01126         string currDir = bei->pwd();
01127         string dname = currDir.substr(currDir.find_last_of("/")+1);
01128         QRegExp rx("Module_");
01129         //occupancyprinting cout<<"currDir= "<<currDir<< " , dname= "<<dname<<std::endl;
01130                 
01131     if(rx.search(dname)!=-1 && currDir.find("Pixel/Endcap/HalfCylinder_mI/Disk_1/Blade_01/Panel_2/Module_2")==string::npos){ // Skipping noisy module/ROC
01132                 vector<string> meVec = bei->getMEs();
01133                 for (vector<string>::const_iterator it = meVec.begin(); it != meVec.end(); it++) {
01134                         string full_path = currDir + "/" + (*it);
01135                         if(full_path.find("hitmap_siPixelDigis")!=string::npos){ // If we have the hitmap ME
01136                                 MonitorElement * me = bei->get(full_path);
01137                                 if (!me) continue;
01138                                 //occupancyprinting cout << full_path << endl;
01139                                 string path = full_path;
01140                                 while (path.find_last_of("/") != 5) // Stop before Pixel/
01141                                 {
01142                                         path = path.substr(0,path.find_last_of("/"));
01143                                                         cout << "\t" << path << endl;
01144                                         OccupancyMap = bei->get(path + "/" + (isbarrel?"barrel":"endcap") + "OccupancyMap");
01145                                         
01146                                         if(OccupancyMap){ 
01147                                                 //occupancyprinting cout<<"I found the occupancy map!"<<std::endl;
01148                                                 
01149                                                 
01150                                                 if(!isbarrel)
01151                                                 {
01152 
01153                 cout << full_path << endl;
01154                 
01155                 cout << "OccupancyMap" <<endl;
01156                 cout << "X:\t" << OccupancyMap->getTH2F()->GetNbinsX() << "\tY:\t" << OccupancyMap->getTH2F()->GetNbinsY() << endl;
01157                 cout << OccupancyMap->getTH2F()->ProjectionX()->GetBinLowEdge(1) << "\t" << OccupancyMap->getTH2F()->ProjectionX()->GetBinLowEdge(OccupancyMap->getTH2F()->GetNbinsX()+1) << endl;
01158                 cout << OccupancyMap->getTH2F()->ProjectionY()->GetBinLowEdge(1) << "\t" << OccupancyMap->getTH2F()->ProjectionY()->GetBinLowEdge(OccupancyMap->getTH2F()->GetNbinsY()+1) << endl;
01159 
01160                 cout << "ME" << endl;
01161                 cout << "X:\t" << me->getTH2F()->GetNbinsX() << "\tY:\t" << me->getTH2F()->GetNbinsY() << endl;
01162                 cout << me->getTH2F()->ProjectionX()->GetBinLowEdge(1) << "\t" << me->getTH2F()->ProjectionX()->GetBinLowEdge(me->getTH2F()->GetNbinsX()+1) << endl;
01163                 cout << me->getTH2F()->ProjectionY()->GetBinLowEdge(1) << "\t" << me->getTH2F()->ProjectionY()->GetBinLowEdge(me->getTH2F()->GetNbinsY()+1) << endl;
01164                 cout << "--------------------" << endl;                                         
01165                                                 
01166                                                 }
01167                                                 
01168                                                 if(isbarrel && full_path.find("F/")!=string::npos) OccupancyMap->getTH2F()->Add(me->getTH2F());
01169                                                 if(!isbarrel || (isbarrel && full_path.find("H/")!=string::npos)) 
01170                                                 {  
01171                                                         TH2F *tmpHist = (TH2F*) OccupancyMap->getTH2F()->Clone("tmpHist");
01172                                                         tmpHist->Reset();
01173                                                         
01174                                                         for(int i=1; i!=me->getNbinsX()+1; i++) for(int j=1; j!=me->getNbinsY()+1; j++) tmpHist->SetBinContent(i,j,me->getBinContent(i,j));
01175                                                         me->getTH2F()->Print();
01176                                                         // Exceptions for endcap
01177                                                         if(currDir.find("Pixel/Endcap/HalfCylinder_pI/Disk_1/Blade_10/Panel_2/Module_1")!=string::npos || currDir.find("Pixel/Endcap/HalfCylinder_pI/Disk_1/Blade_10/Panel_2/Module_3")!=string::npos)
01178                                                                 for(int i=27 ; i<=52 ; i++)
01179                                                                         for(int j=1 ; j<=40 ; j++)
01180                                                                                 tmpHist->SetBinContent(i,j,0);
01181                                                         if(currDir.find("Pixel/Endcap/HalfCylinder_pI/Disk_1/Blade_09/Panel_1/Module_4")!=string::npos)
01182                                                                 for(int i=52 ; i<=78 ; i++)
01183                                                                         for(int j=1 ; j<=40 ; j++)
01184                                                                                 tmpHist->SetBinContent(i,j,0);                                                  
01185                                                         
01186                                                         OccupancyMap->getTH2F()->Add(tmpHist);
01187                                                         
01188                                                         tmpHist->Delete();
01189                                                 }
01190                                                 
01191                                                 OccupancyMap->getTH2F()->SetEntries(OccupancyMap->getTH2F()->Integral());
01192                                                 
01193                                         }       
01194                                         
01195                                 }
01196                         }
01197                         
01198                 }
01199                 //bei->goUp();
01200     } else {  
01201                 //occupancyprinting cout<<"finding subdirs now"<<std::endl;
01202                 vector<string> subdirs = bei->getSubdirs();
01203                 for (vector<string>::const_iterator it = subdirs.begin(); it != subdirs.end(); it++) {
01204                         bei->cd(*it);
01205                         //occupancyprinting cout<<"now I am in "<<bei->pwd()<<std::endl;
01206                         if(*it != "Pixel" && ((isbarrel && (*it).find("Barrel")==string::npos) || (!isbarrel && (*it).find("Endcap")==string::npos))) continue;
01207                         //occupancyprinting cout<<"calling myself again "<<std::endl;
01208                         fillOccupancy(bei, isbarrel);
01209                         bei->goUp();
01210                 }
01211     }
01212         
01213         //occupancyprinting cout<<"leaving SiPixelActionExecutor::fillOccupancy..."<<std::endl;
01214         
01215 }
01216 //=============================================================================================================
01217 
01218 //
01219 // -- Setup Quality Tests 
01220 //
01221 void SiPixelActionExecutor::setupQTests(DQMStore * bei) {
01222 //printing cout<<"Entering SiPixelActionExecutor::setupQTests: "<<endl;
01223 
01224   bei->cd();
01225   bei->cd("Pixel");
01226   
01227   string localPath = string("DQM/SiPixelMonitorClient/test/sipixel_qualitytest_config.xml");
01228   if(!qtHandler_){
01229     qtHandler_ = new QTestHandle();
01230   }
01231   if(!qtHandler_->configureTests(edm::FileInPath(localPath).fullPath(),bei)){
01232     qtHandler_->attachTests(bei);
01233     bei->cd();
01234   }else{
01235     cout << " Problem setting up quality tests "<<endl;
01236   }
01237 
01238 //printing cout<<" leaving SiPixelActionExecutor::setupQTests. "<<endl;
01239 }
01240 //=============================================================================================================
01241 //
01242 // -- Check Status of Quality Tests
01243 //
01244 void SiPixelActionExecutor::checkQTestResults(DQMStore * bei) {
01245 //printing cout<<"Entering SiPixelActionExecutor::checkQTestResults..."<<endl;
01246 
01247   int messageCounter=0;
01248   string currDir = bei->pwd();
01249   vector<string> contentVec;
01250   bei->getContents(contentVec);
01251   configParser_->getCalibType(calib_type_);
01252 //  cout << calib_type_ << endl;
01253   configParser_->getMessageLimitForQTests(message_limit_);
01254   for (vector<string>::iterator it = contentVec.begin();
01255        it != contentVec.end(); it++) {
01256     vector<string> contents;
01257     int nval = SiPixelUtility::getMEList((*it), contents);
01258     if (nval == 0) continue;
01259     for (vector<string>::const_iterator im = contents.begin();
01260          im != contents.end(); im++) {
01261 
01262       MonitorElement * me = bei->get((*im));
01263       if (me) {
01264         me->runQTests();
01265         // get all warnings associated with me
01266         vector<QReport*> warnings = me->getQWarnings();
01267         for(vector<QReport *>::const_iterator wi = warnings.begin();
01268             wi != warnings.end(); ++wi) {
01269           messageCounter++;
01270           if(messageCounter<message_limit_) {
01271             //edm::LogWarning("SiPixelQualityTester::checkTestResults") << 
01272             //  " *** Warning for " << me->getName() << 
01273             //  "," << (*wi)->getMessage() << "\n";
01274           
01275             edm::LogWarning("SiPixelActionExecutor::checkQTestResults") <<  " *** Warning for " << me->getName() << "," 
01276                  << (*wi)->getMessage() << " " << me->getMean() 
01277                  << " " << me->getRMS() << me->hasWarning() 
01278                  << endl;
01279           }
01280         }
01281         warnings=vector<QReport*>();
01282         // get all errors associated with me
01283         vector<QReport *> errors = me->getQErrors();
01284         for(vector<QReport *>::const_iterator ei = errors.begin();
01285             ei != errors.end(); ++ei) {
01286 
01287           float empty_mean = me->getMean();
01288           float empty_rms = me->getRMS();
01289           if((empty_mean != 0 && empty_rms != 0) || (calib_type_ == 0)){
01290           messageCounter++;
01291           if(messageCounter<=message_limit_) {
01292             //edm::LogError("SiPixelQualityTester::checkTestResults") << 
01293             //  " *** Error for " << me->getName() << 
01294             //  "," << (*ei)->getMessage() << "\n";
01295           
01296             edm::LogWarning("SiPixelActionExecutor::checkQTestResults")  <<   " *** Error for " << me->getName() << ","
01297                   << (*ei)->getMessage() << " " << me->getMean() 
01298                   << " " << me->getRMS() 
01299                   << endl;
01300           }
01301           }
01302         }
01303         errors=vector<QReport*>();
01304       }
01305       me=0;
01306     }
01307     nval=int(); contents=vector<string>();
01308   }
01309   LogDebug("SiPixelActionExecutor::checkQTestResults") <<"messageCounter: "<<messageCounter<<" , message_limit: "<<message_limit_<<endl;
01310 //  if (messageCounter>=message_limit_)
01311 //    edm::LogWarning("SiPixelActionExecutor::checkQTestResults") << "WARNING: too many QTest failures! Giving up after "<<message_limit_<<" messages."<<endl;
01312   contentVec=vector<string>(); currDir=string(); messageCounter=int();
01313   //printing cout<<"...leaving SiPixelActionExecutor::checkQTestResults!"<<endl;
01314 }
01315 
01316 //=============================================================================================================
01317 void SiPixelActionExecutor::createLayout(DQMStore * bei){
01318   if (configWriter_ == 0) {
01319     configWriter_ = new SiPixelConfigWriter();
01320     if (!configWriter_->init()) return;
01321   }
01322   string currDir = bei->pwd();   
01323   if (currDir.find("Layer") != string::npos) {
01324     string name = "Default";
01325    configWriter_->createLayout(name);
01326    configWriter_->createRow();
01327     fillLayout(bei);
01328   } else {
01329     vector<string> subdirs = bei->getSubdirs();
01330     for (vector<string>::const_iterator it = subdirs.begin();
01331          it != subdirs.end(); it++) {
01332       bei->cd(*it);
01333       createLayout(bei);
01334       bei->goUp();
01335     }
01336   }  
01337 }
01338 
01339 //=============================================================================================================
01340 void SiPixelActionExecutor::fillLayout(DQMStore * bei){
01341   
01342   static int icount = 0;
01343   string currDir = bei->pwd();
01344   if (currDir.find("Ladder_") != string::npos) {
01345 
01346     vector<string> contents = bei->getMEs(); 
01347     
01348     for (vector<string>::const_iterator im = contents.begin();
01349          im != contents.end(); im++) {
01350       if ((*im).find("Clusters") != string::npos) {
01351         icount++;
01352         if (icount != 0 && icount%6 == 0) {
01353           configWriter_->createRow();
01354         }
01355         ostringstream full_path;
01356         full_path << "test/" << currDir << "/" << *im ;
01357         string element = "monitorable";
01358         string element_name = full_path.str();     
01359         configWriter_->createColumn(element, element_name);
01360       }
01361     }
01362   } else {
01363     vector<string> subdirs = bei->getSubdirs();
01364     for (vector<string>::const_iterator it = subdirs.begin();
01365          it != subdirs.end(); it++) {
01366       bei->cd(*it);
01367       fillLayout(bei);
01368       bei->goUp();
01369     }
01370   }
01371 }
01372 
01373 //=============================================================================================================
01374 //
01375 // -- Get TkMap ME names
01376 //
01377 int SiPixelActionExecutor::getTkMapMENames(std::vector<std::string>& names) {
01378   if (tkMapMENames.size() == 0) return 0;
01379   for (vector<string>::iterator it = tkMapMENames.begin();
01380        it != tkMapMENames.end(); it++) {
01381     names.push_back(*it) ;
01382   }
01383   return names.size();
01384 }
01385 
01386 //=============================================================================================================
01388 void SiPixelActionExecutor::dumpModIds(DQMStore * bei){
01389 //printing cout<<"Going to dump module IDs now!"<<endl;
01390   bei->cd();
01391   dumpBarrelModIds(bei);
01392   bei->cd();
01393   dumpEndcapModIds(bei);
01394   bei->cd();
01395 //printing cout<<"Done dumping module IDs!"<<endl;
01396 }
01397 
01398 
01399 //=============================================================================================================
01400 void SiPixelActionExecutor::dumpBarrelModIds(DQMStore * bei){
01401   string currDir = bei->pwd();
01402   string dir_name = "Ladder_";
01403   if (currDir.find(dir_name) != string::npos)  {
01404     vector<string> subdirs = bei->getSubdirs();
01405     for (vector<string>::const_iterator it = subdirs.begin();
01406        it != subdirs.end(); it++) {
01407       if ( (*it).find("Module_") == string::npos) continue;
01408       bei->cd(*it);
01409       ndet_++;
01410       cout<<"Ndet: "<<ndet_<<"  ,  Module: "<<bei->pwd();  
01411       vector<string> contents = bei->getMEs(); 
01412       bool first_me = false;
01413       int detId = -999;
01414       for (vector<string>::const_iterator im = contents.begin();
01415          im != contents.end(); im++) {
01416         if(first_me) break;
01417         QRegExp rx("(\\w+)_(\\w+)_(\\d+)") ;
01418         QString mEName = (*im);
01419         if(rx.search(mEName) != -1 ) detId = rx.cap(3).toInt() ;
01420       }
01421       bei->goUp();
01422       cout<<"  , detector ID: "<<detId<<endl;
01423     }
01424   } else {  
01425     vector<string> subdirs = bei->getSubdirs();
01426     for (vector<string>::const_iterator it = subdirs.begin();
01427        it != subdirs.end(); it++) {
01428       if((*it).find("Endcap")!=string::npos) continue;
01429       bei->cd(*it);
01430       dumpBarrelModIds(bei);
01431       bei->goUp();
01432     }
01433   }
01434 }
01435 
01436 //=============================================================================================================
01437 void SiPixelActionExecutor::dumpEndcapModIds(DQMStore * bei){
01438   string currDir = bei->pwd();
01439   string dir_name = "Panel_";
01440   if (currDir.find(dir_name) != string::npos)  {
01441     vector<string> subdirs = bei->getSubdirs();
01442     for (vector<string>::const_iterator it = subdirs.begin();
01443        it != subdirs.end(); it++) {
01444       if ( (*it).find("Module_") == string::npos) continue;
01445       bei->cd(*it);
01446       ndet_++;
01447       cout<<"Ndet: "<<ndet_<<"  ,  Module: "<<bei->pwd();  
01448       vector<string> contents = bei->getMEs(); 
01449       bool first_me = false;
01450       int detId = -999;
01451       for (vector<string>::const_iterator im = contents.begin();
01452          im != contents.end(); im++) {
01453         if(first_me) break;
01454         QRegExp rx("(\\w+)_(\\w+)_(\\d+)") ;
01455         QString mEName = (*im);
01456         if(rx.search(mEName) != -1 ) detId = rx.cap(3).toInt() ;
01457       }
01458       bei->goUp();
01459       cout<<"  , detector ID: "<<detId<<endl;
01460     }
01461   } else {  
01462     vector<string> subdirs = bei->getSubdirs();
01463     for (vector<string>::const_iterator it = subdirs.begin();
01464        it != subdirs.end(); it++) {
01465       if((bei->pwd()).find("Barrel")!=string::npos) bei->goUp();
01466       bei->cd((*it));
01467       if((*it).find("Barrel")!=string::npos) continue;
01468       dumpEndcapModIds(bei);
01469       bei->goUp();
01470     }
01471   }
01472 
01473 }
01474 
01475 //=============================================================================================================

Generated on Tue Jun 9 17:33:20 2009 for CMSSW by  doxygen 1.5.4