CMS 3D CMS Logo

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

#include <DTSegmentsTask.h>

Inheritance diagram for DTSegmentsTask:
edm::EDAnalyzer

Public Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &setup)
 
void beginJob (void)
 book the histos More...
 
 DTSegmentsTask (const edm::ParameterSet &pset)
 Constructor. More...
 
void endJob ()
 Endjob. More...
 
virtual ~DTSegmentsTask ()
 Destructor. More...
 
- Public Member Functions inherited from edm::EDAnalyzer
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 

Private Attributes

bool debug
 
edm::ParameterSet parameters
 
std::vector< MonitorElement * > phiHistos
 
DQMStoretheDbe
 
std::string theRecHits4DLabel
 
std::vector< MonitorElement * > thetaHistos
 

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 &)
 
- Protected Member Functions inherited from edm::EDAnalyzer
CurrentProcessingContext const * currentContext () const
 

Detailed Description

DQM Analysis of 4D DT segments

Date:
2009/12/22 17:44:52
Revision:
1.2
Author
G. Mila - INFN Torino

Definition at line 22 of file DTSegmentsTask.h.

Constructor & Destructor Documentation

DTSegmentsTask::DTSegmentsTask ( const edm::ParameterSet pset)

Constructor.

Definition at line 36 of file DTSegmentsTask.cc.

References debug, edm::ParameterSet::getUntrackedParameter(), cppFunctionSkipper::operator, and Parameters::parameters.

36  {
37 
38  debug = pset.getUntrackedParameter<bool>("debug",false);
39 
40  // Get the DQM needed services
42  theDbe->setVerbose(1);
43 
44  parameters = pset;
45 
46 }
T getUntrackedParameter(std::string const &, T const &) const
void setVerbose(unsigned level)
Definition: DQMStore.cc:393
edm::ParameterSet parameters
DQMStore * theDbe
DTSegmentsTask::~DTSegmentsTask ( )
virtual

Destructor.

Definition at line 49 of file DTSegmentsTask.cc.

49  {
50 }

Member Function Documentation

void DTSegmentsTask::analyze ( const edm::Event event,
const edm::EventSetup setup 
)
virtual

Implements edm::EDAnalyzer.

Definition at line 129 of file DTSegmentsTask.cc.

References gather_cfg::cout, debug, edm::EventSetup::get(), Parameters::parameters, findQualityFiles::size, DTRecSegment2D::specificRecHits(), and crabStatusFromReport::statusMap.

