CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
DTSegmentsTask Class Reference

#include <DTSegmentsTask.h>

Inheritance diagram for DTSegmentsTask:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 book the histos More...
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
 DTSegmentsTask (const edm::ParameterSet &pset)
 Constructor. More...
 
 ~DTSegmentsTask () override
 Destructor. More...
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Private Attributes

bool checkNoisyChannels
 
bool debug
 
edm::ParameterSet parameters
 
std::vector< MonitorElement * > phiHistos
 
edm::EDGetTokenT< DTRecSegment4DCollectiontheRecHits4DLabel_
 
std::vector< MonitorElement * > thetaHistos
 

Detailed Description

DQM Analysis of 4D DT segments

Author
G. Mila - INFN Torino

Definition at line 26 of file DTSegmentsTask.h.

Constructor & Destructor Documentation

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

Constructor.

Definition at line 28 of file DTSegmentsTask.cc.

References debug, edm::ParameterSet::getUntrackedParameter(), muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

28  {
29 
30  debug = pset.getUntrackedParameter<bool>("debug",false);
31  parameters = pset;
32 
33  // should be init from pset, but it was commented out...
34  // better false than undefined
35  checkNoisyChannels = false;
36 
37  // the name of the 4D rec hits collection
38  theRecHits4DLabel_ = consumes<DTRecSegment4DCollection>(parameters.getParameter<std::string>("recHits4DLabel"));
39 }
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< DTRecSegment4DCollection > theRecHits4DLabel_
DTSegmentsTask::~DTSegmentsTask ( )
override

Destructor.

Definition at line 42 of file DTSegmentsTask.cc.

42  {
43 }

Member Function Documentation

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

book the histos

Definition at line 110 of file DTSegmentsTask.cc.

References DTStatusFlag::cellStatus(), gather_cfg::cout, debug, SoftLeptonByDistance_cfi::distance, edm::EventSetup::get(), findQualityFiles::size, and DTRecSegment2D::specificRecHits().

