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 }
dqm::impl
Definition: MonitorElement.h:74
GEMBaseValidation::zr_occ_range_
std::vector< Double_t > zr_occ_range_
Definition: GEMBaseValidation.h:93
dqm::impl::MonitorElement
Definition: MonitorElement.h:98
Handle.h
runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
GEMBaseValidation.h
mps_fire.i
i
Definition: mps_fire.py:428
GEMBaseValidation::xy_occ_num_bins_
Int_t xy_occ_num_bins_
Definition: GEMBaseValidation.h:90
GEMBaseValidation::zr_occ_num_bins_
std::vector< Int_t > zr_occ_num_bins_
Definition: GEMBaseValidation.h:92
MessageLogger.h
GEMBaseValidation::detail_plot_
Bool_t detail_plot_
Definition: GEMBaseValidation.h:95
min
T min(T a, T b)
Definition: MathUtil.h:58
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
GEMUtils::getSuffixName
TString getSuffixName(Int_t region_id)
Definition: GEMValidationUtils.cc:5
GEMBaseValidation::isMuonSimHit
Bool_t isMuonSimHit(const PSimHit &)
Definition: GEMBaseValidation.cc:28
GEMBaseValidation::bookZROccupancy
dqm::impl::MonitorElement * bookZROccupancy(DQMStore::IBooker &booker, Int_t region_id, const char *name_prfix, const char *title_prefix)
Definition: GEMBaseValidation.cc:42
GEMBaseValidation::~GEMBaseValidation
~GEMBaseValidation() override=0
Definition: GEMBaseValidation.cc:22
GEMEtaPartitionSpecs.h
edm::ParameterSet
Definition: ParameterSet.h:47
GEMBaseValidation::GEMBaseValidation
GEMBaseValidation(const edm::ParameterSet &, std::string)
Definition: GEMBaseValidation.cc:10
GEMBaseValidation::pid_list_
std::vector< Int_t > pid_list_
Definition: GEMBaseValidation.h:91
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
gpuVertexFinder::hist
__shared__ Hist hist
Definition: gpuClusterTracksDBSCAN.h:48
GEMBaseValidation::eta_range_
std::vector< Double_t > eta_range_
Definition: GEMBaseValidation.h:94
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
GEMBaseValidation::getPidIdx
Int_t getPidIdx(Int_t pid)
Definition: GEMBaseValidation.cc:38
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
GEMBaseValidation::kMuonPDGId_
const Int_t kMuonPDGId_
Definition: GEMBaseValidation.h:98
dqm::implementation::IBooker::book2D
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:177
GEMUtils::getSuffixTitle
TString getSuffixTitle(Int_t region_id)
Definition: GEMValidationUtils.cc:34
GEMBaseValidation::toDegree
Float_t toDegree(Float_t radian)
Definition: GEMBaseValidation.cc:30
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
PSimHit::particleType
int particleType() const
Definition: PSimHit.h:89
dqm::implementation::IBooker
Definition: DQMStore.h:43
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
PSimHit
Definition: PSimHit.h:15
GEMBaseValidation::getDetOccBinX
Int_t getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id)
Definition: GEMBaseValidation.cc:24