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>();
28 for (
const auto&
region :
gem->regions()) {
29 Int_t region_id =
region->region();
35 Int_t station_id =
station->station();
43 const auto& superChamberVec =
station->superChambers();
44 if (superChamberVec.empty()) {
46 <<
" and station = " << station_id;
50 if (super_chamber ==
nullptr) {
52 <<
" and station = " << station_id;
56 Int_t layer_id =
chamber->id().layer();
57 ME3IdsKey key3(region_id, station_id, layer_id);
59 const auto& etaPartitionVec =
chamber->etaPartitions();
60 if (etaPartitionVec.empty() || etaPartitionVec.front() ==
nullptr) {
62 <<
"Eta partition missing or null for region, station, super chamber, chamber = (" << region_id <<
", "
63 << station_id <<
", " << super_chamber->
id() <<
", " <<
chamber->id() <<
")";
66 Int_t num_pads = etaPartitionVec.front()->npads();
69 bookHist1D(booker, key3,
"total_pads_per_event",
"Number of pad digis per event", 51, -0.5, 50);
73 "matched_pad_occ_eta",
74 "Matched Pad Eta Occupancy",
81 bookHist1D(booker, key3,
"matched_pad_occ_phi",
"Matched Pad Phi Occupancy", 36, -5, 355,
"#phi [degrees]");
100 bookHist1D(booker, key3,
"occ_pad",
"Pad Occupancy", num_pads, 0.5, num_pads + 0.5,
"Pad number");
110 for (
const auto&
region :
gem->regions()) {
111 Int_t region_id =
region->region();
113 Int_t station_id =
station->station();
115 const auto& superChamberVec =
station->superChambers();
116 if (superChamberVec.empty()) {
118 <<
" and station = " << station_id;
122 if (super_chamber ==
nullptr) {
124 <<
" and station = " << station_id;
128 Int_t layer_id =
chamber->id().layer();
129 ME3IdsKey key3(region_id, station_id, layer_id);
152 if (not digiSimLink.
isValid()) {
159 if (not simhit_container.
isValid()) {
164 std::map<ME3IdsKey, Int_t> total_pad;
167 const auto&
range = pad_pair.second;
169 if (
gem->idToDet(gemid) ==
nullptr) {
171 <<
"Maybe it comes from unmatched geometry." << std::endl;
178 Int_t region_id = gemid.
region();
179 Int_t station_id = gemid.
station();
180 Int_t layer_id = gemid.
layer();
181 Int_t chamber_id = gemid.
chamber();
183 Int_t num_layers = gemid.
nlayers();
186 ME3IdsKey key3(region_id, station_id, layer_id);
188 for (
auto digi =
range.first; digi !=
range.second; ++digi) {
195 Int_t pad = digi->pad();
196 Int_t
bx = digi->bx();
199 const GlobalPoint& global_pos = surface.toGlobal(local_pos);
201 Float_t g_r = global_pos.
perp();
202 Float_t g_phi = global_pos.
phi();
203 Float_t g_x = global_pos.
x();
204 Float_t g_y = global_pos.
y();
205 Float_t g_abs_z = std::fabs(global_pos.
z());
207 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
220 for (
const auto&
region :
gem->regions()) {
221 Int_t region_id =
region->region();
223 Int_t station_id =
station->station();
224 const auto& superChamberVec =
station->superChambers();
225 if (superChamberVec.empty()) {
227 <<
" and station = " << station_id;
231 if (super_chamber ==
nullptr) {
233 <<
" and station = " << station_id;
237 Int_t layer_id =
chamber->id().layer();
238 ME3IdsKey key3{region_id, station_id, layer_id};
245 for (
const auto& simhit : *simhit_container.
product()) {
248 if (
gem->idToDet(simhit.detUnitId()) ==
nullptr) {
253 GEMDetId simhit_gemid(simhit.detUnitId());
255 Int_t region_id = simhit_gemid.
region();
256 Int_t station_id = simhit_gemid.station();
257 Int_t layer_id = simhit_gemid.layer();
258 Int_t chamber_id = simhit_gemid.chamber();
259 Int_t
ieta = simhit_gemid.ieta();
260 Int_t num_layers = simhit_gemid.nlayers();
263 ME3IdsKey key3{region_id, station_id, layer_id};
267 const auto& simhit_local_pos = simhit.localPosition();
268 const auto& simhit_global_pos = roll->
surface().
toGlobal(simhit_local_pos);
270 Float_t simhit_g_eta =
std::abs(simhit_global_pos.eta());
271 Float_t simhit_g_phi =
toDegree(simhit_global_pos.phi());
273 auto simhit_trackId = simhit.trackId();
275 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
277 auto links = digiSimLink->find(simhit_gemid);
278 if (
links == digiSimLink->end())
281 Int_t simhit_strip = -1;
283 if (simhit_trackId ==
link.getTrackId()) {
284 simhit_strip =
link.getStrip();
288 Int_t simhit_pad = roll->
padOfStrip(simhit_strip);
290 for (
auto pad =
range.first; pad !=
range.second; ++pad) {
291 if (pad->pad() == simhit_pad) {