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
DTTestPulsesTask Class Reference

#include <DTTestPulsesTask.h>

Inheritance diagram for DTTestPulsesTask:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 DTTestPulsesTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTTestPulsesTask ()
 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 beginRun (const edm::Run &, const edm::EventSetup &)
 BeginRun. More...
 
void bookHistos (const DTLayerId &dtLayer, std::string folder, std::string histoTag)
 Book the ME. 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
 
edm::EDGetTokenT
< DTDigiCollection
dtDigisToken_
 
edm::ESHandle< DTGeometrymuonGeom
 
int nevents
 
edm::ParameterSet parameters
 
edm::ESHandle< DTRangeT0t0RangeMap
 
std::pair< int, int > t0sPeakRange
 
std::map< int, MonitorElement * > testPulsesOccupancies
 
std::map< int, MonitorElement * > testPulsesProfiles
 
std::map< int, MonitorElement * > testPulsesTimeBoxes
 

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 38 of file DTTestPulsesTask.h.

Constructor & Destructor Documentation

DTTestPulsesTask::DTTestPulsesTask ( const edm::ParameterSet ps)

Constructor.

Definition at line 34 of file DTTestPulsesTask.cc.

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

34  {
35 
36 
37  cout<<"[DTTestPulseTask]: Constructor"<<endl;
38  dtDigisToken_ = consumes<DTDigiCollection>(
39  edm::InputTag(ps.getUntrackedParameter<std::string>("dtdigis", "dtunpacker")));
40 
41  parameters = ps;
42 
43 
44  t0sPeakRange = make_pair( parameters.getUntrackedParameter<int>("t0sRangeLowerBound", -100),
45  parameters.getUntrackedParameter<int>("t0sRangeUpperBound", 100));
46 
47 
49 
50 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DTDigiCollection > dtDigisToken_
edm::ParameterSet parameters
std::pair< int, int > t0sPeakRange
tuple cout
Definition: gather_cfg.py:121
DTTestPulsesTask::~DTTestPulsesTask ( )
virtual

Destructor.

Definition at line 52 of file DTTestPulsesTask.cc.

References gather_cfg::cout, and nevents.

52  {
53 
54  cout <<"[DTTestPulsesTask]: analyzed " << nevents << " events" << endl;
55 
56 }
tuple cout
Definition: gather_cfg.py:121

Member Function Documentation

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

Analyze.

Implements edm::EDAnalyzer.

Definition at line 184 of file DTTestPulsesTask.cc.

References bookHistos(), edm::Event::getByToken(), nevents, and edm::second().

184  {
185 
186  nevents++;
187 
189  e.getByToken(dtDigisToken_, dtdigis);
190 
192  for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
193 
194  for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
195  digiIt!=((*dtLayerId_It).second).second; ++digiIt){
196 
197  // for clearness..
198  int layerIndex = ((*dtLayerId_It).first).rawId();
199  int chIndex = ((*dtLayerId_It).first).chamberId().rawId();
200 
201 
202  if ((int)(*digiIt).countsTDC() > t0sPeakRange.first &&
203  (int)(*digiIt).countsTDC() < t0sPeakRange.second ) {
204 
205  // Occupancies
206  if (testPulsesOccupancies.find(layerIndex) != testPulsesOccupancies.end())
207  testPulsesOccupancies.find(layerIndex)->second->Fill((*digiIt).wire());
208  else {
209  bookHistos( (*dtLayerId_It).first , string("TPOccupancy"), string("TestPulses") );
210  testPulsesOccupancies.find(layerIndex)->second->Fill((*digiIt).wire());
211  }
212 
213  // Profiles
214  if (testPulsesProfiles.find(layerIndex) != testPulsesProfiles.end())
215  testPulsesProfiles.find(layerIndex)->second->Fill((*digiIt).wire(),(*digiIt).countsTDC());
216  else {
217  bookHistos( (*dtLayerId_It).first , string("TPProfile"), string("TestPulses2D") );
218  testPulsesProfiles.find(layerIndex)->second->Fill((*digiIt).wire(),(*digiIt).countsTDC());
219  }
220  }
221 
222  // Time Box
223  if (testPulsesTimeBoxes.find(chIndex) != testPulsesTimeBoxes.end())
224  testPulsesTimeBoxes.find(chIndex)->second->Fill((*digiIt).countsTDC());
225  else {
226  bookHistos( (*dtLayerId_It).first , string("TPTimeBox"), string("TestPulsesTB") );
227  testPulsesTimeBoxes.find(chIndex)->second->Fill((*digiIt).countsTDC());
228  }
229  }
230  }
231 
232 }
std::map< int, MonitorElement * > testPulsesOccupancies
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< DTDigiCollection > dtDigisToken_
U second(std::pair< T, U > const &p)
std::pair< int, int > t0sPeakRange
void bookHistos(const DTLayerId &dtLayer, std::string folder, std::string histoTag)
Book the ME.
std::vector< DTDigi >::const_iterator const_iterator
std::map< int, MonitorElement * > testPulsesTimeBoxes
std::map< int, MonitorElement * > testPulsesProfiles
void DTTestPulsesTask::beginJob ( void  )
protectedvirtual

