14 if (GEMGeometry_ ==
nullptr) {
15 std::cout <<
"geometry is wrong! Terminated." << std::endl;
20 edm::LogInfo(
"MuonGEMHitsValidation") <<
"+++ Info : # of region : " <<
nRegion() << std::endl;
21 edm::LogInfo(
"MuonGEMHitsValidation") <<
"+++ Info : # of stations : " <<
nStation() << std::endl;
22 edm::LogInfo(
"MuonGEMHitsValidation") <<
"+++ Info : # of eta partition : " <<
nPart() << std::endl;
24 LogDebug(
"MuonGEMHitsValidation") <<
"+++ Info : finish to get geometry information from ES.\n";
26 LogDebug(
"MuonGEMHitsValidation") <<
"+++ Region independant part.\n";
32 TString hist_name_for_tofMu = TString::Format(
"gem_sh_simple_tofMuon_st%s",
getStationLabel(st).c_str());
33 TString hist_name_for_elossMu = TString::Format(
"gem_sh_simple_energylossMuon_st%s",
getStationLabel(st).c_str());
34 TString hist_label_for_tofMu = TString::Format(
35 "SimHit TOF(Muon only) station : station %s ; Time of flight [ns] ; entries",
getStationLabel(st).c_str());
36 TString hist_label_for_elossMu = TString::Format(
37 "SimHit energy loss(Muon only) : station %s ; Energy loss [eV] ; entries",
getStationLabel(st).c_str());
39 double tof_min, tof_max;
48 ibooker.
book1D(hist_name_for_tofMu.Data(), hist_label_for_tofMu.Data(), 40, tof_min, tof_max);
50 ibooker.
book1D(hist_name_for_elossMu.Data(), hist_label_for_elossMu.Data(), 60, 0., 6000.);
53 LogDebug(
"MuonGEMHitsValidation") <<
"+++ Region+Station part.\n";
59 LogDebug(
"MuonGEMHitsValidation") <<
"+++ SimpleZR Occupancy\n";
60 TString simpleZR_title = TString::Format(
"ZR Occupancy%s; |Z|(cm); R(cm)", title_suffix.Data());
61 TString simpleZR_histname = TString::Format(
"hit_simple_zr%s", histname_suffix.Data());
64 if (simpleZR !=
nullptr) {
72 LogDebug(
"MuonGEMHitsValidation") <<
"+++ dcEta Occupancy\n";
74 TString::Format(
"Occupancy for detector component %s;;#eta-partition", title_suffix2.Data());
75 TString dcEta_histname = TString::Format(
"hit_dcEta%s", histname_suffix2.Data());
77 if (dcEta !=
nullptr) {
83 LogDebug(
"MuonGEMHitsValidation") <<
"+++ Begining Detail Plots\n";
88 if (
ring->ring() != 1)
93 TString hist_name = TString::Format(
"gem_sh_xy%s", name_suffix.c_str());
94 TString hist_title = TString::Format(
"Simhit Global XY Plots at %s", title_suffix.c_str());
96 (hist_name +
"_even").Data(), (hist_title +
" even").Data(),
nBinXY_, -360, 360,
nBinXY_, -360, 360);
97 if (temp !=
nullptr) {
98 LogDebug(
"MuonGEMHitsValidation") <<
"ME can be acquired!";
100 LogDebug(
"MuonGEMHitsValidation") <<
"ME can not be acquired!";
106 (hist_name +
"_odd").Data(), (hist_title +
" odd").Data(),
nBinXY_, -360, 360,
nBinXY_, -360, 360);
107 if (temp2 !=
nullptr) {
108 LogDebug(
"MuonGEMHitsValidation") <<
"ME can be acquired!";
110 LogDebug(
"MuonGEMHitsValidation") <<
"ME can not be acquired!";
117 for (
unsigned int region_num = 0; region_num <
nRegion(); region_num++) {
118 for (
unsigned int station_num = 0; station_num <
nStation(); station_num++) {
119 for (
unsigned int layer_num = 0; layer_num < 2; layer_num++) {
120 gem_sh_zr[region_num][station_num][layer_num] =
121 BookHistZR(ibooker,
"gem_sh",
"SimHit", region_num, station_num, layer_num);
122 gem_sh_xy[region_num][station_num][layer_num] =
123 BookHistXY(ibooker,
"gem_sh",
"SimHit", region_num, station_num, layer_num);
125 int re = ((
unsigned int)region_num) * 2 - 1;
132 std::string hist_label_for_xy =
"SimHit occupancy : region" + suffixtitle +
" ; globalX [cm]; globalY[cm]";
133 std::string hist_label_for_tof =
"SimHit TOF : region" + suffixtitle +
" ; Time of flight [ns] ; entries";
135 "SimHit TOF(Muon only) : " + suffixtitle +
" ; Time of flight [ns] ; entries";
136 std::string hist_label_for_eloss =
"SimHit energy loss : " + suffixtitle +
" ; Energy loss [eV] ; entries";
138 "SimHit energy loss(Muon only) : " + suffixtitle +
" ; Energy loss [eV] ; entries";
140 double tof_min, tof_max;
141 if (station_num == 0) {
148 gem_sh_tof[region_num][station_num][layer_num] =
149 ibooker.
book1D(hist_name_for_tof.c_str(), hist_label_for_tof.c_str(), 40, tof_min, tof_max);
151 ibooker.
book1D(hist_name_for_tofMu.c_str(), hist_label_for_tofMu.c_str(), 40, tof_min, tof_max);
153 ibooker.
book1D(hist_name_for_eloss.c_str(), hist_label_for_eloss.c_str(), 60, 0., 6000.);
155 ibooker.
book1D(hist_name_for_elossMu.c_str(), hist_label_for_elossMu.c_str(), 60, 0., 6000.);
170 edm::LogError(
"GEMHitsValidation") <<
"Cannot get GEMHits by Token simInputTagToken";
174 for (
auto hits = GEMHits->begin();
hits != GEMHits->end();
hits++) {
178 Int_t layer = (Int_t)
id.layer();
180 Int_t nroll = (Int_t)
id.roll();
184 std::cout <<
"simHit did not matched with GEMGeometry." << std::endl;
192 Float_t g_r = hitGP.
perp();
193 Float_t g_x = hitGP.x();
194 Float_t g_y = hitGP.y();
195 Float_t g_z = hitGP.z();
199 int layer_num = layer - 1;
200 int binX = (chamber - 1) * 2 + layer_num;
206 TString simple_zr_histname = TString::Format(
"hit_simple_zr%s", histname_suffix.Data());
207 LogDebug(
"GEMHitsValidation") << simple_zr_histname << std::endl;
208 Hit_simple_zr[simple_zr_histname.Hash()]->Fill(fabs(g_z), g_r);
211 TString dcEta_histname = TString::Format(
"hit_dcEta%s", histname_suffix.Data());
212 LogDebug(
"GEMHitsValidation") << dcEta_histname << std::endl;
213 Hit_dcEta[dcEta_histname.Hash()]->Fill(binX, binY);
215 TString tofMu = TString::Format(
"gem_sh_simple_tofMuon_st%s",
getStationLabel(station).c_str());
216 TString elossMu = TString::Format(
"gem_sh_simple_energylossMuon_st%s",
getStationLabel(station).c_str());
218 if (
abs(
hits->particleType()) == 13) {
219 LogDebug(
"GEMHitsValidation") << tofMu << std::endl;
221 LogDebug(
"GEMHitsValidation") << elossMu << std::endl;
227 LogDebug(
"GEMHitsValidation") <<
"gzgr" << std::endl;
228 gem_sh_zr[(
int)(region / 2. + 0.5)][station - 1][layer_num]->
Fill(g_z, g_r);
229 LogDebug(
"GEMHitsValidation") <<
"gxgy" << std::endl;
230 gem_sh_xy[(
int)(region / 2. + 0.5)][station - 1][layer_num]->
Fill(g_x, g_y);
231 gem_sh_tof[(
int)(region / 2. + 0.5)][station - 1][layer_num]->
Fill(timeOfFlight);
233 if (
abs(
hits->particleType()) == 13) {
242 TString hist_name = TString::Format(
"gem_sh_xy%s", (
getSuffixName(
id.
region(), station) +
"_" + chamber).c_str());
244 LogDebug(
"GEMHitsValidation") << hist_name << std::endl;
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX)
T getParameter(std::string const &) const
MonitorElement * gem_sh_tof[2][3][2]
bool getByToken(EDGetToken token, Handle< PROD > &result) const
void setCurrentFolder(std::string const &fullpath)
MonitorElement * BookHistXY(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
std::unordered_map< UInt_t, MonitorElement * > Hit_dcEta
MonitorElement * BookHistZR(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
MonitorElement * gem_sh_eloss[2][3][2]
std::string getSuffixTitle(int region, int station, int layer)
const Plane & surface() const
The nominal surface of the GeomDet.
const GEMGeometry * initGeometry(const edm::EventSetup &)
MonitorElement * gem_sh_zr[2][3][2]
std::string getSuffixName(int region, int station, int layer)
MonitorElement * getDCEta(DQMStore::IBooker &, const GEMStation *, TString, TString)
std::unordered_map< UInt_t, MonitorElement * > gem_sh_simple_tofMu
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
Abs< T >::type abs(const T &t)
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
std::unordered_map< UInt_t, MonitorElement * > gem_sh_xy_st_ch
const GeomDet * idToDet(DetId) const override
MonitorElement * gem_sh_tofMu[2][3][2]
MonitorElement * gem_sh_elossMu[2][3][2]
MonitorElement * book2D(TString const &name, TString const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
edm::EDGetToken InputTagToken_
void analyze(const edm::Event &e, const edm::EventSetup &) override
~GEMHitsValidation() override
std::string getStationLabel(int i)
MonitorElement * gem_sh_xy[2][3][2]
double timeOfFlight(DetId id, const CaloGeometry *geo, bool debug=false)
GEMHitsValidation(const edm::ParameterSet &)
std::unordered_map< UInt_t, MonitorElement * > Hit_simple_zr
MonitorElement * getSimpleZR(DQMStore::IBooker &, TString, TString)
std::unordered_map< UInt_t, MonitorElement * > gem_sh_simple_elossMu