CMS 3D CMS Logo

DTDigiForNoiseTask Class Reference

#include <DQM/DTMonitorModule/src/DTDigiForNoiseTask.h>

Inheritance diagram for DTDigiForNoiseTask:

edm::EDAnalyzer

List of all members.

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 (const edm::EventSetup &c)
 BeginJob.
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 To reset the MEs.
void bookHistos (const DTLayerId &dtSL)
 Book the ME.
void endJob ()
 Endjob.

Private Attributes

DQMStoredbe
bool debug
std::map< DTLayerId,
MonitorElement * > 
digiHistos
edm::ESHandle< DTGeometrymuonGeom
int nevents
edm::ParameterSet parameters


Detailed Description

Definition at line 39 of file DTDigiForNoiseTask.h.


Constructor & Destructor Documentation

DTDigiForNoiseTask::DTDigiForNoiseTask ( const edm::ParameterSet ps  ) 

Constructor.

Definition at line 38 of file DTDigiForNoiseTask.cc.

References GenMuonPlsPt100GeV_cfg::cout, dbe, debug, lat::endl(), edm::ParameterSet::getUntrackedParameter(), and parameters.

00038                                                                {
00039   
00040   debug = ps.getUntrackedParameter<bool>("debug", "false");
00041   if(debug)
00042     cout<<"[DTDigiForNoiseTask]: Constructor"<<endl;
00043 
00044   parameters = ps;
00045   
00046   dbe = edm::Service<DQMStore>().operator->();
00047 
00048 }

DTDigiForNoiseTask::~DTDigiForNoiseTask (  )  [virtual]

Destructor.

Definition at line 51 of file DTDigiForNoiseTask.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), and nevents.

00051                                        {
00052 
00053   if(debug)
00054     cout << "DTDigiForNoiseTask: analyzed " << nevents << " events" << endl;
00055 
00056 }


Member Function Documentation

void DTDigiForNoiseTask::analyze ( const edm::Event e,
const edm::EventSetup c 
) [protected, virtual]

Analyze.

Implements edm::EDAnalyzer.

Definition at line 139 of file DTDigiForNoiseTask.cc.

References bookHistos(), debug, digiHistos, DTTopology::firstChannel(), edm::Event::getByLabel(), DTTopology::lastChannel(), muonGeom, and nevents.

00139                                                                          {
00140   
00141   nevents++;
00142   //  cout << "events:  " << nevents << endl;
00143   if (nevents%1000 == 0 && debug) {}
00144   
00145   edm::Handle<DTDigiCollection> dtdigis;
00146   e.getByLabel("dtunpacker", dtdigis);
00147 
00148   std::map< int,int > DigiPerWirePerEvent;
00149   
00150   // Loop over all the chambers
00151   vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
00152   vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
00153   // Loop over the SLs
00154   for (; ch_it != ch_end; ++ch_it) {
00155     //    DTChamberId ch = (*ch_it)->id();
00156     vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin(); 
00157     vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
00158     // Loop over the SLs
00159     for(; sl_it != sl_end; ++sl_it) {
00160       vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin(); 
00161       vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
00162       // Loop over the Ls
00163       for(; l_it != l_end; ++l_it) {
00164         DTLayerId layerId = (*l_it)->id();
00165 
00166         DTDigiCollection::Range layerDigi= dtdigis->get(layerId);
00167         if(layerDigi.first != layerDigi.second){
00168 
00169           const DTTopology& dtTopo = muonGeom->layer(layerId)->specificTopology();
00170           const int firstWire = dtTopo.firstChannel();
00171           const int lastWire = dtTopo.lastChannel();
00172           
00173           if (digiHistos.find(layerId) == digiHistos.end())
00174             bookHistos(layerId);
00175           
00176           if (digiHistos.find(layerId) != digiHistos.end()){
00177             for (int wire=firstWire; wire<=lastWire; wire++) {
00178               DigiPerWirePerEvent[wire]= 0;
00179             }
00180 
00181             for (DTDigiCollection::const_iterator digi = layerDigi.first;
00182                  digi!=layerDigi.second;
00183                  ++digi){
00184               DigiPerWirePerEvent[(*digi).wire()]+=1;
00185             }
00186 
00187             for (int wire=firstWire; wire<=lastWire; wire++) {
00188               digiHistos.find(layerId)->second->Fill(wire,DigiPerWirePerEvent[wire]);
00189             }
00190           }
00191         }
00192 
00193       } //Loop Ls
00194     } //Loop SLs
00195   } //Loop over chambers
00196    
00197 }

void DTDigiForNoiseTask::beginJob ( const edm::EventSetup c  )  [protected, virtual]

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file DTDigiForNoiseTask.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, lat::endl(), edm::EventSetup::get(), muonGeom, and nevents.

00069                                                              {
00070 
00071   if(debug)
00072     cout<<"[DTDigiForNoiseTask]: BeginJob"<<endl;
00073 
00074   nevents = 0;
00075 
00076   // Get the geometry
00077   context.get<MuonGeometryRecord>().get(muonGeom);
00078 
00079 }

void DTDigiForNoiseTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
) [protected, virtual]

To reset the MEs.

Reimplemented from edm::EDAnalyzer.

Definition at line 82 of file DTDigiForNoiseTask.cc.