BeginJob.

Reimplemented from edm::EDAnalyzer.

Definition at line 59 of file DTTestPulsesTask.cc.

References gather_cfg::cout, and nevents.

59  {
60 
61  cout<<"[DTTestPulsesTask]: BeginJob"<<endl;
62 
63  nevents = 0;
64 
65 }
tuple cout
Definition: gather_cfg.py:121
void DTTestPulsesTask::beginRun ( const edm::Run run,
const edm::EventSetup context 
)
protectedvirtual

BeginRun.

Reimplemented from edm::EDAnalyzer.

Definition at line 67 of file DTTestPulsesTask.cc.

References edm::EventSetup::get().

67  {
68 
69  // Get the geometry
70  context.get<MuonGeometryRecord>().get(muonGeom);
71 
72  // Get the pedestals tTrig (always get it, even if the TPRange is taken from conf)
73  //context.get<DTRangeT0Rcd>().get(t0RangeMap);
74 
75 }
edm::ESHandle< DTGeometry > muonGeom
const T & get() const
Definition: EventSetup.h:55
void DTTestPulsesTask::bookHistos ( const DTLayerId dtLayer,
std::string  folder,
std::string  histoTag 
)
protected

Book the ME.

Definition at line 77 of file DTTestPulsesTask.cc.

References gather_cfg::cout, DTLayerId, DTLayerId::layer(), Parameters::parameters, DTChamberId::sector(), DTChamberId::station(), relativeConstraints::station, DTSuperLayerId::superlayer(), DTLayerId::superlayerId(), and DTChamberId::wheel().

