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 edm::EDConsumerBase

Public Member Functions

 DTDigiForNoiseTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTDigiForNoiseTask ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Private Attributes

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

Additional Inherited Members

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

Detailed Description

Definition at line 40 of file DTDigiForNoiseTask.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 34 of file DTDigiForNoiseTask.cc.

References gather_cfg::cout, debug, edm::ParameterSet::getUntrackedParameter(), cppFunctionSkipper::operator, Parameters::parameters, and AlCaHLTBitMon_QueryRunRegistry::string.

34  {
35 
36  debug = ps.getUntrackedParameter<bool>("debug", false);
37  dtDigisToken_ = consumes<DTDigiCollection>(
38  edm::InputTag(ps.getUntrackedParameter<std::string>("diDigisLabel", "dtunpacker")));
39 
40  if(debug)
41  cout<<"[DTDigiForNoiseTask]: Constructor"<<endl;
42 
43  parameters = ps;
44 
46 
47 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DTDigiCollection > dtDigisToken_
edm::ParameterSet parameters
tuple cout
Definition: gather_cfg.py:121
DTDigiForNoiseTask::~DTDigiForNoiseTask ( )
virtual

Destructor.

Definition at line 50 of file DTDigiForNoiseTask.cc.

References gather_cfg::cout, debug, and nevents.

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

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 144 of file DTDigiForNoiseTask.cc.

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

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

References gather_cfg::cout, debug, and nevents.

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

To reset the MEs.

Reimplemented from edm::EDAnalyzer.

Definition at line 87 of file DTDigiForNoiseTask.cc.

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

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

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 77 of file DTDigiForNoiseTask.cc.

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

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

Book the ME.

Definition at line 103 of file DTDigiForNoiseTask.cc.

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

103  {
104 
105  if (debug) cout<<"[DTDigiForNoiseTask]: booking"<<endl;
106 
107  const DTSuperLayerId dtSLId = lId.superlayerId();
108  const DTChamberId dtChId = dtSLId.chamberId();
109  stringstream layer; layer << lId.layer();
110  stringstream superLayer; superLayer << dtSLId.superlayer();
111  stringstream wheel; wheel << dtChId.wheel();
112  stringstream station; station << dtChId.station();
113  stringstream sector; sector << dtChId.sector();
114 
115  dbe->setCurrentFolder("DT/DTDigiForNoiseTask/Wheel" + wheel.str() +
116  "/Station" + station.str() +
117  "/Sector" + sector.str() + "/DigiPerEvent");
118 
119  if (debug){
120  cout<<"[DTDigiForNoiseTask]: folder "<< "DT/DTDigiTask/Wheel" + wheel.str() +
121  "/Station" + station.str() +
122  "/Sector" + sector.str() + "/DigiPerEvent"<<endl;
123  }
124 
125  string histoName =
126  "DigiPerEvent_W" + wheel.str()
127  + "_St" + station.str()
128  + "_Sec" + sector.str()
129  + "_SL" + superLayer.str()
130  + "_L" + layer.str();
131 
132  if (debug) cout<<"[DTDigiTask]: histoName "<<histoName<<endl;
133 
134  const DTTopology& dtTopo = muonGeom->layer(lId)->specificTopology();
135  const int firstWire = dtTopo.firstChannel();
136  const int lastWire = dtTopo.lastChannel();
137  int nWires = lastWire-firstWire+1;
138 
139  digiHistos[lId] = dbe->book2D(histoName,histoName,nWires,firstWire,lastWire,10,-0.5,9.5);
140 
141 }
DTChamberId chamberId() const
Return the corresponding ChamberId.
int firstChannel() const
Returns the wire number of the first wire.
Definition: DTTopology.h:78
int lastChannel() const
Returns the wire number of the last 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:61
tuple cout
Definition: gather_cfg.py:121
int station() const
Return the station number.
Definition: DTChamberId.h:51
int wheel() const
Return the wheel number.
Definition: DTChamberId.h:45
edm::ESHandle< DTGeometry > muonGeom
void DTDigiForNoiseTask::endJob ( void  )
protectedvirtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 58 of file DTDigiForNoiseTask.cc.

References gather_cfg::cout, and debug.

58  {
59 
60  if(debug)
61  cout<<"[DTDigiForNoiseTask] endjob called!"<<endl;
62 
63  dbe->rmdir("DT/DTDigiForNoiseTask");
64 
65 }
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

DQMStore* DTDigiForNoiseTask::dbe
private

Definition at line 75 of file DTDigiForNoiseTask.h.

bool DTDigiForNoiseTask::debug
private
std::map< DTLayerId, MonitorElement* > DTDigiForNoiseTask::digiHistos
private

Definition at line 82 of file DTDigiForNoiseTask.h.

edm::EDGetTokenT<DTDigiCollection> DTDigiForNoiseTask::dtDigisToken_
private

Definition at line 80 of file DTDigiForNoiseTask.h.

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

Definition at line 79 of file DTDigiForNoiseTask.h.

int DTDigiForNoiseTask::nevents
private

Definition at line 73 of file DTDigiForNoiseTask.h.

edm::ParameterSet DTDigiForNoiseTask::parameters
private