110  {
111 
112  // Get the map of noisy channels
113  // bool checkNoisyChannels = parameters.getUntrackedParameter<bool>("checkNoisyChannels",false);
114  ESHandle<DTStatusFlag> statusMap;
115  if(checkNoisyChannels) {
116  setup.get<DTStatusFlagRcd>().get(statusMap);
117  }
118 
119  // Get the 4D segment collection from the event
121  event.getByToken(theRecHits4DLabel_, all4DSegments);
122 
123  // Loop over all chambers containing a segment
125  for (chamberId = all4DSegments->id_begin(); chamberId != all4DSegments->id_end(); ++chamberId){
126  // Get the range for the corresponding ChamerId
127  DTRecSegment4DCollection::range range = all4DSegments->get(*chamberId);
128  int nsegm = distance(range.first, range.second);
129  if(debug)
130  cout << " Chamber: " << *chamberId << " has " << nsegm
131  << " 4D segments" << endl;
132 
133  // Loop over the rechits of this ChamerId
134  for (DTRecSegment4DCollection::const_iterator segment4D = range.first; segment4D!=range.second; ++segment4D){
135 
136  //FOR NOISY CHANNELS////////////////////////////////
137  bool segmNoisy = false;
138  if((*segment4D).hasPhi()){
139  const DTChamberRecSegment2D* phiSeg = (*segment4D).phiSegment();
140  vector<DTRecHit1D> phiHits = phiSeg->specificRecHits();
141  map<DTSuperLayerId,vector<DTRecHit1D> > hitsBySLMap;
142  for(vector<DTRecHit1D>::const_iterator hit = phiHits.begin(); hit != phiHits.end(); ++hit) {
143  DTWireId wireId = (*hit).wireId();
144 
145  // Check for noisy channels to skip them
146  if(checkNoisyChannels) {
147  bool isNoisy = false;
148  bool isFEMasked = false;
149  bool isTDCMasked = false;
150  bool isTrigMask = false;
151  bool isDead = false;
152  bool isNohv = false;
153  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
154  if(isNoisy) {
155  if(debug)
156  cout << "Wire: " << wireId << " is noisy, skipping!" << endl;
157  segmNoisy = true;
158  }
159  }
160  }
161  }
162 
163  if((*segment4D).hasZed()) {
164  const DTSLRecSegment2D* zSeg = (*segment4D).zSegment(); // zSeg lives in the SL RF
165  // Check for noisy channels to skip them
166  vector<DTRecHit1D> zHits = zSeg->specificRecHits();
167  for(vector<DTRecHit1D>::const_iterator hit = zHits.begin();
168  hit != zHits.end(); ++hit) {
169  DTWireId wireId = (*hit).wireId();
170  if(checkNoisyChannels) {
171  bool isNoisy = false;
172  bool isFEMasked = false;
173  bool isTDCMasked = false;
174  bool isTrigMask = false;
175  bool isDead = false;
176  bool isNohv = false;
177  //cout<<"wire id "<<wireId<<endl;
178  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
179  if(isNoisy) {
180  if(debug)
181  cout << "Wire: " << wireId << " is noisy, skipping!" << endl;
182  segmNoisy = true;
183  }
184  }
185  }
186  }
187 
188  if (segmNoisy) {
189  if(debug)
190  cout<<"skipping the segment: it contains noisy cells"<<endl;
191  continue;
192  }
193  //END FOR NOISY CHANNELS////////////////////////////////
194 
195  // Fill the histos
196  int nHits=0;
197  if((*segment4D).hasPhi()){
198  nHits = (((*segment4D).phiSegment())->specificRecHits()).size();
199  if(debug)
200  cout<<"Phi segment with number of hits: "<<nHits<<endl;
201  phiHistos[0]->Fill((*chamberId).wheel(), nHits);
202  phiHistos[1]->Fill((*chamberId).sector(), nHits);
203  phiHistos[2]->Fill((*chamberId).station(), nHits);
204  }
205  if((*segment4D).hasZed()) {
206  nHits = (((*segment4D).zSegment())->specificRecHits()).size();
207  if(debug)
208  cout<<"Zed segment with number of hits: "<<nHits<<endl;
209  thetaHistos[0]->Fill((*chamberId).wheel(), nHits);
210  thetaHistos[1]->Fill((*chamberId).sector(), nHits);
211  thetaHistos[2]->Fill((*chamberId).station(), nHits);
212  }
213 
214  } //loop over segments
215  } // loop over chambers
216 }
size
Write out results.
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
identifier iterator
Definition: RangeMap.h:135
edm::EDGetTokenT< DTRecSegment4DCollection > theRecHits4DLabel_
std::vector< MonitorElement * > thetaHistos
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
std::vector< MonitorElement * > phiHistos
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
int cellStatus(int wheelId, int stationId, int sectorId, int slId, int layerId, int cellId, bool &noiseFlag, bool &feMask, bool &tdcMask, bool &trigMask, bool &deadFlag, bool &nohvFlag) const
get content
Definition: DTStatusFlag.h:100
T get() const
Definition: EventSetup.h:71
void DTSegmentsTask::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
override

Definition at line 45 of file DTSegmentsTask.cc.

References DQMStore::IBooker::book2D(), DQMStore::IBooker::cd(), and DQMStore::IBooker::setCurrentFolder().

