CMS 3D CMS Logo

RPCNoisyStripTest.cc
Go to the documentation of this file.
4 
7 
9  edm::LogVerbatim("rpcnoisetest") << "[RPCNoisyStripTest]: Constructor";
10 
11  prescaleFactor_ = ps.getUntrackedParameter<int>("DiagnosticPrescale", 1);
12  numberOfDisks_ = ps.getUntrackedParameter<int>("NumberOfEndcapDisks", 4);
13  numberOfRings_ = ps.getUntrackedParameter<int>("NumberOfEndcapRings", 2);
14  useRollInfo_ = ps.getUntrackedParameter<bool>("UseRollInfo", false);
15  testMode_ = ps.getUntrackedParameter<bool>("testMode", false);
16 }
17 
19  edm::LogVerbatim("rpcnoisetest") << "[RPCNoisyStripTest]: Begin job ";
20  globalFolder_ = workingFolder;
21 }
22 
24  edm::LogVerbatim("rpcnoisetest") << "[RPCNoisyStripTest]: Client Operation";
25 
26  //Loop on MEs
27  for (unsigned int i = 0; i < myOccupancyMe_.size(); i++) {
29  } //End loop on MEs
30 }
31 
34 
35  std::stringstream histoName;
36 
37  for (int w = -2; w <= 2; w++) { //loop on wheels and disks
38 
39  if (testMode_) {
40  histoName.str("");
41  histoName << "RPCNoisyStrips_Distribution_Wheel" << w;
42  NOISEDWheel[w + 2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 6, -0.5, 5.5);
43 
44  histoName.str("");
45  histoName << "RPCStripsDeviation_Distribution_Wheel" << w;
46  DEVDWheel[w + 2] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 101, -0.01, 10.01);
47  }
48 
49  histoName.str("");
50  histoName << "RPCNoisyStrips_Roll_vs_Sector_Wheel" << w;
51  auto me = RPCRollMapHisto::bookBarrel(ibooker, w, histoName.str(), histoName.str(), useRollInfo_);
52  NOISEWheel[w + 2] = dynamic_cast<MonitorElement*>(me);
53  }
54 
55  for (int d = -numberOfDisks_; d <= numberOfDisks_; d++) { //ENDCAP
56 
57  if (d == 0)
58  continue;
59 
60  int offset = numberOfDisks_;
61  if (d > 0)
62  offset--;
63 
64  if (testMode_) {
65  histoName.str("");
66  histoName << "RPCNoisyStrips_Distribution_Disk" << d;
67  NOISEDDisk[d + offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 6, -0.5, 5.5);
68 
69  histoName.str("");
70  histoName << "RPCStripsDeviation_Distribution_Disk" << d;
71  DEVDDisk[d + offset] = ibooker.book1D(histoName.str().c_str(), histoName.str().c_str(), 101, -0.01, 10.01);
72  }
73 
74  histoName.str("");
75  histoName << "RPCNoisyStrips_Ring_vs_Segment_Disk" << d;
76  auto me = RPCRollMapHisto::bookEndcap(ibooker, d, histoName.str(), histoName.str(), useRollInfo_);
77  NOISEDisk[d + offset] = dynamic_cast<MonitorElement*>(me);
78  }
79 }
80 
81 void RPCNoisyStripTest::getMonitorElements(std::vector<MonitorElement*>& meVector,
82  std::vector<RPCDetId>& detIdVector,
83  std::string& clientHistoName) {
84  //Get NumberOfDigi ME for each roll
85  for (unsigned int i = 0; i < meVector.size(); i++) {
86  std::string meName = meVector[i]->getName();
87 
88  if (meName.find(clientHistoName) != std::string::npos) {
89  myOccupancyMe_.push_back(meVector[i]);
90  myDetIds_.push_back(detIdVector[i]);
91  }
92  }
93 }
94 
96  std::stringstream meName;
97 
98  MonitorElement* NOISE = nullptr;
99  MonitorElement* DEVD = nullptr;
100  MonitorElement* NOISED = nullptr;
101 
102  if (detId.region() == 0) { //BARREL
103  NOISE = NOISEWheel[detId.ring() + 2];
104  if (testMode_) {
105  DEVD = DEVDWheel[detId.ring() + 2];
106  NOISED = NOISEDWheel[detId.ring() + 2];
107  }
108  } else if (detId.region() < 0 && (-detId.station() + numberOfDisks_) >= 0) { //ENDCAP-
109  NOISE = NOISEDisk[-detId.station() + numberOfDisks_];
110  if (testMode_) {
111  DEVD = DEVDDisk[-detId.station() + numberOfDisks_];
112  NOISED = NOISEDDisk[-detId.station() + numberOfDisks_];
113  }
114  } else if ((-detId.station() + numberOfDisks_) >= 0) { //ENDCAP +
115  NOISE = NOISEDisk[detId.station() + numberOfDisks_ - 1];
116  if (testMode_) {
117  DEVD = DEVDDisk[detId.station() + numberOfDisks_ - 1];
118  NOISED = NOISEDDisk[detId.station() + numberOfDisks_ - 1];
119  }
120  }
121 
122  int entries = (int)myMe->getEntries();
123  int bins = (int)myMe->getNbinsX();
124 
125  std::vector<float> myvector;
126 
127  // count alive strips and alive strip values put in the vector
128  for (int xbin = 1; xbin <= bins; xbin++) {
129  float binContent = myMe->getBinContent(xbin);
130  if (binContent > 0)
131  myvector.push_back(binContent);
132  }
133 
134  int noisyStrips = 0;
135  // calculate mean on YAxis and check diff between bins and mean
136  if (!myvector.empty()) {
137  float ymean = entries / myvector.size(); //mean on Yaxis
138  for (unsigned int i = 0; i < myvector.size(); i++) {
139  float deviation = myvector[i] / ymean;
140  if (deviation > 3.5)
141  noisyStrips++;
142  if (deviation > 5)
143  deviation = 5; //overflow
144  if (DEVD)
145  DEVD->Fill(deviation);
146  }
147 
148  int xBin, yBin;
149  if (detId.region() == 0) { //Barrel
150  xBin = detId.sector();
151  rpcdqm::utils rollNumber;
152  yBin = rollNumber.detId2RollNr(detId);
153  } else { //Endcap
154  //get segment number
155  RPCGeomServ RPCServ(detId);
156  xBin = RPCServ.segment();
157  (numberOfRings_ == 3 ? yBin = detId.ring() * 3 - detId.roll() + 1
158  : yBin = (detId.ring() - 1) * 3 - detId.roll() + 1);
159  }
160 
161  if (NOISE)
162  NOISE->setBinContent(xBin, yBin, noisyStrips);
163  if (NOISED)
164  NOISED->Fill(noisyStrips);
165  }
166 }
int sector() const
Sector id: the group of chambers at same phi (and increasing r)
Definition: RPCDetId.h:81
Log< level::Info, true > LogVerbatim
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
T w() const
int ring() const
Definition: RPCDetId.h:59
MonitorElement * NOISEDDisk[10]
std::string globalFolder_
std::vector< RPCDetId > myDetIds_
RPCNoisyStripTest(const edm::ParameterSet &ps)
T getUntrackedParameter(std::string const &, T const &) const
void Fill(long long x)
std::vector< MonitorElement * > myOccupancyMe_
MonitorElement * NOISEDWheel[5]
void clientOperation() override
virtual double getEntries() const
get # of entries
int roll() const
Definition: RPCDetId.h:92
d
Definition: ztail.py:151
MonitorElement * DEVDWheel[5]
virtual int segment()
Definition: RPCGeomServ.cc:361
int detId2RollNr(const RPCDetId &_id)
Definition: utils.h:31
MonitorElement * NOISEDisk[10]
void beginJob(std::string &) override
static MonitorElement * bookBarrel(IBooker &booker, const int wheel, const std::string &prefix, const std::string &title, const bool useRollInfo)
int station() const
Definition: RPCDetId.h:78
int region() const
Region id: 0 for Barrel, +/-1 For +/- Endcap.
Definition: RPCDetId.h:53
void myBooker(DQMStore::IBooker &) override
virtual int getNbinsX() const
get # of bins in X-axis
void getMonitorElements(std::vector< MonitorElement *> &, std::vector< RPCDetId > &, std::string &) override
MonitorElement * DEVDDisk[10]
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
static MonitorElement * bookEndcap(IBooker &booker, const int disk, const std::string &prefix, const std::string &title, const bool useRollInfo)
void fillGlobalME(RPCDetId &, MonitorElement *)
MonitorElement * NOISEWheel[5]
virtual double getBinContent(int binx) const
get content of bin (1-D)