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);
9 const auto& simhit_pset =
pset.getParameterSet(
"gemSimHit");
10 const auto& simhit_tag = simhit_pset.getParameter<
edm::InputTag>(
"inputTag");
16 geomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
17 geomTokenBeginRun_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
24 if (!gemH.isValid()) {
33 for (
const auto&
region :
gem->regions()) {
34 Int_t region_id =
region->region();
40 Int_t station_id =
station->station();
48 const auto& superChamberVec =
station->superChambers();
49 if (superChamberVec.empty()) {
51 <<
" and station = " << station_id;
55 if (super_chamber ==
nullptr) {
57 <<
" and station = " << station_id;
61 Int_t layer_id =
chamber->id().layer();
62 ME3IdsKey key3(region_id, station_id, layer_id);
64 const auto& etaPartitionVec =
chamber->etaPartitions();
65 if (etaPartitionVec.empty() || etaPartitionVec.front() ==
nullptr) {
67 <<
"Eta partition missing or null for region, station, super chamber, chamber = (" << region_id <<
", " 68 << station_id <<
", " << super_chamber->
id() <<
", " <<
chamber->id() <<
")";
71 Int_t num_pads = etaPartitionVec.front()->npads();
74 bookHist1D(booker, key3,
"total_pads_per_event",
"Number of pad digis per event", 50, 0, 50);
78 "sim_matched_occ_eta",
79 "Matched Pad Eta Occupancy",
86 bookHist1D(booker, key3,
"sim_matched_occ_phi",
"Matched Pad Phi Occupancy", 36, -5, 355,
"#phi [degrees]");
105 bookHist1D(booker, key3,
"occ_pad",
"Pad Occupancy", num_pads, 0, num_pads,
"Pad number");
113 for (
const auto&
region :
gem->regions()) {
114 Int_t region_id =
region->region();
116 Int_t station_id =
station->station();
118 const auto& superChamberVec =
station->superChambers();
119 if (superChamberVec.empty()) {
121 <<
" and station = " << station_id;
125 if (super_chamber ==
nullptr) {
127 <<
" and station = " << station_id;
131 Int_t layer_id =
chamber->id().layer();
132 ME3IdsKey key3(region_id, station_id, layer_id);
145 if (!gemH.isValid()) {
160 if (not digiSimLink.
isValid()) {
167 if (not simhit_container.
isValid()) {
172 std::map<ME3IdsKey, Int_t> total_pad;
175 const auto&
range = pad_pair.second;
177 if (
gem->idToDet(gemid) ==
nullptr) {
179 <<
"Maybe it comes from unmatched geometry." << std::endl;
186 Int_t region_id = gemid.
region();
187 Int_t station_id = gemid.
station();
188 Int_t layer_id = gemid.
layer();
189 Int_t chamber_id = gemid.
chamber();
191 Int_t num_layers = gemid.
nlayers();
194 ME3IdsKey key3(region_id, station_id, layer_id);
196 for (
auto digi =
range.first; digi !=
range.second; ++digi) {
199 Int_t pad = digi->pad();
200 Int_t
bx = digi->bx();
203 const GlobalPoint& global_pos = surface.toGlobal(local_pos);
205 Float_t
g_r = global_pos.
perp();
207 Float_t
g_x = global_pos.
x();
208 Float_t
g_y = global_pos.
y();
209 Float_t g_abs_z = std::fabs(global_pos.
z());
211 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
224 for (
const auto&
region :
gem->regions()) {
225 Int_t region_id =
region->region();
227 Int_t station_id =
station->station();
228 const auto& superChamberVec =
station->superChambers();
229 if (superChamberVec.empty()) {
231 <<
" and station = " << station_id;
235 if (super_chamber ==
nullptr) {
237 <<
" and station = " << station_id;
241 Int_t layer_id =
chamber->id().layer();
242 ME3IdsKey key3{region_id, station_id, layer_id};
249 for (
const auto& simhit : *simhit_container.
product()) {
252 if (
gem->idToDet(simhit.detUnitId()) ==
nullptr) {
257 GEMDetId simhit_gemid(simhit.detUnitId());
259 Int_t region_id = simhit_gemid.
region();
260 Int_t station_id = simhit_gemid.station();
261 Int_t layer_id = simhit_gemid.layer();
262 Int_t chamber_id = simhit_gemid.chamber();
263 Int_t
ieta = simhit_gemid.ieta();
264 Int_t num_layers = simhit_gemid.nlayers();
267 ME3IdsKey key3{region_id, station_id, layer_id};
271 const auto& simhit_local_pos = simhit.localPosition();
272 const auto& simhit_global_pos =
roll->surface().toGlobal(simhit_local_pos);
274 Float_t simhit_g_eta =
std::abs(simhit_global_pos.eta());
275 Float_t simhit_g_phi =
toDegree(simhit_global_pos.phi());
277 auto simhit_trackId = simhit.trackId();
279 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
281 auto links = digiSimLink->find(simhit_gemid);
282 if (
links == digiSimLink->end())
285 Int_t simhit_strip = -1;
286 for (
const auto& link : *
links) {
287 if (simhit_trackId == link.getTrackId()) {
288 simhit_strip = link.getStrip();
292 Int_t simhit_pad =
roll->padOfStrip(simhit_strip);
294 for (
auto pad =
range.first; pad !=
range.second; ++pad) {
295 if (pad->pad() == simhit_pad) {
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")
constexpr int station() const
constexpr int region() const
virtual void setCurrentFolder(std::string const &fullpath)
edm::EDGetTokenT< GEMPadDigiCollection > pad_token_
edm::EDGetTokenT< edm::PSimHitContainer > simhit_token_
void analyze(const edm::Event &, const edm::EventSetup &) override
Geom::Phi< T > phi() const
Bool_t isMuonSimHit(const PSimHit &)
T const * product() const
MEMap3Ids me_detail_occ_phi_pad_
MEMap3Ids me_occ_total_pad_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomToken_
Log< level::Error, false > LogError
dqm::impl::MonitorElement * bookZROccupancy(DQMStore::IBooker &booker, Int_t region_id, const char *name_prfix, const char *title_prefix)
constexpr int layer() const
constexpr int chamber() const
dqm::impl::MonitorElement * bookXYOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
MEMap1Ids me_detail_occ_zr_
GEMPadDigiValidation(const edm::ParameterSet &)
MEMap3Ids me_detail_occ_pad_
edm::EDGetTokenT< edm::DetSetVector< GEMDigiSimLink > > digisimlink_token_
Abs< T >::type abs(const T &t)
std::vector< Double_t > eta_range_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomTokenBeginRun_
MEMap2Ids me_detail_occ_det_
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="")
~GEMPadDigiValidation() override
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MEMap2Ids me_detail_pad_occ_det_
constexpr int ieta() const
GEMDetId id() const
Return the GEMDetId of this super chamber.
MEMap3Ids me_pad_occ_eta_
MEMap3Ids me_pad_occ_phi_
std::tuple< Int_t, Int_t > ME2IdsKey
Float_t toDegree(Float_t radian)
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
Int_t getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id)
MEMap3Ids me_detail_occ_xy_
const std::string kLogCategory_
constexpr int nlayers() const
const std::vector< const GEMChamber * > & chambers() const
Return the chambers in the super chamber.
dqm::impl::MonitorElement * bookDetectorOccupancy(DQMStore::IBooker &booker, const T &key, const GEMStation *station, const char *name_prfix, const char *title_prefix)