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  geomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
9  geomTokenBeginRun_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
10 }
11 
13  edm::Run const& Run,
14  edm::EventSetup const& setup) {
15  const GEMGeometry* gem = &setup.getData(geomTokenBeginRun_);
16 
17  // NOTE Occupancy
18  booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/Pad/Occupancy");
19 
20  for (const auto& region : gem->regions()) {
21  Int_t region_id = region->region();
22 
23  me_occ_zr_[region_id] = bookZROccupancy(booker, region_id, "pad", "Pad");
24 
25  for (const auto& station : region->stations()) {
26  Int_t station_id = station->station();
27  ME2IdsKey key2(region_id, station_id);
28 
29  me_occ_det_[key2] = bookDetectorOccupancy(booker, key2, station, "pad", "Pad");
30 
31  const auto& superChamberVec = station->superChambers();
32  if (superChamberVec.empty()) {
33  edm::LogError(kLogCategory_) << "Super chambers missing for region = " << region_id
34  << " and station = " << station_id;
35  continue;
36  }
37  const GEMSuperChamber* super_chamber = superChamberVec.front();
38  if (super_chamber == nullptr) {
39  edm::LogError(kLogCategory_) << "Failed to find super chamber for region = " << region_id
40  << " and station = " << station_id;
41  continue;
42  }
43  for (const auto& chamber : super_chamber->chambers()) {
44  Int_t layer_id = chamber->id().layer();
45  ME3IdsKey key3(region_id, station_id, layer_id);
46 
47  const auto& etaPartitionVec = chamber->etaPartitions();
48  if (etaPartitionVec.empty() || etaPartitionVec.front() == nullptr) {
50  << "Eta partition missing or null for region, station, super chamber, chamber = (" << region_id << ", "
51  << station_id << ", " << super_chamber->id() << ", " << chamber->id() << ")";
52  continue;
53  }
54  Int_t num_pads = etaPartitionVec.front()->npads();
55 
56  if (detail_plot_) {
57  me_detail_occ_xy_[key3] = bookXYOccupancy(booker, key3, "pad", "Pad");
58 
59  me_detail_occ_phi_pad_[key3] = bookHist2D(booker,
60  key3,
61  "occ_phi_pad",
62  "Pad Occupancy",
63  280,
64  -M_PI,
65  M_PI,
66  num_pads / 2,
67  0,
68  num_pads,
69  "#phi [rad]",
70  "Pad number");
71 
72  me_detail_occ_pad_[key3] =
73  bookHist1D(booker, key3, "occ_pad", "Pad Occupancy", num_pads, 0.5, num_pads + 0.5, "Pad number");
74  }
75  } // layer loop
76  } // station loop
77  } // region loop
78 
79  // NOTE Bunch Crossing
80  if (detail_plot_) {
81  booker.setCurrentFolder("MuonGEMDigisV/GEMDigisTask/Pad/BunchCrossing");
82 
83  for (const auto& region : gem->regions()) {
84  Int_t region_id = region->region();
85  for (const auto& station : region->stations()) {
86  Int_t station_id = station->station();
87 
88  const auto& superChamberVec = station->superChambers();
89  if (superChamberVec.empty()) {
90  edm::LogError(kLogCategory_) << "Super chambers missing for region = " << region_id
91  << " and station = " << station_id;
92  continue;
93  }
94  const GEMSuperChamber* super_chamber = superChamberVec.front();
95  if (super_chamber == nullptr) {
96  edm::LogError(kLogCategory_) << "Failed to find super chamber for region = " << region_id
97  << " and station = " << station_id;
98  continue;
99  }
100  for (const auto& chamber : super_chamber->chambers()) {
101  Int_t layer_id = chamber->id().layer();
102  ME3IdsKey key3(region_id, station_id, layer_id);
103 
104  me_detail_bx_[key3] = bookHist1D(booker, key3, "bx", "Pad Bunch Crossing", 5, -2.5, 2.5, "Bunch crossing");
105  } // chamber loop
106  } // station loop
107  } // region loop
108  } // detail plot
109 }
110 
112 
114  const GEMGeometry* gem = &setup.getData(geomToken_);
115 
117  event.getByToken(pad_token_, collection);
118  if (not collection.isValid()) {
119  edm::LogError(kLogCategory_) << "Cannot get pads by label GEMPadToken.";
120  return;
121  }
122 
123  // type of range_iter: GEMPadDigiCollection::DigiRangeIterator
124  for (auto range_iter = collection->begin(); range_iter != collection->end(); range_iter++) {
125  GEMDetId gemid = (*range_iter).first;
126  const auto& range = (*range_iter).second;
127 
128  if (gem->idToDet(gemid) == nullptr) {
129  edm::LogError(kLogCategory_) << "Getting DetId failed. Discard this gem pad hit. "
130  << "Maybe it comes from unmatched geometry." << std::endl;
131  continue;
132  }
133 
134  const GEMEtaPartition* roll = gem->etaPartition(gemid);
135  const BoundPlane& surface = roll->surface();
136 
137  Int_t region_id = gemid.region();
138  Int_t station_id = gemid.station();
139  Int_t layer_id = gemid.layer();
140  Int_t chamber_id = gemid.chamber();
141  Int_t roll_id = gemid.roll();
142 
143  ME2IdsKey key2(region_id, station_id);
144  ME3IdsKey key3(region_id, station_id, layer_id);
145 
146  for (auto digi = range.first; digi != range.second; ++digi) {
147  // ignore 16-partition GE2/1 pads
148  if (gemid.isGE21() and digi->nPartitions() == GEMPadDigi::GE21SplitStrip)
149  continue;
150 
151  Int_t pad = digi->pad();
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  } // if detail_plot
174  } // digi loop
175  } // range loop
176 }
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:12
FastTimerService_cff.range
range
Definition: FastTimerService_cff.py:34
GEMDetId::isGE21
bool isGE21() const
Definition: GEMDetId.cc:11
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
GEMPadDigiValidation::geomTokenBeginRun_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomTokenBeginRun_
Definition: GEMPadDigiValidation.h:18
GEMBaseValidation::detail_plot_
Bool_t detail_plot_
Definition: GEMBaseValidation.h:88
GEMSuperChamber
Definition: GEMSuperChamber.h:19
GEMDetId::layer
constexpr int layer() const
Definition: GEMDetId.h:187
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
edm::Run
Definition: Run.h:45
GEMDetId::region
constexpr int region() const
Definition: GEMDetId.h:168
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::geomToken_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
Definition: GEMPadDigiValidation.h:17
GEMPadDigiValidation::analyze
void analyze(const edm::Event &, const edm::EventSetup &) override
Definition: GEMPadDigiValidation.cc:113
edm::Handle< GEMPadDigiCollection >
GEMPadDigi::GE21SplitStrip
Definition: GEMPadDigi.h:22
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:27
GeomDet::surface
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:37
GEMPadDigiValidation::me_detail_occ_xy_
MEMap3Ids me_detail_occ_xy_
Definition: GEMPadDigiValidation.h:23
GEMPadDigiValidation::me_detail_occ_pad_
MEMap3Ids me_detail_occ_pad_
Definition: GEMPadDigiValidation.h:25
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:22
Point3DBase< float, LocalTag >
GEMPadDigiValidation::~GEMPadDigiValidation
~GEMPadDigiValidation() override
Definition: GEMPadDigiValidation.cc:111
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:180
GEMPadDigiValidation::GEMPadDigiValidation
GEMPadDigiValidation(const edm::ParameterSet &)
Definition: GEMPadDigiValidation.cc:3
edm::ParameterSet
Definition: ParameterSet.h:47
GEMDetId::roll
constexpr int roll() const
Definition: GEMDetId.h:191
GEMDetId
Definition: GEMDetId.h:18
GEMPadDigiValidation::pad_token_
edm::EDGetTokenT< GEMPadDigiCollection > pad_token_
Definition: GEMPadDigiValidation.h:16
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
GEMPadDigiValidation.h
HLT_FULL_cff.region
region
Definition: HLT_FULL_cff.py:88272
universalConfigTemplate.collection
collection
Definition: universalConfigTemplate.py:81
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
GEMBaseValidation
Definition: GEMBaseValidation.h:18
edm::EventSetup
Definition: EventSetup.h:57
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
GEMPadDigiValidation::me_detail_occ_phi_pad_
MEMap3Ids me_detail_occ_phi_pad_
Definition: GEMPadDigiValidation.h:24
gem
Definition: AMC13Event.h:6
GEMEtaPartition::centreOfPad
LocalPoint centreOfPad(int pad) const
Definition: GEMEtaPartition.cc:45
BoundPlane
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:176
GEMPadDigiValidation::me_detail_bx_
MEMap3Ids me_detail_bx_
Definition: GEMPadDigiValidation.h:26
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:21
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:23
GEMBaseValidation::kLogCategory_
const std::string kLogCategory_
Definition: GEMBaseValidation.h:92
Run