129  {
130 
131 // if(!(event.id().event()%1000) && debug)
132 // {
133 // cout << "[DTSegmentsTask] Analyze #Run: " << event.id().run()
134 // << " #Event: " << event.id().event() << endl;
135 // }
136 
137 
138  // Get the map of noisy channels
139  bool checkNoisyChannels = parameters.getUntrackedParameter<bool>("checkNoisyChannels",false);
141  if(checkNoisyChannels) {
142  setup.get<DTStatusFlagRcd>().get(statusMap);
143  }
144 
145  // Get the 4D segment collection from the event
147  event.getByLabel(theRecHits4DLabel, all4DSegments);
148 
149  // Loop over all chambers containing a segment
151  for (chamberId = all4DSegments->id_begin();
152  chamberId != all4DSegments->id_end();
153  ++chamberId){
154  // Get the range for the corresponding ChamerId
155  DTRecSegment4DCollection::range range = all4DSegments->get(*chamberId);
156  int nsegm = distance(range.first, range.second);
157  if(debug)
158  cout << " Chamber: " << *chamberId << " has " << nsegm
159  << " 4D segments" << endl;
160 
161 
162  // Loop over the rechits of this ChamerId
163  for (DTRecSegment4DCollection::const_iterator segment4D = range.first;
164  segment4D!=range.second;
165  ++segment4D){
166 
167  //FOR NOISY CHANNELS////////////////////////////////
168  bool segmNoisy = false;
169  if((*segment4D).hasPhi()){
170  const DTChamberRecSegment2D* phiSeg = (*segment4D).phiSegment();
171  vector<DTRecHit1D> phiHits = phiSeg->specificRecHits();
172  map<DTSuperLayerId,vector<DTRecHit1D> > hitsBySLMap;
173  for(vector<DTRecHit1D>::const_iterator hit = phiHits.begin();
174  hit != phiHits.end(); ++hit) {
175  DTWireId wireId = (*hit).wireId();
176 
177  // Check for noisy channels to skip them
178  if(checkNoisyChannels) {
179  bool isNoisy = false;
180  bool isFEMasked = false;
181  bool isTDCMasked = false;
182  bool isTrigMask = false;
183  bool isDead = false;
184  bool isNohv = false;
185  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
186  if(isNoisy) {
187  if(debug)
188  cout << "Wire: " << wireId << " is noisy, skipping!" << endl;
189  segmNoisy = true;
190  }
191  }
192  }
193  }
194 
195  if((*segment4D).hasZed()) {
196  const DTSLRecSegment2D* zSeg = (*segment4D).zSegment(); // zSeg lives in the SL RF
197  // Check for noisy channels to skip them
198  vector<DTRecHit1D> zHits = zSeg->specificRecHits();
199  for(vector<DTRecHit1D>::const_iterator hit = zHits.begin();
200  hit != zHits.end(); ++hit) {
201  DTWireId wireId = (*hit).wireId();
202  if(checkNoisyChannels) {
203  bool isNoisy = false;
204  bool isFEMasked = false;
205  bool isTDCMasked = false;
206  bool isTrigMask = false;
207  bool isDead = false;
208  bool isNohv = false;
209  //cout<<"wire id "<<wireId<<endl;
210  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
211  if(isNoisy) {
212  if(debug)
213  cout << "Wire: " << wireId << " is noisy, skipping!" << endl;
214  segmNoisy = true;
215  }
216  }
217  }
218  }
219 
220  if (segmNoisy) {
221  if(debug)
222  cout<<"skipping the segment: it contains noisy cells"<<endl;
223  continue;
224  }
225  //END FOR NOISY CHANNELS////////////////////////////////
226 
227  // Fill the histos
228  int nHits=0;
229  if((*segment4D).hasPhi()){
230  nHits = (((*segment4D).phiSegment())->specificRecHits()).size();
231  if(debug)
232  cout<<"Phi segment with number of hits: "<<nHits<<endl;
233  phiHistos[0]->Fill((*chamberId).wheel(), nHits);
234  phiHistos[1]->Fill((*chamberId).sector(), nHits);
235  phiHistos[2]->Fill((*chamberId).station(), nHits);
236  }
237  if((*segment4D).hasZed()) {
238  nHits = (((*segment4D).zSegment())->specificRecHits()).size();
239  if(debug)
240  cout<<"Zed segment with number of hits: "<<nHits<<endl;
241  thetaHistos[0]->Fill((*chamberId).wheel(), nHits);
242  thetaHistos[1]->Fill((*chamberId).sector(), nHits);
243  thetaHistos[2]->Fill((*chamberId).station(), nHits);
244  }
245 
246  } //loop over segments
247  } // loop over chambers
248 
249 }
T getUntrackedParameter(std::string const &, T const &) const
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:52
identifier iterator
Definition: RangeMap.h:138
std::vector< MonitorElement * > thetaHistos
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:45
std::vector< MonitorElement * > phiHistos
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
const T & get() const
Definition: EventSetup.h:55
edm::ParameterSet parameters
tuple cout
Definition: gather_cfg.py:121
tuple size
Write out results.
std::string theRecHits4DLabel
void DTSegmentsTask::beginJob ( void  )
virtual

book the histos

Reimplemented from edm::EDAnalyzer.

Definition at line 53 of file DTSegmentsTask.cc.

References Parameters::parameters.

