#include <DTDigiForNoiseTask.h>
Public Member Functions | |
DTDigiForNoiseTask (const edm::ParameterSet &ps) | |
Constructor. | |
virtual | ~DTDigiForNoiseTask () |
Destructor. | |
Protected Member Functions | |
void | analyze (const edm::Event &e, const edm::EventSetup &c) |
Analyze. | |
void | beginJob () |
BeginJob. | |
void | beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context) |
To reset the MEs. | |
void | beginRun (const edm::Run &, const edm::EventSetup &) |
BeginRun. | |
void | bookHistos (const DTLayerId &dtSL) |
Book the ME. | |
void | endJob () |
Endjob. | |
Private Attributes | |
DQMStore * | dbe |
bool | debug |
std::map< DTLayerId, MonitorElement * > | digiHistos |
edm::ESHandle< DTGeometry > | muonGeom |
int | nevents |
edm::ParameterSet | parameters |
Definition at line 39 of file DTDigiForNoiseTask.h.
DTDigiForNoiseTask::DTDigiForNoiseTask | ( | const edm::ParameterSet & | ps | ) |
Constructor.
Definition at line 38 of file DTDigiForNoiseTask.cc.
References gather_cfg::cout, debug, edm::ParameterSet::getUntrackedParameter(), cppFunctionSkipper::operator, and Parameters::parameters.
{ debug = ps.getUntrackedParameter<bool>("debug", false); if(debug) cout<<"[DTDigiForNoiseTask]: Constructor"<<endl; parameters = ps; dbe = edm::Service<DQMStore>().operator->(); }
DTDigiForNoiseTask::~DTDigiForNoiseTask | ( | ) | [virtual] |
Destructor.
Definition at line 51 of file DTDigiForNoiseTask.cc.
References gather_cfg::cout, debug, and nevents.
void DTDigiForNoiseTask::analyze | ( | const edm::Event & | e, |
const edm::EventSetup & | c | ||
) | [protected, virtual] |
Analyze.
Implements edm::EDAnalyzer.
Definition at line 145 of file DTDigiForNoiseTask.cc.
References bookHistos(), debug, DTTopology::firstChannel(), edm::Event::getByLabel(), DTTopology::lastChannel(), and nevents.
{ nevents++; // cout << "events: " << nevents << endl; if (nevents%1000 == 0 && debug) {} edm::Handle<DTDigiCollection> dtdigis; e.getByLabel("dtunpacker", dtdigis); std::map< int,int > DigiPerWirePerEvent; // Loop over all the chambers vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin(); vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end(); // Loop over the SLs for (; ch_it != ch_end; ++ch_it) { // DTChamberId ch = (*ch_it)->id(); 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) { vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); vector<const DTLayer*>::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()) bookHistos(layerId); 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 }
void DTDigiForNoiseTask::beginJob | ( | void | ) | [protected, virtual] |
BeginJob.
Reimplemented from edm::EDAnalyzer.
Definition at line 69 of file DTDigiForNoiseTask.cc.
References gather_cfg::cout, debug, and nevents.
void DTDigiForNoiseTask::beginLuminosityBlock | ( | edm::LuminosityBlock const & | lumiSeg, |
edm::EventSetup const & | context | ||
) | [protected, virtual] |
To reset the MEs.
Reimplemented from edm::EDAnalyzer.
Definition at line 88 of file DTDigiForNoiseTask.cc.
References gather_cfg::cout, debug, interpolateCardsSimple::histo, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), and Parameters::parameters.
{ if(debug) cout<<"[DTDigiForNoiseTask]: Begin of LS transition"<<endl; if(lumiSeg.id().luminosityBlock()%parameters.getUntrackedParameter<int>("ResetCycle", 3) == 0) { for(map< DTLayerId, MonitorElement* > ::const_iterator histo = digiHistos.begin(); histo != digiHistos.end(); histo++) { (*histo).second->Reset(); } } }
void DTDigiForNoiseTask::beginRun | ( | const edm::Run & | run, |
const edm::EventSetup & | context | ||
) | [protected, virtual] |
BeginRun.
Reimplemented from edm::EDAnalyzer.
Definition at line 78 of file DTDigiForNoiseTask.cc.
References gather_cfg::cout, debug, and edm::EventSetup::get().
{ if(debug) cout<<"[DTDigiForNoiseTask]: BeginRun"<<endl; // Get the geometry context.get<MuonGeometryRecord>().get(muonGeom); }
void DTDigiForNoiseTask::bookHistos | ( | const DTLayerId & | dtSL | ) | [protected] |
Definition at line 104 of file DTDigiForNoiseTask.cc.
References DTSuperLayerId::chamberId(), gather_cfg::cout, debug, DTTopology::firstChannel(), DTTopology::lastChannel(), DTLayerId::layer(), DTChamberId::sector(), relativeConstraints::station, DTChamberId::station(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), and DTChamberId::wheel().
{ if (debug) cout<<"[DTDigiForNoiseTask]: booking"<<endl; const DTSuperLayerId dtSLId = lId.superlayerId(); const DTChamberId dtChId = dtSLId.chamberId(); stringstream layer; layer << lId.layer(); stringstream superLayer; superLayer << dtSLId.superlayer(); stringstream wheel; wheel << dtChId.wheel(); stringstream station; station << dtChId.station(); stringstream sector; sector << dtChId.sector(); dbe->setCurrentFolder("DT/DTDigiForNoiseTask/Wheel" + wheel.str() + "/Station" + station.str() + "/Sector" + sector.str() + "/DigiPerEvent"); if (debug){ cout<<"[DTDigiForNoiseTask]: folder "<< "DT/DTDigiTask/Wheel" + wheel.str() + "/Station" + station.str() + "/Sector" + sector.str() + "/DigiPerEvent"<<endl; } string histoName = "DigiPerEvent_W" + wheel.str() + "_St" + station.str() + "_Sec" + sector.str() + "_SL" + superLayer.str() + "_L" + layer.str(); if (debug) cout<<"[DTDigiTask]: histoName "<<histoName<<endl; const DTTopology& dtTopo = muonGeom->layer(lId)->specificTopology(); const int firstWire = dtTopo.firstChannel(); const int lastWire = dtTopo.lastChannel(); int nWires = lastWire-firstWire+1; digiHistos[lId] = dbe->book2D(histoName,histoName,nWires,firstWire,lastWire,10,-0.5,9.5); }
void DTDigiForNoiseTask::endJob | ( | void | ) | [protected, virtual] |
Endjob.
Reimplemented from edm::EDAnalyzer.
Definition at line 59 of file DTDigiForNoiseTask.cc.
References gather_cfg::cout, and debug.
DQMStore* DTDigiForNoiseTask::dbe [private] |
Definition at line 74 of file DTDigiForNoiseTask.h.
bool DTDigiForNoiseTask::debug [private] |
Definition at line 71 of file DTDigiForNoiseTask.h.
std::map< DTLayerId, MonitorElement* > DTDigiForNoiseTask::digiHistos [private] |
Definition at line 80 of file DTDigiForNoiseTask.h.
edm::ESHandle<DTGeometry> DTDigiForNoiseTask::muonGeom [private] |
Definition at line 78 of file DTDigiForNoiseTask.h.
int DTDigiForNoiseTask::nevents [private] |
Definition at line 72 of file DTDigiForNoiseTask.h.
Definition at line 76 of file DTDigiForNoiseTask.h.