#include <DTNoiseTask.h>
No description available.
Definition at line 32 of file DTNoiseTask.h.
DTNoiseTask::DTNoiseTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 48 of file DTNoiseTask.cc.
References dbe, doSegmentVeto, doTimeBoxHistos, dtDigiLabel, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), cppFunctionSkipper::operator, safeMargin, and theRecHits4DLabel.
: evtNumber(0) { LogVerbatim("DTNoiseTask") << "[DTNoiseTask]: Constructor"<<endl; dbe = edm::Service<DQMStore>().operator->(); //switch for timeBox booking doTimeBoxHistos = ps.getUntrackedParameter<bool>("doTbHistos", false); // The label to retrieve the digis dtDigiLabel = ps.getParameter<InputTag>("dtDigiLabel"); // the name of the 4D rec hits collection theRecHits4DLabel = ps.getParameter<string>("recHits4DLabel"); // switch for segment veto doSegmentVeto = ps.getUntrackedParameter<bool>("doSegmentVeto", false); // safe margin (ns) between ttrig and beginning of counting area safeMargin = ps.getUntrackedParameter<double>("safeMargin", 200.); }
DTNoiseTask::~DTNoiseTask | ( | ) | [virtual] |
void DTNoiseTask::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 98 of file DTNoiseTask.cc.
References doSegmentVeto, doTimeBoxHistos, dtDigiLabel, evtNumber, MonitorElement::Fill(), edm::Event::getByLabel(), mapEvt, nEventMonitor, noiseHistos, safeMargin, edm::second(), tbHistos, theRecHits4DLabel, and tTrigStMap.
{ evtNumber++; nEventMonitor->Fill(evtNumber); if(evtNumber%1000==0) LogVerbatim("DTNoiseTask") <<"[DTNoiseTask]: Analyzing evt number :"<<evtNumber<<endl; // map of the chambers with at least 1 segment std::map<DTChamberId, int> segmentsChId; // Get the 4D segment collection from the event edm::Handle<DTRecSegment4DCollection> all4DSegments; if(doSegmentVeto) { e.getByLabel(theRecHits4DLabel, all4DSegments); // Loop over all chambers containing a segment and look for the number of segments DTRecSegment4DCollection::id_iterator chamberId; for (chamberId = all4DSegments->id_begin(); chamberId != all4DSegments->id_end(); ++chamberId){ segmentsChId[*chamberId]=1; } } // Get the digis from the event edm::Handle<DTDigiCollection> dtdigis; e.getByLabel(dtDigiLabel, dtdigis); // LOOP OVER ALL THE DIGIS OF THE EVENT 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){ //Check the TDC trigger width int tdcTime = (*digiIt).countsTDC(); double upperLimit = tTrigStMap[(*dtLayerId_It).first.superlayerId().chamberId()]-safeMargin; if(doTimeBoxHistos) tbHistos[(*dtLayerId_It).first.superlayerId()]->Fill(tdcTime); if(tdcTime>upperLimit) continue; //Check the chamber has no 4D segments (optional) if(doSegmentVeto && segmentsChId.find((*dtLayerId_It).first.superlayerId().chamberId())!=segmentsChId.end()) continue; // fill the occupancy histo // FIXME: needs to be optimized: no need to rescale the histo for each digi TH2F* noise_root = noiseHistos[(*dtLayerId_It).first.superlayerId().chamberId()]->getTH2F(); double normalization=0; if(mapEvt.find((*dtLayerId_It).first.superlayerId().chamberId())!=mapEvt.end()) { LogVerbatim("DTNoiseTask") << " Last fill: # of events: " << mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()] << endl; normalization = 1e-9*upperLimit*mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]; // revert back to # of entries noise_root->Scale(normalization); } int yBin=(*dtLayerId_It).first.layer()+(4*((*dtLayerId_It).first.superlayerId().superlayer()-1)); noise_root->Fill((*digiIt).wire(),yBin); // normalize the occupancy histo mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()] = evtNumber; LogVerbatim("DTNoiseTask") << (*dtLayerId_It).first << " wire: " << (*digiIt).wire() << " # counts: " << noise_root->GetBinContent((*digiIt).wire(),yBin) << " Time interval: " << upperLimit << " # of events: " << evtNumber << endl;; normalization = double( 1e-9*upperLimit*mapEvt[(*dtLayerId_It).first.superlayerId().chamberId()]); // update the rate noise_root->Scale(1./normalization); LogVerbatim("DTNoiseTask") << " noise rate: " << noise_root->GetBinContent((*digiIt).wire(),yBin) << endl; } } }
void DTNoiseTask::beginJob | ( | void | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 79 of file DTNoiseTask.cc.
{ LogVerbatim("DTNoiseTask") << "[DTNoiseTask]: BeginJob"<<endl; }
void DTNoiseTask::beginLuminosityBlock | ( | const edm::LuminosityBlock & | lumiSeg, |
const edm::EventSetup & | context | ||
) | [protected, virtual] |
To reset the MEs.
Reimplemented from edm::EDAnalyzer.
Definition at line 88 of file DTNoiseTask.cc.
{ LogVerbatim("DTNoiseTask") <<"[DTNoiseTask]: Begin of LS transition"<<endl; }
void DTNoiseTask::beginRun | ( | const edm::Run & | run, |
const edm::EventSetup & | setup | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 266 of file DTNoiseTask.cc.
References DQMStore::bookFloat(), bookHistos(), dbe, doTimeBoxHistos, dtGeom, edm::EventSetup::get(), nEventMonitor, DTTimeUnits::ns, DQMStore::setCurrentFolder(), and tTrigStMap.
{ LogVerbatim("DTNoiseTask") <<"[DTNoiseTask]: Begin of run"<<endl; // tTrig Map edm::ESHandle<DTTtrig> tTrigMap; setup.get<DTTtrigRcd>().get(tTrigMap); // get the geometry setup.get<MuonGeometryRecord>().get(dtGeom); dbe->setCurrentFolder("DT/EventInfo/Counters"); nEventMonitor = dbe->bookFloat("nProcessedEventsNoise"); // Loop over all the chambers vector<DTChamber*>::const_iterator ch_it = dtGeom->chambers().begin(); vector<DTChamber*>::const_iterator ch_end = dtGeom->chambers().end(); for (; ch_it != ch_end; ++ch_it) { DTChamberId chId = (*ch_it)->id(); // histo booking bookHistos(chId); vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin(); vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end(); // Loop over the SLs for(; sl_it != sl_end; ++sl_it) { DTSuperLayerId slId = (*sl_it)->id(); if(doTimeBoxHistos) bookHistos(slId); float tTrig, tTrigRMS, kFactor; tTrigMap->get(slId, tTrig, tTrigRMS,kFactor,DTTimeUnits::ns); // tTrig mapping per station // check that the ttrig is the lowest of the 3 SLs if(tTrigStMap.find(chId)==tTrigStMap.end() || (tTrigStMap.find(chId)!=tTrigStMap.end() && tTrig < tTrigStMap[chId])) tTrigStMap[chId] = tTrig; } } }
void DTNoiseTask::bookHistos | ( | DTSuperLayerId | slId | ) | [private] |
Definition at line 237 of file DTNoiseTask.cc.
References DQMStore::book1D(), DTSuperLayerId::chamberId(), dbe, DTChamberId::sector(), DQMStore::setCurrentFolder(), relativeConstraints::station, DTChamberId::station(), DTSuperLayerId::superlayer(), tbHistos, and DTChamberId::wheel().
{ // set the folder stringstream wheel; wheel << slId.chamberId().wheel(); stringstream station; station << slId.chamberId().station(); stringstream sector; sector << slId.chamberId().sector(); stringstream superlayer; superlayer << slId.superlayer(); dbe->setCurrentFolder("DT/05-Noise/Wheel" + wheel.str() + "/Station" + station.str() + "/Sector" + sector.str()); // Build the histo name string histoName = string("TimeBox") + "_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superlayer.str(); LogVerbatim("DTNoiseTask") <<"[DTNoiseTask]: booking SL histo:"<<endl; LogVerbatim("DTNoiseTask") <<" folder "<< "DT/05-Noise/Wheel" + wheel.str() + "/Station" + station.str() + "/Sector" + sector.str() + "/" << endl; LogVerbatim("DTNoiseTask") <<" histoName "<<histoName<<endl; tbHistos[slId] = dbe->book1D(histoName,"Time Box (TDC counts)", 1000, 0, 6000); }
void DTNoiseTask::bookHistos | ( | DTChamberId | chId | ) | [private] |
Definition at line 181 of file DTNoiseTask.cc.
References DQMStore::book2D(), dbe, dtGeom, noiseHistos, DTChamberId::sector(), DQMStore::setCurrentFolder(), relativeConstraints::station, DTChamberId::station(), DTChamber::superLayers(), and DTChamberId::wheel().
Referenced by beginRun().
{ // set the folder stringstream wheel; wheel << chId.wheel(); stringstream station; station << chId.station(); stringstream sector; sector << chId.sector(); dbe->setCurrentFolder("DT/05-Noise/Wheel" + wheel.str() + // "/Station" + station.str() + "/Sector" + sector.str()); // Build the histo name string histoName = string("NoiseRate") + "_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() ; LogVerbatim("DTNoiseTask") << "[DTNoiseTask]: booking chamber histo:"<<endl; LogVerbatim("DTNoiseTask") << " folder "<< "DT/05-Noise/Wheel" + wheel.str() + // "/Station" + station.str() + "/Sector" + sector.str() + "/"<<endl; LogVerbatim("DTNoiseTask") << " histoName "<<histoName<<endl; // Get the chamber from the geometry int nWires_max = 0; const DTChamber* dtchamber = dtGeom->chamber(chId); const vector<const DTSuperLayer*> superlayers = dtchamber->superLayers(); // Loop over layers and find the max # of wires for(vector<const DTSuperLayer*>::const_iterator sl = superlayers.begin(); sl != superlayers.end(); ++sl) { // loop over SLs vector<const DTLayer*> layers = (*sl)->layers(); for(vector<const DTLayer*>::const_iterator lay = layers.begin(); lay != layers.end(); ++lay) { // loop over layers int nWires = (*lay)->specificTopology().channels(); if(nWires > nWires_max) nWires_max = nWires; } } noiseHistos[chId] = dbe->book2D(histoName,"Noise rate (Hz) per channel", nWires_max,1, nWires_max+1,12,1,13); noiseHistos[chId]->setAxisTitle("wire number",1); noiseHistos[chId]->setBinLabel(1,"SL1-L1",2); noiseHistos[chId]->setBinLabel(2,"SL1-L2",2); noiseHistos[chId]->setBinLabel(3,"SL1-L3",2); noiseHistos[chId]->setBinLabel(4,"SL1-L4",2); noiseHistos[chId]->setBinLabel(5,"SL2-L1",2); noiseHistos[chId]->setBinLabel(6,"SL2-L2",2); noiseHistos[chId]->setBinLabel(7,"SL2-L3",2); noiseHistos[chId]->setBinLabel(8,"SL2-L4",2); noiseHistos[chId]->setBinLabel(9,"SL3-L1",2); noiseHistos[chId]->setBinLabel(10,"SL3-L2",2); noiseHistos[chId]->setBinLabel(11,"SL3-L3",2); noiseHistos[chId]->setBinLabel(12,"SL3-L4",2); }
void DTNoiseTask::endJob | ( | void | ) | [protected, virtual] |
void DTNoiseTask::endLuminosityBlock | ( | const edm::LuminosityBlock & | lumiSeg, |
const edm::EventSetup & | setup | ||
) | [protected, virtual] |
Reimplemented from edm::EDAnalyzer.
Definition at line 307 of file DTNoiseTask.cc.
References alignCSCRings::e, evtNumber, mapEvt, noiseHistos, safeMargin, and tTrigStMap.
{ LogVerbatim("DTNoiseTask") << "[DTNoiseTask]: End LS, update rates in all histos" << endl; // update the rate of all histos (usefull for histos with few entries: they are not updated very often for(map<DTChamberId, MonitorElement*>::const_iterator meAndChamber = noiseHistos.begin(); meAndChamber != noiseHistos.end(); ++meAndChamber) { DTChamberId chId = (*meAndChamber).first; TH2F* noise_root = (*meAndChamber).second->getTH2F(); double upperLimit = tTrigStMap[chId]-safeMargin; double normalization=0; if(mapEvt.find(chId) != mapEvt.end()) { LogVerbatim("DTNoiseTask") << " Ch: " << chId << " Last fill: # of events: " << mapEvt[chId] << endl; normalization = 1e-9*upperLimit*mapEvt[chId]; // revert back to # of entries noise_root->Scale(normalization); } //check that event analyzed != 0 might happen oline if (evtNumber) { // set the # of events analyzed until this update LogVerbatim("DTNoiseTask") << " Update for events: " << evtNumber << endl; mapEvt[chId] = evtNumber; // update the rate normalization = double( 1e-9*upperLimit*evtNumber); noise_root->Scale(1./normalization); } } }
DQMStore* DTNoiseTask::dbe [private] |
Definition at line 74 of file DTNoiseTask.h.
Referenced by beginRun(), bookHistos(), and DTNoiseTask().
bool DTNoiseTask::doSegmentVeto [private] |
Definition at line 72 of file DTNoiseTask.h.
Referenced by analyze(), and DTNoiseTask().
bool DTNoiseTask::doTimeBoxHistos [private] |
Definition at line 68 of file DTNoiseTask.h.
Referenced by analyze(), beginRun(), and DTNoiseTask().
edm::InputTag DTNoiseTask::dtDigiLabel [private] |
Definition at line 64 of file DTNoiseTask.h.
Referenced by analyze(), and DTNoiseTask().
edm::ESHandle<DTGeometry> DTNoiseTask::dtGeom [private] |
Definition at line 75 of file DTNoiseTask.h.
Referenced by beginRun(), and bookHistos().
int DTNoiseTask::evtNumber [private] |
Definition at line 66 of file DTNoiseTask.h.
Referenced by analyze(), and endLuminosityBlock().
std::map<DTChamberId, int> DTNoiseTask::mapEvt [private] |
Definition at line 84 of file DTNoiseTask.h.
Referenced by analyze(), and endLuminosityBlock().
MonitorElement* DTNoiseTask::nEventMonitor [private] |
Definition at line 89 of file DTNoiseTask.h.
Referenced by analyze(), and beginRun().
std::map<DTChamberId, MonitorElement*> DTNoiseTask::noiseHistos [private] |
Definition at line 81 of file DTNoiseTask.h.
Referenced by analyze(), bookHistos(), and endLuminosityBlock().
double DTNoiseTask::safeMargin [private] |
Definition at line 92 of file DTNoiseTask.h.
Referenced by analyze(), DTNoiseTask(), and endLuminosityBlock().
std::map<DTSuperLayerId, MonitorElement*> DTNoiseTask::tbHistos [private] |
Definition at line 87 of file DTNoiseTask.h.
Referenced by analyze(), and bookHistos().
std::string DTNoiseTask::theRecHits4DLabel [private] |
Definition at line 70 of file DTNoiseTask.h.
Referenced by analyze(), and DTNoiseTask().
std::map<DTChamberId, double> DTNoiseTask::tTrigStMap [private] |
Definition at line 78 of file DTNoiseTask.h.
Referenced by analyze(), beginRun(), and endLuminosityBlock().