CMS 3D CMS Logo

RPCRecHitValidClient.cc
Go to the documentation of this file.
2 
4 
7 
8 using namespace std;
9 
11 
13  subDir_ = pset.getParameter<std::string>("subDir");
14 }
15 
17  booker.setCurrentFolder(subDir_);
18  MEP me_rollEfficiencyBarrel_eff =
19  booker.book1D("RollEfficiencyBarrel_eff", "Roll efficiency in Barrel;Efficiency [%]", 50 + 2, -2, 100 + 2);
20  MEP me_rollEfficiencyEndcap_eff =
21  booker.book1D("RollEfficiencyEndcap_eff", "Roll efficiency in Endcap;Efficiency [%]", 50 + 2, -2, 100 + 2);
22 
23  const double maxNoise = 1e-7;
24  MEP me_rollNoiseBarrel_noise = booker.book1D("RollNoiseBarrel_noise",
25  "Roll noise in Barrel;Noise level [Event^{-1}cm^{-2}]",
26  25 + 2,
27  -maxNoise / 25,
28  maxNoise + maxNoise / 25);
29  MEP me_rollNoiseEndcap_noise = booker.book1D("RollNoiseEndcap_noise",
30  "Roll noise in Endcap;Noise level [Event^{-1}cm^{-2}]",
31  25 + 2,
32  -maxNoise / 25,
33  maxNoise + maxNoise / 25);
34 
35  MEP me_matchOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/MatchOccupancyBarrel_detId");
36  MEP me_matchOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/MatchOccupancyEndcap_detId");
37  MEP me_refOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/RefOccupancyBarrel_detId");
38  MEP me_refOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/RefOccupancyEndcap_detId");
39 
40  if (me_matchOccupancyBarrel_detId and me_refOccupancyBarrel_detId) {
41  TH1 *h_matchOccupancyBarrel_detId = me_matchOccupancyBarrel_detId->getTH1();
42  TH1 *h_refOccupancyBarrel_detId = me_refOccupancyBarrel_detId->getTH1();
43 
44  for (int bin = 1, nBin = h_matchOccupancyBarrel_detId->GetNbinsX(); bin <= nBin; ++bin) {
45  const double nRec = h_matchOccupancyBarrel_detId->GetBinContent(bin);
46  const double nRef = h_refOccupancyBarrel_detId->GetBinContent(bin);
47 
48  const double eff = nRef ? nRec / nRef * 100 : -1;
49 
50  me_rollEfficiencyBarrel_eff->Fill(eff);
51  }
52  }
53 
54  if (me_matchOccupancyEndcap_detId and me_refOccupancyEndcap_detId) {
55  TH1 *h_matchOccupancyEndcap_detId = me_matchOccupancyEndcap_detId->getTH1();
56  TH1 *h_refOccupancyEndcap_detId = me_refOccupancyEndcap_detId->getTH1();
57 
58  for (int bin = 1, nBin = h_matchOccupancyEndcap_detId->GetNbinsX(); bin <= nBin; ++bin) {
59  const double nRec = h_matchOccupancyEndcap_detId->GetBinContent(bin);
60  const double nRef = h_refOccupancyEndcap_detId->GetBinContent(bin);
61 
62  const double eff = nRef ? nRec / nRef * 100 : -1;
63 
64  me_rollEfficiencyEndcap_eff->Fill(eff);
65  }
66  }
67 
68  MEP me_eventCount = getter.get(subDir_ + "/Occupancy/EventCount");
69  const double nEvent = me_eventCount ? me_eventCount->getTH1()->GetBinContent(1) : 1;
70  MEP me_allOccupancyBarrel_detId = getter.get(subDir_ + "/Occupancy/OccupancyBarrel_detId");
71  MEP me_rollAreaBarrel_detId = getter.get(subDir_ + "/Occupancy/RollAreaBarrel_detId");
72  if (me_allOccupancyBarrel_detId and me_rollAreaBarrel_detId) {
73  TH1 *h_noiseOccupancyBarrel_detId = me_allOccupancyBarrel_detId->getTH1();
74  TH1 *h_rollAreaBarrel_detId = me_rollAreaBarrel_detId->getTH1();
75 
76  for (int bin = 1, nBin = h_noiseOccupancyBarrel_detId->GetNbinsX(); bin <= nBin; ++bin) {
77  const double noiseCount = h_noiseOccupancyBarrel_detId->GetBinContent(bin);
78  const double area = h_rollAreaBarrel_detId->GetBinContent(bin);
79  const double noiseLevel = area > 0 ? noiseCount / area / nEvent : 0;
80  if (noiseLevel == 0.)
81  me_rollNoiseBarrel_noise->Fill(-maxNoise / 50); // Fill underflow bin if noise is exactly zero
82  else
83  me_rollNoiseBarrel_noise->Fill(std::min(noiseLevel, maxNoise));
84  }
85  }
86 
87  MEP me_allOccupancyEndcap_detId = getter.get(subDir_ + "/Occupancy/OccupancyEndcap_detId");
88  MEP me_rollAreaEndcap_detId = getter.get(subDir_ + "/Occupancy/RollAreaEndcap_detId");
89  if (me_allOccupancyEndcap_detId and me_rollAreaEndcap_detId) {
90  TH1 *h_noiseOccupancyEndcap_detId = me_allOccupancyEndcap_detId->getTH1();
91  TH1 *h_rollAreaEndcap_detId = me_rollAreaEndcap_detId->getTH1();
92 
93  for (int bin = 1, nBin = h_noiseOccupancyEndcap_detId->GetNbinsX(); bin <= nBin; ++bin) {
94  const double noiseCount = h_noiseOccupancyEndcap_detId->GetBinContent(bin);
95  const double area = h_rollAreaEndcap_detId->GetBinContent(bin);
96  const double noiseLevel = area > 0 ? noiseCount / area / nEvent : 0;
97  if (noiseLevel == 0)
98  me_rollNoiseEndcap_noise->Fill(-maxNoise / 50); // Fill underflow bin if noise if exactly zero
99  else
100  me_rollNoiseEndcap_noise->Fill(std::min(noiseLevel, maxNoise));
101  }
102  }
103 }
104 
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
int nEvent
Definition: myFastSimVal.cc:44
void Fill(long long x)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
virtual MonitorElement * get(std::string const &fullpath) const
Definition: DQMStore.cc:712
RPCRecHitValidClient::MonitorElement * MEP
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
RPCRecHitValidClient(const edm::ParameterSet &pset)
void dqmEndJob(DQMStore::IBooker &booker, DQMStore::IGetter &getter) override