CMS 3D CMS Logo

RPCClusterSizeTest.cc
Go to the documentation of this file.
3 
4 // Framework
6 
7 // //Geometry
9 
11  edm::LogVerbatim ("rpceventsummary") << "[RPCClusterSizeTest]: Constructor";
12 
13  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
14 
15  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
16  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
17  testMode_ = ps.getUntrackedParameter<bool>("testMode", false);
18  useRollInfo_ = ps.getUntrackedParameter<bool>("useRollInfo", false);
19 
20  resetMEArrays();
21 }
22 
24 
26  edm::LogVerbatim ("rpceventsummary") << "[RPCClusterSizeTest]: Begin job ";
27 
28  globalFolder_ = workingFolder;
29 }
30 
31 
32 void RPCClusterSizeTest::getMonitorElements(std::vector<MonitorElement *> & meVector, std::vector<RPCDetId> & detIdVector, std::string & clientHistoName){
33 
34 
35  //Get ME for each roll
36  for (unsigned int i = 0 ; i<meVector.size(); i++){
37 
38  std::string meName = meVector[i]->getName();
39 
40  if(meName.find(clientHistoName) != std::string::npos){
41  myClusterMe_.push_back(meVector[i]);
42  myDetIds_.push_back(detIdVector[i]);
43  }
44  }
45 }
46 
47 
49 
50  edm::LogVerbatim ("rpceventsummary") <<"[RPCClusterSizeTest]:Client Operation";
51 
52  //check some statements and prescale Factor
53  if(myClusterMe_.size()==0 || myDetIds_.size()==0)return;
54 
55  MonitorElement * CLS = NULL; // ClusterSize in 1 bin, Roll vs Sector
56  MonitorElement * CLSD = NULL; // ClusterSize in 1 bin, Distribution
57  MonitorElement * MEAN = NULL; // Mean ClusterSize, Roll vs Sector
58  MonitorElement * MEAND = NULL; // Mean ClusterSize, Distribution
59 
60 
61  std::stringstream meName;
62  RPCDetId detId;
63  MonitorElement * myMe;
64 
65 
66  //Loop on chambers
67  for (unsigned int i = 0 ; i<myClusterMe_.size();i++){
68 
69  myMe = myClusterMe_[i];
70  if (!myMe || myMe->getEntries()==0 )continue;
71 
72 
73  detId=myDetIds_[i];
74 
75 
76  if (detId.region()==0){
77 
78  CLS = CLSWheel[detId.ring()+2];
79  MEAN = MEANWheel[detId.ring()+2];
80  if(testMode_){
81  CLSD = CLSDWheel[detId.ring()+2];
82  MEAND = MEANDWheel[detId.ring()+2];
83  }
84  }else {
85 
86  if(((detId.station() * detId.region() ) + numberOfDisks_) >= 0 ){
87 
88  if(detId.region()<0){
89  CLS=CLSDisk[(detId.station() * detId.region() ) + numberOfDisks_];
90  MEAN= MEANDisk[(detId.station() * detId.region() ) + numberOfDisks_];
91  if(testMode_){
92  CLSD = CLSDDisk[(detId.station() * detId.region() ) + numberOfDisks_];
93  MEAND= MEANDDisk[(detId.station() * detId.region() ) + numberOfDisks_];
94  }
95  }else{
96  CLS=CLSDisk[(detId.station() * detId.region() ) + numberOfDisks_ -1];
97  MEAN= MEANDisk[(detId.station() * detId.region() ) + numberOfDisks_-1];
98  if(testMode_){
99  CLSD = CLSDDisk[(detId.station() * detId.region() ) + numberOfDisks_-1];
100  MEAND= MEANDDisk[(detId.station() * detId.region() ) + numberOfDisks_-1];
101  }
102  }
103  }
104 
105  }
106 
107 
108  int xBin,yBin;
109 
110  if (detId.region()==0){//Barrel
111 
112  rpcdqm::utils rollNumber;
113  yBin = rollNumber.detId2RollNr(detId);
114  xBin = detId.sector();
115  }else {//Endcap
116 
117  //get segment number
118  RPCGeomServ RPCServ(detId);
119  xBin = RPCServ.segment();
120  (numberOfRings_ == 3 ? yBin= detId.ring()*3-detId.roll()+1 : yBin= (detId.ring()-1)*3-detId.roll()+1);
121  }
122 
123  // Normalization -> # of Entries in first Bin normalaized by total Entries
124 
125  float NormCLS = myMe->getBinContent(1)/myMe->getEntries();
126  float meanCLS = myMe->getMean();
127 
128  if (CLS) CLS -> setBinContent(xBin,yBin, NormCLS);
129  if(MEAN) MEAN -> setBinContent(xBin, yBin, meanCLS);
130 
131  if(testMode_){
132  if(MEAND) MEAND->Fill(meanCLS);
133  if(CLSD) CLSD->Fill(NormCLS);
134  }
135 
136  }//End loop on chambers
137 }
138 
139 
141  memset((void*) CLSWheel, 0, sizeof(MonitorElement*)*kWheels);
142  memset((void*) CLSDWheel, 0, sizeof(MonitorElement*)*kWheels);
143  memset((void*) MEANWheel, 0, sizeof(MonitorElement*)*kWheels);
144  memset((void*) MEANDWheel, 0, sizeof(MonitorElement*)*kWheels);
145 
146  memset((void*) CLSDisk, 0, sizeof(MonitorElement*)*kDisks);
147  memset((void*) CLSDDisk, 0, sizeof(MonitorElement*)*kDisks);
148  memset((void*) MEANDisk, 0, sizeof(MonitorElement*)*kDisks);
149  memset((void*) MEANDDisk, 0, sizeof(MonitorElement*)*kDisks);
150 }
151 
152 
154 
155  resetMEArrays();
156 
158 
159  std::stringstream histoName;
160 
161  rpcdqm::utils rpcUtils;
162 
163  // Loop over wheels
164  for (int w = -2; w <= 2; w++) {
165  histoName.str("");
166  histoName<<"ClusterSizeIn1Bin_Roll_vs_Sector_Wheel"<<w; // ClusterSize in first bin norm. by Entries (2D Roll vs Sector)
167  CLSWheel[w+2] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
168  rpcUtils.labelXAxisSector( CLSWheel[w+2]);
169  rpcUtils.labelYAxisRoll( CLSWheel[w+2], 0, w ,useRollInfo_);
170 
171 
172  histoName.str("");
173  histoName<<"ClusterSizeMean_Roll_vs_Sector_Wheel"<<w; // Avarage ClusterSize (2D Roll vs Sector)
174  MEANWheel[w+2] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 12, 0.5, 12.5, 21, 0.5, 21.5);
175 
176  rpcUtils.labelXAxisSector( MEANWheel[w+2]);
177  rpcUtils.labelYAxisRoll(MEANWheel[w+2], 0, w,useRollInfo_ );
178 
179  if(testMode_){
180  histoName.str("");
181  histoName<<"ClusterSizeIn1Bin_Distribution_Wheel"<<w; // ClusterSize in first bin, distribution
182  CLSDWheel[w+2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 20, 0.0, 1.0);
183 
184 
185  histoName.str("");
186  histoName<<"ClusterSizeMean_Distribution_Wheel"<<w; // Avarage ClusterSize Distribution
187  MEANDWheel[w+2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 0.5, 10.5);
188  }
189  }//end loop on wheels
190 
191 
192  for (int d = -numberOfDisks_; d <= numberOfDisks_; d++) {
193  if (d == 0)
194  continue;
195  //Endcap
196  int offset = numberOfDisks_;
197  if (d>0) offset--;
198 
199  histoName.str("");
200  histoName<<"ClusterSizeIn1Bin_Ring_vs_Segment_Disk"<<d; // ClusterSize in first bin norm. by Entries (2D Roll vs Sector)
201  CLSDisk[d+offset] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(),36, 0.5, 36.5, 3*numberOfRings_, 0.5,3*numberOfRings_+ 0.5);
202  rpcUtils.labelXAxisSegment(CLSDisk[d+offset]);
203  rpcUtils.labelYAxisRing(CLSDisk[d+offset], numberOfRings_,useRollInfo_ );
204 
205  if(testMode_){
206  histoName.str("");
207  histoName<<"ClusterSizeIn1Bin_Distribution_Disk"<<d; // ClusterSize in first bin, distribution
208  CLSDDisk[d+offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 20, 0.0, 1.0);
209 
210  histoName.str("");
211  histoName<<"ClusterSizeMean_Distribution_Disk"<<d; // Avarage ClusterSize Distribution
212  MEANDDisk[d+offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 100, 0.5, 10.5);
213 
214  }
215 
216  histoName.str("");
217  histoName<<"ClusterSizeMean_Ring_vs_Segment_Disk"<<d; // Avarage ClusterSize (2D Roll vs Sector)
218  MEANDisk[d+offset] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str(), 36, 0.5, 36.5, 3*numberOfRings_, 0.5,3*numberOfRings_+ 0.5);
219  rpcUtils.labelXAxisSegment(MEANDisk[d+offset]);
220  rpcUtils.labelYAxisRing(MEANDisk[d+offset], numberOfRings_ ,useRollInfo_);
221  }
222 }
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
const double w
Definition: UKUtility.cc:23
MonitorElement * MEANWheel[kWheels]
void myBooker(DQMStore::IBooker &)
void labelXAxisSegment(MonitorElement *myMe)
Definition: utils.h:250
void labelYAxisRoll(MonitorElement *myMe, int region, int ring, bool useRollInfo)
Definition: utils.h:268
#define NULL
Definition: scimark2.h:8
MonitorElement * MEANDWheel[kWheels]
double getEntries(void) const
get # of entries
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * CLSDisk[kDisks]
MonitorElement * CLSDWheel[kWheels]
void Fill(long long x)
void labelYAxisRing(MonitorElement *myMe, int numberOfRings, bool useRollInfo)
Definition: utils.h:295
int roll() const
Definition: RPCDetId.h:120
int ring() const
Definition: RPCDetId.h:72
MonitorElement * MEANDisk[kDisks]
MonitorElement * MEANDDisk[kDisks]
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
std::vector< MonitorElement * > myClusterMe_
void labelXAxisSector(MonitorElement *myMe)
Definition: utils.h:236
virtual int segment()
Definition: RPCGeomServ.cc:469
int detId2RollNr(const RPCDetId &_id)
Definition: utils.h:18
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:277
RPCClusterSizeTest(const edm::ParameterSet &ps)
Constructor.
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
void beginJob(std::string &)
std::vector< RPCDetId > myDetIds_
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
void getMonitorElements(std::vector< MonitorElement * > &, std::vector< RPCDetId > &, std::string &)
double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * CLSDDisk[kDisks]
yBin
Definition: cuy.py:891
MonitorElement * CLSWheel[kWheels]
virtual ~RPCClusterSizeTest()
Destructor.
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96