40 LogVerbatim(
"NoiseDBValidation") <<
"[DTnoiseDBValidation] Constructor called!";
50 diffTestName_ =
"noiseDifferenceInRange";
51 if (pset.
exists(
"diffTestName"))
52 diffTestName_ = pset.
getParameter<
string>(
"diffTestName");
54 wheelTestName_ =
"noiseWheelOccInRange";
55 if (pset.
exists(
"wheelTestName"))
56 wheelTestName_ = pset.
getParameter<
string>(
"wheelTestName");
58 stationTestName_ =
"noiseStationOccInRange";
59 if (pset.
exists(
"stationTestName"))
60 stationTestName_ = pset.
getParameter<
string>(
"stationTestName");
62 sectorTestName_ =
"noiseSectorOccInRange";
63 if (pset.
exists(
"sectorTestName"))
64 sectorTestName_ = pset.
getParameter<
string>(
"sectorTestName");
66 layerTestName_ =
"noiseLayerOccInRange";
67 if (pset.
exists(
"layerTestName"))
68 layerTestName_ = pset.
getParameter<
string>(
"layerTestName");
70 outputMEsInRootFile_ =
false;
71 if (pset.
exists(
"OutputFileName")) {
72 outputMEsInRootFile_ =
true;
86 noiseMap_ = &*noiseValid;
91 LogVerbatim(
"NoiseDBValidation") <<
"[DTnoiseDBValidation] Parameters initialization";
98 dbe_->
book1D(
"noisyCellDiff",
"percentual (wrt the previous db) total number of noisy cells", 1, 0.5, 1.5);
100 wheelHisto_ =
dbe_->
book1D(
"wheelOccupancy",
"percentual noisy cells occupancy per wheel", 5, -2.5, 2.5);
102 wheelHisto_->setBinLabel(2,
"Wh-1");
103 wheelHisto_->setBinLabel(3,
"Wh0");
104 wheelHisto_->setBinLabel(4,
"Wh1");
105 wheelHisto_->setBinLabel(5,
"Wh2");
106 stationHisto_ =
dbe_->
book1D(
"stationOccupancy",
"percentual noisy cells occupancy per station", 4, 0.5, 4.5);
108 stationHisto_->setBinLabel(2,
"St2");
109 stationHisto_->setBinLabel(3,
"St3");
110 stationHisto_->setBinLabel(4,
"St4");
111 sectorHisto_ =
dbe_->
book1D(
"sectorOccupancy",
"percentual noisy cells occupancy per sector", 12, 0.5, 12.5);
113 sectorHisto_->setBinLabel(2,
"Sect2");
114 sectorHisto_->setBinLabel(3,
"Sect3");
115 sectorHisto_->setBinLabel(4,
"Sect4");
116 sectorHisto_->setBinLabel(5,
"Sect5");
117 sectorHisto_->setBinLabel(6,
"Sect6");
118 sectorHisto_->setBinLabel(7,
"Sect7");
119 sectorHisto_->setBinLabel(8,
"Sect8");
120 sectorHisto_->setBinLabel(9,
"Sect9");
121 sectorHisto_->setBinLabel(10,
"Sect10");
122 sectorHisto_->setBinLabel(11,
"Sect11");
123 sectorHisto_->setBinLabel(12,
"Sect12");
124 layerHisto_ =
dbe_->
book1D(
"layerOccupancy",
"percentual noisy cells occupancy per layer", 3, 0.5, 3.5);
126 layerHisto_->setBinLabel(2,
"Middle bins");
127 layerHisto_->setBinLabel(3,
"Last 10 bins");
134 map<int, int> sectMap;
136 map<int, int> layerMap;
141 DTWireId wireId((*noise).first.wheelId,
142 (*noise).first.stationId,
143 (*noise).first.sectorId,
145 (*noise).first.layerId,
146 (*noise).first.cellId);
147 LogVerbatim(
"NoiseDBValidation") <<
"Ref. noisy wire: " << wireId;
153 DTWireId wireId((*noise).first.wheelId,
154 (*noise).first.stationId,
155 (*noise).first.sectorId,
157 (*noise).first.layerId,
158 (*noise).first.cellId);
159 LogVerbatim(
"NoiseDBValidation") <<
"Valid. noisy wire: " << wireId;
162 whMap[(*noise).first.wheelId]++;
163 stMap[(*noise).first.stationId]++;
164 sectMap[(*noise).first.sectorId]++;
168 if ((*noise).first.cellId <= 10)
170 if ((*noise).first.cellId > 10 && (*noise).first.cellId < (lastWire - 10))
172 if ((*noise).first.cellId >= (lastWire - 10))
176 if (noiseHistoMap_.find(chId) == noiseHistoMap_.end())
183 double scale = 1 / double(noisyCellsRef_);
184 diffHisto_->Fill(1,
abs(noisyCellsRef_ - noisyCellsValid_) * scale);
186 scale = 1 / double(noisyCellsValid_);
187 for (map<int, int>::const_iterator
wheel = whMap.begin();
wheel != whMap.end();
wheel++) {
188 wheelHisto_->Fill((*wheel).first, ((*wheel).second) * scale);
191 stationHisto_->Fill((*station).first, ((*station).second) * scale);
193 for (map<int, int>::const_iterator sector = sectMap.begin(); sector != sectMap.end(); sector++) {
194 sectorHisto_->Fill((*sector).first, ((*sector).second) * scale);
196 for (map<int, int>::const_iterator layer = layerMap.begin(); layer != layerMap.end(); layer++) {
197 layerHisto_->Fill((*layer).first, ((*layer).second) * scale);
206 const QReport *theDiffQReport = diffHisto_->getQReport(diffTestName_);
207 if (theDiffQReport) {
208 vector<dqm::me_util::Channel> badChannels = theDiffQReport->
getBadChannels();
209 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
211 LogWarning(
"NoiseDBValidation") <<
" Bad partial difference of noisy channels! Contents : " 212 << (*channel).getContents();
217 const QReport *theDiffQReport2 = wheelHisto_->getQReport(wheelTestName_);
218 if (theDiffQReport2) {
219 vector<dqm::me_util::Channel> badChannels = theDiffQReport2->
getBadChannels();
220 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
222 int wheel = (*channel).getBin() - 3;
223 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for wheel : " << wheel
224 <<
" Contents : " << (*channel).getContents();
229 const QReport *theDiffQReport3 = stationHisto_->getQReport(stationTestName_);
230 if (theDiffQReport3) {
231 vector<dqm::me_util::Channel> badChannels = theDiffQReport3->
getBadChannels();
232 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
234 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for station : " << (*channel).getBin()
235 <<
" Contents : " << (*channel).getContents();
240 const QReport *theDiffQReport4 = sectorHisto_->getQReport(sectorTestName_);
241 if (theDiffQReport4) {
242 vector<dqm::me_util::Channel> badChannels = theDiffQReport4->
getBadChannels();
243 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
245 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for sector : " << (*channel).getBin()
246 <<
" Contents : " << (*channel).getContents();
251 const QReport *theDiffQReport5 = layerHisto_->getQReport(layerTestName_);
252 if (theDiffQReport5) {
253 vector<dqm::me_util::Channel> badChannels = theDiffQReport5->
getBadChannels();
254 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
256 if ((*channel).getBin() == 1)
257 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for the first 10 wires! Contents : " 258 << (*channel).getContents();
259 if ((*channel).getBin() == 2)
260 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for the middle wires! Contents : " 261 << (*channel).getContents();
262 if ((*channel).getBin() == 3)
263 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for the last 10 wires! Contents : " 264 << (*channel).getContents();
271 if (outputMEsInRootFile_)
277 histoName <<
"NoiseOccupancy" 280 if (noiseHistoMap_.find(chId) == noiseHistoMap_.end()) {
283 const DTChamber *dtchamber = dtGeom_->chamber(chId);
284 const vector<const DTSuperLayer *> &superlayers = dtchamber->
superLayers();
287 for (vector<const DTSuperLayer *>::const_iterator sl = superlayers.begin(); sl != superlayers.end();
289 vector<const DTLayer *>
layers = (*sl)->layers();
290 for (vector<const DTLayer *>::const_iterator lay = layers.begin(); lay != layers.end();
292 int nWires = (*lay)->specificTopology().channels();
293 if (nWires > nWiresMax)
298 noiseHistoMap_[chId] =
dbe_->
book2D(histoName.str(),
"Noise occupancy", nWiresMax, 1, (nWiresMax + 1), 12, 1, 13);
299 for (
int i_sl = 1; i_sl <= 3; ++i_sl) {
300 for (
int i_lay = 1; i_lay <= 4; ++i_lay) {
303 label <<
"SL" << i_sl <<
": L" << i_lay;
304 noiseHistoMap_[chId]->setBinLabel(binNumber, label.str(), 2);
T getParameter(std::string const &) const
MonitorElement * book2D(char_string const &name, char_string const &title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
const std::vector< DQMChannel > & getBadChannels() const
DTChamberId chamberId() const
Return the corresponding ChamberId.
dqm::legacy::DQMStore * dbe_
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void bookHisto(const DTChamberId &)
void beginRun(const edm::Run &run, const edm::EventSetup &setup) override
Operations.
int layer() const
Return the layer number.
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
int lastChannel() const
Returns the wire number of the last wire.
DTnoiseDBValidation(const edm::ParameterSet &pset)
Constructor.
def binNumber(station, sl)
const std::vector< const DTSuperLayer * > & superLayers() const
Return the superlayers in the chamber.
Abs< T >::type abs(const T &t)
int superLayer() const
Return the superlayer number.
void endRun(edm::Run const &, edm::EventSetup const &) override
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
int wire() const
Return the wire number.
std::vector< std::pair< DTStatusFlagId, DTStatusFlagData > >::const_iterator const_iterator
Access methods to data.
void setCurrentFolder(std::string const &fullpath)
DTLayerId layerId() const
Return the corresponding LayerId.
MonitorElement * book1D(char_string const &name, char_string const &title, int const nchX, double const lowX, double const highX)
Book 1D histogram.
int station() const
Return the station number.
int wheel() const
Return the wheel number.
void save(std::string const &filename, std::string const &path="", std::string const &pattern="", std::string const &rewrite="", uint32_t run=0, uint32_t lumi=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, std::string const &fileupdate="RECREATE")
~DTnoiseDBValidation() override
Destructor.