77  {
78 
79 
80  stringstream wheel; wheel << dtLayer.wheel();
81  stringstream station; station << dtLayer.station();
82  stringstream sector; sector << dtLayer.sector();
83  stringstream superLayer; superLayer << dtLayer.superlayer();
84  stringstream layer; layer << dtLayer.layer();
85 
86  cout<<"[DTTestPulseTask]: booking"<<endl;
87 
88  // TP Profiles
89  if ( folder == "TPProfile" ) {
90 
91  const int nWires = muonGeom->layer(DTLayerId(dtLayer.wheel(),
92  dtLayer.station(),
93  dtLayer.sector(),
94  dtLayer.superlayer(),
95  dtLayer.layer()))->specificTopology().channels();
96 
97  dbe->setCurrentFolder("DT/DTTestPulsesTask/Wheel" + wheel.str() +
98  "/Station" + station.str() +
99  "/Sector" + sector.str() +
100  "/SuperLayer" + superLayer.str() +
101  "/" +folder);
102 
103  string histoName = histoTag
104  + "_W" + wheel.str()
105  + "_St" + station.str()
106  + "_Sec" + sector.str()
107  + "_SL" + superLayer.str()
108  + "_L" + layer.str();
109 
110  // Setting the range
111  if ( parameters.getUntrackedParameter<bool>("readDB", false) ) {
112  t0RangeMap->slRangeT0( dtLayer.superlayerId() , t0sPeakRange.first, t0sPeakRange.second);
113  }
114 
115 
116  cout<<"t0sRangeLowerBound "<<t0sPeakRange.first<<"; "
117  <<"t0sRangeUpperBound "<<t0sPeakRange.second<<endl;
118 
119 
120  testPulsesProfiles[int(DTLayerId(dtLayer.wheel(),
121  dtLayer.station(),
122  dtLayer.sector(),
123  dtLayer.superlayer(),
124  dtLayer.layer()).rawId())] =
125  dbe->bookProfile(histoName,histoName,
126  nWires, 0, nWires, // Xaxis: channels
127  t0sPeakRange.first - t0sPeakRange.second, t0sPeakRange.first, t0sPeakRange.second); // Yaxis: times
128  }
129 
130  // TP Occupancies
131  else if ( folder == "TPOccupancy" ) {
132 
133  dbe->setCurrentFolder("DT/DTTestPulsesTask/Wheel" + wheel.str() +
134  "/Station" + station.str() +
135  "/Sector" + sector.str() +
136  "/SuperLayer" + superLayer.str() +
137  "/" +folder);
138 
139  string histoName = histoTag
140  + "_W" + wheel.str()
141  + "_St" + station.str()
142  + "_Sec" + sector.str()
143  + "_SL" + superLayer.str()
144  + "_L" + layer.str();
145 
146  const int nWires = muonGeom->layer(DTLayerId(dtLayer.wheel(),
147  dtLayer.station(),
148  dtLayer.sector(),
149  dtLayer.superlayer(),
150  dtLayer.layer()))->specificTopology().channels();
151 
152  testPulsesOccupancies[int(DTLayerId(dtLayer.wheel(),
153  dtLayer.station(),
154  dtLayer.sector(),
155  dtLayer.superlayer(),
156  dtLayer.layer()).rawId())] =
157  dbe->book1D(histoName, histoName, nWires, 0, nWires);
158  }
159 
160  // Time Box per Chamber
161  else if ( folder == "TPTimeBox" ) {
162 
163  dbe->setCurrentFolder("DT/DTTestPulsesTask/Wheel" + wheel.str() +
164  "/Station" + station.str() +
165  "/Sector" + sector.str() +
166  "/" +folder);
167 
168  string histoName = histoTag
169  + "_W" + wheel.str()
170  + "_St" + station.str()
171  + "_Sec" + sector.str();
172 
173  testPulsesTimeBoxes[int( DTLayerId(dtLayer.wheel(),
174  dtLayer.station(),
175  dtLayer.sector(),
176  dtLayer.superlayer(),
177  dtLayer.layer()).chamberId().rawId())] =
178  dbe->book1D(histoName, histoName, 10000, 0, 10000); // Overview of the TP (and noise) times
179  }
180 
181 }
T getUntrackedParameter(std::string const &, T const &) const
std::map< int, MonitorElement * > testPulsesOccupancies
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:954
edm::ESHandle< DTRangeT0 > t0RangeMap
int layer() const
Return the layer number.
Definition: DTLayerId.h:53
DTSuperLayerId superlayerId() const
Return the corresponding SuperLayerId.
Definition: DTLayerId.h:59
edm::ESHandle< DTGeometry > muonGeom
edm::ParameterSet parameters
std::pair< int, int > t0sPeakRange
MonitorElement * bookProfile(const char *name, const char *title, int nchX, double lowX, double highX, int nchY, double lowY, double highY, const char *option="s")
Definition: DQMStore.cc:1268
int superlayer() const
Return the superlayer number (deprecated method name)
std::map< int, MonitorElement * > testPulsesTimeBoxes
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
std::map< int, MonitorElement * > testPulsesProfiles
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:667

Member Data Documentation

DQMStore* DTTestPulsesTask::dbe
private

Definition at line 67 of file DTTestPulsesTask.h.

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

Definition at line 74 of file DTTestPulsesTask.h.

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

Definition at line 71 of file DTTestPulsesTask.h.

int DTTestPulsesTask::nevents
private

Definition at line 65 of file DTTestPulsesTask.h.

edm::ParameterSet DTTestPulsesTask::parameters
private
edm::ESHandle<DTRangeT0> DTTestPulsesTask::t0RangeMap
private

Definition at line 72 of file DTTestPulsesTask.h.

std::pair<int, int> DTTestPulsesTask::t0sPeakRange
private

Definition at line 75 of file DTTestPulsesTask.h.

std::map<int, MonitorElement*> DTTestPulsesTask::testPulsesOccupancies
private

Definition at line 79 of file DTTestPulsesTask.h.

std::map<int, MonitorElement*> DTTestPulsesTask::testPulsesProfiles
private

Definition at line 78 of file DTTestPulsesTask.h.

std::map<int, MonitorElement*> DTTestPulsesTask::testPulsesTimeBoxes
private

Definition at line 80 of file DTTestPulsesTask.h.