CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCRecHitValidClient.cc
Go to the documentation of this file.
2 
4 
7 
8 using namespace std;
9 
11 
13 {
14  subDir_ = pset.getParameter<std::string>("subDir");
15 }
16 
18 {
20  if ( !dbe ) return;
21 
22  dbe->setCurrentFolder(subDir_);
23  MEP me_rollEfficiencyBarrel_eff = dbe->book1D("RollEfficiencyBarrel_eff", "Roll efficiency in Barrel;Efficiency [%]", 50+2, -2, 100+2);
24  MEP me_rollEfficiencyEndcap_eff = dbe->book1D("RollEfficiencyEndcap_eff", "Roll efficiency in Endcap;Efficiency [%]", 50+2, -2, 100+2);
25  MEP me_rollEfficiencyStatCutOffBarrel_eff = dbe->book1D("RollEfficiencyCutOffBarrel_eff", "Roll efficiency in Barrel without low stat chamber;Efficiency [%]", 50+2, -2, 100+2);
26  MEP me_rollEfficiencyStatCutOffEndcap_eff = dbe->book1D("RollEfficiencyCutOffEndcap_eff", "Roll efficiency in Endcap without low stat chamber;Efficiency [%]", 50+2, -2, 100+2);
27 
28  const double maxNoise = 1e-7;
29  MEP me_rollNoiseBarrel_noise = dbe->book1D("RollNoiseBarrel_noise", "Roll noise in Barrel;Noise level [Event^{-1}cm^{-2}]", 25+2, -maxNoise/25, maxNoise+maxNoise/25);
30  MEP me_rollNoiseEndcap_noise = dbe->book1D("RollNoiseEndcap_noise", "Roll noise in Endcap;Noise level [Event^{-1}cm^{-2}]", 25+2, -maxNoise/25, maxNoise+maxNoise/25);
31 
32  MEP me_matchOccupancyBarrel_detId = dbe->get(subDir_+"/Occupancy/MatchOccupancyBarrel_detId");
33  MEP me_matchOccupancyEndcap_detId = dbe->get(subDir_+"/Occupancy/MatchOccupancyEndcap_detId");
34  MEP me_refOccupancyBarrel_detId = dbe->get(subDir_+"/Occupancy/RefOccupancyBarrel_detId");
35  MEP me_refOccupancyEndcap_detId = dbe->get(subDir_+"/Occupancy/RefOccupancyEndcap_detId");
36 
37  if ( me_matchOccupancyBarrel_detId and me_refOccupancyBarrel_detId )
38  {
39  TH1* h_matchOccupancyBarrel_detId = me_matchOccupancyBarrel_detId->getTH1();
40  TH1* h_refOccupancyBarrel_detId = me_refOccupancyBarrel_detId->getTH1();
41 
42  for ( int bin = 1, nBin = h_matchOccupancyBarrel_detId->GetNbinsX(); bin <= nBin; ++bin )
43  {
44  const double nRec = h_matchOccupancyBarrel_detId->GetBinContent(bin);
45  const double nRef = h_refOccupancyBarrel_detId->GetBinContent(bin);
46 
47  const double eff = nRef ? nRec/nRef*100 : -1;
48 
49  me_rollEfficiencyBarrel_eff->Fill(eff);
50  if ( nRef >= 20 ) me_rollEfficiencyStatCutOffBarrel_eff->Fill(eff);
51  }
52  }
53 
54  if ( me_matchOccupancyEndcap_detId and me_refOccupancyEndcap_detId )
55  {
56  TH1* h_matchOccupancyEndcap_detId = me_matchOccupancyEndcap_detId->getTH1();
57  TH1* h_refOccupancyEndcap_detId = me_refOccupancyEndcap_detId->getTH1();
58 
59  for ( int bin = 1, nBin = h_matchOccupancyEndcap_detId->GetNbinsX(); bin <= nBin; ++bin )
60  {
61  const double nRec = h_matchOccupancyEndcap_detId->GetBinContent(bin);
62  const double nRef = h_refOccupancyEndcap_detId->GetBinContent(bin);
63 
64  const double eff = nRef ? nRec/nRef*100 : -1;
65 
66  me_rollEfficiencyEndcap_eff->Fill(eff);
67  if ( nRef >= 20 ) me_rollEfficiencyStatCutOffEndcap_eff->Fill(eff);
68  }
69  }
70 
71  MEP me_eventCount = dbe->get(subDir_+"/Occupancy/EventCount");
72  const double nEvent = me_eventCount ? me_eventCount->getTH1()->GetBinContent(1) : 1;
73  MEP me_noiseOccupancyBarrel_detId = dbe->get(subDir_+"/Occupancy/NoiseOccupancyBarrel_detId");
74  MEP me_rollAreaBarrel_detId = dbe->get(subDir_+"/Occupancy/RollAreaBarrel_detId");
75  if ( me_noiseOccupancyBarrel_detId and me_rollAreaBarrel_detId )
76  {
77  TH1* h_noiseOccupancyBarrel_detId = me_noiseOccupancyBarrel_detId->getTH1();
78  TH1* h_rollAreaBarrel_detId = me_rollAreaBarrel_detId->getTH1();
79 
80  for ( int bin = 1, nBin = h_noiseOccupancyBarrel_detId->GetNbinsX(); bin <= nBin; ++bin )
81  {
82  const double noiseCount = h_noiseOccupancyBarrel_detId->GetBinContent(bin);
83  const double area = h_rollAreaBarrel_detId->GetBinContent(bin);
84  const double noiseLevel = area > 0 ? noiseCount/area/nEvent : 0;
85  if ( noiseLevel == 0. ) me_rollNoiseBarrel_noise->Fill(-maxNoise/50); // Fill underflow bin if noise is exactly zero
86  else me_rollNoiseBarrel_noise->Fill(std::min(noiseLevel, maxNoise));
87  }
88  }
89 
90  MEP me_noiseOccupancyEndcap_detId = dbe->get(subDir_+"/Occupancy/NoiseOccupancyEndcap_detId");
91  MEP me_rollAreaEndcap_detId = dbe->get(subDir_+"/Occupancy/RollAreaEndcap_detId");
92  if ( me_noiseOccupancyEndcap_detId and me_rollAreaEndcap_detId )
93  {
94  TH1* h_noiseOccupancyEndcap_detId = me_noiseOccupancyEndcap_detId->getTH1();
95  TH1* h_rollAreaEndcap_detId = me_rollAreaEndcap_detId->getTH1();
96 
97  for ( int bin = 1, nBin = h_noiseOccupancyEndcap_detId->GetNbinsX(); bin <= nBin; ++bin )
98  {
99  const double noiseCount = h_noiseOccupancyEndcap_detId->GetBinContent(bin);
100  const double area = h_rollAreaEndcap_detId->GetBinContent(bin);
101  const double noiseLevel = area > 0 ? noiseCount/area/nEvent : 0;
102  if ( noiseLevel == 0 ) me_rollNoiseEndcap_noise->Fill(-maxNoise/50); // Fill underflow bin if noise if exactly zero
103  else me_rollNoiseEndcap_noise->Fill(std::min(noiseLevel, maxNoise));
104  }
105  }
106 
107 }
108 
110 
T getParameter(std::string const &) const
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:717
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
#define min(a, b)
Definition: mlp_lapack.h:161
int nEvent
Definition: myFastSimVal.cc:49
void Fill(long long x)
MonitorElement * MEP
void endRun(const edm::Run &run, const edm::EventSetup &eventSetup)
TH1 * getTH1(void) const
MonitorElement * get(const std::string &path) const
get ME from full pathname (e.g. &quot;my/long/dir/my_histo&quot;)
Definition: DQMStore.cc:1468
RPCRecHitValidClient(const edm::ParameterSet &pset)
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
Definition: Run.h:33