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);
66 DQMStore::IBooker& booker,
const T& key, Int_t ieta,
const char* name,
const char* title);
76 const char* x_title =
"",
77 const char* y_title =
"Entries");
90 const char* x_title =
"",
91 const char* y_title =
"");
108 template <
typename T>
111 const char* name_prefix,
112 const char* title_prefix) {
118 Int_t station_id = std::get<1>(
key);
123 TString
name = TString::Format(
"%s_occ_zr%s", name_prefix, name_suffix.Data());
124 TString
title = TString::Format(
"%s ZR Occupancy :%s;|Z| #[cm];R [cm]", title_prefix, title_suffix.Data());
128 UInt_t nbins_start = 2 * (station_id - 1);
133 UInt_t range_start = 4 * (station_id - 1);
141 return booker.
book2D(name, title, nbinsx, xlow, xup, nbinsy, ylow, yup);
144 template <
typename T>
147 const char* name_prefix,
148 const char* title_prefix) {
151 TString
name = TString::Format(
"%s_occ_xy%s", name_prefix, name_suffix.Data());
152 TString
title = TString::Format(
"%s XY Occupancy :%s;X [cm];Y [cm]", title_prefix, title_suffix.Data());
156 template <
typename T>
159 const char* name_prefix,
160 const char* title_prefix) {
163 TString
name = TString::Format(
"%s_occ_polar%s", name_prefix, name_suffix.Data());
164 TString
title = TString::Format(
"%s Polar Occupancy :%s", title_prefix, title_suffix.Data());
171 template <
typename T>
175 const char* name_prefix,
176 const char* title_prefix) {
180 TString
name = TString::Format(
"%s_occ_det%s", name_prefix, name_suffix.Data());
181 TString
title = TString::Format(
"%s Occupancy for detector component :%s", title_prefix, title_suffix.Data());
183 std::vector<const GEMSuperChamber*> superchambers = station->
superChambers();
185 Int_t num_superchambers = superchambers.size();
186 Int_t num_chambers = 0;
188 if (num_superchambers > 0) {
189 num_chambers = superchambers.front()->nChambers();
190 if (num_chambers > 0)
191 nbinsy = superchambers.front()->chambers().front()->nEtaPartitions();
193 Int_t nbinsx = num_superchambers * num_chambers;
199 auto hist =
new TH2F(name, title, nbinsx, 1 - 0.5, nbinsx + 0.5, nbinsy, 1 - 0.5, nbinsy + 0.5);
200 hist->GetXaxis()->SetTitle(
"Chamber-Layer");
201 hist->GetYaxis()->SetTitle(
"Eta Partition");
203 TAxis* x_axis =
hist->GetXaxis();
204 for (Int_t chamber_id = 1; chamber_id <= num_superchambers; chamber_id++) {
205 for (Int_t layer_id = 1; layer_id <= num_chambers; layer_id++) {
207 TString
label = TString::Format(
"C%dL%d", chamber_id, layer_id);
208 x_axis->SetBinLabel(bin, label);
212 TAxis* y_axis =
hist->GetYaxis();
213 for (Int_t
bin = 1;
bin <= nbinsy;
bin++) {
214 y_axis->SetBinLabel(
bin, TString::Itoa(
bin, 10));
220 template <
typename T>
227 TString x_title =
"Particle Type";
228 TString y_title =
"Particles";
229 TString hist_name = TString::Format(
"%s%s", name, name_suffix.Data());
230 TString hist_title = TString::Format(
"%s :%s;%s;%s", title, title_suffix.Data(), x_title.Data(), y_title.Data());
232 auto hist = booker.
book1D(hist_name, hist_title, nbinsx + 1, 0, nbinsx + 1);
233 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
234 for (Int_t idx = 0; idx < nbinsx; idx++) {
236 auto particle_name = pdgDB->GetParticle(
pid_list_[idx])->GetName();
237 hist->setBinLabel(bin, particle_name);
239 hist->setBinLabel(nbinsx + 1,
"others");
243 template <
typename T>
248 TString x_title =
"Particle Type";
249 TString y_title =
"Particles";
250 TString hist_name = TString::Format(
"%s%s-E%d", name, name_suffix.Data(), ieta);
252 TString::Format(
"%s :%s-E%d;%s;%s", title, title_suffix.Data(), ieta, x_title.Data(), y_title.Data());
254 auto hist = booker.
book1D(hist_name, hist_title, nbinsx + 1, 0, nbinsx + 1);
255 TDatabasePDG* pdgDB = TDatabasePDG::Instance();
256 for (Int_t idx = 0; idx < nbinsx; idx++) {
258 auto particle_name = pdgDB->GetParticle(
pid_list_[idx])->GetName();
259 hist->setBinLabel(bin, particle_name);
261 hist->setBinLabel(nbinsx + 1,
"others");
265 template <
typename T>
274 const char* y_title) {
277 TString hist_name = TString::Format(
"%s%s", name, name_suffix.Data());
278 TString hist_title = TString::Format(
"%s :%s;%s;%s", title, title_suffix.Data(), x_title, y_title);
279 return booker.
book1D(hist_name, hist_title, nbinsx, xlow, xup);
282 template <
typename T>
294 const char* y_title) {
297 TString hist_name = TString::Format(
"%s%s", name, name_suffix.Data());
298 TString hist_title = TString::Format(
"%s :%s;%s;%s", title, title_suffix.Data(), x_title, y_title);
299 return booker.
book2D(hist_name, hist_title, nbinsx, xlow, xup, nbinsy, ylow, yup);
302 #endif // Validation_MuonGEMHits_GEMBaseValidation_h
dqm::impl::MonitorElement * bookHist1D(DQMStore::IBooker &booker, const T &key, const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, const char *x_title="", const char *y_title="Entries")
TString getSuffixName(Int_t region_id)
Bool_t isMuonSimHit(const PSimHit &)
std::vector< Int_t > zr_occ_num_bins_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomTokenBeginRun_
Log< level::Error, false > LogError
dqm::impl::MonitorElement * bookZROccupancy(DQMStore::IBooker &booker, Int_t region_id, const char *name_prfix, const char *title_prefix)
TString getSuffixTitle(Int_t region_id)
std::vector< const GEMSuperChamber * > superChambers() const
Return the super chambers in the region.
~GEMBaseValidation() override=0
dqm::impl::MonitorElement * bookXYOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
std::vector< Int_t > pid_list_
Int_t getPidIdx(Int_t pid)
tuple key
prepare the HTCondor submission files and eventually submit them
std::vector< Double_t > eta_range_
void analyze(const edm::Event &e, const edm::EventSetup &) override=0
dqm::impl::MonitorElement * bookHist2D(DQMStore::IBooker &booker, const T &key, const char *name, const char *title, Int_t nbinsx, Double_t xlow, Double_t xup, Int_t nbinsy, Double_t ylow, Double_t yup, const char *x_title="", const char *y_title="")
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
GEMBaseValidation(const edm::ParameterSet &, std::string)
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, FUNC onbooking=NOOP())
Float_t toDegree(Float_t radian)
std::vector< Double_t > zr_occ_range_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Int_t getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id)
dqm::impl::MonitorElement * bookPIDHist(DQMStore::IBooker &booker, const T &key, const char *name, const char *title)
const std::string kLogCategory_
dqm::impl::MonitorElement * bookPolarOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
dqm::impl::MonitorElement * bookDetectorOccupancy(DQMStore::IBooker &booker, const T &key, const GEMStation *station, const char *name_prfix, const char *title_prefix)