CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Protected Member Functions | Private Attributes
DTDigiForNoiseTask Class Reference

#include <DTDigiForNoiseTask.h>

Inheritance diagram for DTDigiForNoiseTask:
edm::EDAnalyzer

Public Member Functions

 DTDigiForNoiseTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTDigiForNoiseTask ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 Analyze. More...
 
void beginJob ()
 BeginJob. More...
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumiSeg, edm::EventSetup const &context)
 To reset the MEs. More...
 
void beginRun (const edm::Run &, const edm::EventSetup &)
 BeginRun. More...
 
void bookHistos (const DTLayerId &dtSL)
 Book the ME. More...
 
void endJob ()
 Endjob. More...
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
typedef WorkerT< EDAnalyzerWorkerType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 

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 gather_cfg::cout, debug, edm::ParameterSet::getUntrackedParameter(), cmsCodeRules.cppFunctionSkipper::operator, and Parameters::parameters.

38  {
39 
40  debug = ps.getUntrackedParameter<bool>("debug", "false");
41  if(debug)
42  cout<<"[DTDigiForNoiseTask]: Constructor"<<endl;
43 
44  parameters = ps;
45 
47 
48 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters
tuple cout
Definition: gather_cfg.py:41
DTDigiForNoiseTask::~DTDigiForNoiseTask ( )
virtual

Destructor.

Definition at line 51 of file DTDigiForNoiseTask.cc.

References gather_cfg::cout, debug, and nevents.

51  {
52 
53  if(debug)
54  cout << "DTDigiForNoiseTask: analyzed " << nevents << " events" << endl;
55 
56 }
tuple cout
Definition: gather_cfg.py:41

Member Function Documentation

void DTDigiForNoiseTask::analyze ( const edm::Event e,
const edm::EventSetup c 
)
protectedvirtual

Analyze.

Implements edm::EDAnalyzer.

Definition at line 145 of file DTDigiForNoiseTask.cc.

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

145  {
146 
147  nevents++;
148  // cout << "events: " << nevents << endl;
149  if (nevents%1000 == 0 && debug) {}
150 
152  e.getByLabel("dtunpacker", dtdigis);
153 
154  std::map< int,int > DigiPerWirePerEvent;
155 
156  // Loop over all the chambers
157  vector<DTChamber*>::const_iterator ch_it = muonGeom->chambers().begin();
158  vector<DTChamber*>::const_iterator ch_end = muonGeom->chambers().end();
159  // Loop over the SLs
160  for (; ch_it != ch_end; ++ch_it) {
161  // DTChamberId ch = (*ch_it)->id();
162  vector<const DTSuperLayer*>::const_iterator sl_it = (*ch_it)->superLayers().begin();
163  vector<const DTSuperLayer*>::const_iterator sl_end = (*ch_it)->superLayers().end();
164  // Loop over the SLs
165  for(; sl_it != sl_end; ++sl_it) {
166  vector<const DTLayer*>::const_iterator l_it = (*sl_it)->layers().begin();
167  vector<const DTLayer*>::const_iterator l_end = (*sl_it)->layers().end();
168  // Loop over the Ls
169  for(; l_it != l_end; ++l_it) {
170  DTLayerId layerId = (*l_it)->id();
171 
172  DTDigiCollection::Range layerDigi= dtdigis->get(layerId);
173  if(layerDigi.first != layerDigi.second){
174 
175  const DTTopology& dtTopo = muonGeom->layer(layerId)->specificTopology();
176  const int firstWire = dtTopo.firstChannel();
177  const int lastWire = dtTopo.lastChannel();
178 
179  if (digiHistos.find(layerId) == digiHistos.end())
180  bookHistos(layerId);
181 
182  if (digiHistos.find(layerId) != digiHistos.end()){
183  for (int wire=firstWire; wire<=lastWire; wire++) {
184  DigiPerWirePerEvent[wire]= 0;
185  }
186 
187  for (DTDigiCollection::const_iterator digi = layerDigi.first;
188  digi!=layerDigi.second;
189  ++digi){
190  DigiPerWirePerEvent[(*digi).wire()]+=1;
191  }
192 
193  for (int wire=firstWire; wire<=lastWire; wire++) {
194  digiHistos.find(layerId)->second->Fill(wire,DigiPerWirePerEvent[wire]);
195  }
196  }
197  }
198 
199  } //Loop Ls
200  } //Loop SLs
201  } //Loop over chambers
202 
203 }
const int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:82
const int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:80
void bookHistos(const DTLayerId &dtSL)
Book the ME.
std::map< DTLayerId, MonitorElement * > digiHistos
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:355
std::vector< DigiType >::const_iterator const_iterator
std::pair< const_iterator, const_iterator > Range
edm::ESHandle< DTGeometry > muonGeom
void DTDigiForNoiseTask::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 69 of file DTDigiForNoiseTask.cc.

References gather_cfg::cout, debug, and nevents.

69  {
70 
71  if(debug)
72  cout<<"[DTDigiForNoiseTask]: BeginJob"<<endl;
73 
74  nevents = 0;
75 
76 }
tuple cout
Definition: gather_cfg.py:41
void DTDigiForNoiseTask::beginLuminosityBlock ( edm::LuminosityBlock const &  lumiSeg,
edm::EventSetup const &  context 
)
protectedvirtual

To reset the MEs.

Reimplemented from edm::EDAnalyzer.

Definition at line 88 of file DTDigiForNoiseTask.cc.

References gather_cfg::cout, debug, trackerHits::histo, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), and Parameters::parameters.

