CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCValidHistograms.cc
Go to the documentation of this file.
2 
3 #include "TAxis.h"
4 
6 {
7  if ( !dbe )
8  {
9  edm::LogError("RPCValidHistograms") << "DBE not initialized\n";
10  return;
11  }
12  if ( booked_ )
13  {
14  edm::LogError("RPCValidHistograms") << "Histogram is already booked\n";
15  return;
16  }
17 
18  const std::string pwd = dbe->pwd();
19  dbe->setCurrentFolder(subDir);
20 
21  // Book histograms
22  dbe->setCurrentFolder(subDir+"/HitProperty");
23  clusterSize = dbe->book1D("ClusterSize", "Cluster size;Cluster size", 11, -0.5, 10.5);
24  clusterSizeBarrel = dbe->book1D("ClusterSizeBarrel", "Cluster size in Barrel;Cluster size", 11, -0.5, 10.5);
25  clusterSizeEndcap = dbe->book1D("ClusterSizeEndcap", "Cluster size in Endcap;Cluster size", 11, -0.5, 10.5);
26 
27  avgClusterSize = dbe->book1D("AverageClusterSize", "Average cluster size;Average clsuter size", 11, -0.5, 10.5);
28  avgClusterSizeBarrel = dbe->book1D("AverageClusterSizeBarrel", "Average cluster size in Barrel;Average clsuter size", 11, -0.5, 10.5);
29  avgClusterSizeEndcap = dbe->book1D("AverageClusterSizeEndcap", "Average cluster size in Endcap;Average clsuter size", 11, -0.5, 10.5);
30 
31  nRecHitBarrel = dbe->book1D("NRecHitBarrel", "Number of RPC recHits per event in Barrel;Number of RPC hits", 25, 0, 25);
32  nRecHitEndcap = dbe->book1D("NRecHitEndcap", "Number of RPC recHits per event in Endcap;Number of RPC hits", 25, 0, 25);
33 
34  nRefHitBarrel = dbe->book1D("NRefHitBarrel", "Number of reference hits per event in Barrel;Number of RPC hits", 25, 0, 25);
35  nRefHitEndcap = dbe->book1D("NRefHitEndcap", "Number of reference hits per event in Endcap;Number of RPC hits", 25, 0, 25);
36 
37  nMatchHitBarrel = dbe->book1D("nMatchBarrel", "Number of matched reference hits per event in Barrel;Number of RPC hits", 25, 0, 25);
38  nMatchHitEndcap = dbe->book1D("nMatchEndcap", "Number of matched reference hits per event in Endcap;Number of RPC hits", 25, 0, 25);
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  dbe->setCurrentFolder(subDir+"/Occupancy");
59  refHitOccupancyBarrel_wheel = dbe->book1D("RefHitOccupancyBarrel_wheel" , "Reference Hit occupancy", 5, -2.5, 2.5);
60  refHitOccupancyEndcap_disk = dbe->book1D("RefHitOccupancyEndcap_disk" , "Reference Hit occupancy", 9, -4.5, 4.5);
61  refHitOccupancyBarrel_station = dbe->book1D("RefHitOccupancyBarrel_station", "Reference Hit occupancy", 4, 0.5, 4.5);
62 
63  recHitOccupancyBarrel_wheel = dbe->book1D("RecHitOccupancyBarrel_wheel" , "RecHit occupancy", 5, -2.5, 2.5);
64  recHitOccupancyEndcap_disk = dbe->book1D("RecHitOccupancyEndcap_disk" , "RecHit occupancy", 9, -4.5, 4.5);
65  recHitOccupancyBarrel_station = dbe->book1D("RecHitOccupancyBarrel_station", "RecHit occupancy", 4, 0.5, 4.5);
66 
67  matchOccupancyBarrel_wheel = dbe->book1D("MatchOccupancyBarrel_wheel" , "Matched hit occupancy", 5, -2.5, 2.5);
68  matchOccupancyEndcap_disk = dbe->book1D("MatchOccupancyEndcap_disk" , "Matched hit occupancy", 9, -4.5, 4.5);
69  matchOccupancyBarrel_station = dbe->book1D("MatchOccupancyBarrel_station", "Matched hit occupancy", 4, 0.5, 4.5);
70 
71  umOccupancyBarrel_wheel = dbe->book1D("UmOccupancyBarrel_wheel" , "Un-matched hit occupancy", 5, -2.5, 2.5);
72  umOccupancyEndcap_disk = dbe->book1D("UmOccupancyEndcap_disk" , "Un-matched hit occupancy", 9, -4.5, 4.5);
73  umOccupancyBarrel_station = dbe->book1D("UmOccupancyBarrel_station", "Un-matched hit occupancy", 4, 0.5, 4.5);
74 
75  refHitOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
76  refHitOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
77  refHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
78 
79  recHitOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
80  recHitOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
81  recHitOccupancyBarrel_station->getTH1()->SetMinimum(0);
82 
83  matchOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
84  matchOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
85  matchOccupancyBarrel_station->getTH1()->SetMinimum(0);
86 
87  umOccupancyBarrel_wheel ->getTH1()->SetMinimum(0);
88  umOccupancyEndcap_disk ->getTH1()->SetMinimum(0);
89  umOccupancyBarrel_station->getTH1()->SetMinimum(0);
90 
91  // Occupancy 2D
92  refHitOccupancyBarrel_wheel_station = dbe->book2D("RefHitOccupancyBarrel_wheel_station", "Reference hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
93  refHitOccupancyEndcap_disk_ring = dbe->book2D("RefHitOccupancyEndcap_disk_ring" , "Reference hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
94 
95  recHitOccupancyBarrel_wheel_station = dbe->book2D("RecHitOccupancyBarrel_wheel_station", "RecHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
96  recHitOccupancyEndcap_disk_ring = dbe->book2D("RecHitOccupancyEndcap_disk_ring" , "RecHit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
97 
98  matchOccupancyBarrel_wheel_station = dbe->book2D("MatchOccupancyBarrel_wheel_station", "Matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
99  matchOccupancyEndcap_disk_ring = dbe->book2D("MatchOccupancyEndcap_disk_ring" , "Matched hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
100 
101  umOccupancyBarrel_wheel_station = dbe->book2D("UmOccupancyBarrel_wheel_station", "Un-matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
102  umOccupancyEndcap_disk_ring = dbe->book2D("UmOccupancyEndcap_disk_ring" , "Un-matched hit occupancy", 9, -4.5, 4.5, 4, 0.5, 4.5);
103 
105  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
106 
108  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
109 
111  matchOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
112 
113  umOccupancyBarrel_wheel_station->getTH2F()->SetMinimum(0);
114  umOccupancyEndcap_disk_ring ->getTH2F()->SetMinimum(0);
115 
116  // Residuals
117  dbe->setCurrentFolder(subDir+"/Residual");
118  resBarrel = dbe->book1D("ResBarrel", "Global Residuals for Barrel;Residual [cm]" , 100, -8, 8);
119  resEndcap = dbe->book1D("ResEndcap", "Global Residuals for Endcap;Residual [cm]" , 100, -8, 8);
120 
121  resBarrel->getTH1()->SetMinimum(0);
122  resEndcap->getTH1()->SetMinimum(0);
123 
124  res_wheel_res = dbe->book2D("Res_wheel_res" , "Residuals vs Wheel;;Residual [cm]", 5, -2.5, 2.5, 50, -8, 8);
125  res_disk_res = dbe->book2D("Res_disk_res" , "Residuals vs Disk;;Residual [cm]", 9, -4.5, 4.5, 50, -8, 8);
126  res_station_res = dbe->book2D("Res_station_res", "Redisuals vs Station;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
127  res_ring_res = dbe->book2D("Res_ring_res" , "Redisuals vs Ring;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
128 
129  res_wheel_res ->getTH2F()->SetMinimum(0);
130  res_disk_res ->getTH2F()->SetMinimum(0);
131  res_station_res->getTH2F()->SetMinimum(0);
132  res_ring_res ->getTH2F()->SetMinimum(0);
133 
134  // Pulls
135  pullBarrel = dbe->book1D("PullBarrel", "Global Pull for Barrel;Pull", 100, -3, 3);
136  pullEndcap = dbe->book1D("PullEndcap", "Global Pull for Endcap;Pull", 100, -3, 3);
137 
138  pullBarrel->getTH1()->SetMinimum(0);
139  pullEndcap->getTH1()->SetMinimum(0);
140 
141  pull_wheel_pull = dbe->book2D("Pull_wheel_pull" , "Pull vs Wheel;;Pull" , 5, -2.5, 2.5, 50, -3, 3);
142  pull_disk_pull = dbe->book2D("Pull_disk_pull" , "Pull vs Disk;;Pull" , 9, -4.5, 4.5, 50, -3, 3);
143  pull_station_pull = dbe->book2D("Pull_station_pull", "Pull vs Station;;Pull", 4, 0.5, 4.5, 50, -3, 3);
144  pull_ring_pull = dbe->book2D("Pull_ring_pull" , "Pull vs Ring;;Pull" , 4, 0.5, 4.5, 50, -3, 3);
145 
146  pull_wheel_pull ->getTH2F()->SetMinimum(0);
147  pull_disk_pull ->getTH2F()->SetMinimum(0);
148  pull_station_pull->getTH2F()->SetMinimum(0);
149  pull_ring_pull ->getTH2F()->SetMinimum(0);
150 
151  // Set plot options
152  refHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
153  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
154  recHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
155  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
156  matchOccupancyBarrel_wheel_station ->getTH2F()->SetOption("COLZ");
157  matchOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
158  umOccupancyBarrel_wheel_station ->getTH2F()->SetOption("COLZ");
159  umOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
160 
161  res_wheel_res ->getTH2F()->SetOption("COLZ");
162  res_disk_res ->getTH2F()->SetOption("COLZ");
163  res_station_res->getTH2F()->SetOption("COLZ");
164  res_ring_res ->getTH2F()->SetOption("COLZ");
165 
166  pull_wheel_pull ->getTH2F()->SetOption("COLZ");
167  pull_disk_pull ->getTH2F()->SetOption("COLZ");
168  pull_station_pull->getTH2F()->SetOption("COLZ");
169  pull_ring_pull ->getTH2F()->SetOption("COLZ");
170 
171  refHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
172  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
173  recHitOccupancyBarrel_wheel_station->getTH2F()->SetContour(10);
174  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
175  matchOccupancyBarrel_wheel_station ->getTH2F()->SetContour(10);
176  matchOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
177  umOccupancyBarrel_wheel_station ->getTH2F()->SetContour(10);
178  umOccupancyEndcap_disk_ring ->getTH2F()->SetContour(10);
179 
180  res_wheel_res ->getTH2F()->SetContour(10);
181  res_disk_res ->getTH2F()->SetContour(10);
182  res_station_res->getTH2F()->SetContour(10);
183  res_ring_res ->getTH2F()->SetContour(10);
184 
185  pull_wheel_pull ->getTH2F()->SetContour(10);
186  pull_disk_pull ->getTH2F()->SetContour(10);
187  pull_station_pull->getTH2F()->SetContour(10);
188  pull_ring_pull ->getTH2F()->SetContour(10);
189 
191  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
193  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
195  matchOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
196  umOccupancyBarrel_wheel_station ->getTH2F()->SetStats(0);
197  umOccupancyEndcap_disk_ring ->getTH2F()->SetStats(0);
198 
199  res_wheel_res ->getTH2F()->SetStats(0);
200  res_disk_res ->getTH2F()->SetStats(0);
201  res_station_res->getTH2F()->SetStats(0);
202  res_ring_res ->getTH2F()->SetStats(0);
203 
204  pull_wheel_pull ->getTH2F()->SetStats(0);
205  pull_disk_pull ->getTH2F()->SetStats(0);
206  pull_station_pull->getTH2F()->SetStats(0);
207  pull_ring_pull ->getTH2F()->SetStats(0);
208 
209  // Set bin labels
210  for ( int i=1; i<=5; ++i )
211  {
212  TString binLabel = Form("Wheel %d", i-3);
213 
214  refHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
215  recHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
216  matchOccupancyBarrel_wheel ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
217  umOccupancyBarrel_wheel ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
218 
219  refHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
220  recHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
221  matchOccupancyBarrel_wheel_station ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
222  umOccupancyBarrel_wheel_station ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
223 
224  res_wheel_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
225  pull_wheel_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
226  }
227 
228  for ( int i=1; i<=9; ++i )
229  {
230  TString binLabel = Form("Disk %d", i-5);
231 
232  refHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
233  recHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
234  matchOccupancyEndcap_disk ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
235  umOccupancyEndcap_disk ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
236 
237  refHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
238  recHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
239  matchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
240  umOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
241 
242  res_disk_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
243  pull_disk_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
244  }
245 
246  for ( int i=1; i<=4; ++i )
247  {
248  TString binLabel = Form("Station %d", i);
249 
250  refHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
251  recHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
252  matchOccupancyBarrel_station ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
253  umOccupancyBarrel_station ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
254 
255  refHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
256  recHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
257  matchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
258  umOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
259 
260  res_station_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
261  pull_station_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
262  }
263 
264  for ( int i=1; i<=4; ++i )
265  {
266  TString binLabel = Form("Ring %d", i);
267 
268  refHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
269  recHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
270  matchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
271  umOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
272  }
273 
274  dbe->setCurrentFolder(pwd);
275  booked_ = true;
276 }
277 
int i
Definition: DBlmapReader.cc:9
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
void bookHistograms(DQMStore *dbe, const std::string subDir)
TH1 * getTH1(void) const
TH1F * getTH1F(void) const
TH2F * getTH2F(void) const
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:1000
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
const std::string & pwd(void) const
Definition: DQMStore.cc:556