47  {
48 
49  ibooker.cd();
50  ibooker.setCurrentFolder("Muons/DTSegmentsMonitor");
51 
52  // histos for phi segments
53  phiHistos.push_back(ibooker.book2D("phiSegments_numHitsVsWheel", "phiSegments_numHitsVsWheel", 5, -2.5, 2.5, 20, 0, 20));
54  phiHistos[0]->setBinLabel(1,"W-2",1);
55  phiHistos[0]->setBinLabel(2,"W-1",1);
56  phiHistos[0]->setBinLabel(3,"W0",1);
57  phiHistos[0]->setBinLabel(4,"W1",1);
58  phiHistos[0]->setBinLabel(5,"W2",1);
59  phiHistos.push_back(ibooker.book2D("phiSegments_numHitsVsSector", "phiSegments_numHitsVsSector", 14, 0.5, 14.5, 20, 0, 20));
60  phiHistos[1]->setBinLabel(1,"Sec1",1);
61  phiHistos[1]->setBinLabel(2,"Sec2",1);
62  phiHistos[1]->setBinLabel(3,"Sec3",1);
63  phiHistos[1]->setBinLabel(4,"Sec4",1);
64  phiHistos[1]->setBinLabel(5,"Sec5",1);
65  phiHistos[1]->setBinLabel(6,"Sec6",1);
66  phiHistos[1]->setBinLabel(7,"Sec7",1);
67  phiHistos[1]->setBinLabel(8,"Sec8",1);
68  phiHistos[1]->setBinLabel(9,"Sec9",1);
69  phiHistos[1]->setBinLabel(10,"Sec10",1);
70  phiHistos[1]->setBinLabel(11,"Sec11",1);
71  phiHistos[1]->setBinLabel(12,"Sec12",1);
72  phiHistos[1]->setBinLabel(13,"Sec13",1);
73  phiHistos[1]->setBinLabel(14,"Sec14",1);
74  phiHistos.push_back(ibooker.book2D("phiSegments_numHitsVsStation", "phiSegments_numHitsVsStation", 4, 0.5, 4.5, 20, 0, 20));
75  phiHistos[2]->setBinLabel(1,"St1",1);
76  phiHistos[2]->setBinLabel(2,"St2",1);
77  phiHistos[2]->setBinLabel(3,"St3",1);
78  phiHistos[2]->setBinLabel(4,"St4",1);
79 
80  // histos for theta segments
81  thetaHistos.push_back(ibooker.book2D("thetaSegments_numHitsVsWheel", "thetaSegments_numHitsVsWheel", 5, -2.5, 2.5, 20, 0, 20));
82  thetaHistos[0]->setBinLabel(1,"W-2",1);
83  thetaHistos[0]->setBinLabel(2,"W-1",1);
84  thetaHistos[0]->setBinLabel(3,"W0",1);
85  thetaHistos[0]->setBinLabel(4,"W1",1);
86  thetaHistos[0]->setBinLabel(5,"W2",1);
87  thetaHistos.push_back(ibooker.book2D("thetaSegments_numHitsVsSector", "thetaSegments_numHitsVsSector", 14, 0.5, 14.5, 20, 0, 20));
88  thetaHistos[1]->setBinLabel(1,"Sec1",1);
89  thetaHistos[1]->setBinLabel(2,"Sec2",1);
90  thetaHistos[1]->setBinLabel(3,"Sec3",1);
91  thetaHistos[1]->setBinLabel(4,"Sec4",1);
92  thetaHistos[1]->setBinLabel(5,"Sec5",1);
93  thetaHistos[1]->setBinLabel(6,"Sec6",1);
94  thetaHistos[1]->setBinLabel(7,"Sec7",1);
95  thetaHistos[1]->setBinLabel(8,"Sec8",1);
96  thetaHistos[1]->setBinLabel(9,"Sec9",1);
97  thetaHistos[1]->setBinLabel(10,"Sec10",1);
98  thetaHistos[1]->setBinLabel(11,"Sec11",1);
99  thetaHistos[1]->setBinLabel(12,"Sec12",1);
100  thetaHistos[1]->setBinLabel(13,"Sec13",1);
101  thetaHistos[1]->setBinLabel(14,"Sec14",1);
102  thetaHistos.push_back(ibooker.book2D("thetaSegments_numHitsVsStation", "thetaSegments_numHitsVsStation", 4, 0.5, 4.5, 20, 0, 20));
103  thetaHistos[2]->setBinLabel(1,"St1",1);
104  thetaHistos[2]->setBinLabel(2,"St2",1);
105  thetaHistos[2]->setBinLabel(3,"St3",1);
106  thetaHistos[2]->setBinLabel(4,"St4",1);
107 
108 }
std::vector< MonitorElement * > thetaHistos
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
std::vector< MonitorElement * > phiHistos
MonitorElement * book2D(Args &&...args)
Definition: DQMStore.h:109

Member Data Documentation

bool DTSegmentsTask::checkNoisyChannels
private

Definition at line 46 of file DTSegmentsTask.h.

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

Definition at line 50 of file DTSegmentsTask.h.

edm::EDGetTokenT<DTRecSegment4DCollection> DTSegmentsTask::theRecHits4DLabel_
private

Definition at line 54 of file DTSegmentsTask.h.

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

Definition at line 51 of file DTSegmentsTask.h.