Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 23:29:41

0001 #include "CalibTracker/SiStripQuality/interface/SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy.h"
0002 
0003 #include "FWCore/ServiceRegistry/interface/Service.h"
0004 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0005 #include "DataFormats/DetId/interface/DetId.h"
0006 #include "DataFormats/TrackerCommon/interface/TrackerTopology.h"
0007 #include "DataFormats/SiStripDetId/interface/StripSubdetector.h"
0008 #include "Geometry/TrackerGeometryBuilder/interface/StripGeomDetUnit.h"
0009 #include "Geometry/CommonTopologies/interface/StripTopology.h"
0010 #include "CalibFormats/SiStripObjects/interface/SiStripQuality.h"
0011 
0012 SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy(
0013     const edm::ParameterSet& iConfig, const TrackerTopology* theTopo)
0014     : ratio_(1.5),
0015       lowoccupancy_(0),
0016       highoccupancy_(100),
0017       absolutelow_(0),
0018       numberiterations_(2),
0019       Nevents_(0),
0020       absolute_occupancy_(0),
0021       OutFileName_("Occupancy.root"),
0022       DQMOutfileName_("DQMOutput"),
0023       UseInputDB_(iConfig.getUntrackedParameter<bool>("UseInputDB", false)),
0024       tTopo(theTopo) {
0025   minNevents_ = Nevents_ * absolute_occupancy_;
0026 }
0027 
0028 SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::~SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy() {
0029   LogTrace("SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy")
0030       << "[SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::~"
0031          "SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy] "
0032       << std::endl;
0033 }
0034 
0035 void SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVSandStrips(
0036     SiStripQuality* siStripQuality, HistoMap& DM, const SiStripQuality* inSiStripQuality) {
0037   LogTrace("SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy")
0038       << "[SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::extractBadAPVs] " << std::endl;
0039 
0040   if (WriteOutputFile_ == true) {
0041     f = new TFile(OutFileName_.c_str(), "RECREATE");
0042     f->cd();
0043 
0044     apvtree = new TTree("moduleOccupancy", "tree");
0045 
0046     apvtree->Branch("DetRawId", &detrawid, "DetRawId/I");
0047     apvtree->Branch("SubDetId", &subdetid, "SubDetId/I");
0048     apvtree->Branch("Layer_Ring", &layer_ring, "Layer_Ring/I");
0049     apvtree->Branch("Disc", &disc, "Disc/I");
0050     apvtree->Branch("IsBack", &isback, "IsBack/I");
0051     apvtree->Branch("IsExternalString", &isexternalstring, "IsExternalString/I");
0052     apvtree->Branch("IsZMinusSide", &iszminusside, "IsZMinusSide/I");
0053     apvtree->Branch("RodStringPetal", &rodstringpetal, "RodStringPetal/I");
0054     apvtree->Branch("IsStereo", &isstereo, "IsStereo/I");
0055     apvtree->Branch("ModuleNumber", &module_number, "ModuleNumber/I");
0056     apvtree->Branch("NumberOfStrips", &number_strips, "NumberOfStrips/I");
0057     apvtree->Branch("APVGlobalPositionX", &global_position_x, "APVGlobalPositionX/F");
0058     apvtree->Branch("APVGlobalPositionY", &global_position_y, "APVGlobalPositionY/F");
0059     apvtree->Branch("APVGlobalPositionZ", &global_position_z, "APVGlobalPositionZ/F");
0060     apvtree->Branch("APVNumber", &apv_number, "APVNumber/I");
0061     apvtree->Branch("APVAbsoluteOccupancy", &apvAbsoluteOccupancy, "apvAbsoluteOccupancy/I");
0062     apvtree->Branch("APVMedianOccupancy", &apvMedianOccupancy, "apvMedianOccupancy/D");
0063     apvtree->Branch("IsBad", &isBad, "IsBad/I");
0064 
0065     striptree = new TTree("stripOccupancy", "tree");
0066 
0067     striptree->Branch("DetRawId", &detrawid, "DetRawId/I");
0068     striptree->Branch("SubDetId", &subdetid, "SubDetId/I");
0069     striptree->Branch("Layer_Ring", &layer_ring, "Layer_Ring/I");
0070     striptree->Branch("Disc", &disc, "Disc/I");
0071     striptree->Branch("IsBack", &isback, "IsBack/I");
0072     striptree->Branch("IsExternalString", &isexternalstring, "IsExternalString/I");
0073     striptree->Branch("IsZMinusSide", &iszminusside, "IsZMinusSide/I");
0074     striptree->Branch("RodStringPetal", &rodstringpetal, "RodStringPetal/I");
0075     striptree->Branch("IsStereo", &isstereo, "IsStereo/I");
0076     striptree->Branch("ModulePosition", &module_number, "ModulePosition/I");
0077     striptree->Branch("NumberOfStrips", &number_strips, "NumberOfStrips/I");
0078     striptree->Branch("StripNumber", &strip_number, "StripNumber/I");
0079     striptree->Branch("APVChannel", &apv_channel, "APVChannel/I");
0080     striptree->Branch("StripGlobalPositionX", &strip_global_position_x, "StripGlobalPositionX/F");
0081     striptree->Branch("StripGlobalPositionY", &strip_global_position_y, "StripGlobalPositionY/F");
0082     striptree->Branch("StripGlobalPositionZ", &strip_global_position_z, "StripGlobalPositionZ/F");
0083     striptree->Branch("IsHot", &isHot, "IsHot/I");
0084     striptree->Branch("HotStripsPerAPV", &hotStripsPerAPV, "HotStripsPerAPV/I");
0085     striptree->Branch("HotStripsPerModule", &hotStripsPerModule, "HotStripsPerModule/I");
0086     striptree->Branch("StripOccupancy", &singleStripOccupancy, "StripOccupancy/D");
0087     striptree->Branch("StripHits", &stripHits, "StripHits/I");
0088     striptree->Branch("PoissonProb", &poissonProb, "PoissonProb/D");
0089     striptree->Branch("MedianAPVHits", &medianAPVHits, "MedianAPVHits/D");
0090     striptree->Branch("AvgAPVHits", &avgAPVHits, "AvgAPVHits/D");
0091   }
0092 
0093   HistoMap::iterator it = DM.begin();
0094   HistoMap::iterator itEnd = DM.end();
0095   std::vector<unsigned int> badStripList;
0096   uint32_t detid;
0097   for (; it != itEnd; ++it) {
0098     Apv APV;
0099 
0100     for (int apv = 0; apv < 6; apv++) {
0101       APV.apvMedian[apv] = 0;
0102       APV.apvabsoluteOccupancy[apv] = 0;
0103       APV.NEntries[apv] = 0;
0104       APV.NEmptyBins[apv] = 0;
0105 
0106       for (int strip = 0; strip < 128; strip++) {
0107         stripOccupancy[apv][strip] = 0;
0108         stripWeight[apv][strip] = 0;
0109       }
0110     }
0111 
0112     number_strips = (int)((it->second.get())->GetNbinsX());
0113     number_apvs = number_strips / 128;
0114     APV.numberApvs = number_apvs;
0115 
0116     for (int apv = 0; apv < number_apvs; apv++) {
0117       APV.th1f[apv] = new TH1F("tmp", "tmp", 128, 0.5, 128.5);
0118       int NumberEntriesPerAPV = 0;
0119 
0120       for (int strip = 0; strip < 128; strip++) {
0121         stripOccupancy[apv][strip] =
0122             (it->second.get())->GetBinContent((apv * 128) + strip + 1);  // Remember: Bin=0 is underflow bin!
0123         stripWeight[apv][strip] = 1;
0124         APV.apvabsoluteOccupancy[apv] +=
0125             (it->second.get())->GetBinContent((apv * 128) + strip + 1);  // Remember: Bin=0 is underflow bin!
0126         APV.th1f[apv]->SetBinContent(strip + 1, (it->second.get())->GetBinContent((apv * 128) + strip + 1));
0127         NumberEntriesPerAPV += (int)(it->second.get())->GetBinContent((apv * 128) + strip + 1);
0128       }
0129 
0130       APV.th1f[apv]->SetEntries(NumberEntriesPerAPV);
0131       APV.NEntries[apv] = (int)APV.th1f[apv]->GetEntries();
0132     }
0133 
0134     for (int apv = 0; apv < number_apvs; apv++) {
0135       APV.apvMedian[apv] = TMath::Median(128, stripOccupancy[apv], stripWeight[apv]);
0136     }
0137 
0138     detid = it->first;
0139     DetId detectorId = DetId(detid);
0140 
0141     if (edm::isDebugEnabled())
0142       LogTrace("SiStripBadAPV") << "Analyzing detid " << detid << std::endl;
0143 
0144     detrawid = detid;
0145     APV.detrawId = detrawid;
0146     subdetid = detectorId.subdetId();
0147 
0148     switch (detectorId.subdetId()) {
0149       case StripSubdetector::TIB:
0150         layer_ring = tTopo->tibLayer(detrawid);
0151         module_number = tTopo->tibModule(detrawid);
0152         APV.modulePosition = module_number;
0153 
0154         if (layer_ring == 1)
0155           medianValues_TIB_Layer1.push_back(APV);
0156         else if (layer_ring == 2)
0157           medianValues_TIB_Layer2.push_back(APV);
0158         else if (layer_ring == 3)
0159           medianValues_TIB_Layer3.push_back(APV);
0160         else if (layer_ring == 4)
0161           medianValues_TIB_Layer4.push_back(APV);
0162         break;
0163 
0164       case StripSubdetector::TID:
0165         layer_ring = tTopo->tidRing(detrawid);
0166         disc = tTopo->tidWheel(detrawid);
0167         APV.modulePosition = layer_ring;
0168 
0169         if (tTopo->tidIsZMinusSide(detrawid))
0170           iszminusside = 1;
0171         else
0172           iszminusside = 0;
0173 
0174         if (iszminusside == 0) {
0175           if (disc == 1)
0176             medianValues_TIDPlus_Disc1.push_back(APV);
0177           else if (disc == 2)
0178             medianValues_TIDPlus_Disc2.push_back(APV);
0179           else if (disc == 3)
0180             medianValues_TIDPlus_Disc3.push_back(APV);
0181         } else if (iszminusside == 1) {
0182           if (disc == 1)
0183             medianValues_TIDMinus_Disc1.push_back(APV);
0184           else if (disc == 2)
0185             medianValues_TIDMinus_Disc2.push_back(APV);
0186           else if (disc == 3)
0187             medianValues_TIDMinus_Disc3.push_back(APV);
0188         }
0189         break;
0190 
0191       case StripSubdetector::TOB:
0192         layer_ring = tTopo->tobLayer(detrawid);
0193         module_number = tTopo->tobModule(detrawid);
0194         APV.modulePosition = module_number;
0195 
0196         if (layer_ring == 1)
0197           medianValues_TOB_Layer1.push_back(APV);
0198         else if (layer_ring == 2)
0199           medianValues_TOB_Layer2.push_back(APV);
0200         else if (layer_ring == 3)
0201           medianValues_TOB_Layer3.push_back(APV);
0202         else if (layer_ring == 4)
0203           medianValues_TOB_Layer4.push_back(APV);
0204         else if (layer_ring == 5)
0205           medianValues_TOB_Layer5.push_back(APV);
0206         else if (layer_ring == 6)
0207           medianValues_TOB_Layer6.push_back(APV);
0208         break;
0209 
0210       case StripSubdetector::TEC:
0211         layer_ring = tTopo->tecRing(detrawid);
0212         disc = tTopo->tecWheel(detrawid);
0213         APV.modulePosition = layer_ring;
0214 
0215         if (tTopo->tecIsZMinusSide(detrawid))
0216           iszminusside = 1;
0217         else
0218           iszminusside = 0;
0219 
0220         if (iszminusside == 0) {
0221           if (disc == 1)
0222             medianValues_TECPlus_Disc1.push_back(APV);
0223           else if (disc == 2)
0224             medianValues_TECPlus_Disc2.push_back(APV);
0225           else if (disc == 3)
0226             medianValues_TECPlus_Disc3.push_back(APV);
0227           else if (disc == 4)
0228             medianValues_TECPlus_Disc4.push_back(APV);
0229           else if (disc == 5)
0230             medianValues_TECPlus_Disc5.push_back(APV);
0231           else if (disc == 6)
0232             medianValues_TECPlus_Disc6.push_back(APV);
0233           else if (disc == 7)
0234             medianValues_TECPlus_Disc7.push_back(APV);
0235           else if (disc == 8)
0236             medianValues_TECPlus_Disc8.push_back(APV);
0237           else if (disc == 9)
0238             medianValues_TECPlus_Disc9.push_back(APV);
0239         } else if (iszminusside == 1) {
0240           if (disc == 1)
0241             medianValues_TECMinus_Disc1.push_back(APV);
0242           else if (disc == 2)
0243             medianValues_TECMinus_Disc2.push_back(APV);
0244           else if (disc == 3)
0245             medianValues_TECMinus_Disc3.push_back(APV);
0246           else if (disc == 4)
0247             medianValues_TECMinus_Disc4.push_back(APV);
0248           else if (disc == 5)
0249             medianValues_TECMinus_Disc5.push_back(APV);
0250           else if (disc == 6)
0251             medianValues_TECMinus_Disc6.push_back(APV);
0252           else if (disc == 7)
0253             medianValues_TECMinus_Disc7.push_back(APV);
0254           else if (disc == 8)
0255             medianValues_TECMinus_Disc8.push_back(APV);
0256           else if (disc == 9)
0257             medianValues_TECMinus_Disc9.push_back(APV);
0258         }
0259         break;
0260 
0261       default:
0262         std::cout << "### Detector does not belong to TIB, TID, TOB or TEC !? ###" << std::endl;
0263         std::cout << "### DetRawId: " << detrawid << " ###" << std::endl;
0264     }
0265 
0266   }  // end loop on modules
0267 
0268   // Calculate Mean and RMS for each Layer
0269   CalculateMeanAndRMS(medianValues_TIB_Layer1, MeanAndRms_TIB_Layer1, numberiterations_);
0270   CalculateMeanAndRMS(medianValues_TIB_Layer2, MeanAndRms_TIB_Layer2, numberiterations_);
0271   CalculateMeanAndRMS(medianValues_TIB_Layer3, MeanAndRms_TIB_Layer3, numberiterations_);
0272   CalculateMeanAndRMS(medianValues_TIB_Layer4, MeanAndRms_TIB_Layer4, numberiterations_);
0273 
0274   CalculateMeanAndRMS(medianValues_TOB_Layer1, MeanAndRms_TOB_Layer1, numberiterations_);
0275   CalculateMeanAndRMS(medianValues_TOB_Layer2, MeanAndRms_TOB_Layer2, numberiterations_);
0276   CalculateMeanAndRMS(medianValues_TOB_Layer3, MeanAndRms_TOB_Layer3, numberiterations_);
0277   CalculateMeanAndRMS(medianValues_TOB_Layer4, MeanAndRms_TOB_Layer4, numberiterations_);
0278   CalculateMeanAndRMS(medianValues_TOB_Layer5, MeanAndRms_TOB_Layer5, numberiterations_);
0279   CalculateMeanAndRMS(medianValues_TOB_Layer6, MeanAndRms_TOB_Layer6, numberiterations_);
0280 
0281   CalculateMeanAndRMS(medianValues_TIDPlus_Disc1, MeanAndRms_TIDPlus_Disc1, numberiterations_);
0282   CalculateMeanAndRMS(medianValues_TIDPlus_Disc2, MeanAndRms_TIDPlus_Disc2, numberiterations_);
0283   CalculateMeanAndRMS(medianValues_TIDPlus_Disc3, MeanAndRms_TIDPlus_Disc3, numberiterations_);
0284   CalculateMeanAndRMS(medianValues_TIDMinus_Disc1, MeanAndRms_TIDMinus_Disc1, numberiterations_);
0285   CalculateMeanAndRMS(medianValues_TIDMinus_Disc2, MeanAndRms_TIDMinus_Disc2, numberiterations_);
0286   CalculateMeanAndRMS(medianValues_TIDMinus_Disc3, MeanAndRms_TIDMinus_Disc3, numberiterations_);
0287 
0288   CalculateMeanAndRMS(medianValues_TECPlus_Disc1, MeanAndRms_TECPlus_Disc1, numberiterations_);
0289   CalculateMeanAndRMS(medianValues_TECPlus_Disc2, MeanAndRms_TECPlus_Disc2, numberiterations_);
0290   CalculateMeanAndRMS(medianValues_TECPlus_Disc3, MeanAndRms_TECPlus_Disc3, numberiterations_);
0291   CalculateMeanAndRMS(medianValues_TECPlus_Disc4, MeanAndRms_TECPlus_Disc4, numberiterations_);
0292   CalculateMeanAndRMS(medianValues_TECPlus_Disc5, MeanAndRms_TECPlus_Disc5, numberiterations_);
0293   CalculateMeanAndRMS(medianValues_TECPlus_Disc6, MeanAndRms_TECPlus_Disc6, numberiterations_);
0294   CalculateMeanAndRMS(medianValues_TECPlus_Disc7, MeanAndRms_TECPlus_Disc7, numberiterations_);
0295   CalculateMeanAndRMS(medianValues_TECPlus_Disc8, MeanAndRms_TECPlus_Disc8, numberiterations_);
0296   CalculateMeanAndRMS(medianValues_TECPlus_Disc9, MeanAndRms_TECPlus_Disc9, numberiterations_);
0297 
0298   CalculateMeanAndRMS(medianValues_TECMinus_Disc1, MeanAndRms_TECMinus_Disc1, numberiterations_);
0299   CalculateMeanAndRMS(medianValues_TECMinus_Disc2, MeanAndRms_TECMinus_Disc2, numberiterations_);
0300   CalculateMeanAndRMS(medianValues_TECMinus_Disc3, MeanAndRms_TECMinus_Disc3, numberiterations_);
0301   CalculateMeanAndRMS(medianValues_TECMinus_Disc4, MeanAndRms_TECMinus_Disc4, numberiterations_);
0302   CalculateMeanAndRMS(medianValues_TECMinus_Disc5, MeanAndRms_TECMinus_Disc5, numberiterations_);
0303   CalculateMeanAndRMS(medianValues_TECMinus_Disc6, MeanAndRms_TECMinus_Disc6, numberiterations_);
0304   CalculateMeanAndRMS(medianValues_TECMinus_Disc7, MeanAndRms_TECMinus_Disc7, numberiterations_);
0305   CalculateMeanAndRMS(medianValues_TECMinus_Disc8, MeanAndRms_TECMinus_Disc8, numberiterations_);
0306   CalculateMeanAndRMS(medianValues_TECMinus_Disc9, MeanAndRms_TECMinus_Disc9, numberiterations_);
0307 
0308   pQuality = siStripQuality;
0309   badStripList.clear();
0310 
0311   // Initialize the DQM output histograms
0312   initializeDQMHistograms();
0313 
0314   // Analyze the Occupancy for both APVs and Strips
0315   AnalyzeOccupancy(siStripQuality, medianValues_TIB_Layer1, MeanAndRms_TIB_Layer1, badStripList, inSiStripQuality);
0316   AnalyzeOccupancy(siStripQuality, medianValues_TIB_Layer2, MeanAndRms_TIB_Layer2, badStripList, inSiStripQuality);
0317   AnalyzeOccupancy(siStripQuality, medianValues_TIB_Layer3, MeanAndRms_TIB_Layer3, badStripList, inSiStripQuality);
0318   AnalyzeOccupancy(siStripQuality, medianValues_TIB_Layer4, MeanAndRms_TIB_Layer4, badStripList, inSiStripQuality);
0319 
0320   AnalyzeOccupancy(siStripQuality, medianValues_TOB_Layer1, MeanAndRms_TOB_Layer1, badStripList, inSiStripQuality);
0321   AnalyzeOccupancy(siStripQuality, medianValues_TOB_Layer2, MeanAndRms_TOB_Layer2, badStripList, inSiStripQuality);
0322   AnalyzeOccupancy(siStripQuality, medianValues_TOB_Layer3, MeanAndRms_TOB_Layer3, badStripList, inSiStripQuality);
0323   AnalyzeOccupancy(siStripQuality, medianValues_TOB_Layer4, MeanAndRms_TOB_Layer4, badStripList, inSiStripQuality);
0324   AnalyzeOccupancy(siStripQuality, medianValues_TOB_Layer5, MeanAndRms_TOB_Layer5, badStripList, inSiStripQuality);
0325   AnalyzeOccupancy(siStripQuality, medianValues_TOB_Layer6, MeanAndRms_TOB_Layer6, badStripList, inSiStripQuality);
0326 
0327   AnalyzeOccupancy(
0328       siStripQuality, medianValues_TIDPlus_Disc1, MeanAndRms_TIDPlus_Disc1, badStripList, inSiStripQuality);
0329   AnalyzeOccupancy(
0330       siStripQuality, medianValues_TIDPlus_Disc2, MeanAndRms_TIDPlus_Disc2, badStripList, inSiStripQuality);
0331   AnalyzeOccupancy(
0332       siStripQuality, medianValues_TIDPlus_Disc3, MeanAndRms_TIDPlus_Disc3, badStripList, inSiStripQuality);
0333   AnalyzeOccupancy(
0334       siStripQuality, medianValues_TIDMinus_Disc1, MeanAndRms_TIDMinus_Disc1, badStripList, inSiStripQuality);
0335   AnalyzeOccupancy(
0336       siStripQuality, medianValues_TIDMinus_Disc2, MeanAndRms_TIDMinus_Disc2, badStripList, inSiStripQuality);
0337   AnalyzeOccupancy(
0338       siStripQuality, medianValues_TIDMinus_Disc3, MeanAndRms_TIDMinus_Disc3, badStripList, inSiStripQuality);
0339 
0340   AnalyzeOccupancy(
0341       siStripQuality, medianValues_TECPlus_Disc1, MeanAndRms_TECPlus_Disc1, badStripList, inSiStripQuality);
0342   AnalyzeOccupancy(
0343       siStripQuality, medianValues_TECPlus_Disc2, MeanAndRms_TECPlus_Disc2, badStripList, inSiStripQuality);
0344   AnalyzeOccupancy(
0345       siStripQuality, medianValues_TECPlus_Disc3, MeanAndRms_TECPlus_Disc3, badStripList, inSiStripQuality);
0346   AnalyzeOccupancy(
0347       siStripQuality, medianValues_TECPlus_Disc4, MeanAndRms_TECPlus_Disc4, badStripList, inSiStripQuality);
0348   AnalyzeOccupancy(
0349       siStripQuality, medianValues_TECPlus_Disc5, MeanAndRms_TECPlus_Disc5, badStripList, inSiStripQuality);
0350   AnalyzeOccupancy(
0351       siStripQuality, medianValues_TECPlus_Disc6, MeanAndRms_TECPlus_Disc6, badStripList, inSiStripQuality);
0352   AnalyzeOccupancy(
0353       siStripQuality, medianValues_TECPlus_Disc7, MeanAndRms_TECPlus_Disc7, badStripList, inSiStripQuality);
0354   AnalyzeOccupancy(
0355       siStripQuality, medianValues_TECPlus_Disc8, MeanAndRms_TECPlus_Disc8, badStripList, inSiStripQuality);
0356   AnalyzeOccupancy(
0357       siStripQuality, medianValues_TECPlus_Disc9, MeanAndRms_TECPlus_Disc9, badStripList, inSiStripQuality);
0358 
0359   AnalyzeOccupancy(
0360       siStripQuality, medianValues_TECMinus_Disc1, MeanAndRms_TECMinus_Disc1, badStripList, inSiStripQuality);
0361   AnalyzeOccupancy(
0362       siStripQuality, medianValues_TECMinus_Disc2, MeanAndRms_TECMinus_Disc2, badStripList, inSiStripQuality);
0363   AnalyzeOccupancy(
0364       siStripQuality, medianValues_TECMinus_Disc3, MeanAndRms_TECMinus_Disc3, badStripList, inSiStripQuality);
0365   AnalyzeOccupancy(
0366       siStripQuality, medianValues_TECMinus_Disc4, MeanAndRms_TECMinus_Disc4, badStripList, inSiStripQuality);
0367   AnalyzeOccupancy(
0368       siStripQuality, medianValues_TECMinus_Disc5, MeanAndRms_TECMinus_Disc5, badStripList, inSiStripQuality);
0369   AnalyzeOccupancy(
0370       siStripQuality, medianValues_TECMinus_Disc6, MeanAndRms_TECMinus_Disc6, badStripList, inSiStripQuality);
0371   AnalyzeOccupancy(
0372       siStripQuality, medianValues_TECMinus_Disc7, MeanAndRms_TECMinus_Disc7, badStripList, inSiStripQuality);
0373   AnalyzeOccupancy(
0374       siStripQuality, medianValues_TECMinus_Disc8, MeanAndRms_TECMinus_Disc8, badStripList, inSiStripQuality);
0375   AnalyzeOccupancy(
0376       siStripQuality, medianValues_TECMinus_Disc9, MeanAndRms_TECMinus_Disc9, badStripList, inSiStripQuality);
0377 
0378   siStripQuality->fillBadComponents();
0379 
0380   // Fill DQM histograms
0381   for (unsigned int i = 0; i < subDetName.size(); i++) {
0382     projYDistanceVsStripNumber[i]->Add((TH1F*)distanceVsStripNumber[i]->ProjectionY());
0383     pfxDistanceVsStripNumber[i]->Add(
0384         distanceVsStripNumber[i]->ProfileX(pfxDistanceVsStripNumber[i]->GetName(), 1, 998));
0385     projYNHitsVsStripNumber[i]->Add(nHitsVsStripNumber[i]->ProjectionY());
0386     projYNHitsGoodStripsVsStripNumber[i]->Add(nHitsGoodStripsVsStripNumber[i]->ProjectionY());
0387     projYNHitsHotStripsVsStripNumber[i]->Add(nHitsHotStripsVsStripNumber[i]->ProjectionY());
0388     projYOccupancyVsStripNumber[i]->Add(occupancyVsStripNumber[i]->ProjectionY());
0389     projYOccupancyGoodStripsVsStripNumber[i]->Add(occupancyGoodStripsVsStripNumber[i]->ProjectionY());
0390     projYOccupancyHotStripsVsStripNumber[i]->Add(occupancyHotStripsVsStripNumber[i]->ProjectionY());
0391     pfxOccupancyVsStripNumber[i]->Add(
0392         occupancyVsStripNumber[i]->ProfileX(pfxOccupancyVsStripNumber[i]->GetName(), -8., 0.));
0393     pfxOccupancyGoodStripsVsStripNumber[i]->Add(
0394         occupancyGoodStripsVsStripNumber[i]->ProfileX(pfxOccupancyGoodStripsVsStripNumber[i]->GetName(), -8., 0.));
0395     pfxOccupancyHotStripsVsStripNumber[i]->Add(
0396         occupancyHotStripsVsStripNumber[i]->ProfileX(pfxOccupancyHotStripsVsStripNumber[i]->GetName(), -8., 0.));
0397     projYPoissonProbVsStripNumber[i]->Add(poissonProbVsStripNumber[i]->ProjectionY());
0398     projYPoissonProbGoodStripsVsStripNumber[i]->Add(poissonProbGoodStripsVsStripNumber[i]->ProjectionY());
0399     projYPoissonProbHotStripsVsStripNumber[i]->Add(poissonProbHotStripsVsStripNumber[i]->ProjectionY());
0400     pfxPoissonProbVsStripNumber[i]->Add(
0401         poissonProbVsStripNumber[i]->ProfileX(pfxPoissonProbVsStripNumber[i]->GetName(), -18., 0.));
0402     pfxPoissonProbGoodStripsVsStripNumber[i]->Add(
0403         poissonProbGoodStripsVsStripNumber[i]->ProfileX(pfxPoissonProbGoodStripsVsStripNumber[i]->GetName(), -18., 0.));
0404     pfxPoissonProbHotStripsVsStripNumber[i]->Add(
0405         poissonProbHotStripsVsStripNumber[i]->ProfileX(pfxPoissonProbHotStripsVsStripNumber[i]->GetName(), -18., 0.));
0406     projXDistanceVsStripNumber[i]->Add(
0407         distanceVsStripNumber[i]->ProjectionX(projXDistanceVsStripNumber[i]->GetName(), 1, 998));
0408   }
0409 
0410   // Save output files
0411 
0412   if (WriteOutputFile_ == true) {
0413     f->cd();
0414     apvtree->Write();
0415     striptree->Write();
0416     f->Close();
0417   }
0418 
0419   if (WriteDQMHistograms_ == true) {
0420     dqmStore->cd();
0421     dqmStore->save(DQMOutfileName_);
0422   }
0423 
0424   LogTrace("SiStripBadAPV") << ss.str() << std::endl;
0425 }
0426 
0427 void SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::CalculateMeanAndRMS(const std::vector<Apv>& a,
0428                                                                                 std::pair<double, double>* MeanRMS,
0429                                                                                 int number_iterations) {
0430   Double_t tot[7], tot2[7];
0431   Double_t n[7];
0432 
0433   Double_t Mean[7] = {0};
0434   Double_t Rms[7] = {1000, 1000, 1000, 1000, 1000, 1000, 1000};
0435 
0436   int Moduleposition;
0437 
0438   for (int i = 0; i < number_iterations; i++) {
0439     for (int j = 0; j < 7; j++) {
0440       n[j] = 0;
0441       tot[j] = 0;
0442       tot2[j] = 0;
0443     }
0444 
0445     for (uint32_t it = 0; it < a.size(); it++) {
0446       Moduleposition = (a[it].modulePosition) - 1;
0447 
0448       for (int apv = 0; apv < a[it].numberApvs; apv++) {
0449         if (i > 0) {
0450           if (a[it].apvMedian[apv] < (Mean[Moduleposition] - 3 * Rms[Moduleposition]) ||
0451               (a[it].apvMedian[apv] > (Mean[Moduleposition] + 5 * Rms[Moduleposition]))) {
0452             continue;
0453           }
0454         }
0455         tot[Moduleposition] += a[it].apvMedian[apv];
0456         tot2[Moduleposition] += (a[it].apvMedian[apv]) * (a[it].apvMedian[apv]);
0457         n[Moduleposition]++;
0458       }
0459     }
0460 
0461     for (int j = 0; j < 7; j++) {
0462       if (n[j] != 0) {
0463         Mean[j] = tot[j] / n[j];
0464         Rms[j] = TMath::Sqrt(TMath::Abs(tot2[j] / n[j] - Mean[j] * Mean[j]));
0465       }
0466     }
0467   }
0468 
0469   for (int j = 0; j < 7; j++) {
0470     MeanRMS[j] = std::make_pair(Mean[j], Rms[j]);
0471   }
0472 }
0473 
0474 void SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::AnalyzeOccupancy(SiStripQuality* quality,
0475                                                                              std::vector<Apv>& medianValues,
0476                                                                              std::pair<double, double>* MeanAndRms,
0477                                                                              std::vector<unsigned int>& BadStripList,
0478                                                                              const SiStripQuality* InSiStripQuality) {
0479   int Moduleposition;
0480   uint32_t Detid;
0481 
0482   for (uint32_t it = 0; it < medianValues.size(); it++) {
0483     Moduleposition = (medianValues[it].modulePosition) - 1;
0484     Detid = medianValues[it].detrawId;
0485 
0486     setBasicTreeParameters(Detid);
0487 
0488     DetId DetectorId = DetId(Detid);
0489     const StripGeomDetUnit* TheStripDet = dynamic_cast<const StripGeomDetUnit*>((TkGeom->idToDet(DetectorId)));
0490     const StripTopology* TheStripTopol = dynamic_cast<const StripTopology*>(&(TheStripDet->specificTopology()));
0491 
0492     //Analyze the occupancies
0493     hotstripspermodule = 0;
0494     vHotStripsInModule.clear();
0495 
0496     for (int apv = 0; apv < medianValues[it].numberApvs; apv++) {
0497       double logMedianOccupancy = -1;
0498       double logAbsoluteOccupancy = -1;
0499 
0500       for (int i = 0; i < 128; i++) {
0501         ishot[i] = 0;
0502         stripoccupancy[i] = 0;
0503         striphits[i] = 0;
0504         poissonprob[i] = 0;
0505       }
0506 
0507       number_strips = (medianValues[it].numberApvs) * 128;
0508       apv_number = apv + 1;
0509       apvMedianOccupancy = medianValues[it].apvMedian[apv];
0510       apvAbsoluteOccupancy = medianValues[it].apvabsoluteOccupancy[apv];
0511       isBad = 0;
0512       hotstripsperapv[apv] = 0;
0513 
0514       LocalPoint pos_apv_local = TheStripTopol->localPosition((apv * 128));
0515       GlobalPoint pos_apv_global = (TkGeom->idToDet(DetectorId))->surface().toGlobal(pos_apv_local);
0516 
0517       global_position_x = pos_apv_global.x();
0518       global_position_y = pos_apv_global.y();
0519       global_position_z = pos_apv_global.z();
0520 
0521       if (apvMedianOccupancy > 0)
0522         logMedianOccupancy = log10(apvMedianOccupancy);
0523       if (apvAbsoluteOccupancy > 0)
0524         logAbsoluteOccupancy = log10(apvAbsoluteOccupancy);
0525 
0526       //Fill the DQM histograms
0527       unsigned int layer = 0;
0528       if (subdetid == 3 || subdetid == 5)
0529         layer = layer_ring;
0530       else
0531         layer = disc;
0532 
0533       // Fill histograms for all the tracker
0534       medianVsAbsoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy, logMedianOccupancy);
0535       medianOccupancy[0][0]->Fill(logMedianOccupancy);
0536       absoluteOccupancy[0][0]->Fill(logAbsoluteOccupancy);
0537       // Fill summary histograms for each subdetector
0538       medianVsAbsoluteOccupancy[subdetid - 2][0]->Fill(logAbsoluteOccupancy, logMedianOccupancy);
0539       medianOccupancy[subdetid - 2][0]->Fill(logMedianOccupancy);
0540       absoluteOccupancy[subdetid - 2][0]->Fill(logAbsoluteOccupancy);
0541       // Fill histograms for each layer/disk
0542       medianVsAbsoluteOccupancy[subdetid - 2][layer]->Fill(logAbsoluteOccupancy, logMedianOccupancy);
0543       medianOccupancy[subdetid - 2][layer]->Fill(logMedianOccupancy);
0544       absoluteOccupancy[subdetid - 2][layer]->Fill(logAbsoluteOccupancy);
0545 
0546       if (UseInputDB_) {
0547         if (InSiStripQuality->IsApvBad(Detid, apv)) {
0548           if (WriteOutputFile_ == true) {
0549             apvtree->Fill();
0550             for (int strip = 0; strip < 128; strip++) {
0551               strip_number = (apv * 128) + strip + 1;
0552               apv_channel = apv + 1;
0553               isHot = ishot[strip];
0554               singleStripOccupancy = stripoccupancy[strip];
0555               stripHits = striphits[strip];
0556               poissonProb = poissonprob[strip];
0557 
0558               hotStripsPerModule = hotstripspermodule;
0559               hotStripsPerAPV = hotstripsperapv[apv];
0560 
0561               LocalPoint pos_strip_local = TheStripTopol->localPosition(strip);
0562               GlobalPoint pos_strip_global = (TkGeom->idToDet(DetectorId))->surface().toGlobal(pos_strip_local);
0563 
0564               strip_global_position_x = pos_strip_global.x();
0565               strip_global_position_y = pos_strip_global.y();
0566               strip_global_position_z = pos_strip_global.z();
0567               striptree->Fill();
0568 
0569               // Fill the strip DQM Plots
0570               fillStripDQMHistograms();
0571             }
0572 
0573             if (vHotStripsInModule.size() == 1) {
0574               distance = 999;
0575               distanceVsStripNumber[0]->Fill(vHotStripsInModule[0], distance);
0576               distanceVsStripNumber[subdetid - 2]->Fill(vHotStripsInModule[0], distance);
0577             } else if (vHotStripsInModule.size() > 1) {
0578               for (unsigned int iVec = 0; iVec != vHotStripsInModule.size(); iVec++) {
0579                 if (iVec == 0)
0580                   distance = vHotStripsInModule[1] - vHotStripsInModule[0];
0581                 else if (iVec == vHotStripsInModule.size() - 1) {
0582                   distance = vHotStripsInModule[vHotStripsInModule.size() - 1] -
0583                              vHotStripsInModule[vHotStripsInModule.size() - 2];
0584                 } else if (vHotStripsInModule.size() > 2) {
0585                   distanceR = vHotStripsInModule[iVec + 1] - vHotStripsInModule[iVec];
0586                   distanceL = vHotStripsInModule[iVec] - vHotStripsInModule[iVec - 1];
0587                   distance = distanceL > distanceR ? distanceR : distanceL;
0588                 } else {
0589                   std::cout << "ERROR! distance is never computed!!!\n";
0590                 }
0591                 distanceVsStripNumber[0]->Fill(vHotStripsInModule[iVec], distance);
0592                 distanceVsStripNumber[subdetid - 2]->Fill(vHotStripsInModule[iVec], distance);
0593               }
0594             }
0595           }
0596           continue;  //if the apv is already flagged as bad, continue.
0597         }
0598       }
0599 
0600       if (medianValues[it].apvMedian[apv] > minNevents_) {
0601         if ((medianValues[it].apvMedian[apv] >
0602              (MeanAndRms[Moduleposition].first + highoccupancy_ * MeanAndRms[Moduleposition].second)) &&
0603             (medianValues[it].apvMedian[apv] > absolutelow_)) {
0604           BadStripList.push_back(pQuality->encode((apv * 128), 128, 0));
0605           isBad = 1;
0606         }
0607       } else if (medianValues[it].apvMedian[apv] <
0608                      (MeanAndRms[Moduleposition].first - lowoccupancy_ * MeanAndRms[Moduleposition].second) &&
0609                  (MeanAndRms[Moduleposition].first > 2 || medianValues[it].apvabsoluteOccupancy[apv] == 0)) {
0610         BadStripList.push_back(pQuality->encode((apv * 128), 128, 0));
0611         isBad = 1;
0612       }
0613 
0614       if (isBad != 1) {
0615         iterativeSearch(medianValues[it], BadStripList, apv);
0616       }
0617 
0618       if (WriteOutputFile_ == true) {
0619         apvtree->Fill();
0620         for (int strip = 0; strip < 128; strip++) {
0621           strip_number = (apv * 128) + strip + 1;
0622           apv_channel = apv + 1;
0623           isHot = ishot[strip];
0624           singleStripOccupancy = stripoccupancy[strip];
0625           stripHits = striphits[strip];
0626           poissonProb = poissonprob[strip];
0627 
0628           hotStripsPerModule = hotstripspermodule;
0629           hotStripsPerAPV = hotstripsperapv[apv];
0630 
0631           LocalPoint pos_strip_local = TheStripTopol->localPosition(strip);
0632           GlobalPoint pos_strip_global = (TkGeom->idToDet(DetectorId))->surface().toGlobal(pos_strip_local);
0633 
0634           strip_global_position_x = pos_strip_global.x();
0635           strip_global_position_y = pos_strip_global.y();
0636           strip_global_position_z = pos_strip_global.z();
0637           striptree->Fill();
0638 
0639           // Fill the strip DQM Plots
0640           fillStripDQMHistograms();
0641         }
0642         if (vHotStripsInModule.size() == 1) {
0643           distance = 999;
0644           distanceVsStripNumber[0]->Fill(vHotStripsInModule[0], distance);
0645           distanceVsStripNumber[subdetid - 2]->Fill(vHotStripsInModule[0], distance);
0646         } else if (vHotStripsInModule.size() > 1) {
0647           for (unsigned int iVec = 0; iVec != vHotStripsInModule.size(); iVec++) {
0648             if (iVec == 0)
0649               distance = vHotStripsInModule[1] - vHotStripsInModule[0];
0650             else if (iVec == vHotStripsInModule.size() - 1) {
0651               distance =
0652                   vHotStripsInModule[vHotStripsInModule.size() - 1] - vHotStripsInModule[vHotStripsInModule.size() - 2];
0653             } else if (vHotStripsInModule.size() > 2) {
0654               distanceR = vHotStripsInModule[iVec + 1] - vHotStripsInModule[iVec];
0655               distanceL = vHotStripsInModule[iVec] - vHotStripsInModule[iVec - 1];
0656               distance = distanceL > distanceR ? distanceR : distanceL;
0657             } else {
0658               std::cout << "ERROR! distance is never computed!!!\n";
0659             }
0660             distanceVsStripNumber[0]->Fill(vHotStripsInModule[iVec], distance);
0661             distanceVsStripNumber[subdetid - 2]->Fill(vHotStripsInModule[iVec], distance);
0662           }
0663         }
0664       }
0665     }
0666 
0667     if (BadStripList.begin() != BadStripList.end()) {
0668       quality->compact(Detid, BadStripList);
0669       SiStripQuality::Range range(BadStripList.begin(), BadStripList.end());
0670       quality->put(Detid, range);
0671     }
0672     BadStripList.clear();
0673   }
0674 }
0675 
0676 void SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::iterativeSearch(Apv& histo,
0677                                                                             std::vector<unsigned int>& vect,
0678                                                                             int apv) {
0679   if (!histo.NEntries[apv] || histo.NEntries[apv] <= MinNumEntries_ || histo.NEntries[apv] <= minNevents_)
0680     return;
0681 
0682   size_t startingSize = vect.size();
0683   long double diff = 1. - prob_;
0684 
0685   size_t Nbins = histo.th1f[apv]->GetNbinsX();
0686   size_t ibinStart = 1;
0687   size_t ibinStop = Nbins + 1;
0688   int MaxEntry = (int)histo.th1f[apv]->GetMaximum();
0689 
0690   std::vector<long double> vPoissonProbs(MaxEntry + 1, 0);
0691   long double meanVal = 1. * histo.NEntries[apv] / (1. * Nbins - histo.NEmptyBins[apv]);
0692   evaluatePoissonian(vPoissonProbs, meanVal);
0693 
0694   // Find median occupancy, taking into account only good strips
0695   unsigned int goodstripentries[128];
0696   int nGoodStrips = 0;
0697   for (size_t i = ibinStart; i < ibinStop; ++i) {
0698     if (ishot[(apv * 128) + i - 1] == 0) {
0699       goodstripentries[nGoodStrips] = (unsigned int)histo.th1f[apv]->GetBinContent(i);
0700       nGoodStrips++;
0701     }
0702   }
0703   double median = TMath::Median(nGoodStrips, goodstripentries);
0704 
0705   for (size_t i = ibinStart; i < ibinStop; ++i) {
0706     unsigned int entries = (unsigned int)histo.th1f[apv]->GetBinContent(i);
0707 
0708     if (ishot[i - 1] == 0) {
0709       stripoccupancy[i - 1] = entries / (double)Nevents_;
0710       striphits[i - 1] = entries;
0711       poissonprob[i - 1] = 1 - vPoissonProbs[entries];
0712       medianapvhits[apv] = median;
0713       avgapvhits[apv] = meanVal;
0714     }
0715 
0716     if (entries <= MinNumEntriesPerStrip_ || entries <= minNevents_ || entries / median < ratio_)
0717       continue;
0718 
0719     if (diff < vPoissonProbs[entries]) {
0720       ishot[i - 1] = 1;
0721       hotstripspermodule++;
0722       hotstripsperapv[apv]++;
0723       histo.th1f[apv]->SetBinContent(i, 0.);
0724       histo.NEntries[apv] -= entries;
0725       histo.NEmptyBins[apv]++;
0726       if (edm::isDebugEnabled())
0727         LogTrace("SiStripHotStrip") << " rejecting strip " << (apv * 128) + i - 1 << " value " << entries << " diff  "
0728                                     << diff << " prob " << vPoissonProbs[entries] << std::endl;
0729       vect.push_back(pQuality->encode((apv * 128) + i - 1, 1, 0));
0730     }
0731   }
0732   if (edm::isDebugEnabled())
0733     LogTrace("SiStripHotStrip") << " [SiStripHotStripAlgorithmFromClusterOccupancy::iterativeSearch] Nbins=" << Nbins
0734                                 << " MaxEntry=" << MaxEntry << " meanVal=" << meanVal
0735                                 << " NEmptyBins=" << histo.NEmptyBins[apv] << " NEntries=" << histo.NEntries[apv]
0736                                 << " thEntries " << histo.th1f[apv]->GetEntries() << " startingSize " << startingSize
0737                                 << " vector.size " << vect.size() << std::endl;
0738 
0739   if (vect.size() != startingSize)
0740     iterativeSearch(histo, vect, apv);
0741 }
0742 
0743 void SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::evaluatePoissonian(std::vector<long double>& vPoissonProbs,
0744                                                                                long double& meanVal) {
0745   for (size_t i = 0; i < vPoissonProbs.size(); ++i) {
0746     vPoissonProbs[i] = (i == 0) ? TMath::Poisson(i, meanVal) : vPoissonProbs[i - 1] + TMath::Poisson(i, meanVal);
0747   }
0748 }
0749 
0750 void SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::setBasicTreeParameters(int detid) {
0751   DetId DetectorID = DetId(detid);
0752 
0753   detrawid = detid;
0754   subdetid = DetectorID.subdetId();
0755 
0756   switch (DetectorID.subdetId()) {
0757     case StripSubdetector::TIB:
0758       layer_ring = tTopo->tibLayer(detid);
0759       disc = -1;
0760       isstereo = tTopo->tibIsStereo(detid);
0761       isback = -1;
0762       if (tTopo->tibIsExternalString(detid))
0763         isexternalstring = 1;
0764       else
0765         isexternalstring = 0;
0766       if (tTopo->tibIsZMinusSide(detid))
0767         iszminusside = 1;
0768       else
0769         iszminusside = 0;
0770       rodstringpetal = tTopo->tibString(detid);
0771       module_number = tTopo->tibModule(detid);
0772 
0773       break;
0774 
0775     case StripSubdetector::TID:
0776       layer_ring = tTopo->tidRing(detid);
0777       disc = tTopo->tidWheel(detid);
0778       isstereo = tTopo->tidIsStereo(detid);
0779       if (tTopo->tidIsBackRing(detid))
0780         isback = 1;
0781       else
0782         isback = 0;
0783       if (tTopo->tidIsZMinusSide(detid))
0784         iszminusside = 1;
0785       else
0786         iszminusside = 0;
0787       isexternalstring = -1;
0788       rodstringpetal = -1;
0789       module_number = tTopo->tidModule(detid);
0790 
0791       break;
0792 
0793     case StripSubdetector::TOB:
0794       layer_ring = tTopo->tobLayer(detid);
0795       disc = -1;
0796       isstereo = tTopo->tobIsStereo(detid);
0797       isback = -1;
0798       if (tTopo->tobIsZMinusSide(detid))
0799         iszminusside = 1;
0800       else
0801         iszminusside = 0;
0802       isexternalstring = -1;
0803       rodstringpetal = tTopo->tobRod(detid);
0804       module_number = tTopo->tobModule(detid);
0805 
0806       break;
0807 
0808     case StripSubdetector::TEC:
0809       layer_ring = tTopo->tecRing(detid);
0810       disc = tTopo->tecWheel(detid);
0811       isstereo = tTopo->tecIsStereo(detid);
0812       if (tTopo->tecIsBackPetal(detid))
0813         isback = 1;
0814       else
0815         isback = 0;
0816       if (tTopo->tecIsZMinusSide(detid))
0817         iszminusside = 1;
0818       else
0819         iszminusside = 0;
0820       isexternalstring = -1;
0821       rodstringpetal = tTopo->tecPetalNumber(detid);
0822       module_number = tTopo->tecModule(detid);
0823 
0824       break;
0825 
0826     default:
0827       std::cout << "### Detector does not belong to TIB, TID, TOB or TEC !? ###" << std::endl;
0828       std::cout << "### DetRawId: " << detid << " ###" << std::endl;
0829   }
0830 }
0831 
0832 void SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::setMinNumOfEvents() {
0833   minNevents_ = absolute_occupancy_ * Nevents_;
0834 }
0835 
0836 void SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::initializeDQMHistograms() {
0837   oss.str("");
0838   oss << 1;  //runNumber
0839 
0840   dqmStore = edm::Service<DQMStore>().operator->();
0841   dqmStore->setCurrentFolder("ChannelStatusPlots");
0842 
0843   // Initialize histograms
0844   subDetName.push_back("");
0845   subDetName.push_back("TIB");
0846   subDetName.push_back("TID");
0847   subDetName.push_back("TOB");
0848   subDetName.push_back("TEC");
0849   nLayers.push_back(0);
0850   nLayers.push_back(4);
0851   nLayers.push_back(3);
0852   nLayers.push_back(6);
0853   nLayers.push_back(9);
0854   layerName.push_back("");
0855   layerName.push_back("Layer");
0856   layerName.push_back("Disk");
0857   layerName.push_back("Layer");
0858   layerName.push_back("Disk");
0859 
0860   std::string histoName;
0861   std::string histoTitle;
0862 
0863   for (unsigned int i = 0; i < subDetName.size(); i++) {
0864     histoName = "distanceVsStripNumber" + subDetName[i];
0865     histoTitle = "Distance between hot strips vs. strip number";
0866     if (i != 0)
0867       histoTitle += " in " + subDetName[i];
0868     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 999, 0.5, 999.5);
0869     distanceVsStripNumber.push_back(tmp->getTH2F());
0870 
0871     histoName = "pfxDistanceVsStripNumber" + subDetName[i];
0872     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
0873     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
0874     pfxDistanceVsStripNumber.push_back(tmp->getTProfile());
0875     pfxDistanceVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
0876     pfxDistanceVsStripNumber[i]->GetYaxis()->SetTitle("Distance");
0877 
0878     histoName = "projXDistanceVsStripNumber" + subDetName[i];
0879     histoTitle = "Number of hot strips vs. strip number";
0880     if (i != 0)
0881       histoTitle += " in " + subDetName[i];
0882     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
0883     projXDistanceVsStripNumber.push_back(tmp->getTH1F());
0884     projXDistanceVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
0885     projXDistanceVsStripNumber[i]->GetYaxis()->SetTitle("N_{hot}");
0886 
0887     histoName = "projYDistanceVsStripNumber" + subDetName[i];
0888     histoTitle = "Distribution of distance between hot strips";
0889     if (i != 0)
0890       histoTitle += " in " + subDetName[i];
0891     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 999, 0.5, 999.5);
0892     projYDistanceVsStripNumber.push_back(tmp->getTH1F());
0893     projYDistanceVsStripNumber[i]->GetXaxis()->SetTitle("Distance");
0894     projYDistanceVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
0895 
0896     //
0897     histoName = "occupancyVsStripNumber" + subDetName[i];
0898     histoTitle = "Occupancy of strips vs. strip number";
0899     if (i != 0)
0900       histoTitle += " in " + subDetName[i];
0901     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -8., 0.);
0902     occupancyVsStripNumber.push_back(tmp->getTH2F());
0903 
0904     histoName = "pfxOccupancyVsStripNumber" + subDetName[i];
0905     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
0906     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
0907     pfxOccupancyVsStripNumber.push_back(tmp->getTProfile());
0908     pfxOccupancyVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
0909     pfxOccupancyVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Occupancy)");
0910 
0911     histoName = "projYOccupancyVsStripNumber" + subDetName[i];
0912     histoTitle = "Distribution of strip occupancy";
0913     if (i != 0)
0914       histoTitle += " in " + subDetName[i];
0915     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -8., 0.);
0916     projYOccupancyVsStripNumber.push_back(tmp->getTH1F());
0917     projYOccupancyVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
0918     projYOccupancyVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
0919 
0920     //
0921     histoName = "occupancyHotStripsVsStripNumber" + subDetName[i];
0922     histoTitle = "Occupancy of hot strips vs. strip number";
0923     if (i != 0)
0924       histoTitle += " in " + subDetName[i];
0925     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -8., 0.);
0926     occupancyHotStripsVsStripNumber.push_back(tmp->getTH2F());
0927 
0928     histoName = "pfxOccupancyHotStripsVsStripNumber" + subDetName[i];
0929     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
0930     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
0931     pfxOccupancyHotStripsVsStripNumber.push_back(tmp->getTProfile());
0932     pfxOccupancyHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
0933     pfxOccupancyHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Occupancy)");
0934 
0935     histoName = "projYOccupancyHotStripsVsStripNumber" + subDetName[i];
0936     histoTitle = "Distribution of hot strip occupancy";
0937     if (i != 0)
0938       histoTitle += " in " + subDetName[i];
0939     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -8., 0.);
0940     projYOccupancyHotStripsVsStripNumber.push_back(tmp->getTH1F());
0941     projYOccupancyHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
0942     projYOccupancyHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
0943 
0944     //
0945     histoName = "occupancyGoodStripsVsStripNumber" + subDetName[i];
0946     histoTitle = "Occupancy of good strips vs. strip number";
0947     if (i != 0)
0948       histoTitle += " in " + subDetName[i];
0949     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -8., 0.);
0950     occupancyGoodStripsVsStripNumber.push_back(tmp->getTH2F());
0951 
0952     histoName = "pfxOccupancyGoodStripsVsStripNumber" + subDetName[i];
0953     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
0954     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
0955     pfxOccupancyGoodStripsVsStripNumber.push_back(tmp->getTProfile());
0956     pfxOccupancyGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
0957     pfxOccupancyGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Occupancy)");
0958 
0959     histoName = "projYOccupancyGoodStripsVsStripNumber" + subDetName[i];
0960     histoTitle = "Distribution of good strip occupancy";
0961     if (i != 0)
0962       histoTitle += " in " + subDetName[i];
0963     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -8., 0.);
0964     projYOccupancyGoodStripsVsStripNumber.push_back(tmp->getTH1F());
0965     projYOccupancyGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
0966     projYOccupancyGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
0967 
0968     //
0969     histoName = "poissonProbVsStripNumber" + subDetName[i];
0970     histoTitle = "Poisson probability of strips vs. strip number";
0971     if (i != 0)
0972       histoTitle += " in " + subDetName[i];
0973     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -18., 0.);
0974     poissonProbVsStripNumber.push_back(tmp->getTH2F());
0975 
0976     histoName = "pfxPoissonProbVsStripNumber" + subDetName[i];
0977     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
0978     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
0979     pfxPoissonProbVsStripNumber.push_back(tmp->getTProfile());
0980     pfxPoissonProbVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
0981     pfxPoissonProbVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Probability)");
0982 
0983     histoName = "projYPoissonProbVsStripNumber" + subDetName[i];
0984     histoTitle = "Distribution of strip Poisson probability";
0985     if (i != 0)
0986       histoTitle += " in " + subDetName[i];
0987     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -18., 0.);
0988     projYPoissonProbVsStripNumber.push_back(tmp->getTH1F());
0989     projYPoissonProbVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Probability)");
0990     projYPoissonProbVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
0991 
0992     //
0993     histoName = "poissonProbHotStripsVsStripNumber" + subDetName[i];
0994     histoTitle = "Poisson probability of hot strips vs. strip number";
0995     if (i != 0)
0996       histoTitle += " in " + subDetName[i];
0997     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -18., 0.);
0998     poissonProbHotStripsVsStripNumber.push_back(tmp->getTH2F());
0999 
1000     histoName = "pfxPoissonProbHotStripsVsStripNumber" + subDetName[i];
1001     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1002     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
1003     pfxPoissonProbHotStripsVsStripNumber.push_back(tmp->getTProfile());
1004     pfxPoissonProbHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
1005     pfxPoissonProbHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Probability)");
1006 
1007     histoName = "projYPoissonProbHotStripsVsStripNumber" + subDetName[i];
1008     histoTitle = "Distribution of hot strip Poisson probability";
1009     if (i != 0)
1010       histoTitle += " in " + subDetName[i];
1011     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -18., 0.);
1012     projYPoissonProbHotStripsVsStripNumber.push_back(tmp->getTH1F());
1013     projYPoissonProbHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Probability)");
1014     projYPoissonProbHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
1015 
1016     //
1017     histoName = "poissonProbGoodStripsVsStripNumber" + subDetName[i];
1018     histoTitle = "Poisson probability of good strips vs. strip number";
1019     if (i != 0)
1020       histoTitle += " in " + subDetName[i];
1021     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 1000, -18., 0.);
1022     poissonProbGoodStripsVsStripNumber.push_back(tmp->getTH2F());
1023 
1024     histoName = "pfxPoissonProbGoodStripsVsStripNumber" + subDetName[i];
1025     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1026     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
1027     pfxPoissonProbGoodStripsVsStripNumber.push_back(tmp->getTProfile());
1028     pfxPoissonProbGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("Strip");
1029     pfxPoissonProbGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("log_{10}(Probability)");
1030 
1031     histoName = "projYPoissonProbGoodStripsVsStripNumber" + subDetName[i];
1032     histoTitle = "Distribution of good strip Poisson probability";
1033     if (i != 0)
1034       histoTitle += " in " + subDetName[i];
1035     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -18., 0.);
1036     projYPoissonProbGoodStripsVsStripNumber.push_back(tmp->getTH1F());
1037     projYPoissonProbGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("log_{10}(Probability)");
1038     projYPoissonProbGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
1039 
1040     //
1041     histoName = "nHitsVsStripNumber" + subDetName[i];
1042     histoTitle = "NHits in strips vs. strip number";
1043     if (i != 0)
1044       histoTitle += " in " + subDetName[i];
1045     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 10000, -0.5, 9999.5);
1046     nHitsVsStripNumber.push_back(tmp->getTH2F());
1047 
1048     histoName = "pfxNHitsVsStripNumber" + subDetName[i];
1049     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1050     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
1051     pfxNHitsVsStripNumber.push_back(tmp->getTProfile());
1052 
1053     histoName = "projXNHitsVsStripNumber" + subDetName[i];
1054     histoTitle = "Cumulative nHits in strips vs. strip number";
1055     if (i != 0)
1056       histoTitle += " in " + subDetName[i];
1057     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1058     projXNHitsVsStripNumber.push_back(tmp->getTH1F());
1059 
1060     histoName = "projYNHitsVsStripNumber" + subDetName[i];
1061     histoTitle = "Distribution of nHits for all strips";
1062     if (i != 0)
1063       histoTitle += " in " + subDetName[i];
1064     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 10000, -0.5, 9999.5);
1065     projYNHitsVsStripNumber.push_back(tmp->getTH1F());
1066     projYNHitsVsStripNumber[i]->GetXaxis()->SetTitle("N_{hits}");
1067     projYNHitsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
1068 
1069     //
1070     histoName = "nHitsHotStripsVsStripNumber" + subDetName[i];
1071     histoTitle = "NHits in hot strips vs. strip number";
1072     if (i != 0)
1073       histoTitle += " in " + subDetName[i];
1074     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 10000, -0.5, 9999.5);
1075     nHitsHotStripsVsStripNumber.push_back(tmp->getTH2F());
1076 
1077     histoName = "pfxNHitsHotStripsVsStripNumber" + subDetName[i];
1078     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1079     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
1080     pfxNHitsHotStripsVsStripNumber.push_back(tmp->getTProfile());
1081 
1082     histoName = "projXNHitsHotStripsVsStripNumber" + subDetName[i];
1083     histoTitle = "Cumulative nHits in hot strips vs. strip number";
1084     if (i != 0)
1085       histoTitle += " in " + subDetName[i];
1086     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1087     projXNHitsHotStripsVsStripNumber.push_back(tmp->getTH1F());
1088 
1089     histoName = "projYNHitsHotStripsVsStripNumber" + subDetName[i];
1090     histoTitle = "Distribution of nHits for hot strips";
1091     if (i != 0)
1092       histoTitle += " in " + subDetName[i];
1093     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 10000, -0.5, 9999.5);
1094     projYNHitsHotStripsVsStripNumber.push_back(tmp->getTH1F());
1095     projYNHitsHotStripsVsStripNumber[i]->GetXaxis()->SetTitle("N_{hits}");
1096     projYNHitsHotStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
1097 
1098     //
1099     histoName = "nHitsGoodStripsVsStripNumber" + subDetName[i];
1100     histoTitle = "NHits in good strips vs. strip number";
1101     if (i != 0)
1102       histoTitle += " in " + subDetName[i];
1103     tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5, 10000, -0.5, 9999.5);
1104     nHitsGoodStripsVsStripNumber.push_back(tmp->getTH2F());
1105 
1106     histoName = "pfxNHitsGoodStripsVsStripNumber" + subDetName[i];
1107     tmp_prof = new TProfile(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1108     tmp = dqmStore->bookProfile(histoName.c_str(), tmp_prof);
1109     pfxNHitsGoodStripsVsStripNumber.push_back(tmp->getTProfile());
1110 
1111     histoName = "projXNHitsGoodStripsVsStripNumber" + subDetName[i];
1112     histoTitle = "Cumulative nHits in good strips vs. strip number";
1113     if (i != 0)
1114       histoTitle += " in " + subDetName[i];
1115     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 768, 0.5, 768.5);
1116     projXNHitsGoodStripsVsStripNumber.push_back(tmp->getTH1F());
1117 
1118     histoName = "projYNHitsGoodStripsVsStripNumber" + subDetName[i];
1119     histoTitle = "Distribution of nHits for good strips";
1120     if (i != 0)
1121       histoTitle += " in " + subDetName[i];
1122     tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 10000, -0.5, 9999.5);
1123     projYNHitsGoodStripsVsStripNumber.push_back(tmp->getTH1F());
1124     projYNHitsGoodStripsVsStripNumber[i]->GetXaxis()->SetTitle("N_{hits}");
1125     projYNHitsGoodStripsVsStripNumber[i]->GetYaxis()->SetTitle("N_{strips}");
1126 
1127     for (unsigned int j = 0; j <= nLayers[i]; j++) {
1128       histoName = "medianVsAbsoluteOccupancy" + subDetName[i];
1129       if (j != 0) {
1130         oss.str("");
1131         oss << j;
1132         histoName += layerName[i] + oss.str();
1133       }
1134       histoTitle = "Median APV occupancy vs. absolute APV occupancy";
1135       if (i != 0)
1136         histoTitle += " in " + subDetName[i];
1137       if (j != 0) {
1138         histoTitle += " " + layerName[i] + " " + oss.str();
1139       }
1140       tmp = dqmStore->book2D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6., 1000, -1., 3.);
1141       medianVsAbsoluteOccupancy[i][j] = tmp->getTH2F();
1142       medianVsAbsoluteOccupancy[i][j]->Rebin2D(10, 10);
1143       medianVsAbsoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Abs. Occupancy)");
1144       medianVsAbsoluteOccupancy[i][j]->GetYaxis()->SetTitle("log_{10}(Median Occupancy)");
1145       //
1146       histoName = "medianOccupancy" + subDetName[i];
1147       if (j != 0) {
1148         oss.str("");
1149         oss << j;
1150         histoName += layerName[i] + oss.str();
1151       }
1152       histoTitle = "Median APV occupancy";
1153       if (i != 0)
1154         histoTitle += " in " + subDetName[i];
1155       if (j != 0) {
1156         histoTitle += " " + layerName[i] + " " + oss.str();
1157       }
1158       tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, -1., 3.);
1159       medianOccupancy[i][j] = tmp->getTH1F();
1160       medianOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
1161       medianOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
1162       //
1163       histoName = "absoluteOccupancy" + subDetName[i];
1164       if (j != 0) {
1165         oss.str("");
1166         oss << j;
1167         histoName += layerName[i] + oss.str();
1168       }
1169       histoTitle = "Absolute APV occupancy";
1170       if (i != 0)
1171         histoTitle += " in " + subDetName[i];
1172       if (j != 0) {
1173         histoTitle += " " + layerName[i] + " " + oss.str();
1174       }
1175       tmp = dqmStore->book1D(histoName.c_str(), histoTitle.c_str(), 1000, 0., 6.);
1176       absoluteOccupancy[i][j] = tmp->getTH1F();
1177       absoluteOccupancy[i][j]->GetXaxis()->SetTitle("log_{10}(Occupancy)");
1178       absoluteOccupancy[i][j]->GetYaxis()->SetTitle("APVs");
1179     }
1180   }
1181 }
1182 
1183 void SiStripBadAPVandHotStripAlgorithmFromClusterOccupancy::fillStripDQMHistograms() {
1184   double logStripOccupancy = -1;
1185   double logPoissonProb = -1;
1186 
1187   if (singleStripOccupancy > 0)
1188     logStripOccupancy = log10(singleStripOccupancy);
1189   if (poissonProb > 0)
1190     logPoissonProb = log10(fabs(poissonProb));
1191 
1192   occupancyVsStripNumber[0]->Fill(strip_number, logStripOccupancy);
1193   occupancyVsStripNumber[subdetid - 2]->Fill(strip_number, logStripOccupancy);
1194   poissonProbVsStripNumber[0]->Fill(strip_number, logPoissonProb);
1195   poissonProbVsStripNumber[subdetid - 2]->Fill(strip_number, logPoissonProb);
1196   nHitsVsStripNumber[0]->Fill(strip_number, stripHits);
1197   nHitsVsStripNumber[subdetid - 2]->Fill(strip_number, stripHits);
1198 
1199   if (isHot) {
1200     vHotStripsInModule.push_back(strip_number);
1201     occupancyHotStripsVsStripNumber[0]->Fill(strip_number, logStripOccupancy);
1202     occupancyHotStripsVsStripNumber[subdetid - 2]->Fill(strip_number, logStripOccupancy);
1203     poissonProbHotStripsVsStripNumber[0]->Fill(strip_number, logPoissonProb);
1204     poissonProbHotStripsVsStripNumber[subdetid - 2]->Fill(strip_number, logPoissonProb);
1205     nHitsHotStripsVsStripNumber[0]->Fill(strip_number, stripHits);
1206     nHitsHotStripsVsStripNumber[subdetid - 2]->Fill(strip_number, stripHits);
1207   } else {
1208     occupancyGoodStripsVsStripNumber[0]->Fill(strip_number, logStripOccupancy);
1209     occupancyGoodStripsVsStripNumber[subdetid - 2]->Fill(strip_number, logStripOccupancy);
1210     poissonProbGoodStripsVsStripNumber[0]->Fill(strip_number, logPoissonProb);
1211     poissonProbGoodStripsVsStripNumber[subdetid - 2]->Fill(strip_number, logPoissonProb);
1212     nHitsGoodStripsVsStripNumber[0]->Fill(strip_number, stripHits);
1213     nHitsGoodStripsVsStripNumber[subdetid - 2]->Fill(strip_number, stripHits);
1214   }
1215 }