test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GEMBaseValidation.cc
Go to the documentation of this file.
4 //#include "DataFormats/GEMDigi/interface/GEMDigiCollection.h"
6 #include <memory>
7 using namespace std;
9 {
10  nBinZR_ = ps.getUntrackedParameter< std::vector<double> >("nBinGlobalZR") ;
11  RangeZR_ = ps.getUntrackedParameter< std::vector<double> >("RangeGlobalZR");
12  nBinXY_ = ps.getUntrackedParameter< int >("nBinGlobalXY",360) ;
13 
14  regionLabel.push_back("-1");
15  regionLabel.push_back("1" );
16 
17 
18  layerLabel.push_back("1");
19  layerLabel.push_back("2");
20 }
21 
23  const GEMGeometry* GEMGeometry_ = nullptr;
24  try {
26  iSetup.get<MuonGeometryRecord>().get(hGeom);
27  GEMGeometry_ = &*hGeom;
28  }
30  edm::LogError("MuonGEMBaseValidation") << "+++ Error : GEM geometry is unavailable on event loop. +++\n";
31  return nullptr;
32  }
33  nregion = GEMGeometry_->regions().size();
34  nstation = GEMGeometry_->regions()[0]->stations().size() ;
35  nstationForLabel = GEMGeometry_->regions()[0]->stations().size() ;
36  npart = GEMGeometry_->regions()[0]->stations()[0]->superChambers()[0]->chambers()[0]->etaPartitions().size();
37 
38  return GEMGeometry_;
39 }
40 
41 string GEMBaseValidation::getSuffixName(int region, int station, int layer){
42  if ( region == -1 ) region =0 ;
43  else if ( region >1 ) std::cout<<"Name)Alert! Region must be -1 or 1 : "<<region<<" "<<station<<" "<<layer<<std::endl;
44  return string("_r")+regionLabel[region]+"_st"+getStationLabel(station)+"_l"+layerLabel[layer-1];
45 }
47  if ( region == -1 ) region =0 ;
48  else if ( region >1 ) std::cout<<"Name)Alert! Region must be -1 or 1 : "<<region<<" "<<station<<std::endl;
49  return string("_r")+regionLabel[region]+"_st"+getStationLabel(station);
50 }
52  if ( region == -1 ) region =0 ;
53  else if ( region >1 ) std::cout<<"Name)Alert! Region must be -1 or 1 : "<<region<<std::endl;
54  return string("_r")+regionLabel[region];
55 }
56 
57 string GEMBaseValidation::getSuffixTitle(int region, int station, int layer){
58  if ( region == -1 ) region =0 ;
59  else if ( region >1 ) std::cout<<"Title)Alert! Region must be -1 or 1 : "<<region<<" "<<station<<" "<<layer<<std::endl;
60  return string("Region ")+regionLabel[region]+" Station "+getStationLabel(station)+" Layer "+layerLabel[layer-1];
61 }
63  if ( region == -1 ) region =0 ;
64  else if ( region >1 ) std::cout<<"Title)Alert! Region must be -1 or 1 : "<<region<<" "<<station<<std::endl;
65  return string("Region ")+regionLabel[region]+" Station "+getStationLabel(station);
66 }
68  if ( region == -1 ) region =0 ;
69  else if ( region >1 ) std::cout<<"Title)Alert! Region must be -1 or 1 : "<<region<<std::endl;
70  return string("Region ")+regionLabel[region];
71 }
72 
74  vector<string> stationLabel;
75  if ( nstationForLabel == 2) {
76  string stationLabel[] = {"1","2"};
77  return stationLabel[i-1];
78  }
79  else if ( nstationForLabel ==3 ) {
80  string stationLabel[] = {"1","2s","2l"};
81  return stationLabel[i-1];
82  }
83  else {
84  std::cout<<"Something is wrong"<<std::endl;
85  return "";
86  }
87 }
88 
89 
90 
91 
93 }
94 
96  std::vector<double> xbins_vector;
97  double station1_xmin = RangeZR_[ 0 ];
98  double station1_xmax = RangeZR_[ 1 ];
99  double station2_xmin = RangeZR_[ 4 ];
100  double station2_xmax = RangeZR_[ 5 ];
101 
102  for( double i= station1_xmin-1 ; i< station2_xmax+1; i=i+0.25 ) {
103  if ( i > station1_xmax+1 && i<station2_xmin-1 ) continue;
104  xbins_vector.push_back(i);
105  }
106  TH2F* simpleZR_temp = new TH2F(title,histname, xbins_vector.size()-1, (double*)&xbins_vector[0], 50,120,330);
107  MonitorElement* simpleZR = ibooker.book2D( histname, simpleZR_temp);
108  return simpleZR;
109 }
110 
111 MonitorElement* GEMBaseValidation::getDCEta(DQMStore::IBooker& ibooker, const GEMStation* station, TString title, TString histname ) {
112  if( station->rings()[0]->superChambers().size() ==0) {
113  LogDebug("MuonBaseValidation")<<"+++ Error! can not get superChambers. Skip "<<getSuffixTitle(station->region(), station->station())<<" on "<<histname<<"\n";
114  return nullptr;
115  }
116 
117  int nXbins = station->rings()[0]->nSuperChambers()*2;;
118  int nRoll1 = station->rings()[0]->superChambers()[0]->chambers()[0]->etaPartitions().size();;
119  int nRoll2 = station->rings()[0]->superChambers()[0]->chambers()[1]->etaPartitions().size();;
120  int nYbins = ( nRoll1 > nRoll2 ) ? nRoll1 : nRoll2;;
121 
122  TH2F* dcEta_temp = new TH2F(title,histname,nXbins, 0, nXbins, nYbins, 1, nYbins+1);
123  int idx = 0 ;
124  for(unsigned int sCh = 1; sCh <= station->superChambers().size(); sCh++){
125  for(unsigned int Ch = 1; Ch <= 2; Ch++){
126  idx++;
127  TString label = TString::Format("ch%d_la%d", sCh, Ch);
128  dcEta_temp->GetXaxis()->SetBinLabel(idx, label.Data());
129  }
130  }
131  MonitorElement* dcEta = ibooker.book2D( histname, dcEta_temp);
132  return dcEta;
133 }
134 
135 
136 MonitorElement* GEMBaseValidation::BookHistZR( DQMStore::IBooker& ibooker, const char* name, const char* label, unsigned int region_num, unsigned int station_num, unsigned int layer_num) {
137  string hist_name, hist_title;
138  if ( layer_num == 0 || layer_num==1 ) {
139  hist_name = name+string("_zr") + getSuffixName(region_num, station_num+1, layer_num+1);
140  hist_title = label+string(" occupancy : region")+getSuffixTitle( region_num, station_num+1, layer_num+1)+" ; globalZ[cm] ; globalR[cm]";
141  }
142  else {
143  hist_name = name+string("_zr") + getSuffixName(region_num, station_num+1);
144  hist_title = label+string(" occupancy : region")+getSuffixTitle( region_num, station_num+1)+" ; globalZ[cm] ; globalR[cm]";
145  }
146  LogDebug("GEMBaseValidation")<<hist_name<<" "<<hist_title<<std::endl;
147  int xbin = (int)nBinZR_[station_num];
148  int ybin = (int)nBinZR_[ nBinZR_.size()/2+station_num];
149  double xmin = 0;
150  double xmax = 0;
151  double ymin = 0;
152  double ymax = 0;
153  ymin = RangeZR_[ RangeZR_.size()/2 + station_num*2 + 0];
154  ymax = RangeZR_[ RangeZR_.size()/2 + station_num*2 + 1];
155  if ( region_num ==0 ) {
156  xmin = -RangeZR_[ station_num*2 + 1];
157  xmax = -RangeZR_[ station_num*2 + 0];
158  }
159  else {
160  xmin = RangeZR_[ station_num*2 + 0];
161  xmax = RangeZR_[ station_num*2 + 1];
162  }
163  return ibooker.book2D( hist_name, hist_title, xbin, xmin, xmax, ybin,ymin, ymax);
164 }
165 
166 MonitorElement* GEMBaseValidation::BookHistXY( DQMStore::IBooker& ibooker, const char* name, const char* label, unsigned int region_num, unsigned int station_num, unsigned int layer_num) {
167  string hist_name, hist_title;
168  if ( layer_num == 0 || layer_num==1 ) {
169  hist_name = name+string("_xy") + getSuffixName( region_num, station_num+1, layer_num+1) ;
170  hist_title = label+string(" occupancy : ")+getSuffixTitle( region_num, station_num+1, layer_num+1 )+ " ; globalX [cm]; globalY[cm]";
171  }
172  else {
173  hist_name = name+string("_xy") + getSuffixName( region_num, station_num+1);
174  hist_title = label+string(" occupancy : region")+getSuffixTitle( region_num, station_num+1) +" ; globalX [cm]; globalY[cm]";
175  }
176  return ibooker.book2D( hist_name, hist_title, nBinXY_, -360,360,nBinXY_,-360,360);
177 }
178 
#define LogDebug(id)
T getUntrackedParameter(std::string const &, T const &) const
virtual ~GEMBaseValidation()
int i
Definition: DBlmapReader.cc:9
MonitorElement * BookHistZR(DQMStore::IBooker &, const char *name, const char *label, unsigned int region_num, unsigned int station_num, unsigned int layer_num=99)
int region() const
Get the region.
Definition: GEMStation.cc:83
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)
double npart
Definition: HydjetWrapper.h:49
int station() const
Get the station.
Definition: GEMStation.cc:87
std::string getSuffixTitle(int region, int station, int layer)
const GEMGeometry * initGeometry(const edm::EventSetup &)
std::vector< const GEMSuperChamber * > superChambers() const
Return the super chambers in the region.
Definition: GEMStation.cc:49
std::string getSuffixName(int region, int station, int layer)
const std::vector< const GEMRegion * > & regions() const
Return a vector of all GEM regions.
Definition: GEMGeometry.cc:43
GEMBaseValidation(const edm::ParameterSet &ps)
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
const T & get() const
Definition: EventSetup.h:56
MonitorElement * getDCEta(DQMStore::IBooker &, const GEMStation *, TString, TString)
tuple cout
Definition: gather_cfg.py:145
std::string getStationLabel(int i)
const std::vector< const GEMRing * > & rings() const
Return the rings in the station.
Definition: GEMStation.cc:67