CMS 3D CMS Logo

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