45 dbe->setCurrentFolder(
"DT/Tests/Noise");
55 edm::LogVerbatim (
"noise") <<
"DTNoiseTest: analyzed " << updates <<
" events";
110 edm::LogVerbatim (
"noise") <<
"[DTNoiseTest]: End of LS transition, performing the DQM client operation";
124 float tTrig, tTrigRMS, kFactor;
128 vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
129 vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
131 for (; ch_it != ch_end; ++ch_it) {
133 vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
134 vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
138 TH2F * noiseHisto = noiseME->
getTH2F();
141 double nevents = (int) noiseHisto->GetEntries();
143 double normalization =0;
147 float noiseStatistics=0;
148 int newNoiseChannels=0;
150 for(; sl_it != sl_end; ++sl_it) {
155 if (tTrig==0) tTrig=1;
156 const double ns_s = 1e9*(32/25);
157 normalization = ns_s/float(tTrig*nevents);
159 noiseHisto->Scale(normalization);
172 for (
int binX=1; binX <= noiseHisto->GetNbinsX(); binX++) {
174 if (noiseHisto->GetBinContent(binX,binY) >
parameters.getUntrackedParameter<
int>(
"HzThreshold", 300))
175 theNoisyChannels.push_back(
DTWireId(theLayer, binX));
179 average += noiseHisto->GetBinContent(binX,binY);
185 if (nOfChannels) noiseStatistics = average/nOfChannels;
186 histoTag =
"NoiseAverage";
191 for ( vector<DTWireId>::const_iterator nb_it = theNoisyChannels.begin();
192 nb_it != theNoisyChannels.end(); ++nb_it) {
194 bool isNoisy =
false;
195 bool isFEMasked =
false;
196 bool isTDCMasked =
false;
197 bool isTrigMask =
false;
200 statusMap->cellStatus((*nb_it), isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
202 if (!isNoisy) newNoiseChannels++;
204 theNoisyChannels.clear();
205 histoTag =
"NewNoisyChannels";
206 if (
histos[histoTag].
find((*ch_it)->id().rawId()) ==
histos[histoTag].
end())
bookHistos((*ch_it)->id(),string(
"NewNoisyChannels"), histoTag );
207 histos[histoTag].find((*ch_it)->id().rawId())->
second->setBinContent(slID.
superLayer(), newNoiseChannels);
211 vector<const DTSuperLayer*>::const_iterator sl2_it = (*ch_it)->superLayers().begin();
212 vector<const DTSuperLayer*>::const_iterator sl2_end = (*ch_it)->superLayers().end();
213 for(; sl2_it != sl2_end; ++sl2_it) {
215 vector<const DTLayer*>::const_iterator l_it = (*sl2_it)->layers().begin();
216 vector<const DTLayer*>::const_iterator l_end = (*sl2_it)->layers().end();
217 for(; l_it != l_end; ++l_it) {
222 if (noisePerEventME) {
223 TH2F * noiseHistoPerEvent = noisePerEventME->
getTH2F();
224 int nWires = muonGeom->layer(lID)->specificTopology().channels();
225 double MeanNumerator=0, MeanDenominator=0;
226 histoTag =
"MeanDigiPerEvent";
227 for (
int w=1; w<=nWires; w++){
228 for(
int numDigi=1; numDigi<=10; numDigi++){
229 MeanNumerator+=(noiseHistoPerEvent->GetBinContent(w,numDigi)*(numDigi-1));
230 MeanDenominator+=noiseHistoPerEvent->GetBinContent(w,numDigi);
232 double Mean=MeanNumerator/MeanDenominator;
233 if (
histos[histoTag].
find((*l_it)->id().rawId()) ==
histos[histoTag].
end())
bookHistos((*l_it)->id(),nWires, string(
"MeanDigiPerEvent"), histoTag );
234 histos[histoTag].find((*l_it)->id().rawId())->
second->setBinContent(w, Mean);
242 histoTag =
"MeanDigiPerEvent";
243 string MeanCriterionName =
parameters.getUntrackedParameter<
string>(
"meanTestName",
"NoiseMeanInRange");
244 for(map<uint32_t, MonitorElement*>::const_iterator hMean =
histos[histoTag].
begin();
245 hMean !=
histos[histoTag].end();
247 const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName);
249 vector<dqm::me_util::Channel> badChannels = theMeanQReport->
getBadChannels();
250 for (vector<dqm::me_util::Channel>::iterator channel = badChannels.begin();
251 channel != badChannels.end(); channel++) {
252 LogVerbatim (
"tTrigCalibration")<<
"LayerId : "<<(*hMean).first<<
" Bad mean channels: "<<(*channel).getBin()<<
" Contents : "<<(*channel).getContents();
270 dbe->rmdir(
"DT/Tests/Noise");
276 stringstream wheel; wheel << ch.
wheel();
278 stringstream sector; sector << ch.
sector();
280 string folderRoot =
parameters.getUntrackedParameter<
string>(
"folderRoot",
"Collector/FU0/");
281 string folderTag =
parameters.getUntrackedParameter<
string>(
"folderTag",
"Occupancies");
283 folderRoot +
"DT/DTDigiTask/Wheel" + wheel.str() +
284 "/Station" + station.str() +
285 "/Sector" + sector.str() +
"/" + folderTag +
"/";
287 string histoTag =
parameters.getUntrackedParameter<
string>(
"histoTag",
"OccupancyNoise_perCh");
288 string histoname = folderName + histoTag
290 +
"_St" + station.str()
291 +
"_Sec" + sector.str();
300 stringstream wheel; wheel << ly.
wheel();
302 stringstream sector; sector << ly.
sector();
303 stringstream superLayer; superLayer << ly.
superlayer();
304 stringstream layer; layer << ly.
layer();
306 string folderRoot =
parameters.getUntrackedParameter<
string>(
"folderRoot",
"Collector/FU0/");
307 string folderTag =
parameters.getUntrackedParameter<
string>(
"folderTagForDigiPerEventTest",
"DigiPerEvent");
309 folderRoot +
"DT/DTDigiForNoiseTask/Wheel" + wheel.str() +
310 "/Station" + station.str() +
311 "/Sector" + sector.str() +
"/" + folderTag +
"/";
313 string histoTag =
parameters.getUntrackedParameter<
string>(
"histoTagForDigiPerEventTest",
"DigiPerEvent");
314 string histoname = folderName + histoTag
316 +
"_St" + station.str()
317 +
"_Sec" + sector.str()
318 +
"_SL" + superLayer.str()
319 +
"_L" + layer.str();
329 stringstream wheel; wheel << ch.
wheel();
331 stringstream sector; sector << ch.
sector();
333 dbe->setCurrentFolder(
"DT/Tests/Noise/" + folder);
335 string histoName = histoTag +
"W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str();
337 if (folder ==
"NoiseAverage")
338 (
histos[histoTag])[ch.
rawId()] = dbe->book1D(histoName.c_str(),histoName.c_str(),3,0,3);
340 if ( folder ==
"NewNoisyChannels")
341 (
histos[histoTag])[ch.
rawId()] = dbe->book1D(histoName.c_str(),histoName.c_str(),3,0,3);
352 stringstream layer; layer << lId.
layer();
354 string histoName = histoTag +
"_W" + wheel.str() +
"_St" + station.str() +
"_Sec" + sector.str() +
"_SL" + superLayer.str() +
"_L" + layer.str();
356 dbe->setCurrentFolder(
"DT/Tests/Noise/" + folder +
357 "/Wheel" + wheel.str() +
358 "/Station" + station.str() +
359 "/Sector" + sector.str());
361 (
histos[histoTag])[lId.
rawId()] = dbe->book1D(histoName.c_str(),histoName.c_str(),nWires,0,nWires);
LuminosityBlockID id() const
void analyze(const edm::Event &e, const edm::EventSetup &c)
Analyze.
void beginRun(const edm::Run &r, const edm::EventSetup &c)
BeginRun.
DTNoiseTest(const edm::ParameterSet &ps)
Constructor.
int layer() const
Return the layer number.
void beginLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
uint32_t rawId() const
get the raw id
U second(std::pair< T, U > const &p)
int superLayer() const
Return the superlayer number.
const std::vector< DQMChannel > & getBadChannels(void) const
int superlayer() const
Return the superlayer number (deprecated method name)
void bookHistos(const DTChamberId &ch, std::string folder, std::string histoTag)
book the new ME
virtual ~DTNoiseTest()
Destructor.
LuminosityBlockNumber_t luminosityBlock() const
std::string getMEName(const DTChamberId &ch)
Get the ME name.
int station() const
Return the station number.
TH2F * getTH2F(void) const
int wheel() const
Return the wheel number.
void endLuminosityBlock(edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &c)
DQM Client Diagnostic.