CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/DQM/SiPixelHistoricInfoClient/src/SiPixelHistoricInfoReader.cc

Go to the documentation of this file.
00001 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00002 
00003 #include "CondFormats/SiPixelObjects/interface/SiPixelPerformanceSummary.h"
00004 #include "CondFormats/DataRecord/interface/SiPixelPerformanceSummaryRcd.h"
00005 
00006 #include "DQM/SiPixelHistoricInfoClient/interface/SiPixelHistoricInfoReader.h"
00007 
00008 #include <math.h>
00009 #include <iostream>
00010 #include <sstream>
00011 #include <stdio.h>
00012 #include <sys/time.h>
00013 
00014 #include "TH1F.h"
00015 #include "TCanvas.h"
00016 #include "TPad.h"
00017 #include "TStyle.h"
00018 
00019 
00020 using namespace cms;
00021 using namespace std;
00022 
00023 
00024 SiPixelHistoricInfoReader::SiPixelHistoricInfoReader(const edm::ParameterSet& pSet) {
00025   parameterSet_ = pSet;  
00026 
00027   variables_ = parameterSet_.getUntrackedParameter<vstring>("variables");
00028   for (int i=0; i<20; i++) variable_[i] = false; 
00029   for (vector<string>::const_iterator variable = variables_.begin(); variable!=variables_.end(); ++variable) {
00030     if (variable->compare("errorType")==0)        variable_[ 0] = true;
00031     if (variable->compare("ndigis")==0)           variable_[ 1] = true;
00032     if (variable->compare("adc")==0)              variable_[ 2] = true;
00033     if (variable->compare("nclusters")==0)        variable_[ 3] = true;
00034     if (variable->compare("charge")==0)           variable_[ 4] = true;
00035     if (variable->compare("size")==0)             variable_[ 5] = true;
00036     if (variable->compare("sizeX")==0)            variable_[ 6] = true;
00037     if (variable->compare("sizeY")==0)            variable_[ 7] = true;
00038     if (variable->compare("nRecHits")==0)         variable_[ 8] = true;
00039     if (variable->compare("residualX")==0)        variable_[ 9] = true;
00040     if (variable->compare("residualY")==0)        variable_[10] = true;
00041     if (variable->compare("nPixHitsTrk")==0)      variable_[11] = true;
00042     if (variable->compare("nNoisPixels")==0)      variable_[12] = true;
00043     if (variable->compare("nDeadPixels")==0)      variable_[13] = true;
00044     if (variable->compare("tracks")==0)           variable_[14] = true;
00045     if (variable->compare("onTrackClusters")==0)  variable_[15] = true; 
00046     if (variable->compare("offTrackClusters")==0) variable_[16] = true; 
00047   }
00048   normEvents_ = parameterSet_.getUntrackedParameter<bool>("normEvents",false);  
00049   printDebug_ = parameterSet_.getUntrackedParameter<bool>("printDebug",false); 
00050    makePlots_ = parameterSet_.getUntrackedParameter<bool>("makePlots", true); 
00051    typePlots_ = parameterSet_.getUntrackedParameter<string>("typePlots", "gif"); 
00052   outputDir_  = parameterSet_.getUntrackedParameter<string>("outputDir", ".");
00053   outputFile_ = parameterSet_.getUntrackedParameter<string>("outputFile","pixelhistory.root");
00054   
00055   firstBeginRun_ = true; 
00056 } 
00057 
00058 
00059 SiPixelHistoricInfoReader::~SiPixelHistoricInfoReader() {}
00060 
00061 
00062 void SiPixelHistoricInfoReader::beginJob() {
00063   string outputDirFile = outputDir_ + "/" + outputFile_; 
00064   outputDirFile_ = new TFile(outputDirFile.data(), "RECREATE");
00065 } 
00066 
00067 
00068 string SiPixelHistoricInfoReader::getMEregionString(uint32_t detID) const {
00069   uint32_t localMEdetID = detID; 
00070   TString regionStr; 
00071        if (localMEdetID>100000000) { regionStr = "det"; regionStr += localMEdetID; }
00072   else if (localMEdetID<40)        { regionStr = "FED"; regionStr += localMEdetID; }
00073   else if (localMEdetID==80) regionStr = "Barrel"; 
00074   else if (localMEdetID==81) regionStr = "Endcap"; 
00075   else if (localMEdetID>99 && localMEdetID<120) { 
00076     localMEdetID -= 100; 
00077     if (localMEdetID<12) { 
00078       regionStr = "Barrel/"; 
00079            if (localMEdetID<3) { regionStr += "Shell_mI/";                    }
00080       else if (localMEdetID<6) { regionStr += "Shell_mO/"; localMEdetID -= 3; }
00081       else if (localMEdetID<9) { regionStr += "Shell_pI/"; localMEdetID -= 6; } 
00082       else                     { regionStr += "Shell_pO/"; localMEdetID -= 9; }
00083       regionStr += "Layer_"; regionStr += (localMEdetID+1); 
00084     }
00085     else { 
00086       regionStr = "Endcap/"; localMEdetID -= 12; 
00087            if (localMEdetID<2) { regionStr += "HalfCylinder_mI/";                    }
00088       else if (localMEdetID<4) { regionStr += "HalfCylinder_mO/"; localMEdetID -= 2; }
00089       else if (localMEdetID<6) { regionStr += "HalfCylinder_pI/"; localMEdetID -= 4; } 
00090       else                     { regionStr += "HalfCylinder_pO/"; localMEdetID -= 6; }
00091       regionStr += "Disk_"; regionStr += (localMEdetID+1); 
00092     }
00093   } 
00094   else if (localMEdetID>999 && localMEdetID<1288) {
00095     localMEdetID -= 1000; 
00096     if (localMEdetID<192) { 
00097       regionStr = "Barrel/"; 
00098            if (localMEdetID<48)  { regionStr += "Shell_mI/";                      }
00099       else if (localMEdetID<96)  { regionStr += "Shell_mO/"; localMEdetID -= 48;  }
00100       else if (localMEdetID<144) { regionStr += "Shell_pI/"; localMEdetID -= 96;  } 
00101       else                       { regionStr += "Shell_pO/"; localMEdetID -= 144; }
00102            if (localMEdetID<10) { regionStr += "Layer_1/";                     }
00103       else if (localMEdetID<26) { regionStr += "Layer_2/"; localMEdetID -= 10; }
00104       else                      { regionStr += "Layer_3/"; localMEdetID -= 26; }
00105       regionStr += "Ladder_"; regionStr += (localMEdetID+1); 
00106     }
00107     else { 
00108       regionStr = "Endcap/"; localMEdetID -= 192; 
00109            if (localMEdetID<24) { regionStr += "HalfCylinder_mI/";                     }
00110       else if (localMEdetID<48) { regionStr += "HalfCylinder_mO/"; localMEdetID -= 24; }
00111       else if (localMEdetID<72) { regionStr += "HalfCylinder_pI/"; localMEdetID -= 48; } 
00112       else                      { regionStr += "HalfCylinder_pO/"; localMEdetID -= 72; }
00113       if (localMEdetID<12) { regionStr += "Disk_1/"; }
00114       else                 { regionStr += "Disk_2/"; localMEdetID -= 12; } 
00115       regionStr += "Blade_"; regionStr += (localMEdetID+1); 
00116     }
00117   }
00118   else if (localMEdetID==666) regionStr = "Dummy detID=666"; 
00119   else { regionStr = "Wrong detID="; regionStr += localMEdetID; } 
00120   
00121   return regionStr.Data(); 
00122 }
00123 
00124 
00125 void SiPixelHistoricInfoReader::beginRun(const edm::Run& run, const edm::EventSetup& iSetup) {
00126   edm::ESHandle<SiPixelPerformanceSummary> pSummary;
00127   iSetup.get<SiPixelPerformanceSummaryRcd>().get(pSummary); 
00128 
00129   if (firstBeginRun_) {
00130     firstBeginRun_ = false;
00131 
00132     allDetIds.clear(); 
00133     allDetIds = pSummary->getAllDetIds(); // allDetIds.push_back(369345800);
00134       
00135     AllDetHistograms = new TObjArray();
00136 
00137     for (vector<uint32_t>::const_iterator iDet = allDetIds.begin(); iDet!=allDetIds.end(); ++iDet) {  
00138       string detRegion = getMEregionString(*iDet); 
00139       
00140       if (variable_[0] && *iDet<40) { 
00141         for (int pBin=0; pBin<15; pBin++) {
00142           hisID = "errorType"; hisID += (pBin+25); hisID += "_"; hisID += *iDet;             
00143           title = "errorType"; title += (pBin+25); title += " "; title += detRegion;            
00144           AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));
00145           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin); 
00146         } 
00147       }
00148       if (variable_[1] && *iDet>99) {
00149         hisID = "nDigis_"; hisID += *iDet;              
00150         title = "nDigis "; title += detRegion;          
00151         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00152         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00153 
00154         hisID = "nDigis_mFr_"; hisID += *iDet;          
00155         title = "Fraction of Empty Modules in nDigis "; title += detRegion;             
00156         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00157         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00158       }
00159       if (variable_[2] && *iDet>99) {
00160         hisID = "adc_"; hisID += *iDet;                         
00161         title = "adc "; title += detRegion;             
00162         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00163         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00164 
00165         hisID = "adc_mFr_"; hisID += *iDet;             
00166         title = "Fraction of Empty Modules in adc "; title += detRegion;                
00167         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00168         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00169       }
00170       if (variable_[3] && *iDet>99) {
00171         hisID = "nClusters_"; hisID += *iDet;         
00172         title = "nClusters "; title += detRegion;               
00173         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00174         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00175 
00176         hisID = "nClusters_mFr_"; hisID += *iDet;               
00177         title = "Fraction of Empty Modules in nClusters "; title += detRegion;          
00178         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00179         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00180       }
00181       if (variable_[4] && *iDet>99) {
00182         hisID = "charge_"; hisID += *iDet;              
00183         title = "charge "; title += detRegion;          
00184         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00185         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00186 
00187         hisID = "charge_mFr_"; hisID += *iDet;          
00188         title = "Fraction of Empty Modules in charge "; title += detRegion;             
00189         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00190         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00191       }
00192       if (variable_[5] && *iDet>99) {
00193         hisID = "clusterSize_"; hisID += *iDet;                
00194         title = "clusterSize "; title += detRegion;            
00195         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00196         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00197 
00198         hisID = "clusterSize_mFr_"; hisID += *iDet;             
00199         title = "Fraction of Empty Modules in clusterSize "; title += detRegion;                
00200         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00201         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00202       }
00203       if (variable_[6] && *iDet>99) {
00204         hisID = "clusterSizeX_"; hisID += *iDet;                
00205         title = "clusterSizeX "; title += detRegion;            
00206         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00207         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00208 
00209         hisID = "clusterSizeX_mFr_"; hisID += *iDet;            
00210         title = "Fraction of Empty Modules in clusterSizeX "; title += detRegion;               
00211         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00212         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00213       }
00214       if (variable_[7] && *iDet>99) {
00215         hisID = "clusterSizeY_"; hisID += *iDet;                
00216         title = "clusterSizeY "; title += detRegion;            
00217         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00218         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00219 
00220         hisID = "clusterSizeY_mFr_"; hisID += *iDet;            
00221         title = "Fraction of Empty Modules in clusterSizeY "; title += detRegion;               
00222         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00223         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00224       }
00225       if (variable_[8] && *iDet>99) {
00226         hisID = "nRecHits_"; hisID += *iDet;          
00227         title = "nRecHits "; title += detRegion;                
00228         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00229         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00230 
00231         hisID = "nRecHits_mFr_"; hisID += *iDet;                
00232         title = "Fraction of Empty Modules in nRecHits "; title += detRegion;           
00233         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00234         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00235       }
00236       if (variable_[9] && *iDet>99) {
00237         hisID = "residualX_"; hisID += *iDet;           
00238         title = "residualX "; title += detRegion;               
00239         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00240         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00241 
00242         hisID = "residualX_mFr_"; hisID += *iDet;               
00243         title = "Fraction of Empty Modules in residualX "; title += detRegion;          
00244         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00245         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00246       }
00247       if (variable_[10] && *iDet>99) {
00248         hisID = "residualY_"; hisID += *iDet;           
00249         title = "residualY "; title += detRegion;               
00250         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00251         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00252 
00253         hisID = "residualY_mFr_"; hisID += *iDet;               
00254         title = "Fraction of Empty Modules in residualY "; title += detRegion;          
00255         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00256         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00257       } 
00258       if (variable_[11] && *iDet>99) {
00259         hisID = "nPixHitsTrk_"; hisID += *iDet;        
00260         title = "nPixHitsTrk "; title += detRegion;            
00261         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00262         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00263       } 
00264       if (variable_[12] && *iDet>99) {
00265         hisID = "nNoisPixels_"; hisID += *iDet;        
00266         title = "nNoisPixels "; title += detRegion;            
00267         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00268         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00269       } 
00270       if (variable_[13] && *iDet>99) {
00271         hisID = "nDeadPixels_"; hisID += *iDet;        
00272         title = "nDeadPixels "; title += detRegion;            
00273         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00274         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00275       } 
00276       if (variable_[14] && (*iDet==80 || *iDet==81)) {
00277         hisID = "trkFrac_"; hisID += *iDet;             
00278         title = "Track Fraction - "; title += detRegion; title += "/All";
00279         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00280         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00281       } 
00282       if (variable_[15] && (*iDet==80 || *iDet==81)) {
00283         hisID = "nOnTrackClusters_"; hisID += *iDet;         
00284         title = "nOnTrackClusters "; title += detRegion;                
00285         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00286         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00287 
00288         hisID = "onTrackClusterCharge_"; hisID += *iDet;                
00289         title = "onTrackClusterCharge "; title += detRegion;            
00290         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00291         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00292 
00293         hisID = "onTrackClusterSize_"; hisID += *iDet;         
00294         title = "onTrackClusterSize "; title += detRegion;             
00295         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00296         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00297       } 
00298       if (variable_[16] && (*iDet==80 || *iDet==81)) {
00299         hisID = "nOffTrackClusters_"; hisID += *iDet;         
00300         title = "nOffTrackClusters "; title += detRegion;               
00301         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00302         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00303 
00304         hisID = "offTrackClusterCharge_"; hisID += *iDet;               
00305         title = "offTrackClusterCharge "; title += detRegion;           
00306         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00307         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00308 
00309         hisID = "offTrackClusterSize_"; hisID += *iDet;                
00310         title = "offTrackClusterSize "; title += detRegion;            
00311         AllDetHistograms->Add(new TH1F(hisID, title, 1, 0, 1));                 
00312         ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBit(TH1::kCanRebin);  
00313       } 
00314     }
00315   }
00316   if (pSummary->getRunNumber()==run.run()) { // pSummary's run changes only when the table is newly retrieved 
00317     TString sRun; sRun += pSummary->getRunNumber();     
00318     float nEvents = pSummary->getNumberOfEvents(); 
00319     float SF = 1.0; if (normEvents_) SF = 100000.0/nEvents; 
00320     
00321     if (printDebug_) cout << "run "<< sRun.Data() <<" with "<< nEvents <<" events" << endl; 
00322     
00323     for (vector<uint32_t>::const_iterator iDet = allDetIds.begin(); iDet!=allDetIds.end(); ++iDet) {
00324       vector<float> performances = pSummary->getDetSummary(*iDet); 
00325       
00326       if (*iDet<40) {
00327         if (variable_[0]) {
00328           for (int pBin=0; pBin<15; pBin++) {
00329             hisID = "errorType"; hisID += (pBin+25); hisID += "_"; hisID += *iDet;      
00330             ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[pBin]/nEvents);
00331             int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00332             ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, sqrt(performances[pBin])/nEvents);        
00333           } 
00334         } 
00335       } 
00336       if (*iDet>99) {
00337         if (variable_[1]) {
00338           hisID = "nDigis_"; hisID += *iDet;             
00339           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[15]*SF);
00340           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00341           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[16]*SF);
00342 
00343           hisID = "nDigis_mFr_"; hisID += *iDet;                 
00344           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[17]);
00345         } 
00346         if (variable_[2]) {      
00347           hisID = "adc_"; hisID += *iDet;                
00348           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[18]*SF);
00349           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00350           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[19]*SF);
00351 
00352           hisID = "adc_mFr_"; hisID += *iDet;    
00353           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[20]);
00354         } 
00355         if (variable_[3]) {       
00356           hisID = "nClusters_"; hisID += *iDet;        
00357           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[21]*SF);
00358           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00359           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[22]*SF);    
00360 
00361           hisID = "nClusters_mFr_"; hisID += *iDet;              
00362           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[23]);
00363         } 
00364         if (variable_[4]) {      
00365           hisID = "charge_"; hisID += *iDet;             
00366           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[24]*SF);
00367           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00368           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[25]*SF);    
00369 
00370           hisID = "charge_mFr_"; hisID += *iDet;                 
00371           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[26]);
00372         } 
00373         if (variable_[5]) {      
00374           hisID = "clusterSize_"; hisID += *iDet;                
00375           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[27]*SF);
00376           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00377           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[28]*SF);
00378 
00379           hisID = "clusterSize_mFr_"; hisID += *iDet;    
00380           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[29]);
00381         } 
00382         if (variable_[6]) {      
00383           hisID = "clusterSizeX_"; hisID += *iDet;               
00384           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[30]*SF);
00385           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00386           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[31]*SF);
00387 
00388           hisID = "clusterSizeX_mFr_"; hisID += *iDet;   
00389           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[32]);
00390         } 
00391         if (variable_[7]) {      
00392           hisID = "clusterSizeY_"; hisID += *iDet;               
00393           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[33]*SF);
00394           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00395           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[34]*SF);    
00396 
00397           hisID = "clusterSizeY_mFr_"; hisID += *iDet;   
00398           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[35]);
00399         } 
00400         if (variable_[8]) {      
00401           hisID = "nRecHits_"; hisID += *iDet;         
00402           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[36]*SF);
00403           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00404           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[37]*SF);    
00405 
00406           hisID = "nRecHits_mFr_"; hisID += *iDet;               
00407           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[38]);
00408         } 
00409         if (variable_[9]) {      
00410           hisID = "residualX_"; hisID += *iDet;       
00411           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[39]*SF);
00412           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00413           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[40]*SF);    
00414 
00415           hisID = "residualX_mFr_"; hisID += *iDet;              
00416           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[41]);
00417         } 
00418         if (variable_[10]) {      
00419           hisID = "residualY_"; hisID += *iDet;       
00420           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[42]*SF);
00421           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00422           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[43]*SF);    
00423 
00424           hisID = "residualY_mFr_"; hisID += *iDet;              
00425           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[44]);
00426         } 
00427         if (variable_[11]) {      
00428           hisID = "nPixHitsTrk_"; hisID += *iDet;       
00429           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[45]*SF);
00430         } 
00431         if (variable_[12]) {      
00432           hisID = "nNoisPixels_"; hisID += *iDet;       
00433           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[46]*SF);
00434           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00435           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, sqrt(performances[46])/sqrt(nEvents));            
00436         } 
00437         if (variable_[13]) {      
00438           hisID = "nDeadPixels_"; hisID += *iDet;       
00439           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[47]*SF);
00440           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00441           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, sqrt(performances[47])/sqrt(nEvents));            
00442         } 
00443       }
00444       if (*iDet==80 || *iDet==81) {
00445         if (variable_[14]) {
00446           hisID = "trkFrac_"; hisID += *iDet;       
00447           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[48]);
00448           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00449           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[49]);    
00450         }
00451         if (variable_[15]) {
00452           hisID = "nOnTrackClusters_"; hisID += *iDet;         
00453           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[50]*SF);
00454 
00455           hisID = "onTrackClusterCharge_"; hisID += *iDet;              
00456           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[52]*SF);
00457           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00458           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[53]*SF);    
00459 
00460           hisID = "onTrackClusterSize_"; hisID += *iDet;               
00461           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[56]*SF);
00462           int jBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00463           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(jBin, performances[57]*SF);    
00464         }
00465         if (variable_[16]) {
00466           hisID = "nOffTrackClusters_"; hisID += *iDet;         
00467           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[51]*SF);
00468 
00469           hisID = "offTrackClusterCharge_"; hisID += *iDet;             
00470           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[54]*SF);
00471           int iBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00472           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(iBin, performances[55]*SF);    
00473 
00474           hisID = "offTrackClusterSize_"; hisID += *iDet;              
00475           ((TH1F*)AllDetHistograms->FindObject(hisID))->Fill(sRun, performances[58]*SF);
00476           int jBin = ((TH1F*)AllDetHistograms->FindObject(hisID))->GetXaxis()->FindBin(sRun);
00477           ((TH1F*)AllDetHistograms->FindObject(hisID))->SetBinError(jBin, performances[59]*SF);    
00478         }
00479       }
00480     }    
00481   }
00482 }
00483 
00484 
00485 void SiPixelHistoricInfoReader::analyze(const edm::Event& event, const edm::EventSetup& iSetup) {}
00486 
00487 
00488 void SiPixelHistoricInfoReader::endRun(const edm::Run& run, const edm::EventSetup& iSetup) {}
00489 
00490 
00491 void SiPixelHistoricInfoReader::endJob() {
00492   for (vector<uint32_t>::const_iterator iDet=allDetIds.begin(); iDet!=allDetIds.end(); ++iDet) {
00493     if (*iDet<40) {
00494       if (variable_[0]) {
00495         for (int pBin=0; pBin<15; pBin++) {                                                            
00496           hisID = "errorType"; hisID += (pBin+25); hisID += "_"; hisID += *iDet;     
00497           ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X"); 
00498           ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                       
00499 
00500         }                                                                                              
00501       } 
00502     } 
00503     if (*iDet>99) {
00504       if (variable_[1]) {
00505         hisID = "nDigis_"; hisID += *iDet;                                     
00506         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00507         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00508 
00509         hisID = "nDigis_mFr_"; hisID += *iDet;                         
00510         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00511         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00512       } 
00513       if (variable_[2]) {
00514         hisID = "adc_"; hisID += *iDet;                                        
00515         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X"); 
00516         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00517 
00518         hisID = "adc_mFr_"; hisID += *iDet;                                    
00519         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00520         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00521       } 
00522       if (variable_[3]) {
00523         hisID = "nClusters_"; hisID += *iDet;                            
00524         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00525         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00526 
00527         hisID = "nClusters_mFr_"; hisID += *iDet;                                      
00528         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00529         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00530       } 
00531       if (variable_[4]) {
00532         hisID = "charge_"; hisID += *iDet;                                     
00533         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00534         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00535 
00536         hisID = "charge_mFr_"; hisID += *iDet;                         
00537         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00538         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00539       } 
00540       if (variable_[5]) {
00541         hisID = "clusterSize_"; hisID += *iDet;                                
00542         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00543         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00544 
00545         hisID = "clusterSize_mFr_"; hisID += *iDet;                                    
00546         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00547         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00548       } 
00549       if (variable_[6]) {
00550         hisID = "clusterSizeX_"; hisID += *iDet;                               
00551         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00552         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00553 
00554         hisID = "clusterSizeX_mFr_"; hisID += *iDet;                           
00555         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00556         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00557       } 
00558       if (variable_[7]) {
00559         hisID = "clusterSizeY_"; hisID += *iDet;                               
00560         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00561         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00562 
00563         hisID = "clusterSizeY_mFr_"; hisID += *iDet;                           
00564         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00565         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00566       } 
00567       if (variable_[8]) {
00568         hisID = "nRecHits_"; hisID += *iDet;                                   
00569         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                                                                                                                     
00570         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00571 
00572         hisID = "nRecHits_mFr_"; hisID += *iDet;                                       
00573         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00574         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00575       } 
00576       if (variable_[9]) {
00577         hisID = "residualX_"; hisID += *iDet;                                  
00578         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                                                                                                                     
00579         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00580 
00581         hisID = "residualX_mFr_"; hisID += *iDet;                                      
00582         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00583         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00584       } 
00585       if (variable_[10]) {
00586         hisID = "residualY_"; hisID += *iDet;                                  
00587         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00588         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00589 
00590         hisID = "residualY_mFr_"; hisID += *iDet;                                      
00591         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00592         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00593       }
00594       if (variable_[11]) {
00595         hisID = "nPixHitsTrk_"; hisID += *iDet;                                
00596         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00597         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00598       }
00599       if (variable_[12]) {
00600         hisID = "nNoisPixels_"; hisID += *iDet;                                
00601         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00602         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00603       }
00604       if (variable_[13]) {
00605         hisID = "nDeadPixels_"; hisID += *iDet;                                
00606         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00607         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00608       }
00609     } 
00610     if (*iDet==80 || *iDet==81) {
00611       if (variable_[14]) {
00612         hisID = "trkFrac_"; hisID += *iDet;       
00613         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00614         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00615       }
00616       if (variable_[15]) {
00617         hisID = "nOnTrackClusters_"; hisID += *iDet;         
00618         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00619         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00620 
00621         hisID = "onTrackClusterCharge_"; hisID += *iDet;              
00622         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00623         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00624 
00625         hisID = "onTrackClusterSize_"; hisID += *iDet;               
00626         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00627         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00628       }
00629       if (variable_[16]) {
00630         hisID = "nOffTrackClusters_"; hisID += *iDet;         
00631         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00632         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00633 
00634         hisID = "offTrackClusterCharge_"; hisID += *iDet;             
00635         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00636         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00637 
00638         hisID = "offTrackClusterSize_"; hisID += *iDet;              
00639         ((TH1F*)AllDetHistograms->FindObject(hisID))->LabelsDeflate("X");                      
00640         ((TH1F*)AllDetHistograms->FindObject(hisID))->Write();                         
00641       }
00642     }
00643   } 
00644   outputDirFile_->Write(); if (makePlots_) plot(); 
00645   outputDirFile_->Close(); 
00646 }
00647 
00648 
00649 void SiPixelHistoricInfoReader::plot() { 
00650   ostringstream spa; for (unsigned int i=0; i<typePlots_.size(); i++) spa << " "; 
00651   cout << "************************************ "<< spa.str() <<" *************" << endl; 
00652   cout << "SiPixelHistoricInfoReader::plot() in "<< typePlots_<<" with patience" << endl;
00653   cout << "************************************ "<< spa.str() <<" *************" << endl;
00654 
00655   TStyle* sty1 = new TStyle("sty1","My Style.1 for Pixel History Plots"); 
00656           sty1->SetCanvasDefW(1080); 
00657           sty1->SetCanvasDefH(250); 
00658           sty1->SetCanvasBorderMode(0); 
00659           sty1->SetPadBorderMode(0);
00660           sty1->SetPadLeftMargin(0.05);
00661           sty1->SetPadRightMargin(0.03);
00662           sty1->SetPadTopMargin(0.16);
00663           sty1->SetPadBottomMargin(0.15);
00664           sty1->SetTitleBorderSize(0); 
00665           sty1->SetTitleFontSize(0.07); 
00666           sty1->SetOptStat(0); 
00667           sty1->cd(); 
00668 
00669   TCanvas* c1 = new TCanvas("c1","c1",1080,250); 
00670            c1->UseCurrentStyle(); 
00671   
00672   for (vector<uint32_t>::const_iterator iDet=allDetIds.begin(); iDet!=allDetIds.end(); ++iDet) {
00673     if (*iDet<40) {
00674       if (variable_[0]) {
00675         for (int pBin=0; pBin<15; pBin++) {                                                            
00676           hisID = "errorType"; hisID += (pBin+25); hisID += "_"; hisID += *iDet;     
00677           TH1F* errFED = (TH1F*)AllDetHistograms->FindObject(hisID);                           
00678           if (errFED->Integral()>0.0) {
00679             errFED->SetMinimum(0.0); 
00680             errFED->GetXaxis()->SetLabelSize(0.08); 
00681             errFED->GetYaxis()->SetLabelSize(0.06); 
00682             errFED->SetMarkerStyle(8); 
00683             errFED->SetMarkerSize(0.2); 
00684             errFED->Draw(); 
00685             title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00686             c1->SaveAs(title); 
00687           }
00688         }                                                                                              
00689       } 
00690     } 
00691     if (*iDet==80 || *iDet==81) {
00692       if (variable_[14]) {
00693         hisID = "trkFrac_"; hisID += *iDet;       
00694         TH1F* trkFrac = (TH1F*)AllDetHistograms->FindObject(hisID);                   
00695               trkFrac->SetMinimum(0.0); 
00696               trkFrac->SetMarkerStyle(8); 
00697               trkFrac->SetMarkerSize(0.2); 
00698               trkFrac->GetXaxis()->SetLabelSize(0.08); 
00699               trkFrac->GetYaxis()->SetLabelSize(0.06); 
00700               trkFrac->Draw(); 
00701         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00702         c1->SaveAs(title); 
00703       }
00704       if (variable_[15]) {
00705         hisID = "nOnTrackClusters_"; hisID += *iDet;         
00706         TH1F* nOnTrackClusters = (TH1F*)AllDetHistograms->FindObject(hisID);                  
00707               nOnTrackClusters->SetMinimum(0.0); 
00708               nOnTrackClusters->SetMarkerStyle(8); 
00709               nOnTrackClusters->SetMarkerSize(0.2); 
00710               nOnTrackClusters->GetXaxis()->SetLabelSize(0.08); 
00711               nOnTrackClusters->GetYaxis()->SetLabelSize(0.06); 
00712               nOnTrackClusters->Draw(); 
00713         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00714         c1->SaveAs(title); 
00715 
00716         hisID = "onTrackClusterCharge_"; hisID += *iDet;              
00717         TH1F* onTrackClusterCharge = (TH1F*)AllDetHistograms->FindObject(hisID);                      
00718               onTrackClusterCharge->SetMinimum(0.0); 
00719               onTrackClusterCharge->SetMarkerStyle(8); 
00720               onTrackClusterCharge->SetMarkerSize(0.2); 
00721               onTrackClusterCharge->GetXaxis()->SetLabelSize(0.08); 
00722               onTrackClusterCharge->GetYaxis()->SetLabelSize(0.06); 
00723               onTrackClusterCharge->Draw(); 
00724         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00725         c1->SaveAs(title); 
00726 
00727         hisID = "onTrackClusterSize_"; hisID += *iDet;               
00728         TH1F* onTrackClusterSize = (TH1F*)AllDetHistograms->FindObject(hisID);                
00729               onTrackClusterSize->SetMinimum(0.0); 
00730               onTrackClusterSize->SetMarkerStyle(8); 
00731               onTrackClusterSize->SetMarkerSize(0.2); 
00732               onTrackClusterSize->GetXaxis()->SetLabelSize(0.08); 
00733               onTrackClusterSize->GetYaxis()->SetLabelSize(0.06); 
00734               onTrackClusterSize->Draw(); 
00735         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00736         c1->SaveAs(title); 
00737       }
00738       if (variable_[16]) {
00739         hisID = "nOffTrackClusters_"; hisID += *iDet;         
00740         TH1F* nOffTrackClusters = (TH1F*)AllDetHistograms->FindObject(hisID);                 
00741               nOffTrackClusters->SetMinimum(0.0); 
00742               nOffTrackClusters->SetMarkerStyle(8); 
00743               nOffTrackClusters->SetMarkerSize(0.2); 
00744               nOffTrackClusters->GetXaxis()->SetLabelSize(0.08); 
00745               nOffTrackClusters->GetYaxis()->SetLabelSize(0.06); 
00746               nOffTrackClusters->Draw(); 
00747         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00748         c1->SaveAs(title); 
00749 
00750         hisID = "offTrackClusterCharge_"; hisID += *iDet;             
00751         TH1F* offTrackClusterCharge = (TH1F*)AllDetHistograms->FindObject(hisID);                     
00752               offTrackClusterCharge->SetMinimum(0.0); 
00753               offTrackClusterCharge->SetMarkerStyle(8); 
00754               offTrackClusterCharge->SetMarkerSize(0.2); 
00755               offTrackClusterCharge->GetXaxis()->SetLabelSize(0.08); 
00756               offTrackClusterCharge->GetYaxis()->SetLabelSize(0.06); 
00757               offTrackClusterCharge->Draw(); 
00758         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00759         c1->SaveAs(title); 
00760 
00761         hisID = "offTrackClusterSize_"; hisID += *iDet;              
00762         TH1F* offTrackClusterSize = (TH1F*)AllDetHistograms->FindObject(hisID);               
00763               offTrackClusterSize->SetMinimum(0.0); 
00764               offTrackClusterSize->SetMarkerStyle(8); 
00765               offTrackClusterSize->SetMarkerSize(0.2); 
00766               offTrackClusterSize->GetXaxis()->SetLabelSize(0.08); 
00767               offTrackClusterSize->GetYaxis()->SetLabelSize(0.06); 
00768               offTrackClusterSize->Draw(); 
00769         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00770         c1->SaveAs(title); 
00771       }
00772     }
00773     if (*iDet>99) {
00774       if (variable_[1]) {
00775         hisID = "nDigis_"; hisID += *iDet;                                     
00776         TH1F* nDigis = (TH1F*)AllDetHistograms->FindObject(hisID);                    
00777               nDigis->SetMinimum(0.0); 
00778               nDigis->SetMarkerStyle(8); 
00779               nDigis->SetMarkerSize(0.2); 
00780               nDigis->GetXaxis()->SetLabelSize(0.08); 
00781               nDigis->GetYaxis()->SetLabelSize(0.06); 
00782               nDigis->Draw(); 
00783         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00784         c1->SaveAs(title); 
00785       } 
00786       if (variable_[2]) {
00787         hisID = "adc_"; hisID += *iDet;                                        
00788         TH1F* adc = (TH1F*)AllDetHistograms->FindObject(hisID); 
00789               adc->SetMinimum(0.0); 
00790               adc->SetMarkerStyle(8); 
00791               adc->SetMarkerSize(0.2); 
00792               adc->GetXaxis()->SetLabelSize(0.08); 
00793               adc->GetYaxis()->SetLabelSize(0.06); 
00794               adc->Draw(); 
00795         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00796         c1->SaveAs(title); 
00797       } 
00798       if (variable_[3]) {
00799         hisID = "nClusters_"; hisID += *iDet;                            
00800         TH1F* nClusters = (TH1F*)AllDetHistograms->FindObject(hisID); 
00801               nClusters->SetMinimum(0.0); 
00802               nClusters->SetMarkerStyle(8); 
00803               nClusters->SetMarkerSize(0.2); 
00804               nClusters->GetXaxis()->SetLabelSize(0.08); 
00805               nClusters->GetYaxis()->SetLabelSize(0.06); 
00806               nClusters->Draw(); 
00807         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00808         c1->SaveAs(title); 
00809       } 
00810       if (variable_[4]) {
00811         hisID = "charge_"; hisID += *iDet;                                     
00812         TH1F* charge = (TH1F*)AllDetHistograms->FindObject(hisID); 
00813               charge->SetMinimum(0.0); 
00814               charge->SetMarkerStyle(8); 
00815               charge->SetMarkerSize(0.2); 
00816               charge->GetXaxis()->SetLabelSize(0.08); 
00817               charge->GetYaxis()->SetLabelSize(0.06); 
00818               charge->Draw(); 
00819         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00820         c1->SaveAs(title); 
00821       } 
00822       if (variable_[5]) {
00823         hisID = "clusterSize_"; hisID += *iDet;                                
00824         TH1F* clusterSize = (TH1F*)AllDetHistograms->FindObject(hisID); 
00825               clusterSize->SetMinimum(0.0); 
00826               clusterSize->SetMarkerStyle(8); 
00827               clusterSize->SetMarkerSize(0.2); 
00828               clusterSize->GetXaxis()->SetLabelSize(0.08); 
00829               clusterSize->GetYaxis()->SetLabelSize(0.06); 
00830               clusterSize->Draw(); 
00831         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00832         c1->SaveAs(title); 
00833       } 
00834       if (variable_[6]) {
00835         hisID = "clusterSizeX_"; hisID += *iDet;                               
00836         TH1F* sizeX = (TH1F*)AllDetHistograms->FindObject(hisID); 
00837               sizeX->SetMinimum(0.0); 
00838               sizeX->SetMarkerStyle(8); 
00839               sizeX->SetMarkerSize(0.2); 
00840               sizeX->GetXaxis()->SetLabelSize(0.08); 
00841               sizeX->GetYaxis()->SetLabelSize(0.06); 
00842               sizeX->Draw(); 
00843         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00844         c1->SaveAs(title); 
00845       } 
00846       if (variable_[7]) {
00847         hisID = "clusterSizeY_"; hisID += *iDet;                               
00848         TH1F* sizeY = (TH1F*)AllDetHistograms->FindObject(hisID); 
00849               sizeY->SetMinimum(0.0); 
00850               sizeY->SetMarkerStyle(8); 
00851               sizeY->SetMarkerSize(0.2); 
00852               sizeY->GetXaxis()->SetLabelSize(0.08); 
00853               sizeY->GetYaxis()->SetLabelSize(0.06); 
00854               sizeY->Draw(); 
00855         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00856         c1->SaveAs(title); 
00857       }
00858       if (variable_[8]) {
00859         hisID = "nRecHits_"; hisID += *iDet;                                   
00860         TH1F* nRecHits = (TH1F*)AllDetHistograms->FindObject(hisID); 
00861               nRecHits->SetMinimum(0.0); 
00862               nRecHits->SetMarkerStyle(8); 
00863               nRecHits->SetMarkerSize(0.2); 
00864               nRecHits->GetXaxis()->SetLabelSize(0.08); 
00865               nRecHits->GetYaxis()->SetLabelSize(0.06); 
00866               nRecHits->Draw(); 
00867         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00868         c1->SaveAs(title); 
00869       } 
00870       if (variable_[9]) {
00871         hisID = "residualX_"; hisID += *iDet;                                  
00872         TH1F* residualX = (TH1F*)AllDetHistograms->FindObject(hisID); 
00873               residualX->SetMinimum(0.0); 
00874               residualX->SetMarkerStyle(8); 
00875               residualX->SetMarkerSize(0.2); 
00876               residualX->GetXaxis()->SetLabelSize(0.08); 
00877               residualX->GetYaxis()->SetLabelSize(0.06); 
00878               residualX->Draw(); 
00879         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00880         c1->SaveAs(title); 
00881       } 
00882       if (variable_[10]) {
00883         hisID = "residualY_"; hisID += *iDet;                                  
00884         TH1F* residualY = (TH1F*)AllDetHistograms->FindObject(hisID); 
00885               residualY->SetMinimum(0.0); 
00886               residualY->SetMarkerStyle(8); 
00887               residualY->SetMarkerSize(0.2); 
00888               residualY->GetXaxis()->SetLabelSize(0.08); 
00889               residualY->GetYaxis()->SetLabelSize(0.06); 
00890               residualY->Draw(); 
00891         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00892         c1->SaveAs(title); 
00893       }
00894       if (variable_[11]) {
00895         hisID = "nPixHitsTrk_"; hisID += *iDet;                                
00896         TH1F* nPixHitsTrk = (TH1F*)AllDetHistograms->FindObject(hisID); 
00897               nPixHitsTrk->SetMinimum(0.0); 
00898               nPixHitsTrk->SetMarkerStyle(8); 
00899               nPixHitsTrk->SetMarkerSize(0.2); 
00900               nPixHitsTrk->GetXaxis()->SetLabelSize(0.08); 
00901               nPixHitsTrk->GetYaxis()->SetLabelSize(0.06); 
00902               nPixHitsTrk->Draw(); 
00903         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00904         c1->SaveAs(title); 
00905       }
00906       if (variable_[12]) {
00907         hisID = "nNoisPixels_"; hisID += *iDet;                                
00908         TH1F* nNoisPixels = (TH1F*)AllDetHistograms->FindObject(hisID); 
00909               nNoisPixels->SetMinimum(0.0); 
00910               nNoisPixels->SetMarkerStyle(8); 
00911               nNoisPixels->SetMarkerSize(0.2); 
00912               nNoisPixels->GetXaxis()->SetLabelSize(0.08); 
00913               nNoisPixels->GetYaxis()->SetLabelSize(0.06); 
00914               nNoisPixels->Draw(); 
00915         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00916         c1->SaveAs(title); 
00917       }
00918       if (variable_[13]) {
00919         hisID = "nDeadPixels_"; hisID += *iDet;                                
00920         TH1F* nDeadPixels = (TH1F*)AllDetHistograms->FindObject(hisID); 
00921               nDeadPixels->SetMinimum(0.0); 
00922               nDeadPixels->SetMarkerStyle(8); 
00923               nDeadPixels->SetMarkerSize(0.2); 
00924               nDeadPixels->GetXaxis()->SetLabelSize(0.08); 
00925               nDeadPixels->GetYaxis()->SetLabelSize(0.06); 
00926               nDeadPixels->Draw(); 
00927         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00928         c1->SaveAs(title); 
00929       }
00930     } 
00931   } 
00932   TStyle* sty2 = new TStyle("mSty2","My Style.2 for Pixel History Plots"); 
00933           sty2->SetCanvasDefW(1080); 
00934           sty2->SetCanvasDefH(135); 
00935           sty2->SetCanvasBorderMode(0); 
00936           sty2->SetPadBorderMode(0);
00937           sty2->SetPadLeftMargin(0.05);
00938           sty2->SetPadRightMargin(0.03);
00939           sty2->SetPadTopMargin(0.18);
00940           sty2->SetPadBottomMargin(0.31);
00941           sty2->SetTitleBorderSize(0); 
00942           sty2->SetTitleFontSize(0.144); 
00943           sty2->SetTitleX(0.409); 
00944           sty2->SetOptStat(0); 
00945           sty2->cd(); 
00946  
00947   TCanvas* c2 = new TCanvas("c2","c2",1080,135); 
00948            c2->UseCurrentStyle(); 
00949 
00950   for (vector<uint32_t>::const_iterator iDet=allDetIds.begin(); iDet!=allDetIds.end(); ++iDet) {
00951     if (*iDet>99) {
00952       if (variable_[1]) {
00953         hisID = "nDigis_mFr_"; hisID += *iDet;                         
00954         (TH1F*)AllDetHistograms->FindObject(hisID);                    
00955         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
00956               mFr->SetMinimum(0.0); 
00957               mFr->GetXaxis()->SetLabelOffset(0.009); 
00958               mFr->GetXaxis()->SetLabelSize(0.165); 
00959               mFr->GetYaxis()->SetLabelSize(0.120); 
00960               mFr->Draw(); 
00961         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00962         c2->SaveAs(title); 
00963       } 
00964       if (variable_[2]) {
00965         hisID = "adc_mFr_"; hisID += *iDet;                                    
00966         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
00967               mFr->SetMinimum(0.0); 
00968               mFr->GetXaxis()->SetLabelOffset(0.009); 
00969               mFr->GetXaxis()->SetLabelSize(0.165); 
00970               mFr->GetYaxis()->SetLabelSize(0.120); 
00971               mFr->Draw(); 
00972         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00973         c2->SaveAs(title); 
00974       } 
00975       if (variable_[3]) {
00976         hisID = "nClusters_mFr_"; hisID += *iDet;                                      
00977         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
00978               mFr->SetMinimum(0.0); 
00979               mFr->GetXaxis()->SetLabelOffset(0.009); 
00980               mFr->GetXaxis()->SetLabelSize(0.165); 
00981               mFr->GetYaxis()->SetLabelSize(0.120); 
00982               mFr->Draw(); 
00983         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00984         c2->SaveAs(title); 
00985       } 
00986       if (variable_[4]) {
00987         hisID = "charge_mFr_"; hisID += *iDet;                         
00988         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
00989               mFr->SetMinimum(0.0); 
00990               mFr->GetXaxis()->SetLabelOffset(0.009); 
00991               mFr->GetXaxis()->SetLabelSize(0.165); 
00992               mFr->GetYaxis()->SetLabelSize(0.120); 
00993               mFr->Draw(); 
00994         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
00995         c2->SaveAs(title); 
00996       } 
00997       if (variable_[5]) {
00998         hisID = "clusterSize_mFr_"; hisID += *iDet;                                    
00999         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
01000               mFr->SetMinimum(0.0); 
01001               mFr->GetXaxis()->SetLabelOffset(0.009); 
01002               mFr->GetXaxis()->SetLabelSize(0.165); 
01003               mFr->GetYaxis()->SetLabelSize(0.120); 
01004               mFr->Draw(); 
01005         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
01006         c2->SaveAs(title); 
01007       } 
01008       if (variable_[6]) {
01009         hisID = "clusterSizeX_mFr_"; hisID += *iDet;                           
01010         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
01011               mFr->SetMinimum(0.0); 
01012               mFr->GetXaxis()->SetLabelOffset(0.009); 
01013               mFr->GetXaxis()->SetLabelSize(0.165); 
01014               mFr->GetYaxis()->SetLabelSize(0.120); 
01015               mFr->Draw(); 
01016         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
01017         c2->SaveAs(title); 
01018       } 
01019       if (variable_[7]) {
01020         hisID = "clusterSizeY_mFr_"; hisID += *iDet;                           
01021         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
01022               mFr->SetMinimum(0.0); 
01023               mFr->GetXaxis()->SetLabelOffset(0.009); 
01024               mFr->GetXaxis()->SetLabelSize(0.165); 
01025               mFr->GetYaxis()->SetLabelSize(0.120); 
01026               mFr->Draw(); 
01027         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
01028         c2->SaveAs(title); 
01029       } 
01030       if (variable_[8]) {
01031         hisID = "nRecHits_mFr_"; hisID += *iDet;                                       
01032         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
01033               mFr->SetMinimum(0.0); 
01034               mFr->GetXaxis()->SetLabelOffset(0.009); 
01035               mFr->GetXaxis()->SetLabelSize(0.165); 
01036               mFr->GetYaxis()->SetLabelSize(0.120); 
01037               mFr->Draw(); 
01038         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
01039         c2->SaveAs(title); 
01040       } 
01041       if (variable_[9]) {
01042         hisID = "residualX_mFr_"; hisID += *iDet;                                      
01043         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
01044               mFr->SetMinimum(0.0); 
01045               mFr->GetXaxis()->SetLabelOffset(0.009); 
01046               mFr->GetXaxis()->SetLabelSize(0.165); 
01047               mFr->GetYaxis()->SetLabelSize(0.120); 
01048               mFr->Draw(); 
01049         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
01050         c2->SaveAs(title); 
01051       } 
01052       if (variable_[10]) {
01053         hisID = "residualY_mFr_"; hisID += *iDet;                                      
01054         TH1F* mFr = (TH1F*)AllDetHistograms->FindObject(hisID); 
01055               mFr->SetMinimum(0.0); 
01056               mFr->GetXaxis()->SetLabelOffset(0.009); 
01057               mFr->GetXaxis()->SetLabelSize(0.165); 
01058               mFr->GetYaxis()->SetLabelSize(0.120); 
01059               mFr->Draw(); 
01060         title = outputDir_; title += "/"; title += hisID; title += "."; title += typePlots_; 
01061         c2->SaveAs(title); 
01062       }
01063     } 
01064   } 
01065 }