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  clusterSize->getTH1()->SetMinimum(0);
36  clusterSizeBarrel->getTH1()->SetMinimum(0);
37  clusterSizeEndcap->getTH1()->SetMinimum(0);
38 
39  avgClusterSize->getTH1()->SetMinimum(0);
40  avgClusterSizeBarrel->getTH1()->SetMinimum(0);
41  avgClusterSizeEndcap->getTH1()->SetMinimum(0);
42 
43  nRecHitBarrel->getTH1()->SetMinimum(0);
44  nRecHitEndcap->getTH1()->SetMinimum(0);
45 
46  nRefHitBarrel->getTH1()->SetMinimum(0);
47  nRefHitEndcap->getTH1()->SetMinimum(0);
48 
49  nMatchHitBarrel->getTH1()->SetMinimum(0);
50  nMatchHitEndcap->getTH1()->SetMinimum(0);
51 
52  // Occupancy 1D
53  booker.setCurrentFolder(subDir+"/Occupancy");
54  refHitOccupancyBarrel_wheel = booker.book1D("RefHitOccupancyBarrel_wheel" , "Reference Hit occupancy", 5, -2.5, 2.5);
55  refHitOccupancyEndcap_disk = booker.book1D("RefHitOccupancyEndcap_disk" , "Reference Hit occupancy", 9, -4.5, 4.5);
56  refHitOccupancyBarrel_station = booker.book1D("RefHitOccupancyBarrel_station", "Reference Hit occupancy", 4, 0.5, 4.5);
57 
58  recHitOccupancyBarrel_wheel = booker.book1D("RecHitOccupancyBarrel_wheel" , "RecHit occupancy", 5, -2.5, 2.5);
59  recHitOccupancyEndcap_disk = booker.book1D("RecHitOccupancyEndcap_disk" , "RecHit occupancy", 9, -4.5, 4.5);
60  recHitOccupancyBarrel_station = booker.book1D("RecHitOccupancyBarrel_station", "RecHit occupancy", 4, 0.5, 4.5);
61 
62  matchOccupancyBarrel_wheel = booker.book1D("MatchOccupancyBarrel_wheel" , "Matched hit occupancy", 5, -2.5, 2.5);
63  matchOccupancyEndcap_disk = booker.book1D("MatchOccupancyEndcap_disk" , "Matched hit occupancy", 9, -4.5, 4.5);
64  matchOccupancyBarrel_station = booker.book1D("MatchOccupancyBarrel_station", "Matched hit occupancy", 4, 0.5, 4.5);
65 
66  umOccupancyBarrel_wheel = booker.book1D("UmOccupancyBarrel_wheel" , "Un-matched hit occupancy", 5, -2.5, 2.5);
67  umOccupancyEndcap_disk = booker.book1D("UmOccupancyEndcap_disk" , "Un-matched hit occupancy", 9, -4.5, 4.5);
68  umOccupancyBarrel_station = booker.book1D("UmOccupancyBarrel_station", "Un-matched hit occupancy", 4, 0.5, 4.5);
69 
70  refHitOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
71  refHitOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
72  refHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
73 
74  recHitOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
75  recHitOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
76  recHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
77 
78  matchOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
79  matchOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
80  matchOccupancyBarrel_station->getTH1()->SetMinimum(0);
81 
82  umOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
83  umOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
84  umOccupancyBarrel_station->getTH1()->SetMinimum(0);
85 
86  // Occupancy 2D
87  refHitOccupancyBarrel_wheel_station = booker.book2D("RefHitOccupancyBarrel_wheel_station", "Reference hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
88  refHitOccupancyEndcap_disk_ring = booker.book2D("RefHitOccupancyEndcap_disk_ring" , "Reference hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
89 
90  recHitOccupancyBarrel_wheel_station = booker.book2D("RecHitOccupancyBarrel_wheel_station", "RecHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
91  recHitOccupancyEndcap_disk_ring = booker.book2D("RecHitOccupancyEndcap_disk_ring" , "RecHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
92 
93  matchOccupancyBarrel_wheel_station = booker.book2D("MatchOccupancyBarrel_wheel_station", "Matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
94  matchOccupancyEndcap_disk_ring = booker.book2D("MatchOccupancyEndcap_disk_ring" , "Matched hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
95 
96  umOccupancyBarrel_wheel_station = booker.book2D("UmOccupancyBarrel_wheel_station", "Un-matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
97  umOccupancyEndcap_disk_ring = booker.book2D("UmOccupancyEndcap_disk_ring" , "Un-matched hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
98 
100  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
101 
103  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
104 
106  matchOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
107 
108  umOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
109  umOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
110 
111  // Residuals
112  booker.setCurrentFolder(subDir+"/Residual");
113  resBarrel = booker.book1D("ResBarrel", "Global Residuals for Barrel;Residual [cm]" , 100, -8, 8);
114  resEndcap = booker.book1D("ResEndcap", "Global Residuals for Endcap;Residual [cm]" , 100, -8, 8);
115 
116  resBarrel->getTH1()->SetMinimum(0);
117  resEndcap->getTH1()->SetMinimum(0);
118 
119  res_wheel_res = booker.book2D("Res_wheel_res" , "Residuals vs Wheel;;Residual [cm]", 5, -2.5, 2.5, 50, -8, 8);
120  res_disk_res = booker.book2D("Res_disk_res" , "Residuals vs Disk;;Residual [cm]", 9, -4.5, 4.5, 50, -8, 8);
121  res_station_res = booker.book2D("Res_station_res", "Redisuals vs Station;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
122  res_ring_res = booker.book2D("Res_ring_res" , "Redisuals vs Ring;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
123 
124  res_wheel_res ->getTH2F()->SetMinimum(0);
125  res_disk_res ->getTH2F()->SetMinimum(0);
126  res_station_res->getTH2F()->SetMinimum(0);
127  res_ring_res ->getTH2F()->SetMinimum(0);
128 
129  // Pulls
130  pullBarrel = booker.book1D("PullBarrel", "Global Pull for Barrel;Pull", 100, -3, 3);
131  pullEndcap = booker.book1D("PullEndcap", "Global Pull for Endcap;Pull", 100, -3, 3);
132 
133  pullBarrel->getTH1()->SetMinimum(0);
134  pullEndcap->getTH1()->SetMinimum(0);
135 
136  pull_wheel_pull = booker.book2D("Pull_wheel_pull" , "Pull vs Wheel;;Pull" , 5, -2.5, 2.5, 50, -3, 3);
137  pull_disk_pull = booker.book2D("Pull_disk_pull" , "Pull vs Disk;;Pull" , 9, -4.5, 4.5, 50, -3, 3);
138  pull_station_pull = booker.book2D("Pull_station_pull", "Pull vs Station;;Pull", 4, 0.5, 4.5, 50, -3, 3);
139  pull_ring_pull = booker.book2D("Pull_ring_pull" , "Pull vs Ring;;Pull" , 4, 0.5, 4.5, 50, -3, 3);
140 
141  pull_wheel_pull ->getTH2F()->SetMinimum(0);
142  pull_disk_pull ->getTH2F()->SetMinimum(0);
143  pull_station_pull->getTH2F()->SetMinimum(0);
144  pull_ring_pull ->getTH2F()->SetMinimum(0);
145 
146  // Set plot options
147  refHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
148  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
149  recHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
150  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
151  matchOccupancyBarrel_wheel_station ->getTH2F()->SetOption("COLZ");
152  matchOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
153  umOccupancyBarrel_wheel_station ->getTH2F()->SetOption("COLZ");
154  umOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
155 
156  res_wheel_res ->getTH2F()->SetOption("COLZ");
157  res_disk_res ->getTH2F()->SetOption("COLZ");
158  res_station_res->getTH2F()->SetOption("COLZ");
159  res_ring_res ->getTH2F()->SetOption("COLZ");
160 
161  pull_wheel_pull ->getTH2F()->SetOption("COLZ");
162  pull_disk_pull ->getTH2F()->SetOption("COLZ");
163  pull_station_pull->getTH2F()->SetOption("COLZ");
164  pull_ring_pull ->getTH2F()->SetOption("COLZ");
165 
166  refHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
167  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
168  recHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
169  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
170  matchOccupancyBarrel_wheel_station ->getTH2F()->SetContour(10);
171  matchOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
172  umOccupancyBarrel_wheel_station ->getTH2F()->SetContour(10);
173  umOccupancyEndcap_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 
186  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
188  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
190  matchOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
191  umOccupancyBarrel_wheel_station ->getTH2F()->SetStats(0);
192  umOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
193 
194  res_wheel_res ->getTH2F()->SetStats(0);
195  res_disk_res ->getTH2F()->SetStats(0);
196  res_station_res->getTH2F()->SetStats(0);
197  res_ring_res ->getTH2F()->SetStats(0);
198 
199  pull_wheel_pull ->getTH2F()->SetStats(0);
200  pull_disk_pull ->getTH2F()->SetStats(0);
201  pull_station_pull->getTH2F()->SetStats(0);
202  pull_ring_pull ->getTH2F()->SetStats(0);
203 
204  // Set bin labels
205  for ( int i=1; i<=5; ++i )
206  {
207  TString binLabel = Form("Wheel %d", i-3);
208 
209  refHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
210  recHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
211  matchOccupancyBarrel_wheel ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
212  umOccupancyBarrel_wheel ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
213 
214  refHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
215  recHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
216  matchOccupancyBarrel_wheel_station ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
217  umOccupancyBarrel_wheel_station ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
218 
219  res_wheel_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
220  pull_wheel_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
221  }
222 
223  for ( int i=1; i<=9; ++i )
224  {
225  TString binLabel = Form("Disk %d", i-5);
226 
227  refHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
228  recHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
229  matchOccupancyEndcap_disk ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
230  umOccupancyEndcap_disk ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
231 
232  refHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
233  recHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
234  matchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
235  umOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
236 
237  res_disk_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
238  pull_disk_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
239  }
240 
241  for ( int i=1; i<=4; ++i )
242  {
243  TString binLabel = Form("Station %d", i);
244 
245  refHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
246  recHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
247  matchOccupancyBarrel_station ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
248  umOccupancyBarrel_station ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
249 
250  refHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
251  recHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
252  matchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
253  umOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
254 
255  res_station_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
256  pull_station_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
257  }
258 
259  for ( int i=1; i<=4; ++i )
260  {
261  TString binLabel = Form("Ring %d", i);
262 
263  refHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
264  recHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
265  matchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
266  umOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
267  }
268 
269  booked_ = true;
270 
271  booker.setCurrentFolder(pwd);
272 }
273 
int i
Definition: DBlmapReader.cc:9
const std::string & pwd(void)
Definition: DQMStore.cc:285
void bookHistograms(DQMStore::IBooker &booker, const std::string &subDir)
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
TH1 * getTH1(void) const
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
TH1F * getTH1F(void) const
TH2F * getTH2F(void) const