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

Public Member Functions

 DTTestPulsesTask (const edm::ParameterSet &ps)
 Constructor. More...
 
virtual ~DTTestPulsesTask ()
 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 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::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Private Attributes

DQMStoredbe
 
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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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 37 of file DTTestPulsesTask.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 38 of file DTTestPulsesTask.cc.

References gather_cfg::cout, cppFunctionSkipper::operator, and Parameters::parameters.

38  {
39 
40 
41  cout<<"[DTTestPulseTask]: Constructor"<<endl;
42 
43  parameters = ps;
44 
45 
46  t0sPeakRange = make_pair( parameters.getUntrackedParameter<int>("t0sRangeLowerBound", -100),
47  parameters.getUntrackedParameter<int>("t0sRangeUpperBound", 100));
48 
49 
51 
52 }
T getUntrackedParameter(std::string const &, T const &) const
edm::ParameterSet parameters
std::pair< int, int > t0sPeakRange
tuple cout
Definition: gather_cfg.py:121
DTTestPulsesTask::~DTTestPulsesTask ( )
virtual

Destructor.

Definition at line 54 of file DTTestPulsesTask.cc.

References gather_cfg::cout, and nevents.

54  {
55 
56  cout <<"[DTTestPulsesTask]: analyzed " << nevents << " events" << endl;
57 
58 }
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 186 of file DTTestPulsesTask.cc.

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

186  {
187 
188  nevents++;
189 
191  e.getByLabel("dtunpacker", dtdigis);
192 
194  for (dtLayerId_It=dtdigis->begin(); dtLayerId_It!=dtdigis->end(); ++dtLayerId_It){
195 
196  for (DTDigiCollection::const_iterator digiIt = ((*dtLayerId_It).second).first;
197  digiIt!=((*dtLayerId_It).second).second; ++digiIt){
198 
199  // for clearness..
200  int layerIndex = ((*dtLayerId_It).first).rawId();
201  int chIndex = ((*dtLayerId_It).first).chamberId().rawId();
202 
203 
204  if ((int)(*digiIt).countsTDC() > t0sPeakRange.first &&
205  (int)(*digiIt).countsTDC() < t0sPeakRange.second ) {
206 
207  // Occupancies
208  if (testPulsesOccupancies.find(layerIndex) != testPulsesOccupancies.end())
209  testPulsesOccupancies.find(layerIndex)->second->Fill((*digiIt).wire());
210  else {
211  bookHistos( (*dtLayerId_It).first , string("TPOccupancy"), string("TestPulses") );
212  testPulsesOccupancies.find(layerIndex)->second->Fill((*digiIt).wire());
213  }
214 
215  // Profiles
216  if (testPulsesProfiles.find(layerIndex) != testPulsesProfiles.end())
217  testPulsesProfiles.find(layerIndex)->second->Fill((*digiIt).wire(),(*digiIt).countsTDC());
218  else {
219  bookHistos( (*dtLayerId_It).first , string("TPProfile"), string("TestPulses2D") );
220  testPulsesProfiles.find(layerIndex)->second->Fill((*digiIt).wire(),(*digiIt).countsTDC());
221  }
222  }
223 
224  // Time Box
225  if (testPulsesTimeBoxes.find(chIndex) != testPulsesTimeBoxes.end())
226  testPulsesTimeBoxes.find(chIndex)->second->Fill((*digiIt).countsTDC());
227  else {
228  bookHistos( (*dtLayerId_It).first , string("TPTimeBox"), string("TestPulsesTB") );
229  testPulsesTimeBoxes.find(chIndex)->second->Fill((*digiIt).countsTDC());
230  }
231  }
232  }
233 
234 }
std::map< int, MonitorElement * > testPulsesOccupancies
U second(std::pair< T, U > const &p)
std::pair< int, int > t0sPeakRange
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
void bookHistos(const DTLayerId &dtLayer, std::string folder, std::string histoTag)
Book the ME.
std::vector< DigiType >::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 61 of file DTTestPulsesTask.cc.

References gather_cfg::cout, and nevents.

61  {
62 
63  cout<<"[DTTestPulsesTask]: BeginJob"<<endl;
64 
65  nevents = 0;
66 
67 }
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 69 of file DTTestPulsesTask.cc.

References edm::EventSetup::get().

69  {
70 
71  // Get the geometry
72  context.get<MuonGeometryRecord>().get(muonGeom);
73 
74  // Get the pedestals tTrig (always get it, even if the TPRange is taken from conf)
75  //context.get<DTRangeT0Rcd>().get(t0RangeMap);
76 
77 }
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 79 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().

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

Member Data Documentation

DQMStore* DTTestPulsesTask::dbe
private

Definition at line 66 of file DTTestPulsesTask.h.

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

Definition at line 70 of file DTTestPulsesTask.h.

int DTTestPulsesTask::nevents
private

Definition at line 64 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 74 of file DTTestPulsesTask.h.

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

Definition at line 78 of file DTTestPulsesTask.h.

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

Definition at line 77 of file DTTestPulsesTask.h.

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

Definition at line 79 of file DTTestPulsesTask.h.