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";
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);
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;
59 for (
const auto& chamber : super_chamber->
chambers()) {
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";
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);
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)",
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;
155 for (
const auto& chamber : super_chamber->
chambers()) {
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};
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")
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
T getUntrackedParameter(std::string const &, T const &) const
~GEMSimHitValidation() override
MEMap2Ids me_detail_occ_det_
MEMap3Ids me_detail_occ_xy_
virtual void setCurrentFolder(std::string const &fullpath)
GEMSimHitValidation(const edm::ParameterSet &)
Bool_t isMuonSimHit(const PSimHit &)
const GeomDet * idToDet(DetId) const override
Geom::Phi< T > phi() 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_
const Plane & surface() const
The nominal surface of the GeomDet.
bool getData(T &iHolder) const
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_
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
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)
T const * product() const
ParameterSet const & getParameterSet(std::string const &) const
constexpr int layer() const
GEMDetId id() const
Return the GEMDetId of this super chamber.
T getParameter(std::string const &) const
MEMap3Ids me_detail_tof_mu_
const std::vector< const GEMChamber * > & chambers() const
Return the chambers in the super chamber.
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_
dqm::impl::MonitorElement * bookDetectorOccupancy(DQMStore::IBooker &booker, const T &key, const GEMStation *station, const char *name_prfix, const char *title_prefix)