From ed09589a266f92fa812ae35439516e2e714ae471 Mon Sep 17 00:00:00 2001 From: Francesca Cavallo Date: Mon, 20 Apr 2015 10:53:13 +0200 Subject: [PATCH 01/10] package pruned --- DQM/DTMonitorModule/plugins/plugins.cc | 24 +- .../python/dtDQMOfflineSources_Cosmics_cff.py | 2 + .../src/DTAlbertoBenvenutiTask.cc | 311 ------------------ DQM/DTMonitorModule/src/DTDataErrorFilter.cc | 31 -- .../src/DTDataIntegrityTask.cc | 6 +- DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc | 211 ------------ DQM/DTMonitorModule/src/DTGlobalRecoTask.cc | 37 --- .../src/DTLocalTriggerSynchTask.cc | 272 --------------- DQM/DTMonitorModule/src/DTROMonitorFilter.cc | 73 ---- DQM/DTMonitorModule/src/DTTestPulsesTask.cc | 240 -------------- DQM/DTMonitorModule/src/DTTriggerCheck.cc | 79 ----- 11 files changed, 17 insertions(+), 1269 deletions(-) delete mode 100644 DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc delete mode 100644 DQM/DTMonitorModule/src/DTDataErrorFilter.cc delete mode 100644 DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc delete mode 100644 DQM/DTMonitorModule/src/DTGlobalRecoTask.cc delete mode 100644 DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc delete mode 100644 DQM/DTMonitorModule/src/DTROMonitorFilter.cc delete mode 100644 DQM/DTMonitorModule/src/DTTestPulsesTask.cc delete mode 100644 DQM/DTMonitorModule/src/DTTriggerCheck.cc diff --git a/DQM/DTMonitorModule/plugins/plugins.cc b/DQM/DTMonitorModule/plugins/plugins.cc index d026ab4ef2a58..f9089d8e46e90 100644 --- a/DQM/DTMonitorModule/plugins/plugins.cc +++ b/DQM/DTMonitorModule/plugins/plugins.cc @@ -3,8 +3,8 @@ #include DEFINE_FWK_MODULE(DTDigiTask); -#include -DEFINE_FWK_MODULE(DTTestPulsesTask); +//#include +//DEFINE_FWK_MODULE(DTTestPulsesTask); #include DEFINE_FWK_MODULE(DTSegmentAnalysisTask); @@ -27,29 +27,29 @@ DEFINE_FWK_MODULE(DTChamberEfficiency); #include DEFINE_FWK_MODULE(DTRunConditionVar); -#include "DQM/DTMonitorModule/interface/DTTriggerCheck.h" -DEFINE_FWK_MODULE(DTTriggerCheck); +//#include "DQM/DTMonitorModule/interface/DTTriggerCheck.h" +//DEFINE_FWK_MODULE(DTTriggerCheck); -#include "DQM/DTMonitorModule/src/DTDigiForNoiseTask.h" -DEFINE_FWK_MODULE(DTDigiForNoiseTask); +//#include "DQM/DTMonitorModule/src/DTDigiForNoiseTask.h" +//DEFINE_FWK_MODULE(DTDigiForNoiseTask); #include "DQM/DTMonitorModule/src/DTNoiseTask.h" DEFINE_FWK_MODULE(DTNoiseTask); -#include "DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h" -DEFINE_FWK_MODULE(DTAlbertoBenvenutiTask); +//#include "DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h" +//DEFINE_FWK_MODULE(DTAlbertoBenvenutiTask); #include "DQM/DTMonitorModule/interface/DTCalibValidation.h" DEFINE_FWK_MODULE(DTCalibValidation); -#include "DQM/DTMonitorModule/src/DTROMonitorFilter.h" -DEFINE_FWK_MODULE(DTROMonitorFilter); +//#include "DQM/DTMonitorModule/src/DTROMonitorFilter.h" +//DEFINE_FWK_MODULE(DTROMonitorFilter); #include DEFINE_FWK_MODULE(DTTriggerEfficiencyTask); -#include -DEFINE_FWK_MODULE(DTLocalTriggerSynchTask); +//#include +//DEFINE_FWK_MODULE(DTLocalTriggerSynchTask); #include DEFINE_FWK_MODULE(DTLocalTriggerLutTask); diff --git a/DQM/DTMonitorModule/python/dtDQMOfflineSources_Cosmics_cff.py b/DQM/DTMonitorModule/python/dtDQMOfflineSources_Cosmics_cff.py index 9112c08f4bc5c..11d624cf43c5c 100644 --- a/DQM/DTMonitorModule/python/dtDQMOfflineSources_Cosmics_cff.py +++ b/DQM/DTMonitorModule/python/dtDQMOfflineSources_Cosmics_cff.py @@ -3,6 +3,7 @@ from DQM.DTMonitorModule.dtChamberEfficiency_Cosmics_cfi import * from DQM.DTMonitorModule.dtDCSByLumiTask_cfi import * from DQM.DTMonitorModule.dtSegmentTask_cfi import * +from DQM.DTMonitorModule.dtRunConditionVar_cfi import * dtSegmentAnalysisMonitor.detailedAnalysis = True dtSegmentAnalysisMonitor.slideTimeBins = False dtSegmentAnalysisMonitor.nLSTimeBin = 5 @@ -43,6 +44,7 @@ dtSourcesCosmics = cms.Sequence(dtDataIntegrityUnpacker + DTDataIntegrityTask + dtDCSByLumiMonitor + + dtRunConditionVar + dtSegmentAnalysisMonitor + dtResolutionAnalysisMonitor + dtEfficiencyMonitor + diff --git a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc b/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc deleted file mode 100644 index 0757ae59bfee6..0000000000000 --- a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc +++ /dev/null @@ -1,311 +0,0 @@ - - -/* - * See header file for a description of this class. - * - * \author G. Mila - INFN Torino - */ - - -#include - -// Framework -#include - -// Digis -#include -#include -#include - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - -// T0s -#include -#include -#include -#include - -#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" -#include "CondFormats/DTObjects/interface/DTStatusFlag.h" - - -#include -#include -#include -#include "TFile.h" -#include "TPostScript.h" -#include "TCanvas.h" - -using namespace edm; -using namespace std; - - -DTAlbertoBenvenutiTask::DTAlbertoBenvenutiTask(const edm::ParameterSet& ps){ - - debug = ps.getUntrackedParameter("debug", false); - if(debug) - cout<<"[DTAlbertoBenvenutiTask]: Constructor"<("outputFile", "DTDigiSources.root"); - maxTDCHits = ps.getUntrackedParameter("maxTDCHits",1000); - - // tMax (not yet from the DB) - tMax = parameters.getParameter("defaultTmax"); - - parameters = ps; - - //set Token(-s) - DTUnpackerToken_ = consumes(std::string("dtunpacker")); -} - - -DTAlbertoBenvenutiTask::~DTAlbertoBenvenutiTask(){ - - if(debug) - cout << "DTAlbertoBenvenutiTask: analyzed " << nevents << " events" << endl; - -} - - -void DTAlbertoBenvenutiTask::endJob(){ - - if(debug) - cout<<"[DTAlbertoBenvenutiTask] endjob called!"< > TBMap_perChamber; - - for(map::const_iterator wHisto = TBMap.begin(); - wHisto != TBMap.end(); - wHisto++) { - DTChamberId chId = (*wHisto).first.layerId().superlayerId().chamberId(); - TBMap_perChamber[chId].push_back((*wHisto).second); - } - - - for(map >::const_iterator Histo = TBMap_perChamber.begin(); - Histo != TBMap_perChamber.end(); - Histo++) { - stringstream station; station << (*Histo).first.station(); - stringstream sector; sector << (*Histo).first.sector(); - stringstream wheel; wheel << (*Histo).first.wheel(); - - string fileTag = "TimeBoxes"; - string fileName = fileTag - + "_W" + wheel.str() - + "_Sec" + sector.str() - + "_St" + station.str() - + ".ps"; - - TPostScript psFile(fileName.c_str(),111); - psFile.Range(20,26); - int counter = 0; - TCanvas c1("c1","",600,780); - c1.Divide(4,4); - psFile.NewPage(); - - cout<<"[DTAlbertoBenvenutiTask] filling the file: "<::const_iterator tbHisto = (*Histo).second.begin(); - tbHisto != (*Histo).second.end(); - tbHisto++) { - counter++; - c1.cd(counter); - (*tbHisto)->Draw(); - if(counter%16 == 0 && counter>=16){ - c1.Update(); - psFile.NewPage(); - c1.Clear(); - c1.Divide(4,4); - counter=0; - } - } // loop over TB histos (divided per chamber) - - } //loop over the chambers - -} - - -void DTAlbertoBenvenutiTask::beginJob(){ - - if(debug) - cout<<"[DTAlbertoBenvenutiTask]: BeginJob"<().get(muonGeom); - - // tTrig - if (parameters.getUntrackedParameter("readDB", true)) - context.get().get(tTrigMap); - - // t0s - if (parameters.getParameter("performPerWireT0Calibration")) - context.get().get(t0Map); - -} - - -void DTAlbertoBenvenutiTask::bookHistos(const DTWireId dtWire) { - - if (debug) cout<<"[DTAlbertoBenvenutiTask]: booking"<::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - // Loop over the SLs - for (; ch_it != ch_end; ++ch_it) { - DTChamberId ch = (*ch_it)->id(); - if(ch == dtWire.layerId().superlayerId().chamberId()){ - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - const int firstWire = muonGeom->layer(layerId)->specificTopology().firstChannel(); - const int lastWire = muonGeom->layer(layerId)->specificTopology().lastChannel(); - // Loop overt the wires - for(int wr=firstWire; wr -lastWire <= 0; wr++) { - - stringstream wire; wire << wr; - DTWireId wrId(layerId, wr); - - string histoTag = "TimeBox"; - string histoName = histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str() - + "_L" + layer.str() - + "_wire" + wire.str(); - - if (debug) cout<<"[DTAlbertoBenvenutiTask]: histoName "<("readDB", false) ) - // ttrig and rms are TDC counts - tTrigMap->get(dtWire.layerId().superlayerId(), tTrig, tTrigRMS, kFactor, - DTTimeUnits::counts); - else tTrig = parameters.getParameter("defaultTtrig"); - - string histoTitle = histoName + " (TDC Counts)"; - int timeBoxGranularity = parameters.getUntrackedParameter("timeBoxGranularity",4); - - if (!parameters.getUntrackedParameter("readDB", true)) { - int maxTDCCounts = 6400 * parameters.getUntrackedParameter("tdcRescale", 1); - TH1F *TB = new TH1F(histoName.c_str(),histoTitle.c_str(), maxTDCCounts/timeBoxGranularity, 0, maxTDCCounts); - TBMap[wrId] = TB; - } - else { - TH1F *TB = new TH1F(histoName.c_str(),histoTitle.c_str(), 2*tMax/timeBoxGranularity, tTrig-tMax, tTrig+2*tMax); - TBMap[wrId] = TB; - } - - } // loopover wires - } // loop over Ls - } // loop over SLs - } // if is the right chamber to book - } // loop over chambers -} - - -void DTAlbertoBenvenutiTask::analyze(const edm::Event& e, const edm::EventSetup& c){ - - nevents++; - if (nevents%1000 == 0 && debug) {} - - edm::Handle dtdigis; - e.getByToken(DTUnpackerToken_, dtdigis); - - bool checkNoisyChannels = parameters.getUntrackedParameter("checkNoisyChannels",false); - ESHandle statusMap; - if(checkNoisyChannels) { - // Get the map of noisy channels - c.get().get(statusMap); - } - - int tdcCount = 0; - DTDigiCollection::DigiRangeIterator dtLayerId_It; - for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){ - for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first; - digiIt!=((*dtLayerId_It).second).second; ++digiIt){ - tdcCount++; - } - } - - bool isSyncNoisy = false; - if (tdcCount > maxTDCHits) isSyncNoisy = true; - - for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){ - for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first; - digiIt!=((*dtLayerId_It).second).second; ++digiIt){ - - bool isNoisy = false; - bool isFEMasked = false; - bool isTDCMasked = false; - bool isTrigMask = false; - bool isDead = false; - bool isNohv = false; - const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire()); - if(checkNoisyChannels) { - statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv); - } - - // for clearness.. -// const DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId(); -// uint32_t indexSL = dtSLId.rawId(); -// const DTChamberId dtChId = dtSLId.chamberId(); -// uint32_t indexCh = dtChId.rawId(); -// int layer_number=((*dtLayerId_It).first).layer(); -// int superlayer_number=dtSLId.superlayer(); -// const DTLayerId dtLId = (*dtLayerId_It).first; -// uint32_t indexL = dtLId.rawId(); - - float t0; float t0RMS; - int tdcTime = (*digiIt).countsTDC(); - - if (parameters.getParameter("performPerWireT0Calibration")) { - const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire()); - t0Map->get(dtWireId, t0, t0RMS, DTTimeUnits::counts) ; - tdcTime += int(round(t0)); - } - - // avoid to fill TB with noise - if ((!isNoisy ) && (!isSyncNoisy)) { - // TimeBoxes per wire - if (TBMap.find(wireId) == TBMap.end()){ - bookHistos(wireId); - TBMap[wireId]->Fill(tdcTime); - } - else - TBMap[wireId]->Fill(tdcTime); - } - } - } -} - - - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTDataErrorFilter.cc b/DQM/DTMonitorModule/src/DTDataErrorFilter.cc deleted file mode 100644 index bc7575a262eed..0000000000000 --- a/DQM/DTMonitorModule/src/DTDataErrorFilter.cc +++ /dev/null @@ -1,31 +0,0 @@ -/* - * See header file for a description of this class. - * - * \author G. Cerminara - INFN Torino - */ - -#include "DQM/DTMonitorModule/src/DTDataErrorFilter.h" -#include "DQM/DTMonitorModule/interface/DTDataIntegrityTask.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - - -DTDataErrorFilter::DTDataErrorFilter(const edm::ParameterSet & config) : - HLTFilter(config) -{ - // Get the data integrity service - dataMonitor = edm::Service().operator->(); -} - -DTDataErrorFilter::~DTDataErrorFilter(){} - - -bool DTDataErrorFilter::hltFilter(edm::Event& event, const edm::EventSetup& setup, trigger::TriggerFilterObjectWithRefs & filterproduct) const { - // check the event error flag - if (dataMonitor->eventHasErrors()) return true; - return false; -} - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTDataIntegrityTask.cc b/DQM/DTMonitorModule/src/DTDataIntegrityTask.cc index 7cdb0e140951e..4b680b1efaf46 100644 --- a/DQM/DTMonitorModule/src/DTDataIntegrityTask.cc +++ b/DQM/DTMonitorModule/src/DTDataIntegrityTask.cc @@ -469,7 +469,7 @@ void DTDataIntegrityTask::bookHistos(DQMStore::IBooker & ibooker, string folder, // SC data Size histoType = "SCSizeVsROSSize"; histoName = "FED" + dduID_s.str() + "_SCSizeVsROSSize"; - histoTitle = "SC size - ROS size vs SC (FED " + dduID_s.str() + ")"; + histoTitle = "SC size vs SC (FED " + dduID_s.str() + ")"; rosHistos[histoType][code.getSCID()] = ibooker.book2D(histoName,histoTitle,12,1,13,51,-1,50); rosHistos[histoType][code.getSCID()]->setAxisTitle("SC",1); @@ -763,7 +763,7 @@ void DTDataIntegrityTask::processROS25(DTROS25Data & data, int ddu, int ros) { if (mode <= 1 && getSCInfo) { // NumberOf16bitWords counts the # of words + 1 subheader // the SC includes the SC "private header" and the ROS header and trailer (= NumberOf16bitWords +3) - rosHistos["SCSizeVsROSSize"][code.getSCID()]->Fill(ros,data.getSCPrivHeader().NumberOf16bitWords()+3-data.getSCTrailer().wordCount()); + rosHistos["SCSizeVsROSSize"][code.getSCID()]->Fill(ros,data.getSCTrailer().wordCount()); } } @@ -779,7 +779,7 @@ void DTDataIntegrityTask::processFED(DTDDUData & data, const std::vector FEDIDMax) return; - + hFEDEntry->Fill(code.getDDUID()); FEDTrailer trailer = data.getDDUTrailer(); diff --git a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc b/DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc deleted file mode 100644 index 845a864bf92aa..0000000000000 --- a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc +++ /dev/null @@ -1,211 +0,0 @@ - /* - * \file DTDigiForNoiseTask.cc - * - * \author G. Mila - INFN Torino - * - */ - -#include - -// Framework -#include - -// Digis -#include -#include - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" - -#include -#include -#include - -using namespace edm; -using namespace std; - - -DTDigiForNoiseTask::DTDigiForNoiseTask(const edm::ParameterSet& ps){ - - debug = ps.getUntrackedParameter("debug", false); - dtDigisToken_ = consumes( - edm::InputTag(ps.getUntrackedParameter("diDigisLabel", "dtunpacker"))); - - if(debug) - cout<<"[DTDigiForNoiseTask]: Constructor"<().get(muonGeom); - return; -} - -void DTDigiForNoiseTask::bookHistograms(DQMStore::IBooker & ibooker, - edm::Run const & run, - edm::EventSetup const & context) { - - if(debug) - cout<<"[DTDigiForNoiseTask]: boojHistograms"<("ResetCycle", 3) == 0) { - for(map< DTLayerId, MonitorElement* > ::const_iterator histo = digiHistos.begin(); - histo != digiHistos.end(); - histo++) { - (*histo).second->Reset(); - } - } - -} - -void DTDigiForNoiseTask::bookHistos(DQMStore::IBooker & ibooker,const DTLayerId& lId) { - - if (debug) cout<<"[DTDigiForNoiseTask]: booking"<layer(lId)->specificTopology(); - const int firstWire = dtTopo.firstChannel(); - const int lastWire = dtTopo.lastChannel(); - int nWires = lastWire-firstWire+1; - - digiHistos[lId] = ibooker.book2D(histoName,histoName,nWires,firstWire,lastWire,10,-0.5,9.5); - -// dynamic bookings staticized - // Loop over all the chambers - auto ch_it = muonGeom->chambers().begin(); - auto ch_end = muonGeom->chambers().end(); - // Loop over the SLs - for (; ch_it != ch_end; ++ch_it) { - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - - bookHistos(ibooker,layerId); - } - } - } - -} - - -void DTDigiForNoiseTask::analyze(const edm::Event& e, const edm::EventSetup& c){ - - nevents++; - if (nevents%1000 == 0 && debug) {} - - edm::Handle dtdigis; - e.getByToken(dtDigisToken_, dtdigis); - - std::map< int,int > DigiPerWirePerEvent; - - // Loop over all the chambers - auto ch_it = muonGeom->chambers().begin(); - auto ch_end = muonGeom->chambers().end(); - // Loop over the SLs - for (; ch_it != ch_end; ++ch_it) { - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - - DTDigiCollection::Range layerDigi= dtdigis->get(layerId); - if(layerDigi.first != layerDigi.second){ - - const DTTopology& dtTopo = muonGeom->layer(layerId)->specificTopology(); - const int firstWire = dtTopo.firstChannel(); - const int lastWire = dtTopo.lastChannel(); - - if (digiHistos.find(layerId) != digiHistos.end()){ - for (int wire=firstWire; wire-lastWire <= 0; wire++) { - DigiPerWirePerEvent[wire]= 0; - } - - for (DTDigiCollection::const_iterator digi = layerDigi.first; - digi!=layerDigi.second; - ++digi){ - DigiPerWirePerEvent[(*digi).wire()]+=1; - } - - for (int wire=firstWire; wire-lastWire<=0; wire++) { - digiHistos.find(layerId)->second->Fill(wire,DigiPerWirePerEvent[wire]); - } - } - } - - } //Loop Ls - } //Loop SLs - } //Loop over chambers - -} - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: - - - diff --git a/DQM/DTMonitorModule/src/DTGlobalRecoTask.cc b/DQM/DTMonitorModule/src/DTGlobalRecoTask.cc deleted file mode 100644 index e1d7eb92096da..0000000000000 --- a/DQM/DTMonitorModule/src/DTGlobalRecoTask.cc +++ /dev/null @@ -1,37 +0,0 @@ -/* - * \file DTDigiTask.cc - * - * \author M. Zanetti - INFN Padova - * -*/ - -#include -#include "DQMServices/Core/interface/DQMStore.h" - - -using namespace std; - -DTGlobalRecoTask::DTGlobalRecoTask(const edm::ParameterSet& ps, const edm::EventSetup& context){ - logFile.open("DTGlobalRecoTask.log"); - nevents = 0; -} - -DTGlobalRecoTask::~DTGlobalRecoTask(){ - cout << "DTGlobalRecoTask: analyzed " << nevents << " events" << endl; - logFile.close(); -} - - -void DTGlobalRecoTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & context) { - ibooker.setCurrentFolder("DT/DTGlobalRecoTask"); -} - -void DTGlobalRecoTask::analyze(const edm::Event& e, const edm::EventSetup& c){ - nevents++; -} - - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc b/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc deleted file mode 100644 index fbdabbae11265..0000000000000 --- a/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc +++ /dev/null @@ -1,272 +0,0 @@ -/* - * \file DTLocalTriggerSynchTask.cc - * - * \author C. Battilana - CIEMAT - * -*/ - -#include "DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.h" - -// Framework -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/Utilities/interface/InputTag.h" - -// Geometry -#include "DataFormats/GeometryVector/interface/Pi.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTSuperLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - -// tTrigs -#include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h" -#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" - -// DT Digi -#include -#include - - -//Root -#include"TH1.h" -#include"TAxis.h" - -#include -#include -#include - - -using namespace edm; -using namespace std; - -DTLocalTriggerSynchTask::DTLocalTriggerSynchTask(const edm::ParameterSet& ps) : nevents(0) { - - edm::LogVerbatim ("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: Constructor" << endl; - parameters = ps; - dcc_Token_ = consumes( - parameters.getParameter("DCCInputTag")); - ddu_Token_ = consumes( - parameters.getParameter("DDUInputTag")); - seg_Token_ = consumes( - parameters.getParameter("SEGInputTag")); - - bxTime = parameters.getParameter("bxTimeInterval"); // CB move this to static const or DB - rangeInBX = parameters.getParameter("rangeWithinBX"); - nBXLow = parameters.getParameter("nBXLow"); - nBXHigh = parameters.getParameter("nBXHigh"); - angleRange = parameters.getParameter("angleRange"); - minHitsPhi = parameters.getParameter("minHitsPhi"); - baseDirectory = parameters.getParameter("baseDir"); -} - - -DTLocalTriggerSynchTask::~DTLocalTriggerSynchTask() { - - edm::LogVerbatim ("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: analyzed " << nevents << " events" << endl; - -} - -void DTLocalTriggerSynchTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & context) { - - edm::LogVerbatim ("DTLocalTriggerSynchTask") <<"[DTLocalTriggerSynchTask]: Book Histograms"<Fill(bxTime); - - tTrigSync = DTTTrigSyncFactory::get()->create(parameters.getParameter("tTrigMode"), - parameters.getParameter("tTrigModeConfig")); - tTrigSync->setES(context); - - - std::vector::const_iterator chambIt = muonGeom->chambers().begin(); - std::vector::const_iterator chambEnd = muonGeom->chambers().end(); - - for (; chambIt!=chambEnd; ++chambIt) { - bookHistos(ibooker,(*chambIt)->id()); - triggerHistos[(*chambIt)->id().rawId()]["tTrig_SL1"]->Fill(tTrigSync->offset(DTWireId((*chambIt)->id(),1,1,2))); - triggerHistos[(*chambIt)->id().rawId()]["tTrig_SL3"]->Fill(tTrigSync->offset(DTWireId((*chambIt)->id(),3,1,2))); - } - - -} - - -void DTLocalTriggerSynchTask::dqmBeginRun(const Run& run, const EventSetup& context) { - - context.get().get(muonGeom); -} - - -void DTLocalTriggerSynchTask::analyze(const edm::Event& event, const edm::EventSetup& context){ - - nevents++; - - InputTag inputTagDCC = parameters.getParameter("DCCInputTag"); - InputTag inputTagDDU = parameters.getParameter("DDUInputTag"); - InputTag inputTagSEG = parameters.getParameter("SEGInputTag"); - - for (int i=0;i<5;++i){ - for (int j=0;j<6;++j){ - for (int k=0;k<13;++k){ - phCodeBestDCC[j][i][k] = -1; - phCodeBestDDU[j][i][k] = -1; - } - } - } - - // Get best DCC triggers - edm::Handle l1DTTPGPh; - event.getByToken(dcc_Token_, l1DTTPGPh); - vector const* phTrigs = l1DTTPGPh->getContainer(); - - vector::const_iterator iph = phTrigs->begin(); - vector::const_iterator iphe = phTrigs->end(); - for(; iph !=iphe ; ++iph) { - - int phwheel = iph->whNum(); - int phsec = iph->scNum() + 1; // DTTF[0-11] -> DT[1-12] Sector Numbering - int phst = iph->stNum(); - int phcode = iph->code(); - - if(phcode>phCodeBestDCC[phwheel+3][phst][phsec] && phcode<7) { - phCodeBestDCC[phwheel+3][phst][phsec]=phcode; - } - - } - - // Get best DDU triggers - Handle trigsDDU; - event.getByToken(ddu_Token_, trigsDDU); - DTLocalTriggerCollection::DigiRangeIterator detUnitIt; - - for (detUnitIt=trigsDDU->begin();detUnitIt!=trigsDDU->end();++detUnitIt){ - - const DTChamberId& id = (*detUnitIt).first; - const DTLocalTriggerCollection::Range& range = (*detUnitIt).second; - - int wh = id.wheel(); - int sec = id.sector(); - int st = id.station(); - - for (DTLocalTriggerCollection::const_iterator trigIt = range.first; trigIt!=range.second;++trigIt){ - - int quality = trigIt->quality(); - - if(quality>-1 && quality<7 && - quality>phCodeBestDDU[wh+3][st][sec]) { - phCodeBestDDU[wh+3][st][sec]=quality; - } - } - } - - //Get best segments (highest number of phi hits) - vector bestSegments4D; - Handle segments4D; - event.getByToken(seg_Token_, segments4D); - DTRecSegment4DCollection::const_iterator track; - DTRecSegment4DCollection::id_iterator chambIdIt; - - for (chambIdIt = segments4D->id_begin(); chambIdIt != segments4D->id_end(); ++chambIdIt){ - - DTRecSegment4DCollection::range range = segments4D->get(*chambIdIt); - const DTRecSegment4D* best=0; - int hitsBest = 0; - int hits = 0; - - for ( track = range.first; track != range.second; ++track){ - if( (*track).hasPhi() ) { - hits = (*track).phiSegment()->degreesOfFreedom()+2; - if ( hits>hitsBest ){ - best = &(*track); - hitsBest = hits; - } - } - } - if (best) { - bestSegments4D.push_back(best); - } - } - - - // Filling histos - vector::const_iterator bestSegIt = bestSegments4D.begin(); - vector::const_iterator bestSegEnd = bestSegments4D.end(); - for (; bestSegIt!=bestSegEnd; ++bestSegIt ){ - - float dir = atan((*bestSegIt)->localDirection().x()/ (*bestSegIt)->localDirection().z())*180/Geom::pi(); // CB cerca un modo migliore x farlo - const DTRecSegment2D* seg2D = (*bestSegIt)->phiSegment(); - int nHitsPhi = seg2D->degreesOfFreedom()+2; - DTChamberId chambId = (*bestSegIt)->chamberId(); - map &innerME = triggerHistos[chambId.rawId()]; - - if (fabs(dir)=minHitsPhi && - seg2D->ist0Valid()){ - - float t0seg = (*bestSegIt)->phiSegment()->t0(); - float tTrig = (tTrigSync->offset(DTWireId(chambId,1,1,2)) + tTrigSync->offset(DTWireId(chambId,3,1,2)) )/2; - float time = tTrig+t0seg; - float htime = rangeInBX ? time-int(time/bxTime)*bxTime : time-int(tTrig/bxTime)*bxTime; - - int wheel = chambId.wheel(); - int sector = chambId.sector(); - int station = chambId.station(); - int scsector = sector>12 ? sector==13 ? 4 : 10 : sector; - - int qualDCC = phCodeBestDCC[wheel+3][station][scsector]; - int qualDDU = phCodeBestDDU[wheel+3][station][scsector]; - - if (fabs(t0seg)>0.01) { - innerME.find("SEG_TrackCrossingTime")->second->Fill(htime); - if ( qualDCC>=0 ) innerME.find("DCC_TrackCrossingTimeAll")->second->Fill(htime); - if ( qualDCC==6 ) innerME.find("DCC_TrackCrossingTimeHH")->second->Fill(htime); - if ( qualDDU>=0 ) innerME.find("DDU_TrackCrossingTimeAll")->second->Fill(htime); - if ( qualDDU==6 ) innerME.find("DDU_TrackCrossingTimeHH")->second->Fill(htime); - } - - } - } - -} - -void DTLocalTriggerSynchTask::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId& dtChId) { - - stringstream wheel; wheel << dtChId.wheel(); - stringstream station; station << dtChId.station(); - stringstream sector; sector << dtChId.sector(); - uint32_t chRawId = dtChId.rawId(); - - ibooker.setCurrentFolder(baseDir() + "/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str() ); - - - string histoTag[5] = { "SEG_TrackCrossingTime", "DCC_TrackCrossingTimeAll", "DCC_TrackCrossingTimeHH", "DDU_TrackCrossingTimeAll", "DDU_TrackCrossingTimeHH" }; - - float min = rangeInBX ? 0 : nBXLow*bxTime; - float max = rangeInBX ? bxTime : nBXHigh*bxTime; - int nbins = static_cast(ceil( rangeInBX ? bxTime : (nBXHigh-nBXLow)*bxTime)); - - for (int iHisto=0;iHisto<5;++iHisto) { - string histoName = histoTag[iHisto] + (rangeInBX ? "InBX" : "") + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - edm::LogVerbatim ("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: booking " - << baseDir() + "/Wheel" << wheel.str() - << "/Sector" << sector.str() - << "/Station"<< station.str() - << "/" << histoName << endl; - - triggerHistos[chRawId][histoTag[iHisto]] = ibooker.book1D(histoName.c_str(),"Track time distribution",nbins,min,max); - } - - string floatTag[2] = { "tTrig_SL1", "tTrig_SL3" }; - - for (int iFloat=0;iFloat<2;++iFloat) { - string floatName = floatTag[iFloat] + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - triggerHistos[chRawId][floatTag[iFloat]] = ibooker.bookFloat(floatName); - } - -} - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTROMonitorFilter.cc b/DQM/DTMonitorModule/src/DTROMonitorFilter.cc deleted file mode 100644 index f31cb195b5193..0000000000000 --- a/DQM/DTMonitorModule/src/DTROMonitorFilter.cc +++ /dev/null @@ -1,73 +0,0 @@ -/* - * See header file for a description of this class. - * - * \author G. Cerminara - INFN Torino - */ - -#include "DQM/DTMonitorModule/src/DTROMonitorFilter.h" - -#include - -#include -#include -#include - -#include -#include -#include - -using namespace edm; - - -DTROMonitorFilter::DTROMonitorFilter(const edm::ParameterSet& pset) : - HLTFilter(pset) -{ - rawDataToken_ = consumes( - pset.getUntrackedParameter("inputLabel",InputTag("source"))); -} - -DTROMonitorFilter::~DTROMonitorFilter(){} - - -bool DTROMonitorFilter::hltFilter(edm::Event& event, - const edm::EventSetup& setup, - trigger::TriggerFilterObjectWithRefs & filterproduct) const { - // get the raw data - edm::Handle rawdata; - event.getByToken(rawDataToken_, rawdata); - - // Loop over the DT FEDs - int FEDIDmin = FEDNumbering::MINDTFEDID; - int FEDIDMax = FEDNumbering::MAXDTFEDID; - - // Definitions - static const int wordSize_32 = 4; - static const int wordSize_64 = 8; - - for (int dduID=FEDIDmin; dduID<=FEDIDMax; ++dduID) { // loop over all feds - const FEDRawData& feddata = rawdata->FEDData(dduID); - const int datasize = feddata.size(); - if (datasize){ // check the FED payload - const unsigned int* index32 = reinterpret_cast(feddata.data()); - const int numberOf32Words = datasize/wordSize_32; - - const unsigned char* index8 = reinterpret_cast(index32); - - // Check Status Words (1 x ROS) - for (int rosId = 0; rosId < 12; rosId++ ) { - int wordIndex8 = numberOf32Words*wordSize_32 - 3*wordSize_64 + rosId; - DTDDUFirstStatusWord statusWord(index8[wordIndex8]); - // check the error bit - if(statusWord.errorFromROS() != 0) return true; - } - } - } - - // check the event error flag - return false; -} - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTTestPulsesTask.cc b/DQM/DTMonitorModule/src/DTTestPulsesTask.cc deleted file mode 100644 index 2714de27eed3e..0000000000000 --- a/DQM/DTMonitorModule/src/DTTestPulsesTask.cc +++ /dev/null @@ -1,240 +0,0 @@ -/* - * \file DTTestPulsesTask.cc - * - * \author M. Zanetti - INFN Padova - * -*/ - -#include - -// Framework -#include - -// Digis -#include - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - -// Pedestals -#include -#include -#include -#include -#include "DQMServices/Core/interface/DQMStore.h" - - -using namespace edm; -using namespace std; - - -DTTestPulsesTask::DTTestPulsesTask(const edm::ParameterSet& ps){ - - - cout<<"[DTTestPulseTask]: Constructor"<( - edm::InputTag(ps.getUntrackedParameter("dtdigis", "dtunpacker"))); - - parameters = ps; - - - t0sPeakRange = make_pair( parameters.getUntrackedParameter("t0sRangeLowerBound", -100), - parameters.getUntrackedParameter("t0sRangeUpperBound", 100)); - -} - -DTTestPulsesTask::~DTTestPulsesTask(){ - - cout <<"[DTTestPulsesTask]: analyzed " << nevents << " events" << endl; - -} - -void DTTestPulsesTask::dqmBeginRun(const edm::Run& run, const edm::EventSetup& context) { - - cout<<"[DTTestPulsesTask]: dqmBeginRun"<().get(muonGeom); - nevents = 0; -} - -void DTTestPulsesTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & context) { - - bookHistos( ibooker, string("TPOccupancy"), string("TestPulses") ); - bookHistos( ibooker, string("TPProfile"), string("TestPulses2D") ); - bookHistos( ibooker, string("TPTimeBox"), string("TestPulsesTB") ); -} - -void DTTestPulsesTask::bookHistos(DQMStore::IBooker & ibooker, string folder, string histoTag) { - - cout<<"[DTTestPulseTask]: booking"<::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - - for (; ch_it != ch_end; ++ch_it) { - - // Loop over the SLs - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - - // Loop over the Ls - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - stringstream superLayer; superLayer << layerId.superlayer(); - stringstream station; station << layerId.superlayerId().chamberId().station(); - stringstream sector; sector << layerId.superlayerId().chamberId().sector(); - stringstream wheel; wheel << layerId.superlayerId().chamberId().wheel(); - - // TP Profiles - if ( folder == "TPProfile" ) { - - const int nWires = (*l_it)->specificTopology().channels(); - - ibooker.setCurrentFolder("DT/DTTestPulsesTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + - "/SuperLayer" + superLayer.str() + - "/" +folder); - - string histoName = histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str() - + "_L" + layer.str(); - - // Setting the range - if ( parameters.getUntrackedParameter("readDB", false) ) { - t0RangeMap->slRangeT0( layerId.superlayerId() , t0sPeakRange.first, t0sPeakRange.second); - } - - - cout<<"t0sRangeLowerBound "<layer(DTLayerId(layerId.wheel(), - layerId.station(), - layerId.sector(), - layerId.superlayer(), - layerId.layer()))->specificTopology().channels(); - - testPulsesOccupancies[int(DTLayerId(layerId.wheel(), - layerId.station(), - layerId.sector(), - layerId.superlayer(), - layerId.layer()).rawId())] = - ibooker.book1D(histoName, histoName, nWires, 0, nWires); - } - - // Time Box per Chamber - else if ( folder == "TPTimeBox" ) { - - ibooker.setCurrentFolder("DT/DTTestPulsesTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + - "/" +folder); - - string histoName = histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str(); - - testPulsesTimeBoxes[int( DTLayerId(layerId.wheel(), - layerId.station(), - layerId.sector(), - layerId.superlayer(), - layerId.layer()).chamberId().rawId())] = - ibooker.book1D(histoName, histoName, 10000, 0, 10000); // Overview of the TP (and noise) times - } - - } // close loop on layers - } // close loop on superlayers - } // close loop on chambers -} - - -void DTTestPulsesTask::analyze(const edm::Event& e, const edm::EventSetup& c){ - - nevents++; - - edm::Handle dtdigis; - e.getByToken(dtDigisToken_, dtdigis); - - DTDigiCollection::DigiRangeIterator dtLayerId_It; - for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){ - - for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first; - digiIt!=((*dtLayerId_It).second).second; ++digiIt){ - - // for clearness.. - int layerIndex = ((*dtLayerId_It).first).rawId(); - int chIndex = ((*dtLayerId_It).first).chamberId().rawId(); - - - if ((int)(*digiIt).countsTDC() > t0sPeakRange.first && - (int)(*digiIt).countsTDC() < t0sPeakRange.second ) { - - // Occupancies - - testPulsesOccupancies.find(layerIndex)->second->Fill((*digiIt).wire()); - - // Profiles - - testPulsesProfiles.find(layerIndex)->second->Fill((*digiIt).wire(),(*digiIt).countsTDC()); - } - - // Time Box - - testPulsesTimeBoxes.find(chIndex)->second->Fill((*digiIt).countsTDC()); - } - } - -} - - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTTriggerCheck.cc b/DQM/DTMonitorModule/src/DTTriggerCheck.cc deleted file mode 100644 index 226102763282f..0000000000000 --- a/DQM/DTMonitorModule/src/DTTriggerCheck.cc +++ /dev/null @@ -1,79 +0,0 @@ - -/* - * See header file for a description of this class. - * - * \author S.Bologensi - INFN Torino - */ - -#include "DQM/DTMonitorModule/interface/DTTriggerCheck.h" - -#include "FWCore/Framework/interface/Event.h" - -#include "DQMServices/Core/interface/DQMStore.h" - -#include - -using namespace edm; -using namespace std; - -DTTriggerCheck::DTTriggerCheck(const ParameterSet& pset) : - isLocalRun(pset.getUntrackedParameter("localrun", true)) { - - if (!isLocalRun) { - ltcDigiCollectionToken_ = consumes( - pset.getParameter("ltcDigiCollectionTag")); - } - - debug = pset.getUntrackedParameter("debug",false); - -} - -DTTriggerCheck::~DTTriggerCheck(){ -} - -void DTTriggerCheck::bookHistograms(DQMStore::IBooker & ibooker, - edm::Run const & iRun, - edm::EventSetup const & /* iSetup */) { - ibooker.setCurrentFolder("DT/DTTriggerTask"); - - histo = ibooker.book1D("hNTriggerPerType", - "# of trigger per type",21,-1,20); -} - -void DTTriggerCheck::analyze(const Event& event, const EventSetup& setup) { - if(debug) - cout << "[DTTriggerCheck] Analyze #Run: " << event.id().run() - << " #Event: " << event.id().event() << endl; - - //Get the trigger source from ltc digis - edm::Handle ltcdigis; - if (!isLocalRun) - { - event.getByToken(ltcDigiCollectionToken_, ltcdigis); - for (std::vector::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){ - if (((*ltc_it).HasTriggered(0)) || - ((*ltc_it).HasTriggered(1)) || - ((*ltc_it).HasTriggered(2)) || - ((*ltc_it).HasTriggered(3)) || - ((*ltc_it).HasTriggered(4))) - histo->Fill(-1); - if ((*ltc_it).HasTriggered(0)) - histo->Fill(0); - if ((*ltc_it).HasTriggered(1)) - histo->Fill(1); - if ((*ltc_it).HasTriggered(2)) - histo->Fill(2); - if ((*ltc_it).HasTriggered(3)) - histo->Fill(3); - if ((*ltc_it).HasTriggered(4)) - histo->Fill(4); - } - } - else - histo->Fill(0); -} - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: From 70d16da393d051884e74bd2078debbb11070262d Mon Sep 17 00:00:00 2001 From: Francesca Cavallo Date: Mon, 20 Apr 2015 11:00:37 +0200 Subject: [PATCH 02/10] package pruned --- .../python/dtDQMOfflineClients_Cosmics_cff.py | 2 + .../src/DTCreateSummaryHistos.cc | 713 ---------------- DQM/DTMonitorClient/src/DTDeadChannelTest.cc | 226 ----- DQM/DTMonitorClient/src/DTFineDelayCorr.cc | 203 ----- .../src/DTLocalTriggerSynchTest.cc | 287 ------- DQM/DTMonitorClient/src/DTNoiseTest.cc | 314 ------- DQM/DTMonitorClient/src/DTResolutionTest.cc | 782 ------------------ .../src/DTtTrigCalibrationTest.cc | 277 ------- DQM/DTMonitorClient/src/SealModule.cc | 20 +- 9 files changed, 12 insertions(+), 2812 deletions(-) delete mode 100644 DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc delete mode 100644 DQM/DTMonitorClient/src/DTDeadChannelTest.cc delete mode 100644 DQM/DTMonitorClient/src/DTFineDelayCorr.cc delete mode 100644 DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.cc delete mode 100644 DQM/DTMonitorClient/src/DTNoiseTest.cc delete mode 100644 DQM/DTMonitorClient/src/DTResolutionTest.cc delete mode 100644 DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc diff --git a/DQM/DTMonitorClient/python/dtDQMOfflineClients_Cosmics_cff.py b/DQM/DTMonitorClient/python/dtDQMOfflineClients_Cosmics_cff.py index 129913c0d99b2..7d924b8c16cf6 100644 --- a/DQM/DTMonitorClient/python/dtDQMOfflineClients_Cosmics_cff.py +++ b/DQM/DTMonitorClient/python/dtDQMOfflineClients_Cosmics_cff.py @@ -9,6 +9,7 @@ from DQM.DTMonitorClient.dtResolutionAnalysisTest_cfi import * from DQM.DTMonitorClient.dtTriggerEfficiencyTest_cfi import * from DQM.DTMonitorClient.dtBlockedROChannelsTest_cfi import * +from DQM.DTMonitorClient.dtRunConditionVarClient_cfi import * blockedROChannelTest.offlineMode = True; from DQM.DTMonitorClient.ALCARECODTCalibSynchCosmicsDQMClient_cff import * @@ -25,6 +26,7 @@ dtChamberEfficiencyClient+ triggerEffTest+ blockedROChannelTest+ + dtRunConditionVarClient+ dtOfflineSummaryClients+ ALCARECODTCalibSynchCosmicsDQMClient) diff --git a/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc b/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc deleted file mode 100644 index cad3965c88c18..0000000000000 --- a/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc +++ /dev/null @@ -1,713 +0,0 @@ -/* - * See header file for a description of this class. - * - * \author G. Mila - INFN Torino - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah ncpp-um-my - * - */ - - -#include - -// Framework -#include - - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include -#include -#include - -#include "TCanvas.h" -#include "TFile.h" -#include "TProfile.h" - -using namespace edm; -using namespace std; - -DTCreateSummaryHistos::DTCreateSummaryHistos(const edm::ParameterSet& ps){ - - edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos]: Constructor"; - - parameters = ps; - - // The root file which contain the histos - string rootFileName = ps.getUntrackedParameter("rootFileName", "DTEfficiencyTest.root"); - theFile = new TFile(rootFileName.c_str(), "READ"); - - // The *.ps file which contains the summary histos - PsFileName = ps.getUntrackedParameter("PsFileName", "DTSummaryHistos"); - - // Files to write in the *.ps file - DataIntegrityHistos = ps.getUntrackedParameter("DataIntegrityHistos", false); - DigiHistos = ps.getUntrackedParameter("DigiHistos", false); - RecoHistos = ps.getUntrackedParameter("RecoHistos", false); - ResoHistos = ps.getUntrackedParameter("ResoHistos", false); - EfficiencyHistos = ps.getUntrackedParameter("EfficiencyHistos", false); - TestPulsesHistos = ps.getUntrackedParameter("TestPulsesHistos", false); - TriggerHistos = ps.getUntrackedParameter("TriggerHistos", false); - - // The DDU Id - DDUId = ps.getUntrackedParameter("DDUId"); - - MainFolder = "DQMData/DT/"; - - nevents = 0; - -} - -DTCreateSummaryHistos::~DTCreateSummaryHistos(){ - - edm::LogVerbatim ("histos") << "DTCreateSummaryHistos: analyzed " << nevents << " events"; - theFile->Close(); - -} - -void DTCreateSummaryHistos::beginRun(const edm::Run& run, const edm::EventSetup& context){ - - // Get the geometry - context.get().get(muonGeom); - -} - -void DTCreateSummaryHistos::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - - edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos] endjob called!"; - - stringstream RunNum; RunNum << runNumber; - string PsFileNameWithRun = PsFileName + "_" + RunNum.str() + ".ps"; - TPostScript psFile(PsFileNameWithRun.c_str(),111); - psFile.Range(20,26); - //psFile.NewPage(); - TCanvas c1("c1","",600,780); - - - - // DataIntegrity summary histos ************************************************************** - if(DataIntegrityHistos){ - c1.Clear(); - c1.Divide(2,2); - stringstream dduID; dduID << DDUId; - - string histo_name1 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_TTSValues"; - TH1F *histo1 = (TH1F*) theFile -> Get(histo_name1.c_str()); - c1.cd(1); - if(histo1) - histo1->Draw(); - - string histo_name2 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSStatus"; - TH1F *histo2 = (TH1F*) theFile -> Get(histo_name2.c_str()); - c1.cd(2); - if(histo2) - histo2->Draw(); - - string histo_name3 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSSummary"; - TH1F *histo3 = (TH1F*) theFile -> Get(histo_name3.c_str()); - c1.cd(3); - if(histo3) - histo3->Draw(); - - string histo_name4 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/ROS1/FED" + dduID.str() + "_ROS1_ROSError"; - TH1F *histo4 = (TH1F*) theFile -> Get(histo_name4.c_str()); - c1.cd(4); - if(histo4) - histo4->Draw(); - - c1.Update(); - psFile.NewPage(); - } - - // Digi summary histos ******************************************************************** - if(DigiHistos){ - // Time Box Histos - c1.Clear(); - c1.Divide(3,4); - // Loop over all the chambers - vector::const_iterator ch_digi_it = muonGeom->chambers().begin(); - vector::const_iterator ch_digi_end = muonGeom->chambers().end(); - for (; ch_digi_it != ch_digi_end; ++ch_digi_it) { - DTChamberId ch = (*ch_digi_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - vector::const_iterator sl_it = (*ch_digi_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_digi_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - - string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); - string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/TimeBoxes/TimeBox_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str(); - TH1F *histo = (TH1F *) theFile->Get(histo_name.c_str()); - if(histo){ - int pad = (ch.station() - 1)*3 + sl.superlayer(); - c1.cd(pad); - histo->Draw(); - } - } - } - c1.Update(); - psFile.NewPage(); - - // Occupancy in Time Histos - c1.Clear(); - c1.Divide(4,3); - // Loop over all the chambers - vector::const_iterator ch_digi2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_digi2_end = muonGeom->chambers().end(); - for (; ch_digi2_it != ch_digi2_end; ++ch_digi2_it) { - DTChamberId ch = (*ch_digi2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_digi2_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_digi2_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); - string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyInTimeHits_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found){ - c1.Update(); - psFile.NewPage(); - } - } - - // Occupancy Noise - // Loop over all the chambers - vector::const_iterator ch_digi3_it = muonGeom->chambers().begin(); - vector::const_iterator ch_digi3_end = muonGeom->chambers().end(); - for (; ch_digi3_it != ch_digi3_end; ++ch_digi3_it) { - DTChamberId ch = (*ch_digi3_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_digi3_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_digi3_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); - string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyNoise_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found) { - c1.Update(); - psFile.NewPage(); - } - } - - // Digi Per Event - // Loop over all the chambers - vector::const_iterator ch_digi4_it = muonGeom->chambers().begin(); - vector::const_iterator ch_digi4_end = muonGeom->chambers().end(); - for (; ch_digi4_it != ch_digi4_end; ++ch_digi4_it) { - DTChamberId ch = (*ch_digi4_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_digi4_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_digi4_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); - string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/DigiPerEvent/DigiPerEvent_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); - TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found){ - c1.Update(); - psFile.NewPage(); - } - } - } - - // Reconstruction summary histos ********************************************************* - if(RecoHistos){ - // reco segment Histos - page1 - c1.Clear(); - c1.Divide(2,4); - // Loop over all the chambers - vector::const_iterator ch_reco_it = muonGeom->chambers().begin(); - vector::const_iterator ch_reco_end = muonGeom->chambers().end(); - for (; ch_reco_it != ch_reco_end; ++ch_reco_it) { - DTChamberId ch = (*ch_reco_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str(); - string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hN4DSeg_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - int pad = (ch.station() - 1)*2 + 1; - c1.cd(pad); - histo->Draw(); - } - histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmXvsYInCham_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TProfile *histo2 = (TProfile*) theFile -> Get(histo_name.c_str()); - if(histo2){ - int pad = (ch.station() - 1)*2 + 2; - c1.cd(pad); - histo2->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - // reco segment Histos - page2 - // Loop over all the chambers - vector::const_iterator ch_reco2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_reco2_end = muonGeom->chambers().end(); - for (; ch_reco2_it != ch_reco2_end; ++ch_reco2_it) { - DTChamberId ch = (*ch_reco2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str(); - string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmPhiDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo) { - int pad = (ch.station() - 1)*2 + 1; - c1.cd(pad); - histo->Draw(); - } - histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmThetaDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo2 = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo2) { - int pad = (ch.station() - 1)*2 + 2; - c1.cd(pad); - histo2->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - } - - // Resolution summary histos ******************************************************************* - if(ResoHistos){ - // Residuals histos - c1.Clear(); - c1.Divide(3,4); - // Loop over all the chambers - vector::const_iterator ch_reso_it = muonGeom->chambers().begin(); - vector::const_iterator ch_reso_end = muonGeom->chambers().end(); - for (; ch_reso_it != ch_reso_end; ++ch_reso_it) { - DTChamberId ch = (*ch_reso_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - vector::const_iterator sl_it = (*ch_reso_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_reso_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - - string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str(); - string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - int pad = (ch.station() - 1)*3 + sl.superlayer(); - c1.cd(pad); - histo->Draw(); - } - } - } - c1.Update(); - psFile.NewPage(); - - // Residuals as a function of the position Histos - // Loop over all the chambers - vector::const_iterator ch_reso2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_reso2_end = muonGeom->chambers().end(); - for (; ch_reso2_it != ch_reso2_end; ++ch_reso2_it) { - DTChamberId ch = (*ch_reso2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - vector::const_iterator sl_it = (*ch_reso2_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_reso2_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - - string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str(); - string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDistVsDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str(); - TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str()); - if(histo){ - int pad = (ch.station() - 1)*3 + sl.superlayer(); - c1.cd(pad); - histo->Draw(); - } - } - } - c1.Update(); - psFile.NewPage(); - } - - // Efficiency summary histos ****************************************************************** - if(EfficiencyHistos){ - // Cell efficiency - c1.Clear(); - c1.Divide(4,3); - // Loop over all the chambers - vector::const_iterator ch_eff_it = muonGeom->chambers().begin(); - vector::const_iterator ch_eff_end = muonGeom->chambers().end(); - for (; ch_eff_it != ch_eff_end; ++ch_eff_it) { - DTChamberId ch = (*ch_eff_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_eff_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_eff_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string efficiencyFolder = MainFolder + "Tests/DTEfficiency/Wheel" + wheel.str(); - string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/UnassEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found){ - c1.Update(); - psFile.NewPage(); - } - } - - // Chamber X efficiency - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_eff2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_eff2_end = muonGeom->chambers().end(); - for (; ch_eff2_it != ch_eff2_end; ++ch_eff2_it) { - DTChamberId ch = (*ch_eff2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str(); - string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/xEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - // Chamber Y efficiency - // Loop over all the chambers - vector::const_iterator ch_eff3_it = muonGeom->chambers().begin(); - vector::const_iterator ch_eff3_end = muonGeom->chambers().end(); - for (; ch_eff3_it != ch_eff3_end; ++ch_eff3_it) { - DTChamberId ch = (*ch_eff3_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str(); - string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/yEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - } - - // Test Pulses Summary Histos ************************************************************** - if(TestPulsesHistos){ - c1.Clear(); - c1.Divide(4,3); - // Loop over all the chambers - vector::const_iterator ch_TP_it = muonGeom->chambers().begin(); - vector::const_iterator ch_TP_end = muonGeom->chambers().end(); - for (; ch_TP_it != ch_TP_end; ++ch_TP_it) { - DTChamberId ch = (*ch_TP_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_TP_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_TP_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string testPulsesFolder = MainFolder + "DTTestPulsesTask/Wheel" + wheel.str(); - string histo_name = testPulsesFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/SuperLayer" + superLayer.str() + "/TPProfile/TestPulses2D_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); - TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found){ - c1.Update(); - psFile.NewPage(); - } - } - } - - // Trigger Summary Histos ************************************************************************ - if(TriggerHistos){ - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger_end = muonGeom->chambers().end(); - for (; ch_trigger_it != ch_trigger_end; ++ch_trigger_it) { - DTChamberId ch = (*ch_trigger_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerPhi/DDU_BXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - // Loop over all the chambers - vector::const_iterator ch_trigger2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger2_end = muonGeom->chambers().end(); - for (; ch_trigger2_it != ch_trigger2_end; ++ch_trigger2_it) { - DTChamberId ch = (*ch_trigger2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerTheta/DDU_ThetaBXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(1,2); - int counter1=0,counter2=0; - // Loop over all the chambers - vector::const_iterator ch_trigger3_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger3_end = muonGeom->chambers().end(); - for (; ch_trigger3_it != ch_trigger3_end; ++ch_trigger3_it) { - DTChamberId ch = (*ch_trigger3_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerPhi/CorrFraction_Phi_W" + wheel.str() + "_Sec" + sector.str(); - TH1F *Histo1 = (TH1F*) theFile -> Get(histo_Name.c_str()); - if(Histo1 && counter1==0){ - counter1++; - c1.cd(1); - Histo1->Draw(); - } - histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerTheta/HFraction_Theta_W" + wheel.str() + "_Sec" + sector.str(); - TH1F *Histo2 = (TH1F*) theFile -> Get(histo_Name.c_str()); - if(Histo2 && counter2==0){ - counter2++; - c1.cd(2); - Histo2->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger4_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger4_end = muonGeom->chambers().end(); - for (; ch_trigger4_it != ch_trigger4_end; ++ch_trigger4_it) { - DTChamberId ch = (*ch_trigger4_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - string histo_nameHHHL = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPosHHHL_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histoHHHL = (TH1F*) theFile -> Get(histo_nameHHHL.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->GetYaxis()->SetRangeUser(0,1.1); - histo->Draw(); - if(histoHHHL){ - histoHHHL->Draw("same"); - } - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger5_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger5_end = muonGeom->chambers().end(); - for (; ch_trigger5_it != ch_trigger5_end; ++ch_trigger5_it) { - DTChamberId ch = (*ch_trigger5_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->GetYaxis()->SetRangeUser(0,1.1); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger6_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger6_end = muonGeom->chambers().end(); - for (; ch_trigger6_it != ch_trigger6_end; ++ch_trigger6_it) { - DTChamberId ch = (*ch_trigger6_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->GetYaxis()->SetRangeUser(0,1.1); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger7_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger7_end = muonGeom->chambers().end(); - for (; ch_trigger7_it != ch_trigger7_end; ++ch_trigger7_it) { - DTChamberId ch = (*ch_trigger7_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - histo->GetYaxis()->SetRangeUser(0,1.1); - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - } - psFile.Close(); -} diff --git a/DQM/DTMonitorClient/src/DTDeadChannelTest.cc b/DQM/DTMonitorClient/src/DTDeadChannelTest.cc deleted file mode 100644 index ab4197228cd2c..0000000000000 --- a/DQM/DTMonitorClient/src/DTDeadChannelTest.cc +++ /dev/null @@ -1,226 +0,0 @@ - -/* - * See header file for a description of this class. - * - * \author G. Mila - INFN Torino - */ - - -#include - -// Framework -#include - - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - -#include -#include - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include -#include -#include - - -using namespace edm; -using namespace std; - - -DTDeadChannelTest::DTDeadChannelTest(const edm::ParameterSet& ps){ - - edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Constructor"; - - parameters = ps; - - prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 1); - nevents = 0; - -} - -DTDeadChannelTest::~DTDeadChannelTest(){ - - edm::LogVerbatim ("deadChannel") << "DTDeadChannelTest: analyzed " << nevents << " events"; - -} - -void DTDeadChannelTest::beginRun(Run const& run, EventSetup const& context) { - - edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: BeginRun"; - - // Get the geometry - context.get().get(muonGeom); - -} - - -void DTDeadChannelTest::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) { - - edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: Begin of LS transition"; - - // Get the run number - run = lumiSeg.run(); - -} - - -void DTDeadChannelTest::analyze(const edm::Event& e, const edm::EventSetup& context){ - - nevents++; - edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - - edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Occupancy tests results"; - - // Loop over the chambers - for (; ch_it != ch_end; ++ch_it) { - DTChamberId chID = (*ch_it)->id(); - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - - stringstream wheel; wheel << chID.wheel(); - stringstream station; station << chID.station(); - stringstream sector; sector << chID.sector(); - - context.get().get(tTrigMap); - - string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - - // Get the ME produced by DigiTask Source - MonitorElement * noise_histo = igetter.get(getMEName("OccupancyNoise_perCh", chID)); - MonitorElement * hitInTime_histo = igetter.get(getMEName("OccupancyInTimeHits_perCh", chID)); - - // ME -> TH2F - if(noise_histo && hitInTime_histo) { - TH2F * noise_histo_root = noise_histo->getTH2F(); - TH2F * hitInTime_histo_root = hitInTime_histo->getTH2F(); - - // Loop over the SuperLayers - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId slID = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - - // ttrig and rms are counts - float tTrig, tTrigRMS, kFactor; - tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts); - - // Loop over the layers - for(; l_it != l_end; ++l_it) { - DTLayerId lID = (*l_it)->id(); - - //Parameters to fill histos - stringstream superLayer; superLayer << slID.superlayer(); - stringstream layer; layer << lID.layer(); - string HistoNameTest = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() - + "_L" + layer.str(); - - const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel(); - const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel(); - - int entry=-1; - if(slID.superlayer() == 1) entry=0; - if(slID.superlayer() == 2) entry=4; - if(slID.superlayer() == 3) entry=8; - int YBinNumber = entry+lID.layer(); - - - // Loop over the TH2F bin and fill the ME to be used for the Quality Test - for(int bin=firstWire; bin <= lastWire; bin++) { - if (OccupancyDiffHistos.find(HistoNameTest) == OccupancyDiffHistos.end()) bookHistos(ibooker,lID, firstWire, lastWire); - // tMax default value - float tMax = 450.0; - - float difference = (hitInTime_histo_root->GetBinContent(bin, YBinNumber) / tMax) - - (noise_histo_root->GetBinContent(bin, YBinNumber) / tTrig); - OccupancyDiffHistos.find(HistoNameTest)->second->setBinContent(bin, difference); - } - } // loop on layers - } // loop on superlayers - } - } // loop on chambers - - // Occupancy Difference test - string OccupancyDiffCriterionName = parameters.getUntrackedParameter("OccupancyDiffTestName","OccupancyDiffInRange"); - for(map::const_iterator hOccDiff = OccupancyDiffHistos.begin(); - hOccDiff != OccupancyDiffHistos.end(); - hOccDiff++) { - const QReport * theOccupancyDiffQReport = (*hOccDiff).second->getQReport(OccupancyDiffCriterionName); - if(theOccupancyDiffQReport) { - vector badChannels = theOccupancyDiffQReport->getBadChannels(); - for (vector::iterator channel = badChannels.begin(); - channel != badChannels.end(); channel++) { - edm::LogError ("deadChannel") << "Layer : "<<(*hOccDiff).first<<" Bad occupancy difference channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents(); - } - } - } - -} - -string DTDeadChannelTest::getMEName(string histoTag, const DTChamberId & chId) { - - stringstream wheel; wheel << chId.wheel(); - stringstream station; station << chId.station(); - stringstream sector; sector << chId.sector(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderName = - folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + - "/Occupancies" + "/"; - - string histoname = folderName + histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str(); - - return histoname; - -} - - -void DTDeadChannelTest::bookHistos(DQMStore::IBooker & ibooker, const DTLayerId & lId, int firstWire, int lastWire) { - - stringstream wheel; wheel << lId.superlayerId().wheel(); - stringstream station; station << lId.superlayerId().station(); - stringstream sector; sector << lId.superlayerId().sector(); - stringstream superLayer; superLayer << lId.superlayerId().superlayer(); - stringstream layer; layer << lId.layer(); - - string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); - string OccupancyDiffHistoName = "OccupancyDiff_" + HistoName; - - ibooker.setCurrentFolder("DT/Tests/DTDeadChannel/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str()); - - OccupancyDiffHistos[HistoName] = ibooker.book1D(OccupancyDiffHistoName.c_str(),OccupancyDiffHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5); - -} diff --git a/DQM/DTMonitorClient/src/DTFineDelayCorr.cc b/DQM/DTMonitorClient/src/DTFineDelayCorr.cc deleted file mode 100644 index cb5c51982a044..0000000000000 --- a/DQM/DTMonitorClient/src/DTFineDelayCorr.cc +++ /dev/null @@ -1,203 +0,0 @@ -/* - * See header file for a description of this class. - * - * \author M. Giunta, C. Battilana - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - */ - - -// This class header -#include "DQM/DTMonitorClient/src/DTFineDelayCorr.h" - -// Framework headers -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "DQMServices/Core/interface/DQMStore.h" - -// L1Trigger -#include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTrigUnit.h" - -// Geometry -#include "DQM/DTMonitorModule/interface/DTTrigGeomUtils.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" - -// DB & Calib -#include "CalibMuon/DTCalibration/interface/DTCalibDBUtils.h" - -// Root -#include "TF1.h" -#include "TProfile.h" - - -//C++ headers -using namespace edm; -using namespace std; -#include -#include -#include -#include -#include -#include - -DTFineDelayCorr::DTFineDelayCorr(const ParameterSet& ps) { - - setConfig(ps,"DTFineDelayCorr"); // sets parameter values and name used in log file - baseFolderDCC = "DT/90-LocalTriggerSynch/"; - baseFolderDDU = "DT/90-LocalTriggerSynch/"; - -} - - -DTFineDelayCorr::~DTFineDelayCorr(){ - -} - -void DTFineDelayCorr::beginRun(edm::Run const & run, edm::EventSetup const & evSU) { - - // Tag for Hardware Source (DDU or DCC) - hwSource = parameters.getParameter("hwSource"); - // Tag for the t0Mean Histograms - t0MeanHistoTag = parameters.getParameter("t0MeanHistoTag"); - // Read old delays from file or from Db - readOldFromDb = parameters.getParameter("readOldFromDb"); - // Input file name for old delays - oldDelaysInputFile = parameters.getParameter("oldDelaysInputFile"), - // Write new delays to file or to Db - writeDB = parameters.getParameter("writeDB"); - // Output File Name - outputFileName = parameters.getParameter("outputFile"); - // Choose to use Hist Mean or Gaussian Fit Mean - gaussMean = parameters.getParameter("gaussMean"); - // Require Minimum Number Of Entries in the t0Mean Histogram - minEntries = parameters.getUntrackedParameter("minEntries",5); - - DTLocalTriggerBaseTest::beginRun(run,evSU); - evSU.get< DTConfigManagerRcd >().get(dtConfig); - evSU.get< DTTPGParametersRcd >().get(worstPhaseMap); - -} - -void DTFineDelayCorr::runClientDiagnostic(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - int coarseDelay = -999; - float oldFineDelay = -999; - if(!readOldFromDb) { // read old delays from txt file - // ** Open and read old delays input file ** - ifstream oldDelaysFile(oldDelaysInputFile.c_str()); - string line; - - while (getline(oldDelaysFile, line)) { - if( line == "" || line[0] == '#' ) continue; - stringstream linestr; - int wheelKey,sectorKey, stationKey; - linestr << line; - - linestr >> wheelKey - >> sectorKey - >> stationKey - >> coarseDelay - >> oldFineDelay; - - pair oldDelays = make_pair(coarseDelay,oldFineDelay); - DTChamberId oldDelayKey = DTChamberId(wheelKey,stationKey,sectorKey); - oldDelayMap.insert(make_pair(oldDelayKey,oldDelays)); - } - } - - // ** Loop over the chambers ** - vector::const_iterator chambIt = muonGeom->chambers().begin(); - vector::const_iterator chambEnd = muonGeom->chambers().end(); - for (; chambIt!=chambEnd; ++chambIt) { - DTChamberId chId = (*chambIt)->id(); - uint32_t indexCh = chId.rawId(); - int wheel = chId.wheel(); - int sector = chId.sector(); - int station = chId.station(); - - // ** Compute corrected values and write them to file or database ** - vector newDelays; - - // ** Retrieve Delays Loaded in MiniCrates ** - if(readOldFromDb) { // read from db - const DTConfigPedestals *pedestals = dtConfig->getDTConfigPedestals(); - const DTLayer *layer = muonGeom->layer(DTLayerId(chId,1,1)); - float delay = pedestals->getOffset(DTWireId(layer->id(),layer->specificTopology().firstChannel())); - coarseDelay = int(delay/25.); - oldFineDelay = delay - coarseDelay * 25.; - } - else { // read from map created from txt file - coarseDelay = oldDelayMap[chId].first; - oldFineDelay = oldDelayMap[chId].second; - } - - // ** Retrieve t0Mean histograms ** - TH1F *t0H = getHisto(igetter.get(getMEName(t0MeanHistoTag,"", chId))); - float newFineDelay = -999; // initialize to dummy number - cout <<"MG: " << getMEName(t0MeanHistoTag,"", chId) << " entries: " << t0H->GetEntries() << endl; - if (t0H->GetEntries() > minEntries) { - Double_t mean; - // ** Find Mean Value of the distribution ** - if(gaussMean) { - TF1 *funct = t0H->GetFunction("gaus"); - mean = funct->GetParameter(1); - } - else { - mean = t0H->GetMean(); - } - - // ** Retrieve Worst Phase values ** - int wpCoarseDelay; - float wpFineDelay; - worstPhaseMap->get(chId, wpCoarseDelay, wpFineDelay, DTTimeUnits::ns); -// cout << "wpFineDelay, oldFineDelay, mean: " << wpFineDelay << " " -// << oldFineDelay << " " << mean << endl; - float bpFineDelay = (wpFineDelay < 12.5)? (wpFineDelay + 12.5) : (wpFineDelay - 12.5); // Best Phase: half BX far from the worst phase - // ** Calculate correction ** - float diffFineDelays = oldFineDelay + (mean - bpFineDelay); // positive mean shift implies positive delay correction - int bxDiff = (int) (diffFineDelays / 25); - coarseDelay += bxDiff; - newFineDelay = fmodf(diffFineDelays, 25); -// cout << "diffFineDelays, newFineDelay, bxDiff, coarseDelay: " << diffFineDelays -// << " "<< newFineDelay << " " << bxDiff << " " << coarseDelay << endl; - } - else { - LogProblem(category()) << "[" << testName << "Test]: Not enough entries in hist for Chamber " - << indexCh << endl; - } - - newDelays.push_back(wheel); - newDelays.push_back(sector); - newDelays.push_back(station); - newDelays.push_back(coarseDelay); - newDelays.push_back(newFineDelay); - pair< DTChamberId, vector > chDelays; - chDelays.first = chId; - chDelays.second = newDelays; - delayMap.insert(chDelays); - } -} - -void DTFineDelayCorr::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter){ - - DTLocalTriggerBaseTest::dqmEndJob( ibooker,igetter); - - if (writeDB) { - // to be added if needed - } - else { // write txt file - // ** Open output file ** - ofstream outFile(outputFileName.c_str()); - for(map< DTChamberId, vector >::const_iterator iter = delayMap.begin(); - iter != delayMap.end() ; iter++) { - // writing - ostream_iterator oit(outFile, " "); - copy((*iter).second.begin(), (*iter).second.end(), oit); - outFile << endl; - } - outFile.close(); - } -} diff --git a/DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.cc b/DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.cc deleted file mode 100644 index 5a5c67a8cdb9f..0000000000000 --- a/DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.cc +++ /dev/null @@ -1,287 +0,0 @@ -/* - * See header file for a description of this class. - * - * \author C. Battilana - CIEMAT - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - */ - - -// This class header -#include "DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.h" - -// Framework headers -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "DQMServices/Core/interface/DQMStore.h" - -// Geometry -#include "DQM/DTMonitorModule/interface/DTTrigGeomUtils.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" - -// DB & Calib -#include "CalibMuon/DTCalibration/interface/DTCalibDBUtils.h" -#include "CondFormats/DataRecord/interface/DTTPGParametersRcd.h" -#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" -#include "CondFormats/DTObjects/interface/DTStatusFlag.h" - - -// Root -#include "TF1.h" -#include "TProfile.h" - - -//C++ headers -#include -#include - -using namespace edm; -using namespace std; - - -DTLocalTriggerSynchTest::DTLocalTriggerSynchTest(const edm::ParameterSet& ps) { - - setConfig(ps,"DTLocalTriggerSynch"); - baseFolderDCC = "DT/90-LocalTriggerSynch/"; - baseFolderDDU = "DT/90-LocalTriggerSynch/"; - - bookingdone = 0; - -} - - -DTLocalTriggerSynchTest::~DTLocalTriggerSynchTest(){ - -} - - -void DTLocalTriggerSynchTest::beginRun(edm::Run const & run, edm::EventSetup const & c) { - - numHistoTag = parameters.getParameter("numHistoTag"); - denHistoTag = parameters.getParameter("denHistoTag"); - ratioHistoTag = parameters.getParameter("ratioHistoTag"); - bxTime = parameters.getParameter("bxTimeInterval"); - rangeInBX = parameters.getParameter("rangeWithinBX"); - nBXLow = parameters.getParameter("nBXLow"); - nBXHigh = parameters.getParameter("nBXHigh"); - minEntries = parameters.getParameter("minEntries"); - - DTLocalTriggerBaseTest::beginRun(run,c); -} - - -void DTLocalTriggerSynchTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, - edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & c) { - - if (bookingdone) return; - - vector::const_iterator iTr = trigSources.begin(); - vector::const_iterator trEnd = trigSources.end(); - vector::const_iterator iHw = hwSources.begin(); - vector::const_iterator hwEnd = hwSources.end(); - - //Booking - if(parameters.getUntrackedParameter("staticBooking", true)){ - for (; iTr != trEnd; ++iTr){ - trigSource = (*iTr); - for (; iHw != hwEnd; ++iHw){ - hwSource = (*iHw); - std::vector::const_iterator chambIt = muonGeom->chambers().begin(); - std::vector::const_iterator chambEnd = muonGeom->chambers().end(); - for (; chambIt!=chambEnd; ++chambIt) { - DTChamberId chId = ((*chambIt)->id()); - bookChambHistos(ibooker,chId,ratioHistoTag); - } - } - } - } - - LogVerbatim(category()) << "[" << testName << "Test]: book Histograms" << endl; - - if (parameters.getParameter("fineParamDiff")) { - ESHandle wPhaseHandle; - c.get().get(wPhaseHandle); - wPhaseMap = (*wPhaseHandle); - } - - bookingdone = 1; - -} - - -void DTLocalTriggerSynchTest::runClientDiagnostic(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - - // Loop over Trig & Hw sources - for (vector::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){ - trigSource = (*iTr); - for (vector::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){ - hwSource = (*iHw); - std::vector::const_iterator chambIt = muonGeom->chambers().begin(); - std::vector::const_iterator chambEnd = muonGeom->chambers().end(); - for (; chambIt!=chambEnd; ++chambIt) { - DTChamberId chId = (*chambIt)->id(); - uint32_t indexCh = chId.rawId(); - - // Perform peak finding - - TH1F *numH = getHisto(igetter.get(getMEName(numHistoTag,"", chId))); - TH1F *denH = getHisto(igetter.get(getMEName(denHistoTag,"", chId))); - - if (numH && denH && numH->GetEntries()>minEntries && denH->GetEntries()>minEntries) { - std::map innerME = chambME[indexCh]; - MonitorElement* ratioH = innerME.find(fullName(ratioHistoTag))->second; - makeRatioME(numH,denH,ratioH); - try { - //Need our own copy to avoid threading problems - TF1 mypol8("mypol8","pol8"); - getHisto(ratioH)->Fit(&mypol8,"CQO"); - } catch (cms::Exception& iException) { - edm::LogPrint(category()) << "[" << testName - << "Test]: Error fitting " - << ratioH->getName() << " returned 0" << endl; - } - } else { - if (!numH || !denH) { - LogPrint(category()) << "[" << testName - << "Test]: At least one of the required Histograms was not found for chamber " - << chId << ". Peaks not computed" << endl; - } else { - LogPrint(category()) << "[" << testName - << "Test]: Number of plots entries for " - << chId << " is less than minEntries=" - << minEntries <<". Peaks not computed" << endl; - } - } - - } - } - } - -} - -void DTLocalTriggerSynchTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter){ - - DTLocalTriggerBaseTest::dqmEndJob(ibooker,igetter); - - if ( parameters.getParameter("writeDB")) { - LogVerbatim(category()) << "[" << testName - << "Test]: writeDB flag set to true. Producing peak position database." << endl; - - DTTPGParameters* delayMap = new DTTPGParameters(); - hwSource = parameters.getParameter("dbFromDCC") ? "DCC" : "DDU"; - std::vector::const_iterator chambIt = muonGeom->chambers().begin(); - std::vector::const_iterator chambEnd = muonGeom->chambers().end(); - for (; chambIt!=chambEnd; ++chambIt) { - - DTChamberId chId = (*chambIt)->id(); - float fineDelay = 0; - int coarseDelay = static_cast((getFloatFromME(igetter,chId,"tTrig_SL1") + - getFloatFromME(igetter,chId,"tTrig_SL3"))*0.5/bxTime); - - bool fineDiff = parameters.getParameter("fineParamDiff"); - bool coarseDiff = parameters.getParameter("coarseParamDiff"); - - TH1F *ratioH = getHisto(igetter.get(getMEName(ratioHistoTag,"", chId))); - if (ratioH->GetEntries()>minEntries) { - TF1 *fitF=ratioH->GetFunction("mypol8"); - if (fitF) { fineDelay=fitF->GetMaximumX(0,bxTime); } - } else { - LogInfo(category()) << "[" << testName - << "Test]: Ratio histogram for chamber " << chId - << " is empty. Worst Phase value set to 0." << endl; - } - - if (fineDiff || coarseDiff) { - float wFine; - int wCoarse; - wPhaseMap.get(chId,wCoarse,wFine,DTTimeUnits::ns); - if (fineDiff) { fineDelay = wFine - fineDelay; } - if (coarseDiff) { coarseDelay = wCoarse - coarseDelay; } - } - delayMap->set(chId,coarseDelay,fineDelay,DTTimeUnits::ns); - } - - std::vector< std::pair >::const_iterator dbIt = delayMap->begin(); - std::vector< std::pair >::const_iterator dbEnd = delayMap->end(); - for (; dbIt!=dbEnd; ++dbIt) { - LogVerbatim(category()) << "[" << testName << "Test]: DB entry for Wh " << (*dbIt).first.wheelId - << " Sec " << (*dbIt).first.sectorId - << " St " << (*dbIt).first.stationId - << " has coarse " << (*dbIt).second.nClock - << " and phase " << (*dbIt).second.tPhase << std::endl; - } - - string delayRecord = "DTTPGParametersRcd"; - DTCalibDBUtils::writeToDB(delayRecord,delayMap); - - } - -} - - - -void DTLocalTriggerSynchTest::makeRatioME(TH1F* numerator, TH1F* denominator, MonitorElement* result){ - - TH1F* efficiency = result->getTH1F(); - efficiency->Divide(numerator,denominator,1,1,""); - -} - -float DTLocalTriggerSynchTest::getFloatFromME(DQMStore::IGetter & igetter, - DTChamberId chId, std::string meType) { - - stringstream wheel; wheel << chId.wheel(); - stringstream station; station << chId.station(); - stringstream sector; sector << chId.sector(); - - string folderName = topFolder(hwSource=="DCC") + "Wheel" + wheel.str() + - "/Sector" + sector.str() + "/Station" + station.str() + "/" ; - - string histoname = sourceFolder + folderName - + meType - + "_W" + wheel.str() - + "_Sec" + sector.str() - + "_St" + station.str(); - - MonitorElement* me = igetter.get(histoname); - if (me) { - return me->getFloatValue(); - } - else { - LogProblem(category()) << "[" << testName << "Test]: " << histoname << " is not a valid ME. 0 returned" << std::endl; - } - - return 0; - - } - -void DTLocalTriggerSynchTest::bookChambHistos(DQMStore::IBooker & ibooker, - DTChamberId chambId, string htype, string subfolder) { - - stringstream wheel; wheel << chambId.wheel(); - stringstream station; station << chambId.station(); - stringstream sector; sector << chambId.sector(); - - string fullType = fullName(htype); - bool isDCC = hwSource=="DCC" ; - string HistoName = fullType + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - - string folder = topFolder(isDCC) + "Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str(); - if ( subfolder!="") { folder += "7" + subfolder; } - - ibooker.setCurrentFolder(folder); - - LogPrint(category()) << "[" << testName << "Test]: booking " << folder << "/" <(ceil( rangeInBX ? bxTime : (nBXHigh-nBXLow)*bxTime)); - - chambME[indexChId][fullType] = ibooker.book1D(HistoName.c_str(),"All/HH ratio vs Muon Arrival Time",nbins,min,max); - -} diff --git a/DQM/DTMonitorClient/src/DTNoiseTest.cc b/DQM/DTMonitorClient/src/DTNoiseTest.cc deleted file mode 100644 index 54bc9135e9a2f..0000000000000 --- a/DQM/DTMonitorClient/src/DTNoiseTest.cc +++ /dev/null @@ -1,314 +0,0 @@ -/* - * - * \authors: - * A. Gresele - INFN Trento - * G. Mila - INFN Torino - * M. Zanetti - CERN PH - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - */ - -#include "DQM/DTMonitorClient/src/DTNoiseTest.h" - -// Framework -#include - - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include -#include -#include - -using namespace edm; -using namespace std; - - - -DTNoiseTest::DTNoiseTest(const edm::ParameterSet& ps){ - - edm::LogVerbatim ("noise") <<"[DTNoiseTest]: Constructor"; - - parameters = ps; - - prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 1); - - bookingdone = 0; - -} - - - -DTNoiseTest::~DTNoiseTest(){ - - edm::LogVerbatim ("noise") <<"DTNoiseTest: analyzed " << updates << " events"; - -} - - void DTNoiseTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, - edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) { - - if (!bookingdone) { - ibooker.setCurrentFolder("DT/Tests/Noise"); - updates = 0; - // Get the geometry - context.get().get(muonGeom); - } - bookingdone = 1; - - edm::LogVerbatim ("noise") <<"[DTNoiseTest]: End of LS transition, performing the DQM client operation"; - - // counts number of lumiSegs - nLumiSegs = lumiSeg.id().luminosityBlock(); - - // prescale factor - if ( nLumiSegs%prescaleFactor != 0 ) return; - - edm::LogVerbatim ("noise") <<"[DTNoiseTest]: "< statusMap; - context.get().get(statusMap); - - context.get().get(tTrigMap); - float tTrig, tTrigRMS, kFactor; - - string histoTag; - // loop over chambers - vector::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - - for (; ch_it != ch_end; ++ch_it) { - DTChamberId ch = (*ch_it)->id(); - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - - MonitorElement * noiseME = igetter.get(getMEName(ch)); - if (noiseME) { - TH2F * noiseHisto = noiseME->getTH2F(); - - // WARNING uncorrect normalization!! TO BE PROVIDED CENTRALLY - double nevents = (int) noiseHisto->GetEntries(); - - double normalization =0; - - float average=0; - float nOfChannels=0; - float noiseStatistics=0; - int newNoiseChannels=0; - - for(; sl_it != sl_end; ++sl_it) { - const DTSuperLayerId & slID = (*sl_it)->id(); - - // ttrig and rms are counts - tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts); - if (tTrig==0) tTrig=1; - const double ns_s = 1e9*(32/25); - normalization = ns_s/float(tTrig*nevents); - - noiseHisto->Scale(normalization); - - // loop over layers - - for (int binY=(slID.superLayer()-1)*4+1 ; binY <= (slID.superLayer()-1)*4+4; binY++) { - - int Y = binY - 4*(slID.superLayer()-1); - - // the layer - - const DTLayerId theLayer(slID,Y); - - // loop over channels - for (int binX=1; binX <= noiseHisto->GetNbinsX(); binX++) { - - if (noiseHisto->GetBinContent(binX,binY) > parameters.getUntrackedParameter("HzThreshold", 300)) - theNoisyChannels.push_back(DTWireId(theLayer, binX)); - - // get rid of the dead channels - else { - average += noiseHisto->GetBinContent(binX,binY); - nOfChannels++; - } - } - } - - if (nOfChannels) noiseStatistics = average/nOfChannels; - histoTag = "NoiseAverage"; - - if (histos[histoTag].find((*ch_it)->id().rawId()) == histos[histoTag].end()) bookHistos(ibooker,(*ch_it)->id(),string("NoiseAverage"), histoTag ); - histos[histoTag].find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(),noiseStatistics); - - for ( vector::const_iterator nb_it = theNoisyChannels.begin(); - nb_it != theNoisyChannels.end(); ++nb_it) { - - bool isNoisy = false; - bool isFEMasked = false; - bool isTDCMasked = false; - bool isTrigMask = false; - bool isDead = false; - bool isNohv = false; - statusMap->cellStatus((*nb_it), isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv); - - if (!isNoisy) newNoiseChannels++; - } - theNoisyChannels.clear(); - histoTag = "NewNoisyChannels"; - - if (histos[histoTag].find((*ch_it)->id().rawId()) == histos[histoTag].end()) - bookHistos(ibooker,(*ch_it)->id(),string("NewNoisyChannels"), histoTag ); - histos[histoTag].find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(), newNoiseChannels); - } - } - //To compute the Noise Mean test - vector::const_iterator sl2_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl2_end = (*ch_it)->superLayers().end(); - for(; sl2_it != sl2_end; ++sl2_it) { - vector::const_iterator l_it = (*sl2_it)->layers().begin(); - vector::const_iterator l_end = (*sl2_it)->layers().end(); - for(; l_it != l_end; ++l_it) { - - DTLayerId lID = (*l_it)->id(); - MonitorElement * noisePerEventME = igetter.get(getMEName(lID)); - - if (noisePerEventME) { - TH2F * noiseHistoPerEvent = noisePerEventME->getTH2F(); - int nWires = muonGeom->layer(lID)->specificTopology().channels(); - double MeanNumerator=0, MeanDenominator=0; - histoTag = "MeanDigiPerEvent"; - for (int w=1; w<=nWires; w++){ - for(int numDigi=1; numDigi<=10; numDigi++){ - MeanNumerator+=(noiseHistoPerEvent->GetBinContent(w,numDigi)*(numDigi-1)); - MeanDenominator+=noiseHistoPerEvent->GetBinContent(w,numDigi); - } - double Mean=MeanNumerator/MeanDenominator; - if (histos[histoTag].find((*l_it)->id().rawId()) == histos[histoTag].end()) bookHistos(ibooker,(*l_it)->id(),nWires, string("MeanDigiPerEvent"), histoTag ); - histos[histoTag].find((*l_it)->id().rawId())->second->setBinContent(w, Mean); - } - } - } - } - } - - // Noise Mean test - histoTag = "MeanDigiPerEvent"; - string MeanCriterionName = parameters.getUntrackedParameter("meanTestName","NoiseMeanInRange"); - for(map::const_iterator hMean = histos[histoTag].begin(); - hMean != histos[histoTag].end(); - hMean++) { - const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName); - if(theMeanQReport) { - vector badChannels = theMeanQReport->getBadChannels(); - for (vector::iterator channel = badChannels.begin(); - channel != badChannels.end(); channel++) { - LogVerbatim ("tTrigCalibration")<<"LayerId : "<<(*hMean).first<<" Bad mean channels: " - <<(*channel).getBin()<<" Contents : "<<(*channel).getContents(); - } - } - } - -} - -void DTNoiseTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - - edm::LogVerbatim ("noise") <<"[DTNoiseTest] endjob called!"; -} - - -string DTNoiseTest::getMEName(const DTChamberId & ch) { - - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderTag = parameters.getUntrackedParameter("folderTag", "Occupancies"); - string folderName = - folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/" + folderTag + "/"; - - string histoTag = parameters.getUntrackedParameter("histoTag", "OccupancyNoise_perCh"); - string histoname = folderName + histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str(); - - - return histoname; - -} - -string DTNoiseTest::getMEName(const DTLayerId & ly) { - - stringstream wheel; wheel << ly.wheel(); - stringstream station; station << ly.station(); - stringstream sector; sector << ly.sector(); - stringstream superLayer; superLayer << ly.superlayer(); - stringstream layer; layer << ly.layer(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderTag = parameters.getUntrackedParameter("folderTagForDigiPerEventTest", "DigiPerEvent"); - string folderName = - folderRoot + "DT/DTDigiForNoiseTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/" + folderTag + "/"; - - string histoTag = parameters.getUntrackedParameter("histoTagForDigiPerEventTest", "DigiPerEvent"); - string histoname = folderName + histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str() - + "_L" + layer.str(); - - - return histoname; - -} - -void DTNoiseTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch, string folder, string histoTag ) { - - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - ibooker.setCurrentFolder("DT/Tests/Noise/" + folder); - - string histoName = histoTag + "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - - if (folder == "NoiseAverage") - (histos[histoTag])[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,3); - - if ( folder == "NewNoisyChannels") - (histos[histoTag])[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,3); - -} - -void DTNoiseTest::bookHistos(DQMStore::IBooker & ibooker, const DTLayerId & lId, int nWires, string folder, string histoTag) { - - stringstream wheel; wheel << lId.superlayerId().wheel(); - stringstream station; station << lId.superlayerId().station(); - stringstream sector; sector << lId.superlayerId().sector(); - stringstream superLayer; superLayer << lId.superlayerId().superlayer(); - stringstream layer; layer << lId.layer(); - - string histoName = histoTag + "_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() - + "_SL" + superLayer.str() + "_L" + layer.str(); - - ibooker.setCurrentFolder("DT/Tests/Noise/" + folder + - "/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str()); - - (histos[histoTag])[lId.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),nWires,0,nWires); -} diff --git a/DQM/DTMonitorClient/src/DTResolutionTest.cc b/DQM/DTMonitorClient/src/DTResolutionTest.cc deleted file mode 100644 index 74ed5b760268a..0000000000000 --- a/DQM/DTMonitorClient/src/DTResolutionTest.cc +++ /dev/null @@ -1,782 +0,0 @@ - - -/* - * See header file for a description of this class. - * - * \author G. Mila - INFN Torino - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - */ - - -#include - -// Framework -#include -#include "DataFormats/Common/interface/Handle.h" -#include -#include -#include - - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTChamber.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" - - - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include -#include -#include -#include -#include -#include "TF1.h" - - -using namespace edm; -using namespace std; - - -DTResolutionTest::DTResolutionTest(const edm::ParameterSet& ps){ - - edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Constructor"; - parameters = ps; - -//FR: no idea if this input file needs to be used! comment it for now -//- if(ps.getUntrackedParameter("readFile", false)) -//- dbe->open(ps.getUntrackedParameter("inputFile", "residuals.root")); - - prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 1); - - percentual = parameters.getUntrackedParameter("BadSLpercentual", 10); - - nevents = 0; - - bookingdone = 0; - -} - - -DTResolutionTest::~DTResolutionTest(){ - - edm::LogVerbatim ("resolution") << "DTResolutionTest: analyzed " << nevents << " events"; - -} - - void DTResolutionTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, - edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) { - - // counts number of updates (online mode) or number of events (standalone mode) - //nevents++; - // if running in standalone perform diagnostic only after a reasonalbe amount of events - //if ( parameters.getUntrackedParameter("runningStandalone", false) && - // nevents%parameters.getUntrackedParameter("diagnosticPrescale", 1000) != 0 ) return; - //edm::LogVerbatim ("resolution") << "[DTResolutionTest]: "<().get(muonGeom); - - // book the histos - for(int wheel=-2; wheel<3; wheel++){ - - bookHistos(ibooker,wheel); - } - vector chambers = muonGeom->chambers(); - for(vector::const_iterator chamber = chambers.begin(); - chamber != chambers.end(); ++chamber) { - bookHistos(ibooker,(*chamber)->id()); - } - - } - bookingdone = 1; - - - edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: End of LS transition, performing the DQM client operation"; - - // counts number of lumiSegs - nLumiSegs = lumiSeg.id().luminosityBlock(); - - // prescale factor - if ( nLumiSegs%prescaleFactor != 0 ) return; - - for(map ::const_iterator histo = wheelMeanHistos.begin(); - histo != wheelMeanHistos.end(); - histo++) { - (*histo).second->Reset(); - } - if(parameters.getUntrackedParameter("sigmaTest")){ - for(map ::const_iterator histo = wheelSigmaHistos.begin(); - histo != wheelSigmaHistos.end(); - histo++) { - (*histo).second->Reset(); - } - } - if(parameters.getUntrackedParameter("slopeTest")){ - for(map ::const_iterator histo = wheelSlopeHistos.begin(); - histo != wheelSlopeHistos.end(); - histo++) { - (*histo).second->Reset(); - } - } - - cmsMeanHistos.clear(); - for(int i=-2; i<3; i++){ - for(int j=1; j<15; j++){ - MeanFilled[make_pair(i,j)]=false; - } - } - if(parameters.getUntrackedParameter("sigmaTest")){ - cmsSigmaHistos.clear(); - for(int i=-2; i<3; i++){ - for(int j=1; j<15; j++){ - SigmaFilled[make_pair(i,j)]=false; - } - } - } - if(parameters.getUntrackedParameter("slopeTest")){ - cmsSlopeHistos.clear(); - for(int i=-2; i<3; i++){ - for(int j=1; j<15; j++){ - SlopeFilled[make_pair(i,j)]=false; - } - } - } - - - // summary histos initialization - for(int wh=-2; wh<=3; wh++){ - if(wh!=3){ - for(int xBin=0; xBin<14; xBin++){ - for(int yBin=0; yBin<11; yBin++){ - wheelMeanHistos[wh]->setBinContent(xBin,yBin,0); - if(parameters.getUntrackedParameter("sigmaTest")) - wheelSigmaHistos[wh]->setBinContent(xBin,yBin,0); - if(parameters.getUntrackedParameter("slopeTest")) - wheelSlopeHistos[wh]->setBinContent(xBin,yBin,0); - } - } - } - else{ - for(int xBin=0; xBin<14; xBin++){ - for(int yBin=-2; yBin<3; yBin++){ - wheelMeanHistos[wh]->setBinContent(xBin,yBin,0); - if(parameters.getUntrackedParameter("sigmaTest")) - wheelSigmaHistos[wh]->setBinContent(xBin,yBin,0); - if(parameters.getUntrackedParameter("slopeTest")) - wheelSlopeHistos[wh]->setBinContent(xBin,yBin,0); - } - } - } - } - - - edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: "<::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - - edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Residual Distribution tests results"; - - for (; ch_it != ch_end; ++ch_it) { - - DTChamberId chID = (*ch_it)->id(); - - // Fill the test histos - int entry=-1; - if(chID.station() == 1) entry=0; - if(chID.station() == 2) entry=3; - if(chID.station() == 3) entry=6; - if(chID.station() == 4) entry=9; - - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - - for(; sl_it != sl_end; ++sl_it) { - - DTSuperLayerId slID = (*sl_it)->id(); - - edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Superlayer: " << slID; - - stringstream wheel; wheel << slID.wheel(); - stringstream station; station << slID.station(); - stringstream sector; sector << slID.sector(); - stringstream superLayer; superLayer << slID.superlayer(); - - string HistoName = "W" + wheel.str() + "_Sec" + sector.str(); - string supLayer = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str(); - - MonitorElement * res_histo = igetter.get(getMEName(slID)); - if (res_histo) { - // gaussian test - string GaussianCriterionName = - parameters.getUntrackedParameter("resDistributionTestName", - "ResidualsDistributionGaussianTest"); - const QReport * GaussianReport = res_histo->getQReport(GaussianCriterionName); - if(GaussianReport){ - // FIXE ME: if the quality test fails this cout returns a null pointer - //edm::LogWarning ("resolution") << "-------- SuperLayer : "<getMessage()<<" ------- "<getStatus(); - } - int BinNumber = entry+slID.superLayer(); - if(BinNumber == 12) BinNumber=11; - float mean = (*res_histo).getMean(1); - float sigma = (*res_histo).getRMS(1); - MeanHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, mean); - if(parameters.getUntrackedParameter("sigmaTest")) - SigmaHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, sigma); - } - - if(parameters.getUntrackedParameter("slopeTest")){ - - MonitorElement * res_histo_2D = igetter.get(getMEName2D(slID)); - if (res_histo_2D) { - TH2F * res_histo_2D_root = res_histo_2D->getTH2F(); - int BinNumber = entry+slID.superLayer(); - if(BinNumber == 12) BinNumber=11; - TProfile* prof = res_histo_2D_root->ProfileX(); - prof->GetXaxis()->SetRangeUser(0,2); - //prof->Fit("pol1","Q0"); - //need our own copy to avoid threading problems - TF1 fitting("mypol1","pol1"); - try { - prof->Fit(&fitting,"Q0"); - } catch (cms::Exception& iException) { - edm::LogError ("resolution") << "[DTResolutionTest]: Exception when fitting..." - << "SuperLayer : " << slID << "\n" - << " STEP : " << parameters.getUntrackedParameter("STEP", "STEP3") << "\n" - << "Filling slope histogram with standard value -99. for bin " << BinNumber; - SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, -99.); - continue; - } - double slope = fitting.GetParameter(1); - SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, slope); - } - } - - } - } - - // Mean test - string MeanCriterionName = parameters.getUntrackedParameter("meanTestName","ResidualsMeanInRange"); - for(map, MonitorElement*>::const_iterator hMean = MeanHistos.begin(); - hMean != MeanHistos.end(); - hMean++) { - const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName); - stringstream wheel; wheel << (*hMean).first.first; - stringstream sector; sector << (*hMean).first.second; - // Report the channels failing the test on the mean - if(theMeanQReport) { - vector badChannels = theMeanQReport->getBadChannels(); - for (vector::iterator channel = badChannels.begin(); - channel != badChannels.end(); channel++) { - edm::LogError("resolution") << "Bad mean channel: wh: " << wheel.str() - << " st: " << stationFromBin((*channel).getBin()) - << " sect: " <("meanWrongHisto")){ - MeanHistosSetRange.find(HistoName)->second->Fill((*channel).getBin()); - MeanHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents()); - } - // fill the wheel summary histos if the SL has not passed the test - if(abs((*channel).getContents())("meanMaxLimit")) - wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,1); - else - wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,2); - // fill the cms summary histo if the percentual of SL which have not passed the test - // is more than a predefined treshold - if(abs((*channel).getContents())>parameters.getUntrackedParameter("meanMaxLimit")){ - cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)]++; - if(((*hMean).first.second<13 && - double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/11>double(percentual)/100 && - MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false) || - ((*hMean).first.first>=13 && - double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/2>double(percentual)/100 && - MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false)){ - MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]=true; - wheelMeanHistos[3]->Fill(((*hMean).first.second)-1,(*hMean).first.first); - } - } - } - } - } - - // Sigma test - if(parameters.getUntrackedParameter("sigmaTest")){ - string SigmaCriterionName = parameters.getUntrackedParameter("sigmaTestName","ResidualsSigmaInRange"); - for(map, MonitorElement*>::const_iterator hSigma = SigmaHistos.begin(); - hSigma != SigmaHistos.end(); - hSigma++) { - const QReport * theSigmaQReport = (*hSigma).second->getQReport(SigmaCriterionName); - stringstream wheel; wheel << (*hSigma).first.first; - stringstream sector; sector << (*hSigma).first.second; - if(theSigmaQReport) { - vector badChannels = theSigmaQReport->getBadChannels(); - for (vector::iterator channel = badChannels.begin(); - channel != badChannels.end(); channel++) { - edm::LogError("resolution") << "Bad sigma: wh: " << wheel.str() - << " st: " << stationFromBin((*channel).getBin()) - << " sect: " <second->Fill((*channel).getBin()); - SigmaHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents()); - // fill the wheel summary histos if the SL has not passed the test - wheelSigmaHistos[(*hSigma).first.first]->Fill(((*hSigma).first.second)-1,(*channel).getBin()-1); - // fill the cms summary histo if the percentual of SL which have not passed the test - // is more than a predefined treshold - cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)]++; - if(((*hSigma).first.second<13 && - double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/11>double(percentual)/100 && - SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false) || - ((*hSigma).first.first>=13 && - double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/2>double(percentual)/100 && - SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false)){ - SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]=true; - wheelSigmaHistos[3]->Fill((*hSigma).first.second-1,(*hSigma).first.first); - } - } - } - } - } - - // Slope test - if(parameters.getUntrackedParameter("slopeTest")){ - string SlopeCriterionName = parameters.getUntrackedParameter("slopeTestName","ResidualsSlopeInRange"); - for(map, MonitorElement*>::const_iterator hSlope = SlopeHistos.begin(); - hSlope != SlopeHistos.end(); - hSlope++) { - const QReport * theSlopeQReport = (*hSlope).second->getQReport(SlopeCriterionName); - stringstream wheel; wheel << (*hSlope).first.first; - stringstream sector; sector << (*hSlope).first.second; - if(theSlopeQReport) { - vector badChannels = theSlopeQReport->getBadChannels(); - for (vector::iterator channel = badChannels.begin(); - channel != badChannels.end(); channel++) { - edm::LogError("resolution") << "Bad slope: wh: " << wheel.str() - << " st: " << stationFromBin((*channel).getBin()) - << " sect: " <second->Fill((*channel).getBin()); - SlopeHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents()); - // fill the wheel summary histos if the SL has not passed the test - wheelSlopeHistos[(*hSlope).first.first]->Fill(((*hSlope).first.second)-1,(*channel).getBin()-1); - // fill the cms summary histo if the percentual of SL which have not passed the test - // is more than a predefined treshold - cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)]++; - if(((*hSlope).first.second<13 && - double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/11>double(percentual)/100 && - SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false) || - ((*hSlope).first.first>=13 && - double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/2>double(percentual)/100 && - SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false)){ - SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]=true; - wheelSlopeHistos[3]->Fill((*hSlope).first.second-1,(*hSlope).first.first); - } - } - } - } - } - -} - -void DTResolutionTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - - edm::LogVerbatim ("resolution") << "[DTResolutionTest] endjob called!"; - - //FR: no idea if this output file needs to be written!! comment it for now - //bool outputMEsInRootFile = parameters.getParameter("OutputMEsInRootFile"); - //if(outputMEsInRootFile){ - // std::string outputFileName = parameters.getParameter("OutputFileName"); - // dbe->save(outputFileName,"DT/CalibrationSummary"); - //} -} - - -string DTResolutionTest::getMEName(const DTSuperLayerId & slID) { - - stringstream wheel; wheel << slID.wheel(); - stringstream station; station << slID.station(); - stringstream sector; sector << slID.sector(); - stringstream superLayer; superLayer << slID.superlayer(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderName; - - if(parameters.getUntrackedParameter("calibModule", false)){ - folderName = - folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/"; - } - else{ - folderName = - folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/"; - } - - string histoTag = parameters.getUntrackedParameter("histoTag", "hResDist"); - - string histoname = folderName + histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str(); - - return histoname; - -} - - -string DTResolutionTest::getMEName2D(const DTSuperLayerId & slID) { - - stringstream wheel; wheel << slID.wheel(); - stringstream station; station << slID.station(); - stringstream sector; sector << slID.sector(); - stringstream superLayer; superLayer << slID.superlayer(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderName; - - if(parameters.getUntrackedParameter("calibModule", false)){ - folderName = - folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/"; - } - else{ - folderName = - folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/"; - } - - string histoTag2D = parameters.getUntrackedParameter("histoTag2D", "hResDistVsDist"); - - string histoname = folderName + histoTag2D - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str(); - - return histoname; - -} - -void DTResolutionTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch) { - - stringstream wheel; wheel << ch.wheel(); - stringstream sector; sector << ch.sector(); - - - string MeanHistoName = "MeanTest_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str(); - string SigmaHistoName = "SigmaTest_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str(); - string SlopeHistoName = "SlopeTest_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str(); - - - ibooker.setCurrentFolder("DT/Tests/DTResolution"); - - // Book the histo for the mean value and set the axis labels - - MeanHistos[make_pair(ch.wheel(),ch.sector())] = ibooker.book1D(MeanHistoName.c_str(),MeanHistoName.c_str(),11,0,11); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1); - (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1); - - - // Book the histo for the sigma value and set the axis labels - if(parameters.getUntrackedParameter("sigmaTest")){ - - SigmaHistos[make_pair(ch.wheel(),ch.sector())] = ibooker.book1D(SigmaHistoName.c_str(),SigmaHistoName.c_str(),11,0,11); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1); - (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1); - } - - // Book the histo for the slope value and set the axis labels - if(parameters.getUntrackedParameter("slopeTest")){ - - SlopeHistos[make_pair(ch.wheel(),ch.sector())] = ibooker.book1D(SlopeHistoName.c_str(),SlopeHistoName.c_str(),11,0,11); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1); - (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1); - } - - string HistoName = "W" + wheel.str() + "_Sec" + sector.str(); - - if(parameters.getUntrackedParameter("meanWrongHisto")){ - string MeanHistoNameSetRange = "MeanWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" - + wheel.str() + "_Sec" + sector.str() + "_SetRange"; - - MeanHistosSetRange[HistoName] = ibooker.book1D(MeanHistoNameSetRange.c_str(),MeanHistoNameSetRange.c_str(),11,0.5,11.5); - string MeanHistoNameSetRange2D = "MeanWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" - + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D"; - MeanHistosSetRange2D[HistoName] = ibooker.book2D(MeanHistoNameSetRange2D.c_str(),MeanHistoNameSetRange2D.c_str(), - 11, 0.5, 11.5, 100, -0.05, 0.05); - } - - if(parameters.getUntrackedParameter("sigmaTest")){ - string SigmaHistoNameSetRange = "SigmaWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" - + wheel.str() + "_Sec" + sector.str() + "_SetRange"; - - SigmaHistosSetRange[HistoName] = ibooker.book1D(SigmaHistoNameSetRange.c_str(),SigmaHistoNameSetRange.c_str(),11,0.5,11.5); - string SigmaHistoNameSetRange2D = "SigmaWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") - + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D"; - - SigmaHistosSetRange2D[HistoName] = ibooker.book2D(SigmaHistoNameSetRange2D.c_str(),SigmaHistoNameSetRange2D.c_str(), - 11, 0.5, 11.5, 500, 0, 0.5); - } - - if(parameters.getUntrackedParameter("slopeTest")){ - string SlopeHistoNameSetRange = "SlopeWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") - + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange"; - - SlopeHistosSetRange[HistoName] = ibooker.book1D(SlopeHistoNameSetRange.c_str(),SlopeHistoNameSetRange.c_str(),11,0.5,11.5); - string SlopeHistoNameSetRange2D = "SlopeWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" - + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D"; - - SlopeHistosSetRange2D[HistoName] = ibooker.book2D(SlopeHistoNameSetRange2D.c_str(),SlopeHistoNameSetRange2D.c_str(), - 11, 0.5, 11.5, 200, -0.1, 0.1); - } -} - -void DTResolutionTest::bookHistos(DQMStore::IBooker & ibooker, int wh) { - - - ibooker.setCurrentFolder("DT/CalibrationSummary"); - - if(wheelMeanHistos.find(3) == wheelMeanHistos.end()){ - string histoName = "MeanSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter("STEP", "STEP3"); - - wheelMeanHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3); - wheelMeanHistos[3]->setBinLabel(1,"Sector1",1); - wheelMeanHistos[3]->setBinLabel(1,"Sector1",1); - wheelMeanHistos[3]->setBinLabel(2,"Sector2",1); - wheelMeanHistos[3]->setBinLabel(3,"Sector3",1); - wheelMeanHistos[3]->setBinLabel(4,"Sector4",1); - wheelMeanHistos[3]->setBinLabel(5,"Sector5",1); - wheelMeanHistos[3]->setBinLabel(6,"Sector6",1); - wheelMeanHistos[3]->setBinLabel(7,"Sector7",1); - wheelMeanHistos[3]->setBinLabel(8,"Sector8",1); - wheelMeanHistos[3]->setBinLabel(9,"Sector9",1); - wheelMeanHistos[3]->setBinLabel(10,"Sector10",1); - wheelMeanHistos[3]->setBinLabel(11,"Sector11",1); - wheelMeanHistos[3]->setBinLabel(12,"Sector12",1); - wheelMeanHistos[3]->setBinLabel(13,"Sector13",1); - wheelMeanHistos[3]->setBinLabel(14,"Sector14",1); - wheelMeanHistos[3]->setBinLabel(1,"Wheel-2",2); - wheelMeanHistos[3]->setBinLabel(2,"Wheel-1",2); - wheelMeanHistos[3]->setBinLabel(3,"Wheel0",2); - wheelMeanHistos[3]->setBinLabel(4,"Wheel+1",2); - wheelMeanHistos[3]->setBinLabel(5,"Wheel+2",2); - } - - if(parameters.getUntrackedParameter("sigmaTest")){ - if(wheelSigmaHistos.find(3) == wheelSigmaHistos.end()){ - string histoName = "SigmaSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter("STEP", "STEP3"); - - wheelSigmaHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3); - wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1); - wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1); - wheelSigmaHistos[3]->setBinLabel(2,"Sector2",1); - wheelSigmaHistos[3]->setBinLabel(3,"Sector3",1); - wheelSigmaHistos[3]->setBinLabel(4,"Sector4",1); - wheelSigmaHistos[3]->setBinLabel(5,"Sector5",1); - wheelSigmaHistos[3]->setBinLabel(6,"Sector6",1); - wheelSigmaHistos[3]->setBinLabel(7,"Sector7",1); - wheelSigmaHistos[3]->setBinLabel(8,"Sector8",1); - wheelSigmaHistos[3]->setBinLabel(9,"Sector9",1); - wheelSigmaHistos[3]->setBinLabel(10,"Sector10",1); - wheelSigmaHistos[3]->setBinLabel(11,"Sector11",1); - wheelSigmaHistos[3]->setBinLabel(12,"Sector12",1); - wheelSigmaHistos[3]->setBinLabel(13,"Sector13",1); - wheelSigmaHistos[3]->setBinLabel(14,"Sector14",1); - wheelSigmaHistos[3]->setBinLabel(1,"Wheel-2",2); - wheelSigmaHistos[3]->setBinLabel(2,"Wheel-1",2); - wheelSigmaHistos[3]->setBinLabel(3,"Wheel0",2); - wheelSigmaHistos[3]->setBinLabel(4,"Wheel+1",2); - wheelSigmaHistos[3]->setBinLabel(5,"Wheel+2",2); - } - } - - if(parameters.getUntrackedParameter("slopeTest")){ - if(wheelSlopeHistos.find(3) == wheelSlopeHistos.end()){ - string histoName = "SlopeSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter("STEP", "STEP3"); - - wheelSlopeHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3); - wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1); - wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1); - wheelSlopeHistos[3]->setBinLabel(2,"Sector2",1); - wheelSlopeHistos[3]->setBinLabel(3,"Sector3",1); - wheelSlopeHistos[3]->setBinLabel(4,"Sector4",1); - wheelSlopeHistos[3]->setBinLabel(5,"Sector5",1); - wheelSlopeHistos[3]->setBinLabel(6,"Sector6",1); - wheelSlopeHistos[3]->setBinLabel(7,"Sector7",1); - wheelSlopeHistos[3]->setBinLabel(8,"Sector8",1); - wheelSlopeHistos[3]->setBinLabel(9,"Sector9",1); - wheelSlopeHistos[3]->setBinLabel(10,"Sector10",1); - wheelSlopeHistos[3]->setBinLabel(11,"Sector11",1); - wheelSlopeHistos[3]->setBinLabel(12,"Sector12",1); - wheelSlopeHistos[3]->setBinLabel(13,"Sector13",1); - wheelSlopeHistos[3]->setBinLabel(14,"Sector14",1); - wheelSlopeHistos[3]->setBinLabel(1,"Wheel-2",2); - wheelSlopeHistos[3]->setBinLabel(2,"Wheel-1",2); - wheelSlopeHistos[3]->setBinLabel(3,"Wheel0",2); - wheelSlopeHistos[3]->setBinLabel(4,"Wheel+1",2); - wheelSlopeHistos[3]->setBinLabel(5,"Wheel+2",2); - } - } - - stringstream wheel; wheel <("STEP", "STEP3") - + "_W" + wheel.str(); - - wheelMeanHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11); - wheelMeanHistos[wh]->setBinLabel(1,"Sector1",1); - wheelMeanHistos[wh]->setBinLabel(2,"Sector2",1); - wheelMeanHistos[wh]->setBinLabel(3,"Sector3",1); - wheelMeanHistos[wh]->setBinLabel(4,"Sector4",1); - wheelMeanHistos[wh]->setBinLabel(5,"Sector5",1); - wheelMeanHistos[wh]->setBinLabel(6,"Sector6",1); - wheelMeanHistos[wh]->setBinLabel(7,"Sector7",1); - wheelMeanHistos[wh]->setBinLabel(8,"Sector8",1); - wheelMeanHistos[wh]->setBinLabel(9,"Sector9",1); - wheelMeanHistos[wh]->setBinLabel(10,"Sector10",1); - wheelMeanHistos[wh]->setBinLabel(11,"Sector11",1); - wheelMeanHistos[wh]->setBinLabel(12,"Sector12",1); - wheelMeanHistos[wh]->setBinLabel(13,"Sector13",1); - wheelMeanHistos[wh]->setBinLabel(14,"Sector14",1); - wheelMeanHistos[wh]->setBinLabel(1,"MB1_SL1",2); - wheelMeanHistos[wh]->setBinLabel(2,"MB1_SL2",2); - wheelMeanHistos[wh]->setBinLabel(3,"MB1_SL3",2); - wheelMeanHistos[wh]->setBinLabel(4,"MB2_SL1",2); - wheelMeanHistos[wh]->setBinLabel(5,"MB2_SL2",2); - wheelMeanHistos[wh]->setBinLabel(6,"MB2_SL3",2); - wheelMeanHistos[wh]->setBinLabel(7,"MB3_SL1",2); - wheelMeanHistos[wh]->setBinLabel(8,"MB3_SL2",2); - wheelMeanHistos[wh]->setBinLabel(9,"MB3_SL3",2); - wheelMeanHistos[wh]->setBinLabel(10,"MB4_SL1",2); - wheelMeanHistos[wh]->setBinLabel(11,"MB4_SL3",2); - } - - if(parameters.getUntrackedParameter("sigmaTest")){ - if(wheelSigmaHistos.find(wh) == wheelSigmaHistos.end()){ - string histoName = "SigmaSummaryRes_testFailed_" + parameters.getUntrackedParameter("STEP", "STEP3") - + "_W" + wheel.str(); - - wheelSigmaHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11); - wheelSigmaHistos[wh]->setBinLabel(1,"Sector1",1); - wheelSigmaHistos[wh]->setBinLabel(2,"Sector2",1); - wheelSigmaHistos[wh]->setBinLabel(3,"Sector3",1); - wheelSigmaHistos[wh]->setBinLabel(4,"Sector4",1); - wheelSigmaHistos[wh]->setBinLabel(5,"Sector5",1); - wheelSigmaHistos[wh]->setBinLabel(6,"Sector6",1); - wheelSigmaHistos[wh]->setBinLabel(7,"Sector7",1); - wheelSigmaHistos[wh]->setBinLabel(8,"Sector8",1); - wheelSigmaHistos[wh]->setBinLabel(9,"Sector9",1); - wheelSigmaHistos[wh]->setBinLabel(10,"Sector10",1); - wheelSigmaHistos[wh]->setBinLabel(11,"Sector11",1); - wheelSigmaHistos[wh]->setBinLabel(12,"Sector12",1); - wheelSigmaHistos[wh]->setBinLabel(13,"Sector13",1); - wheelSigmaHistos[wh]->setBinLabel(14,"Sector14",1); - wheelSigmaHistos[wh]->setBinLabel(1,"MB1_SL1",2); - wheelSigmaHistos[wh]->setBinLabel(2,"MB1_SL2",2); - wheelSigmaHistos[wh]->setBinLabel(3,"MB1_SL3",2); - wheelSigmaHistos[wh]->setBinLabel(4,"MB2_SL1",2); - wheelSigmaHistos[wh]->setBinLabel(5,"MB2_SL2",2); - wheelSigmaHistos[wh]->setBinLabel(6,"MB2_SL3",2); - wheelSigmaHistos[wh]->setBinLabel(7,"MB3_SL1",2); - wheelSigmaHistos[wh]->setBinLabel(8,"MB3_SL2",2); - wheelSigmaHistos[wh]->setBinLabel(9,"MB3_SL3",2); - wheelSigmaHistos[wh]->setBinLabel(10,"MB4_SL1",2); - wheelSigmaHistos[wh]->setBinLabel(11,"MB4_SL3",2); - } - } - - if(parameters.getUntrackedParameter("slopeTest")){ - if(wheelSlopeHistos.find(wh) == wheelSlopeHistos.end()){ - string histoName = "SlopeSummaryRes_testFailed_" + parameters.getUntrackedParameter("STEP", "STEP3") - + "_W" + wheel.str(); - - wheelSlopeHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11); - wheelSlopeHistos[wh]->setBinLabel(1,"Sector1",1); - wheelSlopeHistos[wh]->setBinLabel(2,"Sector2",1); - wheelSlopeHistos[wh]->setBinLabel(3,"Sector3",1); - wheelSlopeHistos[wh]->setBinLabel(4,"Sector4",1); - wheelSlopeHistos[wh]->setBinLabel(5,"Sector5",1); - wheelSlopeHistos[wh]->setBinLabel(6,"Sector6",1); - wheelSlopeHistos[wh]->setBinLabel(7,"Sector7",1); - wheelSlopeHistos[wh]->setBinLabel(8,"Sector8",1); - wheelSlopeHistos[wh]->setBinLabel(9,"Sector9",1); - wheelSlopeHistos[wh]->setBinLabel(10,"Sector10",1); - wheelSlopeHistos[wh]->setBinLabel(11,"Sector11",1); - wheelSlopeHistos[wh]->setBinLabel(12,"Sector12",1); - wheelSlopeHistos[wh]->setBinLabel(13,"Sector13",1); - wheelSlopeHistos[wh]->setBinLabel(14,"Sector14",1); - wheelSlopeHistos[wh]->setBinLabel(1,"MB1_SL1",2); - wheelSlopeHistos[wh]->setBinLabel(2,"MB1_SL2",2); - wheelSlopeHistos[wh]->setBinLabel(3,"MB1_SL3",2); - wheelSlopeHistos[wh]->setBinLabel(4,"MB2_SL1",2); - wheelSlopeHistos[wh]->setBinLabel(5,"MB2_SL2",2); - wheelSlopeHistos[wh]->setBinLabel(6,"MB2_SL3",2); - wheelSlopeHistos[wh]->setBinLabel(7,"MB3_SL1",2); - wheelSlopeHistos[wh]->setBinLabel(8,"MB3_SL2",2); - wheelSlopeHistos[wh]->setBinLabel(9,"MB3_SL3",2); - wheelSlopeHistos[wh]->setBinLabel(10,"MB4_SL1",2); - wheelSlopeHistos[wh]->setBinLabel(11,"MB4_SL3",2); - } - } - -} - -int DTResolutionTest::stationFromBin(int bin) const { - return (int) (bin /3.1)+1; -} - - -int DTResolutionTest::slFromBin(int bin) const { - int ret = bin%3; - if(ret == 0 || bin == 11) ret = 3; - - return ret; -} diff --git a/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc b/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc deleted file mode 100644 index 4965d7dc3a2fd..0000000000000 --- a/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc +++ /dev/null @@ -1,277 +0,0 @@ -/* - * \file DTtTrigCalibrationTest.cc - * - * \author M. Zanetti - CERN - * Modified by G. Mila - INFN Torino - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - */ - - -#include "DQM/DTMonitorClient/src/DTtTrigCalibrationTest.h" - -// Framework -#include - - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" - -#include -#include - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -// the Timebox fitter -#include "CalibMuon/DTCalibration/interface/DTTimeBoxFitter.h" - -#include -#include -#include - -using namespace edm; -using namespace std; - -DTtTrigCalibrationTest::DTtTrigCalibrationTest(const edm::ParameterSet& ps){ - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: Constructor"; - - parameters = ps; - - theFitter = new DTTimeBoxFitter(); - - prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 3); - - percentual = parameters.getUntrackedParameter("BadSLpercentual", 10); - -} - - -DTtTrigCalibrationTest::~DTtTrigCalibrationTest(){ - - edm::LogVerbatim ("tTrigCalibration") <<"DTtTrigCalibrationTest: analyzed " << nevents << " events"; - - delete theFitter; - -} - - -void DTtTrigCalibrationTest::beginRun(Run const& run, EventSetup const& context) { - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: BeginRun"; - - nevents = 0; - - // Get the geometry - context.get().get(muonGeom); - -} - - - void DTtTrigCalibrationTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, - edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) { - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: End of LS transition, performing the DQM client operation"; - - // counts number of lumiSegs - nLumiSegs = lumiSeg.id().luminosityBlock(); - - // prescale factor - if ( nLumiSegs%prescaleFactor != 0 ) return; - - for(map ::const_iterator histo = wheelHistos.begin(); - histo != wheelHistos.end(); - histo++) { - (*histo).second->Reset(); - } - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: "<().get(tTrigMap); - float tTrig, tTrigRMS,kFactor; - - map , int> cmsHistos; - cmsHistos.clear(); - map , bool> filled; - for(int i=-2; i<3; i++){ - for(int j=1; j<15; j++){ - filled[make_pair(i,j)]=false; - } - } - - vector::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - for (; ch_it != ch_end; ++ch_it) { - - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - for(; sl_it != sl_end; ++sl_it) { - - DTSuperLayerId slID = (*sl_it)->id(); - - MonitorElement * tb_histo = igetter.get(getMEName(slID)); - if (tb_histo) { - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: I've got the histo!!"; - - TH1F * tb_histo_root = tb_histo->getTH1F(); - - pair meanAndSigma = theFitter->fitTimeBox(tb_histo_root); - - // ttrig and rms are counts - tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts ); - - if (histos.find((*ch_it)->id().rawId()) == histos.end()) bookHistos(ibooker,(*ch_it)->id()); - histos.find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(), meanAndSigma.first-tTrig); - - } - } - - if (histos.find((*ch_it)->id().rawId()) != histos.end()) { - string criterionName = parameters.getUntrackedParameter("tTrigTestName","tTrigOffSet"); - const QReport * theQReport = histos.find((*ch_it)->id().rawId())->second->getQReport(criterionName); - if(theQReport) { - vector badChannels = theQReport->getBadChannels(); - for (vector::iterator channel = badChannels.begin(); - channel != badChannels.end(); channel++) { - edm::LogError ("tTrigCalibration") <<"Chamber ID : "<<(*ch_it)->id()<<" Bad channels: "<<(*channel).getBin()<<" "<<(*channel).getContents(); - - if(wheelHistos.find((*ch_it)->id().wheel()) == wheelHistos.end()) bookHistos(ibooker,(*ch_it)->id(), (*ch_it)->id().wheel()); - // fill the wheel summary histos if the SL has not passed the test - if(!((*ch_it)->id().station() == 4 && (*channel).getBin() == 3)) - wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,((*channel).getBin()-1)+3*((*ch_it)->id().station()-1)); - else - wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,10); - // fill the cms summary histo if the percentual of SL which have not passed the test - // is more than a predefined treshold - cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]++; - if(((*ch_it)->id().sector()<13 && - double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/11>double(percentual)/100 && - filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false) || - ((*ch_it)->id().sector()>=13 && - double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/2>double(percentual)/100 && - filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false)){ - filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]=true; - wheelHistos[3]->Fill((*ch_it)->id().sector()-1,(*ch_it)->id().wheel()); - } - } - } - } - - } - -} - -void DTtTrigCalibrationTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest] endjob called!"; - -} - - - - -string DTtTrigCalibrationTest::getMEName(const DTSuperLayerId & slID) { - - stringstream wheel; wheel << slID.wheel(); - stringstream station; station << slID.station(); - stringstream sector; sector << slID.sector(); - stringstream superLayer; superLayer << slID.superlayer(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderTag = parameters.getUntrackedParameter("folderTag", "TimeBoxes"); - string folderName = - folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/" + folderTag + "/"; - - string histoTag = parameters.getUntrackedParameter("histoTag", "TimeBox"); - string histoname = folderName + histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str(); - - return histoname; - -} - -void DTtTrigCalibrationTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch) { - - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string histoName = "tTrigTest_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - ibooker.setCurrentFolder("DT/Tests/DTtTrigCalibration"); - - histos[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,2); - -} - -void DTtTrigCalibrationTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch, int wh) { - - ibooker.setCurrentFolder("DT/Tests/DTtTrigCalibration/SummaryPlot"); - - if(wheelHistos.find(3) == wheelHistos.end()){ - string histoName = "t_TrigSummary_testFailedByAtLeastBadSL"; - wheelHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2); - wheelHistos[3]->setBinLabel(1,"Sector1",1); - wheelHistos[3]->setBinLabel(1,"Sector1",1); - wheelHistos[3]->setBinLabel(2,"Sector2",1); - wheelHistos[3]->setBinLabel(3,"Sector3",1); - wheelHistos[3]->setBinLabel(4,"Sector4",1); - wheelHistos[3]->setBinLabel(5,"Sector5",1); - wheelHistos[3]->setBinLabel(6,"Sector6",1); - wheelHistos[3]->setBinLabel(7,"Sector7",1); - wheelHistos[3]->setBinLabel(8,"Sector8",1); - wheelHistos[3]->setBinLabel(9,"Sector9",1); - wheelHistos[3]->setBinLabel(10,"Sector10",1); - wheelHistos[3]->setBinLabel(11,"Sector11",1); - wheelHistos[3]->setBinLabel(12,"Sector12",1); - wheelHistos[3]->setBinLabel(13,"Sector13",1); - wheelHistos[3]->setBinLabel(14,"Sector14",1); - wheelHistos[3]->setBinLabel(1,"Wheel-2",2); - wheelHistos[3]->setBinLabel(2,"Wheel-1",2); - wheelHistos[3]->setBinLabel(3,"Wheel0",2); - wheelHistos[3]->setBinLabel(4,"Wheel+1",2); - wheelHistos[3]->setBinLabel(5,"Wheel+2",2); - } - - stringstream wheel; wheel <setBinLabel(1,"Sector1",1); - wheelHistos[wh]->setBinLabel(2,"Sector2",1); - wheelHistos[wh]->setBinLabel(3,"Sector3",1); - wheelHistos[wh]->setBinLabel(4,"Sector4",1); - wheelHistos[wh]->setBinLabel(5,"Sector5",1); - wheelHistos[wh]->setBinLabel(6,"Sector6",1); - wheelHistos[wh]->setBinLabel(7,"Sector7",1); - wheelHistos[wh]->setBinLabel(8,"Sector8",1); - wheelHistos[wh]->setBinLabel(9,"Sector9",1); - wheelHistos[wh]->setBinLabel(10,"Sector10",1); - wheelHistos[wh]->setBinLabel(11,"Sector11",1); - wheelHistos[wh]->setBinLabel(12,"Sector12",1); - wheelHistos[wh]->setBinLabel(13,"Sector13",1); - wheelHistos[wh]->setBinLabel(14,"Sector14",1); - wheelHistos[wh]->setBinLabel(1,"MB1_SL1",2); - wheelHistos[wh]->setBinLabel(2,"MB1_SL2",2); - wheelHistos[wh]->setBinLabel(3,"MB1_SL3",2); - wheelHistos[wh]->setBinLabel(4,"MB2_SL1",2); - wheelHistos[wh]->setBinLabel(5,"MB2_SL2",2); - wheelHistos[wh]->setBinLabel(6,"MB2_SL3",2); - wheelHistos[wh]->setBinLabel(7,"MB3_SL1",2); - wheelHistos[wh]->setBinLabel(8,"MB3_SL2",2); - wheelHistos[wh]->setBinLabel(9,"MB3_SL3",2); - wheelHistos[wh]->setBinLabel(10,"MB4_SL1",2); - wheelHistos[wh]->setBinLabel(11,"MB4_SL3",2); - -} - diff --git a/DQM/DTMonitorClient/src/SealModule.cc b/DQM/DTMonitorClient/src/SealModule.cc index 622485877776e..ac4da53d6d601 100644 --- a/DQM/DTMonitorClient/src/SealModule.cc +++ b/DQM/DTMonitorClient/src/SealModule.cc @@ -1,11 +1,11 @@ #include "FWCore/Framework/interface/MakerMacros.h" -#include -DEFINE_FWK_MODULE(DTtTrigCalibrationTest); +//#include +//DEFINE_FWK_MODULE(DTtTrigCalibrationTest); -#include -DEFINE_FWK_MODULE(DTResolutionTest); +//#include +//DEFINE_FWK_MODULE(DTResolutionTest); #include DEFINE_FWK_MODULE(DTEfficiencyTest); @@ -22,11 +22,11 @@ DEFINE_FWK_MODULE(DTDataIntegrityTest); #include DEFINE_FWK_MODULE(DTSegmentAnalysisTest); -#include "DQM/DTMonitorClient/src/DTDeadChannelTest.h" -DEFINE_FWK_MODULE(DTDeadChannelTest); +//#include "DQM/DTMonitorClient/src/DTDeadChannelTest.h" +//DEFINE_FWK_MODULE(DTDeadChannelTest); -#include "DQM/DTMonitorClient/src/DTNoiseTest.h" -DEFINE_FWK_MODULE(DTNoiseTest); +//#include "DQM/DTMonitorClient/src/DTNoiseTest.h" +//DEFINE_FWK_MODULE(DTNoiseTest); #include "DQM/DTMonitorClient/src/DTNoiseAnalysisTest.h" DEFINE_FWK_MODULE(DTNoiseAnalysisTest); @@ -43,8 +43,8 @@ DEFINE_FWK_MODULE(DTLocalTriggerLutTest); #include "DQM/DTMonitorClient/src/DTLocalTriggerTPTest.h" DEFINE_FWK_MODULE(DTLocalTriggerTPTest); -#include "DQM/DTMonitorClient/src/DTCreateSummaryHistos.h" -DEFINE_FWK_MODULE(DTCreateSummaryHistos); +//#include "DQM/DTMonitorClient/src/DTCreateSummaryHistos.h" +//DEFINE_FWK_MODULE(DTCreateSummaryHistos); #include "DQM/DTMonitorClient/src/DTOccupancyTest.h" DEFINE_FWK_MODULE(DTOccupancyTest); From 5ccdc96e0e7ed26b6c677d4554db15a025980086 Mon Sep 17 00:00:00 2001 From: Francesca Cavallo Date: Mon, 20 Apr 2015 11:07:42 +0200 Subject: [PATCH 03/10] new CEROS_ID_ROS_STATUS_MASK --- DataFormats/DTDigi/interface/DTDDUWords.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DataFormats/DTDigi/interface/DTDDUWords.h b/DataFormats/DTDigi/interface/DTDDUWords.h index b6254afe28ef6..0971fedbbafc4 100644 --- a/DataFormats/DTDigi/interface/DTDDUWords.h +++ b/DataFormats/DTDigi/interface/DTDDUWords.h @@ -24,7 +24,7 @@ #define EV_ID_CEROS_STATUS_MASK 0xFC0 #define EV_ID_CEROS_STATUS_SHIFT 6 #define DONTREAD_CEROS_STATUS_MASK 0x3F -#define CEROS_ID_ROS_STATUS_MASK 0x3F +#define CEROS_ID_ROS_STATUS_MASK 0x1F #define TTC_EVENT_COUNTER_MASK 0xFFFFFF From 51c168794949d893fcf279d3134f303dae6576b2 Mon Sep 17 00:00:00 2001 From: Francesca Cavallo Date: Tue, 21 Apr 2015 15:01:33 +0200 Subject: [PATCH 04/10] package pruned --- DQM/DTMonitorClient/src/SealModule.cc | 16 +-- .../interface/DTGlobalRecoTask.h | 65 ------------- .../interface/DTTestPulsesTask.h | 90 ----------------- .../interface/DTTriggerCheck.h | 60 ------------ DQM/DTMonitorModule/plugins/plugins.cc | 19 +--- .../src/DTAlbertoBenvenutiTask.h | 97 ------------------- DQM/DTMonitorModule/src/DTDataErrorFilter.h | 39 -------- DQM/DTMonitorModule/src/DTDigiForNoiseTask.h | 90 ----------------- DQM/DTMonitorModule/src/DTROMonitorFilter.h | 39 -------- .../src/DTSegmentAnalysisTask.cc | 52 +++++----- 10 files changed, 29 insertions(+), 538 deletions(-) delete mode 100644 DQM/DTMonitorModule/interface/DTGlobalRecoTask.h delete mode 100644 DQM/DTMonitorModule/interface/DTTestPulsesTask.h delete mode 100644 DQM/DTMonitorModule/interface/DTTriggerCheck.h delete mode 100644 DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h delete mode 100644 DQM/DTMonitorModule/src/DTDataErrorFilter.h delete mode 100644 DQM/DTMonitorModule/src/DTDigiForNoiseTask.h delete mode 100644 DQM/DTMonitorModule/src/DTROMonitorFilter.h diff --git a/DQM/DTMonitorClient/src/SealModule.cc b/DQM/DTMonitorClient/src/SealModule.cc index ac4da53d6d601..7141e8bd7efa8 100644 --- a/DQM/DTMonitorClient/src/SealModule.cc +++ b/DQM/DTMonitorClient/src/SealModule.cc @@ -1,11 +1,8 @@ #include "FWCore/Framework/interface/MakerMacros.h" -//#include -//DEFINE_FWK_MODULE(DTtTrigCalibrationTest); - -//#include -//DEFINE_FWK_MODULE(DTResolutionTest); +#include +DEFINE_FWK_MODULE(DTResolutionTest); #include DEFINE_FWK_MODULE(DTEfficiencyTest); @@ -22,12 +19,6 @@ DEFINE_FWK_MODULE(DTDataIntegrityTest); #include DEFINE_FWK_MODULE(DTSegmentAnalysisTest); -//#include "DQM/DTMonitorClient/src/DTDeadChannelTest.h" -//DEFINE_FWK_MODULE(DTDeadChannelTest); - -//#include "DQM/DTMonitorClient/src/DTNoiseTest.h" -//DEFINE_FWK_MODULE(DTNoiseTest); - #include "DQM/DTMonitorClient/src/DTNoiseAnalysisTest.h" DEFINE_FWK_MODULE(DTNoiseAnalysisTest); @@ -43,9 +34,6 @@ DEFINE_FWK_MODULE(DTLocalTriggerLutTest); #include "DQM/DTMonitorClient/src/DTLocalTriggerTPTest.h" DEFINE_FWK_MODULE(DTLocalTriggerTPTest); -//#include "DQM/DTMonitorClient/src/DTCreateSummaryHistos.h" -//DEFINE_FWK_MODULE(DTCreateSummaryHistos); - #include "DQM/DTMonitorClient/src/DTOccupancyTest.h" DEFINE_FWK_MODULE(DTOccupancyTest); diff --git a/DQM/DTMonitorModule/interface/DTGlobalRecoTask.h b/DQM/DTMonitorModule/interface/DTGlobalRecoTask.h deleted file mode 100644 index 2fbe3a558888d..0000000000000 --- a/DQM/DTMonitorModule/interface/DTGlobalRecoTask.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef DTGlobalRecoTask_H -#define DTGlobalRecoTask_H - -/* - * \file DTGlobalRecoTask.h - * - * \author M. Zanetti - INFN Padova - * -*/ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include - -#include -#include - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include "DQMServices/Core/interface/MonitorElement.h" -#include - -#include -#include -#include - -class DTGlobalRecoTask: public DQMEDAnalyzer{ - -friend class DTMonitorModule; - -public: - -/// Constructor -DTGlobalRecoTask(const edm::ParameterSet& ps, const edm::EventSetup& context); - -/// Destructor -virtual ~DTGlobalRecoTask(); - -protected: - -// Book the histograms -void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - -/// Analyze -void analyze(const edm::Event& e, const edm::EventSetup& c); - - -private: - - int nevents; - - // My monitor elements - - std::ofstream logFile; - -}; - -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/interface/DTTestPulsesTask.h b/DQM/DTMonitorModule/interface/DTTestPulsesTask.h deleted file mode 100644 index b2df76f197b0c..0000000000000 --- a/DQM/DTMonitorModule/interface/DTTestPulsesTask.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef DTTestPulsesTask_H -#define DTTestPulsesTask_H - -/* - * \file DTTestPulsesTask.h - * - * \author M. Zanetti - INFN Padova - * -*/ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -class DTGeometry; -class DTLayerId; -class DTRangeT0; - -class DTTestPulsesTask: public DQMEDAnalyzer{ - -public: - - /// Constructor - DTTestPulsesTask(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTTestPulsesTask(); - -protected: - - /// BeginRun - void dqmBeginRun(const edm::Run& , const edm::EventSetup&); - - // Book the histograms - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - - /// Book the ME - void bookHistos(DQMStore::IBooker & ibooker, std::string folder, std::string histoTag); - - /// Analyze - void analyze(const edm::Event& e, const edm::EventSetup& c); - - -private: - - int nevents; - - edm::ParameterSet parameters; - - edm::ESHandle muonGeom; - edm::ESHandle t0RangeMap; - - edm::EDGetTokenT dtDigisToken_; // dtunpacker - std::pair t0sPeakRange; - - // My monitor elements - std::map testPulsesProfiles; - std::map testPulsesOccupancies; - std::map testPulsesTimeBoxes; - - -}; - -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/interface/DTTriggerCheck.h b/DQM/DTMonitorModule/interface/DTTriggerCheck.h deleted file mode 100644 index 9fd42cd448c58..0000000000000 --- a/DQM/DTMonitorModule/interface/DTTriggerCheck.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef DTSegmentAnalysis_H -#define DTSegmentAnalysis_H - -/** \class DTTriggerCheck - * - * \author S.Bolognesi - INFN Torino - */ - -#include -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include "DataFormats/LTCDigi/interface/LTCDigi.h" - -#include -#include -#include - -class DQMStore; -class MonitorElement; - -class DTTriggerCheck: public DQMEDAnalyzer{ - -friend class DTMonitorModule; -public: - /// Constructor - DTTriggerCheck(const edm::ParameterSet& pset); - - /// Destructor - virtual ~DTTriggerCheck(); - -/// Analyze -void analyze(const edm::Event& event, const edm::EventSetup& setup); - -void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - -protected: - -private: - - bool debug; - - MonitorElement* histo; - - bool isLocalRun; - edm::EDGetTokenT ltcDigiCollectionToken_; -}; -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/plugins/plugins.cc b/DQM/DTMonitorModule/plugins/plugins.cc index f9089d8e46e90..9a96ba3704b9c 100644 --- a/DQM/DTMonitorModule/plugins/plugins.cc +++ b/DQM/DTMonitorModule/plugins/plugins.cc @@ -3,9 +3,6 @@ #include DEFINE_FWK_MODULE(DTDigiTask); -//#include -//DEFINE_FWK_MODULE(DTTestPulsesTask); - #include DEFINE_FWK_MODULE(DTSegmentAnalysisTask); @@ -27,29 +24,17 @@ DEFINE_FWK_MODULE(DTChamberEfficiency); #include DEFINE_FWK_MODULE(DTRunConditionVar); -//#include "DQM/DTMonitorModule/interface/DTTriggerCheck.h" -//DEFINE_FWK_MODULE(DTTriggerCheck); - -//#include "DQM/DTMonitorModule/src/DTDigiForNoiseTask.h" -//DEFINE_FWK_MODULE(DTDigiForNoiseTask); - #include "DQM/DTMonitorModule/src/DTNoiseTask.h" DEFINE_FWK_MODULE(DTNoiseTask); -//#include "DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h" -//DEFINE_FWK_MODULE(DTAlbertoBenvenutiTask); - #include "DQM/DTMonitorModule/interface/DTCalibValidation.h" DEFINE_FWK_MODULE(DTCalibValidation); -//#include "DQM/DTMonitorModule/src/DTROMonitorFilter.h" -//DEFINE_FWK_MODULE(DTROMonitorFilter); - #include DEFINE_FWK_MODULE(DTTriggerEfficiencyTask); -//#include -//DEFINE_FWK_MODULE(DTLocalTriggerSynchTask); +#include +DEFINE_FWK_MODULE(DTLocalTriggerSynchTask); #include DEFINE_FWK_MODULE(DTLocalTriggerLutTask); diff --git a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h b/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h deleted file mode 100644 index 98df4e2eb1b63..0000000000000 --- a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef DTAlbertoBenvenutiTask_H -#define DTAlbertoBenvenutiTask_H - - -/* - * \file DTAlbertoBenvenutiTask.h - * - * \author G. Mila - INFN Torino - * -*/ - - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include - -#include -#include -#include -#include -#include -#include -#include "TH1F.h" - -class DTGeometry; -class DTWireId; -class DTTtrig; -class DTT0; - - -class DTAlbertoBenvenutiTask: public edm::EDAnalyzer{ - -public: - - /// Constructor - DTAlbertoBenvenutiTask(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTAlbertoBenvenutiTask(); - -protected: - - /// BeginJob - void beginJob(); - - void beginRun(const edm::Run&, const edm::EventSetup&); - - /// Book the ME - void bookHistos(const DTWireId dtWire); - - /// Analyze - void analyze(const edm::Event& e, const edm::EventSetup& c); - - /// Endjob - void endJob(); - -private: - - bool debug; - int nevents; - - /// no needs to be precise. Value from PSets will always be used - int tMax; - int maxTDCHits; - - /// tTrig from the DB - float tTrig; - float tTrigRMS; - float kFactor; - - edm::ParameterSet parameters; - - edm::ESHandle muonGeom; - - edm::ESHandle tTrigMap; - edm::ESHandle t0Map; - - std::string outputFile; - - std::map TBMap; - - //define Token(-s) - edm::EDGetTokenT DTUnpackerToken_; - -}; - -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/src/DTDataErrorFilter.h b/DQM/DTMonitorModule/src/DTDataErrorFilter.h deleted file mode 100644 index e97728747ae8e..0000000000000 --- a/DQM/DTMonitorModule/src/DTDataErrorFilter.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef DTDataErrorFilter_H -#define DTDataErrorFilter_H - -/** \class DTDataErrorFilter - * No description available. - * - * \author G. Cerminara - INFN Torino - */ - -#include "HLTrigger/HLTcore/interface/HLTFilter.h" - -class DTDataIntegrityTask; - - -class DTDataErrorFilter : public HLTFilter { -public: - /// Constructor - DTDataErrorFilter(const edm::ParameterSet&); - - /// Destructor - virtual ~DTDataErrorFilter(); - - // Operations - virtual bool hltFilter(edm::Event& event, const edm::EventSetup& setup, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; - -protected: - -private: - DTDataIntegrityTask * dataMonitor; - - -}; -#endif - - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.h b/DQM/DTMonitorModule/src/DTDigiForNoiseTask.h deleted file mode 100644 index 3285b9633f2c0..0000000000000 --- a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.h +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef DTDigiForNoiseTask_H -#define DTDigiForNoiseTask_H - -/* - * \file DTDigiForNoiseTask.h - * - * \author G. Mila - INFN Torino - * -*/ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include -#include "FWCore/ServiceRegistry/interface/Service.h" -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -class DTGeometry; -class DTSuperLayerId; -class DTLayerId; -class DTChamberId; - - -//-class DTDigiForNoiseTask: public edm::EDAnalyzer{ -class DTDigiForNoiseTask: public DQMEDAnalyzer{ - -public: - - /// Constructor - DTDigiForNoiseTask(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTDigiForNoiseTask(); - -protected: - - /// begin run - void dqmBeginRun(const edm::Run& , const edm::EventSetup&); - - /// bookHistograms - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - - - /// Book the ME - void bookHistos(DQMStore::IBooker &, const DTLayerId& dtSL); - - /// To reset the MEs - void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) ; - - /// Analyze - void analyze(const edm::Event& e, const edm::EventSetup& c); - -private: - - bool debug; - int nevents; - - edm::ParameterSet parameters; - - edm::ESHandle muonGeom; - edm::EDGetTokenT dtDigisToken_; // dtunpacker - - std::map< DTLayerId, MonitorElement* > digiHistos; - - -}; - -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/src/DTROMonitorFilter.h b/DQM/DTMonitorModule/src/DTROMonitorFilter.h deleted file mode 100644 index f5b3638aaaec6..0000000000000 --- a/DQM/DTMonitorModule/src/DTROMonitorFilter.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef DTROMonitorFilter_H -#define DTROMonitorFilter_H - -/** \class DTROMonitorFilter.h - * No description available. - * - * \author G. Cerminara - INFN Torino - */ - -#include "HLTrigger/HLTcore/interface/HLTFilter.h" -#include -#include - - -class DTROMonitorFilter : public HLTFilter { -public: - /// Constructor - DTROMonitorFilter(const edm::ParameterSet&); - - /// Destructor - virtual ~DTROMonitorFilter(); - - // Operations - virtual bool hltFilter(edm::Event& event, const edm::EventSetup& setup, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; - -protected: - -private: - /// if not you need the label - edm::EDGetTokenT rawDataToken_; - -}; -#endif - - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/src/DTSegmentAnalysisTask.cc b/DQM/DTMonitorModule/src/DTSegmentAnalysisTask.cc index e61139c7f6316..29ae0e5a63ab0 100644 --- a/DQM/DTMonitorModule/src/DTSegmentAnalysisTask.cc +++ b/DQM/DTMonitorModule/src/DTSegmentAnalysisTask.cc @@ -85,6 +85,31 @@ void DTSegmentAnalysisTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run nEventMonitor = ibooker.bookFloat("nProcessedEventsSegment"); } + for(int wh=-2; wh<=2; wh++){ + stringstream wheel; wheel << wh; + ibooker.setCurrentFolder(topHistoFolder + "/Wheel" + wheel.str()); + string histoName = "numberOfSegments_W" + wheel.str(); + + summaryHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5); + summaryHistos[wh]->setAxisTitle("Sector",1); + summaryHistos[wh]->setBinLabel(1,"1",1); + summaryHistos[wh]->setBinLabel(2,"2",1); + summaryHistos[wh]->setBinLabel(3,"3",1); + summaryHistos[wh]->setBinLabel(4,"4",1); + summaryHistos[wh]->setBinLabel(5,"5",1); + summaryHistos[wh]->setBinLabel(6,"6",1); + summaryHistos[wh]->setBinLabel(7,"7",1); + summaryHistos[wh]->setBinLabel(8,"8",1); + summaryHistos[wh]->setBinLabel(9,"9",1); + summaryHistos[wh]->setBinLabel(10,"10",1); + summaryHistos[wh]->setBinLabel(11,"11",1); + summaryHistos[wh]->setBinLabel(12,"12",1); + summaryHistos[wh]->setBinLabel(1,"MB1",2); + summaryHistos[wh]->setBinLabel(2,"MB2",2); + summaryHistos[wh]->setBinLabel(3,"MB3",2); + summaryHistos[wh]->setBinLabel(4,"MB4",2); + } + // loop over all the DT chambers & book the histos const vector& chambers = dtGeom->chambers(); vector::const_iterator ch_it = chambers.begin(); @@ -287,33 +312,6 @@ void DTSegmentAnalysisTask::bookHistos(DQMStore::IBooker & ibooker, DTChamberId "_St" + station.str() + "_Sec" + sector.str(); - - for(int wh=-2; wh<=2; wh++){ - stringstream wheel; wheel << wh; - ibooker.setCurrentFolder(topHistoFolder + "/Wheel" + wheel.str()); - string histoName = "numberOfSegments_W" + wheel.str(); - - summaryHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),12,1,13,4,1,5); - summaryHistos[wh]->setAxisTitle("Sector",1); - summaryHistos[wh]->setBinLabel(1,"1",1); - summaryHistos[wh]->setBinLabel(2,"2",1); - summaryHistos[wh]->setBinLabel(3,"3",1); - summaryHistos[wh]->setBinLabel(4,"4",1); - summaryHistos[wh]->setBinLabel(5,"5",1); - summaryHistos[wh]->setBinLabel(6,"6",1); - summaryHistos[wh]->setBinLabel(7,"7",1); - summaryHistos[wh]->setBinLabel(8,"8",1); - summaryHistos[wh]->setBinLabel(9,"9",1); - summaryHistos[wh]->setBinLabel(10,"10",1); - summaryHistos[wh]->setBinLabel(11,"11",1); - summaryHistos[wh]->setBinLabel(12,"12",1); - summaryHistos[wh]->setBinLabel(1,"MB1",2); - summaryHistos[wh]->setBinLabel(2,"MB2",2); - summaryHistos[wh]->setBinLabel(3,"MB3",2); - summaryHistos[wh]->setBinLabel(4,"MB4",2); - } - - ibooker.setCurrentFolder(topHistoFolder + "/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str()); From 5aa17b43a8d14fc6dfbe587d075d45d7b1c5328c Mon Sep 17 00:00:00 2001 From: Francesca Cavallo Date: Sat, 25 Apr 2015 17:27:44 +0200 Subject: [PATCH 05/10] pruning and minor changes --- .../interface/DTGlobalRecoTask.h1 | 65 ++++ .../interface/DTTestPulsesTask.h1 | 90 +++++ .../interface/DTTriggerCheck.h1 | 60 ++++ .../src/DTAlbertoBenvenutiTask.cc1 | 311 ++++++++++++++++++ .../src/DTAlbertoBenvenutiTask.h1 | 97 ++++++ DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 | 31 ++ DQM/DTMonitorModule/src/DTDataErrorFilter.h1 | 39 +++ .../src/DTDigiForNoiseTask.cc1 | 211 ++++++++++++ DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 | 90 +++++ DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 | 37 +++ .../src/DTLocalTriggerSynchTask.cc | 272 +++++++++++++++ DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 | 73 ++++ DQM/DTMonitorModule/src/DTROMonitorFilter.h1 | 39 +++ DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 | 240 ++++++++++++++ DQM/DTMonitorModule/src/DTTriggerCheck.cc1 | 79 +++++ 15 files changed, 1734 insertions(+) create mode 100644 DQM/DTMonitorModule/interface/DTGlobalRecoTask.h1 create mode 100644 DQM/DTMonitorModule/interface/DTTestPulsesTask.h1 create mode 100644 DQM/DTMonitorModule/interface/DTTriggerCheck.h1 create mode 100644 DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc1 create mode 100644 DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h1 create mode 100644 DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 create mode 100644 DQM/DTMonitorModule/src/DTDataErrorFilter.h1 create mode 100644 DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc1 create mode 100644 DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 create mode 100644 DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 create mode 100644 DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc create mode 100644 DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 create mode 100644 DQM/DTMonitorModule/src/DTROMonitorFilter.h1 create mode 100644 DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 create mode 100644 DQM/DTMonitorModule/src/DTTriggerCheck.cc1 diff --git a/DQM/DTMonitorModule/interface/DTGlobalRecoTask.h1 b/DQM/DTMonitorModule/interface/DTGlobalRecoTask.h1 new file mode 100644 index 0000000000000..2fbe3a558888d --- /dev/null +++ b/DQM/DTMonitorModule/interface/DTGlobalRecoTask.h1 @@ -0,0 +1,65 @@ +#ifndef DTGlobalRecoTask_H +#define DTGlobalRecoTask_H + +/* + * \file DTGlobalRecoTask.h + * + * \author M. Zanetti - INFN Padova + * +*/ + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include + +#include +#include + +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DQMServices/Core/interface/DQMStore.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "DQMServices/Core/interface/MonitorElement.h" +#include + +#include +#include +#include + +class DTGlobalRecoTask: public DQMEDAnalyzer{ + +friend class DTMonitorModule; + +public: + +/// Constructor +DTGlobalRecoTask(const edm::ParameterSet& ps, const edm::EventSetup& context); + +/// Destructor +virtual ~DTGlobalRecoTask(); + +protected: + +// Book the histograms +void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + +/// Analyze +void analyze(const edm::Event& e, const edm::EventSetup& c); + + +private: + + int nevents; + + // My monitor elements + + std::ofstream logFile; + +}; + +#endif + +/* Local Variables: */ +/* show-trailing-whitespace: t */ +/* truncate-lines: t */ +/* End: */ diff --git a/DQM/DTMonitorModule/interface/DTTestPulsesTask.h1 b/DQM/DTMonitorModule/interface/DTTestPulsesTask.h1 new file mode 100644 index 0000000000000..b2df76f197b0c --- /dev/null +++ b/DQM/DTMonitorModule/interface/DTTestPulsesTask.h1 @@ -0,0 +1,90 @@ +#ifndef DTTestPulsesTask_H +#define DTTestPulsesTask_H + +/* + * \file DTTestPulsesTask.h + * + * \author M. Zanetti - INFN Padova + * +*/ + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include +#include +#include +#include +#include +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +class DTGeometry; +class DTLayerId; +class DTRangeT0; + +class DTTestPulsesTask: public DQMEDAnalyzer{ + +public: + + /// Constructor + DTTestPulsesTask(const edm::ParameterSet& ps); + + /// Destructor + virtual ~DTTestPulsesTask(); + +protected: + + /// BeginRun + void dqmBeginRun(const edm::Run& , const edm::EventSetup&); + + // Book the histograms + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + + /// Book the ME + void bookHistos(DQMStore::IBooker & ibooker, std::string folder, std::string histoTag); + + /// Analyze + void analyze(const edm::Event& e, const edm::EventSetup& c); + + +private: + + int nevents; + + edm::ParameterSet parameters; + + edm::ESHandle muonGeom; + edm::ESHandle t0RangeMap; + + edm::EDGetTokenT dtDigisToken_; // dtunpacker + std::pair t0sPeakRange; + + // My monitor elements + std::map testPulsesProfiles; + std::map testPulsesOccupancies; + std::map testPulsesTimeBoxes; + + +}; + +#endif + +/* Local Variables: */ +/* show-trailing-whitespace: t */ +/* truncate-lines: t */ +/* End: */ diff --git a/DQM/DTMonitorModule/interface/DTTriggerCheck.h1 b/DQM/DTMonitorModule/interface/DTTriggerCheck.h1 new file mode 100644 index 0000000000000..9fd42cd448c58 --- /dev/null +++ b/DQM/DTMonitorModule/interface/DTTriggerCheck.h1 @@ -0,0 +1,60 @@ +#ifndef DTSegmentAnalysis_H +#define DTSegmentAnalysis_H + +/** \class DTTriggerCheck + * + * \author S.Bolognesi - INFN Torino + */ + +#include +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include "FWCore/Utilities/interface/InputTag.h" + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include +#include "FWCore/ServiceRegistry/interface/Service.h" + +#include "DataFormats/LTCDigi/interface/LTCDigi.h" + +#include +#include +#include + +class DQMStore; +class MonitorElement; + +class DTTriggerCheck: public DQMEDAnalyzer{ + +friend class DTMonitorModule; +public: + /// Constructor + DTTriggerCheck(const edm::ParameterSet& pset); + + /// Destructor + virtual ~DTTriggerCheck(); + +/// Analyze +void analyze(const edm::Event& event, const edm::EventSetup& setup); + +void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + +protected: + +private: + + bool debug; + + MonitorElement* histo; + + bool isLocalRun; + edm::EDGetTokenT ltcDigiCollectionToken_; +}; +#endif + +/* Local Variables: */ +/* show-trailing-whitespace: t */ +/* truncate-lines: t */ +/* End: */ diff --git a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc1 b/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc1 new file mode 100644 index 0000000000000..0757ae59bfee6 --- /dev/null +++ b/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc1 @@ -0,0 +1,311 @@ + + +/* + * See header file for a description of this class. + * + * \author G. Mila - INFN Torino + */ + + +#include + +// Framework +#include + +// Digis +#include +#include +#include + +// Geometry +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "Geometry/DTGeometry/interface/DTLayer.h" +#include "Geometry/DTGeometry/interface/DTTopology.h" + +// T0s +#include +#include +#include +#include + +#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" +#include "CondFormats/DTObjects/interface/DTStatusFlag.h" + + +#include +#include +#include +#include "TFile.h" +#include "TPostScript.h" +#include "TCanvas.h" + +using namespace edm; +using namespace std; + + +DTAlbertoBenvenutiTask::DTAlbertoBenvenutiTask(const edm::ParameterSet& ps){ + + debug = ps.getUntrackedParameter("debug", false); + if(debug) + cout<<"[DTAlbertoBenvenutiTask]: Constructor"<("outputFile", "DTDigiSources.root"); + maxTDCHits = ps.getUntrackedParameter("maxTDCHits",1000); + + // tMax (not yet from the DB) + tMax = parameters.getParameter("defaultTmax"); + + parameters = ps; + + //set Token(-s) + DTUnpackerToken_ = consumes(std::string("dtunpacker")); +} + + +DTAlbertoBenvenutiTask::~DTAlbertoBenvenutiTask(){ + + if(debug) + cout << "DTAlbertoBenvenutiTask: analyzed " << nevents << " events" << endl; + +} + + +void DTAlbertoBenvenutiTask::endJob(){ + + if(debug) + cout<<"[DTAlbertoBenvenutiTask] endjob called!"< > TBMap_perChamber; + + for(map::const_iterator wHisto = TBMap.begin(); + wHisto != TBMap.end(); + wHisto++) { + DTChamberId chId = (*wHisto).first.layerId().superlayerId().chamberId(); + TBMap_perChamber[chId].push_back((*wHisto).second); + } + + + for(map >::const_iterator Histo = TBMap_perChamber.begin(); + Histo != TBMap_perChamber.end(); + Histo++) { + stringstream station; station << (*Histo).first.station(); + stringstream sector; sector << (*Histo).first.sector(); + stringstream wheel; wheel << (*Histo).first.wheel(); + + string fileTag = "TimeBoxes"; + string fileName = fileTag + + "_W" + wheel.str() + + "_Sec" + sector.str() + + "_St" + station.str() + + ".ps"; + + TPostScript psFile(fileName.c_str(),111); + psFile.Range(20,26); + int counter = 0; + TCanvas c1("c1","",600,780); + c1.Divide(4,4); + psFile.NewPage(); + + cout<<"[DTAlbertoBenvenutiTask] filling the file: "<::const_iterator tbHisto = (*Histo).second.begin(); + tbHisto != (*Histo).second.end(); + tbHisto++) { + counter++; + c1.cd(counter); + (*tbHisto)->Draw(); + if(counter%16 == 0 && counter>=16){ + c1.Update(); + psFile.NewPage(); + c1.Clear(); + c1.Divide(4,4); + counter=0; + } + } // loop over TB histos (divided per chamber) + + } //loop over the chambers + +} + + +void DTAlbertoBenvenutiTask::beginJob(){ + + if(debug) + cout<<"[DTAlbertoBenvenutiTask]: BeginJob"<().get(muonGeom); + + // tTrig + if (parameters.getUntrackedParameter("readDB", true)) + context.get().get(tTrigMap); + + // t0s + if (parameters.getParameter("performPerWireT0Calibration")) + context.get().get(t0Map); + +} + + +void DTAlbertoBenvenutiTask::bookHistos(const DTWireId dtWire) { + + if (debug) cout<<"[DTAlbertoBenvenutiTask]: booking"<::const_iterator ch_it = muonGeom->chambers().begin(); + vector::const_iterator ch_end = muonGeom->chambers().end(); + // Loop over the SLs + for (; ch_it != ch_end; ++ch_it) { + DTChamberId ch = (*ch_it)->id(); + if(ch == dtWire.layerId().superlayerId().chamberId()){ + vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + stringstream superLayer; superLayer << sl.superlayer(); + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + // Loop over the Ls + for(; l_it != l_end; ++l_it) { + DTLayerId layerId = (*l_it)->id(); + stringstream layer; layer << layerId.layer(); + const int firstWire = muonGeom->layer(layerId)->specificTopology().firstChannel(); + const int lastWire = muonGeom->layer(layerId)->specificTopology().lastChannel(); + // Loop overt the wires + for(int wr=firstWire; wr -lastWire <= 0; wr++) { + + stringstream wire; wire << wr; + DTWireId wrId(layerId, wr); + + string histoTag = "TimeBox"; + string histoName = histoTag + + "_W" + wheel.str() + + "_St" + station.str() + + "_Sec" + sector.str() + + "_SL" + superLayer.str() + + "_L" + layer.str() + + "_wire" + wire.str(); + + if (debug) cout<<"[DTAlbertoBenvenutiTask]: histoName "<("readDB", false) ) + // ttrig and rms are TDC counts + tTrigMap->get(dtWire.layerId().superlayerId(), tTrig, tTrigRMS, kFactor, + DTTimeUnits::counts); + else tTrig = parameters.getParameter("defaultTtrig"); + + string histoTitle = histoName + " (TDC Counts)"; + int timeBoxGranularity = parameters.getUntrackedParameter("timeBoxGranularity",4); + + if (!parameters.getUntrackedParameter("readDB", true)) { + int maxTDCCounts = 6400 * parameters.getUntrackedParameter("tdcRescale", 1); + TH1F *TB = new TH1F(histoName.c_str(),histoTitle.c_str(), maxTDCCounts/timeBoxGranularity, 0, maxTDCCounts); + TBMap[wrId] = TB; + } + else { + TH1F *TB = new TH1F(histoName.c_str(),histoTitle.c_str(), 2*tMax/timeBoxGranularity, tTrig-tMax, tTrig+2*tMax); + TBMap[wrId] = TB; + } + + } // loopover wires + } // loop over Ls + } // loop over SLs + } // if is the right chamber to book + } // loop over chambers +} + + +void DTAlbertoBenvenutiTask::analyze(const edm::Event& e, const edm::EventSetup& c){ + + nevents++; + if (nevents%1000 == 0 && debug) {} + + edm::Handle dtdigis; + e.getByToken(DTUnpackerToken_, dtdigis); + + bool checkNoisyChannels = parameters.getUntrackedParameter("checkNoisyChannels",false); + ESHandle statusMap; + if(checkNoisyChannels) { + // Get the map of noisy channels + c.get().get(statusMap); + } + + int tdcCount = 0; + DTDigiCollection::DigiRangeIterator dtLayerId_It; + for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){ + for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first; + digiIt!=((*dtLayerId_It).second).second; ++digiIt){ + tdcCount++; + } + } + + bool isSyncNoisy = false; + if (tdcCount > maxTDCHits) isSyncNoisy = true; + + for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){ + for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first; + digiIt!=((*dtLayerId_It).second).second; ++digiIt){ + + bool isNoisy = false; + bool isFEMasked = false; + bool isTDCMasked = false; + bool isTrigMask = false; + bool isDead = false; + bool isNohv = false; + const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire()); + if(checkNoisyChannels) { + statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv); + } + + // for clearness.. +// const DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId(); +// uint32_t indexSL = dtSLId.rawId(); +// const DTChamberId dtChId = dtSLId.chamberId(); +// uint32_t indexCh = dtChId.rawId(); +// int layer_number=((*dtLayerId_It).first).layer(); +// int superlayer_number=dtSLId.superlayer(); +// const DTLayerId dtLId = (*dtLayerId_It).first; +// uint32_t indexL = dtLId.rawId(); + + float t0; float t0RMS; + int tdcTime = (*digiIt).countsTDC(); + + if (parameters.getParameter("performPerWireT0Calibration")) { + const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire()); + t0Map->get(dtWireId, t0, t0RMS, DTTimeUnits::counts) ; + tdcTime += int(round(t0)); + } + + // avoid to fill TB with noise + if ((!isNoisy ) && (!isSyncNoisy)) { + // TimeBoxes per wire + if (TBMap.find(wireId) == TBMap.end()){ + bookHistos(wireId); + TBMap[wireId]->Fill(tdcTime); + } + else + TBMap[wireId]->Fill(tdcTime); + } + } + } +} + + + +// Local Variables: +// show-trailing-whitespace: t +// truncate-lines: t +// End: diff --git a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h1 b/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h1 new file mode 100644 index 0000000000000..98df4e2eb1b63 --- /dev/null +++ b/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h1 @@ -0,0 +1,97 @@ +#ifndef DTAlbertoBenvenutiTask_H +#define DTAlbertoBenvenutiTask_H + + +/* + * \file DTAlbertoBenvenutiTask.h + * + * \author G. Mila - INFN Torino + * +*/ + + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include +#include +#include +#include +#include +#include "FWCore/ParameterSet/interface/ParameterSet.h" +#include + +#include +#include +#include +#include +#include +#include +#include "TH1F.h" + +class DTGeometry; +class DTWireId; +class DTTtrig; +class DTT0; + + +class DTAlbertoBenvenutiTask: public edm::EDAnalyzer{ + +public: + + /// Constructor + DTAlbertoBenvenutiTask(const edm::ParameterSet& ps); + + /// Destructor + virtual ~DTAlbertoBenvenutiTask(); + +protected: + + /// BeginJob + void beginJob(); + + void beginRun(const edm::Run&, const edm::EventSetup&); + + /// Book the ME + void bookHistos(const DTWireId dtWire); + + /// Analyze + void analyze(const edm::Event& e, const edm::EventSetup& c); + + /// Endjob + void endJob(); + +private: + + bool debug; + int nevents; + + /// no needs to be precise. Value from PSets will always be used + int tMax; + int maxTDCHits; + + /// tTrig from the DB + float tTrig; + float tTrigRMS; + float kFactor; + + edm::ParameterSet parameters; + + edm::ESHandle muonGeom; + + edm::ESHandle tTrigMap; + edm::ESHandle t0Map; + + std::string outputFile; + + std::map TBMap; + + //define Token(-s) + edm::EDGetTokenT DTUnpackerToken_; + +}; + +#endif + +/* Local Variables: */ +/* show-trailing-whitespace: t */ +/* truncate-lines: t */ +/* End: */ diff --git a/DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 b/DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 new file mode 100644 index 0000000000000..bc7575a262eed --- /dev/null +++ b/DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 @@ -0,0 +1,31 @@ +/* + * See header file for a description of this class. + * + * \author G. Cerminara - INFN Torino + */ + +#include "DQM/DTMonitorModule/src/DTDataErrorFilter.h" +#include "DQM/DTMonitorModule/interface/DTDataIntegrityTask.h" +#include "FWCore/ServiceRegistry/interface/Service.h" + + +DTDataErrorFilter::DTDataErrorFilter(const edm::ParameterSet & config) : + HLTFilter(config) +{ + // Get the data integrity service + dataMonitor = edm::Service().operator->(); +} + +DTDataErrorFilter::~DTDataErrorFilter(){} + + +bool DTDataErrorFilter::hltFilter(edm::Event& event, const edm::EventSetup& setup, trigger::TriggerFilterObjectWithRefs & filterproduct) const { + // check the event error flag + if (dataMonitor->eventHasErrors()) return true; + return false; +} + +// Local Variables: +// show-trailing-whitespace: t +// truncate-lines: t +// End: diff --git a/DQM/DTMonitorModule/src/DTDataErrorFilter.h1 b/DQM/DTMonitorModule/src/DTDataErrorFilter.h1 new file mode 100644 index 0000000000000..e97728747ae8e --- /dev/null +++ b/DQM/DTMonitorModule/src/DTDataErrorFilter.h1 @@ -0,0 +1,39 @@ +#ifndef DTDataErrorFilter_H +#define DTDataErrorFilter_H + +/** \class DTDataErrorFilter + * No description available. + * + * \author G. Cerminara - INFN Torino + */ + +#include "HLTrigger/HLTcore/interface/HLTFilter.h" + +class DTDataIntegrityTask; + + +class DTDataErrorFilter : public HLTFilter { +public: + /// Constructor + DTDataErrorFilter(const edm::ParameterSet&); + + /// Destructor + virtual ~DTDataErrorFilter(); + + // Operations + virtual bool hltFilter(edm::Event& event, const edm::EventSetup& setup, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; + +protected: + +private: + DTDataIntegrityTask * dataMonitor; + + +}; +#endif + + +/* Local Variables: */ +/* show-trailing-whitespace: t */ +/* truncate-lines: t */ +/* End: */ diff --git a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc1 b/DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc1 new file mode 100644 index 0000000000000..845a864bf92aa --- /dev/null +++ b/DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc1 @@ -0,0 +1,211 @@ + /* + * \file DTDigiForNoiseTask.cc + * + * \author G. Mila - INFN Torino + * + */ + +#include + +// Framework +#include + +// Digis +#include +#include + +// Geometry +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "Geometry/DTGeometry/interface/DTLayer.h" +#include "Geometry/DTGeometry/interface/DTTopology.h" + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" + +#include +#include +#include + +using namespace edm; +using namespace std; + + +DTDigiForNoiseTask::DTDigiForNoiseTask(const edm::ParameterSet& ps){ + + debug = ps.getUntrackedParameter("debug", false); + dtDigisToken_ = consumes( + edm::InputTag(ps.getUntrackedParameter("diDigisLabel", "dtunpacker"))); + + if(debug) + cout<<"[DTDigiForNoiseTask]: Constructor"<().get(muonGeom); + return; +} + +void DTDigiForNoiseTask::bookHistograms(DQMStore::IBooker & ibooker, + edm::Run const & run, + edm::EventSetup const & context) { + + if(debug) + cout<<"[DTDigiForNoiseTask]: boojHistograms"<("ResetCycle", 3) == 0) { + for(map< DTLayerId, MonitorElement* > ::const_iterator histo = digiHistos.begin(); + histo != digiHistos.end(); + histo++) { + (*histo).second->Reset(); + } + } + +} + +void DTDigiForNoiseTask::bookHistos(DQMStore::IBooker & ibooker,const DTLayerId& lId) { + + if (debug) cout<<"[DTDigiForNoiseTask]: booking"<layer(lId)->specificTopology(); + const int firstWire = dtTopo.firstChannel(); + const int lastWire = dtTopo.lastChannel(); + int nWires = lastWire-firstWire+1; + + digiHistos[lId] = ibooker.book2D(histoName,histoName,nWires,firstWire,lastWire,10,-0.5,9.5); + +// dynamic bookings staticized + // Loop over all the chambers + auto ch_it = muonGeom->chambers().begin(); + auto ch_end = muonGeom->chambers().end(); + // Loop over the SLs + for (; ch_it != ch_end; ++ch_it) { + vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + // Loop over the Ls + for(; l_it != l_end; ++l_it) { + DTLayerId layerId = (*l_it)->id(); + + bookHistos(ibooker,layerId); + } + } + } + +} + + +void DTDigiForNoiseTask::analyze(const edm::Event& e, const edm::EventSetup& c){ + + nevents++; + if (nevents%1000 == 0 && debug) {} + + edm::Handle dtdigis; + e.getByToken(dtDigisToken_, dtdigis); + + std::map< int,int > DigiPerWirePerEvent; + + // Loop over all the chambers + auto ch_it = muonGeom->chambers().begin(); + auto ch_end = muonGeom->chambers().end(); + // Loop over the SLs + for (; ch_it != ch_end; ++ch_it) { + vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + // Loop over the Ls + for(; l_it != l_end; ++l_it) { + DTLayerId layerId = (*l_it)->id(); + + DTDigiCollection::Range layerDigi= dtdigis->get(layerId); + if(layerDigi.first != layerDigi.second){ + + const DTTopology& dtTopo = muonGeom->layer(layerId)->specificTopology(); + const int firstWire = dtTopo.firstChannel(); + const int lastWire = dtTopo.lastChannel(); + + if (digiHistos.find(layerId) != digiHistos.end()){ + for (int wire=firstWire; wire-lastWire <= 0; wire++) { + DigiPerWirePerEvent[wire]= 0; + } + + for (DTDigiCollection::const_iterator digi = layerDigi.first; + digi!=layerDigi.second; + ++digi){ + DigiPerWirePerEvent[(*digi).wire()]+=1; + } + + for (int wire=firstWire; wire-lastWire<=0; wire++) { + digiHistos.find(layerId)->second->Fill(wire,DigiPerWirePerEvent[wire]); + } + } + } + + } //Loop Ls + } //Loop SLs + } //Loop over chambers + +} + +// Local Variables: +// show-trailing-whitespace: t +// truncate-lines: t +// End: + + + diff --git a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 b/DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 new file mode 100644 index 0000000000000..3285b9633f2c0 --- /dev/null +++ b/DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 @@ -0,0 +1,90 @@ +#ifndef DTDigiForNoiseTask_H +#define DTDigiForNoiseTask_H + +/* + * \file DTDigiForNoiseTask.h + * + * \author G. Mila - INFN Torino + * +*/ + +#include "FWCore/Framework/interface/Frameworkfwd.h" +#include +#include +#include +#include +#include +#include "FWCore/ParameterSet/interface/ParameterSet.h" + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include +#include "FWCore/ServiceRegistry/interface/Service.h" +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +class DTGeometry; +class DTSuperLayerId; +class DTLayerId; +class DTChamberId; + + +//-class DTDigiForNoiseTask: public edm::EDAnalyzer{ +class DTDigiForNoiseTask: public DQMEDAnalyzer{ + +public: + + /// Constructor + DTDigiForNoiseTask(const edm::ParameterSet& ps); + + /// Destructor + virtual ~DTDigiForNoiseTask(); + +protected: + + /// begin run + void dqmBeginRun(const edm::Run& , const edm::EventSetup&); + + /// bookHistograms + void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; + + + /// Book the ME + void bookHistos(DQMStore::IBooker &, const DTLayerId& dtSL); + + /// To reset the MEs + void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) ; + + /// Analyze + void analyze(const edm::Event& e, const edm::EventSetup& c); + +private: + + bool debug; + int nevents; + + edm::ParameterSet parameters; + + edm::ESHandle muonGeom; + edm::EDGetTokenT dtDigisToken_; // dtunpacker + + std::map< DTLayerId, MonitorElement* > digiHistos; + + +}; + +#endif + +/* Local Variables: */ +/* show-trailing-whitespace: t */ +/* truncate-lines: t */ +/* End: */ diff --git a/DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 b/DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 new file mode 100644 index 0000000000000..e1d7eb92096da --- /dev/null +++ b/DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 @@ -0,0 +1,37 @@ +/* + * \file DTDigiTask.cc + * + * \author M. Zanetti - INFN Padova + * +*/ + +#include +#include "DQMServices/Core/interface/DQMStore.h" + + +using namespace std; + +DTGlobalRecoTask::DTGlobalRecoTask(const edm::ParameterSet& ps, const edm::EventSetup& context){ + logFile.open("DTGlobalRecoTask.log"); + nevents = 0; +} + +DTGlobalRecoTask::~DTGlobalRecoTask(){ + cout << "DTGlobalRecoTask: analyzed " << nevents << " events" << endl; + logFile.close(); +} + + +void DTGlobalRecoTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & context) { + ibooker.setCurrentFolder("DT/DTGlobalRecoTask"); +} + +void DTGlobalRecoTask::analyze(const edm::Event& e, const edm::EventSetup& c){ + nevents++; +} + + +// Local Variables: +// show-trailing-whitespace: t +// truncate-lines: t +// End: diff --git a/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc b/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc new file mode 100644 index 0000000000000..fbdabbae11265 --- /dev/null +++ b/DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.cc @@ -0,0 +1,272 @@ +/* + * \file DTLocalTriggerSynchTask.cc + * + * \author C. Battilana - CIEMAT + * +*/ + +#include "DQM/DTMonitorModule/src/DTLocalTriggerSynchTask.h" + +// Framework +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/Utilities/interface/InputTag.h" + +// Geometry +#include "DataFormats/GeometryVector/interface/Pi.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "Geometry/DTGeometry/interface/DTLayer.h" +#include "Geometry/DTGeometry/interface/DTSuperLayer.h" +#include "Geometry/DTGeometry/interface/DTTopology.h" + +// tTrigs +#include "CalibMuon/DTDigiSync/interface/DTTTrigSyncFactory.h" +#include "CalibMuon/DTDigiSync/interface/DTTTrigBaseSync.h" + +// DT Digi +#include +#include + + +//Root +#include"TH1.h" +#include"TAxis.h" + +#include +#include +#include + + +using namespace edm; +using namespace std; + +DTLocalTriggerSynchTask::DTLocalTriggerSynchTask(const edm::ParameterSet& ps) : nevents(0) { + + edm::LogVerbatim ("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: Constructor" << endl; + parameters = ps; + dcc_Token_ = consumes( + parameters.getParameter("DCCInputTag")); + ddu_Token_ = consumes( + parameters.getParameter("DDUInputTag")); + seg_Token_ = consumes( + parameters.getParameter("SEGInputTag")); + + bxTime = parameters.getParameter("bxTimeInterval"); // CB move this to static const or DB + rangeInBX = parameters.getParameter("rangeWithinBX"); + nBXLow = parameters.getParameter("nBXLow"); + nBXHigh = parameters.getParameter("nBXHigh"); + angleRange = parameters.getParameter("angleRange"); + minHitsPhi = parameters.getParameter("minHitsPhi"); + baseDirectory = parameters.getParameter("baseDir"); +} + + +DTLocalTriggerSynchTask::~DTLocalTriggerSynchTask() { + + edm::LogVerbatim ("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: analyzed " << nevents << " events" << endl; + +} + +void DTLocalTriggerSynchTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & context) { + + edm::LogVerbatim ("DTLocalTriggerSynchTask") <<"[DTLocalTriggerSynchTask]: Book Histograms"<Fill(bxTime); + + tTrigSync = DTTTrigSyncFactory::get()->create(parameters.getParameter("tTrigMode"), + parameters.getParameter("tTrigModeConfig")); + tTrigSync->setES(context); + + + std::vector::const_iterator chambIt = muonGeom->chambers().begin(); + std::vector::const_iterator chambEnd = muonGeom->chambers().end(); + + for (; chambIt!=chambEnd; ++chambIt) { + bookHistos(ibooker,(*chambIt)->id()); + triggerHistos[(*chambIt)->id().rawId()]["tTrig_SL1"]->Fill(tTrigSync->offset(DTWireId((*chambIt)->id(),1,1,2))); + triggerHistos[(*chambIt)->id().rawId()]["tTrig_SL3"]->Fill(tTrigSync->offset(DTWireId((*chambIt)->id(),3,1,2))); + } + + +} + + +void DTLocalTriggerSynchTask::dqmBeginRun(const Run& run, const EventSetup& context) { + + context.get().get(muonGeom); +} + + +void DTLocalTriggerSynchTask::analyze(const edm::Event& event, const edm::EventSetup& context){ + + nevents++; + + InputTag inputTagDCC = parameters.getParameter("DCCInputTag"); + InputTag inputTagDDU = parameters.getParameter("DDUInputTag"); + InputTag inputTagSEG = parameters.getParameter("SEGInputTag"); + + for (int i=0;i<5;++i){ + for (int j=0;j<6;++j){ + for (int k=0;k<13;++k){ + phCodeBestDCC[j][i][k] = -1; + phCodeBestDDU[j][i][k] = -1; + } + } + } + + // Get best DCC triggers + edm::Handle l1DTTPGPh; + event.getByToken(dcc_Token_, l1DTTPGPh); + vector const* phTrigs = l1DTTPGPh->getContainer(); + + vector::const_iterator iph = phTrigs->begin(); + vector::const_iterator iphe = phTrigs->end(); + for(; iph !=iphe ; ++iph) { + + int phwheel = iph->whNum(); + int phsec = iph->scNum() + 1; // DTTF[0-11] -> DT[1-12] Sector Numbering + int phst = iph->stNum(); + int phcode = iph->code(); + + if(phcode>phCodeBestDCC[phwheel+3][phst][phsec] && phcode<7) { + phCodeBestDCC[phwheel+3][phst][phsec]=phcode; + } + + } + + // Get best DDU triggers + Handle trigsDDU; + event.getByToken(ddu_Token_, trigsDDU); + DTLocalTriggerCollection::DigiRangeIterator detUnitIt; + + for (detUnitIt=trigsDDU->begin();detUnitIt!=trigsDDU->end();++detUnitIt){ + + const DTChamberId& id = (*detUnitIt).first; + const DTLocalTriggerCollection::Range& range = (*detUnitIt).second; + + int wh = id.wheel(); + int sec = id.sector(); + int st = id.station(); + + for (DTLocalTriggerCollection::const_iterator trigIt = range.first; trigIt!=range.second;++trigIt){ + + int quality = trigIt->quality(); + + if(quality>-1 && quality<7 && + quality>phCodeBestDDU[wh+3][st][sec]) { + phCodeBestDDU[wh+3][st][sec]=quality; + } + } + } + + //Get best segments (highest number of phi hits) + vector bestSegments4D; + Handle segments4D; + event.getByToken(seg_Token_, segments4D); + DTRecSegment4DCollection::const_iterator track; + DTRecSegment4DCollection::id_iterator chambIdIt; + + for (chambIdIt = segments4D->id_begin(); chambIdIt != segments4D->id_end(); ++chambIdIt){ + + DTRecSegment4DCollection::range range = segments4D->get(*chambIdIt); + const DTRecSegment4D* best=0; + int hitsBest = 0; + int hits = 0; + + for ( track = range.first; track != range.second; ++track){ + if( (*track).hasPhi() ) { + hits = (*track).phiSegment()->degreesOfFreedom()+2; + if ( hits>hitsBest ){ + best = &(*track); + hitsBest = hits; + } + } + } + if (best) { + bestSegments4D.push_back(best); + } + } + + + // Filling histos + vector::const_iterator bestSegIt = bestSegments4D.begin(); + vector::const_iterator bestSegEnd = bestSegments4D.end(); + for (; bestSegIt!=bestSegEnd; ++bestSegIt ){ + + float dir = atan((*bestSegIt)->localDirection().x()/ (*bestSegIt)->localDirection().z())*180/Geom::pi(); // CB cerca un modo migliore x farlo + const DTRecSegment2D* seg2D = (*bestSegIt)->phiSegment(); + int nHitsPhi = seg2D->degreesOfFreedom()+2; + DTChamberId chambId = (*bestSegIt)->chamberId(); + map &innerME = triggerHistos[chambId.rawId()]; + + if (fabs(dir)=minHitsPhi && + seg2D->ist0Valid()){ + + float t0seg = (*bestSegIt)->phiSegment()->t0(); + float tTrig = (tTrigSync->offset(DTWireId(chambId,1,1,2)) + tTrigSync->offset(DTWireId(chambId,3,1,2)) )/2; + float time = tTrig+t0seg; + float htime = rangeInBX ? time-int(time/bxTime)*bxTime : time-int(tTrig/bxTime)*bxTime; + + int wheel = chambId.wheel(); + int sector = chambId.sector(); + int station = chambId.station(); + int scsector = sector>12 ? sector==13 ? 4 : 10 : sector; + + int qualDCC = phCodeBestDCC[wheel+3][station][scsector]; + int qualDDU = phCodeBestDDU[wheel+3][station][scsector]; + + if (fabs(t0seg)>0.01) { + innerME.find("SEG_TrackCrossingTime")->second->Fill(htime); + if ( qualDCC>=0 ) innerME.find("DCC_TrackCrossingTimeAll")->second->Fill(htime); + if ( qualDCC==6 ) innerME.find("DCC_TrackCrossingTimeHH")->second->Fill(htime); + if ( qualDDU>=0 ) innerME.find("DDU_TrackCrossingTimeAll")->second->Fill(htime); + if ( qualDDU==6 ) innerME.find("DDU_TrackCrossingTimeHH")->second->Fill(htime); + } + + } + } + +} + +void DTLocalTriggerSynchTask::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId& dtChId) { + + stringstream wheel; wheel << dtChId.wheel(); + stringstream station; station << dtChId.station(); + stringstream sector; sector << dtChId.sector(); + uint32_t chRawId = dtChId.rawId(); + + ibooker.setCurrentFolder(baseDir() + "/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str() ); + + + string histoTag[5] = { "SEG_TrackCrossingTime", "DCC_TrackCrossingTimeAll", "DCC_TrackCrossingTimeHH", "DDU_TrackCrossingTimeAll", "DDU_TrackCrossingTimeHH" }; + + float min = rangeInBX ? 0 : nBXLow*bxTime; + float max = rangeInBX ? bxTime : nBXHigh*bxTime; + int nbins = static_cast(ceil( rangeInBX ? bxTime : (nBXHigh-nBXLow)*bxTime)); + + for (int iHisto=0;iHisto<5;++iHisto) { + string histoName = histoTag[iHisto] + (rangeInBX ? "InBX" : "") + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + edm::LogVerbatim ("DTLocalTriggerSynchTask") << "[DTLocalTriggerSynchTask]: booking " + << baseDir() + "/Wheel" << wheel.str() + << "/Sector" << sector.str() + << "/Station"<< station.str() + << "/" << histoName << endl; + + triggerHistos[chRawId][histoTag[iHisto]] = ibooker.book1D(histoName.c_str(),"Track time distribution",nbins,min,max); + } + + string floatTag[2] = { "tTrig_SL1", "tTrig_SL3" }; + + for (int iFloat=0;iFloat<2;++iFloat) { + string floatName = floatTag[iFloat] + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + triggerHistos[chRawId][floatTag[iFloat]] = ibooker.bookFloat(floatName); + } + +} + +// Local Variables: +// show-trailing-whitespace: t +// truncate-lines: t +// End: diff --git a/DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 b/DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 new file mode 100644 index 0000000000000..f31cb195b5193 --- /dev/null +++ b/DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 @@ -0,0 +1,73 @@ +/* + * See header file for a description of this class. + * + * \author G. Cerminara - INFN Torino + */ + +#include "DQM/DTMonitorModule/src/DTROMonitorFilter.h" + +#include + +#include +#include +#include + +#include +#include +#include + +using namespace edm; + + +DTROMonitorFilter::DTROMonitorFilter(const edm::ParameterSet& pset) : + HLTFilter(pset) +{ + rawDataToken_ = consumes( + pset.getUntrackedParameter("inputLabel",InputTag("source"))); +} + +DTROMonitorFilter::~DTROMonitorFilter(){} + + +bool DTROMonitorFilter::hltFilter(edm::Event& event, + const edm::EventSetup& setup, + trigger::TriggerFilterObjectWithRefs & filterproduct) const { + // get the raw data + edm::Handle rawdata; + event.getByToken(rawDataToken_, rawdata); + + // Loop over the DT FEDs + int FEDIDmin = FEDNumbering::MINDTFEDID; + int FEDIDMax = FEDNumbering::MAXDTFEDID; + + // Definitions + static const int wordSize_32 = 4; + static const int wordSize_64 = 8; + + for (int dduID=FEDIDmin; dduID<=FEDIDMax; ++dduID) { // loop over all feds + const FEDRawData& feddata = rawdata->FEDData(dduID); + const int datasize = feddata.size(); + if (datasize){ // check the FED payload + const unsigned int* index32 = reinterpret_cast(feddata.data()); + const int numberOf32Words = datasize/wordSize_32; + + const unsigned char* index8 = reinterpret_cast(index32); + + // Check Status Words (1 x ROS) + for (int rosId = 0; rosId < 12; rosId++ ) { + int wordIndex8 = numberOf32Words*wordSize_32 - 3*wordSize_64 + rosId; + DTDDUFirstStatusWord statusWord(index8[wordIndex8]); + // check the error bit + if(statusWord.errorFromROS() != 0) return true; + } + } + } + + // check the event error flag + return false; +} + +// Local Variables: +// show-trailing-whitespace: t +// truncate-lines: t +// End: diff --git a/DQM/DTMonitorModule/src/DTROMonitorFilter.h1 b/DQM/DTMonitorModule/src/DTROMonitorFilter.h1 new file mode 100644 index 0000000000000..f5b3638aaaec6 --- /dev/null +++ b/DQM/DTMonitorModule/src/DTROMonitorFilter.h1 @@ -0,0 +1,39 @@ +#ifndef DTROMonitorFilter_H +#define DTROMonitorFilter_H + +/** \class DTROMonitorFilter.h + * No description available. + * + * \author G. Cerminara - INFN Torino + */ + +#include "HLTrigger/HLTcore/interface/HLTFilter.h" +#include +#include + + +class DTROMonitorFilter : public HLTFilter { +public: + /// Constructor + DTROMonitorFilter(const edm::ParameterSet&); + + /// Destructor + virtual ~DTROMonitorFilter(); + + // Operations + virtual bool hltFilter(edm::Event& event, const edm::EventSetup& setup, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; + +protected: + +private: + /// if not you need the label + edm::EDGetTokenT rawDataToken_; + +}; +#endif + + +/* Local Variables: */ +/* show-trailing-whitespace: t */ +/* truncate-lines: t */ +/* End: */ diff --git a/DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 b/DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 new file mode 100644 index 0000000000000..2714de27eed3e --- /dev/null +++ b/DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 @@ -0,0 +1,240 @@ +/* + * \file DTTestPulsesTask.cc + * + * \author M. Zanetti - INFN Padova + * +*/ + +#include + +// Framework +#include + +// Digis +#include + +// Geometry +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "Geometry/DTGeometry/interface/DTLayer.h" +#include "Geometry/DTGeometry/interface/DTTopology.h" + +// Pedestals +#include +#include +#include +#include +#include "DQMServices/Core/interface/DQMStore.h" + + +using namespace edm; +using namespace std; + + +DTTestPulsesTask::DTTestPulsesTask(const edm::ParameterSet& ps){ + + + cout<<"[DTTestPulseTask]: Constructor"<( + edm::InputTag(ps.getUntrackedParameter("dtdigis", "dtunpacker"))); + + parameters = ps; + + + t0sPeakRange = make_pair( parameters.getUntrackedParameter("t0sRangeLowerBound", -100), + parameters.getUntrackedParameter("t0sRangeUpperBound", 100)); + +} + +DTTestPulsesTask::~DTTestPulsesTask(){ + + cout <<"[DTTestPulsesTask]: analyzed " << nevents << " events" << endl; + +} + +void DTTestPulsesTask::dqmBeginRun(const edm::Run& run, const edm::EventSetup& context) { + + cout<<"[DTTestPulsesTask]: dqmBeginRun"<().get(muonGeom); + nevents = 0; +} + +void DTTestPulsesTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & context) { + + bookHistos( ibooker, string("TPOccupancy"), string("TestPulses") ); + bookHistos( ibooker, string("TPProfile"), string("TestPulses2D") ); + bookHistos( ibooker, string("TPTimeBox"), string("TestPulsesTB") ); +} + +void DTTestPulsesTask::bookHistos(DQMStore::IBooker & ibooker, string folder, string histoTag) { + + cout<<"[DTTestPulseTask]: booking"<::const_iterator ch_it = muonGeom->chambers().begin(); + vector::const_iterator ch_end = muonGeom->chambers().end(); + + for (; ch_it != ch_end; ++ch_it) { + + // Loop over the SLs + vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_it)->superLayers().end(); + + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + stringstream superLayer; superLayer << sl.superlayer(); + + // Loop over the Ls + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + + for(; l_it != l_end; ++l_it) { + DTLayerId layerId = (*l_it)->id(); + stringstream layer; layer << layerId.layer(); + + stringstream superLayer; superLayer << layerId.superlayer(); + stringstream station; station << layerId.superlayerId().chamberId().station(); + stringstream sector; sector << layerId.superlayerId().chamberId().sector(); + stringstream wheel; wheel << layerId.superlayerId().chamberId().wheel(); + + // TP Profiles + if ( folder == "TPProfile" ) { + + const int nWires = (*l_it)->specificTopology().channels(); + + ibooker.setCurrentFolder("DT/DTTestPulsesTask/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + + "/SuperLayer" + superLayer.str() + + "/" +folder); + + string histoName = histoTag + + "_W" + wheel.str() + + "_St" + station.str() + + "_Sec" + sector.str() + + "_SL" + superLayer.str() + + "_L" + layer.str(); + + // Setting the range + if ( parameters.getUntrackedParameter("readDB", false) ) { + t0RangeMap->slRangeT0( layerId.superlayerId() , t0sPeakRange.first, t0sPeakRange.second); + } + + + cout<<"t0sRangeLowerBound "<layer(DTLayerId(layerId.wheel(), + layerId.station(), + layerId.sector(), + layerId.superlayer(), + layerId.layer()))->specificTopology().channels(); + + testPulsesOccupancies[int(DTLayerId(layerId.wheel(), + layerId.station(), + layerId.sector(), + layerId.superlayer(), + layerId.layer()).rawId())] = + ibooker.book1D(histoName, histoName, nWires, 0, nWires); + } + + // Time Box per Chamber + else if ( folder == "TPTimeBox" ) { + + ibooker.setCurrentFolder("DT/DTTestPulsesTask/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + + "/" +folder); + + string histoName = histoTag + + "_W" + wheel.str() + + "_St" + station.str() + + "_Sec" + sector.str(); + + testPulsesTimeBoxes[int( DTLayerId(layerId.wheel(), + layerId.station(), + layerId.sector(), + layerId.superlayer(), + layerId.layer()).chamberId().rawId())] = + ibooker.book1D(histoName, histoName, 10000, 0, 10000); // Overview of the TP (and noise) times + } + + } // close loop on layers + } // close loop on superlayers + } // close loop on chambers +} + + +void DTTestPulsesTask::analyze(const edm::Event& e, const edm::EventSetup& c){ + + nevents++; + + edm::Handle dtdigis; + e.getByToken(dtDigisToken_, dtdigis); + + DTDigiCollection::DigiRangeIterator dtLayerId_It; + for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){ + + for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first; + digiIt!=((*dtLayerId_It).second).second; ++digiIt){ + + // for clearness.. + int layerIndex = ((*dtLayerId_It).first).rawId(); + int chIndex = ((*dtLayerId_It).first).chamberId().rawId(); + + + if ((int)(*digiIt).countsTDC() > t0sPeakRange.first && + (int)(*digiIt).countsTDC() < t0sPeakRange.second ) { + + // Occupancies + + testPulsesOccupancies.find(layerIndex)->second->Fill((*digiIt).wire()); + + // Profiles + + testPulsesProfiles.find(layerIndex)->second->Fill((*digiIt).wire(),(*digiIt).countsTDC()); + } + + // Time Box + + testPulsesTimeBoxes.find(chIndex)->second->Fill((*digiIt).countsTDC()); + } + } + +} + + +// Local Variables: +// show-trailing-whitespace: t +// truncate-lines: t +// End: diff --git a/DQM/DTMonitorModule/src/DTTriggerCheck.cc1 b/DQM/DTMonitorModule/src/DTTriggerCheck.cc1 new file mode 100644 index 0000000000000..226102763282f --- /dev/null +++ b/DQM/DTMonitorModule/src/DTTriggerCheck.cc1 @@ -0,0 +1,79 @@ + +/* + * See header file for a description of this class. + * + * \author S.Bologensi - INFN Torino + */ + +#include "DQM/DTMonitorModule/interface/DTTriggerCheck.h" + +#include "FWCore/Framework/interface/Event.h" + +#include "DQMServices/Core/interface/DQMStore.h" + +#include + +using namespace edm; +using namespace std; + +DTTriggerCheck::DTTriggerCheck(const ParameterSet& pset) : + isLocalRun(pset.getUntrackedParameter("localrun", true)) { + + if (!isLocalRun) { + ltcDigiCollectionToken_ = consumes( + pset.getParameter("ltcDigiCollectionTag")); + } + + debug = pset.getUntrackedParameter("debug",false); + +} + +DTTriggerCheck::~DTTriggerCheck(){ +} + +void DTTriggerCheck::bookHistograms(DQMStore::IBooker & ibooker, + edm::Run const & iRun, + edm::EventSetup const & /* iSetup */) { + ibooker.setCurrentFolder("DT/DTTriggerTask"); + + histo = ibooker.book1D("hNTriggerPerType", + "# of trigger per type",21,-1,20); +} + +void DTTriggerCheck::analyze(const Event& event, const EventSetup& setup) { + if(debug) + cout << "[DTTriggerCheck] Analyze #Run: " << event.id().run() + << " #Event: " << event.id().event() << endl; + + //Get the trigger source from ltc digis + edm::Handle ltcdigis; + if (!isLocalRun) + { + event.getByToken(ltcDigiCollectionToken_, ltcdigis); + for (std::vector::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){ + if (((*ltc_it).HasTriggered(0)) || + ((*ltc_it).HasTriggered(1)) || + ((*ltc_it).HasTriggered(2)) || + ((*ltc_it).HasTriggered(3)) || + ((*ltc_it).HasTriggered(4))) + histo->Fill(-1); + if ((*ltc_it).HasTriggered(0)) + histo->Fill(0); + if ((*ltc_it).HasTriggered(1)) + histo->Fill(1); + if ((*ltc_it).HasTriggered(2)) + histo->Fill(2); + if ((*ltc_it).HasTriggered(3)) + histo->Fill(3); + if ((*ltc_it).HasTriggered(4)) + histo->Fill(4); + } + } + else + histo->Fill(0); +} + +// Local Variables: +// show-trailing-whitespace: t +// truncate-lines: t +// End: From f132b53732da58a23b1d473261c06231668256e7 Mon Sep 17 00:00:00 2001 From: Francesca Cavallo Date: Sat, 25 Apr 2015 17:52:34 +0200 Subject: [PATCH 06/10] restored DTLocalTrigerSynchTask --- .../interface/DTGlobalRecoTask.h1 | 65 ---- .../interface/DTTestPulsesTask.h1 | 90 ----- .../interface/DTTriggerCheck.h1 | 60 ---- .../src/DTAlbertoBenvenutiTask.cc1 | 311 ------------------ .../src/DTAlbertoBenvenutiTask.h1 | 97 ------ DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 | 31 -- DQM/DTMonitorModule/src/DTDataErrorFilter.h1 | 39 --- .../src/DTDigiForNoiseTask.cc1 | 211 ------------ DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 | 90 ----- DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 | 37 --- DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 | 73 ---- DQM/DTMonitorModule/src/DTROMonitorFilter.h1 | 39 --- DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 | 240 -------------- DQM/DTMonitorModule/src/DTTriggerCheck.cc1 | 79 ----- 14 files changed, 1462 deletions(-) delete mode 100644 DQM/DTMonitorModule/interface/DTGlobalRecoTask.h1 delete mode 100644 DQM/DTMonitorModule/interface/DTTestPulsesTask.h1 delete mode 100644 DQM/DTMonitorModule/interface/DTTriggerCheck.h1 delete mode 100644 DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc1 delete mode 100644 DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h1 delete mode 100644 DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 delete mode 100644 DQM/DTMonitorModule/src/DTDataErrorFilter.h1 delete mode 100644 DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc1 delete mode 100644 DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 delete mode 100644 DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 delete mode 100644 DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 delete mode 100644 DQM/DTMonitorModule/src/DTROMonitorFilter.h1 delete mode 100644 DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 delete mode 100644 DQM/DTMonitorModule/src/DTTriggerCheck.cc1 diff --git a/DQM/DTMonitorModule/interface/DTGlobalRecoTask.h1 b/DQM/DTMonitorModule/interface/DTGlobalRecoTask.h1 deleted file mode 100644 index 2fbe3a558888d..0000000000000 --- a/DQM/DTMonitorModule/interface/DTGlobalRecoTask.h1 +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef DTGlobalRecoTask_H -#define DTGlobalRecoTask_H - -/* - * \file DTGlobalRecoTask.h - * - * \author M. Zanetti - INFN Padova - * -*/ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include - -#include -#include - -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include "DQMServices/Core/interface/MonitorElement.h" -#include - -#include -#include -#include - -class DTGlobalRecoTask: public DQMEDAnalyzer{ - -friend class DTMonitorModule; - -public: - -/// Constructor -DTGlobalRecoTask(const edm::ParameterSet& ps, const edm::EventSetup& context); - -/// Destructor -virtual ~DTGlobalRecoTask(); - -protected: - -// Book the histograms -void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - -/// Analyze -void analyze(const edm::Event& e, const edm::EventSetup& c); - - -private: - - int nevents; - - // My monitor elements - - std::ofstream logFile; - -}; - -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/interface/DTTestPulsesTask.h1 b/DQM/DTMonitorModule/interface/DTTestPulsesTask.h1 deleted file mode 100644 index b2df76f197b0c..0000000000000 --- a/DQM/DTMonitorModule/interface/DTTestPulsesTask.h1 +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef DTTestPulsesTask_H -#define DTTestPulsesTask_H - -/* - * \file DTTestPulsesTask.h - * - * \author M. Zanetti - INFN Padova - * -*/ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -class DTGeometry; -class DTLayerId; -class DTRangeT0; - -class DTTestPulsesTask: public DQMEDAnalyzer{ - -public: - - /// Constructor - DTTestPulsesTask(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTTestPulsesTask(); - -protected: - - /// BeginRun - void dqmBeginRun(const edm::Run& , const edm::EventSetup&); - - // Book the histograms - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - - /// Book the ME - void bookHistos(DQMStore::IBooker & ibooker, std::string folder, std::string histoTag); - - /// Analyze - void analyze(const edm::Event& e, const edm::EventSetup& c); - - -private: - - int nevents; - - edm::ParameterSet parameters; - - edm::ESHandle muonGeom; - edm::ESHandle t0RangeMap; - - edm::EDGetTokenT dtDigisToken_; // dtunpacker - std::pair t0sPeakRange; - - // My monitor elements - std::map testPulsesProfiles; - std::map testPulsesOccupancies; - std::map testPulsesTimeBoxes; - - -}; - -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/interface/DTTriggerCheck.h1 b/DQM/DTMonitorModule/interface/DTTriggerCheck.h1 deleted file mode 100644 index 9fd42cd448c58..0000000000000 --- a/DQM/DTMonitorModule/interface/DTTriggerCheck.h1 +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef DTSegmentAnalysis_H -#define DTSegmentAnalysis_H - -/** \class DTTriggerCheck - * - * \author S.Bolognesi - INFN Torino - */ - -#include -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include "FWCore/Utilities/interface/InputTag.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include "DataFormats/LTCDigi/interface/LTCDigi.h" - -#include -#include -#include - -class DQMStore; -class MonitorElement; - -class DTTriggerCheck: public DQMEDAnalyzer{ - -friend class DTMonitorModule; -public: - /// Constructor - DTTriggerCheck(const edm::ParameterSet& pset); - - /// Destructor - virtual ~DTTriggerCheck(); - -/// Analyze -void analyze(const edm::Event& event, const edm::EventSetup& setup); - -void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - -protected: - -private: - - bool debug; - - MonitorElement* histo; - - bool isLocalRun; - edm::EDGetTokenT ltcDigiCollectionToken_; -}; -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc1 b/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc1 deleted file mode 100644 index 0757ae59bfee6..0000000000000 --- a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.cc1 +++ /dev/null @@ -1,311 +0,0 @@ - - -/* - * See header file for a description of this class. - * - * \author G. Mila - INFN Torino - */ - - -#include - -// Framework -#include - -// Digis -#include -#include -#include - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - -// T0s -#include -#include -#include -#include - -#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" -#include "CondFormats/DTObjects/interface/DTStatusFlag.h" - - -#include -#include -#include -#include "TFile.h" -#include "TPostScript.h" -#include "TCanvas.h" - -using namespace edm; -using namespace std; - - -DTAlbertoBenvenutiTask::DTAlbertoBenvenutiTask(const edm::ParameterSet& ps){ - - debug = ps.getUntrackedParameter("debug", false); - if(debug) - cout<<"[DTAlbertoBenvenutiTask]: Constructor"<("outputFile", "DTDigiSources.root"); - maxTDCHits = ps.getUntrackedParameter("maxTDCHits",1000); - - // tMax (not yet from the DB) - tMax = parameters.getParameter("defaultTmax"); - - parameters = ps; - - //set Token(-s) - DTUnpackerToken_ = consumes(std::string("dtunpacker")); -} - - -DTAlbertoBenvenutiTask::~DTAlbertoBenvenutiTask(){ - - if(debug) - cout << "DTAlbertoBenvenutiTask: analyzed " << nevents << " events" << endl; - -} - - -void DTAlbertoBenvenutiTask::endJob(){ - - if(debug) - cout<<"[DTAlbertoBenvenutiTask] endjob called!"< > TBMap_perChamber; - - for(map::const_iterator wHisto = TBMap.begin(); - wHisto != TBMap.end(); - wHisto++) { - DTChamberId chId = (*wHisto).first.layerId().superlayerId().chamberId(); - TBMap_perChamber[chId].push_back((*wHisto).second); - } - - - for(map >::const_iterator Histo = TBMap_perChamber.begin(); - Histo != TBMap_perChamber.end(); - Histo++) { - stringstream station; station << (*Histo).first.station(); - stringstream sector; sector << (*Histo).first.sector(); - stringstream wheel; wheel << (*Histo).first.wheel(); - - string fileTag = "TimeBoxes"; - string fileName = fileTag - + "_W" + wheel.str() - + "_Sec" + sector.str() - + "_St" + station.str() - + ".ps"; - - TPostScript psFile(fileName.c_str(),111); - psFile.Range(20,26); - int counter = 0; - TCanvas c1("c1","",600,780); - c1.Divide(4,4); - psFile.NewPage(); - - cout<<"[DTAlbertoBenvenutiTask] filling the file: "<::const_iterator tbHisto = (*Histo).second.begin(); - tbHisto != (*Histo).second.end(); - tbHisto++) { - counter++; - c1.cd(counter); - (*tbHisto)->Draw(); - if(counter%16 == 0 && counter>=16){ - c1.Update(); - psFile.NewPage(); - c1.Clear(); - c1.Divide(4,4); - counter=0; - } - } // loop over TB histos (divided per chamber) - - } //loop over the chambers - -} - - -void DTAlbertoBenvenutiTask::beginJob(){ - - if(debug) - cout<<"[DTAlbertoBenvenutiTask]: BeginJob"<().get(muonGeom); - - // tTrig - if (parameters.getUntrackedParameter("readDB", true)) - context.get().get(tTrigMap); - - // t0s - if (parameters.getParameter("performPerWireT0Calibration")) - context.get().get(t0Map); - -} - - -void DTAlbertoBenvenutiTask::bookHistos(const DTWireId dtWire) { - - if (debug) cout<<"[DTAlbertoBenvenutiTask]: booking"<::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - // Loop over the SLs - for (; ch_it != ch_end; ++ch_it) { - DTChamberId ch = (*ch_it)->id(); - if(ch == dtWire.layerId().superlayerId().chamberId()){ - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - const int firstWire = muonGeom->layer(layerId)->specificTopology().firstChannel(); - const int lastWire = muonGeom->layer(layerId)->specificTopology().lastChannel(); - // Loop overt the wires - for(int wr=firstWire; wr -lastWire <= 0; wr++) { - - stringstream wire; wire << wr; - DTWireId wrId(layerId, wr); - - string histoTag = "TimeBox"; - string histoName = histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str() - + "_L" + layer.str() - + "_wire" + wire.str(); - - if (debug) cout<<"[DTAlbertoBenvenutiTask]: histoName "<("readDB", false) ) - // ttrig and rms are TDC counts - tTrigMap->get(dtWire.layerId().superlayerId(), tTrig, tTrigRMS, kFactor, - DTTimeUnits::counts); - else tTrig = parameters.getParameter("defaultTtrig"); - - string histoTitle = histoName + " (TDC Counts)"; - int timeBoxGranularity = parameters.getUntrackedParameter("timeBoxGranularity",4); - - if (!parameters.getUntrackedParameter("readDB", true)) { - int maxTDCCounts = 6400 * parameters.getUntrackedParameter("tdcRescale", 1); - TH1F *TB = new TH1F(histoName.c_str(),histoTitle.c_str(), maxTDCCounts/timeBoxGranularity, 0, maxTDCCounts); - TBMap[wrId] = TB; - } - else { - TH1F *TB = new TH1F(histoName.c_str(),histoTitle.c_str(), 2*tMax/timeBoxGranularity, tTrig-tMax, tTrig+2*tMax); - TBMap[wrId] = TB; - } - - } // loopover wires - } // loop over Ls - } // loop over SLs - } // if is the right chamber to book - } // loop over chambers -} - - -void DTAlbertoBenvenutiTask::analyze(const edm::Event& e, const edm::EventSetup& c){ - - nevents++; - if (nevents%1000 == 0 && debug) {} - - edm::Handle dtdigis; - e.getByToken(DTUnpackerToken_, dtdigis); - - bool checkNoisyChannels = parameters.getUntrackedParameter("checkNoisyChannels",false); - ESHandle statusMap; - if(checkNoisyChannels) { - // Get the map of noisy channels - c.get().get(statusMap); - } - - int tdcCount = 0; - DTDigiCollection::DigiRangeIterator dtLayerId_It; - for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){ - for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first; - digiIt!=((*dtLayerId_It).second).second; ++digiIt){ - tdcCount++; - } - } - - bool isSyncNoisy = false; - if (tdcCount > maxTDCHits) isSyncNoisy = true; - - for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){ - for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first; - digiIt!=((*dtLayerId_It).second).second; ++digiIt){ - - bool isNoisy = false; - bool isFEMasked = false; - bool isTDCMasked = false; - bool isTrigMask = false; - bool isDead = false; - bool isNohv = false; - const DTWireId wireId(((*dtLayerId_It).first), (*digiIt).wire()); - if(checkNoisyChannels) { - statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv); - } - - // for clearness.. -// const DTSuperLayerId dtSLId = ((*dtLayerId_It).first).superlayerId(); -// uint32_t indexSL = dtSLId.rawId(); -// const DTChamberId dtChId = dtSLId.chamberId(); -// uint32_t indexCh = dtChId.rawId(); -// int layer_number=((*dtLayerId_It).first).layer(); -// int superlayer_number=dtSLId.superlayer(); -// const DTLayerId dtLId = (*dtLayerId_It).first; -// uint32_t indexL = dtLId.rawId(); - - float t0; float t0RMS; - int tdcTime = (*digiIt).countsTDC(); - - if (parameters.getParameter("performPerWireT0Calibration")) { - const DTWireId dtWireId(((*dtLayerId_It).first), (*digiIt).wire()); - t0Map->get(dtWireId, t0, t0RMS, DTTimeUnits::counts) ; - tdcTime += int(round(t0)); - } - - // avoid to fill TB with noise - if ((!isNoisy ) && (!isSyncNoisy)) { - // TimeBoxes per wire - if (TBMap.find(wireId) == TBMap.end()){ - bookHistos(wireId); - TBMap[wireId]->Fill(tdcTime); - } - else - TBMap[wireId]->Fill(tdcTime); - } - } - } -} - - - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h1 b/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h1 deleted file mode 100644 index 98df4e2eb1b63..0000000000000 --- a/DQM/DTMonitorModule/src/DTAlbertoBenvenutiTask.h1 +++ /dev/null @@ -1,97 +0,0 @@ -#ifndef DTAlbertoBenvenutiTask_H -#define DTAlbertoBenvenutiTask_H - - -/* - * \file DTAlbertoBenvenutiTask.h - * - * \author G. Mila - INFN Torino - * -*/ - - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include - -#include -#include -#include -#include -#include -#include -#include "TH1F.h" - -class DTGeometry; -class DTWireId; -class DTTtrig; -class DTT0; - - -class DTAlbertoBenvenutiTask: public edm::EDAnalyzer{ - -public: - - /// Constructor - DTAlbertoBenvenutiTask(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTAlbertoBenvenutiTask(); - -protected: - - /// BeginJob - void beginJob(); - - void beginRun(const edm::Run&, const edm::EventSetup&); - - /// Book the ME - void bookHistos(const DTWireId dtWire); - - /// Analyze - void analyze(const edm::Event& e, const edm::EventSetup& c); - - /// Endjob - void endJob(); - -private: - - bool debug; - int nevents; - - /// no needs to be precise. Value from PSets will always be used - int tMax; - int maxTDCHits; - - /// tTrig from the DB - float tTrig; - float tTrigRMS; - float kFactor; - - edm::ParameterSet parameters; - - edm::ESHandle muonGeom; - - edm::ESHandle tTrigMap; - edm::ESHandle t0Map; - - std::string outputFile; - - std::map TBMap; - - //define Token(-s) - edm::EDGetTokenT DTUnpackerToken_; - -}; - -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 b/DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 deleted file mode 100644 index bc7575a262eed..0000000000000 --- a/DQM/DTMonitorModule/src/DTDataErrorFilter.cc1 +++ /dev/null @@ -1,31 +0,0 @@ -/* - * See header file for a description of this class. - * - * \author G. Cerminara - INFN Torino - */ - -#include "DQM/DTMonitorModule/src/DTDataErrorFilter.h" -#include "DQM/DTMonitorModule/interface/DTDataIntegrityTask.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - - -DTDataErrorFilter::DTDataErrorFilter(const edm::ParameterSet & config) : - HLTFilter(config) -{ - // Get the data integrity service - dataMonitor = edm::Service().operator->(); -} - -DTDataErrorFilter::~DTDataErrorFilter(){} - - -bool DTDataErrorFilter::hltFilter(edm::Event& event, const edm::EventSetup& setup, trigger::TriggerFilterObjectWithRefs & filterproduct) const { - // check the event error flag - if (dataMonitor->eventHasErrors()) return true; - return false; -} - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTDataErrorFilter.h1 b/DQM/DTMonitorModule/src/DTDataErrorFilter.h1 deleted file mode 100644 index e97728747ae8e..0000000000000 --- a/DQM/DTMonitorModule/src/DTDataErrorFilter.h1 +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef DTDataErrorFilter_H -#define DTDataErrorFilter_H - -/** \class DTDataErrorFilter - * No description available. - * - * \author G. Cerminara - INFN Torino - */ - -#include "HLTrigger/HLTcore/interface/HLTFilter.h" - -class DTDataIntegrityTask; - - -class DTDataErrorFilter : public HLTFilter { -public: - /// Constructor - DTDataErrorFilter(const edm::ParameterSet&); - - /// Destructor - virtual ~DTDataErrorFilter(); - - // Operations - virtual bool hltFilter(edm::Event& event, const edm::EventSetup& setup, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; - -protected: - -private: - DTDataIntegrityTask * dataMonitor; - - -}; -#endif - - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc1 b/DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc1 deleted file mode 100644 index 845a864bf92aa..0000000000000 --- a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.cc1 +++ /dev/null @@ -1,211 +0,0 @@ - /* - * \file DTDigiForNoiseTask.cc - * - * \author G. Mila - INFN Torino - * - */ - -#include - -// Framework -#include - -// Digis -#include -#include - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" - -#include -#include -#include - -using namespace edm; -using namespace std; - - -DTDigiForNoiseTask::DTDigiForNoiseTask(const edm::ParameterSet& ps){ - - debug = ps.getUntrackedParameter("debug", false); - dtDigisToken_ = consumes( - edm::InputTag(ps.getUntrackedParameter("diDigisLabel", "dtunpacker"))); - - if(debug) - cout<<"[DTDigiForNoiseTask]: Constructor"<().get(muonGeom); - return; -} - -void DTDigiForNoiseTask::bookHistograms(DQMStore::IBooker & ibooker, - edm::Run const & run, - edm::EventSetup const & context) { - - if(debug) - cout<<"[DTDigiForNoiseTask]: boojHistograms"<("ResetCycle", 3) == 0) { - for(map< DTLayerId, MonitorElement* > ::const_iterator histo = digiHistos.begin(); - histo != digiHistos.end(); - histo++) { - (*histo).second->Reset(); - } - } - -} - -void DTDigiForNoiseTask::bookHistos(DQMStore::IBooker & ibooker,const DTLayerId& lId) { - - if (debug) cout<<"[DTDigiForNoiseTask]: booking"<layer(lId)->specificTopology(); - const int firstWire = dtTopo.firstChannel(); - const int lastWire = dtTopo.lastChannel(); - int nWires = lastWire-firstWire+1; - - digiHistos[lId] = ibooker.book2D(histoName,histoName,nWires,firstWire,lastWire,10,-0.5,9.5); - -// dynamic bookings staticized - // Loop over all the chambers - auto ch_it = muonGeom->chambers().begin(); - auto ch_end = muonGeom->chambers().end(); - // Loop over the SLs - for (; ch_it != ch_end; ++ch_it) { - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - - bookHistos(ibooker,layerId); - } - } - } - -} - - -void DTDigiForNoiseTask::analyze(const edm::Event& e, const edm::EventSetup& c){ - - nevents++; - if (nevents%1000 == 0 && debug) {} - - edm::Handle dtdigis; - e.getByToken(dtDigisToken_, dtdigis); - - std::map< int,int > DigiPerWirePerEvent; - - // Loop over all the chambers - auto ch_it = muonGeom->chambers().begin(); - auto ch_end = muonGeom->chambers().end(); - // Loop over the SLs - for (; ch_it != ch_end; ++ch_it) { - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - - DTDigiCollection::Range layerDigi= dtdigis->get(layerId); - if(layerDigi.first != layerDigi.second){ - - const DTTopology& dtTopo = muonGeom->layer(layerId)->specificTopology(); - const int firstWire = dtTopo.firstChannel(); - const int lastWire = dtTopo.lastChannel(); - - if (digiHistos.find(layerId) != digiHistos.end()){ - for (int wire=firstWire; wire-lastWire <= 0; wire++) { - DigiPerWirePerEvent[wire]= 0; - } - - for (DTDigiCollection::const_iterator digi = layerDigi.first; - digi!=layerDigi.second; - ++digi){ - DigiPerWirePerEvent[(*digi).wire()]+=1; - } - - for (int wire=firstWire; wire-lastWire<=0; wire++) { - digiHistos.find(layerId)->second->Fill(wire,DigiPerWirePerEvent[wire]); - } - } - } - - } //Loop Ls - } //Loop SLs - } //Loop over chambers - -} - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: - - - diff --git a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 b/DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 deleted file mode 100644 index 3285b9633f2c0..0000000000000 --- a/DQM/DTMonitorModule/src/DTDigiForNoiseTask.h1 +++ /dev/null @@ -1,90 +0,0 @@ -#ifndef DTDigiForNoiseTask_H -#define DTDigiForNoiseTask_H - -/* - * \file DTDigiForNoiseTask.h - * - * \author G. Mila - INFN Torino - * -*/ - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include -#include "FWCore/ServiceRegistry/interface/Service.h" -#include - -#include -#include - -#include -#include -#include -#include -#include -#include - -class DTGeometry; -class DTSuperLayerId; -class DTLayerId; -class DTChamberId; - - -//-class DTDigiForNoiseTask: public edm::EDAnalyzer{ -class DTDigiForNoiseTask: public DQMEDAnalyzer{ - -public: - - /// Constructor - DTDigiForNoiseTask(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTDigiForNoiseTask(); - -protected: - - /// begin run - void dqmBeginRun(const edm::Run& , const edm::EventSetup&); - - /// bookHistograms - void bookHistograms(DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override; - - - /// Book the ME - void bookHistos(DQMStore::IBooker &, const DTLayerId& dtSL); - - /// To reset the MEs - void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) ; - - /// Analyze - void analyze(const edm::Event& e, const edm::EventSetup& c); - -private: - - bool debug; - int nevents; - - edm::ParameterSet parameters; - - edm::ESHandle muonGeom; - edm::EDGetTokenT dtDigisToken_; // dtunpacker - - std::map< DTLayerId, MonitorElement* > digiHistos; - - -}; - -#endif - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 b/DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 deleted file mode 100644 index e1d7eb92096da..0000000000000 --- a/DQM/DTMonitorModule/src/DTGlobalRecoTask.cc1 +++ /dev/null @@ -1,37 +0,0 @@ -/* - * \file DTDigiTask.cc - * - * \author M. Zanetti - INFN Padova - * -*/ - -#include -#include "DQMServices/Core/interface/DQMStore.h" - - -using namespace std; - -DTGlobalRecoTask::DTGlobalRecoTask(const edm::ParameterSet& ps, const edm::EventSetup& context){ - logFile.open("DTGlobalRecoTask.log"); - nevents = 0; -} - -DTGlobalRecoTask::~DTGlobalRecoTask(){ - cout << "DTGlobalRecoTask: analyzed " << nevents << " events" << endl; - logFile.close(); -} - - -void DTGlobalRecoTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & context) { - ibooker.setCurrentFolder("DT/DTGlobalRecoTask"); -} - -void DTGlobalRecoTask::analyze(const edm::Event& e, const edm::EventSetup& c){ - nevents++; -} - - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 b/DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 deleted file mode 100644 index f31cb195b5193..0000000000000 --- a/DQM/DTMonitorModule/src/DTROMonitorFilter.cc1 +++ /dev/null @@ -1,73 +0,0 @@ -/* - * See header file for a description of this class. - * - * \author G. Cerminara - INFN Torino - */ - -#include "DQM/DTMonitorModule/src/DTROMonitorFilter.h" - -#include - -#include -#include -#include - -#include -#include -#include - -using namespace edm; - - -DTROMonitorFilter::DTROMonitorFilter(const edm::ParameterSet& pset) : - HLTFilter(pset) -{ - rawDataToken_ = consumes( - pset.getUntrackedParameter("inputLabel",InputTag("source"))); -} - -DTROMonitorFilter::~DTROMonitorFilter(){} - - -bool DTROMonitorFilter::hltFilter(edm::Event& event, - const edm::EventSetup& setup, - trigger::TriggerFilterObjectWithRefs & filterproduct) const { - // get the raw data - edm::Handle rawdata; - event.getByToken(rawDataToken_, rawdata); - - // Loop over the DT FEDs - int FEDIDmin = FEDNumbering::MINDTFEDID; - int FEDIDMax = FEDNumbering::MAXDTFEDID; - - // Definitions - static const int wordSize_32 = 4; - static const int wordSize_64 = 8; - - for (int dduID=FEDIDmin; dduID<=FEDIDMax; ++dduID) { // loop over all feds - const FEDRawData& feddata = rawdata->FEDData(dduID); - const int datasize = feddata.size(); - if (datasize){ // check the FED payload - const unsigned int* index32 = reinterpret_cast(feddata.data()); - const int numberOf32Words = datasize/wordSize_32; - - const unsigned char* index8 = reinterpret_cast(index32); - - // Check Status Words (1 x ROS) - for (int rosId = 0; rosId < 12; rosId++ ) { - int wordIndex8 = numberOf32Words*wordSize_32 - 3*wordSize_64 + rosId; - DTDDUFirstStatusWord statusWord(index8[wordIndex8]); - // check the error bit - if(statusWord.errorFromROS() != 0) return true; - } - } - } - - // check the event error flag - return false; -} - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTROMonitorFilter.h1 b/DQM/DTMonitorModule/src/DTROMonitorFilter.h1 deleted file mode 100644 index f5b3638aaaec6..0000000000000 --- a/DQM/DTMonitorModule/src/DTROMonitorFilter.h1 +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef DTROMonitorFilter_H -#define DTROMonitorFilter_H - -/** \class DTROMonitorFilter.h - * No description available. - * - * \author G. Cerminara - INFN Torino - */ - -#include "HLTrigger/HLTcore/interface/HLTFilter.h" -#include -#include - - -class DTROMonitorFilter : public HLTFilter { -public: - /// Constructor - DTROMonitorFilter(const edm::ParameterSet&); - - /// Destructor - virtual ~DTROMonitorFilter(); - - // Operations - virtual bool hltFilter(edm::Event& event, const edm::EventSetup& setup, trigger::TriggerFilterObjectWithRefs & filterproduct) const override; - -protected: - -private: - /// if not you need the label - edm::EDGetTokenT rawDataToken_; - -}; -#endif - - -/* Local Variables: */ -/* show-trailing-whitespace: t */ -/* truncate-lines: t */ -/* End: */ diff --git a/DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 b/DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 deleted file mode 100644 index 2714de27eed3e..0000000000000 --- a/DQM/DTMonitorModule/src/DTTestPulsesTask.cc1 +++ /dev/null @@ -1,240 +0,0 @@ -/* - * \file DTTestPulsesTask.cc - * - * \author M. Zanetti - INFN Padova - * -*/ - -#include - -// Framework -#include - -// Digis -#include - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - -// Pedestals -#include -#include -#include -#include -#include "DQMServices/Core/interface/DQMStore.h" - - -using namespace edm; -using namespace std; - - -DTTestPulsesTask::DTTestPulsesTask(const edm::ParameterSet& ps){ - - - cout<<"[DTTestPulseTask]: Constructor"<( - edm::InputTag(ps.getUntrackedParameter("dtdigis", "dtunpacker"))); - - parameters = ps; - - - t0sPeakRange = make_pair( parameters.getUntrackedParameter("t0sRangeLowerBound", -100), - parameters.getUntrackedParameter("t0sRangeUpperBound", 100)); - -} - -DTTestPulsesTask::~DTTestPulsesTask(){ - - cout <<"[DTTestPulsesTask]: analyzed " << nevents << " events" << endl; - -} - -void DTTestPulsesTask::dqmBeginRun(const edm::Run& run, const edm::EventSetup& context) { - - cout<<"[DTTestPulsesTask]: dqmBeginRun"<().get(muonGeom); - nevents = 0; -} - -void DTTestPulsesTask::bookHistograms(DQMStore::IBooker & ibooker, edm::Run const & iRun, edm::EventSetup const & context) { - - bookHistos( ibooker, string("TPOccupancy"), string("TestPulses") ); - bookHistos( ibooker, string("TPProfile"), string("TestPulses2D") ); - bookHistos( ibooker, string("TPTimeBox"), string("TestPulsesTB") ); -} - -void DTTestPulsesTask::bookHistos(DQMStore::IBooker & ibooker, string folder, string histoTag) { - - cout<<"[DTTestPulseTask]: booking"<::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - - for (; ch_it != ch_end; ++ch_it) { - - // Loop over the SLs - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - - // Loop over the Ls - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - stringstream superLayer; superLayer << layerId.superlayer(); - stringstream station; station << layerId.superlayerId().chamberId().station(); - stringstream sector; sector << layerId.superlayerId().chamberId().sector(); - stringstream wheel; wheel << layerId.superlayerId().chamberId().wheel(); - - // TP Profiles - if ( folder == "TPProfile" ) { - - const int nWires = (*l_it)->specificTopology().channels(); - - ibooker.setCurrentFolder("DT/DTTestPulsesTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + - "/SuperLayer" + superLayer.str() + - "/" +folder); - - string histoName = histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str() - + "_L" + layer.str(); - - // Setting the range - if ( parameters.getUntrackedParameter("readDB", false) ) { - t0RangeMap->slRangeT0( layerId.superlayerId() , t0sPeakRange.first, t0sPeakRange.second); - } - - - cout<<"t0sRangeLowerBound "<layer(DTLayerId(layerId.wheel(), - layerId.station(), - layerId.sector(), - layerId.superlayer(), - layerId.layer()))->specificTopology().channels(); - - testPulsesOccupancies[int(DTLayerId(layerId.wheel(), - layerId.station(), - layerId.sector(), - layerId.superlayer(), - layerId.layer()).rawId())] = - ibooker.book1D(histoName, histoName, nWires, 0, nWires); - } - - // Time Box per Chamber - else if ( folder == "TPTimeBox" ) { - - ibooker.setCurrentFolder("DT/DTTestPulsesTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + - "/" +folder); - - string histoName = histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str(); - - testPulsesTimeBoxes[int( DTLayerId(layerId.wheel(), - layerId.station(), - layerId.sector(), - layerId.superlayer(), - layerId.layer()).chamberId().rawId())] = - ibooker.book1D(histoName, histoName, 10000, 0, 10000); // Overview of the TP (and noise) times - } - - } // close loop on layers - } // close loop on superlayers - } // close loop on chambers -} - - -void DTTestPulsesTask::analyze(const edm::Event& e, const edm::EventSetup& c){ - - nevents++; - - edm::Handle dtdigis; - e.getByToken(dtDigisToken_, dtdigis); - - DTDigiCollection::DigiRangeIterator dtLayerId_It; - for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){ - - for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first; - digiIt!=((*dtLayerId_It).second).second; ++digiIt){ - - // for clearness.. - int layerIndex = ((*dtLayerId_It).first).rawId(); - int chIndex = ((*dtLayerId_It).first).chamberId().rawId(); - - - if ((int)(*digiIt).countsTDC() > t0sPeakRange.first && - (int)(*digiIt).countsTDC() < t0sPeakRange.second ) { - - // Occupancies - - testPulsesOccupancies.find(layerIndex)->second->Fill((*digiIt).wire()); - - // Profiles - - testPulsesProfiles.find(layerIndex)->second->Fill((*digiIt).wire(),(*digiIt).countsTDC()); - } - - // Time Box - - testPulsesTimeBoxes.find(chIndex)->second->Fill((*digiIt).countsTDC()); - } - } - -} - - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: diff --git a/DQM/DTMonitorModule/src/DTTriggerCheck.cc1 b/DQM/DTMonitorModule/src/DTTriggerCheck.cc1 deleted file mode 100644 index 226102763282f..0000000000000 --- a/DQM/DTMonitorModule/src/DTTriggerCheck.cc1 +++ /dev/null @@ -1,79 +0,0 @@ - -/* - * See header file for a description of this class. - * - * \author S.Bologensi - INFN Torino - */ - -#include "DQM/DTMonitorModule/interface/DTTriggerCheck.h" - -#include "FWCore/Framework/interface/Event.h" - -#include "DQMServices/Core/interface/DQMStore.h" - -#include - -using namespace edm; -using namespace std; - -DTTriggerCheck::DTTriggerCheck(const ParameterSet& pset) : - isLocalRun(pset.getUntrackedParameter("localrun", true)) { - - if (!isLocalRun) { - ltcDigiCollectionToken_ = consumes( - pset.getParameter("ltcDigiCollectionTag")); - } - - debug = pset.getUntrackedParameter("debug",false); - -} - -DTTriggerCheck::~DTTriggerCheck(){ -} - -void DTTriggerCheck::bookHistograms(DQMStore::IBooker & ibooker, - edm::Run const & iRun, - edm::EventSetup const & /* iSetup */) { - ibooker.setCurrentFolder("DT/DTTriggerTask"); - - histo = ibooker.book1D("hNTriggerPerType", - "# of trigger per type",21,-1,20); -} - -void DTTriggerCheck::analyze(const Event& event, const EventSetup& setup) { - if(debug) - cout << "[DTTriggerCheck] Analyze #Run: " << event.id().run() - << " #Event: " << event.id().event() << endl; - - //Get the trigger source from ltc digis - edm::Handle ltcdigis; - if (!isLocalRun) - { - event.getByToken(ltcDigiCollectionToken_, ltcdigis); - for (std::vector::const_iterator ltc_it = ltcdigis->begin(); ltc_it != ltcdigis->end(); ltc_it++){ - if (((*ltc_it).HasTriggered(0)) || - ((*ltc_it).HasTriggered(1)) || - ((*ltc_it).HasTriggered(2)) || - ((*ltc_it).HasTriggered(3)) || - ((*ltc_it).HasTriggered(4))) - histo->Fill(-1); - if ((*ltc_it).HasTriggered(0)) - histo->Fill(0); - if ((*ltc_it).HasTriggered(1)) - histo->Fill(1); - if ((*ltc_it).HasTriggered(2)) - histo->Fill(2); - if ((*ltc_it).HasTriggered(3)) - histo->Fill(3); - if ((*ltc_it).HasTriggered(4)) - histo->Fill(4); - } - } - else - histo->Fill(0); -} - -// Local Variables: -// show-trailing-whitespace: t -// truncate-lines: t -// End: From 3970f810d775e532be99891cbc01c2ee25f7f132 Mon Sep 17 00:00:00 2001 From: Francesca Cavallo Date: Sat, 25 Apr 2015 18:52:58 +0200 Subject: [PATCH 07/10] restored DTResolutionTest --- .../src/#DTRunConditionVarClient.cc# | 343 ++++++++ .../src/DTCreateSummaryHistos.cc1 | 713 ++++++++++++++++ DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 | 226 +++++ DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 | 203 +++++ .../src/DTLocalTriggerSynchTest.cc | 287 +++++++ DQM/DTMonitorClient/src/DTNoiseTest.cc1 | 314 +++++++ DQM/DTMonitorClient/src/DTResolutionTest.cc | 782 ++++++++++++++++++ .../src/DTtTrigCalibrationTest.cc1 | 277 +++++++ 8 files changed, 3145 insertions(+) create mode 100644 DQM/DTMonitorClient/src/#DTRunConditionVarClient.cc# create mode 100644 DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc1 create mode 100644 DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 create mode 100644 DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 create mode 100644 DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.cc create mode 100644 DQM/DTMonitorClient/src/DTNoiseTest.cc1 create mode 100644 DQM/DTMonitorClient/src/DTResolutionTest.cc create mode 100644 DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc1 diff --git a/DQM/DTMonitorClient/src/#DTRunConditionVarClient.cc# b/DQM/DTMonitorClient/src/#DTRunConditionVarClient.cc# new file mode 100644 index 0000000000000..0e356865eabf3 --- /dev/null +++ b/DQM/DTMonitorClient/src/#DTRunConditionVarClient.cc# @@ -0,0 +1,343 @@ +/******* \class DTRunConditionVarClient ******* + * + * Description: + * + * detailed description + * + * \author : Paolo Bellan, Antonio Branca + * $date : 23/09/2011 15:42:04 CET $ + * + * Modification: + * + * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my + * + * + *********************************/ + +#include +#include +#include + +#include +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" + +#include +#include +#include + +using namespace edm; +using namespace std; + +DTRunConditionVarClient::DTRunConditionVarClient(const ParameterSet& pSet) +{ + + LogVerbatim ("DTDQM|DTMonitorClient|DTRunConditionVarClient") + << "DTRunConditionVarClient: Constructor called"; + + + minRangeVDrift = pSet.getUntrackedParameter("minRangeVDrift"); + maxRangeVDrift = pSet.getUntrackedParameter("maxRangeVDrift"); + minRangeT0 = pSet.getUntrackedParameter("minRangeT0"); + maxRangeT0 = pSet.getUntrackedParameter("maxRangeT0"); + + maxGoodVDriftDev = pSet.getUntrackedParameter("maxGoodVDriftDev"); + minBadVDriftDev = pSet.getUntrackedParameter("minBadVDriftDev"); + maxGoodT0 = pSet.getUntrackedParameter("maxGoodT0"); + minBadT0 = pSet.getUntrackedParameter("minBadT0"); + + maxGoodVDriftSigma = pSet.getUntrackedParameter("maxGoodVDriftSigma"); + minBadVDriftSigma = pSet.getUntrackedParameter("minBadVDriftSigma"); + maxGoodT0Sigma = pSet.getUntrackedParameter("maxGoodT0Sigma"); + minBadT0Sigma = pSet.getUntrackedParameter("minBadT0Sigma"); + + nevents = 0; + + bookingdone = 0; + +} + +DTRunConditionVarClient::~DTRunConditionVarClient() +{ + LogVerbatim ("DTDQM|DTMonitorClient|DTRunConditionVarClient") + << "DTRunConditionVarClient: Destructor called"; +} + +void DTRunConditionVarClient::beginRun(const Run& run, const EventSetup& context){ + + LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<"[DTRunConditionVarClient]: BeginRun"; + // Get the map of vdrift from the setup + context.get().get(mTime); + mTimeMap_ = &*mTime; +} + + + + void DTRunConditionVarClient::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, + edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) +{ + +} + +void DTRunConditionVarClient::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) +{ + LogVerbatim ("DTDQM|DTMonitorClient|DTRunConditionVarClient") + << "DTRunConditionVarClient: end job"; + + ibooker.setCurrentFolder("DT/02-Segments"); + + glbVDriftSummary = ibooker.book2D("VDriftGlbSummary", "# of MBs with good mean and good sigma of vDrift",12,1,13,5,-2,3); + glbT0Summary = ibooker.book2D("T0GlbSummary", "# of MBs with good mean and good sigma of t0",12,1,13,5,-2,3); + + ibooker.setCurrentFolder("DT/02-Segments/02-MeanVDrift"); + + summaryHistos["MeanVDriftGlbSummary"] = ibooker.book2D("MeanVDriftGlbSummary","mean VDrift average per sector",12,1.,13.,5,-2.,3.); + allwheelHistos["allMeanVDrift"] = ibooker.book1D("VDriftMeanAllWheels","mean VDrift for all chambers",60,0.0048,0.006); + + ibooker.setCurrentFolder("DT/02-Segments/02-SigmaVDrift"); + + summaryHistos["SigmaVDriftGlbSummary"] = ibooker.book2D("SigmaVDriftGlbSummary","# of Chambers with good sigma VDrift",12,1.,13.,5,-2.,3.); + allwheelHistos["allSigmaVDrift"] = ibooker.book1D("VDriftSigmaAllWheels","sigma VDrift for all chambers",30,0.,0.0006); + + ibooker.setCurrentFolder("DT/02-Segments/03-MeanT0"); + + summaryHistos["MeanT0GlbSummary"] = ibooker.book2D("MeanT0GlbSummary","mean T0 average per sector",12,1.,13.,5,-2.,3.); + allwheelHistos["allMeanT0"] = ibooker.book1D("T0MeanAllWheels","mean T0 for all chambers",100,-25.,25.); + + ibooker.setCurrentFolder("DT/02-Segments/03-SigmaT0"); + + summaryHistos["SigmaT0GlbSummary"] = ibooker.book2D("SigmaT0GlbSummary","# of Chambers with good sigma T0",12,1.,13.,5,-2.,3.); + allwheelHistos["allSigmaT0"] = ibooker.book1D("T0SigmaAllWheels","sigma T0 for alla chambers",50,0,25); + + for(int wh=-2; wh<=2; wh++) { + bookWheelHistos(ibooker,"MeanVDrift","02-MeanVDrift",wh,60,0.0048,0.006,true); + bookWheelHistos(ibooker,"SigmaVDrift","02-SigmaVDrift",wh,30,0.,0.0006); + bookWheelHistos(ibooker,"MeanT0","03-MeanT0",wh,100,-25.,25.); + bookWheelHistos(ibooker,"SigmaT0","03-SigmaT0",wh,50,0,25); + } + + + for(int wheel=-2;wheel<=2;wheel++){ + for(int sec=1; sec<=14; sec++) { + for(int stat=1; stat<=4; stat++) { + + if( (sec == 13 || sec == 14) && stat != 4 ) continue; + + // Get the ME produced by DTRunConditionVar Source + MonitorElement* VDriftME = getChamberHistos(igetter,DTChamberId(wheel,stat,sec),"VDrift_FromSegm"); + MonitorElement* T0ME = getChamberHistos(igetter,DTChamberId(wheel,stat,sec),"T0_FromSegm"); + + if (!VDriftME || !T0ME) { + edm::LogWarning("DTRunConditionVarClient") << "ME not available" << std::endl; + return; + } + + + // Get the means per chamber + float vDriftMean = VDriftME->getMean(); + float t0Mean = T0ME->getMean(); + + // Get the sigma per chamber + float vDriftSigma = VDriftME->getRMS(); + float t0Sigma = T0ME->getRMS(); + + if( VDriftME->getEntries() != 0 ) { + + allwheelHistos["allMeanVDrift"] -> Fill(vDriftMean); + allwheelHistos["allSigmaVDrift"] -> Fill(vDriftSigma); + + (wheelHistos[wheel])["MeanVDrift"] -> Fill(vDriftMean); + (wheelHistos[wheel])["SigmaVDrift"] -> Fill(vDriftSigma); + + } + + + if( T0ME->getEntries() != 0 ) { + + allwheelHistos["allMeanT0"] -> Fill(t0Mean); + allwheelHistos["allSigmaT0"] -> Fill(t0Sigma); + + (wheelHistos[wheel])["MeanT0"] -> Fill(t0Mean); + (wheelHistos[wheel])["SigmaT0"] -> Fill(t0Sigma); + + } + + DTChamberId indexCh(wheel,stat,sec); + + float vDriftDev(0.), errvDriftDev(0.); + percDevVDrift(indexCh, vDriftMean, vDriftSigma, vDriftDev, errvDriftDev); + + int sec_ = sec; + if( sec == 13 || sec == 14 ) sec_ = ( sec == 13 ) ? 4 : 10; + + float fillvDriftDev = max(min(vDriftDev,maxRangeVDrift),minRangeVDrift); + float fillT0Mean = max(min(t0Mean,maxRangeT0),minRangeT0); + + float vDriftDevQ = varQuality(fabs(vDriftDev),maxGoodVDriftDev,minBadVDriftDev); + float t0MeanQ = varQuality(fabs(t0Mean),maxGoodT0,minBadT0); + + float vDriftSigmQ = varQuality(vDriftSigma,maxGoodVDriftSigma,minBadVDriftSigma); + float t0SigmQ = varQuality(t0Sigma,maxGoodT0Sigma,minBadT0Sigma); + + if( sec == 13 || sec == 14 ) { + + float binVDriftDev = (wheelHistos[wheel])["MeanVDriftSummary"]->getBinContent(sec_,stat); + binVDriftDev = (fabs(binVDriftDev) > fabs(fillvDriftDev)) ? binVDriftDev : fillvDriftDev; + (wheelHistos[wheel])["MeanVDriftSummary"] -> setBinContent(sec_,stat,binVDriftDev); + + float binT0MeanVal = (wheelHistos[wheel])["MeanT0Summary"] -> getBinContent(sec_,stat); + binT0MeanVal = (fabs(binT0MeanVal) > fabs(fillT0Mean)) ? binT0MeanVal : fillT0Mean; + (wheelHistos[wheel])["MeanT0Summary"] -> setBinContent(sec_,stat,binT0MeanVal); + + float binVDriftSigmVal = (wheelHistos[wheel])["SigmaVDriftSummary"] -> getBinContent(sec_,stat); + binVDriftSigmVal = (binVDriftSigmVal > 0. && binVDriftSigmVal < vDriftSigmQ) ? binVDriftSigmVal : vDriftSigmQ; + (wheelHistos[wheel])["SigmaVDriftSummary"] -> setBinContent(sec_,stat,binVDriftSigmVal); + + float binT0SigmVal = (wheelHistos[wheel])["SigmaT0Summary"] -> getBinContent(sec_,stat); + binT0SigmVal = (binT0SigmVal > 0. && binT0SigmVal < t0SigmQ) ? binT0SigmVal : t0SigmQ; + (wheelHistos[wheel])["SigmaT0Summary"] -> setBinContent(sec_,stat,binT0SigmVal); + + } else { + + (wheelHistos[wheel])["MeanVDriftSummary"] -> setBinContent(sec_,stat,fillvDriftDev); + (wheelHistos[wheel])["MeanT0Summary"] -> setBinContent(sec_,stat,fillT0Mean); + (wheelHistos[wheel])["SigmaVDriftSummary"] -> setBinContent(sec_,stat,vDriftSigmQ); + (wheelHistos[wheel])["SigmaT0Summary"] -> setBinContent(sec_,stat,t0SigmQ); + + } + + double weight = 1/4.; + if(( sec_ == 4 || sec_ == 10) && stat == 4) weight = 1/8.; + + if( vDriftDevQ > 0.85 && vDriftSigmQ > 0.85 ) { + glbVDriftSummary -> Fill(sec_,wheel,weight); + summaryHistos["MeanVDriftGlbSummary"] -> Fill(sec_,wheel,weight); + summaryHistos["SigmaVDriftGlbSummary"] -> Fill(sec_,wheel,weight); + + } else { + if( vDriftDevQ > 0.85 && vDriftSigmQ < 0.85 ) { + summaryHistos["MeanVDriftGlbSummary"] -> Fill(sec_,wheel,weight); + } + if( vDriftDevQ < 0.85 && vDriftSigmQ > 0.85 ) { + summaryHistos["SigmaVDriftGlbSummary"] -> Fill(sec_,wheel,weight); + } + } + + if( t0MeanQ > 0.85 && t0SigmQ > 0.85 ) { + glbT0Summary -> Fill(sec_,wheel,weight); + summaryHistos["MeanT0GlbSummary"] -> Fill(sec_,wheel,weight); + summaryHistos["SigmaT0GlbSummary"] -> Fill(sec_,wheel,weight); + } else { + if( t0MeanQ > 0.85 && t0SigmQ < 0.85 ) { + summaryHistos["MeanT0GlbSummary"] -> Fill(sec_,wheel,weight); + + } + if( t0MeanQ < 0.85 && t0SigmQ > 0.85 ) { + summaryHistos["SigmaT0GlbSummary"] -> Fill(sec_,wheel,weight); + } + } + + + }// end loop on stations + }// end loop on sectors + }//end loop on wheels + + return; +} + +float DTRunConditionVarClient::varQuality(float var, float maxGood, float minBad) { + + float qual(0); + if( var <= maxGood ) {qual = 1.;} + else if( var > maxGood && var < minBad ) {qual = 0.9;} + else if( var >= minBad ) {qual = 0.1;} + + return qual; +} + +void DTRunConditionVarClient::percDevVDrift(DTChamberId indexCh, float meanVD, float sigmaVD, float& devVD, float& errdevVD) { + + DTSuperLayerId indexSLPhi1(indexCh,1); + DTSuperLayerId indexSLPhi2(indexCh,3); + + float vDriftPhi1(0.), vDriftPhi2(0.); + float ResPhi1(0.), ResPhi2(0.); + int status1 = mTimeMap_->get(indexSLPhi1,vDriftPhi1,ResPhi1,DTVelocityUnits::cm_per_ns); + int status2 = mTimeMap_->get(indexSLPhi2,vDriftPhi2,ResPhi2,DTVelocityUnits::cm_per_ns); + + if(status1 != 0 || status2 != 0) { + DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2; + throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for" + << sl << endl; + } + + float vDriftMed = (vDriftPhi1 + vDriftPhi2) / 2.; + + devVD = (meanVD - vDriftMed) / vDriftMed; + devVD = devVD < 1. ? devVD : 1.; + + errdevVD = sigmaVD/vDriftMed; + + return; +} + +void DTRunConditionVarClient::bookWheelHistos(DQMStore::IBooker & ibooker, string histoType, string subfolder, + int wh, int nbins, float min, float max, bool isVDCorr ) +{ + stringstream wheel; wheel << wh; + + string folder = "DT/02-Segments/" + subfolder; + + ibooker.setCurrentFolder(folder); + + string histoName = histoType + "_W" + wheel.str(); + string histoLabel = histoType; + + (wheelHistos[wh])[histoType] = ibooker.book1D(histoName, histoLabel, nbins, min, max); + + if( isVDCorr ) { + histoLabel = "Summary of corrections to VDrift DB values"; + histoName = "CorrTo" + histoType + "Summary_W" + wheel.str(); + } else { + histoLabel = histoType + "Summary"; + histoName = histoType + "Summary_W" + wheel.str(); + } + + MonitorElement* me = ibooker.book2D(histoName, histoLabel,12,1,13,4,1,5); + + me->setBinLabel(1,"MB1",2); + me->setBinLabel(2,"MB2",2); + me->setBinLabel(3,"MB3",2); + me->setBinLabel(4,"MB4",2); + me->setAxisTitle("Sector",1); + + (wheelHistos[wh])[histoType + "Summary"] = me; + + return; +} + +MonitorElement* DTRunConditionVarClient::getChamberHistos(DQMStore::IGetter & igetter,const DTChamberId& dtCh, string histoType) { + + int wh = dtCh.wheel(); + int sc = dtCh.sector(); + int st = dtCh.station(); + stringstream wheel; wheel << wh; + stringstream station; station << st; + stringstream sector; sector << sc; + + string folder = "DT/02-Segments/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str(); + string histoTag = "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + string MEpath = folder + "/" + histoType + histoTag; + + igetter.setCurrentFolder(folder); + + LogTrace ("DTDQM|DTMonitorModule|DTRunConditionVar") + << "[DTRunConditionVar]: getting ME from " << folder << endl; + + MonitorElement* ME = igetter.get(MEpath); + + return ME; +} diff --git a/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc1 b/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc1 new file mode 100644 index 0000000000000..cad3965c88c18 --- /dev/null +++ b/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc1 @@ -0,0 +1,713 @@ +/* + * See header file for a description of this class. + * + * \author G. Mila - INFN Torino + * + * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah ncpp-um-my + * + */ + + +#include + +// Framework +#include + + +// Geometry +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "Geometry/DTGeometry/interface/DTLayer.h" + +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include +#include +#include + +#include "TCanvas.h" +#include "TFile.h" +#include "TProfile.h" + +using namespace edm; +using namespace std; + +DTCreateSummaryHistos::DTCreateSummaryHistos(const edm::ParameterSet& ps){ + + edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos]: Constructor"; + + parameters = ps; + + // The root file which contain the histos + string rootFileName = ps.getUntrackedParameter("rootFileName", "DTEfficiencyTest.root"); + theFile = new TFile(rootFileName.c_str(), "READ"); + + // The *.ps file which contains the summary histos + PsFileName = ps.getUntrackedParameter("PsFileName", "DTSummaryHistos"); + + // Files to write in the *.ps file + DataIntegrityHistos = ps.getUntrackedParameter("DataIntegrityHistos", false); + DigiHistos = ps.getUntrackedParameter("DigiHistos", false); + RecoHistos = ps.getUntrackedParameter("RecoHistos", false); + ResoHistos = ps.getUntrackedParameter("ResoHistos", false); + EfficiencyHistos = ps.getUntrackedParameter("EfficiencyHistos", false); + TestPulsesHistos = ps.getUntrackedParameter("TestPulsesHistos", false); + TriggerHistos = ps.getUntrackedParameter("TriggerHistos", false); + + // The DDU Id + DDUId = ps.getUntrackedParameter("DDUId"); + + MainFolder = "DQMData/DT/"; + + nevents = 0; + +} + +DTCreateSummaryHistos::~DTCreateSummaryHistos(){ + + edm::LogVerbatim ("histos") << "DTCreateSummaryHistos: analyzed " << nevents << " events"; + theFile->Close(); + +} + +void DTCreateSummaryHistos::beginRun(const edm::Run& run, const edm::EventSetup& context){ + + // Get the geometry + context.get().get(muonGeom); + +} + +void DTCreateSummaryHistos::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { + + edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos] endjob called!"; + + stringstream RunNum; RunNum << runNumber; + string PsFileNameWithRun = PsFileName + "_" + RunNum.str() + ".ps"; + TPostScript psFile(PsFileNameWithRun.c_str(),111); + psFile.Range(20,26); + //psFile.NewPage(); + TCanvas c1("c1","",600,780); + + + + // DataIntegrity summary histos ************************************************************** + if(DataIntegrityHistos){ + c1.Clear(); + c1.Divide(2,2); + stringstream dduID; dduID << DDUId; + + string histo_name1 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_TTSValues"; + TH1F *histo1 = (TH1F*) theFile -> Get(histo_name1.c_str()); + c1.cd(1); + if(histo1) + histo1->Draw(); + + string histo_name2 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSStatus"; + TH1F *histo2 = (TH1F*) theFile -> Get(histo_name2.c_str()); + c1.cd(2); + if(histo2) + histo2->Draw(); + + string histo_name3 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSSummary"; + TH1F *histo3 = (TH1F*) theFile -> Get(histo_name3.c_str()); + c1.cd(3); + if(histo3) + histo3->Draw(); + + string histo_name4 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/ROS1/FED" + dduID.str() + "_ROS1_ROSError"; + TH1F *histo4 = (TH1F*) theFile -> Get(histo_name4.c_str()); + c1.cd(4); + if(histo4) + histo4->Draw(); + + c1.Update(); + psFile.NewPage(); + } + + // Digi summary histos ******************************************************************** + if(DigiHistos){ + // Time Box Histos + c1.Clear(); + c1.Divide(3,4); + // Loop over all the chambers + vector::const_iterator ch_digi_it = muonGeom->chambers().begin(); + vector::const_iterator ch_digi_end = muonGeom->chambers().end(); + for (; ch_digi_it != ch_digi_end; ++ch_digi_it) { + DTChamberId ch = (*ch_digi_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + vector::const_iterator sl_it = (*ch_digi_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_digi_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + stringstream superLayer; superLayer << sl.superlayer(); + + string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); + string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/TimeBoxes/TimeBox_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str(); + TH1F *histo = (TH1F *) theFile->Get(histo_name.c_str()); + if(histo){ + int pad = (ch.station() - 1)*3 + sl.superlayer(); + c1.cd(pad); + histo->Draw(); + } + } + } + c1.Update(); + psFile.NewPage(); + + // Occupancy in Time Histos + c1.Clear(); + c1.Divide(4,3); + // Loop over all the chambers + vector::const_iterator ch_digi2_it = muonGeom->chambers().begin(); + vector::const_iterator ch_digi2_end = muonGeom->chambers().end(); + for (; ch_digi2_it != ch_digi2_end; ++ch_digi2_it) { + DTChamberId ch = (*ch_digi2_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + bool found = false; + vector::const_iterator sl_it = (*ch_digi2_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_digi2_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + stringstream superLayer; superLayer << sl.superlayer(); + // Loop over the Ls + for(; l_it != l_end; ++l_it) { + DTLayerId layerId = (*l_it)->id(); + stringstream layer; layer << layerId.layer(); + + string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); + string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyInTimeHits_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + found = true; + int pad = (sl.superlayer() - 1)*4 + layerId.layer(); + c1.cd(pad); + histo->Draw(); + } + } + } + if(found){ + c1.Update(); + psFile.NewPage(); + } + } + + // Occupancy Noise + // Loop over all the chambers + vector::const_iterator ch_digi3_it = muonGeom->chambers().begin(); + vector::const_iterator ch_digi3_end = muonGeom->chambers().end(); + for (; ch_digi3_it != ch_digi3_end; ++ch_digi3_it) { + DTChamberId ch = (*ch_digi3_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + bool found = false; + vector::const_iterator sl_it = (*ch_digi3_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_digi3_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + stringstream superLayer; superLayer << sl.superlayer(); + // Loop over the Ls + for(; l_it != l_end; ++l_it) { + DTLayerId layerId = (*l_it)->id(); + stringstream layer; layer << layerId.layer(); + + string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); + string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyNoise_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + found = true; + int pad = (sl.superlayer() - 1)*4 + layerId.layer(); + c1.cd(pad); + histo->Draw(); + } + } + } + if(found) { + c1.Update(); + psFile.NewPage(); + } + } + + // Digi Per Event + // Loop over all the chambers + vector::const_iterator ch_digi4_it = muonGeom->chambers().begin(); + vector::const_iterator ch_digi4_end = muonGeom->chambers().end(); + for (; ch_digi4_it != ch_digi4_end; ++ch_digi4_it) { + DTChamberId ch = (*ch_digi4_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + bool found = false; + vector::const_iterator sl_it = (*ch_digi4_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_digi4_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + stringstream superLayer; superLayer << sl.superlayer(); + // Loop over the Ls + for(; l_it != l_end; ++l_it) { + DTLayerId layerId = (*l_it)->id(); + stringstream layer; layer << layerId.layer(); + + string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); + string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/DigiPerEvent/DigiPerEvent_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); + TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str()); + if(histo){ + found = true; + int pad = (sl.superlayer() - 1)*4 + layerId.layer(); + c1.cd(pad); + histo->Draw(); + } + } + } + if(found){ + c1.Update(); + psFile.NewPage(); + } + } + } + + // Reconstruction summary histos ********************************************************* + if(RecoHistos){ + // reco segment Histos - page1 + c1.Clear(); + c1.Divide(2,4); + // Loop over all the chambers + vector::const_iterator ch_reco_it = muonGeom->chambers().begin(); + vector::const_iterator ch_reco_end = muonGeom->chambers().end(); + for (; ch_reco_it != ch_reco_end; ++ch_reco_it) { + DTChamberId ch = (*ch_reco_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str(); + string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hN4DSeg_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + int pad = (ch.station() - 1)*2 + 1; + c1.cd(pad); + histo->Draw(); + } + histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmXvsYInCham_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); + TProfile *histo2 = (TProfile*) theFile -> Get(histo_name.c_str()); + if(histo2){ + int pad = (ch.station() - 1)*2 + 2; + c1.cd(pad); + histo2->Draw(); + } + } + c1.Update(); + psFile.NewPage(); + + // reco segment Histos - page2 + // Loop over all the chambers + vector::const_iterator ch_reco2_it = muonGeom->chambers().begin(); + vector::const_iterator ch_reco2_end = muonGeom->chambers().end(); + for (; ch_reco2_it != ch_reco2_end; ++ch_reco2_it) { + DTChamberId ch = (*ch_reco2_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str(); + string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmPhiDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo) { + int pad = (ch.station() - 1)*2 + 1; + c1.cd(pad); + histo->Draw(); + } + histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmThetaDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); + TH1F *histo2 = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo2) { + int pad = (ch.station() - 1)*2 + 2; + c1.cd(pad); + histo2->Draw(); + } + } + c1.Update(); + psFile.NewPage(); + } + + // Resolution summary histos ******************************************************************* + if(ResoHistos){ + // Residuals histos + c1.Clear(); + c1.Divide(3,4); + // Loop over all the chambers + vector::const_iterator ch_reso_it = muonGeom->chambers().begin(); + vector::const_iterator ch_reso_end = muonGeom->chambers().end(); + for (; ch_reso_it != ch_reso_end; ++ch_reso_it) { + DTChamberId ch = (*ch_reso_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + vector::const_iterator sl_it = (*ch_reso_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_reso_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + stringstream superLayer; superLayer << sl.superlayer(); + + string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str(); + string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + int pad = (ch.station() - 1)*3 + sl.superlayer(); + c1.cd(pad); + histo->Draw(); + } + } + } + c1.Update(); + psFile.NewPage(); + + // Residuals as a function of the position Histos + // Loop over all the chambers + vector::const_iterator ch_reso2_it = muonGeom->chambers().begin(); + vector::const_iterator ch_reso2_end = muonGeom->chambers().end(); + for (; ch_reso2_it != ch_reso2_end; ++ch_reso2_it) { + DTChamberId ch = (*ch_reso2_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + vector::const_iterator sl_it = (*ch_reso2_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_reso2_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + stringstream superLayer; superLayer << sl.superlayer(); + + string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str(); + string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDistVsDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str(); + TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str()); + if(histo){ + int pad = (ch.station() - 1)*3 + sl.superlayer(); + c1.cd(pad); + histo->Draw(); + } + } + } + c1.Update(); + psFile.NewPage(); + } + + // Efficiency summary histos ****************************************************************** + if(EfficiencyHistos){ + // Cell efficiency + c1.Clear(); + c1.Divide(4,3); + // Loop over all the chambers + vector::const_iterator ch_eff_it = muonGeom->chambers().begin(); + vector::const_iterator ch_eff_end = muonGeom->chambers().end(); + for (; ch_eff_it != ch_eff_end; ++ch_eff_it) { + DTChamberId ch = (*ch_eff_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + bool found = false; + vector::const_iterator sl_it = (*ch_eff_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_eff_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + stringstream superLayer; superLayer << sl.superlayer(); + // Loop over the Ls + for(; l_it != l_end; ++l_it) { + DTLayerId layerId = (*l_it)->id(); + stringstream layer; layer << layerId.layer(); + + string efficiencyFolder = MainFolder + "Tests/DTEfficiency/Wheel" + wheel.str(); + string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/UnassEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + found = true; + int pad = (sl.superlayer() - 1)*4 + layerId.layer(); + c1.cd(pad); + histo->Draw(); + } + } + } + if(found){ + c1.Update(); + psFile.NewPage(); + } + } + + // Chamber X efficiency + c1.Clear(); + c1.Divide(2,2); + // Loop over all the chambers + vector::const_iterator ch_eff2_it = muonGeom->chambers().begin(); + vector::const_iterator ch_eff2_end = muonGeom->chambers().end(); + for (; ch_eff2_it != ch_eff2_end; ++ch_eff2_it) { + DTChamberId ch = (*ch_eff2_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str(); + string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/xEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + c1.cd(ch.station()); + histo->Draw(); + } + } + c1.Update(); + psFile.NewPage(); + + // Chamber Y efficiency + // Loop over all the chambers + vector::const_iterator ch_eff3_it = muonGeom->chambers().begin(); + vector::const_iterator ch_eff3_end = muonGeom->chambers().end(); + for (; ch_eff3_it != ch_eff3_end; ++ch_eff3_it) { + DTChamberId ch = (*ch_eff3_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str(); + string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/yEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + c1.cd(ch.station()); + histo->Draw(); + } + } + c1.Update(); + psFile.NewPage(); + } + + // Test Pulses Summary Histos ************************************************************** + if(TestPulsesHistos){ + c1.Clear(); + c1.Divide(4,3); + // Loop over all the chambers + vector::const_iterator ch_TP_it = muonGeom->chambers().begin(); + vector::const_iterator ch_TP_end = muonGeom->chambers().end(); + for (; ch_TP_it != ch_TP_end; ++ch_TP_it) { + DTChamberId ch = (*ch_TP_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + bool found = false; + vector::const_iterator sl_it = (*ch_TP_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_TP_it)->superLayers().end(); + // Loop over the SLs + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId sl = (*sl_it)->id(); + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + stringstream superLayer; superLayer << sl.superlayer(); + // Loop over the Ls + for(; l_it != l_end; ++l_it) { + DTLayerId layerId = (*l_it)->id(); + stringstream layer; layer << layerId.layer(); + + string testPulsesFolder = MainFolder + "DTTestPulsesTask/Wheel" + wheel.str(); + string histo_name = testPulsesFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/SuperLayer" + superLayer.str() + "/TPProfile/TestPulses2D_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); + TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str()); + if(histo){ + found = true; + int pad = (sl.superlayer() - 1)*4 + layerId.layer(); + c1.cd(pad); + histo->Draw(); + } + } + } + if(found){ + c1.Update(); + psFile.NewPage(); + } + } + } + + // Trigger Summary Histos ************************************************************************ + if(TriggerHistos){ + c1.Clear(); + c1.Divide(2,2); + // Loop over all the chambers + vector::const_iterator ch_trigger_it = muonGeom->chambers().begin(); + vector::const_iterator ch_trigger_end = muonGeom->chambers().end(); + for (; ch_trigger_it != ch_trigger_end; ++ch_trigger_it) { + DTChamberId ch = (*ch_trigger_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str(); + string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerPhi/DDU_BXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + c1.cd(ch.station()); + histo->Draw(); + } + } + c1.Update(); + psFile.NewPage(); + + // Loop over all the chambers + vector::const_iterator ch_trigger2_it = muonGeom->chambers().begin(); + vector::const_iterator ch_trigger2_end = muonGeom->chambers().end(); + for (; ch_trigger2_it != ch_trigger2_end; ++ch_trigger2_it) { + DTChamberId ch = (*ch_trigger2_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str(); + string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerTheta/DDU_ThetaBXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + c1.cd(ch.station()); + histo->Draw(); + } + } + c1.Update(); + psFile.NewPage(); + + c1.Clear(); + c1.Divide(1,2); + int counter1=0,counter2=0; + // Loop over all the chambers + vector::const_iterator ch_trigger3_it = muonGeom->chambers().begin(); + vector::const_iterator ch_trigger3_end = muonGeom->chambers().end(); + for (; ch_trigger3_it != ch_trigger3_end; ++ch_trigger3_it) { + DTChamberId ch = (*ch_trigger3_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream sector; sector << ch.sector(); + + string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); + string histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerPhi/CorrFraction_Phi_W" + wheel.str() + "_Sec" + sector.str(); + TH1F *Histo1 = (TH1F*) theFile -> Get(histo_Name.c_str()); + if(Histo1 && counter1==0){ + counter1++; + c1.cd(1); + Histo1->Draw(); + } + histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerTheta/HFraction_Theta_W" + wheel.str() + "_Sec" + sector.str(); + TH1F *Histo2 = (TH1F*) theFile -> Get(histo_Name.c_str()); + if(Histo2 && counter2==0){ + counter2++; + c1.cd(2); + Histo2->Draw(); + } + } + c1.Update(); + psFile.NewPage(); + + c1.Clear(); + c1.Divide(2,2); + // Loop over all the chambers + vector::const_iterator ch_trigger4_it = muonGeom->chambers().begin(); + vector::const_iterator ch_trigger4_end = muonGeom->chambers().end(); + for (; ch_trigger4_it != ch_trigger4_end; ++ch_trigger4_it) { + DTChamberId ch = (*ch_trigger4_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); + string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + string histo_nameHHHL = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPosHHHL_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + TH1F *histoHHHL = (TH1F*) theFile -> Get(histo_nameHHHL.c_str()); + if(histo){ + c1.cd(ch.station()); + histo->GetYaxis()->SetRangeUser(0,1.1); + histo->Draw(); + if(histoHHHL){ + histoHHHL->Draw("same"); + } + } + } + c1.Update(); + psFile.NewPage(); + + c1.Clear(); + c1.Divide(2,2); + // Loop over all the chambers + vector::const_iterator ch_trigger5_it = muonGeom->chambers().begin(); + vector::const_iterator ch_trigger5_end = muonGeom->chambers().end(); + for (; ch_trigger5_it != ch_trigger5_end; ++ch_trigger5_it) { + DTChamberId ch = (*ch_trigger5_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); + string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + c1.cd(ch.station()); + histo->GetYaxis()->SetRangeUser(0,1.1); + histo->Draw(); + } + } + c1.Update(); + psFile.NewPage(); + + c1.Clear(); + c1.Divide(2,2); + // Loop over all the chambers + vector::const_iterator ch_trigger6_it = muonGeom->chambers().begin(); + vector::const_iterator ch_trigger6_end = muonGeom->chambers().end(); + for (; ch_trigger6_it != ch_trigger6_end; ++ch_trigger6_it) { + DTChamberId ch = (*ch_trigger6_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); + string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + c1.cd(ch.station()); + histo->GetYaxis()->SetRangeUser(0,1.1); + histo->Draw(); + } + } + c1.Update(); + psFile.NewPage(); + + c1.Clear(); + c1.Divide(2,2); + // Loop over all the chambers + vector::const_iterator ch_trigger7_it = muonGeom->chambers().begin(); + vector::const_iterator ch_trigger7_end = muonGeom->chambers().end(); + for (; ch_trigger7_it != ch_trigger7_end; ++ch_trigger7_it) { + DTChamberId ch = (*ch_trigger7_it)->id(); + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); + string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); + if(histo){ + histo->GetYaxis()->SetRangeUser(0,1.1); + c1.cd(ch.station()); + histo->Draw(); + } + } + c1.Update(); + } + psFile.Close(); +} diff --git a/DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 b/DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 new file mode 100644 index 0000000000000..ab4197228cd2c --- /dev/null +++ b/DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 @@ -0,0 +1,226 @@ + +/* + * See header file for a description of this class. + * + * \author G. Mila - INFN Torino + */ + + +#include + +// Framework +#include + + +// Geometry +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "Geometry/DTGeometry/interface/DTLayer.h" +#include "Geometry/DTGeometry/interface/DTTopology.h" + +#include +#include + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include +#include +#include + + +using namespace edm; +using namespace std; + + +DTDeadChannelTest::DTDeadChannelTest(const edm::ParameterSet& ps){ + + edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Constructor"; + + parameters = ps; + + prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 1); + nevents = 0; + +} + +DTDeadChannelTest::~DTDeadChannelTest(){ + + edm::LogVerbatim ("deadChannel") << "DTDeadChannelTest: analyzed " << nevents << " events"; + +} + +void DTDeadChannelTest::beginRun(Run const& run, EventSetup const& context) { + + edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: BeginRun"; + + // Get the geometry + context.get().get(muonGeom); + +} + + +void DTDeadChannelTest::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) { + + edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: Begin of LS transition"; + + // Get the run number + run = lumiSeg.run(); + +} + + +void DTDeadChannelTest::analyze(const edm::Event& e, const edm::EventSetup& context){ + + nevents++; + edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<::const_iterator ch_it = muonGeom->chambers().begin(); + vector::const_iterator ch_end = muonGeom->chambers().end(); + + edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Occupancy tests results"; + + // Loop over the chambers + for (; ch_it != ch_end; ++ch_it) { + DTChamberId chID = (*ch_it)->id(); + vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_it)->superLayers().end(); + + stringstream wheel; wheel << chID.wheel(); + stringstream station; station << chID.station(); + stringstream sector; sector << chID.sector(); + + context.get().get(tTrigMap); + + string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); + + // Get the ME produced by DigiTask Source + MonitorElement * noise_histo = igetter.get(getMEName("OccupancyNoise_perCh", chID)); + MonitorElement * hitInTime_histo = igetter.get(getMEName("OccupancyInTimeHits_perCh", chID)); + + // ME -> TH2F + if(noise_histo && hitInTime_histo) { + TH2F * noise_histo_root = noise_histo->getTH2F(); + TH2F * hitInTime_histo_root = hitInTime_histo->getTH2F(); + + // Loop over the SuperLayers + for(; sl_it != sl_end; ++sl_it) { + DTSuperLayerId slID = (*sl_it)->id(); + vector::const_iterator l_it = (*sl_it)->layers().begin(); + vector::const_iterator l_end = (*sl_it)->layers().end(); + + // ttrig and rms are counts + float tTrig, tTrigRMS, kFactor; + tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts); + + // Loop over the layers + for(; l_it != l_end; ++l_it) { + DTLayerId lID = (*l_it)->id(); + + //Parameters to fill histos + stringstream superLayer; superLayer << slID.superlayer(); + stringstream layer; layer << lID.layer(); + string HistoNameTest = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + + "_L" + layer.str(); + + const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel(); + const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel(); + + int entry=-1; + if(slID.superlayer() == 1) entry=0; + if(slID.superlayer() == 2) entry=4; + if(slID.superlayer() == 3) entry=8; + int YBinNumber = entry+lID.layer(); + + + // Loop over the TH2F bin and fill the ME to be used for the Quality Test + for(int bin=firstWire; bin <= lastWire; bin++) { + if (OccupancyDiffHistos.find(HistoNameTest) == OccupancyDiffHistos.end()) bookHistos(ibooker,lID, firstWire, lastWire); + // tMax default value + float tMax = 450.0; + + float difference = (hitInTime_histo_root->GetBinContent(bin, YBinNumber) / tMax) + - (noise_histo_root->GetBinContent(bin, YBinNumber) / tTrig); + OccupancyDiffHistos.find(HistoNameTest)->second->setBinContent(bin, difference); + } + } // loop on layers + } // loop on superlayers + } + } // loop on chambers + + // Occupancy Difference test + string OccupancyDiffCriterionName = parameters.getUntrackedParameter("OccupancyDiffTestName","OccupancyDiffInRange"); + for(map::const_iterator hOccDiff = OccupancyDiffHistos.begin(); + hOccDiff != OccupancyDiffHistos.end(); + hOccDiff++) { + const QReport * theOccupancyDiffQReport = (*hOccDiff).second->getQReport(OccupancyDiffCriterionName); + if(theOccupancyDiffQReport) { + vector badChannels = theOccupancyDiffQReport->getBadChannels(); + for (vector::iterator channel = badChannels.begin(); + channel != badChannels.end(); channel++) { + edm::LogError ("deadChannel") << "Layer : "<<(*hOccDiff).first<<" Bad occupancy difference channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents(); + } + } + } + +} + +string DTDeadChannelTest::getMEName(string histoTag, const DTChamberId & chId) { + + stringstream wheel; wheel << chId.wheel(); + stringstream station; station << chId.station(); + stringstream sector; sector << chId.sector(); + + string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); + string folderName = + folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + + "/Occupancies" + "/"; + + string histoname = folderName + histoTag + + "_W" + wheel.str() + + "_St" + station.str() + + "_Sec" + sector.str(); + + return histoname; + +} + + +void DTDeadChannelTest::bookHistos(DQMStore::IBooker & ibooker, const DTLayerId & lId, int firstWire, int lastWire) { + + stringstream wheel; wheel << lId.superlayerId().wheel(); + stringstream station; station << lId.superlayerId().station(); + stringstream sector; sector << lId.superlayerId().sector(); + stringstream superLayer; superLayer << lId.superlayerId().superlayer(); + stringstream layer; layer << lId.layer(); + + string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); + string OccupancyDiffHistoName = "OccupancyDiff_" + HistoName; + + ibooker.setCurrentFolder("DT/Tests/DTDeadChannel/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str()); + + OccupancyDiffHistos[HistoName] = ibooker.book1D(OccupancyDiffHistoName.c_str(),OccupancyDiffHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5); + +} diff --git a/DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 b/DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 new file mode 100644 index 0000000000000..cb5c51982a044 --- /dev/null +++ b/DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 @@ -0,0 +1,203 @@ +/* + * See header file for a description of this class. + * + * \author M. Giunta, C. Battilana + * + * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my + * + * + */ + + +// This class header +#include "DQM/DTMonitorClient/src/DTFineDelayCorr.h" + +// Framework headers +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMServices/Core/interface/DQMStore.h" + +// L1Trigger +#include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTrigUnit.h" + +// Geometry +#include "DQM/DTMonitorModule/interface/DTTrigGeomUtils.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" + +// DB & Calib +#include "CalibMuon/DTCalibration/interface/DTCalibDBUtils.h" + +// Root +#include "TF1.h" +#include "TProfile.h" + + +//C++ headers +using namespace edm; +using namespace std; +#include +#include +#include +#include +#include +#include + +DTFineDelayCorr::DTFineDelayCorr(const ParameterSet& ps) { + + setConfig(ps,"DTFineDelayCorr"); // sets parameter values and name used in log file + baseFolderDCC = "DT/90-LocalTriggerSynch/"; + baseFolderDDU = "DT/90-LocalTriggerSynch/"; + +} + + +DTFineDelayCorr::~DTFineDelayCorr(){ + +} + +void DTFineDelayCorr::beginRun(edm::Run const & run, edm::EventSetup const & evSU) { + + // Tag for Hardware Source (DDU or DCC) + hwSource = parameters.getParameter("hwSource"); + // Tag for the t0Mean Histograms + t0MeanHistoTag = parameters.getParameter("t0MeanHistoTag"); + // Read old delays from file or from Db + readOldFromDb = parameters.getParameter("readOldFromDb"); + // Input file name for old delays + oldDelaysInputFile = parameters.getParameter("oldDelaysInputFile"), + // Write new delays to file or to Db + writeDB = parameters.getParameter("writeDB"); + // Output File Name + outputFileName = parameters.getParameter("outputFile"); + // Choose to use Hist Mean or Gaussian Fit Mean + gaussMean = parameters.getParameter("gaussMean"); + // Require Minimum Number Of Entries in the t0Mean Histogram + minEntries = parameters.getUntrackedParameter("minEntries",5); + + DTLocalTriggerBaseTest::beginRun(run,evSU); + evSU.get< DTConfigManagerRcd >().get(dtConfig); + evSU.get< DTTPGParametersRcd >().get(worstPhaseMap); + +} + +void DTFineDelayCorr::runClientDiagnostic(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { + int coarseDelay = -999; + float oldFineDelay = -999; + if(!readOldFromDb) { // read old delays from txt file + // ** Open and read old delays input file ** + ifstream oldDelaysFile(oldDelaysInputFile.c_str()); + string line; + + while (getline(oldDelaysFile, line)) { + if( line == "" || line[0] == '#' ) continue; + stringstream linestr; + int wheelKey,sectorKey, stationKey; + linestr << line; + + linestr >> wheelKey + >> sectorKey + >> stationKey + >> coarseDelay + >> oldFineDelay; + + pair oldDelays = make_pair(coarseDelay,oldFineDelay); + DTChamberId oldDelayKey = DTChamberId(wheelKey,stationKey,sectorKey); + oldDelayMap.insert(make_pair(oldDelayKey,oldDelays)); + } + } + + // ** Loop over the chambers ** + vector::const_iterator chambIt = muonGeom->chambers().begin(); + vector::const_iterator chambEnd = muonGeom->chambers().end(); + for (; chambIt!=chambEnd; ++chambIt) { + DTChamberId chId = (*chambIt)->id(); + uint32_t indexCh = chId.rawId(); + int wheel = chId.wheel(); + int sector = chId.sector(); + int station = chId.station(); + + // ** Compute corrected values and write them to file or database ** + vector newDelays; + + // ** Retrieve Delays Loaded in MiniCrates ** + if(readOldFromDb) { // read from db + const DTConfigPedestals *pedestals = dtConfig->getDTConfigPedestals(); + const DTLayer *layer = muonGeom->layer(DTLayerId(chId,1,1)); + float delay = pedestals->getOffset(DTWireId(layer->id(),layer->specificTopology().firstChannel())); + coarseDelay = int(delay/25.); + oldFineDelay = delay - coarseDelay * 25.; + } + else { // read from map created from txt file + coarseDelay = oldDelayMap[chId].first; + oldFineDelay = oldDelayMap[chId].second; + } + + // ** Retrieve t0Mean histograms ** + TH1F *t0H = getHisto(igetter.get(getMEName(t0MeanHistoTag,"", chId))); + float newFineDelay = -999; // initialize to dummy number + cout <<"MG: " << getMEName(t0MeanHistoTag,"", chId) << " entries: " << t0H->GetEntries() << endl; + if (t0H->GetEntries() > minEntries) { + Double_t mean; + // ** Find Mean Value of the distribution ** + if(gaussMean) { + TF1 *funct = t0H->GetFunction("gaus"); + mean = funct->GetParameter(1); + } + else { + mean = t0H->GetMean(); + } + + // ** Retrieve Worst Phase values ** + int wpCoarseDelay; + float wpFineDelay; + worstPhaseMap->get(chId, wpCoarseDelay, wpFineDelay, DTTimeUnits::ns); +// cout << "wpFineDelay, oldFineDelay, mean: " << wpFineDelay << " " +// << oldFineDelay << " " << mean << endl; + float bpFineDelay = (wpFineDelay < 12.5)? (wpFineDelay + 12.5) : (wpFineDelay - 12.5); // Best Phase: half BX far from the worst phase + // ** Calculate correction ** + float diffFineDelays = oldFineDelay + (mean - bpFineDelay); // positive mean shift implies positive delay correction + int bxDiff = (int) (diffFineDelays / 25); + coarseDelay += bxDiff; + newFineDelay = fmodf(diffFineDelays, 25); +// cout << "diffFineDelays, newFineDelay, bxDiff, coarseDelay: " << diffFineDelays +// << " "<< newFineDelay << " " << bxDiff << " " << coarseDelay << endl; + } + else { + LogProblem(category()) << "[" << testName << "Test]: Not enough entries in hist for Chamber " + << indexCh << endl; + } + + newDelays.push_back(wheel); + newDelays.push_back(sector); + newDelays.push_back(station); + newDelays.push_back(coarseDelay); + newDelays.push_back(newFineDelay); + pair< DTChamberId, vector > chDelays; + chDelays.first = chId; + chDelays.second = newDelays; + delayMap.insert(chDelays); + } +} + +void DTFineDelayCorr::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter){ + + DTLocalTriggerBaseTest::dqmEndJob( ibooker,igetter); + + if (writeDB) { + // to be added if needed + } + else { // write txt file + // ** Open output file ** + ofstream outFile(outputFileName.c_str()); + for(map< DTChamberId, vector >::const_iterator iter = delayMap.begin(); + iter != delayMap.end() ; iter++) { + // writing + ostream_iterator oit(outFile, " "); + copy((*iter).second.begin(), (*iter).second.end(), oit); + outFile << endl; + } + outFile.close(); + } +} diff --git a/DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.cc b/DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.cc new file mode 100644 index 0000000000000..5a5c67a8cdb9f --- /dev/null +++ b/DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.cc @@ -0,0 +1,287 @@ +/* + * See header file for a description of this class. + * + * \author C. Battilana - CIEMAT + * + * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my + * + */ + + +// This class header +#include "DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.h" + +// Framework headers +#include "FWCore/Framework/interface/EventSetup.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "DQMServices/Core/interface/DQMStore.h" + +// Geometry +#include "DQM/DTMonitorModule/interface/DTTrigGeomUtils.h" +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" + +// DB & Calib +#include "CalibMuon/DTCalibration/interface/DTCalibDBUtils.h" +#include "CondFormats/DataRecord/interface/DTTPGParametersRcd.h" +#include "CondFormats/DataRecord/interface/DTStatusFlagRcd.h" +#include "CondFormats/DTObjects/interface/DTStatusFlag.h" + + +// Root +#include "TF1.h" +#include "TProfile.h" + + +//C++ headers +#include +#include + +using namespace edm; +using namespace std; + + +DTLocalTriggerSynchTest::DTLocalTriggerSynchTest(const edm::ParameterSet& ps) { + + setConfig(ps,"DTLocalTriggerSynch"); + baseFolderDCC = "DT/90-LocalTriggerSynch/"; + baseFolderDDU = "DT/90-LocalTriggerSynch/"; + + bookingdone = 0; + +} + + +DTLocalTriggerSynchTest::~DTLocalTriggerSynchTest(){ + +} + + +void DTLocalTriggerSynchTest::beginRun(edm::Run const & run, edm::EventSetup const & c) { + + numHistoTag = parameters.getParameter("numHistoTag"); + denHistoTag = parameters.getParameter("denHistoTag"); + ratioHistoTag = parameters.getParameter("ratioHistoTag"); + bxTime = parameters.getParameter("bxTimeInterval"); + rangeInBX = parameters.getParameter("rangeWithinBX"); + nBXLow = parameters.getParameter("nBXLow"); + nBXHigh = parameters.getParameter("nBXHigh"); + minEntries = parameters.getParameter("minEntries"); + + DTLocalTriggerBaseTest::beginRun(run,c); +} + + +void DTLocalTriggerSynchTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, + edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & c) { + + if (bookingdone) return; + + vector::const_iterator iTr = trigSources.begin(); + vector::const_iterator trEnd = trigSources.end(); + vector::const_iterator iHw = hwSources.begin(); + vector::const_iterator hwEnd = hwSources.end(); + + //Booking + if(parameters.getUntrackedParameter("staticBooking", true)){ + for (; iTr != trEnd; ++iTr){ + trigSource = (*iTr); + for (; iHw != hwEnd; ++iHw){ + hwSource = (*iHw); + std::vector::const_iterator chambIt = muonGeom->chambers().begin(); + std::vector::const_iterator chambEnd = muonGeom->chambers().end(); + for (; chambIt!=chambEnd; ++chambIt) { + DTChamberId chId = ((*chambIt)->id()); + bookChambHistos(ibooker,chId,ratioHistoTag); + } + } + } + } + + LogVerbatim(category()) << "[" << testName << "Test]: book Histograms" << endl; + + if (parameters.getParameter("fineParamDiff")) { + ESHandle wPhaseHandle; + c.get().get(wPhaseHandle); + wPhaseMap = (*wPhaseHandle); + } + + bookingdone = 1; + +} + + +void DTLocalTriggerSynchTest::runClientDiagnostic(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { + + // Loop over Trig & Hw sources + for (vector::const_iterator iTr = trigSources.begin(); iTr != trigSources.end(); ++iTr){ + trigSource = (*iTr); + for (vector::const_iterator iHw = hwSources.begin(); iHw != hwSources.end(); ++iHw){ + hwSource = (*iHw); + std::vector::const_iterator chambIt = muonGeom->chambers().begin(); + std::vector::const_iterator chambEnd = muonGeom->chambers().end(); + for (; chambIt!=chambEnd; ++chambIt) { + DTChamberId chId = (*chambIt)->id(); + uint32_t indexCh = chId.rawId(); + + // Perform peak finding + + TH1F *numH = getHisto(igetter.get(getMEName(numHistoTag,"", chId))); + TH1F *denH = getHisto(igetter.get(getMEName(denHistoTag,"", chId))); + + if (numH && denH && numH->GetEntries()>minEntries && denH->GetEntries()>minEntries) { + std::map innerME = chambME[indexCh]; + MonitorElement* ratioH = innerME.find(fullName(ratioHistoTag))->second; + makeRatioME(numH,denH,ratioH); + try { + //Need our own copy to avoid threading problems + TF1 mypol8("mypol8","pol8"); + getHisto(ratioH)->Fit(&mypol8,"CQO"); + } catch (cms::Exception& iException) { + edm::LogPrint(category()) << "[" << testName + << "Test]: Error fitting " + << ratioH->getName() << " returned 0" << endl; + } + } else { + if (!numH || !denH) { + LogPrint(category()) << "[" << testName + << "Test]: At least one of the required Histograms was not found for chamber " + << chId << ". Peaks not computed" << endl; + } else { + LogPrint(category()) << "[" << testName + << "Test]: Number of plots entries for " + << chId << " is less than minEntries=" + << minEntries <<". Peaks not computed" << endl; + } + } + + } + } + } + +} + +void DTLocalTriggerSynchTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter){ + + DTLocalTriggerBaseTest::dqmEndJob(ibooker,igetter); + + if ( parameters.getParameter("writeDB")) { + LogVerbatim(category()) << "[" << testName + << "Test]: writeDB flag set to true. Producing peak position database." << endl; + + DTTPGParameters* delayMap = new DTTPGParameters(); + hwSource = parameters.getParameter("dbFromDCC") ? "DCC" : "DDU"; + std::vector::const_iterator chambIt = muonGeom->chambers().begin(); + std::vector::const_iterator chambEnd = muonGeom->chambers().end(); + for (; chambIt!=chambEnd; ++chambIt) { + + DTChamberId chId = (*chambIt)->id(); + float fineDelay = 0; + int coarseDelay = static_cast((getFloatFromME(igetter,chId,"tTrig_SL1") + + getFloatFromME(igetter,chId,"tTrig_SL3"))*0.5/bxTime); + + bool fineDiff = parameters.getParameter("fineParamDiff"); + bool coarseDiff = parameters.getParameter("coarseParamDiff"); + + TH1F *ratioH = getHisto(igetter.get(getMEName(ratioHistoTag,"", chId))); + if (ratioH->GetEntries()>minEntries) { + TF1 *fitF=ratioH->GetFunction("mypol8"); + if (fitF) { fineDelay=fitF->GetMaximumX(0,bxTime); } + } else { + LogInfo(category()) << "[" << testName + << "Test]: Ratio histogram for chamber " << chId + << " is empty. Worst Phase value set to 0." << endl; + } + + if (fineDiff || coarseDiff) { + float wFine; + int wCoarse; + wPhaseMap.get(chId,wCoarse,wFine,DTTimeUnits::ns); + if (fineDiff) { fineDelay = wFine - fineDelay; } + if (coarseDiff) { coarseDelay = wCoarse - coarseDelay; } + } + delayMap->set(chId,coarseDelay,fineDelay,DTTimeUnits::ns); + } + + std::vector< std::pair >::const_iterator dbIt = delayMap->begin(); + std::vector< std::pair >::const_iterator dbEnd = delayMap->end(); + for (; dbIt!=dbEnd; ++dbIt) { + LogVerbatim(category()) << "[" << testName << "Test]: DB entry for Wh " << (*dbIt).first.wheelId + << " Sec " << (*dbIt).first.sectorId + << " St " << (*dbIt).first.stationId + << " has coarse " << (*dbIt).second.nClock + << " and phase " << (*dbIt).second.tPhase << std::endl; + } + + string delayRecord = "DTTPGParametersRcd"; + DTCalibDBUtils::writeToDB(delayRecord,delayMap); + + } + +} + + + +void DTLocalTriggerSynchTest::makeRatioME(TH1F* numerator, TH1F* denominator, MonitorElement* result){ + + TH1F* efficiency = result->getTH1F(); + efficiency->Divide(numerator,denominator,1,1,""); + +} + +float DTLocalTriggerSynchTest::getFloatFromME(DQMStore::IGetter & igetter, + DTChamberId chId, std::string meType) { + + stringstream wheel; wheel << chId.wheel(); + stringstream station; station << chId.station(); + stringstream sector; sector << chId.sector(); + + string folderName = topFolder(hwSource=="DCC") + "Wheel" + wheel.str() + + "/Sector" + sector.str() + "/Station" + station.str() + "/" ; + + string histoname = sourceFolder + folderName + + meType + + "_W" + wheel.str() + + "_Sec" + sector.str() + + "_St" + station.str(); + + MonitorElement* me = igetter.get(histoname); + if (me) { + return me->getFloatValue(); + } + else { + LogProblem(category()) << "[" << testName << "Test]: " << histoname << " is not a valid ME. 0 returned" << std::endl; + } + + return 0; + + } + +void DTLocalTriggerSynchTest::bookChambHistos(DQMStore::IBooker & ibooker, + DTChamberId chambId, string htype, string subfolder) { + + stringstream wheel; wheel << chambId.wheel(); + stringstream station; station << chambId.station(); + stringstream sector; sector << chambId.sector(); + + string fullType = fullName(htype); + bool isDCC = hwSource=="DCC" ; + string HistoName = fullType + "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); + + string folder = topFolder(isDCC) + "Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str(); + if ( subfolder!="") { folder += "7" + subfolder; } + + ibooker.setCurrentFolder(folder); + + LogPrint(category()) << "[" << testName << "Test]: booking " << folder << "/" <(ceil( rangeInBX ? bxTime : (nBXHigh-nBXLow)*bxTime)); + + chambME[indexChId][fullType] = ibooker.book1D(HistoName.c_str(),"All/HH ratio vs Muon Arrival Time",nbins,min,max); + +} diff --git a/DQM/DTMonitorClient/src/DTNoiseTest.cc1 b/DQM/DTMonitorClient/src/DTNoiseTest.cc1 new file mode 100644 index 0000000000000..54bc9135e9a2f --- /dev/null +++ b/DQM/DTMonitorClient/src/DTNoiseTest.cc1 @@ -0,0 +1,314 @@ +/* + * + * \authors: + * A. Gresele - INFN Trento + * G. Mila - INFN Torino + * M. Zanetti - CERN PH + * + * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my + * + * + */ + +#include "DQM/DTMonitorClient/src/DTNoiseTest.h" + +// Framework +#include + + +// Geometry +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" +#include "Geometry/DTGeometry/interface/DTLayer.h" +#include "Geometry/DTGeometry/interface/DTTopology.h" + + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include +#include +#include + +using namespace edm; +using namespace std; + + + +DTNoiseTest::DTNoiseTest(const edm::ParameterSet& ps){ + + edm::LogVerbatim ("noise") <<"[DTNoiseTest]: Constructor"; + + parameters = ps; + + prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 1); + + bookingdone = 0; + +} + + + +DTNoiseTest::~DTNoiseTest(){ + + edm::LogVerbatim ("noise") <<"DTNoiseTest: analyzed " << updates << " events"; + +} + + void DTNoiseTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, + edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) { + + if (!bookingdone) { + ibooker.setCurrentFolder("DT/Tests/Noise"); + updates = 0; + // Get the geometry + context.get().get(muonGeom); + } + bookingdone = 1; + + edm::LogVerbatim ("noise") <<"[DTNoiseTest]: End of LS transition, performing the DQM client operation"; + + // counts number of lumiSegs + nLumiSegs = lumiSeg.id().luminosityBlock(); + + // prescale factor + if ( nLumiSegs%prescaleFactor != 0 ) return; + + edm::LogVerbatim ("noise") <<"[DTNoiseTest]: "< statusMap; + context.get().get(statusMap); + + context.get().get(tTrigMap); + float tTrig, tTrigRMS, kFactor; + + string histoTag; + // loop over chambers + vector::const_iterator ch_it = muonGeom->chambers().begin(); + vector::const_iterator ch_end = muonGeom->chambers().end(); + + for (; ch_it != ch_end; ++ch_it) { + DTChamberId ch = (*ch_it)->id(); + vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_it)->superLayers().end(); + + MonitorElement * noiseME = igetter.get(getMEName(ch)); + if (noiseME) { + TH2F * noiseHisto = noiseME->getTH2F(); + + // WARNING uncorrect normalization!! TO BE PROVIDED CENTRALLY + double nevents = (int) noiseHisto->GetEntries(); + + double normalization =0; + + float average=0; + float nOfChannels=0; + float noiseStatistics=0; + int newNoiseChannels=0; + + for(; sl_it != sl_end; ++sl_it) { + const DTSuperLayerId & slID = (*sl_it)->id(); + + // ttrig and rms are counts + tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts); + if (tTrig==0) tTrig=1; + const double ns_s = 1e9*(32/25); + normalization = ns_s/float(tTrig*nevents); + + noiseHisto->Scale(normalization); + + // loop over layers + + for (int binY=(slID.superLayer()-1)*4+1 ; binY <= (slID.superLayer()-1)*4+4; binY++) { + + int Y = binY - 4*(slID.superLayer()-1); + + // the layer + + const DTLayerId theLayer(slID,Y); + + // loop over channels + for (int binX=1; binX <= noiseHisto->GetNbinsX(); binX++) { + + if (noiseHisto->GetBinContent(binX,binY) > parameters.getUntrackedParameter("HzThreshold", 300)) + theNoisyChannels.push_back(DTWireId(theLayer, binX)); + + // get rid of the dead channels + else { + average += noiseHisto->GetBinContent(binX,binY); + nOfChannels++; + } + } + } + + if (nOfChannels) noiseStatistics = average/nOfChannels; + histoTag = "NoiseAverage"; + + if (histos[histoTag].find((*ch_it)->id().rawId()) == histos[histoTag].end()) bookHistos(ibooker,(*ch_it)->id(),string("NoiseAverage"), histoTag ); + histos[histoTag].find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(),noiseStatistics); + + for ( vector::const_iterator nb_it = theNoisyChannels.begin(); + nb_it != theNoisyChannels.end(); ++nb_it) { + + bool isNoisy = false; + bool isFEMasked = false; + bool isTDCMasked = false; + bool isTrigMask = false; + bool isDead = false; + bool isNohv = false; + statusMap->cellStatus((*nb_it), isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv); + + if (!isNoisy) newNoiseChannels++; + } + theNoisyChannels.clear(); + histoTag = "NewNoisyChannels"; + + if (histos[histoTag].find((*ch_it)->id().rawId()) == histos[histoTag].end()) + bookHistos(ibooker,(*ch_it)->id(),string("NewNoisyChannels"), histoTag ); + histos[histoTag].find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(), newNoiseChannels); + } + } + //To compute the Noise Mean test + vector::const_iterator sl2_it = (*ch_it)->superLayers().begin(); + vector::const_iterator sl2_end = (*ch_it)->superLayers().end(); + for(; sl2_it != sl2_end; ++sl2_it) { + vector::const_iterator l_it = (*sl2_it)->layers().begin(); + vector::const_iterator l_end = (*sl2_it)->layers().end(); + for(; l_it != l_end; ++l_it) { + + DTLayerId lID = (*l_it)->id(); + MonitorElement * noisePerEventME = igetter.get(getMEName(lID)); + + if (noisePerEventME) { + TH2F * noiseHistoPerEvent = noisePerEventME->getTH2F(); + int nWires = muonGeom->layer(lID)->specificTopology().channels(); + double MeanNumerator=0, MeanDenominator=0; + histoTag = "MeanDigiPerEvent"; + for (int w=1; w<=nWires; w++){ + for(int numDigi=1; numDigi<=10; numDigi++){ + MeanNumerator+=(noiseHistoPerEvent->GetBinContent(w,numDigi)*(numDigi-1)); + MeanDenominator+=noiseHistoPerEvent->GetBinContent(w,numDigi); + } + double Mean=MeanNumerator/MeanDenominator; + if (histos[histoTag].find((*l_it)->id().rawId()) == histos[histoTag].end()) bookHistos(ibooker,(*l_it)->id(),nWires, string("MeanDigiPerEvent"), histoTag ); + histos[histoTag].find((*l_it)->id().rawId())->second->setBinContent(w, Mean); + } + } + } + } + } + + // Noise Mean test + histoTag = "MeanDigiPerEvent"; + string MeanCriterionName = parameters.getUntrackedParameter("meanTestName","NoiseMeanInRange"); + for(map::const_iterator hMean = histos[histoTag].begin(); + hMean != histos[histoTag].end(); + hMean++) { + const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName); + if(theMeanQReport) { + vector badChannels = theMeanQReport->getBadChannels(); + for (vector::iterator channel = badChannels.begin(); + channel != badChannels.end(); channel++) { + LogVerbatim ("tTrigCalibration")<<"LayerId : "<<(*hMean).first<<" Bad mean channels: " + <<(*channel).getBin()<<" Contents : "<<(*channel).getContents(); + } + } + } + +} + +void DTNoiseTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { + + edm::LogVerbatim ("noise") <<"[DTNoiseTest] endjob called!"; +} + + +string DTNoiseTest::getMEName(const DTChamberId & ch) { + + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); + string folderTag = parameters.getUntrackedParameter("folderTag", "Occupancies"); + string folderName = + folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + "/" + folderTag + "/"; + + string histoTag = parameters.getUntrackedParameter("histoTag", "OccupancyNoise_perCh"); + string histoname = folderName + histoTag + + "_W" + wheel.str() + + "_St" + station.str() + + "_Sec" + sector.str(); + + + return histoname; + +} + +string DTNoiseTest::getMEName(const DTLayerId & ly) { + + stringstream wheel; wheel << ly.wheel(); + stringstream station; station << ly.station(); + stringstream sector; sector << ly.sector(); + stringstream superLayer; superLayer << ly.superlayer(); + stringstream layer; layer << ly.layer(); + + string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); + string folderTag = parameters.getUntrackedParameter("folderTagForDigiPerEventTest", "DigiPerEvent"); + string folderName = + folderRoot + "DT/DTDigiForNoiseTask/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + "/" + folderTag + "/"; + + string histoTag = parameters.getUntrackedParameter("histoTagForDigiPerEventTest", "DigiPerEvent"); + string histoname = folderName + histoTag + + "_W" + wheel.str() + + "_St" + station.str() + + "_Sec" + sector.str() + + "_SL" + superLayer.str() + + "_L" + layer.str(); + + + return histoname; + +} + +void DTNoiseTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch, string folder, string histoTag ) { + + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + ibooker.setCurrentFolder("DT/Tests/Noise/" + folder); + + string histoName = histoTag + "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); + + if (folder == "NoiseAverage") + (histos[histoTag])[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,3); + + if ( folder == "NewNoisyChannels") + (histos[histoTag])[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,3); + +} + +void DTNoiseTest::bookHistos(DQMStore::IBooker & ibooker, const DTLayerId & lId, int nWires, string folder, string histoTag) { + + stringstream wheel; wheel << lId.superlayerId().wheel(); + stringstream station; station << lId.superlayerId().station(); + stringstream sector; sector << lId.superlayerId().sector(); + stringstream superLayer; superLayer << lId.superlayerId().superlayer(); + stringstream layer; layer << lId.layer(); + + string histoName = histoTag + "_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + + "_SL" + superLayer.str() + "_L" + layer.str(); + + ibooker.setCurrentFolder("DT/Tests/Noise/" + folder + + "/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str()); + + (histos[histoTag])[lId.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),nWires,0,nWires); +} diff --git a/DQM/DTMonitorClient/src/DTResolutionTest.cc b/DQM/DTMonitorClient/src/DTResolutionTest.cc new file mode 100644 index 0000000000000..74ed5b760268a --- /dev/null +++ b/DQM/DTMonitorClient/src/DTResolutionTest.cc @@ -0,0 +1,782 @@ + + +/* + * See header file for a description of this class. + * + * \author G. Mila - INFN Torino + * + * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my + * + */ + + +#include + +// Framework +#include +#include "DataFormats/Common/interface/Handle.h" +#include +#include +#include + + +// Geometry +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTChamber.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" + + + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +#include +#include +#include +#include +#include +#include "TF1.h" + + +using namespace edm; +using namespace std; + + +DTResolutionTest::DTResolutionTest(const edm::ParameterSet& ps){ + + edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Constructor"; + parameters = ps; + +//FR: no idea if this input file needs to be used! comment it for now +//- if(ps.getUntrackedParameter("readFile", false)) +//- dbe->open(ps.getUntrackedParameter("inputFile", "residuals.root")); + + prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 1); + + percentual = parameters.getUntrackedParameter("BadSLpercentual", 10); + + nevents = 0; + + bookingdone = 0; + +} + + +DTResolutionTest::~DTResolutionTest(){ + + edm::LogVerbatim ("resolution") << "DTResolutionTest: analyzed " << nevents << " events"; + +} + + void DTResolutionTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, + edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) { + + // counts number of updates (online mode) or number of events (standalone mode) + //nevents++; + // if running in standalone perform diagnostic only after a reasonalbe amount of events + //if ( parameters.getUntrackedParameter("runningStandalone", false) && + // nevents%parameters.getUntrackedParameter("diagnosticPrescale", 1000) != 0 ) return; + //edm::LogVerbatim ("resolution") << "[DTResolutionTest]: "<().get(muonGeom); + + // book the histos + for(int wheel=-2; wheel<3; wheel++){ + + bookHistos(ibooker,wheel); + } + vector chambers = muonGeom->chambers(); + for(vector::const_iterator chamber = chambers.begin(); + chamber != chambers.end(); ++chamber) { + bookHistos(ibooker,(*chamber)->id()); + } + + } + bookingdone = 1; + + + edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: End of LS transition, performing the DQM client operation"; + + // counts number of lumiSegs + nLumiSegs = lumiSeg.id().luminosityBlock(); + + // prescale factor + if ( nLumiSegs%prescaleFactor != 0 ) return; + + for(map ::const_iterator histo = wheelMeanHistos.begin(); + histo != wheelMeanHistos.end(); + histo++) { + (*histo).second->Reset(); + } + if(parameters.getUntrackedParameter("sigmaTest")){ + for(map ::const_iterator histo = wheelSigmaHistos.begin(); + histo != wheelSigmaHistos.end(); + histo++) { + (*histo).second->Reset(); + } + } + if(parameters.getUntrackedParameter("slopeTest")){ + for(map ::const_iterator histo = wheelSlopeHistos.begin(); + histo != wheelSlopeHistos.end(); + histo++) { + (*histo).second->Reset(); + } + } + + cmsMeanHistos.clear(); + for(int i=-2; i<3; i++){ + for(int j=1; j<15; j++){ + MeanFilled[make_pair(i,j)]=false; + } + } + if(parameters.getUntrackedParameter("sigmaTest")){ + cmsSigmaHistos.clear(); + for(int i=-2; i<3; i++){ + for(int j=1; j<15; j++){ + SigmaFilled[make_pair(i,j)]=false; + } + } + } + if(parameters.getUntrackedParameter("slopeTest")){ + cmsSlopeHistos.clear(); + for(int i=-2; i<3; i++){ + for(int j=1; j<15; j++){ + SlopeFilled[make_pair(i,j)]=false; + } + } + } + + + // summary histos initialization + for(int wh=-2; wh<=3; wh++){ + if(wh!=3){ + for(int xBin=0; xBin<14; xBin++){ + for(int yBin=0; yBin<11; yBin++){ + wheelMeanHistos[wh]->setBinContent(xBin,yBin,0); + if(parameters.getUntrackedParameter("sigmaTest")) + wheelSigmaHistos[wh]->setBinContent(xBin,yBin,0); + if(parameters.getUntrackedParameter("slopeTest")) + wheelSlopeHistos[wh]->setBinContent(xBin,yBin,0); + } + } + } + else{ + for(int xBin=0; xBin<14; xBin++){ + for(int yBin=-2; yBin<3; yBin++){ + wheelMeanHistos[wh]->setBinContent(xBin,yBin,0); + if(parameters.getUntrackedParameter("sigmaTest")) + wheelSigmaHistos[wh]->setBinContent(xBin,yBin,0); + if(parameters.getUntrackedParameter("slopeTest")) + wheelSlopeHistos[wh]->setBinContent(xBin,yBin,0); + } + } + } + } + + + edm::LogVerbatim ("resolution") <<"[DTResolutionTest]: "<::const_iterator ch_it = muonGeom->chambers().begin(); + vector::const_iterator ch_end = muonGeom->chambers().end(); + + edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Residual Distribution tests results"; + + for (; ch_it != ch_end; ++ch_it) { + + DTChamberId chID = (*ch_it)->id(); + + // Fill the test histos + int entry=-1; + if(chID.station() == 1) entry=0; + if(chID.station() == 2) entry=3; + if(chID.station() == 3) entry=6; + if(chID.station() == 4) entry=9; + + vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_it)->superLayers().end(); + + for(; sl_it != sl_end; ++sl_it) { + + DTSuperLayerId slID = (*sl_it)->id(); + + edm::LogVerbatim ("resolution") << "[DTResolutionTest]: Superlayer: " << slID; + + stringstream wheel; wheel << slID.wheel(); + stringstream station; station << slID.station(); + stringstream sector; sector << slID.sector(); + stringstream superLayer; superLayer << slID.superlayer(); + + string HistoName = "W" + wheel.str() + "_Sec" + sector.str(); + string supLayer = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str(); + + MonitorElement * res_histo = igetter.get(getMEName(slID)); + if (res_histo) { + // gaussian test + string GaussianCriterionName = + parameters.getUntrackedParameter("resDistributionTestName", + "ResidualsDistributionGaussianTest"); + const QReport * GaussianReport = res_histo->getQReport(GaussianCriterionName); + if(GaussianReport){ + // FIXE ME: if the quality test fails this cout returns a null pointer + //edm::LogWarning ("resolution") << "-------- SuperLayer : "<getMessage()<<" ------- "<getStatus(); + } + int BinNumber = entry+slID.superLayer(); + if(BinNumber == 12) BinNumber=11; + float mean = (*res_histo).getMean(1); + float sigma = (*res_histo).getRMS(1); + MeanHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, mean); + if(parameters.getUntrackedParameter("sigmaTest")) + SigmaHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, sigma); + } + + if(parameters.getUntrackedParameter("slopeTest")){ + + MonitorElement * res_histo_2D = igetter.get(getMEName2D(slID)); + if (res_histo_2D) { + TH2F * res_histo_2D_root = res_histo_2D->getTH2F(); + int BinNumber = entry+slID.superLayer(); + if(BinNumber == 12) BinNumber=11; + TProfile* prof = res_histo_2D_root->ProfileX(); + prof->GetXaxis()->SetRangeUser(0,2); + //prof->Fit("pol1","Q0"); + //need our own copy to avoid threading problems + TF1 fitting("mypol1","pol1"); + try { + prof->Fit(&fitting,"Q0"); + } catch (cms::Exception& iException) { + edm::LogError ("resolution") << "[DTResolutionTest]: Exception when fitting..." + << "SuperLayer : " << slID << "\n" + << " STEP : " << parameters.getUntrackedParameter("STEP", "STEP3") << "\n" + << "Filling slope histogram with standard value -99. for bin " << BinNumber; + SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, -99.); + continue; + } + double slope = fitting.GetParameter(1); + SlopeHistos.find(make_pair(slID.wheel(),slID.sector()))->second->setBinContent(BinNumber, slope); + } + } + + } + } + + // Mean test + string MeanCriterionName = parameters.getUntrackedParameter("meanTestName","ResidualsMeanInRange"); + for(map, MonitorElement*>::const_iterator hMean = MeanHistos.begin(); + hMean != MeanHistos.end(); + hMean++) { + const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName); + stringstream wheel; wheel << (*hMean).first.first; + stringstream sector; sector << (*hMean).first.second; + // Report the channels failing the test on the mean + if(theMeanQReport) { + vector badChannels = theMeanQReport->getBadChannels(); + for (vector::iterator channel = badChannels.begin(); + channel != badChannels.end(); channel++) { + edm::LogError("resolution") << "Bad mean channel: wh: " << wheel.str() + << " st: " << stationFromBin((*channel).getBin()) + << " sect: " <("meanWrongHisto")){ + MeanHistosSetRange.find(HistoName)->second->Fill((*channel).getBin()); + MeanHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents()); + } + // fill the wheel summary histos if the SL has not passed the test + if(abs((*channel).getContents())("meanMaxLimit")) + wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,1); + else + wheelMeanHistos[(*hMean).first.first]->Fill(((*hMean).first.second)-1,(*channel).getBin()-1,2); + // fill the cms summary histo if the percentual of SL which have not passed the test + // is more than a predefined treshold + if(abs((*channel).getContents())>parameters.getUntrackedParameter("meanMaxLimit")){ + cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)]++; + if(((*hMean).first.second<13 && + double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/11>double(percentual)/100 && + MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false) || + ((*hMean).first.first>=13 && + double(cmsMeanHistos[make_pair((*hMean).first.first,(*hMean).first.second)])/2>double(percentual)/100 && + MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]==false)){ + MeanFilled[make_pair((*hMean).first.first,(*hMean).first.second)]=true; + wheelMeanHistos[3]->Fill(((*hMean).first.second)-1,(*hMean).first.first); + } + } + } + } + } + + // Sigma test + if(parameters.getUntrackedParameter("sigmaTest")){ + string SigmaCriterionName = parameters.getUntrackedParameter("sigmaTestName","ResidualsSigmaInRange"); + for(map, MonitorElement*>::const_iterator hSigma = SigmaHistos.begin(); + hSigma != SigmaHistos.end(); + hSigma++) { + const QReport * theSigmaQReport = (*hSigma).second->getQReport(SigmaCriterionName); + stringstream wheel; wheel << (*hSigma).first.first; + stringstream sector; sector << (*hSigma).first.second; + if(theSigmaQReport) { + vector badChannels = theSigmaQReport->getBadChannels(); + for (vector::iterator channel = badChannels.begin(); + channel != badChannels.end(); channel++) { + edm::LogError("resolution") << "Bad sigma: wh: " << wheel.str() + << " st: " << stationFromBin((*channel).getBin()) + << " sect: " <second->Fill((*channel).getBin()); + SigmaHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents()); + // fill the wheel summary histos if the SL has not passed the test + wheelSigmaHistos[(*hSigma).first.first]->Fill(((*hSigma).first.second)-1,(*channel).getBin()-1); + // fill the cms summary histo if the percentual of SL which have not passed the test + // is more than a predefined treshold + cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)]++; + if(((*hSigma).first.second<13 && + double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/11>double(percentual)/100 && + SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false) || + ((*hSigma).first.first>=13 && + double(cmsSigmaHistos[make_pair((*hSigma).first.first,(*hSigma).first.second)])/2>double(percentual)/100 && + SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]==false)){ + SigmaFilled[make_pair((*hSigma).first.first,(*hSigma).first.second)]=true; + wheelSigmaHistos[3]->Fill((*hSigma).first.second-1,(*hSigma).first.first); + } + } + } + } + } + + // Slope test + if(parameters.getUntrackedParameter("slopeTest")){ + string SlopeCriterionName = parameters.getUntrackedParameter("slopeTestName","ResidualsSlopeInRange"); + for(map, MonitorElement*>::const_iterator hSlope = SlopeHistos.begin(); + hSlope != SlopeHistos.end(); + hSlope++) { + const QReport * theSlopeQReport = (*hSlope).second->getQReport(SlopeCriterionName); + stringstream wheel; wheel << (*hSlope).first.first; + stringstream sector; sector << (*hSlope).first.second; + if(theSlopeQReport) { + vector badChannels = theSlopeQReport->getBadChannels(); + for (vector::iterator channel = badChannels.begin(); + channel != badChannels.end(); channel++) { + edm::LogError("resolution") << "Bad slope: wh: " << wheel.str() + << " st: " << stationFromBin((*channel).getBin()) + << " sect: " <second->Fill((*channel).getBin()); + SlopeHistosSetRange2D.find(HistoName)->second->Fill((*channel).getBin(),(*channel).getContents()); + // fill the wheel summary histos if the SL has not passed the test + wheelSlopeHistos[(*hSlope).first.first]->Fill(((*hSlope).first.second)-1,(*channel).getBin()-1); + // fill the cms summary histo if the percentual of SL which have not passed the test + // is more than a predefined treshold + cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)]++; + if(((*hSlope).first.second<13 && + double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/11>double(percentual)/100 && + SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false) || + ((*hSlope).first.first>=13 && + double(cmsSlopeHistos[make_pair((*hSlope).first.first,(*hSlope).first.second)])/2>double(percentual)/100 && + SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]==false)){ + SlopeFilled[make_pair((*hSlope).first.first,(*hSlope).first.second)]=true; + wheelSlopeHistos[3]->Fill((*hSlope).first.second-1,(*hSlope).first.first); + } + } + } + } + } + +} + +void DTResolutionTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { + + edm::LogVerbatim ("resolution") << "[DTResolutionTest] endjob called!"; + + //FR: no idea if this output file needs to be written!! comment it for now + //bool outputMEsInRootFile = parameters.getParameter("OutputMEsInRootFile"); + //if(outputMEsInRootFile){ + // std::string outputFileName = parameters.getParameter("OutputFileName"); + // dbe->save(outputFileName,"DT/CalibrationSummary"); + //} +} + + +string DTResolutionTest::getMEName(const DTSuperLayerId & slID) { + + stringstream wheel; wheel << slID.wheel(); + stringstream station; station << slID.station(); + stringstream sector; sector << slID.sector(); + stringstream superLayer; superLayer << slID.superlayer(); + + string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); + string folderName; + + if(parameters.getUntrackedParameter("calibModule", false)){ + folderName = + folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + "/"; + } + else{ + folderName = + folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + "/"; + } + + string histoTag = parameters.getUntrackedParameter("histoTag", "hResDist"); + + string histoname = folderName + histoTag + + "_W" + wheel.str() + + "_St" + station.str() + + "_Sec" + sector.str() + + "_SL" + superLayer.str(); + + return histoname; + +} + + +string DTResolutionTest::getMEName2D(const DTSuperLayerId & slID) { + + stringstream wheel; wheel << slID.wheel(); + stringstream station; station << slID.station(); + stringstream sector; sector << slID.sector(); + stringstream superLayer; superLayer << slID.superlayer(); + + string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); + string folderName; + + if(parameters.getUntrackedParameter("calibModule", false)){ + folderName = + folderRoot + "DT/DTCalibValidation/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + "/"; + } + else{ + folderName = + folderRoot + "DT/DTResolutionAnalysisTask/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + "/"; + } + + string histoTag2D = parameters.getUntrackedParameter("histoTag2D", "hResDistVsDist"); + + string histoname = folderName + histoTag2D + + "_W" + wheel.str() + + "_St" + station.str() + + "_Sec" + sector.str() + + "_SL" + superLayer.str(); + + return histoname; + +} + +void DTResolutionTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch) { + + stringstream wheel; wheel << ch.wheel(); + stringstream sector; sector << ch.sector(); + + + string MeanHistoName = "MeanTest_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str(); + string SigmaHistoName = "SigmaTest_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str(); + string SlopeHistoName = "SlopeTest_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + wheel.str() + "_Sec" + sector.str(); + + + ibooker.setCurrentFolder("DT/Tests/DTResolution"); + + // Book the histo for the mean value and set the axis labels + + MeanHistos[make_pair(ch.wheel(),ch.sector())] = ibooker.book1D(MeanHistoName.c_str(),MeanHistoName.c_str(),11,0,11); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1); + (MeanHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1); + + + // Book the histo for the sigma value and set the axis labels + if(parameters.getUntrackedParameter("sigmaTest")){ + + SigmaHistos[make_pair(ch.wheel(),ch.sector())] = ibooker.book1D(SigmaHistoName.c_str(),SigmaHistoName.c_str(),11,0,11); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1); + (SigmaHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1); + } + + // Book the histo for the slope value and set the axis labels + if(parameters.getUntrackedParameter("slopeTest")){ + + SlopeHistos[make_pair(ch.wheel(),ch.sector())] = ibooker.book1D(SlopeHistoName.c_str(),SlopeHistoName.c_str(),11,0,11); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(1,"MB1_SL1",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(2,"MB1_SL2",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(3,"MB1_SL3",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(4,"MB2_SL1",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(5,"MB2_SL2",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(6,"MB2_SL3",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(7,"MB3_SL1",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(8,"MB3_SL2",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(9,"MB3_SL3",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(10,"MB4_SL1",1); + (SlopeHistos[make_pair(ch.wheel(),ch.sector())])->setBinLabel(11,"MB4_SL3",1); + } + + string HistoName = "W" + wheel.str() + "_Sec" + sector.str(); + + if(parameters.getUntrackedParameter("meanWrongHisto")){ + string MeanHistoNameSetRange = "MeanWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + + wheel.str() + "_Sec" + sector.str() + "_SetRange"; + + MeanHistosSetRange[HistoName] = ibooker.book1D(MeanHistoNameSetRange.c_str(),MeanHistoNameSetRange.c_str(),11,0.5,11.5); + string MeanHistoNameSetRange2D = "MeanWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D"; + MeanHistosSetRange2D[HistoName] = ibooker.book2D(MeanHistoNameSetRange2D.c_str(),MeanHistoNameSetRange2D.c_str(), + 11, 0.5, 11.5, 100, -0.05, 0.05); + } + + if(parameters.getUntrackedParameter("sigmaTest")){ + string SigmaHistoNameSetRange = "SigmaWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + + wheel.str() + "_Sec" + sector.str() + "_SetRange"; + + SigmaHistosSetRange[HistoName] = ibooker.book1D(SigmaHistoNameSetRange.c_str(),SigmaHistoNameSetRange.c_str(),11,0.5,11.5); + string SigmaHistoNameSetRange2D = "SigmaWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D"; + + SigmaHistosSetRange2D[HistoName] = ibooker.book2D(SigmaHistoNameSetRange2D.c_str(),SigmaHistoNameSetRange2D.c_str(), + 11, 0.5, 11.5, 500, 0, 0.5); + } + + if(parameters.getUntrackedParameter("slopeTest")){ + string SlopeHistoNameSetRange = "SlopeWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + + "_W" + wheel.str() + "_Sec" + sector.str() + "_SetRange"; + + SlopeHistosSetRange[HistoName] = ibooker.book1D(SlopeHistoNameSetRange.c_str(),SlopeHistoNameSetRange.c_str(),11,0.5,11.5); + string SlopeHistoNameSetRange2D = "SlopeWrong_" + parameters.getUntrackedParameter("STEP", "STEP3") + "_W" + + wheel.str() + "_Sec" + sector.str() + "_SetRange" + "_2D"; + + SlopeHistosSetRange2D[HistoName] = ibooker.book2D(SlopeHistoNameSetRange2D.c_str(),SlopeHistoNameSetRange2D.c_str(), + 11, 0.5, 11.5, 200, -0.1, 0.1); + } +} + +void DTResolutionTest::bookHistos(DQMStore::IBooker & ibooker, int wh) { + + + ibooker.setCurrentFolder("DT/CalibrationSummary"); + + if(wheelMeanHistos.find(3) == wheelMeanHistos.end()){ + string histoName = "MeanSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter("STEP", "STEP3"); + + wheelMeanHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3); + wheelMeanHistos[3]->setBinLabel(1,"Sector1",1); + wheelMeanHistos[3]->setBinLabel(1,"Sector1",1); + wheelMeanHistos[3]->setBinLabel(2,"Sector2",1); + wheelMeanHistos[3]->setBinLabel(3,"Sector3",1); + wheelMeanHistos[3]->setBinLabel(4,"Sector4",1); + wheelMeanHistos[3]->setBinLabel(5,"Sector5",1); + wheelMeanHistos[3]->setBinLabel(6,"Sector6",1); + wheelMeanHistos[3]->setBinLabel(7,"Sector7",1); + wheelMeanHistos[3]->setBinLabel(8,"Sector8",1); + wheelMeanHistos[3]->setBinLabel(9,"Sector9",1); + wheelMeanHistos[3]->setBinLabel(10,"Sector10",1); + wheelMeanHistos[3]->setBinLabel(11,"Sector11",1); + wheelMeanHistos[3]->setBinLabel(12,"Sector12",1); + wheelMeanHistos[3]->setBinLabel(13,"Sector13",1); + wheelMeanHistos[3]->setBinLabel(14,"Sector14",1); + wheelMeanHistos[3]->setBinLabel(1,"Wheel-2",2); + wheelMeanHistos[3]->setBinLabel(2,"Wheel-1",2); + wheelMeanHistos[3]->setBinLabel(3,"Wheel0",2); + wheelMeanHistos[3]->setBinLabel(4,"Wheel+1",2); + wheelMeanHistos[3]->setBinLabel(5,"Wheel+2",2); + } + + if(parameters.getUntrackedParameter("sigmaTest")){ + if(wheelSigmaHistos.find(3) == wheelSigmaHistos.end()){ + string histoName = "SigmaSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter("STEP", "STEP3"); + + wheelSigmaHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3); + wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1); + wheelSigmaHistos[3]->setBinLabel(1,"Sector1",1); + wheelSigmaHistos[3]->setBinLabel(2,"Sector2",1); + wheelSigmaHistos[3]->setBinLabel(3,"Sector3",1); + wheelSigmaHistos[3]->setBinLabel(4,"Sector4",1); + wheelSigmaHistos[3]->setBinLabel(5,"Sector5",1); + wheelSigmaHistos[3]->setBinLabel(6,"Sector6",1); + wheelSigmaHistos[3]->setBinLabel(7,"Sector7",1); + wheelSigmaHistos[3]->setBinLabel(8,"Sector8",1); + wheelSigmaHistos[3]->setBinLabel(9,"Sector9",1); + wheelSigmaHistos[3]->setBinLabel(10,"Sector10",1); + wheelSigmaHistos[3]->setBinLabel(11,"Sector11",1); + wheelSigmaHistos[3]->setBinLabel(12,"Sector12",1); + wheelSigmaHistos[3]->setBinLabel(13,"Sector13",1); + wheelSigmaHistos[3]->setBinLabel(14,"Sector14",1); + wheelSigmaHistos[3]->setBinLabel(1,"Wheel-2",2); + wheelSigmaHistos[3]->setBinLabel(2,"Wheel-1",2); + wheelSigmaHistos[3]->setBinLabel(3,"Wheel0",2); + wheelSigmaHistos[3]->setBinLabel(4,"Wheel+1",2); + wheelSigmaHistos[3]->setBinLabel(5,"Wheel+2",2); + } + } + + if(parameters.getUntrackedParameter("slopeTest")){ + if(wheelSlopeHistos.find(3) == wheelSlopeHistos.end()){ + string histoName = "SlopeSummaryRes_testFailedByAtLeastBadSL_" + parameters.getUntrackedParameter("STEP", "STEP3"); + + wheelSlopeHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,3); + wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1); + wheelSlopeHistos[3]->setBinLabel(1,"Sector1",1); + wheelSlopeHistos[3]->setBinLabel(2,"Sector2",1); + wheelSlopeHistos[3]->setBinLabel(3,"Sector3",1); + wheelSlopeHistos[3]->setBinLabel(4,"Sector4",1); + wheelSlopeHistos[3]->setBinLabel(5,"Sector5",1); + wheelSlopeHistos[3]->setBinLabel(6,"Sector6",1); + wheelSlopeHistos[3]->setBinLabel(7,"Sector7",1); + wheelSlopeHistos[3]->setBinLabel(8,"Sector8",1); + wheelSlopeHistos[3]->setBinLabel(9,"Sector9",1); + wheelSlopeHistos[3]->setBinLabel(10,"Sector10",1); + wheelSlopeHistos[3]->setBinLabel(11,"Sector11",1); + wheelSlopeHistos[3]->setBinLabel(12,"Sector12",1); + wheelSlopeHistos[3]->setBinLabel(13,"Sector13",1); + wheelSlopeHistos[3]->setBinLabel(14,"Sector14",1); + wheelSlopeHistos[3]->setBinLabel(1,"Wheel-2",2); + wheelSlopeHistos[3]->setBinLabel(2,"Wheel-1",2); + wheelSlopeHistos[3]->setBinLabel(3,"Wheel0",2); + wheelSlopeHistos[3]->setBinLabel(4,"Wheel+1",2); + wheelSlopeHistos[3]->setBinLabel(5,"Wheel+2",2); + } + } + + stringstream wheel; wheel <("STEP", "STEP3") + + "_W" + wheel.str(); + + wheelMeanHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11); + wheelMeanHistos[wh]->setBinLabel(1,"Sector1",1); + wheelMeanHistos[wh]->setBinLabel(2,"Sector2",1); + wheelMeanHistos[wh]->setBinLabel(3,"Sector3",1); + wheelMeanHistos[wh]->setBinLabel(4,"Sector4",1); + wheelMeanHistos[wh]->setBinLabel(5,"Sector5",1); + wheelMeanHistos[wh]->setBinLabel(6,"Sector6",1); + wheelMeanHistos[wh]->setBinLabel(7,"Sector7",1); + wheelMeanHistos[wh]->setBinLabel(8,"Sector8",1); + wheelMeanHistos[wh]->setBinLabel(9,"Sector9",1); + wheelMeanHistos[wh]->setBinLabel(10,"Sector10",1); + wheelMeanHistos[wh]->setBinLabel(11,"Sector11",1); + wheelMeanHistos[wh]->setBinLabel(12,"Sector12",1); + wheelMeanHistos[wh]->setBinLabel(13,"Sector13",1); + wheelMeanHistos[wh]->setBinLabel(14,"Sector14",1); + wheelMeanHistos[wh]->setBinLabel(1,"MB1_SL1",2); + wheelMeanHistos[wh]->setBinLabel(2,"MB1_SL2",2); + wheelMeanHistos[wh]->setBinLabel(3,"MB1_SL3",2); + wheelMeanHistos[wh]->setBinLabel(4,"MB2_SL1",2); + wheelMeanHistos[wh]->setBinLabel(5,"MB2_SL2",2); + wheelMeanHistos[wh]->setBinLabel(6,"MB2_SL3",2); + wheelMeanHistos[wh]->setBinLabel(7,"MB3_SL1",2); + wheelMeanHistos[wh]->setBinLabel(8,"MB3_SL2",2); + wheelMeanHistos[wh]->setBinLabel(9,"MB3_SL3",2); + wheelMeanHistos[wh]->setBinLabel(10,"MB4_SL1",2); + wheelMeanHistos[wh]->setBinLabel(11,"MB4_SL3",2); + } + + if(parameters.getUntrackedParameter("sigmaTest")){ + if(wheelSigmaHistos.find(wh) == wheelSigmaHistos.end()){ + string histoName = "SigmaSummaryRes_testFailed_" + parameters.getUntrackedParameter("STEP", "STEP3") + + "_W" + wheel.str(); + + wheelSigmaHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11); + wheelSigmaHistos[wh]->setBinLabel(1,"Sector1",1); + wheelSigmaHistos[wh]->setBinLabel(2,"Sector2",1); + wheelSigmaHistos[wh]->setBinLabel(3,"Sector3",1); + wheelSigmaHistos[wh]->setBinLabel(4,"Sector4",1); + wheelSigmaHistos[wh]->setBinLabel(5,"Sector5",1); + wheelSigmaHistos[wh]->setBinLabel(6,"Sector6",1); + wheelSigmaHistos[wh]->setBinLabel(7,"Sector7",1); + wheelSigmaHistos[wh]->setBinLabel(8,"Sector8",1); + wheelSigmaHistos[wh]->setBinLabel(9,"Sector9",1); + wheelSigmaHistos[wh]->setBinLabel(10,"Sector10",1); + wheelSigmaHistos[wh]->setBinLabel(11,"Sector11",1); + wheelSigmaHistos[wh]->setBinLabel(12,"Sector12",1); + wheelSigmaHistos[wh]->setBinLabel(13,"Sector13",1); + wheelSigmaHistos[wh]->setBinLabel(14,"Sector14",1); + wheelSigmaHistos[wh]->setBinLabel(1,"MB1_SL1",2); + wheelSigmaHistos[wh]->setBinLabel(2,"MB1_SL2",2); + wheelSigmaHistos[wh]->setBinLabel(3,"MB1_SL3",2); + wheelSigmaHistos[wh]->setBinLabel(4,"MB2_SL1",2); + wheelSigmaHistos[wh]->setBinLabel(5,"MB2_SL2",2); + wheelSigmaHistos[wh]->setBinLabel(6,"MB2_SL3",2); + wheelSigmaHistos[wh]->setBinLabel(7,"MB3_SL1",2); + wheelSigmaHistos[wh]->setBinLabel(8,"MB3_SL2",2); + wheelSigmaHistos[wh]->setBinLabel(9,"MB3_SL3",2); + wheelSigmaHistos[wh]->setBinLabel(10,"MB4_SL1",2); + wheelSigmaHistos[wh]->setBinLabel(11,"MB4_SL3",2); + } + } + + if(parameters.getUntrackedParameter("slopeTest")){ + if(wheelSlopeHistos.find(wh) == wheelSlopeHistos.end()){ + string histoName = "SlopeSummaryRes_testFailed_" + parameters.getUntrackedParameter("STEP", "STEP3") + + "_W" + wheel.str(); + + wheelSlopeHistos[wh] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,11,0,11); + wheelSlopeHistos[wh]->setBinLabel(1,"Sector1",1); + wheelSlopeHistos[wh]->setBinLabel(2,"Sector2",1); + wheelSlopeHistos[wh]->setBinLabel(3,"Sector3",1); + wheelSlopeHistos[wh]->setBinLabel(4,"Sector4",1); + wheelSlopeHistos[wh]->setBinLabel(5,"Sector5",1); + wheelSlopeHistos[wh]->setBinLabel(6,"Sector6",1); + wheelSlopeHistos[wh]->setBinLabel(7,"Sector7",1); + wheelSlopeHistos[wh]->setBinLabel(8,"Sector8",1); + wheelSlopeHistos[wh]->setBinLabel(9,"Sector9",1); + wheelSlopeHistos[wh]->setBinLabel(10,"Sector10",1); + wheelSlopeHistos[wh]->setBinLabel(11,"Sector11",1); + wheelSlopeHistos[wh]->setBinLabel(12,"Sector12",1); + wheelSlopeHistos[wh]->setBinLabel(13,"Sector13",1); + wheelSlopeHistos[wh]->setBinLabel(14,"Sector14",1); + wheelSlopeHistos[wh]->setBinLabel(1,"MB1_SL1",2); + wheelSlopeHistos[wh]->setBinLabel(2,"MB1_SL2",2); + wheelSlopeHistos[wh]->setBinLabel(3,"MB1_SL3",2); + wheelSlopeHistos[wh]->setBinLabel(4,"MB2_SL1",2); + wheelSlopeHistos[wh]->setBinLabel(5,"MB2_SL2",2); + wheelSlopeHistos[wh]->setBinLabel(6,"MB2_SL3",2); + wheelSlopeHistos[wh]->setBinLabel(7,"MB3_SL1",2); + wheelSlopeHistos[wh]->setBinLabel(8,"MB3_SL2",2); + wheelSlopeHistos[wh]->setBinLabel(9,"MB3_SL3",2); + wheelSlopeHistos[wh]->setBinLabel(10,"MB4_SL1",2); + wheelSlopeHistos[wh]->setBinLabel(11,"MB4_SL3",2); + } + } + +} + +int DTResolutionTest::stationFromBin(int bin) const { + return (int) (bin /3.1)+1; +} + + +int DTResolutionTest::slFromBin(int bin) const { + int ret = bin%3; + if(ret == 0 || bin == 11) ret = 3; + + return ret; +} diff --git a/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc1 b/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc1 new file mode 100644 index 0000000000000..4965d7dc3a2fd --- /dev/null +++ b/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc1 @@ -0,0 +1,277 @@ +/* + * \file DTtTrigCalibrationTest.cc + * + * \author M. Zanetti - CERN + * Modified by G. Mila - INFN Torino + * + * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my + * + * + */ + + +#include "DQM/DTMonitorClient/src/DTtTrigCalibrationTest.h" + +// Framework +#include + + +// Geometry +#include "Geometry/Records/interface/MuonGeometryRecord.h" +#include "Geometry/DTGeometry/interface/DTGeometry.h" + +#include +#include + +#include "DQMServices/Core/interface/DQMStore.h" +#include "DQMServices/Core/interface/MonitorElement.h" +#include "FWCore/MessageLogger/interface/MessageLogger.h" + +// the Timebox fitter +#include "CalibMuon/DTCalibration/interface/DTTimeBoxFitter.h" + +#include +#include +#include + +using namespace edm; +using namespace std; + +DTtTrigCalibrationTest::DTtTrigCalibrationTest(const edm::ParameterSet& ps){ + + edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: Constructor"; + + parameters = ps; + + theFitter = new DTTimeBoxFitter(); + + prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 3); + + percentual = parameters.getUntrackedParameter("BadSLpercentual", 10); + +} + + +DTtTrigCalibrationTest::~DTtTrigCalibrationTest(){ + + edm::LogVerbatim ("tTrigCalibration") <<"DTtTrigCalibrationTest: analyzed " << nevents << " events"; + + delete theFitter; + +} + + +void DTtTrigCalibrationTest::beginRun(Run const& run, EventSetup const& context) { + + edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: BeginRun"; + + nevents = 0; + + // Get the geometry + context.get().get(muonGeom); + +} + + + void DTtTrigCalibrationTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, + edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) { + + edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: End of LS transition, performing the DQM client operation"; + + // counts number of lumiSegs + nLumiSegs = lumiSeg.id().luminosityBlock(); + + // prescale factor + if ( nLumiSegs%prescaleFactor != 0 ) return; + + for(map ::const_iterator histo = wheelHistos.begin(); + histo != wheelHistos.end(); + histo++) { + (*histo).second->Reset(); + } + + edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: "<().get(tTrigMap); + float tTrig, tTrigRMS,kFactor; + + map , int> cmsHistos; + cmsHistos.clear(); + map , bool> filled; + for(int i=-2; i<3; i++){ + for(int j=1; j<15; j++){ + filled[make_pair(i,j)]=false; + } + } + + vector::const_iterator ch_it = muonGeom->chambers().begin(); + vector::const_iterator ch_end = muonGeom->chambers().end(); + for (; ch_it != ch_end; ++ch_it) { + + vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); + vector::const_iterator sl_end = (*ch_it)->superLayers().end(); + for(; sl_it != sl_end; ++sl_it) { + + DTSuperLayerId slID = (*sl_it)->id(); + + MonitorElement * tb_histo = igetter.get(getMEName(slID)); + if (tb_histo) { + + edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: I've got the histo!!"; + + TH1F * tb_histo_root = tb_histo->getTH1F(); + + pair meanAndSigma = theFitter->fitTimeBox(tb_histo_root); + + // ttrig and rms are counts + tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts ); + + if (histos.find((*ch_it)->id().rawId()) == histos.end()) bookHistos(ibooker,(*ch_it)->id()); + histos.find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(), meanAndSigma.first-tTrig); + + } + } + + if (histos.find((*ch_it)->id().rawId()) != histos.end()) { + string criterionName = parameters.getUntrackedParameter("tTrigTestName","tTrigOffSet"); + const QReport * theQReport = histos.find((*ch_it)->id().rawId())->second->getQReport(criterionName); + if(theQReport) { + vector badChannels = theQReport->getBadChannels(); + for (vector::iterator channel = badChannels.begin(); + channel != badChannels.end(); channel++) { + edm::LogError ("tTrigCalibration") <<"Chamber ID : "<<(*ch_it)->id()<<" Bad channels: "<<(*channel).getBin()<<" "<<(*channel).getContents(); + + if(wheelHistos.find((*ch_it)->id().wheel()) == wheelHistos.end()) bookHistos(ibooker,(*ch_it)->id(), (*ch_it)->id().wheel()); + // fill the wheel summary histos if the SL has not passed the test + if(!((*ch_it)->id().station() == 4 && (*channel).getBin() == 3)) + wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,((*channel).getBin()-1)+3*((*ch_it)->id().station()-1)); + else + wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,10); + // fill the cms summary histo if the percentual of SL which have not passed the test + // is more than a predefined treshold + cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]++; + if(((*ch_it)->id().sector()<13 && + double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/11>double(percentual)/100 && + filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false) || + ((*ch_it)->id().sector()>=13 && + double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/2>double(percentual)/100 && + filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false)){ + filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]=true; + wheelHistos[3]->Fill((*ch_it)->id().sector()-1,(*ch_it)->id().wheel()); + } + } + } + } + + } + +} + +void DTtTrigCalibrationTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { + + edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest] endjob called!"; + +} + + + + +string DTtTrigCalibrationTest::getMEName(const DTSuperLayerId & slID) { + + stringstream wheel; wheel << slID.wheel(); + stringstream station; station << slID.station(); + stringstream sector; sector << slID.sector(); + stringstream superLayer; superLayer << slID.superlayer(); + + string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); + string folderTag = parameters.getUntrackedParameter("folderTag", "TimeBoxes"); + string folderName = + folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() + + "/Station" + station.str() + + "/Sector" + sector.str() + "/" + folderTag + "/"; + + string histoTag = parameters.getUntrackedParameter("histoTag", "TimeBox"); + string histoname = folderName + histoTag + + "_W" + wheel.str() + + "_St" + station.str() + + "_Sec" + sector.str() + + "_SL" + superLayer.str(); + + return histoname; + +} + +void DTtTrigCalibrationTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch) { + + stringstream wheel; wheel << ch.wheel(); + stringstream station; station << ch.station(); + stringstream sector; sector << ch.sector(); + + string histoName = "tTrigTest_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); + ibooker.setCurrentFolder("DT/Tests/DTtTrigCalibration"); + + histos[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,2); + +} + +void DTtTrigCalibrationTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch, int wh) { + + ibooker.setCurrentFolder("DT/Tests/DTtTrigCalibration/SummaryPlot"); + + if(wheelHistos.find(3) == wheelHistos.end()){ + string histoName = "t_TrigSummary_testFailedByAtLeastBadSL"; + wheelHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2); + wheelHistos[3]->setBinLabel(1,"Sector1",1); + wheelHistos[3]->setBinLabel(1,"Sector1",1); + wheelHistos[3]->setBinLabel(2,"Sector2",1); + wheelHistos[3]->setBinLabel(3,"Sector3",1); + wheelHistos[3]->setBinLabel(4,"Sector4",1); + wheelHistos[3]->setBinLabel(5,"Sector5",1); + wheelHistos[3]->setBinLabel(6,"Sector6",1); + wheelHistos[3]->setBinLabel(7,"Sector7",1); + wheelHistos[3]->setBinLabel(8,"Sector8",1); + wheelHistos[3]->setBinLabel(9,"Sector9",1); + wheelHistos[3]->setBinLabel(10,"Sector10",1); + wheelHistos[3]->setBinLabel(11,"Sector11",1); + wheelHistos[3]->setBinLabel(12,"Sector12",1); + wheelHistos[3]->setBinLabel(13,"Sector13",1); + wheelHistos[3]->setBinLabel(14,"Sector14",1); + wheelHistos[3]->setBinLabel(1,"Wheel-2",2); + wheelHistos[3]->setBinLabel(2,"Wheel-1",2); + wheelHistos[3]->setBinLabel(3,"Wheel0",2); + wheelHistos[3]->setBinLabel(4,"Wheel+1",2); + wheelHistos[3]->setBinLabel(5,"Wheel+2",2); + } + + stringstream wheel; wheel <setBinLabel(1,"Sector1",1); + wheelHistos[wh]->setBinLabel(2,"Sector2",1); + wheelHistos[wh]->setBinLabel(3,"Sector3",1); + wheelHistos[wh]->setBinLabel(4,"Sector4",1); + wheelHistos[wh]->setBinLabel(5,"Sector5",1); + wheelHistos[wh]->setBinLabel(6,"Sector6",1); + wheelHistos[wh]->setBinLabel(7,"Sector7",1); + wheelHistos[wh]->setBinLabel(8,"Sector8",1); + wheelHistos[wh]->setBinLabel(9,"Sector9",1); + wheelHistos[wh]->setBinLabel(10,"Sector10",1); + wheelHistos[wh]->setBinLabel(11,"Sector11",1); + wheelHistos[wh]->setBinLabel(12,"Sector12",1); + wheelHistos[wh]->setBinLabel(13,"Sector13",1); + wheelHistos[wh]->setBinLabel(14,"Sector14",1); + wheelHistos[wh]->setBinLabel(1,"MB1_SL1",2); + wheelHistos[wh]->setBinLabel(2,"MB1_SL2",2); + wheelHistos[wh]->setBinLabel(3,"MB1_SL3",2); + wheelHistos[wh]->setBinLabel(4,"MB2_SL1",2); + wheelHistos[wh]->setBinLabel(5,"MB2_SL2",2); + wheelHistos[wh]->setBinLabel(6,"MB2_SL3",2); + wheelHistos[wh]->setBinLabel(7,"MB3_SL1",2); + wheelHistos[wh]->setBinLabel(8,"MB3_SL2",2); + wheelHistos[wh]->setBinLabel(9,"MB3_SL3",2); + wheelHistos[wh]->setBinLabel(10,"MB4_SL1",2); + wheelHistos[wh]->setBinLabel(11,"MB4_SL3",2); + +} + From 094e178b0f8002e82a391950430b1f094d3fe040 Mon Sep 17 00:00:00 2001 From: Francesca Cavallo Date: Sat, 25 Apr 2015 19:02:22 +0200 Subject: [PATCH 08/10] restored DTResolutionTest --- .../src/#DTRunConditionVarClient.cc# | 343 --------- .../src/DTCreateSummaryHistos.cc1 | 713 ------------------ DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 | 226 ------ DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 | 203 ----- DQM/DTMonitorClient/src/DTNoiseTest.cc1 | 314 -------- .../src/DTtTrigCalibrationTest.cc1 | 277 ------- DQM/DTMonitorClient/src/SealModule.cc | 5 +- 7 files changed, 4 insertions(+), 2077 deletions(-) delete mode 100644 DQM/DTMonitorClient/src/#DTRunConditionVarClient.cc# delete mode 100644 DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc1 delete mode 100644 DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 delete mode 100644 DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 delete mode 100644 DQM/DTMonitorClient/src/DTNoiseTest.cc1 delete mode 100644 DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc1 diff --git a/DQM/DTMonitorClient/src/#DTRunConditionVarClient.cc# b/DQM/DTMonitorClient/src/#DTRunConditionVarClient.cc# deleted file mode 100644 index 0e356865eabf3..0000000000000 --- a/DQM/DTMonitorClient/src/#DTRunConditionVarClient.cc# +++ /dev/null @@ -1,343 +0,0 @@ -/******* \class DTRunConditionVarClient ******* - * - * Description: - * - * detailed description - * - * \author : Paolo Bellan, Antonio Branca - * $date : 23/09/2011 15:42:04 CET $ - * - * Modification: - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - *********************************/ - -#include -#include -#include - -#include -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "CondFormats/DataRecord/interface/DTMtimeRcd.h" - -#include -#include -#include - -using namespace edm; -using namespace std; - -DTRunConditionVarClient::DTRunConditionVarClient(const ParameterSet& pSet) -{ - - LogVerbatim ("DTDQM|DTMonitorClient|DTRunConditionVarClient") - << "DTRunConditionVarClient: Constructor called"; - - - minRangeVDrift = pSet.getUntrackedParameter("minRangeVDrift"); - maxRangeVDrift = pSet.getUntrackedParameter("maxRangeVDrift"); - minRangeT0 = pSet.getUntrackedParameter("minRangeT0"); - maxRangeT0 = pSet.getUntrackedParameter("maxRangeT0"); - - maxGoodVDriftDev = pSet.getUntrackedParameter("maxGoodVDriftDev"); - minBadVDriftDev = pSet.getUntrackedParameter("minBadVDriftDev"); - maxGoodT0 = pSet.getUntrackedParameter("maxGoodT0"); - minBadT0 = pSet.getUntrackedParameter("minBadT0"); - - maxGoodVDriftSigma = pSet.getUntrackedParameter("maxGoodVDriftSigma"); - minBadVDriftSigma = pSet.getUntrackedParameter("minBadVDriftSigma"); - maxGoodT0Sigma = pSet.getUntrackedParameter("maxGoodT0Sigma"); - minBadT0Sigma = pSet.getUntrackedParameter("minBadT0Sigma"); - - nevents = 0; - - bookingdone = 0; - -} - -DTRunConditionVarClient::~DTRunConditionVarClient() -{ - LogVerbatim ("DTDQM|DTMonitorClient|DTRunConditionVarClient") - << "DTRunConditionVarClient: Destructor called"; -} - -void DTRunConditionVarClient::beginRun(const Run& run, const EventSetup& context){ - - LogTrace ("DTDQM|DTMonitorClient|DTResolutionAnalysisTest") <<"[DTRunConditionVarClient]: BeginRun"; - // Get the map of vdrift from the setup - context.get().get(mTime); - mTimeMap_ = &*mTime; -} - - - - void DTRunConditionVarClient::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, - edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) -{ - -} - -void DTRunConditionVarClient::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) -{ - LogVerbatim ("DTDQM|DTMonitorClient|DTRunConditionVarClient") - << "DTRunConditionVarClient: end job"; - - ibooker.setCurrentFolder("DT/02-Segments"); - - glbVDriftSummary = ibooker.book2D("VDriftGlbSummary", "# of MBs with good mean and good sigma of vDrift",12,1,13,5,-2,3); - glbT0Summary = ibooker.book2D("T0GlbSummary", "# of MBs with good mean and good sigma of t0",12,1,13,5,-2,3); - - ibooker.setCurrentFolder("DT/02-Segments/02-MeanVDrift"); - - summaryHistos["MeanVDriftGlbSummary"] = ibooker.book2D("MeanVDriftGlbSummary","mean VDrift average per sector",12,1.,13.,5,-2.,3.); - allwheelHistos["allMeanVDrift"] = ibooker.book1D("VDriftMeanAllWheels","mean VDrift for all chambers",60,0.0048,0.006); - - ibooker.setCurrentFolder("DT/02-Segments/02-SigmaVDrift"); - - summaryHistos["SigmaVDriftGlbSummary"] = ibooker.book2D("SigmaVDriftGlbSummary","# of Chambers with good sigma VDrift",12,1.,13.,5,-2.,3.); - allwheelHistos["allSigmaVDrift"] = ibooker.book1D("VDriftSigmaAllWheels","sigma VDrift for all chambers",30,0.,0.0006); - - ibooker.setCurrentFolder("DT/02-Segments/03-MeanT0"); - - summaryHistos["MeanT0GlbSummary"] = ibooker.book2D("MeanT0GlbSummary","mean T0 average per sector",12,1.,13.,5,-2.,3.); - allwheelHistos["allMeanT0"] = ibooker.book1D("T0MeanAllWheels","mean T0 for all chambers",100,-25.,25.); - - ibooker.setCurrentFolder("DT/02-Segments/03-SigmaT0"); - - summaryHistos["SigmaT0GlbSummary"] = ibooker.book2D("SigmaT0GlbSummary","# of Chambers with good sigma T0",12,1.,13.,5,-2.,3.); - allwheelHistos["allSigmaT0"] = ibooker.book1D("T0SigmaAllWheels","sigma T0 for alla chambers",50,0,25); - - for(int wh=-2; wh<=2; wh++) { - bookWheelHistos(ibooker,"MeanVDrift","02-MeanVDrift",wh,60,0.0048,0.006,true); - bookWheelHistos(ibooker,"SigmaVDrift","02-SigmaVDrift",wh,30,0.,0.0006); - bookWheelHistos(ibooker,"MeanT0","03-MeanT0",wh,100,-25.,25.); - bookWheelHistos(ibooker,"SigmaT0","03-SigmaT0",wh,50,0,25); - } - - - for(int wheel=-2;wheel<=2;wheel++){ - for(int sec=1; sec<=14; sec++) { - for(int stat=1; stat<=4; stat++) { - - if( (sec == 13 || sec == 14) && stat != 4 ) continue; - - // Get the ME produced by DTRunConditionVar Source - MonitorElement* VDriftME = getChamberHistos(igetter,DTChamberId(wheel,stat,sec),"VDrift_FromSegm"); - MonitorElement* T0ME = getChamberHistos(igetter,DTChamberId(wheel,stat,sec),"T0_FromSegm"); - - if (!VDriftME || !T0ME) { - edm::LogWarning("DTRunConditionVarClient") << "ME not available" << std::endl; - return; - } - - - // Get the means per chamber - float vDriftMean = VDriftME->getMean(); - float t0Mean = T0ME->getMean(); - - // Get the sigma per chamber - float vDriftSigma = VDriftME->getRMS(); - float t0Sigma = T0ME->getRMS(); - - if( VDriftME->getEntries() != 0 ) { - - allwheelHistos["allMeanVDrift"] -> Fill(vDriftMean); - allwheelHistos["allSigmaVDrift"] -> Fill(vDriftSigma); - - (wheelHistos[wheel])["MeanVDrift"] -> Fill(vDriftMean); - (wheelHistos[wheel])["SigmaVDrift"] -> Fill(vDriftSigma); - - } - - - if( T0ME->getEntries() != 0 ) { - - allwheelHistos["allMeanT0"] -> Fill(t0Mean); - allwheelHistos["allSigmaT0"] -> Fill(t0Sigma); - - (wheelHistos[wheel])["MeanT0"] -> Fill(t0Mean); - (wheelHistos[wheel])["SigmaT0"] -> Fill(t0Sigma); - - } - - DTChamberId indexCh(wheel,stat,sec); - - float vDriftDev(0.), errvDriftDev(0.); - percDevVDrift(indexCh, vDriftMean, vDriftSigma, vDriftDev, errvDriftDev); - - int sec_ = sec; - if( sec == 13 || sec == 14 ) sec_ = ( sec == 13 ) ? 4 : 10; - - float fillvDriftDev = max(min(vDriftDev,maxRangeVDrift),minRangeVDrift); - float fillT0Mean = max(min(t0Mean,maxRangeT0),minRangeT0); - - float vDriftDevQ = varQuality(fabs(vDriftDev),maxGoodVDriftDev,minBadVDriftDev); - float t0MeanQ = varQuality(fabs(t0Mean),maxGoodT0,minBadT0); - - float vDriftSigmQ = varQuality(vDriftSigma,maxGoodVDriftSigma,minBadVDriftSigma); - float t0SigmQ = varQuality(t0Sigma,maxGoodT0Sigma,minBadT0Sigma); - - if( sec == 13 || sec == 14 ) { - - float binVDriftDev = (wheelHistos[wheel])["MeanVDriftSummary"]->getBinContent(sec_,stat); - binVDriftDev = (fabs(binVDriftDev) > fabs(fillvDriftDev)) ? binVDriftDev : fillvDriftDev; - (wheelHistos[wheel])["MeanVDriftSummary"] -> setBinContent(sec_,stat,binVDriftDev); - - float binT0MeanVal = (wheelHistos[wheel])["MeanT0Summary"] -> getBinContent(sec_,stat); - binT0MeanVal = (fabs(binT0MeanVal) > fabs(fillT0Mean)) ? binT0MeanVal : fillT0Mean; - (wheelHistos[wheel])["MeanT0Summary"] -> setBinContent(sec_,stat,binT0MeanVal); - - float binVDriftSigmVal = (wheelHistos[wheel])["SigmaVDriftSummary"] -> getBinContent(sec_,stat); - binVDriftSigmVal = (binVDriftSigmVal > 0. && binVDriftSigmVal < vDriftSigmQ) ? binVDriftSigmVal : vDriftSigmQ; - (wheelHistos[wheel])["SigmaVDriftSummary"] -> setBinContent(sec_,stat,binVDriftSigmVal); - - float binT0SigmVal = (wheelHistos[wheel])["SigmaT0Summary"] -> getBinContent(sec_,stat); - binT0SigmVal = (binT0SigmVal > 0. && binT0SigmVal < t0SigmQ) ? binT0SigmVal : t0SigmQ; - (wheelHistos[wheel])["SigmaT0Summary"] -> setBinContent(sec_,stat,binT0SigmVal); - - } else { - - (wheelHistos[wheel])["MeanVDriftSummary"] -> setBinContent(sec_,stat,fillvDriftDev); - (wheelHistos[wheel])["MeanT0Summary"] -> setBinContent(sec_,stat,fillT0Mean); - (wheelHistos[wheel])["SigmaVDriftSummary"] -> setBinContent(sec_,stat,vDriftSigmQ); - (wheelHistos[wheel])["SigmaT0Summary"] -> setBinContent(sec_,stat,t0SigmQ); - - } - - double weight = 1/4.; - if(( sec_ == 4 || sec_ == 10) && stat == 4) weight = 1/8.; - - if( vDriftDevQ > 0.85 && vDriftSigmQ > 0.85 ) { - glbVDriftSummary -> Fill(sec_,wheel,weight); - summaryHistos["MeanVDriftGlbSummary"] -> Fill(sec_,wheel,weight); - summaryHistos["SigmaVDriftGlbSummary"] -> Fill(sec_,wheel,weight); - - } else { - if( vDriftDevQ > 0.85 && vDriftSigmQ < 0.85 ) { - summaryHistos["MeanVDriftGlbSummary"] -> Fill(sec_,wheel,weight); - } - if( vDriftDevQ < 0.85 && vDriftSigmQ > 0.85 ) { - summaryHistos["SigmaVDriftGlbSummary"] -> Fill(sec_,wheel,weight); - } - } - - if( t0MeanQ > 0.85 && t0SigmQ > 0.85 ) { - glbT0Summary -> Fill(sec_,wheel,weight); - summaryHistos["MeanT0GlbSummary"] -> Fill(sec_,wheel,weight); - summaryHistos["SigmaT0GlbSummary"] -> Fill(sec_,wheel,weight); - } else { - if( t0MeanQ > 0.85 && t0SigmQ < 0.85 ) { - summaryHistos["MeanT0GlbSummary"] -> Fill(sec_,wheel,weight); - - } - if( t0MeanQ < 0.85 && t0SigmQ > 0.85 ) { - summaryHistos["SigmaT0GlbSummary"] -> Fill(sec_,wheel,weight); - } - } - - - }// end loop on stations - }// end loop on sectors - }//end loop on wheels - - return; -} - -float DTRunConditionVarClient::varQuality(float var, float maxGood, float minBad) { - - float qual(0); - if( var <= maxGood ) {qual = 1.;} - else if( var > maxGood && var < minBad ) {qual = 0.9;} - else if( var >= minBad ) {qual = 0.1;} - - return qual; -} - -void DTRunConditionVarClient::percDevVDrift(DTChamberId indexCh, float meanVD, float sigmaVD, float& devVD, float& errdevVD) { - - DTSuperLayerId indexSLPhi1(indexCh,1); - DTSuperLayerId indexSLPhi2(indexCh,3); - - float vDriftPhi1(0.), vDriftPhi2(0.); - float ResPhi1(0.), ResPhi2(0.); - int status1 = mTimeMap_->get(indexSLPhi1,vDriftPhi1,ResPhi1,DTVelocityUnits::cm_per_ns); - int status2 = mTimeMap_->get(indexSLPhi2,vDriftPhi2,ResPhi2,DTVelocityUnits::cm_per_ns); - - if(status1 != 0 || status2 != 0) { - DTSuperLayerId sl = (status1 != 0) ? indexSLPhi1 : indexSLPhi2; - throw cms::Exception("DTRunConditionVarClient") << "Could not find vDrift entry in DB for" - << sl << endl; - } - - float vDriftMed = (vDriftPhi1 + vDriftPhi2) / 2.; - - devVD = (meanVD - vDriftMed) / vDriftMed; - devVD = devVD < 1. ? devVD : 1.; - - errdevVD = sigmaVD/vDriftMed; - - return; -} - -void DTRunConditionVarClient::bookWheelHistos(DQMStore::IBooker & ibooker, string histoType, string subfolder, - int wh, int nbins, float min, float max, bool isVDCorr ) -{ - stringstream wheel; wheel << wh; - - string folder = "DT/02-Segments/" + subfolder; - - ibooker.setCurrentFolder(folder); - - string histoName = histoType + "_W" + wheel.str(); - string histoLabel = histoType; - - (wheelHistos[wh])[histoType] = ibooker.book1D(histoName, histoLabel, nbins, min, max); - - if( isVDCorr ) { - histoLabel = "Summary of corrections to VDrift DB values"; - histoName = "CorrTo" + histoType + "Summary_W" + wheel.str(); - } else { - histoLabel = histoType + "Summary"; - histoName = histoType + "Summary_W" + wheel.str(); - } - - MonitorElement* me = ibooker.book2D(histoName, histoLabel,12,1,13,4,1,5); - - me->setBinLabel(1,"MB1",2); - me->setBinLabel(2,"MB2",2); - me->setBinLabel(3,"MB3",2); - me->setBinLabel(4,"MB4",2); - me->setAxisTitle("Sector",1); - - (wheelHistos[wh])[histoType + "Summary"] = me; - - return; -} - -MonitorElement* DTRunConditionVarClient::getChamberHistos(DQMStore::IGetter & igetter,const DTChamberId& dtCh, string histoType) { - - int wh = dtCh.wheel(); - int sc = dtCh.sector(); - int st = dtCh.station(); - stringstream wheel; wheel << wh; - stringstream station; station << st; - stringstream sector; sector << sc; - - string folder = "DT/02-Segments/Wheel" + wheel.str() + "/Sector" + sector.str() + "/Station" + station.str(); - string histoTag = "_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - string MEpath = folder + "/" + histoType + histoTag; - - igetter.setCurrentFolder(folder); - - LogTrace ("DTDQM|DTMonitorModule|DTRunConditionVar") - << "[DTRunConditionVar]: getting ME from " << folder << endl; - - MonitorElement* ME = igetter.get(MEpath); - - return ME; -} diff --git a/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc1 b/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc1 deleted file mode 100644 index cad3965c88c18..0000000000000 --- a/DQM/DTMonitorClient/src/DTCreateSummaryHistos.cc1 +++ /dev/null @@ -1,713 +0,0 @@ -/* - * See header file for a description of this class. - * - * \author G. Mila - INFN Torino - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah ncpp-um-my - * - */ - - -#include - -// Framework -#include - - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" - -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include -#include -#include - -#include "TCanvas.h" -#include "TFile.h" -#include "TProfile.h" - -using namespace edm; -using namespace std; - -DTCreateSummaryHistos::DTCreateSummaryHistos(const edm::ParameterSet& ps){ - - edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos]: Constructor"; - - parameters = ps; - - // The root file which contain the histos - string rootFileName = ps.getUntrackedParameter("rootFileName", "DTEfficiencyTest.root"); - theFile = new TFile(rootFileName.c_str(), "READ"); - - // The *.ps file which contains the summary histos - PsFileName = ps.getUntrackedParameter("PsFileName", "DTSummaryHistos"); - - // Files to write in the *.ps file - DataIntegrityHistos = ps.getUntrackedParameter("DataIntegrityHistos", false); - DigiHistos = ps.getUntrackedParameter("DigiHistos", false); - RecoHistos = ps.getUntrackedParameter("RecoHistos", false); - ResoHistos = ps.getUntrackedParameter("ResoHistos", false); - EfficiencyHistos = ps.getUntrackedParameter("EfficiencyHistos", false); - TestPulsesHistos = ps.getUntrackedParameter("TestPulsesHistos", false); - TriggerHistos = ps.getUntrackedParameter("TriggerHistos", false); - - // The DDU Id - DDUId = ps.getUntrackedParameter("DDUId"); - - MainFolder = "DQMData/DT/"; - - nevents = 0; - -} - -DTCreateSummaryHistos::~DTCreateSummaryHistos(){ - - edm::LogVerbatim ("histos") << "DTCreateSummaryHistos: analyzed " << nevents << " events"; - theFile->Close(); - -} - -void DTCreateSummaryHistos::beginRun(const edm::Run& run, const edm::EventSetup& context){ - - // Get the geometry - context.get().get(muonGeom); - -} - -void DTCreateSummaryHistos::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - - edm::LogVerbatim ("histos") << "[DTCreateSummaryHistos] endjob called!"; - - stringstream RunNum; RunNum << runNumber; - string PsFileNameWithRun = PsFileName + "_" + RunNum.str() + ".ps"; - TPostScript psFile(PsFileNameWithRun.c_str(),111); - psFile.Range(20,26); - //psFile.NewPage(); - TCanvas c1("c1","",600,780); - - - - // DataIntegrity summary histos ************************************************************** - if(DataIntegrityHistos){ - c1.Clear(); - c1.Divide(2,2); - stringstream dduID; dduID << DDUId; - - string histo_name1 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_TTSValues"; - TH1F *histo1 = (TH1F*) theFile -> Get(histo_name1.c_str()); - c1.cd(1); - if(histo1) - histo1->Draw(); - - string histo_name2 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSStatus"; - TH1F *histo2 = (TH1F*) theFile -> Get(histo_name2.c_str()); - c1.cd(2); - if(histo2) - histo2->Draw(); - - string histo_name3 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/FED" + dduID.str() + "_ROSSummary"; - TH1F *histo3 = (TH1F*) theFile -> Get(histo_name3.c_str()); - c1.cd(3); - if(histo3) - histo3->Draw(); - - string histo_name4 = MainFolder + "DataIntegrity/FED" + dduID.str() + "/ROS1/FED" + dduID.str() + "_ROS1_ROSError"; - TH1F *histo4 = (TH1F*) theFile -> Get(histo_name4.c_str()); - c1.cd(4); - if(histo4) - histo4->Draw(); - - c1.Update(); - psFile.NewPage(); - } - - // Digi summary histos ******************************************************************** - if(DigiHistos){ - // Time Box Histos - c1.Clear(); - c1.Divide(3,4); - // Loop over all the chambers - vector::const_iterator ch_digi_it = muonGeom->chambers().begin(); - vector::const_iterator ch_digi_end = muonGeom->chambers().end(); - for (; ch_digi_it != ch_digi_end; ++ch_digi_it) { - DTChamberId ch = (*ch_digi_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - vector::const_iterator sl_it = (*ch_digi_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_digi_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - - string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); - string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/TimeBoxes/TimeBox_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str(); - TH1F *histo = (TH1F *) theFile->Get(histo_name.c_str()); - if(histo){ - int pad = (ch.station() - 1)*3 + sl.superlayer(); - c1.cd(pad); - histo->Draw(); - } - } - } - c1.Update(); - psFile.NewPage(); - - // Occupancy in Time Histos - c1.Clear(); - c1.Divide(4,3); - // Loop over all the chambers - vector::const_iterator ch_digi2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_digi2_end = muonGeom->chambers().end(); - for (; ch_digi2_it != ch_digi2_end; ++ch_digi2_it) { - DTChamberId ch = (*ch_digi2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_digi2_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_digi2_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); - string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyInTimeHits_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found){ - c1.Update(); - psFile.NewPage(); - } - } - - // Occupancy Noise - // Loop over all the chambers - vector::const_iterator ch_digi3_it = muonGeom->chambers().begin(); - vector::const_iterator ch_digi3_end = muonGeom->chambers().end(); - for (; ch_digi3_it != ch_digi3_end; ++ch_digi3_it) { - DTChamberId ch = (*ch_digi3_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_digi3_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_digi3_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); - string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/Occupancies/OccupancyNoise_perL_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str()+ "_SL" + superLayer.str() + "_L" + layer.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found) { - c1.Update(); - psFile.NewPage(); - } - } - - // Digi Per Event - // Loop over all the chambers - vector::const_iterator ch_digi4_it = muonGeom->chambers().begin(); - vector::const_iterator ch_digi4_end = muonGeom->chambers().end(); - for (; ch_digi4_it != ch_digi4_end; ++ch_digi4_it) { - DTChamberId ch = (*ch_digi4_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_digi4_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_digi4_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string digiFolder = MainFolder + "DTDigiTask/Wheel" + wheel.str(); - string histo_name = digiFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/DigiPerEvent/DigiPerEvent_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); - TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found){ - c1.Update(); - psFile.NewPage(); - } - } - } - - // Reconstruction summary histos ********************************************************* - if(RecoHistos){ - // reco segment Histos - page1 - c1.Clear(); - c1.Divide(2,4); - // Loop over all the chambers - vector::const_iterator ch_reco_it = muonGeom->chambers().begin(); - vector::const_iterator ch_reco_end = muonGeom->chambers().end(); - for (; ch_reco_it != ch_reco_end; ++ch_reco_it) { - DTChamberId ch = (*ch_reco_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str(); - string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hN4DSeg_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - int pad = (ch.station() - 1)*2 + 1; - c1.cd(pad); - histo->Draw(); - } - histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmXvsYInCham_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TProfile *histo2 = (TProfile*) theFile -> Get(histo_name.c_str()); - if(histo2){ - int pad = (ch.station() - 1)*2 + 2; - c1.cd(pad); - histo2->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - // reco segment Histos - page2 - // Loop over all the chambers - vector::const_iterator ch_reco2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_reco2_end = muonGeom->chambers().end(); - for (; ch_reco2_it != ch_reco2_end; ++ch_reco2_it) { - DTChamberId ch = (*ch_reco2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string recoFolder = MainFolder + "DTSegmentAnalysisTask/Wheel" + wheel.str(); - string histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmPhiDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo) { - int pad = (ch.station() - 1)*2 + 1; - c1.cd(pad); - histo->Draw(); - } - histo_name = recoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/h4DSegmThetaDirection_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo2 = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo2) { - int pad = (ch.station() - 1)*2 + 2; - c1.cd(pad); - histo2->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - } - - // Resolution summary histos ******************************************************************* - if(ResoHistos){ - // Residuals histos - c1.Clear(); - c1.Divide(3,4); - // Loop over all the chambers - vector::const_iterator ch_reso_it = muonGeom->chambers().begin(); - vector::const_iterator ch_reso_end = muonGeom->chambers().end(); - for (; ch_reso_it != ch_reso_end; ++ch_reso_it) { - DTChamberId ch = (*ch_reso_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - vector::const_iterator sl_it = (*ch_reso_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_reso_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - - string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str(); - string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - int pad = (ch.station() - 1)*3 + sl.superlayer(); - c1.cd(pad); - histo->Draw(); - } - } - } - c1.Update(); - psFile.NewPage(); - - // Residuals as a function of the position Histos - // Loop over all the chambers - vector::const_iterator ch_reso2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_reso2_end = muonGeom->chambers().end(); - for (; ch_reso2_it != ch_reso2_end; ++ch_reso2_it) { - DTChamberId ch = (*ch_reso2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - vector::const_iterator sl_it = (*ch_reso2_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_reso2_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - stringstream superLayer; superLayer << sl.superlayer(); - - string resoFolder = MainFolder + "DTResolutionAnalysisTask/Wheel" + wheel.str(); - string histo_name = resoFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/hResDistVsDist_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str(); - TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str()); - if(histo){ - int pad = (ch.station() - 1)*3 + sl.superlayer(); - c1.cd(pad); - histo->Draw(); - } - } - } - c1.Update(); - psFile.NewPage(); - } - - // Efficiency summary histos ****************************************************************** - if(EfficiencyHistos){ - // Cell efficiency - c1.Clear(); - c1.Divide(4,3); - // Loop over all the chambers - vector::const_iterator ch_eff_it = muonGeom->chambers().begin(); - vector::const_iterator ch_eff_end = muonGeom->chambers().end(); - for (; ch_eff_it != ch_eff_end; ++ch_eff_it) { - DTChamberId ch = (*ch_eff_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_eff_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_eff_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string efficiencyFolder = MainFolder + "Tests/DTEfficiency/Wheel" + wheel.str(); - string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/UnassEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found){ - c1.Update(); - psFile.NewPage(); - } - } - - // Chamber X efficiency - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_eff2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_eff2_end = muonGeom->chambers().end(); - for (; ch_eff2_it != ch_eff2_end; ++ch_eff2_it) { - DTChamberId ch = (*ch_eff2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str(); - string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/xEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - // Chamber Y efficiency - // Loop over all the chambers - vector::const_iterator ch_eff3_it = muonGeom->chambers().begin(); - vector::const_iterator ch_eff3_end = muonGeom->chambers().end(); - for (; ch_eff3_it != ch_eff3_end; ++ch_eff3_it) { - DTChamberId ch = (*ch_eff3_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string efficiencyFolder = MainFolder + "Tests/DTChamberEfficiency/Wheel" + wheel.str(); - string histo_name = efficiencyFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/yEfficiency_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - } - - // Test Pulses Summary Histos ************************************************************** - if(TestPulsesHistos){ - c1.Clear(); - c1.Divide(4,3); - // Loop over all the chambers - vector::const_iterator ch_TP_it = muonGeom->chambers().begin(); - vector::const_iterator ch_TP_end = muonGeom->chambers().end(); - for (; ch_TP_it != ch_TP_end; ++ch_TP_it) { - DTChamberId ch = (*ch_TP_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - bool found = false; - vector::const_iterator sl_it = (*ch_TP_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_TP_it)->superLayers().end(); - // Loop over the SLs - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId sl = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - stringstream superLayer; superLayer << sl.superlayer(); - // Loop over the Ls - for(; l_it != l_end; ++l_it) { - DTLayerId layerId = (*l_it)->id(); - stringstream layer; layer << layerId.layer(); - - string testPulsesFolder = MainFolder + "DTTestPulsesTask/Wheel" + wheel.str(); - string histo_name = testPulsesFolder + "/Station" + station.str() + "/Sector" + sector.str() + "/SuperLayer" + superLayer.str() + "/TPProfile/TestPulses2D_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); - TProfile *histo = (TProfile*) theFile -> Get(histo_name.c_str()); - if(histo){ - found = true; - int pad = (sl.superlayer() - 1)*4 + layerId.layer(); - c1.cd(pad); - histo->Draw(); - } - } - } - if(found){ - c1.Update(); - psFile.NewPage(); - } - } - } - - // Trigger Summary Histos ************************************************************************ - if(TriggerHistos){ - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger_end = muonGeom->chambers().end(); - for (; ch_trigger_it != ch_trigger_end; ++ch_trigger_it) { - DTChamberId ch = (*ch_trigger_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerPhi/DDU_BXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - // Loop over all the chambers - vector::const_iterator ch_trigger2_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger2_end = muonGeom->chambers().end(); - for (; ch_trigger2_it != ch_trigger2_end; ++ch_trigger2_it) { - DTChamberId ch = (*ch_trigger2_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "DTLocalTriggerTask/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/LocalTriggerTheta/DDU_ThetaBXvsQual_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(1,2); - int counter1=0,counter2=0; - // Loop over all the chambers - vector::const_iterator ch_trigger3_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger3_end = muonGeom->chambers().end(); - for (; ch_trigger3_it != ch_trigger3_end; ++ch_trigger3_it) { - DTChamberId ch = (*ch_trigger3_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerPhi/CorrFraction_Phi_W" + wheel.str() + "_Sec" + sector.str(); - TH1F *Histo1 = (TH1F*) theFile -> Get(histo_Name.c_str()); - if(Histo1 && counter1==0){ - counter1++; - c1.cd(1); - Histo1->Draw(); - } - histo_Name = triggerFolder + "/Sector" + sector.str() + "/LocalTriggerTheta/HFraction_Theta_W" + wheel.str() + "_Sec" + sector.str(); - TH1F *Histo2 = (TH1F*) theFile -> Get(histo_Name.c_str()); - if(Histo2 && counter2==0){ - counter2++; - c1.cd(2); - Histo2->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger4_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger4_end = muonGeom->chambers().end(); - for (; ch_trigger4_it != ch_trigger4_end; ++ch_trigger4_it) { - DTChamberId ch = (*ch_trigger4_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - string histo_nameHHHL = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPosHHHL_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histoHHHL = (TH1F*) theFile -> Get(histo_nameHHHL.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->GetYaxis()->SetRangeUser(0,1.1); - histo->Draw(); - if(histoHHHL){ - histoHHHL->Draw("same"); - } - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger5_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger5_end = muonGeom->chambers().end(); - for (; ch_trigger5_it != ch_trigger5_end; ++ch_trigger5_it) { - DTChamberId ch = (*ch_trigger5_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Phi_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->GetYaxis()->SetRangeUser(0,1.1); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger6_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger6_end = muonGeom->chambers().end(); - for (; ch_trigger6_it != ch_trigger6_end; ++ch_trigger6_it) { - DTChamberId ch = (*ch_trigger6_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffPos_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - c1.cd(ch.station()); - histo->GetYaxis()->SetRangeUser(0,1.1); - histo->Draw(); - } - } - c1.Update(); - psFile.NewPage(); - - c1.Clear(); - c1.Divide(2,2); - // Loop over all the chambers - vector::const_iterator ch_trigger7_it = muonGeom->chambers().begin(); - vector::const_iterator ch_trigger7_end = muonGeom->chambers().end(); - for (; ch_trigger7_it != ch_trigger7_end; ++ch_trigger7_it) { - DTChamberId ch = (*ch_trigger7_it)->id(); - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string triggerFolder = MainFolder + "Tests/DTLocalTrigger/Wheel" + wheel.str(); - string histo_name = triggerFolder + "/Sector" + sector.str() + "/Station" + station.str() + "/TrigEffAngle_Theta_W" + wheel.str() + "_Sec" + sector.str() + "_St" + station.str(); - TH1F *histo = (TH1F*) theFile -> Get(histo_name.c_str()); - if(histo){ - histo->GetYaxis()->SetRangeUser(0,1.1); - c1.cd(ch.station()); - histo->Draw(); - } - } - c1.Update(); - } - psFile.Close(); -} diff --git a/DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 b/DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 deleted file mode 100644 index ab4197228cd2c..0000000000000 --- a/DQM/DTMonitorClient/src/DTDeadChannelTest.cc1 +++ /dev/null @@ -1,226 +0,0 @@ - -/* - * See header file for a description of this class. - * - * \author G. Mila - INFN Torino - */ - - -#include - -// Framework -#include - - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - -#include -#include - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include -#include -#include - - -using namespace edm; -using namespace std; - - -DTDeadChannelTest::DTDeadChannelTest(const edm::ParameterSet& ps){ - - edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Constructor"; - - parameters = ps; - - prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 1); - nevents = 0; - -} - -DTDeadChannelTest::~DTDeadChannelTest(){ - - edm::LogVerbatim ("deadChannel") << "DTDeadChannelTest: analyzed " << nevents << " events"; - -} - -void DTDeadChannelTest::beginRun(Run const& run, EventSetup const& context) { - - edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: BeginRun"; - - // Get the geometry - context.get().get(muonGeom); - -} - - -void DTDeadChannelTest::beginLuminosityBlock(LuminosityBlock const& lumiSeg, EventSetup const& context) { - - edm::LogVerbatim ("deadChannel") <<"[DTDeadChannelTest]: Begin of LS transition"; - - // Get the run number - run = lumiSeg.run(); - -} - - -void DTDeadChannelTest::analyze(const edm::Event& e, const edm::EventSetup& context){ - - nevents++; - edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: "<::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - - edm::LogVerbatim ("deadChannel") << "[DTDeadChannelTest]: Occupancy tests results"; - - // Loop over the chambers - for (; ch_it != ch_end; ++ch_it) { - DTChamberId chID = (*ch_it)->id(); - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - - stringstream wheel; wheel << chID.wheel(); - stringstream station; station << chID.station(); - stringstream sector; sector << chID.sector(); - - context.get().get(tTrigMap); - - string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - - // Get the ME produced by DigiTask Source - MonitorElement * noise_histo = igetter.get(getMEName("OccupancyNoise_perCh", chID)); - MonitorElement * hitInTime_histo = igetter.get(getMEName("OccupancyInTimeHits_perCh", chID)); - - // ME -> TH2F - if(noise_histo && hitInTime_histo) { - TH2F * noise_histo_root = noise_histo->getTH2F(); - TH2F * hitInTime_histo_root = hitInTime_histo->getTH2F(); - - // Loop over the SuperLayers - for(; sl_it != sl_end; ++sl_it) { - DTSuperLayerId slID = (*sl_it)->id(); - vector::const_iterator l_it = (*sl_it)->layers().begin(); - vector::const_iterator l_end = (*sl_it)->layers().end(); - - // ttrig and rms are counts - float tTrig, tTrigRMS, kFactor; - tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts); - - // Loop over the layers - for(; l_it != l_end; ++l_it) { - DTLayerId lID = (*l_it)->id(); - - //Parameters to fill histos - stringstream superLayer; superLayer << slID.superlayer(); - stringstream layer; layer << lID.layer(); - string HistoNameTest = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() - + "_L" + layer.str(); - - const int firstWire = muonGeom->layer(lID)->specificTopology().firstChannel(); - const int lastWire = muonGeom->layer(lID)->specificTopology().lastChannel(); - - int entry=-1; - if(slID.superlayer() == 1) entry=0; - if(slID.superlayer() == 2) entry=4; - if(slID.superlayer() == 3) entry=8; - int YBinNumber = entry+lID.layer(); - - - // Loop over the TH2F bin and fill the ME to be used for the Quality Test - for(int bin=firstWire; bin <= lastWire; bin++) { - if (OccupancyDiffHistos.find(HistoNameTest) == OccupancyDiffHistos.end()) bookHistos(ibooker,lID, firstWire, lastWire); - // tMax default value - float tMax = 450.0; - - float difference = (hitInTime_histo_root->GetBinContent(bin, YBinNumber) / tMax) - - (noise_histo_root->GetBinContent(bin, YBinNumber) / tTrig); - OccupancyDiffHistos.find(HistoNameTest)->second->setBinContent(bin, difference); - } - } // loop on layers - } // loop on superlayers - } - } // loop on chambers - - // Occupancy Difference test - string OccupancyDiffCriterionName = parameters.getUntrackedParameter("OccupancyDiffTestName","OccupancyDiffInRange"); - for(map::const_iterator hOccDiff = OccupancyDiffHistos.begin(); - hOccDiff != OccupancyDiffHistos.end(); - hOccDiff++) { - const QReport * theOccupancyDiffQReport = (*hOccDiff).second->getQReport(OccupancyDiffCriterionName); - if(theOccupancyDiffQReport) { - vector badChannels = theOccupancyDiffQReport->getBadChannels(); - for (vector::iterator channel = badChannels.begin(); - channel != badChannels.end(); channel++) { - edm::LogError ("deadChannel") << "Layer : "<<(*hOccDiff).first<<" Bad occupancy difference channels: "<<(*channel).getBin()<<" Contents : "<<(*channel).getContents(); - } - } - } - -} - -string DTDeadChannelTest::getMEName(string histoTag, const DTChamberId & chId) { - - stringstream wheel; wheel << chId.wheel(); - stringstream station; station << chId.station(); - stringstream sector; sector << chId.sector(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderName = - folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + - "/Occupancies" + "/"; - - string histoname = folderName + histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str(); - - return histoname; - -} - - -void DTDeadChannelTest::bookHistos(DQMStore::IBooker & ibooker, const DTLayerId & lId, int firstWire, int lastWire) { - - stringstream wheel; wheel << lId.superlayerId().wheel(); - stringstream station; station << lId.superlayerId().station(); - stringstream sector; sector << lId.superlayerId().sector(); - stringstream superLayer; superLayer << lId.superlayerId().superlayer(); - stringstream layer; layer << lId.layer(); - - string HistoName = "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); - string OccupancyDiffHistoName = "OccupancyDiff_" + HistoName; - - ibooker.setCurrentFolder("DT/Tests/DTDeadChannel/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str()); - - OccupancyDiffHistos[HistoName] = ibooker.book1D(OccupancyDiffHistoName.c_str(),OccupancyDiffHistoName.c_str(),lastWire-firstWire+1, firstWire-0.5, lastWire+0.5); - -} diff --git a/DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 b/DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 deleted file mode 100644 index cb5c51982a044..0000000000000 --- a/DQM/DTMonitorClient/src/DTFineDelayCorr.cc1 +++ /dev/null @@ -1,203 +0,0 @@ -/* - * See header file for a description of this class. - * - * \author M. Giunta, C. Battilana - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - */ - - -// This class header -#include "DQM/DTMonitorClient/src/DTFineDelayCorr.h" - -// Framework headers -#include "FWCore/Framework/interface/EventSetup.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "DQMServices/Core/interface/DQMStore.h" - -// L1Trigger -#include "L1TriggerConfig/DTTPGConfig/interface/DTConfigTrigUnit.h" - -// Geometry -#include "DQM/DTMonitorModule/interface/DTTrigGeomUtils.h" -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" - -// DB & Calib -#include "CalibMuon/DTCalibration/interface/DTCalibDBUtils.h" - -// Root -#include "TF1.h" -#include "TProfile.h" - - -//C++ headers -using namespace edm; -using namespace std; -#include -#include -#include -#include -#include -#include - -DTFineDelayCorr::DTFineDelayCorr(const ParameterSet& ps) { - - setConfig(ps,"DTFineDelayCorr"); // sets parameter values and name used in log file - baseFolderDCC = "DT/90-LocalTriggerSynch/"; - baseFolderDDU = "DT/90-LocalTriggerSynch/"; - -} - - -DTFineDelayCorr::~DTFineDelayCorr(){ - -} - -void DTFineDelayCorr::beginRun(edm::Run const & run, edm::EventSetup const & evSU) { - - // Tag for Hardware Source (DDU or DCC) - hwSource = parameters.getParameter("hwSource"); - // Tag for the t0Mean Histograms - t0MeanHistoTag = parameters.getParameter("t0MeanHistoTag"); - // Read old delays from file or from Db - readOldFromDb = parameters.getParameter("readOldFromDb"); - // Input file name for old delays - oldDelaysInputFile = parameters.getParameter("oldDelaysInputFile"), - // Write new delays to file or to Db - writeDB = parameters.getParameter("writeDB"); - // Output File Name - outputFileName = parameters.getParameter("outputFile"); - // Choose to use Hist Mean or Gaussian Fit Mean - gaussMean = parameters.getParameter("gaussMean"); - // Require Minimum Number Of Entries in the t0Mean Histogram - minEntries = parameters.getUntrackedParameter("minEntries",5); - - DTLocalTriggerBaseTest::beginRun(run,evSU); - evSU.get< DTConfigManagerRcd >().get(dtConfig); - evSU.get< DTTPGParametersRcd >().get(worstPhaseMap); - -} - -void DTFineDelayCorr::runClientDiagnostic(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - int coarseDelay = -999; - float oldFineDelay = -999; - if(!readOldFromDb) { // read old delays from txt file - // ** Open and read old delays input file ** - ifstream oldDelaysFile(oldDelaysInputFile.c_str()); - string line; - - while (getline(oldDelaysFile, line)) { - if( line == "" || line[0] == '#' ) continue; - stringstream linestr; - int wheelKey,sectorKey, stationKey; - linestr << line; - - linestr >> wheelKey - >> sectorKey - >> stationKey - >> coarseDelay - >> oldFineDelay; - - pair oldDelays = make_pair(coarseDelay,oldFineDelay); - DTChamberId oldDelayKey = DTChamberId(wheelKey,stationKey,sectorKey); - oldDelayMap.insert(make_pair(oldDelayKey,oldDelays)); - } - } - - // ** Loop over the chambers ** - vector::const_iterator chambIt = muonGeom->chambers().begin(); - vector::const_iterator chambEnd = muonGeom->chambers().end(); - for (; chambIt!=chambEnd; ++chambIt) { - DTChamberId chId = (*chambIt)->id(); - uint32_t indexCh = chId.rawId(); - int wheel = chId.wheel(); - int sector = chId.sector(); - int station = chId.station(); - - // ** Compute corrected values and write them to file or database ** - vector newDelays; - - // ** Retrieve Delays Loaded in MiniCrates ** - if(readOldFromDb) { // read from db - const DTConfigPedestals *pedestals = dtConfig->getDTConfigPedestals(); - const DTLayer *layer = muonGeom->layer(DTLayerId(chId,1,1)); - float delay = pedestals->getOffset(DTWireId(layer->id(),layer->specificTopology().firstChannel())); - coarseDelay = int(delay/25.); - oldFineDelay = delay - coarseDelay * 25.; - } - else { // read from map created from txt file - coarseDelay = oldDelayMap[chId].first; - oldFineDelay = oldDelayMap[chId].second; - } - - // ** Retrieve t0Mean histograms ** - TH1F *t0H = getHisto(igetter.get(getMEName(t0MeanHistoTag,"", chId))); - float newFineDelay = -999; // initialize to dummy number - cout <<"MG: " << getMEName(t0MeanHistoTag,"", chId) << " entries: " << t0H->GetEntries() << endl; - if (t0H->GetEntries() > minEntries) { - Double_t mean; - // ** Find Mean Value of the distribution ** - if(gaussMean) { - TF1 *funct = t0H->GetFunction("gaus"); - mean = funct->GetParameter(1); - } - else { - mean = t0H->GetMean(); - } - - // ** Retrieve Worst Phase values ** - int wpCoarseDelay; - float wpFineDelay; - worstPhaseMap->get(chId, wpCoarseDelay, wpFineDelay, DTTimeUnits::ns); -// cout << "wpFineDelay, oldFineDelay, mean: " << wpFineDelay << " " -// << oldFineDelay << " " << mean << endl; - float bpFineDelay = (wpFineDelay < 12.5)? (wpFineDelay + 12.5) : (wpFineDelay - 12.5); // Best Phase: half BX far from the worst phase - // ** Calculate correction ** - float diffFineDelays = oldFineDelay + (mean - bpFineDelay); // positive mean shift implies positive delay correction - int bxDiff = (int) (diffFineDelays / 25); - coarseDelay += bxDiff; - newFineDelay = fmodf(diffFineDelays, 25); -// cout << "diffFineDelays, newFineDelay, bxDiff, coarseDelay: " << diffFineDelays -// << " "<< newFineDelay << " " << bxDiff << " " << coarseDelay << endl; - } - else { - LogProblem(category()) << "[" << testName << "Test]: Not enough entries in hist for Chamber " - << indexCh << endl; - } - - newDelays.push_back(wheel); - newDelays.push_back(sector); - newDelays.push_back(station); - newDelays.push_back(coarseDelay); - newDelays.push_back(newFineDelay); - pair< DTChamberId, vector > chDelays; - chDelays.first = chId; - chDelays.second = newDelays; - delayMap.insert(chDelays); - } -} - -void DTFineDelayCorr::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter){ - - DTLocalTriggerBaseTest::dqmEndJob( ibooker,igetter); - - if (writeDB) { - // to be added if needed - } - else { // write txt file - // ** Open output file ** - ofstream outFile(outputFileName.c_str()); - for(map< DTChamberId, vector >::const_iterator iter = delayMap.begin(); - iter != delayMap.end() ; iter++) { - // writing - ostream_iterator oit(outFile, " "); - copy((*iter).second.begin(), (*iter).second.end(), oit); - outFile << endl; - } - outFile.close(); - } -} diff --git a/DQM/DTMonitorClient/src/DTNoiseTest.cc1 b/DQM/DTMonitorClient/src/DTNoiseTest.cc1 deleted file mode 100644 index 54bc9135e9a2f..0000000000000 --- a/DQM/DTMonitorClient/src/DTNoiseTest.cc1 +++ /dev/null @@ -1,314 +0,0 @@ -/* - * - * \authors: - * A. Gresele - INFN Trento - * G. Mila - INFN Torino - * M. Zanetti - CERN PH - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - */ - -#include "DQM/DTMonitorClient/src/DTNoiseTest.h" - -// Framework -#include - - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" -#include "Geometry/DTGeometry/interface/DTLayer.h" -#include "Geometry/DTGeometry/interface/DTTopology.h" - - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -#include -#include -#include - -using namespace edm; -using namespace std; - - - -DTNoiseTest::DTNoiseTest(const edm::ParameterSet& ps){ - - edm::LogVerbatim ("noise") <<"[DTNoiseTest]: Constructor"; - - parameters = ps; - - prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 1); - - bookingdone = 0; - -} - - - -DTNoiseTest::~DTNoiseTest(){ - - edm::LogVerbatim ("noise") <<"DTNoiseTest: analyzed " << updates << " events"; - -} - - void DTNoiseTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, - edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) { - - if (!bookingdone) { - ibooker.setCurrentFolder("DT/Tests/Noise"); - updates = 0; - // Get the geometry - context.get().get(muonGeom); - } - bookingdone = 1; - - edm::LogVerbatim ("noise") <<"[DTNoiseTest]: End of LS transition, performing the DQM client operation"; - - // counts number of lumiSegs - nLumiSegs = lumiSeg.id().luminosityBlock(); - - // prescale factor - if ( nLumiSegs%prescaleFactor != 0 ) return; - - edm::LogVerbatim ("noise") <<"[DTNoiseTest]: "< statusMap; - context.get().get(statusMap); - - context.get().get(tTrigMap); - float tTrig, tTrigRMS, kFactor; - - string histoTag; - // loop over chambers - vector::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - - for (; ch_it != ch_end; ++ch_it) { - DTChamberId ch = (*ch_it)->id(); - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - - MonitorElement * noiseME = igetter.get(getMEName(ch)); - if (noiseME) { - TH2F * noiseHisto = noiseME->getTH2F(); - - // WARNING uncorrect normalization!! TO BE PROVIDED CENTRALLY - double nevents = (int) noiseHisto->GetEntries(); - - double normalization =0; - - float average=0; - float nOfChannels=0; - float noiseStatistics=0; - int newNoiseChannels=0; - - for(; sl_it != sl_end; ++sl_it) { - const DTSuperLayerId & slID = (*sl_it)->id(); - - // ttrig and rms are counts - tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts); - if (tTrig==0) tTrig=1; - const double ns_s = 1e9*(32/25); - normalization = ns_s/float(tTrig*nevents); - - noiseHisto->Scale(normalization); - - // loop over layers - - for (int binY=(slID.superLayer()-1)*4+1 ; binY <= (slID.superLayer()-1)*4+4; binY++) { - - int Y = binY - 4*(slID.superLayer()-1); - - // the layer - - const DTLayerId theLayer(slID,Y); - - // loop over channels - for (int binX=1; binX <= noiseHisto->GetNbinsX(); binX++) { - - if (noiseHisto->GetBinContent(binX,binY) > parameters.getUntrackedParameter("HzThreshold", 300)) - theNoisyChannels.push_back(DTWireId(theLayer, binX)); - - // get rid of the dead channels - else { - average += noiseHisto->GetBinContent(binX,binY); - nOfChannels++; - } - } - } - - if (nOfChannels) noiseStatistics = average/nOfChannels; - histoTag = "NoiseAverage"; - - if (histos[histoTag].find((*ch_it)->id().rawId()) == histos[histoTag].end()) bookHistos(ibooker,(*ch_it)->id(),string("NoiseAverage"), histoTag ); - histos[histoTag].find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(),noiseStatistics); - - for ( vector::const_iterator nb_it = theNoisyChannels.begin(); - nb_it != theNoisyChannels.end(); ++nb_it) { - - bool isNoisy = false; - bool isFEMasked = false; - bool isTDCMasked = false; - bool isTrigMask = false; - bool isDead = false; - bool isNohv = false; - statusMap->cellStatus((*nb_it), isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv); - - if (!isNoisy) newNoiseChannels++; - } - theNoisyChannels.clear(); - histoTag = "NewNoisyChannels"; - - if (histos[histoTag].find((*ch_it)->id().rawId()) == histos[histoTag].end()) - bookHistos(ibooker,(*ch_it)->id(),string("NewNoisyChannels"), histoTag ); - histos[histoTag].find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(), newNoiseChannels); - } - } - //To compute the Noise Mean test - vector::const_iterator sl2_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl2_end = (*ch_it)->superLayers().end(); - for(; sl2_it != sl2_end; ++sl2_it) { - vector::const_iterator l_it = (*sl2_it)->layers().begin(); - vector::const_iterator l_end = (*sl2_it)->layers().end(); - for(; l_it != l_end; ++l_it) { - - DTLayerId lID = (*l_it)->id(); - MonitorElement * noisePerEventME = igetter.get(getMEName(lID)); - - if (noisePerEventME) { - TH2F * noiseHistoPerEvent = noisePerEventME->getTH2F(); - int nWires = muonGeom->layer(lID)->specificTopology().channels(); - double MeanNumerator=0, MeanDenominator=0; - histoTag = "MeanDigiPerEvent"; - for (int w=1; w<=nWires; w++){ - for(int numDigi=1; numDigi<=10; numDigi++){ - MeanNumerator+=(noiseHistoPerEvent->GetBinContent(w,numDigi)*(numDigi-1)); - MeanDenominator+=noiseHistoPerEvent->GetBinContent(w,numDigi); - } - double Mean=MeanNumerator/MeanDenominator; - if (histos[histoTag].find((*l_it)->id().rawId()) == histos[histoTag].end()) bookHistos(ibooker,(*l_it)->id(),nWires, string("MeanDigiPerEvent"), histoTag ); - histos[histoTag].find((*l_it)->id().rawId())->second->setBinContent(w, Mean); - } - } - } - } - } - - // Noise Mean test - histoTag = "MeanDigiPerEvent"; - string MeanCriterionName = parameters.getUntrackedParameter("meanTestName","NoiseMeanInRange"); - for(map::const_iterator hMean = histos[histoTag].begin(); - hMean != histos[histoTag].end(); - hMean++) { - const QReport * theMeanQReport = (*hMean).second->getQReport(MeanCriterionName); - if(theMeanQReport) { - vector badChannels = theMeanQReport->getBadChannels(); - for (vector::iterator channel = badChannels.begin(); - channel != badChannels.end(); channel++) { - LogVerbatim ("tTrigCalibration")<<"LayerId : "<<(*hMean).first<<" Bad mean channels: " - <<(*channel).getBin()<<" Contents : "<<(*channel).getContents(); - } - } - } - -} - -void DTNoiseTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - - edm::LogVerbatim ("noise") <<"[DTNoiseTest] endjob called!"; -} - - -string DTNoiseTest::getMEName(const DTChamberId & ch) { - - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderTag = parameters.getUntrackedParameter("folderTag", "Occupancies"); - string folderName = - folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/" + folderTag + "/"; - - string histoTag = parameters.getUntrackedParameter("histoTag", "OccupancyNoise_perCh"); - string histoname = folderName + histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str(); - - - return histoname; - -} - -string DTNoiseTest::getMEName(const DTLayerId & ly) { - - stringstream wheel; wheel << ly.wheel(); - stringstream station; station << ly.station(); - stringstream sector; sector << ly.sector(); - stringstream superLayer; superLayer << ly.superlayer(); - stringstream layer; layer << ly.layer(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderTag = parameters.getUntrackedParameter("folderTagForDigiPerEventTest", "DigiPerEvent"); - string folderName = - folderRoot + "DT/DTDigiForNoiseTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/" + folderTag + "/"; - - string histoTag = parameters.getUntrackedParameter("histoTagForDigiPerEventTest", "DigiPerEvent"); - string histoname = folderName + histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str() - + "_L" + layer.str(); - - - return histoname; - -} - -void DTNoiseTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch, string folder, string histoTag ) { - - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - ibooker.setCurrentFolder("DT/Tests/Noise/" + folder); - - string histoName = histoTag + "W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - - if (folder == "NoiseAverage") - (histos[histoTag])[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,3); - - if ( folder == "NewNoisyChannels") - (histos[histoTag])[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,3); - -} - -void DTNoiseTest::bookHistos(DQMStore::IBooker & ibooker, const DTLayerId & lId, int nWires, string folder, string histoTag) { - - stringstream wheel; wheel << lId.superlayerId().wheel(); - stringstream station; station << lId.superlayerId().station(); - stringstream sector; sector << lId.superlayerId().sector(); - stringstream superLayer; superLayer << lId.superlayerId().superlayer(); - stringstream layer; layer << lId.layer(); - - string histoName = histoTag + "_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() - + "_SL" + superLayer.str() + "_L" + layer.str(); - - ibooker.setCurrentFolder("DT/Tests/Noise/" + folder + - "/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str()); - - (histos[histoTag])[lId.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),nWires,0,nWires); -} diff --git a/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc1 b/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc1 deleted file mode 100644 index 4965d7dc3a2fd..0000000000000 --- a/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.cc1 +++ /dev/null @@ -1,277 +0,0 @@ -/* - * \file DTtTrigCalibrationTest.cc - * - * \author M. Zanetti - CERN - * Modified by G. Mila - INFN Torino - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - */ - - -#include "DQM/DTMonitorClient/src/DTtTrigCalibrationTest.h" - -// Framework -#include - - -// Geometry -#include "Geometry/Records/interface/MuonGeometryRecord.h" -#include "Geometry/DTGeometry/interface/DTGeometry.h" - -#include -#include - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/MessageLogger/interface/MessageLogger.h" - -// the Timebox fitter -#include "CalibMuon/DTCalibration/interface/DTTimeBoxFitter.h" - -#include -#include -#include - -using namespace edm; -using namespace std; - -DTtTrigCalibrationTest::DTtTrigCalibrationTest(const edm::ParameterSet& ps){ - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: Constructor"; - - parameters = ps; - - theFitter = new DTTimeBoxFitter(); - - prescaleFactor = parameters.getUntrackedParameter("diagnosticPrescale", 3); - - percentual = parameters.getUntrackedParameter("BadSLpercentual", 10); - -} - - -DTtTrigCalibrationTest::~DTtTrigCalibrationTest(){ - - edm::LogVerbatim ("tTrigCalibration") <<"DTtTrigCalibrationTest: analyzed " << nevents << " events"; - - delete theFitter; - -} - - -void DTtTrigCalibrationTest::beginRun(Run const& run, EventSetup const& context) { - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: BeginRun"; - - nevents = 0; - - // Get the geometry - context.get().get(muonGeom); - -} - - - void DTtTrigCalibrationTest::dqmEndLuminosityBlock(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter, - edm::LuminosityBlock const & lumiSeg, edm::EventSetup const & context) { - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: End of LS transition, performing the DQM client operation"; - - // counts number of lumiSegs - nLumiSegs = lumiSeg.id().luminosityBlock(); - - // prescale factor - if ( nLumiSegs%prescaleFactor != 0 ) return; - - for(map ::const_iterator histo = wheelHistos.begin(); - histo != wheelHistos.end(); - histo++) { - (*histo).second->Reset(); - } - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: "<().get(tTrigMap); - float tTrig, tTrigRMS,kFactor; - - map , int> cmsHistos; - cmsHistos.clear(); - map , bool> filled; - for(int i=-2; i<3; i++){ - for(int j=1; j<15; j++){ - filled[make_pair(i,j)]=false; - } - } - - vector::const_iterator ch_it = muonGeom->chambers().begin(); - vector::const_iterator ch_end = muonGeom->chambers().end(); - for (; ch_it != ch_end; ++ch_it) { - - vector::const_iterator sl_it = (*ch_it)->superLayers().begin(); - vector::const_iterator sl_end = (*ch_it)->superLayers().end(); - for(; sl_it != sl_end; ++sl_it) { - - DTSuperLayerId slID = (*sl_it)->id(); - - MonitorElement * tb_histo = igetter.get(getMEName(slID)); - if (tb_histo) { - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest]: I've got the histo!!"; - - TH1F * tb_histo_root = tb_histo->getTH1F(); - - pair meanAndSigma = theFitter->fitTimeBox(tb_histo_root); - - // ttrig and rms are counts - tTrigMap->get(slID, tTrig, tTrigRMS, kFactor, DTTimeUnits::counts ); - - if (histos.find((*ch_it)->id().rawId()) == histos.end()) bookHistos(ibooker,(*ch_it)->id()); - histos.find((*ch_it)->id().rawId())->second->setBinContent(slID.superLayer(), meanAndSigma.first-tTrig); - - } - } - - if (histos.find((*ch_it)->id().rawId()) != histos.end()) { - string criterionName = parameters.getUntrackedParameter("tTrigTestName","tTrigOffSet"); - const QReport * theQReport = histos.find((*ch_it)->id().rawId())->second->getQReport(criterionName); - if(theQReport) { - vector badChannels = theQReport->getBadChannels(); - for (vector::iterator channel = badChannels.begin(); - channel != badChannels.end(); channel++) { - edm::LogError ("tTrigCalibration") <<"Chamber ID : "<<(*ch_it)->id()<<" Bad channels: "<<(*channel).getBin()<<" "<<(*channel).getContents(); - - if(wheelHistos.find((*ch_it)->id().wheel()) == wheelHistos.end()) bookHistos(ibooker,(*ch_it)->id(), (*ch_it)->id().wheel()); - // fill the wheel summary histos if the SL has not passed the test - if(!((*ch_it)->id().station() == 4 && (*channel).getBin() == 3)) - wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,((*channel).getBin()-1)+3*((*ch_it)->id().station()-1)); - else - wheelHistos[(*ch_it)->id().wheel()]->Fill((*ch_it)->id().sector()-1,10); - // fill the cms summary histo if the percentual of SL which have not passed the test - // is more than a predefined treshold - cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]++; - if(((*ch_it)->id().sector()<13 && - double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/11>double(percentual)/100 && - filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false) || - ((*ch_it)->id().sector()>=13 && - double(cmsHistos[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())])/2>double(percentual)/100 && - filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]==false)){ - filled[make_pair((*ch_it)->id().wheel(),(*ch_it)->id().sector())]=true; - wheelHistos[3]->Fill((*ch_it)->id().sector()-1,(*ch_it)->id().wheel()); - } - } - } - } - - } - -} - -void DTtTrigCalibrationTest::dqmEndJob(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter) { - - edm::LogVerbatim ("tTrigCalibration") <<"[DTtTrigCalibrationTest] endjob called!"; - -} - - - - -string DTtTrigCalibrationTest::getMEName(const DTSuperLayerId & slID) { - - stringstream wheel; wheel << slID.wheel(); - stringstream station; station << slID.station(); - stringstream sector; sector << slID.sector(); - stringstream superLayer; superLayer << slID.superlayer(); - - string folderRoot = parameters.getUntrackedParameter("folderRoot", "Collector/FU0/"); - string folderTag = parameters.getUntrackedParameter("folderTag", "TimeBoxes"); - string folderName = - folderRoot + "DT/DTDigiTask/Wheel" + wheel.str() + - "/Station" + station.str() + - "/Sector" + sector.str() + "/" + folderTag + "/"; - - string histoTag = parameters.getUntrackedParameter("histoTag", "TimeBox"); - string histoname = folderName + histoTag - + "_W" + wheel.str() - + "_St" + station.str() - + "_Sec" + sector.str() - + "_SL" + superLayer.str(); - - return histoname; - -} - -void DTtTrigCalibrationTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch) { - - stringstream wheel; wheel << ch.wheel(); - stringstream station; station << ch.station(); - stringstream sector; sector << ch.sector(); - - string histoName = "tTrigTest_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str(); - ibooker.setCurrentFolder("DT/Tests/DTtTrigCalibration"); - - histos[ch.rawId()] = ibooker.book1D(histoName.c_str(),histoName.c_str(),3,0,2); - -} - -void DTtTrigCalibrationTest::bookHistos(DQMStore::IBooker & ibooker, const DTChamberId & ch, int wh) { - - ibooker.setCurrentFolder("DT/Tests/DTtTrigCalibration/SummaryPlot"); - - if(wheelHistos.find(3) == wheelHistos.end()){ - string histoName = "t_TrigSummary_testFailedByAtLeastBadSL"; - wheelHistos[3] = ibooker.book2D(histoName.c_str(),histoName.c_str(),14,0,14,5,-2,2); - wheelHistos[3]->setBinLabel(1,"Sector1",1); - wheelHistos[3]->setBinLabel(1,"Sector1",1); - wheelHistos[3]->setBinLabel(2,"Sector2",1); - wheelHistos[3]->setBinLabel(3,"Sector3",1); - wheelHistos[3]->setBinLabel(4,"Sector4",1); - wheelHistos[3]->setBinLabel(5,"Sector5",1); - wheelHistos[3]->setBinLabel(6,"Sector6",1); - wheelHistos[3]->setBinLabel(7,"Sector7",1); - wheelHistos[3]->setBinLabel(8,"Sector8",1); - wheelHistos[3]->setBinLabel(9,"Sector9",1); - wheelHistos[3]->setBinLabel(10,"Sector10",1); - wheelHistos[3]->setBinLabel(11,"Sector11",1); - wheelHistos[3]->setBinLabel(12,"Sector12",1); - wheelHistos[3]->setBinLabel(13,"Sector13",1); - wheelHistos[3]->setBinLabel(14,"Sector14",1); - wheelHistos[3]->setBinLabel(1,"Wheel-2",2); - wheelHistos[3]->setBinLabel(2,"Wheel-1",2); - wheelHistos[3]->setBinLabel(3,"Wheel0",2); - wheelHistos[3]->setBinLabel(4,"Wheel+1",2); - wheelHistos[3]->setBinLabel(5,"Wheel+2",2); - } - - stringstream wheel; wheel <setBinLabel(1,"Sector1",1); - wheelHistos[wh]->setBinLabel(2,"Sector2",1); - wheelHistos[wh]->setBinLabel(3,"Sector3",1); - wheelHistos[wh]->setBinLabel(4,"Sector4",1); - wheelHistos[wh]->setBinLabel(5,"Sector5",1); - wheelHistos[wh]->setBinLabel(6,"Sector6",1); - wheelHistos[wh]->setBinLabel(7,"Sector7",1); - wheelHistos[wh]->setBinLabel(8,"Sector8",1); - wheelHistos[wh]->setBinLabel(9,"Sector9",1); - wheelHistos[wh]->setBinLabel(10,"Sector10",1); - wheelHistos[wh]->setBinLabel(11,"Sector11",1); - wheelHistos[wh]->setBinLabel(12,"Sector12",1); - wheelHistos[wh]->setBinLabel(13,"Sector13",1); - wheelHistos[wh]->setBinLabel(14,"Sector14",1); - wheelHistos[wh]->setBinLabel(1,"MB1_SL1",2); - wheelHistos[wh]->setBinLabel(2,"MB1_SL2",2); - wheelHistos[wh]->setBinLabel(3,"MB1_SL3",2); - wheelHistos[wh]->setBinLabel(4,"MB2_SL1",2); - wheelHistos[wh]->setBinLabel(5,"MB2_SL2",2); - wheelHistos[wh]->setBinLabel(6,"MB2_SL3",2); - wheelHistos[wh]->setBinLabel(7,"MB3_SL1",2); - wheelHistos[wh]->setBinLabel(8,"MB3_SL2",2); - wheelHistos[wh]->setBinLabel(9,"MB3_SL3",2); - wheelHistos[wh]->setBinLabel(10,"MB4_SL1",2); - wheelHistos[wh]->setBinLabel(11,"MB4_SL3",2); - -} - diff --git a/DQM/DTMonitorClient/src/SealModule.cc b/DQM/DTMonitorClient/src/SealModule.cc index 7141e8bd7efa8..91596d3d54f3e 100644 --- a/DQM/DTMonitorClient/src/SealModule.cc +++ b/DQM/DTMonitorClient/src/SealModule.cc @@ -28,9 +28,12 @@ DEFINE_FWK_MODULE(DTLocalTriggerTest); #include "DQM/DTMonitorClient/src/DTLocalTriggerEfficiencyTest.h" DEFINE_FWK_MODULE(DTLocalTriggerEfficiencyTest); -#include "DQM/DTMonitorClient/src/DTLocalTriggerLutTest.h" +##include "DQM/DTMonitorClient/src/DTLocalTriggerLutTest.h" DEFINE_FWK_MODULE(DTLocalTriggerLutTest); +include "DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.h" +DEFINE_FWK_MODULE(DTLocalTriggerSynchTest); + #include "DQM/DTMonitorClient/src/DTLocalTriggerTPTest.h" DEFINE_FWK_MODULE(DTLocalTriggerTPTest); From 19b968d3a4f24130e2683305fada450ebb7a6137 Mon Sep 17 00:00:00 2001 From: Francesca Cavallo Date: Sat, 25 Apr 2015 19:09:55 +0200 Subject: [PATCH 09/10] restored DTResolutionTest --- .../src/DTCreateSummaryHistos.h | 91 --------------- DQM/DTMonitorClient/src/DTDeadChannelTest.h | 86 --------------- DQM/DTMonitorClient/src/DTFineDelayCorr.h | 75 ------------- DQM/DTMonitorClient/src/DTNoiseTest.h | 104 ------------------ .../src/DTtTrigCalibrationTest.h | 101 ----------------- 5 files changed, 457 deletions(-) delete mode 100644 DQM/DTMonitorClient/src/DTCreateSummaryHistos.h delete mode 100644 DQM/DTMonitorClient/src/DTDeadChannelTest.h delete mode 100644 DQM/DTMonitorClient/src/DTFineDelayCorr.h delete mode 100644 DQM/DTMonitorClient/src/DTNoiseTest.h delete mode 100644 DQM/DTMonitorClient/src/DTtTrigCalibrationTest.h diff --git a/DQM/DTMonitorClient/src/DTCreateSummaryHistos.h b/DQM/DTMonitorClient/src/DTCreateSummaryHistos.h deleted file mode 100644 index 379ff4225bf46..0000000000000 --- a/DQM/DTMonitorClient/src/DTCreateSummaryHistos.h +++ /dev/null @@ -1,91 +0,0 @@ -#ifndef DTCreateSummaryHistos_H -#define DTCreateSummaryHistos_H - - -/** \class DTCreateSummaryHistos - * * - * DQM Test Client - * - * \author G. Mila - INFN Torino - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah ncpp-um-my - * - * - */ - - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include "DataFormats/Common/interface/Handle.h" -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" - -#include "DQMServices/Core/interface/DQMStore.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include - -#include -#include -#include -#include -#include -#include -#include "TPostScript.h" - -class DTGeometry; - -//-class DTCreateSummaryHistos: public edm::EDAnalyzer{ -class DTCreateSummaryHistos: public DQMEDHarvester{ - -public: - - /// Constructor - DTCreateSummaryHistos(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTCreateSummaryHistos(); - -protected: - - /// BeginRun - void beginRun(const edm::Run& run, const edm::EventSetup& setup); - - void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override; - - private: - - int nevents; - std::string MainFolder; - - edm::ParameterSet parameters; - edm::ESHandle muonGeom; - - // The file which contain the occupancy plot and the digi event plot - TFile *theFile; - - // The *.ps file which contains the summary histos - TPostScript *psFile; - std::string PsFileName; - - // The histos to write in the *.ps file - bool DataIntegrityHistos; - bool DigiHistos; - bool RecoHistos; - bool ResoHistos; - bool EfficiencyHistos; - bool TestPulsesHistos; - bool TriggerHistos; - - // The DDUId - int DDUId; - // The run number - int runNumber; - -}; - -#endif - - diff --git a/DQM/DTMonitorClient/src/DTDeadChannelTest.h b/DQM/DTMonitorClient/src/DTDeadChannelTest.h deleted file mode 100644 index 27ea6568453e8..0000000000000 --- a/DQM/DTMonitorClient/src/DTDeadChannelTest.h +++ /dev/null @@ -1,86 +0,0 @@ -#ifndef DTDeadChannelTest_H -#define DTDeadChannelTest_H - - -/** \class DTDeadChannelTest - * * - * DQM Test Client - * - * \author G. Mila - INFN Torino - * - */ - - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include "DataFormats/Common/interface/Handle.h" -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - - -#include -#include -#include -#include -#include -#include - -class DTGeometry; -class DTChamberId; -class DTSuperLayerId; -class DTLayerId; -class DTTtrig; - -class DTDeadChannelTest: public edm::EDAnalyzer{ - -public: - - /// Constructor - DTDeadChannelTest(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTDeadChannelTest(); - -protected: - - /// BeginRun - void beginRun(edm::Run const& run, edm::EventSetup const& context); - - /// Analyze - void analyze(const edm::Event& e, const edm::EventSetup& c); - - /// book the new ME - void bookHistos(DQMStore::IBooker &, const DTLayerId & ch, int firstWire, int lastWire); - - /// Get the ME name - std::string getMEName(std::string histoTag, const DTChamberId & chId); - - - void beginLuminosityBlock(edm::LuminosityBlock const& lumiSeg, edm::EventSetup const& context) ; - - /// DQM Client Diagnostic - void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &); - -private: - - int nevents; - unsigned int nLumiSegs; - int prescaleFactor; - int run; - - edm::ParameterSet parameters; - edm::ESHandle muonGeom; - edm::ESHandle tTrigMap; - - std::map< std::string , MonitorElement* > OccupancyDiffHistos; - -}; - -#endif diff --git a/DQM/DTMonitorClient/src/DTFineDelayCorr.h b/DQM/DTMonitorClient/src/DTFineDelayCorr.h deleted file mode 100644 index a4e67af7830f4..0000000000000 --- a/DQM/DTMonitorClient/src/DTFineDelayCorr.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef DTFineDelayCorr_H -#define DTFineDelayCorr_H - -/** \class DTFineDelayCorr - * * - * Class to calculate corrections to the fine delays loaded in DT MiniCrates - * - * \author M. Giunta, C. Battilana - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - */ - -#include "DQM/DTMonitorClient/src/DTLocalTriggerBaseTest.h" -#include "FWCore/Framework/interface/ESHandle.h" -// Geometry -#include "Geometry/DTGeometry/interface/DTGeometry.h" -// L1Trigger -#include "L1TriggerConfig/DTTPGConfig/interface/DTConfigManager.h" -#include "L1TriggerConfig/DTTPGConfig/interface/DTConfigManagerRcd.h" -// DB & Calib -#include -#include - -#include -#include - -class DTFineDelayCorr: public DTLocalTriggerBaseTest{ - -public: - - /// Constructor - DTFineDelayCorr(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTFineDelayCorr(); - -protected: - - /// Begin Run - void beginRun(const edm::Run& run, const edm::EventSetup& evSU); - - void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &); - - /// DQM Client Diagnostic - - void runClientDiagnostic(DQMStore::IBooker & ibooker, DQMStore::IGetter & igetter); - - // Write the new delays to a file - void writeConsts(const std::string& outputFileName) const; - - - private: - std::string t0MeanHistoTag; - std::string outputFileName; - std::string oldDelaysInputFile; - std::string trSource; - bool readOldFromDb; - bool writeDB; - bool gaussMean; - int minEntries; - int nEvents; - edm::ESHandle< DTConfigManager > dtConfig; - edm::ESHandle< DTTPGParameters > worstPhaseMap; - -// The map between the Chamber and the old delays - std::map< DTChamberId, std::pair > oldDelayMap; - -// The map between the Chamber and the new delays - std::map< DTChamberId, std::vector > delayMap; - -}; - -#endif diff --git a/DQM/DTMonitorClient/src/DTNoiseTest.h b/DQM/DTMonitorClient/src/DTNoiseTest.h deleted file mode 100644 index 85fc9eb51304f..0000000000000 --- a/DQM/DTMonitorClient/src/DTNoiseTest.h +++ /dev/null @@ -1,104 +0,0 @@ -#ifndef DTNoiseTest_H -#define DTNoiseTest_H - - - -/** \class DTNoiseTest - * * - * DQM Test Client - * - * A. Gresele - INFN Trento - * G. Mila - INFN Torino - * M. Zanetti - CERN PH - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - */ - - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include - -#include -#include - -#include -#include - - -#include -#include -#include -#include -#include -#include - -class DTGeometry; -class DTChamberId; -class DTSuperLayerId; -class DTLayerId ; -class DTWireId; - -class DTNoiseTest: public DQMEDHarvester{ - -public: - - /// Constructor - DTNoiseTest(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTNoiseTest(); - -protected: - - void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &) override; - - /// book the new ME - void bookHistos(DQMStore::IBooker &, const DTChamberId & ch, std::string folder, std::string histoTag); - void bookHistos(DQMStore::IBooker &, const DTLayerId & ch, int nWire,std::string folder, std::string histoTag); - - /// Get the ME name - std::string getMEName(const DTChamberId & ch); - std::string getMEName(const DTLayerId & ly); - - /// DQM Client Diagnostic - void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &); - - - -private: - - bool debug; - int updates; - unsigned int nLumiSegs; - int prescaleFactor; - int run; - - bool bookingdone; - - edm::ParameterSet parameters; - edm::ESHandle muonGeom; - edm::ESHandle tTrigMap; - - // the collection of noisy channels - std::vector theNoisyChannels; - - // histograms: < detRawID, Histogram > - std::map > histos; - -}; - -#endif diff --git a/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.h b/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.h deleted file mode 100644 index 2052c0b97dd49..0000000000000 --- a/DQM/DTMonitorClient/src/DTtTrigCalibrationTest.h +++ /dev/null @@ -1,101 +0,0 @@ -#ifndef DTtTrigCalibrationTest_H -#define DTtTrigCalibrationTest_H - -/** \class DTtTrigCalibrationTest - * * - * DQM Test Client - * - * \author M. Zanetti CERN - * - * threadsafe version (//-) oct/nov 2014 - WATWanAbdullah -ncpp-um-my - * - * - */ - - -#include "FWCore/Framework/interface/Frameworkfwd.h" -#include -#include "DataFormats/Common/interface/Handle.h" -#include -#include -#include -#include "FWCore/ParameterSet/interface/ParameterSet.h" -#include - -#include "DQMServices/Core/interface/DQMStore.h" -#include "DQMServices/Core/interface/MonitorElement.h" -#include "FWCore/ServiceRegistry/interface/Service.h" - -#include - - -#include -#include -#include -#include -#include -#include - -class DTGeometry; -class DTChamberId; -class DTSuperLayerId; -class DTTtrig; -class DTTimeBoxFitter; - - -class DTtTrigCalibrationTest: public DQMEDHarvester { - -public: - - /// Constructor - DTtTrigCalibrationTest(const edm::ParameterSet& ps); - - /// Destructor - virtual ~DTtTrigCalibrationTest(); - -protected: - - /// BeginRun - void beginRun(const edm::Run& r, const edm::EventSetup& c); - - void dqmEndJob(DQMStore::IBooker &, DQMStore::IGetter &); - - /// book the new ME - - void bookHistos(DQMStore::IBooker &,const DTChamberId & ch); - - /// book the summary histograms - - void bookHistos(DQMStore::IBooker &,const DTChamberId & ch, int wh); - - /// Get the ME name - std::string getMEName(const DTSuperLayerId & slID); - - /// DQM Client Diagnostic - - void dqmEndLuminosityBlock(DQMStore::IBooker &, DQMStore::IGetter &, edm::LuminosityBlock const &, edm::EventSetup const &); - - -private: - - int nevents; - unsigned int nLumiSegs; - int prescaleFactor; - int run; - int percentual; - - edm::ParameterSet parameters; - edm::ESHandle muonGeom; - edm::ESHandle tTrigMap; - - DTTimeBoxFitter *theFitter; - - // histograms: < detRawID, Histogram > - std::map< uint32_t , MonitorElement* > histos; - - // wheel summary histograms - std::map< int, MonitorElement* > wheelHistos; - -}; - -#endif From bd457b7c25e64452c3436835323af9cd6fa60c63 Mon Sep 17 00:00:00 2001 From: federico de guio Date: Wed, 29 Apr 2015 14:33:06 +0200 Subject: [PATCH 10/10] fixing compilation errors for PR #8786 and resubmitting --- DQM/DTMonitorClient/src/SealModule.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DQM/DTMonitorClient/src/SealModule.cc b/DQM/DTMonitorClient/src/SealModule.cc index 91596d3d54f3e..cb0788b080a7c 100644 --- a/DQM/DTMonitorClient/src/SealModule.cc +++ b/DQM/DTMonitorClient/src/SealModule.cc @@ -28,10 +28,10 @@ DEFINE_FWK_MODULE(DTLocalTriggerTest); #include "DQM/DTMonitorClient/src/DTLocalTriggerEfficiencyTest.h" DEFINE_FWK_MODULE(DTLocalTriggerEfficiencyTest); -##include "DQM/DTMonitorClient/src/DTLocalTriggerLutTest.h" +#include "DQM/DTMonitorClient/src/DTLocalTriggerLutTest.h" DEFINE_FWK_MODULE(DTLocalTriggerLutTest); -include "DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.h" +#include "DQM/DTMonitorClient/src/DTLocalTriggerSynchTest.h" DEFINE_FWK_MODULE(DTLocalTriggerSynchTest); #include "DQM/DTMonitorClient/src/DTLocalTriggerTPTest.h"