53  {
54 
55  // the name of the 4D rec hits collection
56  theRecHits4DLabel = parameters.getParameter<string>("recHits4DLabel");
57 
58  theDbe->setCurrentFolder("Muons/DTSegmentsMonitor");
59 
60  // histos for phi segments
61  phiHistos.push_back(theDbe->book2D("phiSegments_numHitsVsWheel", "phiSegments_numHitsVsWheel", 5, -2.5, 2.5, 20, 0, 20));
62  phiHistos[0]->setBinLabel(1,"W-2",1);
63  phiHistos[0]->setBinLabel(2,"W-1",1);
64  phiHistos[0]->setBinLabel(3,"W0",1);
65  phiHistos[0]->setBinLabel(4,"W1",1);
66  phiHistos[0]->setBinLabel(5,"W2",1);
67  phiHistos.push_back(theDbe->book2D("phiSegments_numHitsVsSector", "phiSegments_numHitsVsSector", 14, 0.5, 14.5, 20, 0, 20));
68  phiHistos[1]->setBinLabel(1,"Sec1",1);
69  phiHistos[1]->setBinLabel(2,"Sec2",1);
70  phiHistos[1]->setBinLabel(3,"Sec3",1);
71  phiHistos[1]->setBinLabel(4,"Sec4",1);
72  phiHistos[1]->setBinLabel(5,"Sec5",1);
73  phiHistos[1]->setBinLabel(6,"Sec6",1);
74  phiHistos[1]->setBinLabel(7,"Sec7",1);
75  phiHistos[1]->setBinLabel(8,"Sec8",1);
76  phiHistos[1]->setBinLabel(9,"Sec9",1);
77  phiHistos[1]->setBinLabel(10,"Sec10",1);
78  phiHistos[1]->setBinLabel(11,"Sec11",1);
79  phiHistos[1]->setBinLabel(12,"Sec12",1);
80  phiHistos[1]->setBinLabel(13,"Sec13",1);
81  phiHistos[1]->setBinLabel(14,"Sec14",1);
82  phiHistos.push_back(theDbe->book2D("phiSegments_numHitsVsStation", "phiSegments_numHitsVsStation", 4, 0.5, 4.5, 20, 0, 20));
83  phiHistos[2]->setBinLabel(1,"St1",1);
84  phiHistos[2]->setBinLabel(2,"St2",1);
85  phiHistos[2]->setBinLabel(3,"St3",1);
86  phiHistos[2]->setBinLabel(4,"St4",1);
87 
88  // histos for theta segments
89  thetaHistos.push_back(theDbe->book2D("thetaSegments_numHitsVsWheel", "thetaSegments_numHitsVsWheel", 5, -2.5, 2.5, 20, 0, 20));
90  thetaHistos[0]->setBinLabel(1,"W-2",1);
91  thetaHistos[0]->setBinLabel(2,"W-1",1);
92  thetaHistos[0]->setBinLabel(3,"W0",1);
93  thetaHistos[0]->setBinLabel(4,"W1",1);
94  thetaHistos[0]->setBinLabel(5,"W2",1);
95  thetaHistos.push_back(theDbe->book2D("thetaSegments_numHitsVsSector", "thetaSegments_numHitsVsSector", 14, 0.5, 14.5, 20, 0, 20));
96  thetaHistos[1]->setBinLabel(1,"Sec1",1);
97  thetaHistos[1]->setBinLabel(2,"Sec2",1);
98  thetaHistos[1]->setBinLabel(3,"Sec3",1);
99  thetaHistos[1]->setBinLabel(4,"Sec4",1);
100  thetaHistos[1]->setBinLabel(5,"Sec5",1);
101  thetaHistos[1]->setBinLabel(6,"Sec6",1);
102  thetaHistos[1]->setBinLabel(7,"Sec7",1);
103  thetaHistos[1]->setBinLabel(8,"Sec8",1);
104  thetaHistos[1]->setBinLabel(9,"Sec9",1);
105  thetaHistos[1]->setBinLabel(10,"Sec10",1);
106  thetaHistos[1]->setBinLabel(11,"Sec11",1);
107  thetaHistos[1]->setBinLabel(12,"Sec12",1);
108  thetaHistos[1]->setBinLabel(13,"Sec13",1);
109  thetaHistos[1]->setBinLabel(14,"Sec14",1);
110  thetaHistos.push_back(theDbe->book2D("thetaSegments_numHitsVsStation", "thetaSegments_numHitsVsStation", 4, 0.5, 4.5, 20, 0, 20));
111  thetaHistos[2]->setBinLabel(1,"St1",1);
112  thetaHistos[2]->setBinLabel(2,"St2",1);
113  thetaHistos[2]->setBinLabel(3,"St3",1);
114  thetaHistos[2]->setBinLabel(4,"St4",1);
115 
116 }
T getParameter(std::string const &) const
std::vector< MonitorElement * > thetaHistos
std::vector< MonitorElement * > phiHistos
edm::ParameterSet parameters
DQMStore * theDbe
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:845
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:429
std::string theRecHits4DLabel
void DTSegmentsTask::endJob ( void  )
virtual

Endjob.

Reimplemented from edm::EDAnalyzer.

Definition at line 119 of file DTSegmentsTask.cc.

References dumpDBToFile_GT_ttrig_cfg::outputFileName, and Parameters::parameters.

119  {
120  bool outputMEsInRootFile = parameters.getParameter<bool>("OutputMEsInRootFile");
121  std::string outputFileName = parameters.getParameter<std::string>("OutputFileName");
122  if(outputMEsInRootFile){
123  theDbe->save(outputFileName);
124  }
125 
126  theDbe->rmdir("DT/DTSegmentsTask");
127 }
T getParameter(std::string const &) const
void rmdir(const std::string &fullpath)
Definition: DQMStore.cc:2530
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2113
edm::ParameterSet parameters
DQMStore * theDbe

Member Data Documentation

bool DTSegmentsTask::debug
private

Definition at line 47 of file DTSegmentsTask.h.

edm::ParameterSet DTSegmentsTask::parameters
private
std::vector<MonitorElement*> DTSegmentsTask::phiHistos
private

Definition at line 55 of file DTSegmentsTask.h.

DQMStore* DTSegmentsTask::theDbe
private

Definition at line 44 of file DTSegmentsTask.h.

std::string DTSegmentsTask::theRecHits4DLabel
private

Definition at line 50 of file DTSegmentsTask.h.

std::vector<MonitorElement*> DTSegmentsTask::thetaHistos
private

Definition at line 56 of file DTSegmentsTask.h.