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 
5 void RPCValidHistograms::bookHistograms(DQMStore* dbe, const std::string subDir)
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  // Occupancy 1D
41  dbe->setCurrentFolder(subDir+"/Occupancy");
42  refHitOccupancyBarrel_wheel = dbe->book1D("RefHitOccupancyBarrel_wheel" , "Reference Hit occupancy", 5, -2.5, 2.5);
43  refHitOccupancyEndcap_disk = dbe->book1D("RefHitOccupancyEndcap_disk" , "Reference Hit occupancy", 7, -3.5, 3.5);
44  refHitOccupancyBarrel_station = dbe->book1D("RefHitOccupancyBarrel_station", "Reference Hit occupancy", 4, 0.5, 4.5);
45 
46  recHitOccupancyBarrel_wheel = dbe->book1D("RecHitOccupancyBarrel_wheel" , "RecHit occupancy", 5, -2.5, 2.5);
47  recHitOccupancyEndcap_disk = dbe->book1D("RecHitOccupancyEndcap_disk" , "RecHit occupancy", 7, -3.5, 3.5);
48  recHitOccupancyBarrel_station = dbe->book1D("RecHitOccupancyBarrel_station", "RecHit occupancy", 4, 0.5, 4.5);
49 
50  matchOccupancyBarrel_wheel = dbe->book1D("MatchOccupancyBarrel_wheel" , "Matched hit occupancy", 5, -2.5, 2.5);
51  matchOccupancyEndcap_disk = dbe->book1D("MatchOccupancyEndcap_disk" , "Matched hit occupancy", 7, -3.5, 3.5);
52  matchOccupancyBarrel_station = dbe->book1D("MatchOccupancyBarrel_station", "Matched hit occupancy", 4, 0.5, 4.5);
53 
54  umOccupancyBarrel_wheel = dbe->book1D("UmOccupancyBarrel_wheel" , "Un-matched hit occupancy", 5, -2.5, 2.5);
55  umOccupancyEndcap_disk = dbe->book1D("UmOccupancyEndcap_disk" , "Un-matched hit occupancy", 7, -3.5, 3.5);
56  umOccupancyBarrel_station = dbe->book1D("UmOccupancyBarrel_station", "Un-matched hit occupancy", 4, 0.5, 4.5);
57 
58  // Occupancy 2D
59  refHitOccupancyBarrel_wheel_station = dbe->book2D("RefHitOccupancyBarrel_wheel_station", "Reference hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
60  refHitOccupancyEndcap_disk_ring = dbe->book2D("RefHitOccupancyEndcap_disk_ring" , "Reference hit occupancy", 7, -3.5, 3.5, 4, 0.5, 4.5);
61 
62  recHitOccupancyBarrel_wheel_station = dbe->book2D("RecHitOccupancyBarrel_wheel_station", "RecHit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
63  recHitOccupancyEndcap_disk_ring = dbe->book2D("RecHitOccupancyEndcap_disk_ring" , "RecHit occupancy", 7, -3.5, 3.5, 4, 0.5, 4.5);
64 
65  matchOccupancyBarrel_wheel_station = dbe->book2D("MatchOccupancyBarrel_wheel_station", "Matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
66  matchOccupancyEndcap_disk_ring = dbe->book2D("MatchOccupancyEndcap_disk_ring" , "Matched hit occupancy", 7, -3.5, 3.5, 4, 0.5, 4.5);
67 
68  umOccupancyBarrel_wheel_station = dbe->book2D("UmOccupancyBarrel_wheel_station", "Un-matched hit occupancy", 5, -2.5, 2.5, 4, 0.5, 4.5);
69  umOccupancyEndcap_disk_ring = dbe->book2D("UmOccupancyEndcap_disk_ring" , "Un-matched hit occupancy", 7, -3.5, 3.5, 4, 0.5, 4.5);
70 
71  // Residuals
72  dbe->setCurrentFolder(subDir+"/Residual");
73  resBarrel = dbe->book1D("ResBarrel", "Global Residuals for Barrel;Residual [cm]" , 100, -8, 8);
74  resEndcap = dbe->book1D("ResEndcap", "Global Residuals for Endcap;Residual [cm]" , 100, -8, 8);
75 
76  res_wheel_res = dbe->book2D("Res_wheel_res" , "Residuals vs Wheel;;Residual [cm]", 5, -2.5, 2.5, 50, -8, 8);
77  res_disk_res = dbe->book2D("Res_disk_res" , "Residuals vs Disk;;Residual [cm]", 7, -3.5, 3.5, 50, -8, 8);
78  res_station_res = dbe->book2D("Res_station_res", "Redisuals vs Station;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
79  res_ring_res = dbe->book2D("Res_ring_res" , "Redisuals vs Ring;;Residual [cm]", 4, 0.5, 4.5, 50, -8, 8);
80 
81  // Pulls
82  pullBarrel = dbe->book1D("PullBarrel", "Global Pull for Barrel;Pull", 100, -3, 3);
83  pullEndcap = dbe->book1D("PullEndcap", "Global Pull for Endcap;Pull", 100, -3, 3);
84 
85  pull_wheel_pull = dbe->book2D("Pull_wheel_pull" , "Pull vs Wheel;;Pull" , 5, -2.5, 2.5, 50, -3, 3);
86  pull_disk_pull = dbe->book2D("Pull_disk_pull" , "Pull vs Disk;;Pull" , 7, -3.5, 3.5, 50, -3, 3);
87  pull_station_pull = dbe->book2D("Pull_station_pull", "Pull vs Station;;Pull", 4, 0.5, 4.5, 50, -3, 3);
88  pull_ring_pull = dbe->book2D("Pull_ring_pull" , "Pull vs Ring;;Pull" , 4, 0.5, 4.5, 50, -3, 3);
89 
90  // Set plot options
91  refHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
92  refHitOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
93  recHitOccupancyBarrel_wheel_station->getTH2F()->SetOption("COLZ");
94  recHitOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
95  matchOccupancyBarrel_wheel_station ->getTH2F()->SetOption("COLZ");
96  matchOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
97  umOccupancyBarrel_wheel_station ->getTH2F()->SetOption("COLZ");
98  umOccupancyEndcap_disk_ring ->getTH2F()->SetOption("COLZ");
99 
100  res_wheel_res ->getTH2F()->SetOption("COLZ");
101  res_disk_res ->getTH2F()->SetOption("COLZ");
102  res_station_res->getTH2F()->SetOption("COLZ");
103  res_ring_res ->getTH2F()->SetOption("COLZ");
104 
105  pull_wheel_pull ->getTH2F()->SetOption("COLZ");
106  pull_disk_pull ->getTH2F()->SetOption("COLZ");
107  pull_station_pull->getTH2F()->SetOption("COLZ");
108  pull_ring_pull ->getTH2F()->SetOption("COLZ");
109 
110  // Set bin labels
111  for ( int i=1; i<=5; ++i )
112  {
113  TString binLabel = Form("Wheel %d", i-3);
114 
115  refHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
116  recHitOccupancyBarrel_wheel->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
117  matchOccupancyBarrel_wheel ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
118  umOccupancyBarrel_wheel ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
119 
120  refHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
121  recHitOccupancyBarrel_wheel_station->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
122  matchOccupancyBarrel_wheel_station ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
123  umOccupancyBarrel_wheel_station ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
124 
125  res_wheel_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
126  pull_wheel_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
127  }
128 
129  for ( int i=1; i<=7; ++i )
130  {
131  TString binLabel = Form("Disk %d", i-4);
132 
133  refHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
134  recHitOccupancyEndcap_disk->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
135  matchOccupancyEndcap_disk ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
136  umOccupancyEndcap_disk ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
137 
138  refHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
139  recHitOccupancyEndcap_disk_ring->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
140  matchOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
141  umOccupancyEndcap_disk_ring ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
142 
143  res_disk_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
144  pull_disk_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
145  }
146 
147  for ( int i=1; i<=4; ++i )
148  {
149  TString binLabel = Form("Station %d", i);
150 
151  refHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
152  recHitOccupancyBarrel_station->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
153  matchOccupancyBarrel_station ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
154  umOccupancyBarrel_station ->getTH1F()->GetXaxis()->SetBinLabel(i, binLabel);
155 
156  refHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
157  recHitOccupancyBarrel_wheel_station->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
158  matchOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
159  umOccupancyBarrel_wheel_station ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
160 
161  res_station_res ->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
162  pull_station_pull->getTH2F()->GetXaxis()->SetBinLabel(i, binLabel);
163  }
164 
165  for ( int i=1; i<=4; ++i )
166  {
167  TString binLabel = Form("Ring %d", i);
168 
169  refHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
170  recHitOccupancyEndcap_disk_ring->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
171  matchOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
172  umOccupancyEndcap_disk_ring ->getTH2F()->GetYaxis()->SetBinLabel(i, binLabel);
173  }
174 
175  dbe->setCurrentFolder(pwd);
176  booked_ = true;
177 }
178 
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:717
void bookHistograms(DQMStore *dbe, const std::string subDir)
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:845
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
const std::string & pwd(void) const
Definition: DQMStore.cc:401