1 #ifndef Validation_MuonGEMHits_GEMBaseValidation_h
2 #define Validation_MuonGEMHits_GEMBaseValidation_h
17 #include "TDatabasePDG.h"
26 Int_t
getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id);
33 const char* name_prfix,
34 const char* title_prefix);
39 const char* name_prfix,
40 const char* title_prefix);
45 const char* name_prefix,
46 const char* title_prefix);
51 const char* name_prefix,
52 const char* title_prefix);
58 const char* name_prfix,
59 const char* title_prefix);
72 const char* x_title =
"",
73 const char* y_title =
"Entries");
86 const char* x_title =
"",
87 const char* y_title =
"");
104 template <
typename T>
107 const char* name_prefix,
108 const char* title_prefix) {
114 Int_t station_id = std::get<1>(
key);
119 TString
name = TString::Format(
"%s_occ_zr%s", name_prefix, name_suffix.Data());
120 TString
title = TString::Format(
"%s ZR Occupancy :%s;|Z| #[cm];R [cm]", title_prefix, title_suffix.Data());
124 UInt_t nbins_start = 2 * (station_id - 1);
129 UInt_t range_start = 4 * (station_id - 1);
137 return booker.
book2D(
name,
title, nbinsx, xlow, xup, nbinsy, ylow, yup);
140 template <
typename T>
143 const char* name_prefix,
144 const char* title_prefix) {
147 TString
name = TString::Format(
"%s_occ_xy%s", name_prefix, name_suffix.Data());
148 TString
title = TString::Format(
"%s XY Occupancy :%s;X [cm];Y [cm]", title_prefix, title_suffix.Data());
152 template <
typename T>
155 const char* name_prefix,
156 const char* title_prefix) {
159 TString
name = TString::Format(
"%s_occ_polar%s", name_prefix, name_suffix.Data());
160 TString
title = TString::Format(
"%s Polar Occupancy :%s", title_prefix, title_suffix.Data());
167 template <
typename T>
171 const char* name_prefix,
172 const char* title_prefix) {
176 TString
name = TString::Format(
"%s_occ_det%s", name_prefix, name_suffix.Data());
177 TString
title = TString::Format(
"%s Occupancy for detector component :%s", title_prefix, title_suffix.Data());
179 std::vector<const GEMSuperChamber*> superchambers =
station->superChambers();
181 Int_t num_superchambers = superchambers.size();
182 Int_t num_chambers = 0;
184 if (num_superchambers > 0) {
185 num_chambers = superchambers.front()->nChambers();
186 if (num_chambers > 0)
187 nbinsy = superchambers.front()->chambers().front()->nEtaPartitions();
189 Int_t nbinsx = num_superchambers * num_chambers;
195 auto hist =
new TH2F(
name,
title, nbinsx, 1 - 0.5, nbinsx + 0.5, nbinsy, 1 - 0.5, nbinsy + 0.5);
196 hist->GetXaxis()->SetTitle(
"Chamber-Layer");
197 hist->GetYaxis()->SetTitle(
"Eta Partition");
199 TAxis* x_axis =
hist->GetXaxis();
200 for (Int_t chamber_id = 1; chamber_id <= num_superchambers; chamber_id++) {
201 for (Int_t layer_id = 1; layer_id <= num_chambers; layer_id++) {
203 TString
label = TString::Format(
"C%dL%d", chamber_id, layer_id);
208 TAxis* y_axis =
hist->GetYaxis();
209 for (Int_t
bin = 1;
bin <= nbinsy;
bin++) {
210 y_axis->SetBinLabel(
bin, TString::Itoa(
bin, 10));
216 template <
typename T>
223 TString x_title =
"Particle Name";
224 TString y_title =
"Entries";
225 TString hist_name = TString::Format(
"%s%s",
name, name_suffix.Data());
226 TString hist_title = TString::Format(
"%s :%s;%s;%s",
title, title_suffix.Data(), x_title.Data(), y_title.Data());
228 auto hist = booker.
book1D(hist_name, hist_title, nbinsx + 1, 0, nbinsx + 1);
229 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
230 for (Int_t
idx = 0;
idx < nbinsx;
idx++) {
232 auto particle_name = pdgDB->GetParticle(
pid_list_[
idx])->GetName();
233 hist->setBinLabel(
bin, particle_name);
235 hist->setBinLabel(nbinsx + 1,
"others");
239 template <
typename T>
248 const char* y_title) {
251 TString hist_name = TString::Format(
"%s%s",
name, name_suffix.Data());
252 TString hist_title = TString::Format(
"%s :%s;%s;%s",
title, title_suffix.Data(), x_title, y_title);
253 return booker.
book1D(hist_name, hist_title, nbinsx, xlow, xup);
256 template <
typename T>
268 const char* y_title) {
271 TString hist_name = TString::Format(
"%s%s",
name, name_suffix.Data());
272 TString hist_title = TString::Format(
"%s :%s;%s;%s",
title, title_suffix.Data(), x_title, y_title);
273 return booker.
book2D(hist_name, hist_title, nbinsx, xlow, xup, nbinsy, ylow, yup);
276 #endif // Validation_MuonGEMHits_GEMBaseValidation_h