6 const auto& pad_cluster_pset =
pset.getParameterSet(
"gemPadCluster");
7 const auto& pad_cluster_tag = pad_cluster_pset.getParameter<
edm::InputTag>(
"inputTag");
9 const auto& simhit_pset =
pset.getParameterSet(
"gemSimHit");
10 const auto& simhit_tag = simhit_pset.getParameter<
edm::InputTag>(
"inputTag");
17 geomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
18 geomTokenBeginRun_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
26 booker.
setCurrentFolder(
"MuonGEMDigisV/GEMDigisTask/PadCluster/ClusterSize");
28 TString cls_title =
"Cluster Size Distribution";
29 TString cls_x_title =
"Cluster size";
31 me_cls_ = booker.
book1D(
"cls", cls_title +
";" + cls_x_title +
";" +
"Entries", 10, 0.5, 10.5);
35 for (
const auto&
region :
gem->regions()) {
36 Int_t region_id =
region->region();
42 Int_t station_id =
station->station();
51 const auto& superChamberVec =
station->superChambers();
52 if (superChamberVec.empty()) {
54 <<
" and station = " << station_id;
58 if (super_chamber ==
nullptr) {
60 <<
" and station = " << station_id;
64 Int_t layer_id =
chamber->id().layer();
65 ME3IdsKey key3{region_id, station_id, layer_id};
67 const auto& etaPartitionVec =
chamber->etaPartitions();
68 if (etaPartitionVec.empty() || etaPartitionVec.front() ==
nullptr) {
70 <<
"Eta partition missing or null for region, station, super chamber, chamber = (" << region_id <<
", "
71 << station_id <<
", " << super_chamber->
id() <<
", " <<
chamber->id() <<
")";
74 Int_t num_pads = etaPartitionVec.front()->npads();
77 bookHist1D(booker, key3,
"total_pad_cluster",
"Number of pad digi cluster per event", 21, -0.5, 20.5);
81 "matched_pad_occ_eta",
82 "Matched Pad Cluster Eta Occupancy",
89 booker, key3,
"matched_pad_occ_phi",
"Matched Pad Cluster Phi Occupancy", 36, -5, 355,
"#phi [degrees]");
97 "Pad Cluster Occupancy",
108 bookHist1D(booker, key3,
"occ_pad",
"Pad Cluster Occupancy", num_pads, 0.5, num_pads + 0.5,
"Pad number");
116 booker.
setCurrentFolder(
"MuonGEMDigisV/GEMDigisTask/PadCluster/BunchCrossing");
118 for (
const auto&
region :
gem->regions()) {
119 Int_t region_id =
region->region();
121 Int_t station_id =
station->station();
123 const auto& superChamberVec =
station->superChambers();
124 if (superChamberVec.empty()) {
126 <<
" and station = " << station_id;
130 if (super_chamber ==
nullptr) {
132 <<
" and station = " << station_id;
136 Int_t layer_id =
chamber->id().layer();
137 ME3IdsKey key3(region_id, station_id, layer_id);
139 bookHist1D(booker, key3,
"bx",
"Pad Cluster Bunch Crossing", 5, -2.5, 2.5,
"Bunch crossing");
150 for (
auto pad : cluster->pads()) {
151 if (pad == simhit_pad) {
170 if (not digiSimLink.
isValid()) {
177 if (not simhit_container.
isValid()) {
182 std::map<ME3IdsKey, Int_t> total_cluster;
184 GEMDetId gemid = (*range_iter).first;
185 const auto&
range = (*range_iter).second;
187 if (
gem->idToDet(gemid) ==
nullptr) {
189 <<
"Maybe it comes from unmatched geometry." << std::endl;
196 Int_t region_id = gemid.
region();
197 Int_t station_id = gemid.
station();
198 Int_t layer_id = gemid.
layer();
199 Int_t chamber_id = gemid.
chamber();
201 Int_t num_layers = gemid.
nlayers();
204 ME3IdsKey key3(region_id, station_id, layer_id);
206 for (
auto digi =
range.first; digi !=
range.second; ++digi) {
211 const auto& padsVec = digi->pads();
212 if (padsVec.empty()) {
216 Int_t pad = padsVec[0];
218 total_cluster[key3]++;
221 Int_t
bx = digi->bx();
222 Int_t cls = digi->pads().size();
225 const GlobalPoint& global_pos = surface.toGlobal(local_pos);
227 Float_t g_r = global_pos.
perp();
228 Float_t g_phi = global_pos.
phi();
229 Float_t g_x = global_pos.
x();
230 Float_t g_y = global_pos.
y();
231 Float_t g_abs_z = std::fabs(global_pos.
z());
233 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
247 for (
const auto&
region :
gem->regions()) {
248 Int_t region_id =
region->region();
250 Int_t station_id =
station->station();
251 const auto& superChamberVec =
station->superChambers();
252 if (superChamberVec.empty()) {
254 <<
" and station = " << station_id;
258 if (super_chamber ==
nullptr) {
260 <<
" and station = " << station_id;
264 Int_t layer_id =
chamber->id().layer();
265 ME3IdsKey key3{region_id, station_id, layer_id};
272 for (
const auto& simhit : *simhit_container.
product()) {
275 if (
gem->idToDet(simhit.detUnitId()) ==
nullptr) {
280 GEMDetId simhit_gemid(simhit.detUnitId());
282 Int_t region_id = simhit_gemid.
region();
283 Int_t station_id = simhit_gemid.station();
284 Int_t layer_id = simhit_gemid.layer();
285 Int_t chamber_id = simhit_gemid.chamber();
286 Int_t
ieta = simhit_gemid.ieta();
287 Int_t num_layers = simhit_gemid.nlayers();
290 ME3IdsKey key3{region_id, station_id, layer_id};
294 const auto& simhit_local_pos = simhit.localPosition();
295 const auto& simhit_global_pos = roll->
surface().
toGlobal(simhit_local_pos);
297 Float_t simhit_g_eta =
std::abs(simhit_global_pos.eta());
298 Float_t simhit_g_phi =
toDegree(simhit_global_pos.phi());
300 auto simhit_trackId = simhit.trackId();
302 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
304 auto links = digiSimLink->find(simhit_gemid);
305 if (
links == digiSimLink->end())
308 Int_t simhit_strip = -1;
310 if (simhit_trackId ==
link.getTrackId()) {
311 simhit_strip =
link.getStrip();
315 Int_t simhit_pad = roll->
padOfStrip(simhit_strip);
317 for (
auto cluster =
range.first; cluster !=
range.second; ++cluster) {