88  {
89 
90  if(debug)
91  cout<<"[DTDigiForNoiseTask]: Begin of LS transition"<<endl;
92 
93  if(lumiSeg.id().luminosityBlock()%parameters.getUntrackedParameter<int>("ResetCycle", 3) == 0) {
94  for(map< DTLayerId, MonitorElement* > ::const_iterator histo = digiHistos.begin();
95  histo != digiHistos.end();
96  histo++) {
97  (*histo).second->Reset();
98  }
99  }
100 
101 }
T getUntrackedParameter(std::string const &, T const &) const
tuple histo
Definition: trackerHits.py:12
std::map< DTLayerId, MonitorElement * > digiHistos
edm::ParameterSet parameters
tuple cout
Definition: gather_cfg.py:41
void DTDigiForNoiseTask::beginRun ( const edm::Run run,
const edm::EventSetup context 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 78 of file DTDigiForNoiseTask.cc.

References gather_cfg::cout, debug, and edm::EventSetup::get().

78  {
79 
80  if(debug)
81  cout<<"[DTDigiForNoiseTask]: BeginRun"<<endl;
82 
83  // Get the geometry
84  context.get<MuonGeometryRecord>().get(muonGeom);
85 
86 }
const T & get() const
Definition: EventSetup.h:55
tuple cout
Definition: gather_cfg.py:41
edm::ESHandle< DTGeometry > muonGeom
void DTDigiForNoiseTask::bookHistos ( const DTLayerId dtSL)
protected

Book the ME.

Definition at line 104 of file DTDigiForNoiseTask.cc.

References DTSuperLayerId::chamberId(), gather_cfg::cout, debug, DTTopology::firstChannel(), DTTopology::lastChannel(), DTLayerId::layer(), DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), and DTChamberId::wheel().

104  {
105 
106  if (debug) cout<<"[DTDigiForNoiseTask]: booking"<<endl;
107 
108  const DTSuperLayerId dtSLId = lId.superlayerId();
109  const DTChamberId dtChId = dtSLId.chamberId();
110  stringstream layer; layer << lId.layer();
111  stringstream superLayer; superLayer << dtSLId.superlayer();
112  stringstream wheel; wheel << dtChId.wheel();
113  stringstream station; station << dtChId.station();
114  stringstream sector; sector << dtChId.sector();
115 
116  dbe->setCurrentFolder("DT/DTDigiForNoiseTask/Wheel" + wheel.str() +
117  "/Station" + station.str() +
118  "/Sector" + sector.str() + "/DigiPerEvent");
119 
120  if (debug){
121  cout<<"[DTDigiForNoiseTask]: folder "<< "DT/DTDigiTask/Wheel" + wheel.str() +
122  "/Station" + station.str() +
123  "/Sector" + sector.str() + "/DigiPerEvent"<<endl;
124  }
125 
126  string histoName =
127  "DigiPerEvent_W" + wheel.str()
128  + "_St" + station.str()
129  + "_Sec" + sector.str()
130  + "_SL" + superLayer.str()
131  + "_L" + layer.str();
132 
133  if (debug) cout<<"[DTDigiTask]: histoName "<<histoName<<endl;
134 
135  const DTTopology& dtTopo = muonGeom->layer(lId)->specificTopology();
136  const int firstWire = dtTopo.firstChannel();
137  const int lastWire = dtTopo.lastChannel();
138  int nWires = lastWire-firstWire+1;
139 
140  digiHistos[lId] = dbe->book2D(histoName,histoName,nWires,firstWire,lastWire,10,-0.5,9.5);
141 
142 }
const int lastChannel() const
Returns the wire number of the last wire.
Definition: DTTopology.h:82
DTChamberId chamberId() const
Return the corresponding ChamberId.
const int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:80
std::map< DTLayerId, MonitorElement * > digiHistos
int superlayer() const
Return the superlayer number (deprecated method name)
int sector() const
Definition: DTChamberId.h:63
tuple cout
Definition: gather_cfg.py:41
int station() const
Return the station number.
Definition: DTChamberId.h:53
MonitorElement * book2D(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY)
Book 2D histogram.
Definition: DQMStore.cc:642
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:47
edm::ESHandle< DTGeometry > muonGeom
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:232
void DTDigiForNoiseTask::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file DTDigiForNoiseTask.cc.

References gather_cfg::cout, and debug.

59  {
60 
61  if(debug)
62  cout<<"[DTDigiForNoiseTask] endjob called!"<<endl;
63 
64  dbe->rmdir("DT/DTDigiForNoiseTask");
65 
66 }
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2311
tuple cout
Definition: gather_cfg.py:41

Member Data Documentation

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.

edm::ParameterSet DTDigiForNoiseTask::parameters
private