CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RPCNoisyStripTest.cc
Go to the documentation of this file.
3 
4 //DQM Services
5 //#include "DQMServices/Core/interface/DQMStore.h"
6 
7 // Framework
9 //#include <FWCore/Framework/interface/ESHandle.h>
10 
11 //Geometry
13 
14 
16  edm::LogVerbatim ("rpcnoisetest") << "[RPCNoisyStripTest]: Constructor";
17 
18  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
19  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
20  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
21  useRollInfo_ = ps.getUntrackedParameter<bool>("UseRollInfo", false);
22  testMode_ = ps.getUntrackedParameter<bool>("testMode", false);
23 
24 }
25 
27 
29  edm::LogVerbatim ("rpcnoisetest") << "[RPCNoisyStripTest]: Begin job ";
30  globalFolder_ = workingFolder;
31 }
32 
33 
35 
36  edm::LogVerbatim ("rpcnoisetest") <<"[RPCNoisyStripTest]: Client Operation";
37 
38  //Loop on MEs
39  for (unsigned int i = 0 ; i<myOccupancyMe_.size();i++){
41  }//End loop on MEs
42 
43 }
44 
46 
47 
49 
50  std::stringstream histoName;
51 
52  rpcdqm::utils rpcUtils;
53 
54  for (int w = -2; w<= 2;w++ ){//loop on wheels and disks
55 
56  if(testMode_){
57  histoName.str("");
58  histoName<<"RPCNoisyStrips_Distribution_Wheel"<<w;
59  NOISEDWheel[w+2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 6, -0.5, 5.5);
60 
61 
62  histoName.str("");
63  histoName<<"RPCStripsDeviation_Distribution_Wheel"<<w;
64  DEVDWheel[w+2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 101, -0.01, 10.01);
65  }
66 
67  histoName.str("");
68  histoName<<"RPCNoisyStrips_Roll_vs_Sector_Wheel"<<w;
69  NOISEWheel[w+2] = ibooker.book2D(histoName.str().c_str(), histoName.str().c_str() , 12, 0.5, 12.5, 21, 0.5, 21.5);
70  rpcUtils.labelXAxisSector(NOISEWheel[w+2]);
71  rpcUtils.labelYAxisRoll(NOISEWheel[w+2], 0, w, useRollInfo_);
72  }
73 
74 
75 
76  for(int d = -numberOfDisks_; d<=numberOfDisks_; d++ ){//ENDCAP
77 
78  if (d == 0) continue;
79 
80  int offset = numberOfDisks_;
81  if (d>0) offset --;
82 
83  if (testMode_){
84  histoName.str("");
85  histoName<<"RPCNoisyStrips_Distribution_Disk"<<d;
86  NOISEDDisk[d+offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 6, -0.5, 5.5);
87 
88 
89  histoName.str("");
90  histoName<<"RPCStripsDeviation_Distribution_Disk"<<d;
91  DEVDDisk[d+offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 101, -0.01, 10.01);
92  }
93 
94  histoName.str("");
95  histoName<<"RPCNoisyStrips_Ring_vs_Segment_Disk"<<d;
96  NOISEDisk[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);
97  rpcUtils.labelXAxisSegment(NOISEDisk[d+offset]);
99 
100  }
101 
102 }
103 
104 
105 void RPCNoisyStripTest::getMonitorElements(std::vector<MonitorElement *> & meVector, std::vector<RPCDetId> & detIdVector, std::string & clientHistoName){
106 
107  //Get NumberOfDigi ME for each roll
108  for (unsigned int i = 0 ; i<meVector.size(); i++){
109 
110  std::string meName = meVector[i]->getName();
111 
112  if(meName.find(clientHistoName) != std::string::npos){
113 
114  myOccupancyMe_.push_back(meVector[i]);
115  myDetIds_.push_back(detIdVector[i]);
116  }
117  }
118 
119 }
120 
122 
123  std::stringstream meName;
124 
126  MonitorElement * DEVD=NULL;
127  MonitorElement * NOISED=NULL;
128 
129  if (detId.region()==0) { //BARREL
130  NOISE = NOISEWheel[detId.ring()+2];
131  if(testMode_) {
132  DEVD = DEVDWheel[detId.ring()+2];
133  NOISED= NOISEDWheel[detId.ring()+2];
134  }
135  }else if(detId.region()<0 && (-detId.station() + numberOfDisks_) >= 0 ){//ENDCAP-
136  NOISE = NOISEDisk[ -detId.station() + numberOfDisks_];
137  if(testMode_) {
138  DEVD = DEVDDisk[ -detId.station() + numberOfDisks_];
139  NOISED= NOISEDDisk[-detId.station() + numberOfDisks_];
140  }
141  }else if((-detId.station() + numberOfDisks_)>= 0 ){//ENDCAP +
142  NOISE = NOISEDisk[detId.station() + numberOfDisks_-1];
143  if(testMode_) {
144  DEVD = DEVDDisk[detId.station() + numberOfDisks_-1];
145  NOISED= NOISEDDisk[detId.station() + numberOfDisks_-1];
146  }
147  }
148 
149 
150  int entries = (int) myMe -> getEntries();
151  int bins = (int) myMe ->getNbinsX();
152 
153  std::vector<float> myvector;
154 
155  // count alive strips and alive strip values put in the vector
156  for(int xbin =1 ; xbin <= bins ; xbin++) {
157  float binContent = myMe->getBinContent(xbin);
158  if (binContent > 0) myvector.push_back(binContent);
159  }
160 
161 
162  int noisyStrips=0;
163  // calculate mean on YAxis and check diff between bins and mean
164  if (myvector.size()>0) {
165  float ymean = entries/myvector.size(); //mean on Yaxis
166  for(unsigned int i=0; i<myvector.size(); i++) {
167  float deviation = myvector[i]/ymean;
168  if(deviation > 3.5) noisyStrips++;
169  if(deviation > 5) deviation = 5; //overflow
170  if(DEVD) DEVD-> Fill(deviation);
171  }
172 
173 
174  int xBin,yBin;
175  if(detId.region()==0){//Barrel
176  xBin= detId.sector();
177  rpcdqm::utils rollNumber;
178  yBin = rollNumber.detId2RollNr(detId);
179  }else{//Endcap
180  //get segment number
181  RPCGeomServ RPCServ(detId);
182  xBin = RPCServ.segment();
183  (numberOfRings_ == 3 ? yBin= detId.ring()*3-detId.roll()+1 : yBin= (detId.ring()-1)*3-detId.roll()+1);
184  }
185 
186  if(NOISE) NOISE->setBinContent(xBin,yBin,noisyStrips);
187  if(NOISED) NOISED ->Fill(noisyStrips);
188 
189  }
190 
191 }
192 
T getUntrackedParameter(std::string const &, T const &) const
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
const double w
Definition: UKUtility.cc:23
tuple yBin
Definition: cuy.py:891
void getMonitorElements(std::vector< MonitorElement * > &, std::vector< RPCDetId > &, std::string &)
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 * NOISEDDisk[10]
void beginJob(std::string &)
std::string globalFolder_
void Fill(long long x)
std::vector< RPCDetId > myDetIds_
RPCNoisyStripTest(const edm::ParameterSet &ps)
tuple d
Definition: ztail.py:151
void labelYAxisRing(MonitorElement *myMe, int numberOfRings, bool useRollInfo)
Definition: utils.h:295
int roll() const
Definition: RPCDetId.h:120
std::vector< MonitorElement * > myOccupancyMe_
MonitorElement * NOISEDWheel[5]
void Fill(HcalDetId &id, double val, std::vector< TH2F > &depth)
int ring() const
Definition: RPCDetId.h:72
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:115
void labelXAxisSector(MonitorElement *myMe)
Definition: utils.h:236
virtual ~RPCNoisyStripTest()
MonitorElement * DEVDWheel[5]
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:273
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:133
MonitorElement * NOISEDisk[10]
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:102
double getBinContent(int binx) const
get content of bin (1-D)
MonitorElement * DEVDDisk[10]
void fillGlobalME(RPCDetId &, MonitorElement *)
MonitorElement * NOISEWheel[5]
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:63
int station() const
Definition: RPCDetId.h:96
void myBooker(DQMStore::IBooker &)