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 const auto& regionsVec =
gem->regions();
28 if (regionsVec.empty() || regionsVec[0] ==
nullptr) {
32 for (
const auto&
station : regionsVec[0]->stations()) {
33 Int_t station_id =
station->station();
34 const auto [tof_min, tof_max] =
getTOFRange(station_id);
35 auto tof_name = TString::Format(
"tof_muon_st%d", station_id);
36 auto tof_title = TString::Format(
"SimHit Time Of Flight (Muon only) : Station %d", station_id);
38 me_tof_mu_[station_id] = booker.
book1D(tof_name, tof_title, 40, tof_min, tof_max);
43 for (
const auto&
region :
gem->regions()) {
44 Int_t region_id =
region->region();
47 Int_t station_id =
station->station();
49 const auto [tof_min, tof_max] =
getTOFRange(station_id);
50 const auto& superChamberVec =
station->superChambers();
51 if (superChamberVec.empty() || superChamberVec.front() ==
nullptr) {
53 <<
" and station = " << station_id;
58 Int_t layer_id =
chamber->id().layer();
59 ME3IdsKey key3{region_id, station_id, layer_id};
62 booker, key3,
"tof",
"Time of Flight of Muon SimHits", 40, tof_min, tof_max, tof_xtitle, tof_ytitle);
65 booker, key3,
"tof_muon",
"SimHit TOF (Muon only)", 40, tof_min, tof_max, tof_xtitle, tof_ytitle);
75 TString eloss_xtitle =
"Energy loss [eV]";
76 TString eloss_ytitle =
"Entries / 100 eV";
78 for (
const auto&
station :
gem->regions()[0]->stations()) {
79 Int_t station_id =
station->station();
81 auto eloss_name = TString::Format(
"eloss_muon_st%d", station_id);
82 auto eloss_title = TString::Format(
"SimHit Energy Loss (Muon only) : Station %d", station_id);
85 booker.
book1D(eloss_name, eloss_title +
";" + eloss_xtitle +
";" + eloss_ytitle, 60, 0.0, 6000.0);
89 for (
const auto&
region :
gem->regions()) {
90 Int_t region_id =
region->region();
92 Int_t station_id =
station->station();
93 const auto& superChamberVec =
station->superChambers();
94 if (superChamberVec.empty() || superChamberVec.front() ==
nullptr) {
96 <<
" and station = " << station_id;
98 for (
const auto&
chamber : superChamberVec.front()->chambers()) {
99 Int_t layer_id =
chamber->id().layer();
100 ME3IdsKey key3{region_id, station_id, layer_id};
103 bookHist1D(booker, key3,
"eloss",
"SimHit Energy Loss", 60, 0.0, 6000.0, eloss_xtitle, eloss_ytitle);
108 "SimHit Energy Loss (Muon Only)",
124 for (
const auto&
region :
gem->regions()) {
125 Int_t region_id =
region->region();
130 Int_t station_id =
station->station();
135 const auto& superChamberVec =
station->superChambers();
136 if (superChamberVec.empty() || superChamberVec.front() ==
nullptr) {
138 <<
" and station = " << station_id;
142 Int_t layer_id =
chamber->id().layer();
143 ME3IdsKey key3{region_id, station_id, layer_id};
153 UInt_t start_index = station_id == 1 ? 0 : 2;
155 Double_t tof_max =
tof_range_[start_index + 1];
156 return std::make_tuple(tof_min, tof_max);
164 if (not simhit_container.
isValid()) {
169 for (
const auto& simhit : *simhit_container.
product()) {
170 const GEMDetId gemid(simhit.detUnitId());
172 if (
gem->idToDet(gemid) ==
nullptr) {
177 Int_t region_id = gemid.region();
178 Int_t station_id = gemid.station();
179 Int_t layer_id = gemid.layer();
180 Int_t chamber_id = gemid.chamber();
181 Int_t roll_id = gemid.roll();
184 ME3IdsKey key3{region_id, station_id, layer_id};
186 GlobalPoint&& simhit_global_pos =
gem->idToDet(gemid)->surface().toGlobal(simhit.localPosition());
188 Float_t simhit_g_r = simhit_global_pos.
perp();
189 Float_t simhit_g_x = simhit_global_pos.
x();
190 Float_t simhit_g_y = simhit_global_pos.
y();
191 Float_t simhit_g_abs_z = std::fabs(simhit_global_pos.
z());
193 Float_t energy_loss =
kEnergyCF_ * simhit.energyLoss();
194 Float_t tof = simhit.timeOfFlight();
199 me_occ_zr_[region_id]->Fill(simhit_g_abs_z, simhit_g_r);
201 me_occ_xy_[key3]->Fill(simhit_g_x, simhit_g_y);
204 if (is_muon_simhit) {
213 if (is_muon_simhit) {