41 LogVerbatim(
"NoiseDBValidation") <<
"[DTnoiseDBValidation] Constructor called!";
45 dbe_->setCurrentFolder(
"DT/DtCalib/NoiseDBValidation");
51 diffTestName_ =
"noiseDifferenceInRange";
52 if (pset.
exists(
"diffTestName"))
53 diffTestName_ = pset.
getParameter<
string>(
"diffTestName");
55 wheelTestName_ =
"noiseWheelOccInRange";
56 if (pset.
exists(
"wheelTestName"))
57 wheelTestName_ = pset.
getParameter<
string>(
"wheelTestName");
59 stationTestName_ =
"noiseStationOccInRange";
60 if (pset.
exists(
"stationTestName"))
61 stationTestName_ = pset.
getParameter<
string>(
"stationTestName");
63 sectorTestName_ =
"noiseSectorOccInRange";
64 if (pset.
exists(
"sectorTestName"))
65 sectorTestName_ = pset.
getParameter<
string>(
"sectorTestName");
67 layerTestName_ =
"noiseLayerOccInRange";
68 if (pset.
exists(
"layerTestName"))
69 layerTestName_ = pset.
getParameter<
string>(
"layerTestName");
71 outputMEsInRootFile_ =
false;
72 if (pset.
exists(
"OutputFileName")) {
73 outputMEsInRootFile_ =
true;
83 noiseRefMap_ = &*noiseRef;
87 noiseMap_ = &*noiseValid;
92 LogVerbatim(
"NoiseDBValidation") <<
"[DTnoiseDBValidation] Parameters initialization";
99 dbe_->book1D(
"noisyCellDiff",
"percentual (wrt the previous db) total number of noisy cells", 1, 0.5, 1.5);
100 diffHisto_->setBinLabel(1,
"Diff");
101 wheelHisto_ =
dbe_->book1D(
"wheelOccupancy",
"percentual noisy cells occupancy per wheel", 5, -2.5, 2.5);
102 wheelHisto_->setBinLabel(1,
"Wh-2");
103 wheelHisto_->setBinLabel(2,
"Wh-1");
104 wheelHisto_->setBinLabel(3,
"Wh0");
105 wheelHisto_->setBinLabel(4,
"Wh1");
106 wheelHisto_->setBinLabel(5,
"Wh2");
107 stationHisto_ =
dbe_->book1D(
"stationOccupancy",
"percentual noisy cells occupancy per station", 4, 0.5, 4.5);
108 stationHisto_->setBinLabel(1,
"St1");
109 stationHisto_->setBinLabel(2,
"St2");
110 stationHisto_->setBinLabel(3,
"St3");
111 stationHisto_->setBinLabel(4,
"St4");
112 sectorHisto_ =
dbe_->book1D(
"sectorOccupancy",
"percentual noisy cells occupancy per sector", 12, 0.5, 12.5);
113 sectorHisto_->setBinLabel(1,
"Sect1");
114 sectorHisto_->setBinLabel(2,
"Sect2");
115 sectorHisto_->setBinLabel(3,
"Sect3");
116 sectorHisto_->setBinLabel(4,
"Sect4");
117 sectorHisto_->setBinLabel(5,
"Sect5");
118 sectorHisto_->setBinLabel(6,
"Sect6");
119 sectorHisto_->setBinLabel(7,
"Sect7");
120 sectorHisto_->setBinLabel(8,
"Sect8");
121 sectorHisto_->setBinLabel(9,
"Sect9");
122 sectorHisto_->setBinLabel(10,
"Sect10");
123 sectorHisto_->setBinLabel(11,
"Sect11");
124 sectorHisto_->setBinLabel(12,
"Sect12");
125 layerHisto_ =
dbe_->book1D(
"layerOccupancy",
"percentual noisy cells occupancy per layer", 3, 0.5, 3.5);
126 layerHisto_->setBinLabel(1,
"First 10 bins");
127 layerHisto_->setBinLabel(2,
"Middle bins");
128 layerHisto_->setBinLabel(3,
"Last 10 bins");
135 map<int, int> sectMap;
137 map<int, int> layerMap;
142 DTWireId wireId((*noise).first.wheelId,
143 (*noise).first.stationId,
144 (*noise).first.sectorId,
146 (*noise).first.layerId,
147 (*noise).first.cellId);
148 LogVerbatim(
"NoiseDBValidation") <<
"Ref. noisy wire: " << wireId;
154 DTWireId wireId((*noise).first.wheelId,
155 (*noise).first.stationId,
156 (*noise).first.sectorId,
158 (*noise).first.layerId,
159 (*noise).first.cellId);
160 LogVerbatim(
"NoiseDBValidation") <<
"Valid. noisy wire: " << wireId;
163 whMap[(*noise).first.wheelId]++;
164 stMap[(*noise).first.stationId]++;
165 sectMap[(*noise).first.sectorId]++;
169 if ((*noise).first.cellId <= 10)
171 if ((*noise).first.cellId > 10 && (*noise).first.cellId < (lastWire - 10))
173 if ((*noise).first.cellId >= (lastWire - 10))
177 if (noiseHistoMap_.find(chId) == noiseHistoMap_.end())
184 double scale = 1 / double(noisyCellsRef_);
185 diffHisto_->Fill(1,
abs(noisyCellsRef_ - noisyCellsValid_) * scale);
187 scale = 1 / double(noisyCellsValid_);
188 for (map<int, int>::const_iterator
wheel = whMap.begin();
wheel != whMap.end();
wheel++) {
189 wheelHisto_->Fill((*wheel).first, ((*wheel).second) * scale);
192 stationHisto_->Fill((*station).first, ((*station).second) * scale);
194 for (map<int, int>::const_iterator sector = sectMap.begin(); sector != sectMap.end(); sector++) {
195 sectorHisto_->Fill((*sector).first, ((*sector).second) * scale);
197 for (map<int, int>::const_iterator layer = layerMap.begin(); layer != layerMap.end(); layer++) {
198 layerHisto_->Fill((*layer).first, ((*layer).second) * scale);
207 const QReport *theDiffQReport = diffHisto_->getQReport(diffTestName_);
208 if (theDiffQReport) {
209 vector<dqm::me_util::Channel> badChannels = theDiffQReport->
getBadChannels();
210 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
212 LogWarning(
"NoiseDBValidation") <<
" Bad partial difference of noisy channels! Contents : " 213 << (*channel).getContents();
218 const QReport *theDiffQReport2 = wheelHisto_->getQReport(wheelTestName_);
219 if (theDiffQReport2) {
220 vector<dqm::me_util::Channel> badChannels = theDiffQReport2->
getBadChannels();
221 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
223 int wheel = (*channel).getBin() - 3;
224 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for wheel : " << wheel
225 <<
" Contents : " << (*channel).getContents();
230 const QReport *theDiffQReport3 = stationHisto_->getQReport(stationTestName_);
231 if (theDiffQReport3) {
232 vector<dqm::me_util::Channel> badChannels = theDiffQReport3->
getBadChannels();
233 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
235 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for station : " << (*channel).getBin()
236 <<
" Contents : " << (*channel).getContents();
241 const QReport *theDiffQReport4 = sectorHisto_->getQReport(sectorTestName_);
242 if (theDiffQReport4) {
243 vector<dqm::me_util::Channel> badChannels = theDiffQReport4->
getBadChannels();
244 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
246 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for sector : " << (*channel).getBin()
247 <<
" Contents : " << (*channel).getContents();
252 const QReport *theDiffQReport5 = layerHisto_->getQReport(layerTestName_);
253 if (theDiffQReport5) {
254 vector<dqm::me_util::Channel> badChannels = theDiffQReport5->
getBadChannels();
255 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin(); channel != badChannels.end();
257 if ((*channel).getBin() == 1)
258 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for the first 10 wires! Contents : " 259 << (*channel).getContents();
260 if ((*channel).getBin() == 2)
261 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for the middle wires! Contents : " 262 << (*channel).getContents();
263 if ((*channel).getBin() == 3)
264 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for the last 10 wires! Contents : " 265 << (*channel).getContents();
272 if (outputMEsInRootFile_)
273 dbe_->save(outputFileName_);
277 stringstream histoName;
278 histoName <<
"NoiseOccupancy" 281 if (noiseHistoMap_.find(chId) == noiseHistoMap_.end()) {
284 const DTChamber *dtchamber = dtGeom_->chamber(chId);
285 const vector<const DTSuperLayer *> &superlayers = dtchamber->
superLayers();
288 for (vector<const DTSuperLayer *>::const_iterator sl = superlayers.begin(); sl != superlayers.end();
290 vector<const DTLayer *>
layers = (*sl)->layers();
291 for (vector<const DTLayer *>::const_iterator lay = layers.begin(); lay != layers.end();
293 int nWires = (*lay)->specificTopology().channels();
294 if (nWires > nWiresMax)
299 noiseHistoMap_[chId] =
dbe_->book2D(histoName.str(),
"Noise occupancy", nWiresMax, 1, (nWiresMax + 1), 12, 1, 13);
300 for (
int i_sl = 1; i_sl <= 3; ++i_sl) {
301 for (
int i_lay = 1; i_lay <= 4; ++i_lay) {
304 label <<
"SL" << i_sl <<
": L" << i_lay;
305 noiseHistoMap_[chId]->setBinLabel(binNumber, label.str(), 2);
T getParameter(std::string const &) const
const std::vector< DQMChannel > & getBadChannels() const
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
DTChamberId chamberId() const
Return the corresponding ChamberId.
bool exists(std::string const ¶meterName) const
checks if a parameter exists
def setup(process, global_tag, zero_tesla=False)
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
std::vector< std::pair< DTStatusFlagId, DTStatusFlagData > >::const_iterator const_iterator
Access methods to data.
int wire() const
Return the wire number.
DTLayerId layerId() const
Return the corresponding LayerId.
int station() const
Return the station number.
int wheel() const
Return the wheel number.
~DTnoiseDBValidation() override
Destructor.