CMS 3D CMS Logo

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