CMS 3D CMS Logo

GEMBaseValidation.cc
Go to the documentation of this file.
5 
6 #include <memory>
7 
8 using namespace dqm::impl;
9 
11  : kLogCategory_(log_category) {
12  pid_list_ = ps.getUntrackedParameter<std::vector<Int_t> >("pidList");
13  zr_occ_num_bins_ = ps.getUntrackedParameter<std::vector<Int_t> >("ZROccNumBins");
14  zr_occ_range_ = ps.getUntrackedParameter<std::vector<Double_t> >("ZROccRange");
15  xy_occ_num_bins_ = ps.getUntrackedParameter<Int_t>("XYOccNumBins", 360);
16  // TODO depends on the station.. for detail plots..
17  eta_range_ = ps.getUntrackedParameter<std::vector<Double_t> >("EtaOccRange");
18 
19  detail_plot_ = ps.getParameter<Bool_t>("detailPlot");
20 }
21 
23 
24 Int_t GEMBaseValidation::getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id) {
25  return num_layers * chamber_id + layer_id - num_layers;
26 }
27 
28 Bool_t GEMBaseValidation::isMuonSimHit(const PSimHit& simhit) { return std::abs(simhit.particleType()) == kMuonPDGId_; }
29 
30 Float_t GEMBaseValidation::toDegree(Float_t radian) {
31  Float_t degree = radian / M_PI * 180;
32  if (degree < -5)
33  return degree + 360;
34  else
35  return degree;
36 }
37 
38 Int_t GEMBaseValidation::getPidIdx(Int_t pid) {
39  return std::find(pid_list_.begin(), pid_list_.end(), pid) - pid_list_.begin();
40 }
41 
43  Int_t region_id,
44  const char* name_prefix,
45  const char* title_prefix) {
46  auto name_suffix = GEMUtils::getSuffixName(region_id);
47  auto title_suffix = GEMUtils::getSuffixTitle(region_id);
48 
49  TString name = TString::Format("%s_occ_zr%s", name_prefix, name_suffix.Data());
50  TString title = TString::Format("%s ZR Occupancy :%s;|Z| [cm];R [cm]", title_prefix, title_suffix.Data());
51 
52  Double_t station0_xmin = zr_occ_range_[0];
53  Double_t station0_xmax = zr_occ_range_[1];
54  Double_t station1_xmin = zr_occ_range_[4];
55  Double_t station1_xmax = zr_occ_range_[5];
56  Double_t station2_xmin = zr_occ_range_[8];
57  Double_t station2_xmax = zr_occ_range_[9];
58 
59  std::vector<Double_t> xbins_vector;
60  for (Double_t i = station0_xmin - 1; i < station2_xmax + 1; i += 0.25) {
61  if (i > station0_xmax + 1 and i < station1_xmin - 1)
62  continue;
63  if (i > station1_xmax + 1 and i < station2_xmin - 1)
64  continue;
65  xbins_vector.push_back(i);
66  }
67 
68  Int_t nbinsx = xbins_vector.size() - 1;
69 
70  Int_t nbinsy = zr_occ_num_bins_[2];
71  Double_t ylow = std::min(zr_occ_range_[2], std::min(zr_occ_range_[6], zr_occ_range_[10]));
72  Double_t yup = std::max(zr_occ_range_[3], std::max(zr_occ_range_[7], zr_occ_range_[11]));
73 
74  auto hist = new TH2F(name, title, nbinsx, &xbins_vector[0], nbinsy, ylow, yup);
75  return booker.book2D(name, hist);
76 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
TString getSuffixName(Int_t region_id)
Bool_t isMuonSimHit(const PSimHit &)
std::vector< Int_t > zr_occ_num_bins_
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)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
T getUntrackedParameter(std::string const &, T const &) const
~GEMBaseValidation() override=0
std::vector< Int_t > pid_list_
Int_t getPidIdx(Int_t pid)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< Double_t > eta_range_
#define M_PI
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())
Definition: DQMStore.h:221
Float_t toDegree(Float_t radian)
std::vector< Double_t > zr_occ_range_
int particleType() const
Definition: PSimHit.h:91
Int_t getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id)