Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:34:25

0001 #include "Validation/RPCRecHits/interface/RPCRecHitValidClient.h"
0002 
0003 #include "FWCore/Framework/interface/MakerMacros.h"
0004 
0005 #include "FWCore/Framework/interface/ESHandle.h"
0006 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0007 
0008 using namespace std;
0009 
0010 typedef RPCRecHitValidClient::MonitorElement *MEP;
0011 
0012 RPCRecHitValidClient::RPCRecHitValidClient(const edm::ParameterSet &pset) {
0013   subDir_ = pset.getParameter<std::string>("subDir");
0014 }
0015 
0016 void RPCRecHitValidClient::dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) {
0017   booker.setCurrentFolder(subDir_);
0018   MEP me_rollEfficiencyBarrel_eff =
0019       booker.book1D("RollEfficiencyBarrel_eff", "Roll efficiency in Barrel;Efficiency [%]", 50 + 2, -2, 100 + 2);
0020   MEP me_rollEfficiencyEndcap_eff =
0021       booker.book1D("RollEfficiencyEndcap_eff", "Roll efficiency in Endcap;Efficiency [%]", 50 + 2, -2, 100 + 2);
0022   MEP me_rollEfficiencyStatCutOffBarrel_eff =
0023       booker.book1D("RollEfficiencyCutOffBarrel_eff",
0024                     "Roll efficiency in Barrel without low stat chamber;Efficiency [%]",
0025                     50 + 2,
0026                     -2,
0027                     100 + 2);
0028   MEP me_rollEfficiencyStatCutOffEndcap_eff =
0029       booker.book1D("RollEfficiencyCutOffEndcap_eff",
0030                     "Roll efficiency in Endcap without low stat chamber;Efficiency [%]",
0031                     50 + 2,
0032                     -2,
0033                     100 + 2);
0034 
0035   const double maxNoise = 1e-7;
0036   MEP me_rollNoiseBarrel_noise = booker.book1D("RollNoiseBarrel_noise",
0037                                                "Roll noise in Barrel;Noise level [Event^{-1}cm^{-2}]",
0038                                                25 + 2,
0039                                                -maxNoise / 25,
0040                                                maxNoise + maxNoise / 25);
0041   MEP me_rollNoiseEndcap_noise = booker.book1D("RollNoiseEndcap_noise",
0042                                                "Roll noise in Endcap;Noise level [Event^{-1}cm^{-2}]",
0043                                                25 + 2,
0044                                                -maxNoise / 25,
0045                                                maxNoise + maxNoise / 25);
0046 
0047   MEP me_matchOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/MatchOccupancyBarrel_detId");
0048   MEP me_matchOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/MatchOccupancyEndcap_detId");
0049   MEP me_refOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/RefOccupancyBarrel_detId");
0050   MEP me_refOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/RefOccupancyEndcap_detId");
0051 
0052   if (me_matchOccupancyBarrel_detId and me_refOccupancyBarrel_detId) {
0053     TH1 *h_matchOccupancyBarrel_detId = me_matchOccupancyBarrel_detId->getTH1();
0054     TH1 *h_refOccupancyBarrel_detId = me_refOccupancyBarrel_detId->getTH1();
0055 
0056     for (int bin = 1, nBin = h_matchOccupancyBarrel_detId->GetNbinsX(); bin <= nBin; ++bin) {
0057       const double nRec = h_matchOccupancyBarrel_detId->GetBinContent(bin);
0058       const double nRef = h_refOccupancyBarrel_detId->GetBinContent(bin);
0059 
0060       const double eff = nRef ? nRec / nRef * 100 : -1;
0061 
0062       me_rollEfficiencyBarrel_eff->Fill(eff);
0063       if (nRef >= 20)
0064         me_rollEfficiencyStatCutOffBarrel_eff->Fill(eff);
0065     }
0066   }
0067 
0068   if (me_matchOccupancyEndcap_detId and me_refOccupancyEndcap_detId) {
0069     TH1 *h_matchOccupancyEndcap_detId = me_matchOccupancyEndcap_detId->getTH1();
0070     TH1 *h_refOccupancyEndcap_detId = me_refOccupancyEndcap_detId->getTH1();
0071 
0072     for (int bin = 1, nBin = h_matchOccupancyEndcap_detId->GetNbinsX(); bin <= nBin; ++bin) {
0073       const double nRec = h_matchOccupancyEndcap_detId->GetBinContent(bin);
0074       const double nRef = h_refOccupancyEndcap_detId->GetBinContent(bin);
0075 
0076       const double eff = nRef ? nRec / nRef * 100 : -1;
0077 
0078       me_rollEfficiencyEndcap_eff->Fill(eff);
0079       if (nRef >= 20)
0080         me_rollEfficiencyStatCutOffEndcap_eff->Fill(eff);
0081     }
0082   }
0083 
0084   MEP me_eventCount = getter.get(subDir_ + "/Occupancy/EventCount");
0085   const double nEvent = me_eventCount ? me_eventCount->getTH1()->GetBinContent(1) : 1;
0086   MEP me_noiseOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/NoiseOccupancyBarrel_detId");
0087   MEP me_rollAreaBarrel_detId = getter.get(subDir_ + "/Occupancy/RollAreaBarrel_detId");
0088   if (me_noiseOccupancyBarrel_detId and me_rollAreaBarrel_detId) {
0089     TH1 *h_noiseOccupancyBarrel_detId = me_noiseOccupancyBarrel_detId->getTH1();
0090     TH1 *h_rollAreaBarrel_detId = me_rollAreaBarrel_detId->getTH1();
0091 
0092     for (int bin = 1, nBin = h_noiseOccupancyBarrel_detId->GetNbinsX(); bin <= nBin; ++bin) {
0093       const double noiseCount = h_noiseOccupancyBarrel_detId->GetBinContent(bin);
0094       const double area = h_rollAreaBarrel_detId->GetBinContent(bin);
0095       const double noiseLevel = area > 0 ? noiseCount / area / nEvent : 0;
0096       if (noiseLevel == 0.)
0097         me_rollNoiseBarrel_noise->Fill(-maxNoise / 50);  // Fill underflow bin if noise is exactly zero
0098       else
0099         me_rollNoiseBarrel_noise->Fill(std::min(noiseLevel, maxNoise));
0100     }
0101   }
0102 
0103   MEP me_noiseOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/NoiseOccupancyEndcap_detId");
0104   MEP me_rollAreaEndcap_detId = getter.get(subDir_ + "/Occupancy/RollAreaEndcap_detId");
0105   if (me_noiseOccupancyEndcap_detId and me_rollAreaEndcap_detId) {
0106     TH1 *h_noiseOccupancyEndcap_detId = me_noiseOccupancyEndcap_detId->getTH1();
0107     TH1 *h_rollAreaEndcap_detId = me_rollAreaEndcap_detId->getTH1();
0108 
0109     for (int bin = 1, nBin = h_noiseOccupancyEndcap_detId->GetNbinsX(); bin <= nBin; ++bin) {
0110       const double noiseCount = h_noiseOccupancyEndcap_detId->GetBinContent(bin);
0111       const double area = h_rollAreaEndcap_detId->GetBinContent(bin);
0112       const double noiseLevel = area > 0 ? noiseCount / area / nEvent : 0;
0113       if (noiseLevel == 0)
0114         me_rollNoiseEndcap_noise->Fill(-maxNoise / 50);  // Fill underflow bin if noise if exactly zero
0115       else
0116         me_rollNoiseEndcap_noise->Fill(std::min(noiseLevel, maxNoise));
0117     }
0118   }
0119 }
0120 
0121 DEFINE_FWK_MODULE(RPCRecHitValidClient);