7 const auto& simhit_pset =
pset.getParameterSet(
"gemSimHit");
8 const auto& simhit_tag = simhit_pset.getParameter<
edm::InputTag>(
"inputTag");
11 tof_range_ =
pset.getUntrackedParameter<std::vector<Double_t> >(
"TOFRange");
12 geomToken_ = esConsumes<GEMGeometry, MuonGeometryRecord>();
13 geomTokenBeginRun_ = esConsumes<GEMGeometry, MuonGeometryRecord, edm::Transition::BeginRun>();
24 TString tof_xtitle =
"Time of flight [ns]";
25 TString tof_ytitle =
"Entries";
27 for (
const auto&
region :
gem->regions()) {
28 Int_t region_id =
region->region();
31 Int_t station_id =
station->station();
33 const auto [tof_min, tof_max] =
getTOFRange(station_id);
37 bookHist1D(booker, key2,
"tof_muon",
"SimHit TOF (Muon only)", 20, tof_min, tof_max, tof_xtitle, tof_ytitle);
40 booker, key2,
"tof_others",
"SimHit TOF (Other Particles)", 20, tof_min, tof_max, tof_xtitle, tof_ytitle);
45 for (
const auto&
region :
gem->regions()) {
46 Int_t region_id =
region->region();
49 Int_t station_id =
station->station();
51 const auto [tof_min, tof_max] =
getTOFRange(station_id);
52 const auto& superChamberVec =
station->superChambers();
53 if (superChamberVec.empty() || superChamberVec.front() ==
nullptr) {
55 <<
" and station = " << station_id;
60 Int_t layer_id =
chamber->id().layer();
61 ME3IdsKey key3{region_id, station_id, layer_id};
64 booker, key3,
"tof",
"Time of Flight of Muon SimHits", 40, tof_min, tof_max, tof_xtitle, tof_ytitle);
67 booker, key3,
"tof_muon",
"SimHit TOF (Muon only)", 40, tof_min, tof_max, tof_xtitle, tof_ytitle);
77 TString eloss_xtitle =
"Energy loss [eV]";
78 TString eloss_ytitle =
"Entries / 0.5 keV";
80 for (
const auto&
station :
gem->regions()[0]->stations()) {
81 Int_t station_id =
station->station();
83 auto eloss_mu_name = TString::Format(
"eloss_muon_st%d", station_id);
84 auto eloss_mu_title = TString::Format(
"SimHit Energy Loss (Muon only) : Station %d", station_id);
87 booker.
book1D(eloss_mu_name, eloss_mu_title +
";" + eloss_xtitle +
";" + eloss_ytitle, 20, 0.0, 10.0);
89 auto eloss_others_name = TString::Format(
"eloss_others_st%d", station_id);
90 auto eloss_others_title = TString::Format(
"SimHit Energy Loss (Other Particles) : Station %d", station_id);
93 booker.
book1D(eloss_others_name, eloss_others_title +
";" + eloss_xtitle +
";" + eloss_ytitle, 20, 0.0, 10.0);
97 for (
const auto&
region :
gem->regions()) {
98 Int_t region_id =
region->region();
100 Int_t station_id =
station->station();
101 const auto& superChamberVec =
station->superChambers();
102 if (superChamberVec.empty() || superChamberVec.front() ==
nullptr) {
104 <<
" and station = " << station_id;
106 for (
const auto&
chamber : superChamberVec.front()->chambers()) {
107 Int_t layer_id =
chamber->id().layer();
108 ME3IdsKey key3{region_id, station_id, layer_id};
111 bookHist1D(booker, key3,
"eloss",
"SimHit Energy Loss", 60, 0.0, 6000.0, eloss_xtitle, eloss_ytitle);
116 "SimHit Energy Loss (Muon Only)",
132 for (
const auto&
region :
gem->regions()) {
133 Int_t region_id =
region->region();
139 Int_t station_id =
station->station();
147 const auto& superChamberVec =
station->superChambers();
148 if (superChamberVec.empty() || superChamberVec.front() ==
nullptr) {
150 <<
" and station = " << station_id;
154 Int_t layer_id =
chamber->id().layer();
155 ME3IdsKey key3{region_id, station_id, layer_id};
159 "muon_simhit_occ_eta",
160 "Muon SimHit Eta Occupancy",
167 booker, key3,
"muon_simhit_occ_phi",
"Muon SimHit Phi Occupancy", 36, -5, 355,
"#phi [degrees]");
180 UInt_t start_index = station_id * 2;
182 Double_t tof_max =
tof_range_[start_index + 1];
183 return std::make_tuple(tof_min, tof_max);
191 if (not simhit_container.
isValid()) {
196 for (
const auto& simhit : *simhit_container.
product()) {
197 const GEMDetId gemid(simhit.detUnitId());
199 if (
gem->idToDet(gemid) ==
nullptr) {
204 Int_t region_id = gemid.region();
205 Int_t station_id = gemid.station();
206 Int_t layer_id = gemid.layer();
207 Int_t chamber_id = gemid.chamber();
208 Int_t
ieta = gemid.ieta();
209 Int_t num_layers = gemid.nlayers();
212 ME3IdsKey key3{region_id, station_id, layer_id};
214 GlobalPoint&& simhit_global_pos =
gem->idToDet(gemid)->surface().toGlobal(simhit.localPosition());
216 Float_t simhit_g_r = simhit_global_pos.
perp();
217 Float_t simhit_g_x = simhit_global_pos.
x();
218 Float_t simhit_g_y = simhit_global_pos.
y();
219 Float_t simhit_g_abs_z = std::fabs(simhit_global_pos.
z());
220 Float_t simhit_g_eta = std::fabs(simhit_global_pos.
eta());
221 Float_t simhit_g_phi =
toDegree(simhit_global_pos.
phi());
223 Float_t energy_loss =
kEnergyCF_ * simhit.energyLoss();
224 energy_loss = energy_loss > 10 ? 9.9 : energy_loss;
225 Float_t tof = simhit.timeOfFlight();
226 Int_t pid = simhit.particleType();
230 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
233 if (is_muon_simhit) {
253 if (is_muon_simhit) {