17 string hist_name = name+
getSuffixName( region_num, station_num+1, layer_num+1);
19 return ibooker.
book1D( hist_name, hist_label,Nbin,xMin,xMax );
25 return ibooker.
book1D( hist_name, hist_label,Nbin,xMin,xMax );
30 if ( GEMGeometry_ ==
nullptr)
return ;
32 LogDebug(
"GEMRecHitsValidation")<<
"Geometry is acquired from MuonGeometryRecord\n";
34 LogDebug(
"GEMRecHitsValidation")<<
"ibooker set current folder\n";
37 gem_cls_tot = ibooker.
book1D(
"gem_cls_tot",
"ClusterSize Distribution",11,-0.5,10.5);
38 for(
auto& region : GEMGeometry_->
regions() ){
39 int re = region->region();
42 TString simpleZR_title = TString::Format(
"ZR Occupancy%s; |Z|(cm) ; R(cm)",title_suffix.Data());
43 TString simpleZR_histname = TString::Format(
"rh_simple_zr%s",histname_suffix.Data());
44 auto* simpleZR =
getSimpleZR(ibooker, simpleZR_title, simpleZR_histname);
45 if( simpleZR !=
nullptr) {
49 for(
auto&
station : region->stations()) {
50 int station_num =
station->station();
51 TString title_suffix2 = title_suffix + TString::Format(
" Station%d", station_num);
52 TString histname_suffix2 = histname_suffix + TString::Format(
"_st%d", station_num);
54 TString dcEta_title = TString::Format(
"Occupancy for detector component %s;;#eta-partition",title_suffix2.Data());
55 TString dcEta_histname = TString::Format(
"rh_dcEta%s",histname_suffix2.Data());
57 if ( dcEta !=
nullptr) {
61 for(
unsigned int sCh = 1 ; sCh <=
station->superChambers().size() ; sCh++ ) {
62 for(
unsigned int Ch =1 ; Ch<=2 ; Ch++) {
64 TString
label = TString::Format(
"ch%d_la%d",sCh, Ch);
65 recHits_dcEta[ dcEta_histname.Hash() ]->setBinLabel(idx, label.Data());
71 for(
unsigned int region_num = 0 ; region_num <
nRegion() ; region_num++ ) {
77 for(
unsigned int region_num = 0 ; region_num <
nRegion() ; region_num++ ) {
78 for(
int layer_num = 0 ; layer_num < 2 ; layer_num++) {
79 for(
unsigned int station_num = 0 ; station_num <
nStation() ; station_num++) {
80 gem_cls[region_num][station_num][layer_num] =
BookHist1D(ibooker,
"cls",
"ClusterSize Distribution",region_num,station_num,layer_num,11,-0.5,10.5);
81 gem_pullX[region_num][station_num][layer_num] =
BookHist1D(ibooker,
"pullX",
"Pull Of X",region_num,station_num,layer_num,100,-50,50);
82 gem_pullY[region_num][station_num][layer_num] =
BookHist1D(ibooker,
"pullY",
"Pull Of Y",region_num,station_num,layer_num,100,-50,50);
83 gem_rh_zr[region_num][station_num][layer_num] =
BookHistZR(ibooker,
"rh",
"RecHits",region_num,station_num,layer_num);
84 gem_rh_xy[region_num][station_num][layer_num] =
BookHistXY(ibooker,
"rh",
"RecHits",region_num,station_num,layer_num);
89 LogDebug(
"GEMRecHitsValidation")<<
"Booking End.\n";
100 if ( GEMGeometry_ ==
nullptr)
return;
107 edm::LogError(
"GEMRecHitsValidation") <<
"Cannot get strips by Token RecHits Token.\n";
111 for (edm::PSimHitContainer::const_iterator
hits = gemSimHits->begin();
hits!=gemSimHits->end(); ++
hits) {
115 Int_t sh_region =
id.region();
117 Int_t sh_roll =
id.roll();
118 Int_t sh_station =
id.station();
119 Int_t sh_layer =
id.layer();
120 Int_t sh_chamber =
id.chamber();
122 if ( GEMGeometry_->
idToDet(
hits->detUnitId()) ==
nullptr) {
123 std::cout<<
"simHit did not matched with GEMGeometry."<<std::endl;
138 Float_t sh_l_x = hitLP.x();
139 Float_t sh_l_y = hitLP.y();
144 Float_t rh_l_x =
recHit->localPosition().x();
145 Float_t rh_l_xErr =
recHit->localPositionError().xx();
146 Float_t rh_l_y =
recHit->localPosition().y();
147 Float_t rh_l_yErr =
recHit->localPositionError().yy();
150 Int_t clusterSize =
recHit->clusterSize();
151 Int_t firstClusterStrip =
recHit->firstClusterStrip();
155 Short_t rh_region = (Short_t)
id.region();
157 Short_t rh_station = (Short_t)
id.
station();
158 Short_t rh_layer = (Short_t)
id.layer();
159 Short_t rh_chamber = (Short_t)
id.
chamber();
160 Short_t rh_roll = (Short_t)
id.roll();
163 if ( GEMGeometry_->
idToDet((*recHit).gemId()) ==
nullptr) {
164 std::cout<<
"This gem recHit did not matched with GEMGeometry."<<std::endl;
169 Float_t rh_g_R = recHitGP.
perp();
172 Float_t rh_g_X = recHitGP.
x();
173 Float_t rh_g_Y = recHitGP.
y();
174 Float_t rh_g_Z = recHitGP.
z();
175 Float_t rh_pullX = (Float_t)(rh_l_x - sh_l_x)/(rh_l_xErr);
176 Float_t rh_pullY = (Float_t)(rh_l_y - sh_l_y)/(rh_l_yErr);
178 std::vector<int> stripsFired;
179 for(
int i = firstClusterStrip;
i < (firstClusterStrip + clusterSize);
i++){
180 stripsFired.push_back(
i);
183 const bool cond1( sh_region == rh_region and sh_layer == rh_layer and sh_station == rh_station);
184 const bool cond2(sh_chamber == rh_chamber and sh_roll == rh_roll);
185 const bool cond3(
std::find(stripsFired.begin(), stripsFired.end(), (sh_strip + 1)) != stripsFired.end());
187 if(cond1 and cond2 and cond3){
188 LogDebug(
"GEMRecHitsValidation")<<
" Region : " << rh_region <<
"\t Station : " << rh_station
189 <<
"\t Layer : "<< rh_layer <<
"\n Radius: " << rh_g_R <<
"\t X : " << rh_g_X <<
"\t Y : "<< rh_g_Y <<
"\t Z : " << rh_g_Z << std::endl;
192 if ( rh_region ==-1 ) region_num = 0 ;
193 else if ( rh_region==1) region_num = 1;
194 int layer_num = rh_layer-1;
195 int binX = (rh_chamber-1)*2+layer_num;
197 int station_num = rh_station -1;
200 TString histname_suffix = TString::Format(
"_r%d",rh_region);
201 TString simple_zr_histname = TString::Format(
"rh_simple_zr%s",histname_suffix.Data());
202 LogDebug(
"GEMRecHitsValidation")<<
" simpleZR!\n";
206 histname_suffix = TString::Format(
"_r%d_st%d",rh_region, rh_station);
207 TString dcEta_histname = TString::Format(
"rh_dcEta%s",histname_suffix.Data());
208 LogDebug(
"GEMRecHitsValidation")<<
" dcEta\n";
214 LogDebug(
"GEMRecHitsValidation")<<
" Begin detailPlot!\n";
217 gem_cls[region_num][station_num][layer_num]->
Fill(clusterSize);
218 gem_pullX[region_num][station_num][layer_num]->
Fill(rh_pullX);
219 gem_pullY[region_num][station_num][layer_num]->
Fill(rh_pullY);
220 gem_rh_zr[region_num][station_num][layer_num]->
Fill(rh_g_Z ,rh_g_R);
221 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]
std::unordered_map< UInt_t, MonitorElement * > recHits_dcEta
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)
std::unordered_map< UInt_t, MonitorElement * > recHits_simple_zr
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)
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)
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
void setCurrentFolder(const std::string &fullpath)
const GeomDet * idToDet(DetId) const override
MonitorElement * getDCEta(DQMStore::IBooker &, const GEMStation *, TString, TString)
return(e1-e2)*(e1-e2)+dp *dp
MonitorElement * gem_pullY[2][3][2]
MonitorElement * gem_region_pullX[2]
edm::EDGetToken InputTagToken_RH