44 LogVerbatim(
"NoiseDBValidation") <<
"[DTnoiseDBValidation] Constructor called!";
54 diffTestName_ =
"noiseDifferenceInRange";
55 if( pset.
exists(
"diffTestName") ) diffTestName_ = pset.
getParameter<
string>(
"diffTestName");
57 wheelTestName_ =
"noiseWheelOccInRange";
58 if( pset.
exists(
"wheelTestName") ) wheelTestName_ = pset.
getParameter<
string>(
"wheelTestName");
60 stationTestName_ =
"noiseStationOccInRange";
61 if( pset.
exists(
"stationTestName") ) stationTestName_ = pset.
getParameter<
string>(
"stationTestName");
63 sectorTestName_ =
"noiseSectorOccInRange";
64 if( pset.
exists(
"sectorTestName") ) sectorTestName_ = pset.
getParameter<
string>(
"sectorTestName");
66 layerTestName_ =
"noiseLayerOccInRange";
67 if( pset.
exists(
"layerTestName") ) layerTestName_ = pset.
getParameter<
string>(
"layerTestName");
69 outputMEsInRootFile_ =
false;
70 if( pset.
exists(
"OutputFileName") ){
71 outputMEsInRootFile_ =
true;
72 outputFileName_ = pset.
getParameter<std::string>(
"OutputFileName");
82 noiseRefMap_ = &*noiseRef;
86 noiseMap_ = &*noiseValid;
91 LogVerbatim(
"NoiseDBValidation")<<
"[DTnoiseDBValidation] Parameters initialization";
97 diffHisto_ =
dbe_->
book1D(
"noisyCellDiff",
"percentual (wrt the previous db) total number of noisy cells",1, 0.5, 1.5);
99 wheelHisto_ =
dbe_->
book1D(
"wheelOccupancy",
"percentual noisy cells occupancy per wheel",5, -2.5, 2.5);
101 wheelHisto_->setBinLabel(2,
"Wh-1");
102 wheelHisto_->setBinLabel(3,
"Wh0");
103 wheelHisto_->setBinLabel(4,
"Wh1");
104 wheelHisto_->setBinLabel(5,
"Wh2");
105 stationHisto_ =
dbe_->
book1D(
"stationOccupancy",
"percentual noisy cells occupancy per station",4, 0.5, 4.5);
107 stationHisto_->setBinLabel(2,
"St2");
108 stationHisto_->setBinLabel(3,
"St3");
109 stationHisto_->setBinLabel(4,
"St4");
110 sectorHisto_ =
dbe_->
book1D(
"sectorOccupancy",
"percentual noisy cells occupancy per sector",12, 0.5, 12.5);
112 sectorHisto_->setBinLabel(2,
"Sect2");
113 sectorHisto_->setBinLabel(3,
"Sect3");
114 sectorHisto_->setBinLabel(4,
"Sect4");
115 sectorHisto_->setBinLabel(5,
"Sect5");
116 sectorHisto_->setBinLabel(6,
"Sect6");
117 sectorHisto_->setBinLabel(7,
"Sect7");
118 sectorHisto_->setBinLabel(8,
"Sect8");
119 sectorHisto_->setBinLabel(9,
"Sect9");
120 sectorHisto_->setBinLabel(10,
"Sect10");
121 sectorHisto_->setBinLabel(11,
"Sect11");
122 sectorHisto_->setBinLabel(12,
"Sect12");
123 layerHisto_ =
dbe_->
book1D(
"layerOccupancy",
"percentual noisy cells occupancy per layer",3, 0.5, 3.5);
125 layerHisto_->setBinLabel(2,
"Middle bins");
126 layerHisto_->setBinLabel(3,
"Last 10 bins");
133 map<int, int> sectMap;
135 map<int, int> layerMap;
140 noise != noiseRefMap_->end(); noise++) {
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 noise != noiseMap_->end(); noise++) {
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() ) bookHisto(chId);
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();
188 wheel != whMap.end();
190 wheelHisto_->Fill((*wheel).first, ((*wheel).second)*scale);
192 for(map<int, int >::const_iterator
station = stMap.begin();
195 stationHisto_->Fill((*station).first, ((*station).second)*scale);
197 for(map<int, int >::const_iterator sector = sectMap.begin();
198 sector != sectMap.end();
200 sectorHisto_->Fill((*sector).first, ((*sector).second)*scale);
202 for(map<int, int >::const_iterator layer = layerMap.begin();
203 layer != layerMap.end();
205 layerHisto_->Fill((*layer).first, ((*layer).second)*scale);
215 const QReport * theDiffQReport = diffHisto_->getQReport(diffTestName_);
217 vector<dqm::me_util::Channel> badChannels = theDiffQReport->
getBadChannels();
218 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
219 channel != badChannels.end(); channel++) {
220 LogWarning(
"NoiseDBValidation") <<
" Bad partial difference of noisy channels! Contents : " << (*channel).getContents();
224 const QReport * theDiffQReport2 = wheelHisto_->getQReport(wheelTestName_);
225 if(theDiffQReport2) {
226 vector<dqm::me_util::Channel> badChannels = theDiffQReport2->
getBadChannels();
227 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
228 channel != badChannels.end(); channel++) {
229 int wheel = (*channel).getBin()-3;
230 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for wheel : " << wheel <<
" Contents : " << (*channel).getContents();
234 const QReport * theDiffQReport3 = stationHisto_->getQReport(stationTestName_);
235 if(theDiffQReport3) {
236 vector<dqm::me_util::Channel> badChannels = theDiffQReport3->
getBadChannels();
237 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
238 channel != badChannels.end(); channel++) {
239 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for station : " << (*channel).getBin() <<
" Contents : " << (*channel).getContents();
243 const QReport * theDiffQReport4 = sectorHisto_->getQReport(sectorTestName_);
244 if(theDiffQReport4) {
245 vector<dqm::me_util::Channel> badChannels = theDiffQReport4->
getBadChannels();
246 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
247 channel != badChannels.end(); channel++) {
248 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for sector : " << (*channel).getBin() <<
" 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();
256 channel != badChannels.end(); channel++) {
257 if((*channel).getBin()==1)
258 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for the first 10 wires! Contents : " << (*channel).getContents();
259 if((*channel).getBin()==2)
260 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for the middle wires! Contents : " << (*channel).getContents();
261 if((*channel).getBin()==3)
262 LogWarning(
"NoiseDBValidation") <<
" Bad percentual occupancy for the last 10 wires! Contents : "<<(*channel).getContents();
270 if(outputMEsInRootFile_)
dbe_->
save(outputFileName_);
274 stringstream histoName;
275 histoName <<
"NoiseOccupancy"
276 <<
"_W" << chId.
wheel()
278 <<
"_Sec" << chId.
sector();
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();
288 sl != superlayers.end(); ++sl) {
289 vector<const DTLayer*> layers = (*sl)->layers();
290 for(vector<const DTLayer*>::const_iterator lay = layers.begin();
291 lay != layers.end(); ++lay) {
292 int nWires = (*lay)->specificTopology().channels();
293 if(nWires > nWiresMax) nWiresMax = nWires;
297 noiseHistoMap_[chId] =
dbe_->
book2D(histoName.str(),
"Noise occupancy",nWiresMax,1,(nWiresMax + 1),12,1,13);
298 for(
int i_sl = 1; i_sl <= 3; ++i_sl) {
299 for(
int i_lay = 1; i_lay <= 4; ++i_lay) {
302 label <<
"SL" << i_sl <<
": L" << i_lay;
303 noiseHistoMap_[chId]->setBinLabel(binNumber,label.str(),2);
T getParameter(std::string const &) const
void beginRun(const edm::Run &run, const edm::EventSetup &setup)
Operations.
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
DTChamberId chamberId() const
Return the corresponding ChamberId.
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
bool exists(std::string const ¶meterName) const
checks if a parameter exists
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)
void bookHisto(const DTChamberId &)
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.
const std::vector< const DTSuperLayer * > & superLayers() const
Return the superlayers in the chamber.
int superLayer() const
Return the superlayer number.
std::vector< std::pair< DTStatusFlagId, DTStatusFlagData > >::const_iterator const_iterator
Access methods to data.
const std::vector< DQMChannel > & getBadChannels(void) const
int wire() const
Return the wire number.
void endRun(edm::Run const &, edm::EventSetup const &)
DTLayerId layerId() const
Return the corresponding LayerId.
virtual ~DTnoiseDBValidation()
Destructor.
int station() const
Return the station number.
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
int wheel() const
Return the wheel number.
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void setCurrentFolder(const std::string &fullpath)