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 booker, key2,
"sim_tof_muon",
"SimHit TOF (Muon only)", 20, tof_min, tof_max, tof_xtitle, tof_ytitle);
40 booker, key2,
"sim_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,
"sim_tof",
"Time of Flight of Muon SimHits", 40, tof_min, tof_max, tof_xtitle, tof_ytitle);
67 booker, key3,
"sim_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 / 0.5 keV";
80 for (
const auto&
region :
gem->regions()) {
82 Int_t station_id =
station->station();
86 auto eloss_mu_name = TString::Format(
"sim_eloss_muon_GE%d1", station_id);
87 auto eloss_mu_title = TString::Format(
"SimHit Energy Loss (Muon only) : GE%d1", station_id);
90 booker.
book1D(eloss_mu_name, eloss_mu_title +
";" + eloss_xtitle +
";" + eloss_ytitle, 20, 0.0, 10.0);
92 auto eloss_others_name = TString::Format(
"sim_eloss_others_GE%d1", station_id);
93 auto eloss_others_title = TString::Format(
"SimHit Energy Loss (Other Particles) : GE%d1", station_id);
96 booker.
book1D(eloss_others_name, eloss_others_title +
";" + eloss_xtitle +
";" + eloss_ytitle, 20, 0.0, 10.0);
101 for (
const auto&
region :
gem->regions()) {
102 Int_t region_id =
region->region();
104 Int_t station_id =
station->station();
105 const auto& superChamberVec =
station->superChambers();
106 if (superChamberVec.empty() || superChamberVec.front() ==
nullptr) {
108 <<
" and station = " << station_id;
110 for (
const auto&
chamber : superChamberVec.front()->chambers()) {
111 Int_t layer_id =
chamber->id().layer();
112 ME3IdsKey key3{region_id, station_id, layer_id};
115 booker, key3,
"sim_eloss",
"SimHit Energy Loss", 60, 0.0, 6000.0, eloss_xtitle, eloss_ytitle);
120 "SimHit Energy Loss (Muon Only)",
134 for (
const auto&
region :
gem->regions()) {
135 Int_t region_id =
region->region();
141 Int_t station_id =
station->station();
149 const auto& superChamberVec =
station->superChambers();
150 if (superChamberVec.empty() || superChamberVec.front() ==
nullptr) {
152 <<
" and station = " << station_id;
156 Int_t layer_id =
chamber->id().layer();
157 ME3IdsKey key3{region_id, station_id, layer_id};
162 "Muon SimHit Eta Occupancy",
169 bookHist1D(booker, key3,
"sim_muon_occ_phi",
"Muon SimHit Phi Occupancy", 36, -5, 355,
"#phi [degrees]");
182 UInt_t start_index = station_id * 2;
184 Double_t tof_max =
tof_range_[start_index + 1];
185 return std::make_tuple(tof_min, tof_max);
193 if (not simhit_container.
isValid()) {
198 for (
const auto& simhit : *simhit_container.
product()) {
199 const GEMDetId gemid(simhit.detUnitId());
201 if (
gem->idToDet(gemid) ==
nullptr) {
206 Int_t region_id = gemid.region();
207 Int_t station_id = gemid.station();
208 Int_t layer_id = gemid.layer();
209 Int_t chamber_id = gemid.chamber();
210 Int_t
ieta = gemid.ieta();
211 Int_t num_layers = gemid.nlayers();
214 ME3IdsKey key3{region_id, station_id, layer_id};
216 GlobalPoint&& simhit_global_pos =
gem->idToDet(gemid)->surface().toGlobal(simhit.localPosition());
218 Float_t simhit_g_r = simhit_global_pos.
perp();
219 Float_t simhit_g_x = simhit_global_pos.
x();
220 Float_t simhit_g_y = simhit_global_pos.
y();
221 Float_t simhit_g_abs_z = std::fabs(simhit_global_pos.
z());
222 Float_t simhit_g_eta = std::fabs(simhit_global_pos.
eta());
223 Float_t simhit_g_phi =
toDegree(simhit_global_pos.
phi());
225 Float_t energy_loss =
kEnergyCF_ * simhit.energyLoss();
226 energy_loss = energy_loss > 10 ? 9.9 : energy_loss;
227 Float_t tof = simhit.timeOfFlight();
228 Int_t pid = simhit.particleType();
232 Int_t bin_x =
getDetOccBinX(num_layers, chamber_id, layer_id);
235 if (is_muon_simhit) {
255 if (is_muon_simhit) {
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")
~GEMSimHitValidation() override
MEMap2Ids me_detail_occ_det_
MEMap3Ids me_detail_occ_xy_
virtual void setCurrentFolder(std::string const &fullpath)
GEMSimHitValidation(const edm::ParameterSet &)
Geom::Phi< T > phi() const
Bool_t isMuonSimHit(const PSimHit &)
T const * product() const
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)
edm::EDGetTokenT< edm::PSimHitContainer > simhit_token_
dqm::impl::MonitorElement * bookXYOccupancy(DQMStore::IBooker &booker, const T &key, const char *name_prefix, const char *title_prefix)
MEMap3Ids me_detail_eloss_mu_
std::vector< Double_t > tof_range_
Int_t getPidIdx(Int_t pid)
std::vector< Double_t > eta_range_
MEMap2Ids me_detail_occ_det_mu_
edm::ESGetToken< GEMGeometry, MuonGeometryRecord > geomTokenBeginRun_
MEMap1Ids me_detail_occ_zr_
std::tuple< Double_t, Double_t > getTOFRange(Int_t station_id)
MEMap3Ids me_detail_tof_mu_
std::tuple< Int_t, Int_t > ME2IdsKey
Float_t toDegree(Float_t radian)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
MEMap3Ids me_detail_eloss_
std::tuple< Int_t, Int_t, Int_t > ME3IdsKey
MEMap1Ids me_eloss_others_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Int_t getDetOccBinX(Int_t num_layers, Int_t chamber_id, Int_t layer_id)
void analyze(const edm::Event &, const edm::EventSetup &) override
dqm::impl::MonitorElement * bookPIDHist(DQMStore::IBooker &booker, const T &key, const char *name, const char *title)
const std::string kLogCategory_
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)