CMS 3D CMS Logo

GEMPadDigiValidation.cc
Go to the documentation of this file.
2 
4  : GEMBaseValidation(pset, "GEMPadDigiValidation") {
5  const auto& pad_pset = pset.getParameterSet("gemPadDigi");
6  const auto& pad_tag = pad_pset.getParameter<edm::InputTag>("inputTag");
7  pad_token_ = consumes<GEMPadDigiCollection>(pad_tag);
8 }
9 
11  edm::Run const& Run,
12  edm::EventSetup const& setup) {
14 
15  // NOTE Occupancy
16  booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/Pad/Occupancy");
17 
18  for (const auto& region : gem->regions()) {
19  Int_t region_id = region->region();
20 
21  me_occ_zr_[region_id] = bookZROccupancy(booker, region_id, "pad", "Pad");
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");
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");
56 
57  me_detail_occ_phi_pad_[key3] = bookHist2D(booker,
58  key3,
59  "occ_phi_pad",
60  "Pad 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 Occupancy", num_pads, 0.5, num_pads + 0.5, "Pad number");
72  }
73  } // layer loop
74  } // station loop
75  } // region loop
76 
77  // NOTE Bunch Crossing
78  if (detail_plot_) {
79  booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/Pad/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 
102  me_detail_bx_[key3] = bookHist1D(booker, key3, "bx", "Pad 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_token_, collection);
116  if (not collection.isValid()) {
117  edm::LogError(kLogCategory_) << "Cannot get pads by label GEMPadToken.";
118  return;
119  }
120 
121  // type of range_iter: GEMPadDigiCollection::DigiRangeIterator
122  for (auto range_iter = collection->begin(); range_iter != collection->end(); range_iter++) {
123  GEMDetId gemid = (*range_iter).first;
124  const auto& range = (*range_iter).second;
125 
126  if (gem->idToDet(gemid) == nullptr) {
127  edm::LogError(kLogCategory_) << "Getting DetId failed. Discard this gem pad hit. "
128  << "Maybe it comes from unmatched geometry." << std::endl;
129  continue;
130  }
131 
132  const GEMEtaPartition* roll = gem->etaPartition(gemid);
133  const BoundPlane& surface = roll->surface();
134 
135  Int_t region_id = gemid.region();
136  Int_t station_id = gemid.station();
137  Int_t layer_id = gemid.layer();
138  Int_t chamber_id = gemid.chamber();
139  Int_t roll_id = gemid.roll();
140 
141  ME2IdsKey key2(region_id, station_id);
142  ME3IdsKey key3(region_id, station_id, layer_id);
143 
144  for (auto digi = range.first; digi != range.second; ++digi) {
145  Int_t pad = digi->pad();
146  Int_t bx = digi->bx();
147 
148  const LocalPoint& local_pos = roll->centreOfPad(pad);
149  const GlobalPoint& global_pos = surface.toGlobal(local_pos);
150 
151  Float_t g_r = global_pos.perp();
152  Float_t g_phi = global_pos.phi();
153  Float_t g_x = global_pos.x();
154  Float_t g_y = global_pos.y();
155  Float_t g_abs_z = std::fabs(global_pos.z());
156 
157  me_occ_zr_[region_id]->Fill(g_abs_z, g_r);
158 
159  Int_t bin_x = getDetOccBinX(chamber_id, layer_id);
160  me_occ_det_[key2]->Fill(bin_x, roll_id);
161 
162  if (detail_plot_) {
163  me_detail_occ_xy_[key3]->Fill(g_x, g_y);
164  me_detail_occ_phi_pad_[key3]->Fill(g_phi, pad);
165  me_detail_occ_pad_[key3]->Fill(pad);
166  me_detail_bx_[key3]->Fill(bx);
167  } // if detail_plot
168  } // digi loop
169  } // range loop
170 }
ME2IdsKey
std::tuple< Int_t, Int_t > ME2IdsKey
Definition: GEMValidationUtils.h:16
GEMPadDigiValidation::bookHistograms
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
Definition: GEMPadDigiValidation.cc:10
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
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
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
GEMPadDigiValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: GEMPadDigiValidation.cc:111
edm::Handle< GEMPadDigiCollection >
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
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
GEMPadDigiValidation::me_detail_occ_xy_
MEMap3Ids me_detail_occ_xy_
Definition: GEMPadDigiValidation.h:21
GEMPadDigiValidation::me_detail_occ_pad_
MEMap3Ids me_detail_occ_pad_
Definition: GEMPadDigiValidation.h:23
GEMBaseValidation::bookXYOccupancy
dqm::impl::MonitorElement * bookXYOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
Definition: GEMBaseValidation.h:134
GEMPadDigiValidation::me_occ_zr_
MEMap1Ids me_occ_zr_
Definition: GEMPadDigiValidation.h:20
Point3DBase< float, LocalTag >
GEMPadDigiValidation::~GEMPadDigiValidation
~GEMPadDigiValidation() override
Definition: GEMPadDigiValidation.cc:109
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
GEMPadDigiValidation::GEMPadDigiValidation
GEMPadDigiValidation(const edm::ParameterSet &)
Definition: GEMPadDigiValidation.cc:3
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
GEMPadDigiValidation::pad_token_
edm::EDGetTokenT< GEMPadDigiCollection > pad_token_
Definition: GEMPadDigiValidation.h:16
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
GEMPadDigiValidation.h
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
GEMPadDigiValidation::me_detail_occ_phi_pad_
MEMap3Ids me_detail_occ_phi_pad_
Definition: GEMPadDigiValidation.h:22
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
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
GEMPadDigiValidation::me_detail_bx_
MEMap3Ids me_detail_bx_
Definition: GEMPadDigiValidation.h:24
GEMGeometry
Definition: GEMGeometry.h:24
event
Definition: event.py:1
edm::Event
Definition: Event.h:73
GEMPadDigiValidation::me_occ_det_
MEMap2Ids me_occ_det_
Definition: GEMPadDigiValidation.h:19
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