CMS 3D CMS Logo

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