CMS 3D CMS Logo

GEMPadDigiClusterValidation.cc
Go to the documentation of this file.
2 #include <TMath.h>
3 
5  : GEMBaseValidation(pset, "GEMPadDigiClusterValidation") {
6  const auto& pad_cluster_pset = pset.getParameterSet("gemPadCluster");
7  const auto& pad_cluster_tag = pad_cluster_pset.getParameter<edm::InputTag>("inputTag");
8  pad_cluster_token_ = consumes<GEMPadDigiClusterCollection>(pad_cluster_tag);
9 }
10 
12  edm::Run const& Run,
13  edm::EventSetup const& setup) {
15 
16  // NOTE Occupancy
17  booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/PadCluster/Occupancy");
18  for (const auto& region : gem->regions()) {
19  Int_t region_id = region->region();
20 
21  me_occ_zr_.emplace(region_id, bookZROccupancy(booker, region_id, "pad", "Pad Cluster"));
22 
23  for (const auto& station : region->stations()) {
24  Int_t station_id = station->station();
25  ME2IdsKey key2{region_id, station_id};
26 
27  me_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "pad", "Pad Cluster");
28 
29  const auto& superChamberVec = station->superChambers();
30  if (superChamberVec.empty()) {
31  edm::LogError(kLogCategory_) << "Super chambers missing for region = " << region_id
32  << " and station = " << station_id;
33  continue;
34  }
35  const GEMSuperChamber* super_chamber = superChamberVec.front();
36  if (super_chamber == nullptr) {
37  edm::LogError(kLogCategory_) << "Failed to find super chamber for region = " << region_id
38  << " and station = " << station_id;
39  continue;
40  }
41  for (const auto& chamber : super_chamber->chambers()) {
42  Int_t layer_id = chamber->id().layer();
43  ME3IdsKey key3{region_id, station_id, layer_id};
44 
45  const auto& etaPartitionVec = chamber->etaPartitions();
46  if (etaPartitionVec.empty() || etaPartitionVec.front() == nullptr) {
48  << "Eta partition missing or null for region, station, super chamber, chamber = (" << region_id << ", "
49  << station_id << ", " << super_chamber->id() << ", " << chamber->id() << ")";
50  continue;
51  }
52  Int_t num_pads = etaPartitionVec.front()->npads();
53 
54  if (detail_plot_) {
55  me_detail_occ_xy_[key3] = bookXYOccupancy(booker, key3, "pad", "Pad Cluster");
56 
57  me_detail_occ_phi_pad_[key3] = bookHist2D(booker,
58  key3,
59  "occ_phi_pad",
60  "Pad Cluster Occupancy",
61  280,
62  -M_PI,
63  M_PI,
64  num_pads / 2,
65  0,
66  num_pads,
67  "#phi [rad]",
68  "Pad number");
69 
70  me_detail_occ_pad_[key3] =
71  bookHist1D(booker, key3, "occ_pad", "Pad Cluster Occupancy", num_pads, 0.5, num_pads + 0.5, "Pad number");
72  }
73  } // end loop over layer ids
74  } // end loop over station ids
75  } // end loop over region ids
76 
77  // NOTE Bunch Crossing
78  if (detail_plot_) {
79  booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/PadCluster/BunchCrossing");
80 
81  for (const auto& region : gem->regions()) {
82  Int_t region_id = region->region();
83  for (const auto& station : region->stations()) {
84  Int_t station_id = station->station();
85 
86  const auto& superChamberVec = station->superChambers();
87  if (superChamberVec.empty()) {
88  edm::LogError(kLogCategory_) << "Super chambers missing for region = " << region_id
89  << " and station = " << station_id;
90  continue;
91  }
92  const GEMSuperChamber* super_chamber = superChamberVec.front();
93  if (super_chamber == nullptr) {
94  edm::LogError(kLogCategory_) << "Failed to find super chamber for region = " << region_id
95  << " and station = " << station_id;
96  continue;
97  }
98  for (const auto& chamber : super_chamber->chambers()) {
99  Int_t layer_id = chamber->id().layer();
100  ME3IdsKey key3(region_id, station_id, layer_id);
101  me_detail_bx_[key3] =
102  bookHist1D(booker, key3, "bx", "Pad Cluster Bunch Crossing", 5, -2.5, 2.5, "Bunch crossing");
103  } // chamber loop
104  } // station loop
105  } // region loop
106  } // detail plot
107 }
108 
110 
112  const GEMGeometry* gem = initGeometry(setup);
113 
115  event.getByToken(pad_cluster_token_, collection);
116  if (not collection.isValid()) {
117  edm::LogError(kLogCategory_) << "Cannot get pads by label GEMPadToken.";
118  return;
119  }
120 
121  for (auto range_iter = collection->begin(); range_iter != collection->end(); range_iter++) {
122  GEMDetId gemid = (*range_iter).first;
123  const auto& range = (*range_iter).second;
124 
125  if (gem->idToDet(gemid) == nullptr) {
126  edm::LogError(kLogCategory_) << "Getting DetId failed. Discard this gem pad hit. "
127  << "Maybe it comes from unmatched geometry." << std::endl;
128  continue;
129  }
130 
131  const GEMEtaPartition* roll = gem->etaPartition(gemid);
132  const BoundPlane& surface = roll->surface();
133 
134  Int_t region_id = gemid.region();
135  Int_t station_id = gemid.station();
136  Int_t layer_id = gemid.layer();
137  Int_t chamber_id = gemid.chamber();
138  Int_t roll_id = gemid.roll();
139 
140  ME2IdsKey key2(region_id, station_id);
141  ME3IdsKey key3(region_id, station_id, layer_id);
142 
143  for (auto digi = range.first; digi != range.second; ++digi) {
144  const auto& padsVec = digi->pads();
145  if (padsVec.empty()) {
146  edm::LogError(kLogCategory_) << "Pads missing for digi from GEM ID = " << gemid;
147  continue;
148  }
149  Int_t pad = padsVec[0];
150 
151  // bunch crossing
152  Int_t bx = digi->bx();
153 
154  const LocalPoint& local_pos = roll->centreOfPad(pad);
155  const GlobalPoint& global_pos = surface.toGlobal(local_pos);
156 
157  Float_t g_r = global_pos.perp();
158  Float_t g_phi = global_pos.phi();
159  Float_t g_x = global_pos.x();
160  Float_t g_y = global_pos.y();
161  Float_t g_abs_z = std::fabs(global_pos.z());
162 
163  me_occ_zr_[region_id]->Fill(g_abs_z, g_r);
164 
165  Int_t bin_x = getDetOccBinX(chamber_id, layer_id);
166  me_occ_det_[key2]->Fill(bin_x, roll_id);
167 
168  if (detail_plot_) {
169  me_detail_occ_xy_[key3]->Fill(g_x, g_y);
170  me_detail_occ_phi_pad_[key3]->Fill(g_phi, pad);
171  me_detail_occ_pad_[key3]->Fill(pad);
172  me_detail_bx_[key3]->Fill(bx);
173  } // detail_plot_
174  }
175  } // end loop over range iters
176 }
ME2IdsKey
std::tuple< Int_t, Int_t > ME2IdsKey
Definition: GEMValidationUtils.h:16
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
GEMPadDigiClusterValidation::me_occ_det_
MEMap2Ids me_occ_det_
Definition: GEMPadDigiClusterValidation.h:15
GEMBaseValidation::bookHist1D
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")
Definition: GEMBaseValidation.h:210
GEMSuperChamber::chambers
const std::vector< const GEMChamber * > & chambers() const
Return the chambers in the super chamber.
Definition: GEMSuperChamber.cc:23
GEMPadDigiClusterValidation::GEMPadDigiClusterValidation
GEMPadDigiClusterValidation(const edm::ParameterSet &)
Definition: GEMPadDigiClusterValidation.cc:4
GEMBaseValidation::detail_plot_
Bool_t detail_plot_
Definition: GEMBaseValidation.h:90
GEMSuperChamber
Definition: GEMSuperChamber.h:19
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:184
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
edm::Run
Definition: Run.h:45
GEMDetId::region
constexpr int region() const
Definition: GEMDetId.h:165
GEMBaseValidation::bookDetectorOccupancy
dqm::impl::MonitorElement * bookDetectorOccupancy(DQMStore::IBooker &booker, const T &key, const GEMStation *station, const char *name_prfix, const char *title_prefix)
Definition: GEMBaseValidation.h:161
relativeConstraints.station
station
Definition: relativeConstraints.py:67
GEMEtaPartition
Definition: GEMEtaPartition.h:12
l1GtPatternGenerator_cfi.bx
bx
Definition: l1GtPatternGenerator_cfi.py:18
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
edm::Handle< GEMPadDigiClusterCollection >
GEMPadDigiClusterValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: GEMPadDigiClusterValidation.cc:11
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
GEMPadDigiClusterValidation::pad_cluster_token_
edm::EDGetTokenT< GEMPadDigiClusterCollection > pad_cluster_token_
Definition: GEMPadDigiClusterValidation.h:23
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
GEMBaseValidation::bookZROccupancy
dqm::impl::MonitorElement * bookZROccupancy(DQMStore::IBooker &booker, Int_t region_id, const char *name_prfix, const char *title_prefix)
Definition: GEMBaseValidation.cc:34
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
GEMBaseValidation::initGeometry
const GEMGeometry * initGeometry(const edm::EventSetup &)
Definition: GEMBaseValidation.cc:23
GEMPadDigiClusterValidation::me_detail_bx_
MEMap3Ids me_detail_bx_
Definition: GEMPadDigiClusterValidation.h:21
GEMBaseValidation::bookXYOccupancy
dqm::impl::MonitorElement * bookXYOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
Definition: GEMBaseValidation.h:134
GEMPadDigiClusterValidation::me_occ_zr_
MEMap1Ids me_occ_zr_
Definition: GEMPadDigiClusterValidation.h:16
Point3DBase< float, LocalTag >
GEMPadDigiClusterValidation::me_detail_occ_phi_pad_
MEMap3Ids me_detail_occ_phi_pad_
Definition: GEMPadDigiClusterValidation.h:18
GEMBaseValidation::bookHist2D
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="")
Definition: GEMBaseValidation.h:227
GEMDetId::chamber
constexpr int chamber() const
Definition: GEMDetId.h:177
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
GEMDetId::roll
constexpr int roll() const
Definition: GEMDetId.h:188
GEMDetId
Definition: GEMDetId.h:17
GEMPadDigiClusterValidation.h
GEMPadDigiClusterValidation::me_detail_occ_xy_
MEMap3Ids me_detail_occ_xy_
Definition: GEMPadDigiClusterValidation.h:17
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
GEMPadDigiClusterValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: GEMPadDigiClusterValidation.cc:111
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
GEMBaseValidation
Definition: GEMBaseValidation.h:19
edm::EventSetup
Definition: EventSetup.h:57
gem
Definition: AMC13Event.h:6
GEMEtaPartition::centreOfPad
LocalPoint centreOfPad(int pad) const
Definition: GEMEtaPartition.cc:45
BoundPlane
HLT_2018_cff.region
region
Definition: HLT_2018_cff.py:81479
GEMPadDigiClusterValidation::~GEMPadDigiClusterValidation
~GEMPadDigiClusterValidation() override
Definition: GEMPadDigiClusterValidation.cc:109
relativeConstraints.chamber
chamber
Definition: relativeConstraints.py:53
ME3IdsKey
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
Definition: GEMValidationUtils.h:19
dqm::implementation::IBooker
Definition: DQMStore.h:43
GEMDetId::station
constexpr int station() const
Definition: GEMDetId.h:173
GEMGeometry
Definition: GEMGeometry.h:24
GEMPadDigiClusterValidation::me_detail_occ_pad_
MEMap3Ids me_detail_occ_pad_
Definition: GEMPadDigiClusterValidation.h:19
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
edm::InputTag
Definition: InputTag.h:15
GEMSuperChamber::id
GEMDetId id() const
Return the GEMDetId of this super chamber.
Definition: GEMSuperChamber.cc:11
PV3DBase::phi
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
GEMBaseValidation::getDetOccBinX
Int_t getDetOccBinX(Int_t chamber_id, Int_t layer_id)
Definition: GEMBaseValidation.cc:30
GEMBaseValidation::kLogCategory_
const std::string kLogCategory_
Definition: GEMBaseValidation.h:94
Run