CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_2_SLHC4_patch1/src/DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencyModule.cc

Go to the documentation of this file.
00001 // Package:    SiPixelMonitorTrack
00002 // Class:      SiPixelHitEfficiencyModule
00003 // 
00004 // class SiPixelHitEfficiencyModule SiPixelHitEfficiencyModule.cc 
00005 //       DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencyModule.cc
00006 //
00007 // Description: SiPixel hit efficiency data quality monitoring modules
00008 // Implementation: prototype -> improved -> never final - end of the 1st step 
00009 //
00010 // Original Authors: Romain Rougny & Luca Mucibello
00011 //         Created: Mar Nov 10 13:29:00 CET nbinangle9
00012 
00013 
00014 
00015 #include <string>
00016 #include <iostream>
00017 
00018 #include "DQMServices/Core/interface/DQMStore.h"
00019 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00020 #include "FWCore/ServiceRegistry/interface/Service.h"
00021 #include "FWCore/Utilities/interface/InputTag.h"
00022 #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h"
00023 #include "DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencyModule.h"
00024 
00025 // Data Formats
00026 #include "DataFormats/SiPixelDetId/interface/PixelBarrelName.h"
00027 #include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h"
00028 #include "DataFormats/SiPixelDetId/interface/PixelEndcapName.h"
00029 #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h"
00030 #include "DataFormats/DetId/interface/DetId.h"
00031 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
00032 #include "DataFormats/VertexReco/interface/Vertex.h"
00033 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00034 
00035 
00036 using namespace std; 
00037 
00038 
00039 SiPixelHitEfficiencyModule::SiPixelHitEfficiencyModule() : id_(0) {
00040   bBookTracks = true;
00041 }
00042 
00043 
00044 SiPixelHitEfficiencyModule::SiPixelHitEfficiencyModule(uint32_t id) : id_(id) { 
00045   bBookTracks = true;
00046 }
00047 
00048 
00049 SiPixelHitEfficiencyModule::~SiPixelHitEfficiencyModule() { 
00050  
00051 }
00052 
00053 
00054 void SiPixelHitEfficiencyModule::book(const edm::ParameterSet& iConfig, int type, bool isUpgrade) {
00055   DQMStore* dbe = edm::Service<DQMStore>().operator->();
00056 
00057   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00058   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00059   bool isHalfModule = false;
00060   if(barrel){
00061     if (!isUpgrade) {
00062       isHalfModule = PixelBarrelName(DetId(id_)).isHalfModule(); 
00063     } else if (isUpgrade) {
00064       isHalfModule = PixelBarrelNameUpgrade(DetId(id_)).isHalfModule(); 
00065     }
00066   }
00067 
00068   edm::InputTag src = iConfig.getParameter<edm::InputTag>("src");
00069   debug_ = iConfig.getUntrackedParameter<bool>("debug",false);
00070   updateEfficiencies = iConfig.getUntrackedParameter<bool>("updateEfficiencies",false);
00071   std::string hisID;
00072   
00073   int nbinangle = 28;
00074   int nbinX = 45;
00075   int nbinY = 40;
00076 
00077   if(type==0){
00078     SiPixelHistogramId* theHistogramId = new SiPixelHistogramId(src.label());
00079     
00080     if(updateEfficiencies){
00081       //EFFICIENCY
00082       hisID = theHistogramId->setHistoId("efficiency",id_);
00083       meEfficiency_ = dbe->book1D(hisID,"Hit efficiency",1,0,1.);
00084       meEfficiency_->setAxisTitle("Hit efficiency",1);
00085     
00086       hisID = theHistogramId->setHistoId("efficiencyX",id_);
00087       meEfficiencyX_ = dbe->book1D(hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
00088       meEfficiencyX_->setAxisTitle("Hit efficiency in X",1);
00089     
00090       hisID = theHistogramId->setHistoId("efficiencyY",id_);
00091       meEfficiencyY_ = dbe->book1D(hisID,"Hit efficiency in Y",nbinY,-4.,4.);
00092       meEfficiencyY_->setAxisTitle("Hit efficiency in Y",1);
00093     
00094       hisID = theHistogramId->setHistoId("efficiencyAlpha",id_);
00095       meEfficiencyAlpha_ = dbe->book1D(hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
00096       meEfficiencyAlpha_->setAxisTitle("Hit efficiency in Alpha",1);
00097     
00098       hisID = theHistogramId->setHistoId("efficiencyBeta",id_);
00099       meEfficiencyBeta_ = dbe->book1D(hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
00100       meEfficiencyBeta_->setAxisTitle("Hit efficiency in Beta",1);
00101     }
00102 
00103     //VALID
00104     hisID = theHistogramId->setHistoId("valid",id_);
00105     meValid_ = dbe->book1D(hisID,"# Valid hits",1,0,1.);
00106     meValid_->setAxisTitle("# Valid hits",1);
00107     
00108     /*hisID = theHistogramId->setHistoId("validX",id_);
00109     meValidX_ = dbe->book1D(hisID,"# Valid hits in X",nbinX,-1.5,1.5);
00110     meValidX_->setAxisTitle("# Valid hits in X",1);
00111     
00112     hisID = theHistogramId->setHistoId("validY",id_);
00113     meValidY_ = dbe->book1D(hisID,"# Valid hits in Y",nbinY,-4.,4.);
00114     meValidY_->setAxisTitle("# Valid hits in Y",1);
00115     
00116     hisID = theHistogramId->setHistoId("validAlpha",id_);
00117     meValidAlpha_ = dbe->book1D(hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
00118     meValidAlpha_->setAxisTitle("# Valid hits in Alpha",1);
00119     
00120     hisID = theHistogramId->setHistoId("validBeta",id_);
00121     meValidBeta_ = dbe->book1D(hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
00122     meValidBeta_->setAxisTitle("# Valid hits in Beta",1);*/
00123 
00124     //MISSING
00125     hisID = theHistogramId->setHistoId("missing",id_);
00126     meMissing_ = dbe->book1D(hisID,"# Missing hits",1,0,1.);
00127     meMissing_->setAxisTitle("# Missing hits",1);
00128     
00129     /*hisID = theHistogramId->setHistoId("missingX",id_);
00130     meMissingX_ = dbe->book1D(hisID,"# Missing hits in X",nbinX,-1.5,1.5);
00131     meMissingX_->setAxisTitle("# Missing hits in X",1);
00132     
00133     hisID = theHistogramId->setHistoId("missingY",id_);
00134     meMissingY_ = dbe->book1D(hisID,"# Missing hits in Y",nbinY,-4.,4.);
00135     meMissingY_->setAxisTitle("# Missing hits in Y",1);
00136     
00137     hisID = theHistogramId->setHistoId("missingAlpha",id_);
00138     meMissingAlpha_ = dbe->book1D(hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
00139     meMissingAlpha_->setAxisTitle("# Missing hits in Alpha",1);
00140     
00141     hisID = theHistogramId->setHistoId("missingBeta",id_);
00142     meMissingBeta_ = dbe->book1D(hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
00143     meMissingBeta_->setAxisTitle("# Missing hits in Beta",1);*/
00144     
00145     delete theHistogramId;
00146   }
00147 
00148   if(type==1 && barrel){
00149     uint32_t DBladder;
00150     if (!isUpgrade) { DBladder = PixelBarrelName(DetId(id_)).ladderName(); }
00151     else if (isUpgrade) { DBladder = PixelBarrelNameUpgrade(DetId(id_)).ladderName(); }
00152     char sladder[80]; sprintf(sladder,"Ladder_%02i",DBladder);
00153     hisID = src.label() + "_" + sladder;
00154     if(isHalfModule) hisID += "H";
00155     else hisID += "F";
00156     
00157     if(updateEfficiencies){
00158       //EFFICIENCY
00159       meEfficiencyLad_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
00160       meEfficiencyLad_->setAxisTitle("Hit efficiency",1);
00161     
00162       meEfficiencyXLad_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
00163       meEfficiencyXLad_->setAxisTitle("Hit efficiency in X",1);
00164     
00165       meEfficiencyYLad_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
00166       meEfficiencyYLad_->setAxisTitle("Hit efficiency in Y",1);
00167     
00168       meEfficiencyAlphaLad_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
00169       meEfficiencyAlphaLad_->setAxisTitle("Hit efficiency in Alpha",1);
00170     
00171       meEfficiencyBetaLad_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
00172       meEfficiencyBetaLad_->setAxisTitle("Hit efficiency in Beta",1);
00173     }
00174     
00175     //VALID
00176     meValidLad_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
00177     meValidLad_->setAxisTitle("# Valid hits",1);
00178     
00179     meValidXLad_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
00180     meValidXLad_->setAxisTitle("# Valid hits in X",1);
00181     
00182     meValidYLad_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
00183     meValidYLad_->setAxisTitle("# Valid hits in Y",1);
00184     
00185     meValidAlphaLad_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
00186     meValidAlphaLad_->setAxisTitle("# Valid hits in Alpha",1);
00187     
00188     meValidBetaLad_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
00189     meValidBetaLad_->setAxisTitle("# Valid hits in Beta",1);
00190 
00191     //MISSING
00192     meMissingLad_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
00193     meMissingLad_->setAxisTitle("# Missing hits",1);
00194     
00195     meMissingXLad_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
00196     meMissingXLad_->setAxisTitle("# Missing hits in X",1);
00197     
00198     meMissingYLad_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
00199     meMissingYLad_->setAxisTitle("# Missing hits in Y",1);
00200     
00201     meMissingAlphaLad_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
00202     meMissingAlphaLad_->setAxisTitle("# Missing hits in Alpha",1);
00203     
00204     meMissingBetaLad_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
00205     meMissingBetaLad_->setAxisTitle("# Missing hits in Beta",1);
00206   }
00207   
00208   if(type==2 && barrel){
00209     uint32_t DBlayer;
00210     if (!isUpgrade) { DBlayer = PixelBarrelName(DetId(id_)).layerName(); }
00211     else if (isUpgrade) { DBlayer = PixelBarrelNameUpgrade(DetId(id_)).layerName(); }
00212     char slayer[80]; sprintf(slayer,"Layer_%i",DBlayer);
00213     hisID = src.label() + "_" + slayer;
00214 
00215 
00216     if(updateEfficiencies){
00217       //EFFICIENCY
00218       meEfficiencyLay_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
00219       meEfficiencyLay_->setAxisTitle("Hit efficiency",1);
00220     
00221       meEfficiencyXLay_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
00222       meEfficiencyXLay_->setAxisTitle("Hit efficiency in X",1);
00223     
00224       meEfficiencyYLay_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
00225       meEfficiencyYLay_->setAxisTitle("Hit efficiency in Y",1);
00226     
00227       meEfficiencyAlphaLay_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
00228       meEfficiencyAlphaLay_->setAxisTitle("Hit efficiency in Alpha",1);
00229     
00230       meEfficiencyBetaLay_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
00231       meEfficiencyBetaLay_->setAxisTitle("Hit efficiency in Beta",1);
00232     }
00233     
00234     //VALID
00235     meValidLay_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
00236     meValidLay_->setAxisTitle("# Valid hits",1);
00237     
00238     meValidXLay_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
00239     meValidXLay_->setAxisTitle("# Valid hits in X",1);
00240     
00241     meValidYLay_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
00242     meValidYLay_->setAxisTitle("# Valid hits in Y",1);
00243     
00244     meValidAlphaLay_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
00245     meValidAlphaLay_->setAxisTitle("# Valid hits in Alpha",1);
00246     
00247     meValidBetaLay_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
00248     meValidBetaLay_->setAxisTitle("# Valid hits in Beta",1);
00249 
00250     //MISSING
00251     meMissingLay_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
00252     meMissingLay_->setAxisTitle("# Missing hits",1);
00253     
00254     meMissingXLay_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
00255     meMissingXLay_->setAxisTitle("# Missing hits in X",1);
00256     
00257     meMissingYLay_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
00258     meMissingYLay_->setAxisTitle("# Missing hits in Y",1);
00259     
00260     meMissingAlphaLay_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
00261     meMissingAlphaLay_->setAxisTitle("# Missing hits in Alpha",1);
00262     
00263     meMissingBetaLay_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
00264     meMissingBetaLay_->setAxisTitle("# Missing hits in Beta",1);
00265   }
00266   
00267   if(type==3 && barrel){
00268     uint32_t DBmodule;
00269     if (!isUpgrade) { DBmodule = PixelBarrelName(DetId(id_)).moduleName(); }
00270     else if (isUpgrade) { DBmodule = PixelBarrelNameUpgrade(DetId(id_)).moduleName(); }
00271     char smodule[80]; sprintf(smodule,"Ring_%i",DBmodule);
00272     hisID = src.label() + "_" + smodule;
00273     
00274     if(updateEfficiencies){
00275       //EFFICIENCY
00276       meEfficiencyPhi_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
00277       meEfficiencyPhi_->setAxisTitle("Hit efficiency",1);
00278     
00279       meEfficiencyXPhi_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
00280       meEfficiencyXPhi_->setAxisTitle("Hit efficiency in X",1);
00281     
00282       meEfficiencyYPhi_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
00283       meEfficiencyYPhi_->setAxisTitle("Hit efficiency in Y",1);
00284     
00285       meEfficiencyAlphaPhi_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
00286       meEfficiencyAlphaPhi_->setAxisTitle("Hit efficiency in Alpha",1);
00287     
00288       meEfficiencyBetaPhi_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
00289       meEfficiencyBetaPhi_->setAxisTitle("Hit efficiency in Beta",1);
00290     }
00291     
00292     //VALID
00293     meValidPhi_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
00294     meValidPhi_->setAxisTitle("# Valid hits",1);
00295     
00296     meValidXPhi_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
00297     meValidXPhi_->setAxisTitle("# Valid hits in X",1);
00298     
00299     meValidYPhi_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
00300     meValidYPhi_->setAxisTitle("# Valid hits in Y",1);
00301     
00302     meValidAlphaPhi_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
00303     meValidAlphaPhi_->setAxisTitle("# Valid hits in Alpha",1);
00304     
00305     meValidBetaPhi_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
00306     meValidBetaPhi_->setAxisTitle("# Valid hits in Beta",1);
00307 
00308     //MISSING
00309     meMissingPhi_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
00310     meMissingPhi_->setAxisTitle("# Missing hits",1);
00311     
00312     meMissingXPhi_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
00313     meMissingXPhi_->setAxisTitle("# Missing hits in X",1);
00314     
00315     meMissingYPhi_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
00316     meMissingYPhi_->setAxisTitle("# Missing hits in Y",1);
00317     
00318     meMissingAlphaPhi_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
00319     meMissingAlphaPhi_->setAxisTitle("# Missing hits in Alpha",1);
00320     
00321     meMissingBetaPhi_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
00322     meMissingBetaPhi_->setAxisTitle("# Missing hits in Beta",1); 
00323   }
00324   
00325   if(type==4 && endcap){
00326     uint32_t blade;
00327     if (!isUpgrade) { blade= PixelEndcapName(DetId(id_)).bladeName(); }
00328     else if (isUpgrade) { blade= PixelEndcapNameUpgrade(DetId(id_)).bladeName(); }
00329     
00330     char sblade[80]; sprintf(sblade, "Blade_%02i",blade);
00331     hisID = src.label() + "_" + sblade;
00332     
00333     if(updateEfficiencies){
00334       //EFFICIENCY
00335       meEfficiencyBlade_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
00336       meEfficiencyBlade_->setAxisTitle("Hit efficiency",1);
00337     
00338       meEfficiencyXBlade_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
00339       meEfficiencyXBlade_->setAxisTitle("Hit efficiency in X",1);
00340     
00341       meEfficiencyYBlade_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
00342       meEfficiencyYBlade_->setAxisTitle("Hit efficiency in Y",1);
00343     
00344       meEfficiencyAlphaBlade_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
00345       meEfficiencyAlphaBlade_->setAxisTitle("Hit efficiency in Alpha",1);
00346     
00347       meEfficiencyBetaBlade_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
00348       meEfficiencyBetaBlade_->setAxisTitle("Hit efficiency in Beta",1);
00349     }
00350     
00351     //VALID
00352     meValidBlade_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
00353     meValidBlade_->setAxisTitle("# Valid hits",1);
00354     
00355     meValidXBlade_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
00356     meValidXBlade_->setAxisTitle("# Valid hits in X",1);
00357     
00358     meValidYBlade_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
00359     meValidYBlade_->setAxisTitle("# Valid hits in Y",1);
00360     
00361     meValidAlphaBlade_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
00362     meValidAlphaBlade_->setAxisTitle("# Valid hits in Alpha",1);
00363     
00364     meValidBetaBlade_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
00365     meValidBetaBlade_->setAxisTitle("# Valid hits in Beta",1);
00366 
00367     //MISSING
00368     meMissingBlade_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
00369     meMissingBlade_->setAxisTitle("# Missing hits",1);
00370     
00371     meMissingXBlade_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
00372     meMissingXBlade_->setAxisTitle("# Missing hits in X",1);
00373     
00374     meMissingYBlade_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
00375     meMissingYBlade_->setAxisTitle("# Missing hits in Y",1);
00376     
00377     meMissingAlphaBlade_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
00378     meMissingAlphaBlade_->setAxisTitle("# Missing hits in Alpha",1);
00379     
00380     meMissingBetaBlade_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
00381     meMissingBetaBlade_->setAxisTitle("# Missing hits in Beta",1); 
00382   }
00383   
00384   if(type==5 && endcap){
00385     uint32_t disk;
00386     if (!isUpgrade) { disk = PixelEndcapName(DetId(id_)).diskName(); }
00387     else if (isUpgrade) { disk = PixelEndcapNameUpgrade(DetId(id_)).diskName(); }
00388     
00389     char sdisk[80]; sprintf(sdisk, "Disk_%i",disk);
00390     hisID = src.label() + "_" + sdisk;
00391     
00392     if(updateEfficiencies){
00393       //EFFICIENCY
00394       meEfficiencyDisk_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
00395       meEfficiencyDisk_->setAxisTitle("Hit efficiency",1);
00396     
00397       meEfficiencyXDisk_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
00398       meEfficiencyXDisk_->setAxisTitle("Hit efficiency in X",1);
00399     
00400       meEfficiencyYDisk_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
00401       meEfficiencyYDisk_->setAxisTitle("Hit efficiency in Y",1);
00402     
00403       meEfficiencyAlphaDisk_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
00404       meEfficiencyAlphaDisk_->setAxisTitle("Hit efficiency in Alpha",1);
00405     
00406       meEfficiencyBetaDisk_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
00407       meEfficiencyBetaDisk_->setAxisTitle("Hit efficiency in Beta",1);
00408     }
00409     
00410     //VALID
00411     meValidDisk_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
00412     meValidDisk_->setAxisTitle("# Valid hits",1);
00413     
00414     meValidXDisk_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
00415     meValidXDisk_->setAxisTitle("# Valid hits in X",1);
00416     
00417     meValidYDisk_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
00418     meValidYDisk_->setAxisTitle("# Valid hits in Y",1);
00419     
00420     meValidAlphaDisk_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
00421     meValidAlphaDisk_->setAxisTitle("# Valid hits in Alpha",1);
00422     
00423     meValidBetaDisk_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
00424     meValidBetaDisk_->setAxisTitle("# Valid hits in Beta",1);
00425 
00426     //MISSING
00427     meMissingDisk_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
00428     meMissingDisk_->setAxisTitle("# Missing hits",1);
00429     
00430     meMissingXDisk_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
00431     meMissingXDisk_->setAxisTitle("# Missing hits in X",1);
00432     
00433     meMissingYDisk_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
00434     meMissingYDisk_->setAxisTitle("# Missing hits in Y",1);
00435     
00436     meMissingAlphaDisk_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
00437     meMissingAlphaDisk_->setAxisTitle("# Missing hits in Alpha",1);
00438     
00439     meMissingBetaDisk_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
00440     meMissingBetaDisk_->setAxisTitle("# Missing hits in Beta",1);
00441   }
00442     
00443    
00444   if(type==6 && endcap){
00445     uint32_t panel;
00446     uint32_t module;
00447     if (!isUpgrade) {
00448       panel= PixelEndcapName(DetId(id_)).pannelName();
00449       module= PixelEndcapName(DetId(id_)).plaquetteName();
00450     } else if (isUpgrade) {
00451       panel= PixelEndcapNameUpgrade(DetId(id_)).pannelName();
00452       module= PixelEndcapNameUpgrade(DetId(id_)).plaquetteName();
00453     }
00454     
00455     char slab[80]; sprintf(slab, "Panel_%i_Ring_%i",panel, module);
00456     hisID = src.label() + "_" + slab;
00457     
00458     if(updateEfficiencies){
00459       //EFFICIENCY
00460       meEfficiencyRing_ = dbe->book1D("efficiency_"+hisID,"Hit efficiency",1,0,1.);
00461       meEfficiencyRing_->setAxisTitle("Hit efficiency",1);
00462     
00463       meEfficiencyXRing_ = dbe->book1D("efficiencyX_"+hisID,"Hit efficiency in X",nbinX,-1.5,1.5);
00464       meEfficiencyXRing_->setAxisTitle("Hit efficiency in X",1);
00465     
00466       meEfficiencyYRing_ = dbe->book1D("efficiencyY_"+hisID,"Hit efficiency in Y",nbinY,-4.,4.);
00467       meEfficiencyYRing_->setAxisTitle("Hit efficiency in Y",1);
00468     
00469       meEfficiencyAlphaRing_ = dbe->book1D("efficiencyAlpha_"+hisID,"Hit efficiency in Alpha",nbinangle,-3.5,3.5);
00470       meEfficiencyAlphaRing_->setAxisTitle("Hit efficiency in Alpha",1);
00471     
00472       meEfficiencyBetaRing_ = dbe->book1D("efficiencyBeta_"+hisID,"Hit efficiency in Beta",nbinangle,-3.5,3.5);
00473       meEfficiencyBetaRing_->setAxisTitle("Hit efficiency in Beta",1);
00474     }
00475     
00476     //VALID
00477     meValidRing_ = dbe->book1D("valid_"+hisID,"# Valid hits",1,0,1.);
00478     meValidRing_->setAxisTitle("# Valid hits",1);
00479     
00480     meValidXRing_ = dbe->book1D("validX_"+hisID,"# Valid hits in X",nbinX,-1.5,1.5);
00481     meValidXRing_->setAxisTitle("# Valid hits in X",1);
00482     
00483     meValidYRing_ = dbe->book1D("validY_"+hisID,"# Valid hits in Y",nbinY,-4.,4.);
00484     meValidYRing_->setAxisTitle("# Valid hits in Y",1);
00485     
00486     meValidAlphaRing_ = dbe->book1D("validAlpha_"+hisID,"# Valid hits in Alpha",nbinangle,-3.5,3.5);
00487     meValidAlphaRing_->setAxisTitle("# Valid hits in Alpha",1);
00488     
00489     meValidBetaRing_ = dbe->book1D("validBeta_"+hisID,"# Valid hits in Beta",nbinangle,-3.5,3.5);
00490     meValidBetaRing_->setAxisTitle("# Valid hits in Beta",1);
00491 
00492     //MISSING
00493     meMissingRing_ = dbe->book1D("missing_"+hisID,"# Missing hits",1,0,1.);
00494     meMissingRing_->setAxisTitle("# Missing hits",1);
00495     
00496     meMissingXRing_ = dbe->book1D("missingX_"+hisID,"# Missing hits in X",nbinX,-1.5,1.5);
00497     meMissingXRing_->setAxisTitle("# Missing hits in X",1);
00498     
00499     meMissingYRing_ = dbe->book1D("missingY_"+hisID,"# Missing hits in Y",nbinY,-4.,4.);
00500     meMissingYRing_->setAxisTitle("# Missing hits in Y",1);
00501     
00502     meMissingAlphaRing_ = dbe->book1D("missingAlpha_"+hisID,"# Missing hits in Alpha",nbinangle,-3.5,3.5);
00503     meMissingAlphaRing_->setAxisTitle("# Missing hits in Alpha",1);
00504     
00505     meMissingBetaRing_ = dbe->book1D("missingBeta_"+hisID,"# Missing hits in Beta",nbinangle,-3.5,3.5);
00506     meMissingBetaRing_->setAxisTitle("# Missing hits in Beta",1);
00507   }
00508 }
00509 
00510 
00511 void SiPixelHitEfficiencyModule::fill(LocalTrajectoryParameters ltp, bool isHitValid, bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {  
00512   
00513   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00514   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00515 
00516   LocalVector localDir = ltp.momentum()/ltp.momentum().mag();
00517   float prediction_alpha = atan2(localDir.z(), localDir.x());
00518   float prediction_beta = atan2(localDir.z(), localDir.y());
00519   float prediction_x = ltp.position().x();
00520   float prediction_y = ltp.position().y();
00521   
00522   if(isHitValid){
00523     if(modon){
00524       meValid_->Fill(0.5);
00525       /*meValidX_->Fill(prediction_x);
00526       meValidY_->Fill(prediction_y);
00527       meValidAlpha_->Fill(prediction_alpha);
00528       meValidBeta_->Fill(prediction_beta);*/
00529     }
00530     if(barrel && ladon){
00531       meValidLad_->Fill(0.5);
00532       meValidXLad_->Fill(prediction_x);
00533       meValidYLad_->Fill(prediction_y);
00534       meValidAlphaLad_->Fill(prediction_alpha);
00535       meValidBetaLad_->Fill(prediction_beta);
00536     }
00537     if(barrel && layon){
00538       meValidLay_->Fill(0.5);
00539       meValidXLay_->Fill(prediction_x);
00540       meValidYLay_->Fill(prediction_y);
00541       meValidAlphaLay_->Fill(prediction_alpha);
00542       meValidBetaLay_->Fill(prediction_beta);
00543     }   
00544     if(barrel && phion){
00545       meValidPhi_->Fill(0.5);
00546       meValidXPhi_->Fill(prediction_x);
00547       meValidYPhi_->Fill(prediction_y);
00548       meValidAlphaPhi_->Fill(prediction_alpha);
00549       meValidBetaPhi_->Fill(prediction_beta);
00550     }
00551     if(endcap && bladeon){
00552       meValidBlade_->Fill(0.5);
00553       meValidXBlade_->Fill(prediction_x);
00554       meValidYBlade_->Fill(prediction_y);
00555       meValidAlphaBlade_->Fill(prediction_alpha);
00556       meValidBetaBlade_->Fill(prediction_beta);
00557     }
00558     if(endcap && diskon){
00559       meValidDisk_->Fill(0.5);
00560       meValidXDisk_->Fill(prediction_x);
00561       meValidYDisk_->Fill(prediction_y);
00562       meValidAlphaDisk_->Fill(prediction_alpha);
00563       meValidBetaDisk_->Fill(prediction_beta);
00564     }
00565     if(endcap && ringon){
00566       meValidRing_->Fill(0.5);
00567       meValidXRing_->Fill(prediction_x);
00568       meValidYRing_->Fill(prediction_y);
00569       meValidAlphaRing_->Fill(prediction_alpha);
00570       meValidBetaRing_->Fill(prediction_beta);
00571     }
00572   }
00573   else {
00574     if(modon){
00575       meMissing_->Fill(0.5);
00576       /*meMissingX_->Fill(prediction_x);
00577       meMissingY_->Fill(prediction_y);
00578       meMissingAlpha_->Fill(prediction_alpha);
00579       meMissingBeta_->Fill(prediction_beta);*/
00580     }
00581     if(barrel && ladon){
00582       meMissingLad_->Fill(0.5);
00583       meMissingXLad_->Fill(prediction_x);
00584       meMissingYLad_->Fill(prediction_y);
00585       meMissingAlphaLad_->Fill(prediction_alpha);
00586       meMissingBetaLad_->Fill(prediction_beta);
00587     }
00588     if(barrel && layon){
00589       meMissingLay_->Fill(0.5);
00590       meMissingXLay_->Fill(prediction_x);
00591       meMissingYLay_->Fill(prediction_y);
00592       meMissingAlphaLay_->Fill(prediction_alpha);
00593       meMissingBetaLay_->Fill(prediction_beta);
00594     }   
00595     if(barrel && phion){
00596       meMissingPhi_->Fill(0.5);
00597       meMissingXPhi_->Fill(prediction_x);
00598       meMissingYPhi_->Fill(prediction_y);
00599       meMissingAlphaPhi_->Fill(prediction_alpha);
00600       meMissingBetaPhi_->Fill(prediction_beta);
00601     }
00602     if(endcap && bladeon){
00603       meMissingBlade_->Fill(0.5);
00604       meMissingXBlade_->Fill(prediction_x);
00605       meMissingYBlade_->Fill(prediction_y);
00606       meMissingAlphaBlade_->Fill(prediction_alpha);
00607       meMissingBetaBlade_->Fill(prediction_beta);
00608     }
00609     if(endcap && diskon){
00610       meMissingDisk_->Fill(0.5);
00611       meMissingXDisk_->Fill(prediction_x);
00612       meMissingYDisk_->Fill(prediction_y);
00613       meMissingAlphaDisk_->Fill(prediction_alpha);
00614       meMissingBetaDisk_->Fill(prediction_beta);
00615     }
00616     if(endcap && ringon){
00617       meMissingRing_->Fill(0.5);
00618       meMissingXRing_->Fill(prediction_x);
00619       meMissingYRing_->Fill(prediction_y);
00620       meMissingAlphaRing_->Fill(prediction_alpha);
00621       meMissingBetaRing_->Fill(prediction_beta);
00622     }
00623   }
00624   
00625   if(updateEfficiencies)
00626     computeEfficiencies(modon, ladon, layon, phion, bladeon, diskon, ringon);
00627 }
00628 
00629 void SiPixelHitEfficiencyModule::computeEfficiencies(bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
00630   
00631   if(debug_)
00632     std::cout<<"Now Filling histos for detid "<<id_<<std::endl;
00633   
00634   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
00635   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
00636   
00637   if(modon){
00638     meEfficiency_->setBinContent(1,(eff(meValid_->getBinContent(1),meMissing_->getBinContent(1))).first);
00639     meEfficiency_->setBinError(1,(eff(meValid_->getBinContent(1),meMissing_->getBinContent(1))).second);
00640     /*for(int i=1;i<=meValidX_->getNbinsX();++i){
00641       meEfficiencyX_->setBinContent(i,(eff(meValidX_->getBinContent(i),meMissingX_->getBinContent(i))).first);
00642       meEfficiencyX_->setBinError(i,(eff(meValidX_->getBinContent(i),meMissingX_->getBinContent(i))).second);
00643     }
00644     for(int i=1;i<=meValidY_->getNbinsX();++i){
00645       meEfficiencyY_->setBinContent(i,(eff(meValidY_->getBinContent(i),meMissingY_->getBinContent(i))).first);
00646       meEfficiencyY_->setBinError(i,(eff(meValidY_->getBinContent(i),meMissingY_->getBinContent(i))).second);
00647     }
00648     for(int i=1;i<=meValidAlpha_->getNbinsX();++i){
00649       meEfficiencyAlpha_->setBinContent(i,(eff(meValidAlpha_->getBinContent(i),meMissingAlpha_->getBinContent(i))).first);
00650       meEfficiencyAlpha_->setBinError(i,(eff(meValidAlpha_->getBinContent(i),meMissingAlpha_->getBinContent(i))).second);
00651     }
00652     for(int i=1;i<=meValidBeta_->getNbinsX();++i){
00653       meEfficiencyBeta_->setBinContent(i,(eff(meValidBeta_->getBinContent(i),meMissingBeta_->getBinContent(i))).first);
00654       meEfficiencyBeta_->setBinError(i,(eff(meValidBeta_->getBinContent(i),meMissingBeta_->getBinContent(i))).second);
00655     }*/
00656   }
00657   if(ladon && barrel){
00658     meEfficiencyLad_->setBinContent(1,(eff(meValidLad_->getBinContent(1),meMissingLad_->getBinContent(1))).first);
00659     meEfficiencyLad_->setBinError(1,(eff(meValidLad_->getBinContent(1),meMissingLad_->getBinContent(1))).second);
00660     for(int i=1;i<=meValidXLad_->getNbinsX();++i){
00661       meEfficiencyXLad_->setBinContent(i,(eff(meValidXLad_->getBinContent(i),meMissingXLad_->getBinContent(i))).first);
00662       meEfficiencyXLad_->setBinError(i,(eff(meValidXLad_->getBinContent(i),meMissingXLad_->getBinContent(i))).second);
00663     }
00664     for(int i=1;i<=meValidYLad_->getNbinsX();++i){
00665       meEfficiencyYLad_->setBinContent(i,(eff(meValidYLad_->getBinContent(i),meMissingYLad_->getBinContent(i))).first);
00666       meEfficiencyYLad_->setBinError(i,(eff(meValidYLad_->getBinContent(i),meMissingYLad_->getBinContent(i))).second);
00667     }
00668     for(int i=1;i<=meValidAlphaLad_->getNbinsX();++i){
00669       meEfficiencyAlphaLad_->setBinContent(i,(eff(meValidAlphaLad_->getBinContent(i),meMissingAlphaLad_->getBinContent(i))).first);
00670       meEfficiencyAlphaLad_->setBinError(i,(eff(meValidAlphaLad_->getBinContent(i),meMissingAlphaLad_->getBinContent(i))).second);
00671     }
00672     for(int i=1;i<=meValidBetaLad_->getNbinsX();++i){
00673       meEfficiencyBetaLad_->setBinContent(i,(eff(meValidBetaLad_->getBinContent(i),meMissingBetaLad_->getBinContent(i))).first);
00674       meEfficiencyBetaLad_->setBinError(i,(eff(meValidBetaLad_->getBinContent(i),meMissingBetaLad_->getBinContent(i))).second);
00675     }
00676   }
00677   
00678   if(layon && barrel){
00679     meEfficiencyLay_->setBinContent(1,(eff(meValidLay_->getBinContent(1),meMissingLay_->getBinContent(1))).first);
00680     meEfficiencyLay_->setBinError(1,(eff(meValidLay_->getBinContent(1),meMissingLay_->getBinContent(1))).second);
00681     for(int i=1;i<=meValidXLay_->getNbinsX();++i){
00682       meEfficiencyXLay_->setBinContent(i,(eff(meValidXLay_->getBinContent(i),meMissingXLay_->getBinContent(i))).first);
00683       meEfficiencyXLay_->setBinError(i,(eff(meValidXLay_->getBinContent(i),meMissingXLay_->getBinContent(i))).second);
00684     }
00685     for(int i=1;i<=meValidYLay_->getNbinsX();++i){
00686       meEfficiencyYLay_->setBinContent(i,(eff(meValidYLay_->getBinContent(i),meMissingYLay_->getBinContent(i))).first);
00687       meEfficiencyYLay_->setBinError(i,(eff(meValidYLay_->getBinContent(i),meMissingYLay_->getBinContent(i))).second);
00688     }
00689     for(int i=1;i<=meValidAlphaLay_->getNbinsX();++i){
00690       meEfficiencyAlphaLay_->setBinContent(i,(eff(meValidAlphaLay_->getBinContent(i),meMissingAlphaLay_->getBinContent(i))).first);
00691       meEfficiencyAlphaLay_->setBinError(i,(eff(meValidAlphaLay_->getBinContent(i),meMissingAlphaLay_->getBinContent(i))).second);
00692     }
00693     for(int i=1;i<=meValidBetaLay_->getNbinsX();++i){
00694       meEfficiencyBetaLay_->setBinContent(i,(eff(meValidBetaLay_->getBinContent(i),meMissingBetaLay_->getBinContent(i))).first);
00695       meEfficiencyBetaLay_->setBinError(i,(eff(meValidBetaLay_->getBinContent(i),meMissingBetaLay_->getBinContent(i))).second);
00696     }
00697   }
00698   
00699   if(phion && barrel){
00700     meEfficiencyPhi_->setBinContent(1,(eff(meValidPhi_->getBinContent(1),meMissingPhi_->getBinContent(1))).first);
00701     meEfficiencyPhi_->setBinError(1,(eff(meValidPhi_->getBinContent(1),meMissingPhi_->getBinContent(1))).second);
00702     for(int i=1;i<=meValidXPhi_->getNbinsX();++i){
00703       meEfficiencyXPhi_->setBinContent(i,(eff(meValidXPhi_->getBinContent(i),meMissingXPhi_->getBinContent(i))).first);
00704       meEfficiencyXPhi_->setBinError(i,(eff(meValidXPhi_->getBinContent(i),meMissingXPhi_->getBinContent(i))).second);
00705     }
00706     for(int i=1;i<=meValidYPhi_->getNbinsX();++i){
00707       meEfficiencyYPhi_->setBinContent(i,(eff(meValidYPhi_->getBinContent(i),meMissingYPhi_->getBinContent(i))).first);
00708       meEfficiencyYPhi_->setBinError(i,(eff(meValidYPhi_->getBinContent(i),meMissingYPhi_->getBinContent(i))).second);
00709     }
00710     for(int i=1;i<=meValidAlphaPhi_->getNbinsX();++i){
00711       meEfficiencyAlphaPhi_->setBinContent(i,(eff(meValidAlphaPhi_->getBinContent(i),meMissingAlphaPhi_->getBinContent(i))).first);
00712       meEfficiencyAlphaPhi_->setBinError(i,(eff(meValidAlphaPhi_->getBinContent(i),meMissingAlphaPhi_->getBinContent(i))).second);
00713     }
00714     for(int i=1;i<=meValidBetaPhi_->getNbinsX();++i){
00715       meEfficiencyBetaPhi_->setBinContent(i,(eff(meValidBetaPhi_->getBinContent(i),meMissingBetaPhi_->getBinContent(i))).first);
00716       meEfficiencyBetaPhi_->setBinError(i,(eff(meValidBetaPhi_->getBinContent(i),meMissingBetaPhi_->getBinContent(i))).second);
00717     }
00718   }
00719   if(bladeon && endcap){
00720     meEfficiencyBlade_->setBinContent(1,(eff(meValidBlade_->getBinContent(1),meMissingBlade_->getBinContent(1))).first);
00721     meEfficiencyBlade_->setBinError(1,(eff(meValidBlade_->getBinContent(1),meMissingBlade_->getBinContent(1))).second);
00722     for(int i=1;i<=meValidXBlade_->getNbinsX();++i){
00723       meEfficiencyXBlade_->setBinContent(i,(eff(meValidXBlade_->getBinContent(i),meMissingXBlade_->getBinContent(i))).first);
00724       meEfficiencyXBlade_->setBinError(i,(eff(meValidXBlade_->getBinContent(i),meMissingXBlade_->getBinContent(i))).second);
00725     }
00726     for(int i=1;i<=meValidYBlade_->getNbinsX();++i){
00727       meEfficiencyYBlade_->setBinContent(i,(eff(meValidYBlade_->getBinContent(i),meMissingYBlade_->getBinContent(i))).first);
00728       meEfficiencyYBlade_->setBinError(i,(eff(meValidYBlade_->getBinContent(i),meMissingYBlade_->getBinContent(i))).second);
00729     }
00730     for(int i=1;i<=meValidAlphaBlade_->getNbinsX();++i){
00731       meEfficiencyAlphaBlade_->setBinContent(i,(eff(meValidAlphaBlade_->getBinContent(i),meMissingAlphaBlade_->getBinContent(i))).first);
00732       meEfficiencyAlphaBlade_->setBinError(i,(eff(meValidAlphaBlade_->getBinContent(i),meMissingAlphaBlade_->getBinContent(i))).second);
00733     }
00734     for(int i=1;i<=meValidBetaBlade_->getNbinsX();++i){
00735       meEfficiencyBetaBlade_->setBinContent(i,(eff(meValidBetaBlade_->getBinContent(i),meMissingBetaBlade_->getBinContent(i))).first);
00736       meEfficiencyBetaBlade_->setBinError(i,(eff(meValidBetaBlade_->getBinContent(i),meMissingBetaBlade_->getBinContent(i))).second);
00737     }
00738   }
00739   if(diskon && endcap){
00740     meEfficiencyDisk_->setBinContent(1,(eff(meValidDisk_->getBinContent(1),meMissingDisk_->getBinContent(1))).first);
00741     meEfficiencyDisk_->setBinError(1,(eff(meValidDisk_->getBinContent(1),meMissingDisk_->getBinContent(1))).second);
00742     for(int i=1;i<=meValidXDisk_->getNbinsX();++i){
00743       meEfficiencyXDisk_->setBinContent(i,(eff(meValidXDisk_->getBinContent(i),meMissingXDisk_->getBinContent(i))).first);
00744       meEfficiencyXDisk_->setBinError(i,(eff(meValidXDisk_->getBinContent(i),meMissingXDisk_->getBinContent(i))).second);
00745     }
00746     for(int i=1;i<=meValidYDisk_->getNbinsX();++i){
00747       meEfficiencyYDisk_->setBinContent(i,(eff(meValidYDisk_->getBinContent(i),meMissingYDisk_->getBinContent(i))).first);
00748       meEfficiencyYDisk_->setBinError(i,(eff(meValidYDisk_->getBinContent(i),meMissingYDisk_->getBinContent(i))).second);
00749     }
00750     for(int i=1;i<=meValidAlphaDisk_->getNbinsX();++i){
00751       meEfficiencyAlphaDisk_->setBinContent(i,(eff(meValidAlphaDisk_->getBinContent(i),meMissingAlphaDisk_->getBinContent(i))).first);
00752       meEfficiencyAlphaDisk_->setBinError(i,(eff(meValidAlphaDisk_->getBinContent(i),meMissingAlphaDisk_->getBinContent(i))).second);
00753     }
00754     for(int i=1;i<=meValidBetaDisk_->getNbinsX();++i){
00755       meEfficiencyBetaDisk_->setBinContent(i,(eff(meValidBetaDisk_->getBinContent(i),meMissingBetaDisk_->getBinContent(i))).first);
00756       meEfficiencyBetaDisk_->setBinError(i,(eff(meValidBetaDisk_->getBinContent(i),meMissingBetaDisk_->getBinContent(i))).second);
00757     }
00758   }
00759   if(ringon && endcap){
00760     meEfficiencyRing_->setBinContent(1,(eff(meValidRing_->getBinContent(1),meMissingRing_->getBinContent(1))).first);
00761     meEfficiencyRing_->setBinError(1,(eff(meValidRing_->getBinContent(1),meMissingRing_->getBinContent(1))).second);
00762     for(int i=1;i<=meValidXRing_->getNbinsX();++i){
00763       meEfficiencyXRing_->setBinContent(i,(eff(meValidXRing_->getBinContent(i),meMissingXRing_->getBinContent(i))).first);
00764       meEfficiencyXRing_->setBinError(i,(eff(meValidXRing_->getBinContent(i),meMissingXRing_->getBinContent(i))).second);
00765     }
00766     for(int i=1;i<=meValidYRing_->getNbinsX();++i){
00767       meEfficiencyYRing_->setBinContent(i,(eff(meValidYRing_->getBinContent(i),meMissingYRing_->getBinContent(i))).first);
00768       meEfficiencyYRing_->setBinError(i,(eff(meValidYRing_->getBinContent(i),meMissingYRing_->getBinContent(i))).second);
00769     }
00770     for(int i=1;i<=meValidAlphaRing_->getNbinsX();++i){
00771       meEfficiencyAlphaRing_->setBinContent(i,(eff(meValidAlphaRing_->getBinContent(i),meMissingAlphaRing_->getBinContent(i))).first);
00772       meEfficiencyAlphaRing_->setBinError(i,(eff(meValidAlphaRing_->getBinContent(i),meMissingAlphaRing_->getBinContent(i))).second);
00773     }
00774     for(int i=1;i<=meValidBetaRing_->getNbinsX();++i){
00775       meEfficiencyBetaRing_->setBinContent(i,(eff(meValidBetaRing_->getBinContent(i),meMissingBetaRing_->getBinContent(i))).first);
00776       meEfficiencyBetaRing_->setBinError(i,(eff(meValidBetaRing_->getBinContent(i),meMissingBetaRing_->getBinContent(i))).second);
00777     }
00778   }
00779 
00780 }
00781 
00782 std::pair<double,double> SiPixelHitEfficiencyModule::eff(double nValid, double nMissing){
00783   double efficiency = 0, error = 0 ;
00784   if(nValid+nMissing!=0){
00785     efficiency=nValid/(nValid+nMissing);
00786     error=sqrt(efficiency*(1.-efficiency)/(nValid+nMissing));
00787   }
00788   return make_pair(efficiency,error);
00789 }