18 unsigned int region_num,
19 unsigned int station_num,
20 unsigned int layer_num,
21 const unsigned int Nbin,
24 string hist_name = name +
getSuffixName(region_num, station_num + 1, layer_num + 1);
25 string hist_label = label +
string(
" : ") +
getSuffixTitle(region_num, station_num + 1, layer_num + 1);
26 return ibooker.
book1D(hist_name, hist_label, Nbin, xMin, xMax);
32 unsigned int region_num,
33 const unsigned int Nbin,
38 return ibooker.
book1D(hist_name, hist_label, Nbin, xMin, xMax);
45 if (GEMGeometry_ ==
nullptr)
48 LogDebug(
"GEMRecHitsValidation") <<
"Geometry is acquired from MuonGeometryRecord\n";
50 LogDebug(
"GEMRecHitsValidation") <<
"ibooker set current folder\n";
52 gem_cls_tot = ibooker.
book1D(
"gem_cls_tot",
"ClusterSize Distribution", 11, -0.5, 10.5);
53 for (
auto ®ion : GEMGeometry_->
regions()) {
54 int re = region->region();
57 TString simpleZR_title = TString::Format(
"ZR Occupancy%s; |Z|(cm) ; R(cm)", title_suffix.Data());
58 TString simpleZR_histname = TString::Format(
"rh_simple_zr%s", histname_suffix.Data());
59 auto *simpleZR =
getSimpleZR(ibooker, simpleZR_title, simpleZR_histname);
60 if (simpleZR !=
nullptr) {
64 for (
auto &
station : region->stations()) {
65 int station_num =
station->station();
66 TString title_suffix2 = title_suffix + TString::Format(
" Station%d", station_num);
67 TString histname_suffix2 = histname_suffix + TString::Format(
"_st%d", station_num);
70 TString::Format(
"Occupancy for detector component %s;;#eta-partition", title_suffix2.Data());
71 TString dcEta_histname = TString::Format(
"rh_dcEta%s", histname_suffix2.Data());
73 if (dcEta !=
nullptr) {
77 for (
unsigned int sCh = 1; sCh <=
station->superChambers().size(); sCh++) {
78 for (
unsigned int Ch = 1; Ch <= 2; Ch++) {
80 TString
label = TString::Format(
"ch%d_la%d", sCh, Ch);
81 recHits_dcEta[dcEta_histname.Hash()]->setBinLabel(idx, label.Data());
87 for (
unsigned int region_num = 0; region_num <
nRegion(); region_num++) {
93 for (
unsigned int region_num = 0; region_num <
nRegion(); region_num++) {
94 for (
int layer_num = 0; layer_num < 2; layer_num++) {
95 for (
unsigned int station_num = 0; station_num <
nStation(); station_num++) {
97 ibooker,
"cls",
"ClusterSize Distribution", region_num, station_num, layer_num, 11, -0.5, 10.5);
98 gem_pullX[region_num][station_num][layer_num] =
99 BookHist1D(ibooker,
"pullX",
"Pull Of X", region_num, station_num, layer_num, 100, -50, 50);
100 gem_pullY[region_num][station_num][layer_num] =
101 BookHist1D(ibooker,
"pullY",
"Pull Of Y", region_num, station_num, layer_num, 100, -50, 50);
102 gem_rh_zr[region_num][station_num][layer_num] =
103 BookHistZR(ibooker,
"rh",
"RecHits", region_num, station_num, layer_num);
104 gem_rh_xy[region_num][station_num][layer_num] =
105 BookHistXY(ibooker,
"rh",
"RecHits", region_num, station_num, layer_num);
110 LogDebug(
"GEMRecHitsValidation") <<
"Booking End.\n";
117 if (GEMGeometry_ ==
nullptr)
125 edm::LogError(
"GEMRecHitsValidation") <<
"Cannot get strips by Token RecHits Token.\n";
129 for (edm::PSimHitContainer::const_iterator
hits = gemSimHits->begin();
hits != gemSimHits->end(); ++
hits) {
132 Int_t sh_region =
id.region();
134 Int_t sh_roll =
id.roll();
135 Int_t sh_station =
id.station();
136 Int_t sh_layer =
id.layer();
137 Int_t sh_chamber =
id.chamber();
139 if (GEMGeometry_->
idToDet(
hits->detUnitId()) ==
nullptr) {
140 std::cout <<
"simHit did not matched with GEMGeometry." << std::endl;
144 if (!(
abs(
hits->particleType()) == 13))
158 Float_t sh_l_x = hitLP.x();
159 Float_t sh_l_y = hitLP.y();
163 Float_t rh_l_x =
recHit->localPosition().x();
164 Float_t rh_l_xErr =
recHit->localPositionError().xx();
165 Float_t rh_l_y =
recHit->localPosition().y();
166 Float_t rh_l_yErr =
recHit->localPositionError().yy();
169 Int_t clusterSize =
recHit->clusterSize();
170 Int_t firstClusterStrip =
recHit->firstClusterStrip();
174 Short_t rh_region = (Short_t)
id.region();
176 Short_t rh_station = (Short_t)
id.
station();
177 Short_t rh_layer = (Short_t)
id.layer();
178 Short_t rh_chamber = (Short_t)
id.
chamber();
179 Short_t rh_roll = (Short_t)
id.roll();
182 if (GEMGeometry_->
idToDet((*recHit).gemId()) ==
nullptr) {
183 std::cout <<
"This gem recHit did not matched with GEMGeometry." << std::endl;
188 Float_t rh_g_R = recHitGP.
perp();
191 Float_t rh_g_X = recHitGP.
x();
192 Float_t rh_g_Y = recHitGP.
y();
193 Float_t rh_g_Z = recHitGP.
z();
194 Float_t rh_pullX = (Float_t)(rh_l_x - sh_l_x) / (rh_l_xErr);
195 Float_t rh_pullY = (Float_t)(rh_l_y - sh_l_y) / (rh_l_yErr);
197 std::vector<int> stripsFired;
198 for (
int i = firstClusterStrip;
i < (firstClusterStrip + clusterSize);
i++) {
199 stripsFired.push_back(
i);
202 const bool cond1(sh_region == rh_region and sh_layer == rh_layer and sh_station == rh_station);
203 const bool cond2(sh_chamber == rh_chamber and sh_roll == rh_roll);
204 const bool cond3(
std::find(stripsFired.begin(), stripsFired.end(), (sh_strip + 1)) != stripsFired.end());
206 if (cond1 and cond2 and cond3) {
207 LogDebug(
"GEMRecHitsValidation") <<
" Region : " << rh_region <<
"\t Station : " << rh_station
208 <<
"\t Layer : " << rh_layer <<
"\n Radius: " << rh_g_R <<
"\t X : " << rh_g_X
209 <<
"\t Y : " << rh_g_Y <<
"\t Z : " << rh_g_Z << std::endl;
214 else if (rh_region == 1)
216 int layer_num = rh_layer - 1;
217 int binX = (rh_chamber - 1) * 2 + layer_num;
219 int station_num = rh_station - 1;
222 TString histname_suffix = TString::Format(
"_r%d", rh_region);
223 TString simple_zr_histname = TString::Format(
"rh_simple_zr%s", histname_suffix.Data());
224 LogDebug(
"GEMRecHitsValidation") <<
" simpleZR!\n";
227 histname_suffix = TString::Format(
"_r%d_st%d", rh_region, rh_station);
228 TString dcEta_histname = TString::Format(
"rh_dcEta%s", histname_suffix.Data());
229 LogDebug(
"GEMRecHitsValidation") <<
" dcEta\n";
235 LogDebug(
"GEMRecHitsValidation") <<
" Begin detailPlot!\n";
238 gem_cls[region_num][station_num][layer_num]->
Fill(clusterSize);
239 gem_pullX[region_num][station_num][layer_num]->
Fill(rh_pullX);
240 gem_pullY[region_num][station_num][layer_num]->
Fill(rh_pullY);
241 gem_rh_zr[region_num][station_num][layer_num]->
Fill(rh_g_Z, rh_g_R);
242 gem_rh_xy[region_num][station_num][layer_num]->
Fill(rh_g_X, rh_g_Y);
T getParameter(std::string const &) const
MonitorElement * gem_pullX[2][3][2]
void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
bool getByToken(EDGetToken token, Handle< PROD > &result) const
MonitorElement * BookHistZR(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
MonitorElement * gem_region_pullY[2]
MonitorElement * getSimpleZR(DQMStore::IBooker &, TString, TString)
MonitorElement * BookHistXY(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
MonitorElement * gem_rh_xy[2][3][2]
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::string getSuffixTitle(int region, int station, int layer)
MonitorElement * gem_rh_zr[2][3][2]
const GEMEtaPartition * etaPartition(GEMDetId id) const
Return a GEMEtaPartition given its id.
const GEMGeometry * initGeometry(const edm::EventSetup &)
MonitorElement * gem_cls[2][3][2]
std::string getSuffixName(int region, int station, int layer)
C::const_iterator const_iterator
constant access iterator type
void setCurrentFolder(std::string const &fullpath)
MonitorElement * gem_cls_tot
edm::EDGetToken InputTagToken_
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
MonitorElement * book1D(Args &&...args)
std::unordered_map< UInt_t, MonitorElement * > recHits_simple_zr
Abs< T >::type abs(const T &t)
MonitorElement * BookHist1D(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num, const unsigned int Nbin, const Float_t xMin, const Float_t xMax)
GEMRecHitsValidation(const edm::ParameterSet &)
void analyze(const edm::Event &e, const edm::EventSetup &) override
~GEMRecHitsValidation() override
const GeomDet * idToDet(DetId) const override
MonitorElement * getDCEta(DQMStore::IBooker &, const GEMStation *, TString, TString)
MonitorElement * gem_pullY[2][3][2]
std::unordered_map< UInt_t, MonitorElement * > recHits_dcEta
MonitorElement * gem_region_pullX[2]
edm::EDGetToken InputTagToken_RH