References GenMuonPlsPt100GeV_cfg::cout, debug, digiHistos, lat::endl(), edm::ParameterSet::getUntrackedParameter(), histo, edm::LuminosityBlock::id(), edm::LuminosityBlockID::luminosityBlock(), and parameters.

00082                                                                                                        {
00083   
00084   if(debug)
00085     cout<<"[DTDigiForNoiseTask]: Begin of LS transition"<<endl;
00086   
00087   if(lumiSeg.id().luminosityBlock()%parameters.getUntrackedParameter<int>("ResetCycle", 3) == 0) {
00088     for(map< DTLayerId, MonitorElement* > ::const_iterator histo = digiHistos.begin();
00089         histo != digiHistos.end();
00090         histo++) {
00091       (*histo).second->Reset();
00092     }
00093   }
00094   
00095 }

void DTDigiForNoiseTask::bookHistos ( const DTLayerId dtSL  )  [protected]

Book the ME.

Definition at line 98 of file DTDigiForNoiseTask.cc.

References DQMStore::book2D(), DTSuperLayerId::chamberId(), GenMuonPlsPt100GeV_cfg::cout, dbe, debug, digiHistos, lat::endl(), DTTopology::firstChannel(), DTTopology::lastChannel(), DTLayerId::layer(), muonGeom, DTChamberId::sector(), DQMStore::setCurrentFolder(), DTChamberId::station(), DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), muonGeometry::wheel, and DTChamberId::wheel().

Referenced by analyze().

00098                                                         {
00099   
00100   if (debug) cout<<"[DTDigiForNoiseTask]: booking"<<endl;
00101 
00102   const  DTSuperLayerId dtSLId = lId.superlayerId();
00103   const  DTChamberId dtChId = dtSLId.chamberId(); 
00104   stringstream layer; layer << lId.layer();
00105   stringstream superLayer; superLayer << dtSLId.superlayer();
00106   stringstream wheel; wheel << dtChId.wheel();  
00107   stringstream station; station << dtChId.station();    
00108   stringstream sector; sector << dtChId.sector();
00109 
00110   dbe->setCurrentFolder("DT/DTDigiForNoiseTask/Wheel" + wheel.str() +
00111                         "/Station" + station.str() +
00112                         "/Sector" + sector.str() + "/DigiPerEvent");
00113 
00114   if (debug){
00115     cout<<"[DTDigiForNoiseTask]: folder "<< "DT/DTDigiTask/Wheel" + wheel.str() +
00116       "/Station" + station.str() +
00117       "/Sector" + sector.str() + "/DigiPerEvent"<<endl;
00118   }
00119   
00120   string histoName =
00121     "DigiPerEvent_W" + wheel.str() 
00122     + "_St" + station.str() 
00123     + "_Sec" + sector.str()
00124     + "_SL" + superLayer.str()  
00125     + "_L" + layer.str();
00126   
00127   if (debug) cout<<"[DTDigiTask]: histoName "<<histoName<<endl;
00128 
00129   const DTTopology& dtTopo = muonGeom->layer(lId)->specificTopology();
00130   const int firstWire = dtTopo.firstChannel();
00131   const int lastWire = dtTopo.lastChannel();
00132   int nWires = lastWire-firstWire+1;
00133   
00134   digiHistos[lId] = dbe->book2D(histoName,histoName,nWires,firstWire,lastWire,10,-0.5,9.5);
00135 
00136 }

void DTDigiForNoiseTask::endJob ( void   )  [protected, virtual]

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file DTDigiForNoiseTask.cc.

References GenMuonPlsPt100GeV_cfg::cout, dbe, debug, lat::endl(), and DQMStore::rmdir().

00059                                {
00060 
00061   if(debug)
00062     cout<<"[DTDigiForNoiseTask] endjob called!"<<endl;
00063 
00064   dbe->rmdir("DT/DTDigiForNoiseTask");
00065 
00066 }


Member Data Documentation

DQMStore* DTDigiForNoiseTask::dbe [private]

Definition at line 71 of file DTDigiForNoiseTask.h.

Referenced by bookHistos(), DTDigiForNoiseTask(), and endJob().

bool DTDigiForNoiseTask::debug [private]

Definition at line 68 of file DTDigiForNoiseTask.h.

Referenced by analyze(), beginJob(), beginLuminosityBlock(), bookHistos(), DTDigiForNoiseTask(), endJob(), and ~DTDigiForNoiseTask().

std::map< DTLayerId, MonitorElement* > DTDigiForNoiseTask::digiHistos [private]

Definition at line 77 of file DTDigiForNoiseTask.h.

Referenced by analyze(), beginLuminosityBlock(), and bookHistos().

edm::ESHandle<DTGeometry> DTDigiForNoiseTask::muonGeom [private]

Definition at line 75 of file DTDigiForNoiseTask.h.

Referenced by analyze(), beginJob(), and bookHistos().

int DTDigiForNoiseTask::nevents [private]

Definition at line 69 of file DTDigiForNoiseTask.h.

Referenced by analyze(), beginJob(), and ~DTDigiForNoiseTask().

edm::ParameterSet DTDigiForNoiseTask::parameters [private]

Definition at line 73 of file DTDigiForNoiseTask.h.

Referenced by beginLuminosityBlock(), and DTDigiForNoiseTask().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:50 2009 for CMSSW by  doxygen 1.5.4