Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:11:21

0001 // Package:    SiPixelMonitorTrack
0002 // Class:      SiPixelHitEfficiencyModule
0003 //
0004 // class SiPixelHitEfficiencyModule SiPixelHitEfficiencyModule.cc
0005 //       DQM/SiPixelMonitorTrack/src/SiPixelHitEfficiencyModule.cc
0006 //
0007 // Description: SiPixel hit efficiency data quality monitoring modules
0008 // Implementation: prototype -> improved -> never final - end of the 1st step
0009 //
0010 // Original Authors: Romain Rougny & Luca Mucibello
0011 //         Created: Mar Nov 10 13:29:00 CET nbinangle9
0012 
0013 #include <iostream>
0014 #include <string>
0015 
0016 #include "DQM/SiPixelCommon/interface/SiPixelHistogramId.h"
0017 #include "DQM/SiPixelMonitorTrack/interface/SiPixelHitEfficiencyModule.h"
0018 #include "DQMServices/Core/interface/DQMStore.h"
0019 // Data Formats
0020 #include "DataFormats/DetId/interface/DetId.h"
0021 #include "DataFormats/TrackerCommon/interface/PixelBarrelName.h"
0022 #include "DataFormats/SiPixelDetId/interface/PixelBarrelNameUpgrade.h"
0023 #include "DataFormats/TrackerCommon/interface/PixelEndcapName.h"
0024 #include "DataFormats/SiPixelDetId/interface/PixelEndcapNameUpgrade.h"
0025 #include "DataFormats/SiPixelDetId/interface/PixelSubdetector.h"
0026 #include "DataFormats/VertexReco/interface/Vertex.h"
0027 #include "DataFormats/VertexReco/interface/VertexFwd.h"
0028 
0029 using namespace std;
0030 
0031 SiPixelHitEfficiencyModule::SiPixelHitEfficiencyModule() : id_(0) { bBookTracks = true; }
0032 
0033 SiPixelHitEfficiencyModule::SiPixelHitEfficiencyModule(uint32_t id) : id_(id) { bBookTracks = true; }
0034 
0035 SiPixelHitEfficiencyModule::~SiPixelHitEfficiencyModule() {}
0036 
0037 void SiPixelHitEfficiencyModule::book(const edm::ParameterSet &iConfig,
0038                                       const TrackerTopology *pTT,
0039                                       DQMStore::IBooker &iBooker,
0040                                       int type,
0041                                       bool isUpgrade) {
0042   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
0043   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
0044   bool isHalfModule = false;
0045   if (barrel) {
0046     isHalfModule = PixelBarrelName(DetId(id_), pTT, isUpgrade).isHalfModule();
0047   }
0048 
0049   edm::InputTag src = iConfig.getParameter<edm::InputTag>("src");
0050   debug_ = iConfig.getUntrackedParameter<bool>("debug", false);
0051   updateEfficiencies = iConfig.getUntrackedParameter<bool>("updateEfficiencies", false);
0052   std::string hisID;
0053 
0054   int nbinangle = 28;
0055   int nbinX = 45;
0056   int nbinY = 40;
0057 
0058   if (type == 0) {
0059     SiPixelHistogramId *theHistogramId = new SiPixelHistogramId(src.label());
0060 
0061     if (updateEfficiencies) {
0062       // EFFICIENCY
0063       hisID = theHistogramId->setHistoId("efficiency", id_);
0064       meEfficiency_ = iBooker.book1D(hisID, "Hit efficiency", 1, 0, 1.);
0065       meEfficiency_->setAxisTitle("Hit efficiency", 1);
0066 
0067       hisID = theHistogramId->setHistoId("efficiencyX", id_);
0068       meEfficiencyX_ = iBooker.book1D(hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
0069       meEfficiencyX_->setAxisTitle("Hit efficiency in X", 1);
0070 
0071       hisID = theHistogramId->setHistoId("efficiencyY", id_);
0072       meEfficiencyY_ = iBooker.book1D(hisID, "Hit efficiency in Y", nbinY, -4., 4.);
0073       meEfficiencyY_->setAxisTitle("Hit efficiency in Y", 1);
0074 
0075       hisID = theHistogramId->setHistoId("efficiencyAlpha", id_);
0076       meEfficiencyAlpha_ = iBooker.book1D(hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
0077       meEfficiencyAlpha_->setAxisTitle("Hit efficiency in Alpha", 1);
0078 
0079       hisID = theHistogramId->setHistoId("efficiencyBeta", id_);
0080       meEfficiencyBeta_ = iBooker.book1D(hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
0081       meEfficiencyBeta_->setAxisTitle("Hit efficiency in Beta", 1);
0082     }
0083 
0084     // VALID
0085     hisID = theHistogramId->setHistoId("valid", id_);
0086     meValid_ = iBooker.book1D(hisID, "# Valid hits", 1, 0, 1.);
0087     meValid_->setAxisTitle("# Valid hits", 1);
0088 
0089     // MISSING
0090     hisID = theHistogramId->setHistoId("missing", id_);
0091     meMissing_ = iBooker.book1D(hisID, "# Missing hits", 1, 0, 1.);
0092     meMissing_->setAxisTitle("# Missing hits", 1);
0093 
0094     delete theHistogramId;
0095   }
0096 
0097   if (type == 1 && barrel) {
0098     uint32_t DBladder;
0099     DBladder = PixelBarrelName(DetId(id_), pTT, isUpgrade).ladderName();
0100     char sladder[80];
0101     sprintf(sladder, "Ladder_%02i", DBladder);
0102     hisID = src.label() + "_" + sladder;
0103     if (isHalfModule)
0104       hisID += "H";
0105     else
0106       hisID += "F";
0107 
0108     if (updateEfficiencies) {
0109       // EFFICIENCY
0110       meEfficiencyLad_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
0111       meEfficiencyLad_->setAxisTitle("Hit efficiency", 1);
0112 
0113       meEfficiencyXLad_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
0114       meEfficiencyXLad_->setAxisTitle("Hit efficiency in X", 1);
0115 
0116       meEfficiencyYLad_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
0117       meEfficiencyYLad_->setAxisTitle("Hit efficiency in Y", 1);
0118 
0119       meEfficiencyAlphaLad_ =
0120           iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
0121       meEfficiencyAlphaLad_->setAxisTitle("Hit efficiency in Alpha", 1);
0122 
0123       meEfficiencyBetaLad_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
0124       meEfficiencyBetaLad_->setAxisTitle("Hit efficiency in Beta", 1);
0125     }
0126 
0127     // VALID
0128     meValidLad_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
0129     meValidLad_->setAxisTitle("# Valid hits", 1);
0130 
0131     meValidXLad_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
0132     meValidXLad_->setAxisTitle("# Valid hits in X", 1);
0133 
0134     meValidYLad_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
0135     meValidYLad_->setAxisTitle("# Valid hits in Y", 1);
0136 
0137     meValidModLad_ = iBooker.book1D("validMod_" + hisID, "# Valid hits on Module", 4, 0.5, 4.5);
0138     meValidModLad_->setAxisTitle("# Valid hits on Module", 1);
0139 
0140     meValidAlphaLad_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
0141     meValidAlphaLad_->setAxisTitle("# Valid hits in Alpha", 1);
0142 
0143     meValidBetaLad_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
0144     meValidBetaLad_->setAxisTitle("# Valid hits in Beta", 1);
0145 
0146     // MISSING
0147     meMissingLad_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
0148     meMissingLad_->setAxisTitle("# Missing hits", 1);
0149 
0150     meMissingXLad_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
0151     meMissingXLad_->setAxisTitle("# Missing hits in X", 1);
0152 
0153     meMissingYLad_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
0154     meMissingYLad_->setAxisTitle("# Missing hits in Y", 1);
0155 
0156     meMissingModLad_ = iBooker.book1D("missingMod_" + hisID, "# Missing hits on Module", 4, 0.5, 4.5);
0157     meMissingModLad_->setAxisTitle("# Missing hits on Module", 1);
0158 
0159     meMissingAlphaLad_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
0160     meMissingAlphaLad_->setAxisTitle("# Missing hits in Alpha", 1);
0161 
0162     meMissingBetaLad_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
0163     meMissingBetaLad_->setAxisTitle("# Missing hits in Beta", 1);
0164   }
0165 
0166   if (type == 2 && barrel) {
0167     uint32_t DBlayer;
0168     DBlayer = PixelBarrelName(DetId(id_), pTT, isUpgrade).layerName();
0169     char slayer[80];
0170     sprintf(slayer, "Layer_%i", DBlayer);
0171     hisID = src.label() + "_" + slayer;
0172 
0173     if (updateEfficiencies) {
0174       // EFFICIENCY
0175       meEfficiencyLay_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
0176       meEfficiencyLay_->setAxisTitle("Hit efficiency", 1);
0177 
0178       meEfficiencyXLay_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
0179       meEfficiencyXLay_->setAxisTitle("Hit efficiency in X", 1);
0180 
0181       meEfficiencyYLay_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
0182       meEfficiencyYLay_->setAxisTitle("Hit efficiency in Y", 1);
0183 
0184       meEfficiencyAlphaLay_ =
0185           iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
0186       meEfficiencyAlphaLay_->setAxisTitle("Hit efficiency in Alpha", 1);
0187 
0188       meEfficiencyBetaLay_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
0189       meEfficiencyBetaLay_->setAxisTitle("Hit efficiency in Beta", 1);
0190     }
0191 
0192     // VALID
0193     meValidLay_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
0194     meValidLay_->setAxisTitle("# Valid hits", 1);
0195 
0196     meValidXLay_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
0197     meValidXLay_->setAxisTitle("# Valid hits in X", 1);
0198 
0199     meValidYLay_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
0200     meValidYLay_->setAxisTitle("# Valid hits in Y", 1);
0201 
0202     meValidAlphaLay_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
0203     meValidAlphaLay_->setAxisTitle("# Valid hits in Alpha", 1);
0204 
0205     meValidBetaLay_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
0206     meValidBetaLay_->setAxisTitle("# Valid hits in Beta", 1);
0207 
0208     // MISSING
0209     meMissingLay_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
0210     meMissingLay_->setAxisTitle("# Missing hits", 1);
0211 
0212     meMissingXLay_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
0213     meMissingXLay_->setAxisTitle("# Missing hits in X", 1);
0214 
0215     meMissingYLay_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
0216     meMissingYLay_->setAxisTitle("# Missing hits in Y", 1);
0217 
0218     meMissingAlphaLay_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
0219     meMissingAlphaLay_->setAxisTitle("# Missing hits in Alpha", 1);
0220 
0221     meMissingBetaLay_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
0222     meMissingBetaLay_->setAxisTitle("# Missing hits in Beta", 1);
0223   }
0224 
0225   if (type == 3 && barrel) {
0226     uint32_t DBmodule;
0227     DBmodule = PixelBarrelName(DetId(id_), pTT, isUpgrade).moduleName();
0228     char smodule[80];
0229     sprintf(smodule, "Ring_%i", DBmodule);
0230     hisID = src.label() + "_" + smodule;
0231 
0232     if (updateEfficiencies) {
0233       // EFFICIENCY
0234       meEfficiencyPhi_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
0235       meEfficiencyPhi_->setAxisTitle("Hit efficiency", 1);
0236 
0237       meEfficiencyXPhi_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
0238       meEfficiencyXPhi_->setAxisTitle("Hit efficiency in X", 1);
0239 
0240       meEfficiencyYPhi_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
0241       meEfficiencyYPhi_->setAxisTitle("Hit efficiency in Y", 1);
0242 
0243       meEfficiencyAlphaPhi_ =
0244           iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
0245       meEfficiencyAlphaPhi_->setAxisTitle("Hit efficiency in Alpha", 1);
0246 
0247       meEfficiencyBetaPhi_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
0248       meEfficiencyBetaPhi_->setAxisTitle("Hit efficiency in Beta", 1);
0249     }
0250 
0251     // VALID
0252     meValidPhi_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
0253     meValidPhi_->setAxisTitle("# Valid hits", 1);
0254 
0255     meValidXPhi_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
0256     meValidXPhi_->setAxisTitle("# Valid hits in X", 1);
0257 
0258     meValidYPhi_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
0259     meValidYPhi_->setAxisTitle("# Valid hits in Y", 1);
0260 
0261     meValidAlphaPhi_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
0262     meValidAlphaPhi_->setAxisTitle("# Valid hits in Alpha", 1);
0263 
0264     meValidBetaPhi_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
0265     meValidBetaPhi_->setAxisTitle("# Valid hits in Beta", 1);
0266 
0267     // MISSING
0268     meMissingPhi_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
0269     meMissingPhi_->setAxisTitle("# Missing hits", 1);
0270 
0271     meMissingXPhi_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
0272     meMissingXPhi_->setAxisTitle("# Missing hits in X", 1);
0273 
0274     meMissingYPhi_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
0275     meMissingYPhi_->setAxisTitle("# Missing hits in Y", 1);
0276 
0277     meMissingAlphaPhi_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
0278     meMissingAlphaPhi_->setAxisTitle("# Missing hits in Alpha", 1);
0279 
0280     meMissingBetaPhi_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
0281     meMissingBetaPhi_->setAxisTitle("# Missing hits in Beta", 1);
0282   }
0283 
0284   if (type == 4 && endcap) {
0285     uint32_t blade;
0286     blade = PixelEndcapName(DetId(id_), pTT, isUpgrade).bladeName();
0287 
0288     char sblade[80];
0289     sprintf(sblade, "Blade_%02i", blade);
0290     hisID = src.label() + "_" + sblade;
0291 
0292     if (updateEfficiencies) {
0293       // EFFICIENCY
0294       meEfficiencyBlade_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
0295       meEfficiencyBlade_->setAxisTitle("Hit efficiency", 1);
0296 
0297       meEfficiencyXBlade_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
0298       meEfficiencyXBlade_->setAxisTitle("Hit efficiency in X", 1);
0299 
0300       meEfficiencyYBlade_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
0301       meEfficiencyYBlade_->setAxisTitle("Hit efficiency in Y", 1);
0302 
0303       meEfficiencyAlphaBlade_ =
0304           iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
0305       meEfficiencyAlphaBlade_->setAxisTitle("Hit efficiency in Alpha", 1);
0306 
0307       meEfficiencyBetaBlade_ =
0308           iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
0309       meEfficiencyBetaBlade_->setAxisTitle("Hit efficiency in Beta", 1);
0310     }
0311 
0312     // VALID
0313     meValidBlade_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 2, 0.5, 2.5);
0314     meValidBlade_->setAxisTitle("# Valid hits", 1);
0315 
0316     meValidXBlade_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
0317     meValidXBlade_->setAxisTitle("# Valid hits in X", 1);
0318 
0319     meValidYBlade_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
0320     meValidYBlade_->setAxisTitle("# Valid hits in Y", 1);
0321 
0322     meValidAlphaBlade_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
0323     meValidAlphaBlade_->setAxisTitle("# Valid hits in Alpha", 1);
0324 
0325     meValidBetaBlade_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
0326     meValidBetaBlade_->setAxisTitle("# Valid hits in Beta", 1);
0327 
0328     // MISSING
0329     meMissingBlade_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 2, 0.5, 2.5);
0330     meMissingBlade_->setAxisTitle("# Missing hits", 1);
0331 
0332     meMissingXBlade_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
0333     meMissingXBlade_->setAxisTitle("# Missing hits in X", 1);
0334 
0335     meMissingYBlade_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
0336     meMissingYBlade_->setAxisTitle("# Missing hits in Y", 1);
0337 
0338     meMissingAlphaBlade_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
0339     meMissingAlphaBlade_->setAxisTitle("# Missing hits in Alpha", 1);
0340 
0341     meMissingBetaBlade_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
0342     meMissingBetaBlade_->setAxisTitle("# Missing hits in Beta", 1);
0343   }
0344 
0345   if (type == 5 && endcap) {
0346     uint32_t disk;
0347     disk = PixelEndcapName(DetId(id_), pTT, isUpgrade).diskName();
0348 
0349     char sdisk[80];
0350     sprintf(sdisk, "Disk_%i", disk);
0351     hisID = src.label() + "_" + sdisk;
0352 
0353     if (updateEfficiencies) {
0354       // EFFICIENCY
0355       meEfficiencyDisk_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
0356       meEfficiencyDisk_->setAxisTitle("Hit efficiency", 1);
0357 
0358       meEfficiencyXDisk_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
0359       meEfficiencyXDisk_->setAxisTitle("Hit efficiency in X", 1);
0360 
0361       meEfficiencyYDisk_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
0362       meEfficiencyYDisk_->setAxisTitle("Hit efficiency in Y", 1);
0363 
0364       meEfficiencyAlphaDisk_ =
0365           iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
0366       meEfficiencyAlphaDisk_->setAxisTitle("Hit efficiency in Alpha", 1);
0367 
0368       meEfficiencyBetaDisk_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
0369       meEfficiencyBetaDisk_->setAxisTitle("Hit efficiency in Beta", 1);
0370     }
0371 
0372     // VALID
0373     meValidDisk_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
0374     meValidDisk_->setAxisTitle("# Valid hits", 1);
0375 
0376     meValidXDisk_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
0377     meValidXDisk_->setAxisTitle("# Valid hits in X", 1);
0378 
0379     meValidYDisk_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
0380     meValidYDisk_->setAxisTitle("# Valid hits in Y", 1);
0381 
0382     meValidAlphaDisk_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
0383     meValidAlphaDisk_->setAxisTitle("# Valid hits in Alpha", 1);
0384 
0385     meValidBetaDisk_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
0386     meValidBetaDisk_->setAxisTitle("# Valid hits in Beta", 1);
0387 
0388     // MISSING
0389     meMissingDisk_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
0390     meMissingDisk_->setAxisTitle("# Missing hits", 1);
0391 
0392     meMissingXDisk_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
0393     meMissingXDisk_->setAxisTitle("# Missing hits in X", 1);
0394 
0395     meMissingYDisk_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
0396     meMissingYDisk_->setAxisTitle("# Missing hits in Y", 1);
0397 
0398     meMissingAlphaDisk_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
0399     meMissingAlphaDisk_->setAxisTitle("# Missing hits in Alpha", 1);
0400 
0401     meMissingBetaDisk_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
0402     meMissingBetaDisk_->setAxisTitle("# Missing hits in Beta", 1);
0403   }
0404 
0405   if (type == 6 && endcap) {
0406     uint32_t panel;
0407     uint32_t module;
0408     panel = PixelEndcapName(DetId(id_), pTT, isUpgrade).pannelName();
0409     module = PixelEndcapName(DetId(id_), pTT, isUpgrade).plaquetteName();
0410 
0411     char slab[80];
0412     sprintf(slab, "Panel_%i_Ring_%i", panel, module);
0413     hisID = src.label() + "_" + slab;
0414 
0415     if (updateEfficiencies) {
0416       // EFFICIENCY
0417       meEfficiencyRing_ = iBooker.book1D("efficiency_" + hisID, "Hit efficiency", 1, 0, 1.);
0418       meEfficiencyRing_->setAxisTitle("Hit efficiency", 1);
0419 
0420       meEfficiencyXRing_ = iBooker.book1D("efficiencyX_" + hisID, "Hit efficiency in X", nbinX, -1.5, 1.5);
0421       meEfficiencyXRing_->setAxisTitle("Hit efficiency in X", 1);
0422 
0423       meEfficiencyYRing_ = iBooker.book1D("efficiencyY_" + hisID, "Hit efficiency in Y", nbinY, -4., 4.);
0424       meEfficiencyYRing_->setAxisTitle("Hit efficiency in Y", 1);
0425 
0426       meEfficiencyAlphaRing_ =
0427           iBooker.book1D("efficiencyAlpha_" + hisID, "Hit efficiency in Alpha", nbinangle, -3.5, 3.5);
0428       meEfficiencyAlphaRing_->setAxisTitle("Hit efficiency in Alpha", 1);
0429 
0430       meEfficiencyBetaRing_ = iBooker.book1D("efficiencyBeta_" + hisID, "Hit efficiency in Beta", nbinangle, -3.5, 3.5);
0431       meEfficiencyBetaRing_->setAxisTitle("Hit efficiency in Beta", 1);
0432     }
0433 
0434     // VALID
0435     meValidRing_ = iBooker.book1D("valid_" + hisID, "# Valid hits", 1, 0, 1.);
0436     meValidRing_->setAxisTitle("# Valid hits", 1);
0437 
0438     meValidXRing_ = iBooker.book1D("validX_" + hisID, "# Valid hits in X", nbinX, -1.5, 1.5);
0439     meValidXRing_->setAxisTitle("# Valid hits in X", 1);
0440 
0441     meValidYRing_ = iBooker.book1D("validY_" + hisID, "# Valid hits in Y", nbinY, -4., 4.);
0442     meValidYRing_->setAxisTitle("# Valid hits in Y", 1);
0443 
0444     meValidAlphaRing_ = iBooker.book1D("validAlpha_" + hisID, "# Valid hits in Alpha", nbinangle, -3.5, 3.5);
0445     meValidAlphaRing_->setAxisTitle("# Valid hits in Alpha", 1);
0446 
0447     meValidBetaRing_ = iBooker.book1D("validBeta_" + hisID, "# Valid hits in Beta", nbinangle, -3.5, 3.5);
0448     meValidBetaRing_->setAxisTitle("# Valid hits in Beta", 1);
0449 
0450     // MISSING
0451     meMissingRing_ = iBooker.book1D("missing_" + hisID, "# Missing hits", 1, 0, 1.);
0452     meMissingRing_->setAxisTitle("# Missing hits", 1);
0453 
0454     meMissingXRing_ = iBooker.book1D("missingX_" + hisID, "# Missing hits in X", nbinX, -1.5, 1.5);
0455     meMissingXRing_->setAxisTitle("# Missing hits in X", 1);
0456 
0457     meMissingYRing_ = iBooker.book1D("missingY_" + hisID, "# Missing hits in Y", nbinY, -4., 4.);
0458     meMissingYRing_->setAxisTitle("# Missing hits in Y", 1);
0459 
0460     meMissingAlphaRing_ = iBooker.book1D("missingAlpha_" + hisID, "# Missing hits in Alpha", nbinangle, -3.5, 3.5);
0461     meMissingAlphaRing_->setAxisTitle("# Missing hits in Alpha", 1);
0462 
0463     meMissingBetaRing_ = iBooker.book1D("missingBeta_" + hisID, "# Missing hits in Beta", nbinangle, -3.5, 3.5);
0464     meMissingBetaRing_->setAxisTitle("# Missing hits in Beta", 1);
0465   }
0466 }
0467 
0468 void SiPixelHitEfficiencyModule::fill(const TrackerTopology *pTT,
0469                                       const LocalTrajectoryParameters &ltp,
0470                                       bool isHitValid,
0471                                       bool modon,
0472                                       bool ladon,
0473                                       bool layon,
0474                                       bool phion,
0475                                       bool bladeon,
0476                                       bool diskon,
0477                                       bool ringon) {
0478   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
0479   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
0480 
0481   LocalVector localDir = ltp.momentum() / ltp.momentum().mag();
0482   float prediction_alpha = atan2(localDir.z(), localDir.x());
0483   float prediction_beta = atan2(localDir.z(), localDir.y());
0484   float prediction_x = ltp.position().x();
0485   float prediction_y = ltp.position().y();
0486 
0487   PixelBarrelName PBN = PixelBarrelName(DetId(id_), pTT);
0488   int imod = PBN.moduleName();
0489   PixelEndcapName PEN = PixelEndcapName(DetId(id_), pTT);
0490   int ipan = PEN.pannelName();
0491 
0492   if (isHitValid) {
0493     if (modon) {
0494       meValid_->Fill(0.5);
0495     }
0496     if (barrel && ladon) {
0497       meValidLad_->Fill(0.5);
0498       meValidXLad_->Fill(prediction_x);
0499       meValidYLad_->Fill(prediction_y);
0500       meValidModLad_->Fill(imod);
0501       meValidAlphaLad_->Fill(prediction_alpha);
0502       meValidBetaLad_->Fill(prediction_beta);
0503     }
0504     if (barrel && layon) {
0505       meValidLay_->Fill(0.5);
0506       meValidXLay_->Fill(prediction_x);
0507       meValidYLay_->Fill(prediction_y);
0508       meValidAlphaLay_->Fill(prediction_alpha);
0509       meValidBetaLay_->Fill(prediction_beta);
0510     }
0511     if (barrel && phion) {
0512       meValidPhi_->Fill(0.5);
0513       meValidXPhi_->Fill(prediction_x);
0514       meValidYPhi_->Fill(prediction_y);
0515       meValidAlphaPhi_->Fill(prediction_alpha);
0516       meValidBetaPhi_->Fill(prediction_beta);
0517     }
0518     if (endcap && bladeon) {
0519       meValidBlade_->Fill(ipan);
0520       meValidXBlade_->Fill(prediction_x);
0521       meValidYBlade_->Fill(prediction_y);
0522       meValidAlphaBlade_->Fill(prediction_alpha);
0523       meValidBetaBlade_->Fill(prediction_beta);
0524     }
0525     if (endcap && diskon) {
0526       meValidDisk_->Fill(0.5);
0527       meValidXDisk_->Fill(prediction_x);
0528       meValidYDisk_->Fill(prediction_y);
0529       meValidAlphaDisk_->Fill(prediction_alpha);
0530       meValidBetaDisk_->Fill(prediction_beta);
0531     }
0532     if (endcap && ringon) {
0533       meValidRing_->Fill(0.5);
0534       meValidXRing_->Fill(prediction_x);
0535       meValidYRing_->Fill(prediction_y);
0536       meValidAlphaRing_->Fill(prediction_alpha);
0537       meValidBetaRing_->Fill(prediction_beta);
0538     }
0539   } else {
0540     if (modon) {
0541       meMissing_->Fill(0.5);
0542     }
0543     if (barrel && ladon) {
0544       meMissingLad_->Fill(0.5);
0545       meMissingXLad_->Fill(prediction_x);
0546       meMissingYLad_->Fill(prediction_y);
0547       meMissingModLad_->Fill(imod);
0548       meMissingAlphaLad_->Fill(prediction_alpha);
0549       meMissingBetaLad_->Fill(prediction_beta);
0550     }
0551     if (barrel && layon) {
0552       meMissingLay_->Fill(0.5);
0553       meMissingXLay_->Fill(prediction_x);
0554       meMissingYLay_->Fill(prediction_y);
0555       meMissingAlphaLay_->Fill(prediction_alpha);
0556       meMissingBetaLay_->Fill(prediction_beta);
0557     }
0558     if (barrel && phion) {
0559       meMissingPhi_->Fill(0.5);
0560       meMissingXPhi_->Fill(prediction_x);
0561       meMissingYPhi_->Fill(prediction_y);
0562       meMissingAlphaPhi_->Fill(prediction_alpha);
0563       meMissingBetaPhi_->Fill(prediction_beta);
0564     }
0565     if (endcap && bladeon) {
0566       meMissingBlade_->Fill(ipan);
0567       meMissingXBlade_->Fill(prediction_x);
0568       meMissingYBlade_->Fill(prediction_y);
0569       meMissingAlphaBlade_->Fill(prediction_alpha);
0570       meMissingBetaBlade_->Fill(prediction_beta);
0571     }
0572     if (endcap && diskon) {
0573       meMissingDisk_->Fill(0.5);
0574       meMissingXDisk_->Fill(prediction_x);
0575       meMissingYDisk_->Fill(prediction_y);
0576       meMissingAlphaDisk_->Fill(prediction_alpha);
0577       meMissingBetaDisk_->Fill(prediction_beta);
0578     }
0579     if (endcap && ringon) {
0580       meMissingRing_->Fill(0.5);
0581       meMissingXRing_->Fill(prediction_x);
0582       meMissingYRing_->Fill(prediction_y);
0583       meMissingAlphaRing_->Fill(prediction_alpha);
0584       meMissingBetaRing_->Fill(prediction_beta);
0585     }
0586   }
0587 
0588   if (updateEfficiencies)
0589     computeEfficiencies(modon, ladon, layon, phion, bladeon, diskon, ringon);
0590 }
0591 
0592 void SiPixelHitEfficiencyModule::computeEfficiencies(
0593     bool modon, bool ladon, bool layon, bool phion, bool bladeon, bool diskon, bool ringon) {
0594   if (debug_)
0595     std::cout << "Now Filling histos for detid " << id_ << std::endl;
0596 
0597   bool barrel = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelBarrel);
0598   bool endcap = DetId(id_).subdetId() == static_cast<int>(PixelSubdetector::PixelEndcap);
0599 
0600   if (modon) {
0601     meEfficiency_->setBinContent(1, (eff(meValid_->getBinContent(1), meMissing_->getBinContent(1))).first);
0602     meEfficiency_->setBinError(1, (eff(meValid_->getBinContent(1), meMissing_->getBinContent(1))).second);
0603   }
0604   if (ladon && barrel) {
0605     meEfficiencyLad_->setBinContent(1, (eff(meValidLad_->getBinContent(1), meMissingLad_->getBinContent(1))).first);
0606     meEfficiencyLad_->setBinError(1, (eff(meValidLad_->getBinContent(1), meMissingLad_->getBinContent(1))).second);
0607     for (int i = 1; i <= meValidXLad_->getNbinsX(); ++i) {
0608       meEfficiencyXLad_->setBinContent(i,
0609                                        (eff(meValidXLad_->getBinContent(i), meMissingXLad_->getBinContent(i))).first);
0610       meEfficiencyXLad_->setBinError(i, (eff(meValidXLad_->getBinContent(i), meMissingXLad_->getBinContent(i))).second);
0611     }
0612     for (int i = 1; i <= meValidYLad_->getNbinsX(); ++i) {
0613       meEfficiencyYLad_->setBinContent(i,
0614                                        (eff(meValidYLad_->getBinContent(i), meMissingYLad_->getBinContent(i))).first);
0615       meEfficiencyYLad_->setBinError(i, (eff(meValidYLad_->getBinContent(i), meMissingYLad_->getBinContent(i))).second);
0616     }
0617     for (int i = 1; i <= meValidAlphaLad_->getNbinsX(); ++i) {
0618       meEfficiencyAlphaLad_->setBinContent(
0619           i, (eff(meValidAlphaLad_->getBinContent(i), meMissingAlphaLad_->getBinContent(i))).first);
0620       meEfficiencyAlphaLad_->setBinError(
0621           i, (eff(meValidAlphaLad_->getBinContent(i), meMissingAlphaLad_->getBinContent(i))).second);
0622     }
0623     for (int i = 1; i <= meValidBetaLad_->getNbinsX(); ++i) {
0624       meEfficiencyBetaLad_->setBinContent(
0625           i, (eff(meValidBetaLad_->getBinContent(i), meMissingBetaLad_->getBinContent(i))).first);
0626       meEfficiencyBetaLad_->setBinError(
0627           i, (eff(meValidBetaLad_->getBinContent(i), meMissingBetaLad_->getBinContent(i))).second);
0628     }
0629   }
0630 
0631   if (layon && barrel) {
0632     meEfficiencyLay_->setBinContent(1, (eff(meValidLay_->getBinContent(1), meMissingLay_->getBinContent(1))).first);
0633     meEfficiencyLay_->setBinError(1, (eff(meValidLay_->getBinContent(1), meMissingLay_->getBinContent(1))).second);
0634     for (int i = 1; i <= meValidXLay_->getNbinsX(); ++i) {
0635       meEfficiencyXLay_->setBinContent(i,
0636                                        (eff(meValidXLay_->getBinContent(i), meMissingXLay_->getBinContent(i))).first);
0637       meEfficiencyXLay_->setBinError(i, (eff(meValidXLay_->getBinContent(i), meMissingXLay_->getBinContent(i))).second);
0638     }
0639     for (int i = 1; i <= meValidYLay_->getNbinsX(); ++i) {
0640       meEfficiencyYLay_->setBinContent(i,
0641                                        (eff(meValidYLay_->getBinContent(i), meMissingYLay_->getBinContent(i))).first);
0642       meEfficiencyYLay_->setBinError(i, (eff(meValidYLay_->getBinContent(i), meMissingYLay_->getBinContent(i))).second);
0643     }
0644     for (int i = 1; i <= meValidAlphaLay_->getNbinsX(); ++i) {
0645       meEfficiencyAlphaLay_->setBinContent(
0646           i, (eff(meValidAlphaLay_->getBinContent(i), meMissingAlphaLay_->getBinContent(i))).first);
0647       meEfficiencyAlphaLay_->setBinError(
0648           i, (eff(meValidAlphaLay_->getBinContent(i), meMissingAlphaLay_->getBinContent(i))).second);
0649     }
0650     for (int i = 1; i <= meValidBetaLay_->getNbinsX(); ++i) {
0651       meEfficiencyBetaLay_->setBinContent(
0652           i, (eff(meValidBetaLay_->getBinContent(i), meMissingBetaLay_->getBinContent(i))).first);
0653       meEfficiencyBetaLay_->setBinError(
0654           i, (eff(meValidBetaLay_->getBinContent(i), meMissingBetaLay_->getBinContent(i))).second);
0655     }
0656   }
0657 
0658   if (phion && barrel) {
0659     meEfficiencyPhi_->setBinContent(1, (eff(meValidPhi_->getBinContent(1), meMissingPhi_->getBinContent(1))).first);
0660     meEfficiencyPhi_->setBinError(1, (eff(meValidPhi_->getBinContent(1), meMissingPhi_->getBinContent(1))).second);
0661     for (int i = 1; i <= meValidXPhi_->getNbinsX(); ++i) {
0662       meEfficiencyXPhi_->setBinContent(i,
0663                                        (eff(meValidXPhi_->getBinContent(i), meMissingXPhi_->getBinContent(i))).first);
0664       meEfficiencyXPhi_->setBinError(i, (eff(meValidXPhi_->getBinContent(i), meMissingXPhi_->getBinContent(i))).second);
0665     }
0666     for (int i = 1; i <= meValidYPhi_->getNbinsX(); ++i) {
0667       meEfficiencyYPhi_->setBinContent(i,
0668                                        (eff(meValidYPhi_->getBinContent(i), meMissingYPhi_->getBinContent(i))).first);
0669       meEfficiencyYPhi_->setBinError(i, (eff(meValidYPhi_->getBinContent(i), meMissingYPhi_->getBinContent(i))).second);
0670     }
0671     for (int i = 1; i <= meValidAlphaPhi_->getNbinsX(); ++i) {
0672       meEfficiencyAlphaPhi_->setBinContent(
0673           i, (eff(meValidAlphaPhi_->getBinContent(i), meMissingAlphaPhi_->getBinContent(i))).first);
0674       meEfficiencyAlphaPhi_->setBinError(
0675           i, (eff(meValidAlphaPhi_->getBinContent(i), meMissingAlphaPhi_->getBinContent(i))).second);
0676     }
0677     for (int i = 1; i <= meValidBetaPhi_->getNbinsX(); ++i) {
0678       meEfficiencyBetaPhi_->setBinContent(
0679           i, (eff(meValidBetaPhi_->getBinContent(i), meMissingBetaPhi_->getBinContent(i))).first);
0680       meEfficiencyBetaPhi_->setBinError(
0681           i, (eff(meValidBetaPhi_->getBinContent(i), meMissingBetaPhi_->getBinContent(i))).second);
0682     }
0683   }
0684   if (bladeon && endcap) {
0685     meEfficiencyBlade_->setBinContent(1,
0686                                       (eff(meValidBlade_->getBinContent(1), meMissingBlade_->getBinContent(1))).first);
0687     meEfficiencyBlade_->setBinError(1,
0688                                     (eff(meValidBlade_->getBinContent(1), meMissingBlade_->getBinContent(1))).second);
0689     for (int i = 1; i <= meValidXBlade_->getNbinsX(); ++i) {
0690       meEfficiencyXBlade_->setBinContent(
0691           i, (eff(meValidXBlade_->getBinContent(i), meMissingXBlade_->getBinContent(i))).first);
0692       meEfficiencyXBlade_->setBinError(
0693           i, (eff(meValidXBlade_->getBinContent(i), meMissingXBlade_->getBinContent(i))).second);
0694     }
0695     for (int i = 1; i <= meValidYBlade_->getNbinsX(); ++i) {
0696       meEfficiencyYBlade_->setBinContent(
0697           i, (eff(meValidYBlade_->getBinContent(i), meMissingYBlade_->getBinContent(i))).first);
0698       meEfficiencyYBlade_->setBinError(
0699           i, (eff(meValidYBlade_->getBinContent(i), meMissingYBlade_->getBinContent(i))).second);
0700     }
0701     for (int i = 1; i <= meValidAlphaBlade_->getNbinsX(); ++i) {
0702       meEfficiencyAlphaBlade_->setBinContent(
0703           i, (eff(meValidAlphaBlade_->getBinContent(i), meMissingAlphaBlade_->getBinContent(i))).first);
0704       meEfficiencyAlphaBlade_->setBinError(
0705           i, (eff(meValidAlphaBlade_->getBinContent(i), meMissingAlphaBlade_->getBinContent(i))).second);
0706     }
0707     for (int i = 1; i <= meValidBetaBlade_->getNbinsX(); ++i) {
0708       meEfficiencyBetaBlade_->setBinContent(
0709           i, (eff(meValidBetaBlade_->getBinContent(i), meMissingBetaBlade_->getBinContent(i))).first);
0710       meEfficiencyBetaBlade_->setBinError(
0711           i, (eff(meValidBetaBlade_->getBinContent(i), meMissingBetaBlade_->getBinContent(i))).second);
0712     }
0713   }
0714   if (diskon && endcap) {
0715     meEfficiencyDisk_->setBinContent(1, (eff(meValidDisk_->getBinContent(1), meMissingDisk_->getBinContent(1))).first);
0716     meEfficiencyDisk_->setBinError(1, (eff(meValidDisk_->getBinContent(1), meMissingDisk_->getBinContent(1))).second);
0717     for (int i = 1; i <= meValidXDisk_->getNbinsX(); ++i) {
0718       meEfficiencyXDisk_->setBinContent(
0719           i, (eff(meValidXDisk_->getBinContent(i), meMissingXDisk_->getBinContent(i))).first);
0720       meEfficiencyXDisk_->setBinError(i,
0721                                       (eff(meValidXDisk_->getBinContent(i), meMissingXDisk_->getBinContent(i))).second);
0722     }
0723     for (int i = 1; i <= meValidYDisk_->getNbinsX(); ++i) {
0724       meEfficiencyYDisk_->setBinContent(
0725           i, (eff(meValidYDisk_->getBinContent(i), meMissingYDisk_->getBinContent(i))).first);
0726       meEfficiencyYDisk_->setBinError(i,
0727                                       (eff(meValidYDisk_->getBinContent(i), meMissingYDisk_->getBinContent(i))).second);
0728     }
0729     for (int i = 1; i <= meValidAlphaDisk_->getNbinsX(); ++i) {
0730       meEfficiencyAlphaDisk_->setBinContent(
0731           i, (eff(meValidAlphaDisk_->getBinContent(i), meMissingAlphaDisk_->getBinContent(i))).first);
0732       meEfficiencyAlphaDisk_->setBinError(
0733           i, (eff(meValidAlphaDisk_->getBinContent(i), meMissingAlphaDisk_->getBinContent(i))).second);
0734     }
0735     for (int i = 1; i <= meValidBetaDisk_->getNbinsX(); ++i) {
0736       meEfficiencyBetaDisk_->setBinContent(
0737           i, (eff(meValidBetaDisk_->getBinContent(i), meMissingBetaDisk_->getBinContent(i))).first);
0738       meEfficiencyBetaDisk_->setBinError(
0739           i, (eff(meValidBetaDisk_->getBinContent(i), meMissingBetaDisk_->getBinContent(i))).second);
0740     }
0741   }
0742   if (ringon && endcap) {
0743     meEfficiencyRing_->setBinContent(1, (eff(meValidRing_->getBinContent(1), meMissingRing_->getBinContent(1))).first);
0744     meEfficiencyRing_->setBinError(1, (eff(meValidRing_->getBinContent(1), meMissingRing_->getBinContent(1))).second);
0745     for (int i = 1; i <= meValidXRing_->getNbinsX(); ++i) {
0746       meEfficiencyXRing_->setBinContent(
0747           i, (eff(meValidXRing_->getBinContent(i), meMissingXRing_->getBinContent(i))).first);
0748       meEfficiencyXRing_->setBinError(i,
0749                                       (eff(meValidXRing_->getBinContent(i), meMissingXRing_->getBinContent(i))).second);
0750     }
0751     for (int i = 1; i <= meValidYRing_->getNbinsX(); ++i) {
0752       meEfficiencyYRing_->setBinContent(
0753           i, (eff(meValidYRing_->getBinContent(i), meMissingYRing_->getBinContent(i))).first);
0754       meEfficiencyYRing_->setBinError(i,
0755                                       (eff(meValidYRing_->getBinContent(i), meMissingYRing_->getBinContent(i))).second);
0756     }
0757     for (int i = 1; i <= meValidAlphaRing_->getNbinsX(); ++i) {
0758       meEfficiencyAlphaRing_->setBinContent(
0759           i, (eff(meValidAlphaRing_->getBinContent(i), meMissingAlphaRing_->getBinContent(i))).first);
0760       meEfficiencyAlphaRing_->setBinError(
0761           i, (eff(meValidAlphaRing_->getBinContent(i), meMissingAlphaRing_->getBinContent(i))).second);
0762     }
0763     for (int i = 1; i <= meValidBetaRing_->getNbinsX(); ++i) {
0764       meEfficiencyBetaRing_->setBinContent(
0765           i, (eff(meValidBetaRing_->getBinContent(i), meMissingBetaRing_->getBinContent(i))).first);
0766       meEfficiencyBetaRing_->setBinError(
0767           i, (eff(meValidBetaRing_->getBinContent(i), meMissingBetaRing_->getBinContent(i))).second);
0768     }
0769   }
0770 }
0771 
0772 std::pair<double, double> SiPixelHitEfficiencyModule::eff(double nValid, double nMissing) {
0773   double efficiency = 0, error = 0;
0774   if (nValid + nMissing != 0) {
0775     efficiency = nValid / (nValid + nMissing);
0776     error = sqrt(efficiency * (1. - efficiency) / (nValid + nMissing));
0777   }
0778   return make_pair(efficiency, error);
0779 }