CMS 3D CMS Logo

RPCValidHistograms.cc
Go to the documentation of this file.
2 
3 #include "TAxis.h"
4 
6 {
7  if ( booked_ )
8  {
9  edm::LogError("RPCValidHistograms") << "Histogram is already booked\n";
10  return;
11  }
12 
13  const std::string pwd = booker.pwd();
14  booker.setCurrentFolder(subDir);
15 
16  // Book histograms
17  booker.setCurrentFolder(subDir+"/HitProperty");
18  clusterSize = booker.book1D("ClusterSize", "Cluster size;Cluster size", 11, -0.5, 10.5);
19  clusterSizeBarrel = booker.book1D("ClusterSizeBarrel", "Cluster size in Barrel;Cluster size", 11, -0.5, 10.5);
20  clusterSizeEndcap = booker.book1D("ClusterSizeEndcap", "Cluster size in Endcap;Cluster size", 11, -0.5, 10.5);
21 
22  avgClusterSize = booker.book1D("AverageClusterSize", "Average cluster size;Average clsuter size", 11, -0.5, 10.5);
23  avgClusterSizeBarrel = booker.book1D("AverageClusterSizeBarrel", "Average cluster size in Barrel;Average clsuter size", 11, -0.5, 10.5);
24  avgClusterSizeEndcap = booker.book1D("AverageClusterSizeEndcap", "Average cluster size in Endcap;Average clsuter size", 11, -0.5, 10.5);
25 
26  nRecHitBarrel = booker.book1D("NRecHitBarrel", "Number of RPC recHits per event in Barrel;Number of RPC hits", 25, 0, 25);
27  nRecHitEndcap = booker.book1D("NRecHitEndcap", "Number of RPC recHits per event in Endcap;Number of RPC hits", 25, 0, 25);
28 
29  nRefHitBarrel = booker.book1D("NRefHitBarrel", "Number of reference hits per event in Barrel;Number of RPC hits", 25, 0, 25);
30  nRefHitEndcap = booker.book1D("NRefHitEndcap", "Number of reference hits per event in Endcap;Number of RPC hits", 25, 0, 25);
31 
32  nMatchHitBarrel = booker.book1D("nMatchBarrel", "Number of matched reference hits per event in Barrel;Number of RPC hits", 25, 0, 25);
33  nMatchHitEndcap = booker.book1D("nMatchEndcap", "Number of matched reference hits per event in Endcap;Number of RPC hits", 25, 0, 25);
34 
35  timeBarrel = booker.book1D("RecHitTimeBarrel", "RecHit time in Barrel;Time (ns)", 100, -12.5, 12.5);
36  timeEndcap = booker.book1D("RecHitTimeEndcap", "RecHit time in Endcap;Time (ns)", 100, -12.5, 12.5);
37  timeIRPC = booker.book1D("RecHitTimeIRPC", "RecHit time of iRPC;Time (ns)", 100, -12.5, 12.5);
38  timeCRPC = booker.book1D("RecHitTimeCPRC", "RecHit time in current RPC;Time (ns)", 100, -12.5, 12.5);
39 
40  clusterSize->getTH1()->SetMinimum(0);
41  clusterSizeBarrel->getTH1()->SetMinimum(0);
42  clusterSizeEndcap->getTH1()->SetMinimum(0);
43 
44  avgClusterSize->getTH1()->SetMinimum(0);
45  avgClusterSizeBarrel->getTH1()->SetMinimum(0);
46  avgClusterSizeEndcap->getTH1()->SetMinimum(0);
47 
48  nRecHitBarrel->getTH1()->SetMinimum(0);
49  nRecHitEndcap->getTH1()->SetMinimum(0);
50 
51  nRefHitBarrel->getTH1()->SetMinimum(0);
52  nRefHitEndcap->getTH1()->SetMinimum(0);
53 
54  nMatchHitBarrel->getTH1()->SetMinimum(0);
55  nMatchHitEndcap->getTH1()->SetMinimum(0);
56 
57  // Occupancy 1D
58  booker.setCurrentFolder(subDir+"/Occupancy");
59  refHitOccupancyBarrel_wheel = booker.book1D("RefHitOccupancyBarrel_wheel" , "Reference Hit occupancy", 5, -2.5, 2.5);
60  refHitOccupancyEndcap_disk = booker.book1D("RefHitOccupancyEndcap_disk" , "Reference Hit occupancy", 9, -4.5, 4.5);
61  refHitOccupancyBarrel_station = booker.book1D("RefHitOccupancyBarrel_station", "Reference Hit occupancy", 4, 0.5, 4.5);
62 
63  recHitOccupancyBarrel_wheel = booker.book1D("RecHitOccupancyBarrel_wheel" , "RecHit occupancy", 5, -2.5, 2.5);
64  recHitOccupancyEndcap_disk = booker.book1D("RecHitOccupancyEndcap_disk" , "RecHit occupancy", 9, -4.5, 4.5);
65  recHitOccupancyBarrel_station = booker.book1D("RecHitOccupancyBarrel_station", "RecHit occupancy", 4, 0.5, 4.5);
66 
67  matchOccupancyBarrel_wheel = booker.book1D("MatchOccupancyBarrel_wheel" , "Matched hit occupancy", 5, -2.5, 2.5);
68  matchOccupancyEndcap_disk = booker.book1D("MatchOccupancyEndcap_disk" , "Matched hit occupancy", 9, -4.5, 4.5);
69  matchOccupancyBarrel_station = booker.book1D("MatchOccupancyBarrel_station", "Matched hit occupancy", 4, 0.5, 4.5);
70 
71  refHitOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
72  refHitOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
73  refHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
74 
75  recHitOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
76  recHitOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
77  recHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
78 
79  matchOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
80  matchOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
81  matchOccupancyBarrel_station->getTH1()->SetMinimum(0);
82 
83  // Occupancy 2D
84  refHitOccupancyBarrel_wheel_station = booker.book2D("RefHitOccupancyBarrel_wheel_station", "Reference hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
85  refHitOccupancyEndcap_disk_ring = booker.book2D("RefHitOccupancyEndcap_disk_ring" , "Reference hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
86 
87  recHitOccupancyBarrel_wheel_station = booker.book2D("RecHitOccupancyBarrel_wheel_station", "RecHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
88  recHitOccupancyEndcap_disk_ring = booker.book2D("RecHitOccupancyEndcap_disk_ring" , "RecHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
89 
90  matchOccupancyBarrel_wheel_station = booker.book2D("MatchOccupancyBarrel_wheel_station", "Matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
91  matchOccupancyEndcap_disk_ring = booker.book2D("MatchOccupancyEndcap_disk_ring" , "Matched hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
92 
94  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
95 
97  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
98 
100  matchOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
101 
102  // Residuals
103  booker.setCurrentFolder(subDir+"/Residual");
104  resBarrel = booker.book1D("ResBarrel", "Global Residuals for Barrel;Residual [cm]" , 100, -8, 8);
105  resEndcap = booker.book1D("ResEndcap", "Global Residuals for Endcap;Residual [cm]" , 100, -8, 8);
106 
107  resBarrel->getTH1()->SetMinimum(0);
108  resEndcap->getTH1()->SetMinimum(0);
109 
110  res_wheel_res = booker.book2D("Res_wheel_res" , "Residuals vs Wheel;;Residual [cm]", 5, -2.5, 2.5, 50, -8, 8);
111  res_disk_res = booker.book2D("Res_disk_res" , "Residuals vs Disk;;Residual [cm]", 9, -4.5, 4.5, 50, -8, 8);
112  res_station_res = booker.book2D("Res_station_res", "Redisuals vs Station;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
113  res_ring_res = booker.book2D("Res_ring_res" , "Redisuals vs Ring;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
114 
115  res_wheel_res ->getTH2F()->SetMinimum(0);
116  res_disk_res ->getTH2F()->SetMinimum(0);
117  res_station_res->getTH2F()->SetMinimum(0);
118  res_ring_res ->getTH2F()->SetMinimum(0);
119 
120  // Pulls
121  pullBarrel = booker.book1D("PullBarrel", "Global Pull for Barrel;Pull", 100, -3, 3);
122  pullEndcap = booker.book1D("PullEndcap", "Global Pull for Endcap;Pull", 100, -3, 3);
123 
124  pullBarrel->getTH1()->SetMinimum(0);
125  pullEndcap->getTH1()->SetMinimum(0);
126 
127  pull_wheel_pull = booker.book2D("Pull_wheel_pull" , "Pull vs Wheel;;Pull" , 5, -2.5, 2.5, 50, -3, 3);
128  pull_disk_pull = booker.book2D("Pull_disk_pull" , "Pull vs Disk;;Pull" , 9, -4.5, 4.5, 50, -3, 3);
129  pull_station_pull = booker.book2D("Pull_station_pull", "Pull vs Station;;Pull", 4, 0.5, 4.5, 50, -3, 3);
130  pull_ring_pull = booker.book2D("Pull_ring_pull" , "Pull vs Ring;;Pull" , 4, 0.5, 4.5, 50, -3, 3);
131 
132  pull_wheel_pull ->getTH2F()->SetMinimum(0);
133  pull_disk_pull ->getTH2F()->SetMinimum(0);
134  pull_station_pull->getTH2F()->SetMinimum(0);
135  pull_ring_pull ->getTH2F()->SetMinimum(0);
136 
137  // Set plot options
138  refHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
139  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
140  recHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
141  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
142  matchOccupancyBarrel_wheel_station ->getTH2F()->SetOption("COLZ");
143  matchOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
144 
145  res_wheel_res ->getTH2F()->SetOption("COLZ");
146  res_disk_res ->getTH2F()->SetOption("COLZ");
147  res_station_res->getTH2F()->SetOption("COLZ");
148  res_ring_res ->getTH2F()->SetOption("COLZ");
149 
150  pull_wheel_pull ->getTH2F()->SetOption("COLZ");
151  pull_disk_pull ->getTH2F()->SetOption("COLZ");
152  pull_station_pull->getTH2F()->SetOption("COLZ");
153  pull_ring_pull ->getTH2F()->SetOption("COLZ");
154 
155  refHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
156  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
157  recHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
158  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
159  matchOccupancyBarrel_wheel_station ->getTH2F()->SetContour(10);
160  matchOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
161 
162  res_wheel_res ->getTH2F()->SetContour(10);
163  res_disk_res ->getTH2F()->SetContour(10);
164  res_station_res->getTH2F()->SetContour(10);
165  res_ring_res ->getTH2F()->SetContour(10);
166 
167  pull_wheel_pull ->getTH2F()->SetContour(10);
168  pull_disk_pull ->getTH2F()->SetContour(10);
169  pull_station_pull->getTH2F()->SetContour(10);
170  pull_ring_pull ->getTH2F()->SetContour(10);
171 
172  refHitOccupancyBarrel_wheel_station->getTH2F()->SetStats(false);
173  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetStats(false);
174  recHitOccupancyBarrel_wheel_station->getTH2F()->SetStats(false);
175  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetStats(false);
176  matchOccupancyBarrel_wheel_station ->getTH2F()->SetStats(false);
177  matchOccupancyEndcap_disk_ring ->getTH2F()->SetStats(false);
178 
179  res_wheel_res ->getTH2F()->SetStats(false);
180  res_disk_res ->getTH2F()->SetStats(false);
181  res_station_res->getTH2F()->SetStats(false);
182  res_ring_res ->getTH2F()->SetStats(false);
183 
184  pull_wheel_pull ->getTH2F()->SetStats(false);
185  pull_disk_pull ->getTH2F()->SetStats(false);
186  pull_station_pull->getTH2F()->SetStats(false);
187  pull_ring_pull ->getTH2F()->SetStats(false);
188 
189  // Set bin labels
190  for ( int i=1; i<=5; ++i )
191  {
192  TString binLabel = Form("Wheel %d", i-3);
193 
194  refHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
195  recHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
196  matchOccupancyBarrel_wheel ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
197 
198  refHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
199  recHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
200  matchOccupancyBarrel_wheel_station ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
201 
202  res_wheel_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
203  pull_wheel_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
204  }
205 
206  for ( int i=1; i<=9; ++i )
207  {
208  TString binLabel = Form("Disk %d", i-5);
209 
210  refHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
211  recHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
212  matchOccupancyEndcap_disk ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
213 
214  refHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
215  recHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
216  matchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
217 
218  res_disk_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
219  pull_disk_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
220  }
221 
222  for ( int i=1; i<=4; ++i )
223  {
224  TString binLabel = Form("Station %d", i);
225 
226  refHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
227  recHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
228  matchOccupancyBarrel_station ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
229 
230  refHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
231  recHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
232  matchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
233 
234  res_station_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
235  pull_station_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
236  }
237 
238  for ( int i=1; i<=4; ++i )
239  {
240  TString binLabel = Form("Ring %d", i);
241 
242  refHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
243  recHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
244  matchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
245  }
246 
247  booked_ = true;
248 
249  booker.setCurrentFolder(pwd);
250 }
251 
TH1F * getTH1F() const
TH1 * getTH1() const
void bookHistograms(DQMStore::IBooker &booker, const std::string &subDir)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:118
TH2F * getTH2F() const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:279
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:136
const std::string & pwd()
Definition: DQMStore.cc:287