CMS 3D CMS Logo

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

#include <DTSegmentsTask.h>

Inheritance diagram for DTSegmentsTask:
DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

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 DQMEDAnalyzer
void accumulate (edm::Event const &event, edm::EventSetup const &setup) final
 
void beginLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
void beginStream (edm::StreamID id) final
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
 DQMEDAnalyzer ()
 
void endLuminosityBlock (edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) final
 
void endRun (edm::Run const &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Attributes

bool checkNoisyChannels
 
bool debug
 
edm::ParameterSet parameters
 
std::vector< MonitorElement * > phiHistos
 
const edm::ESGetToken< DTStatusFlag, DTStatusFlagRcdstatusMapToken_
 
edm::EDGetTokenT< DTRecSegment4DCollectiontheRecHits4DLabel_
 
std::vector< MonitorElement * > thetaHistos
 

Additional Inherited Members

- Public Types inherited from DQMEDAnalyzer
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Static Public Member Functions inherited from DQMEDAnalyzer
static void globalEndJob (DQMEDAnalyzerGlobalCache const *)
 
static void globalEndLuminosityBlockProduce (edm::LuminosityBlock &lumi, edm::EventSetup const &setup, LuminosityBlockContext const *context)
 
static void globalEndRunProduce (edm::Run &run, edm::EventSetup const &setup, RunContext const *context)
 
static std::unique_ptr< DQMEDAnalyzerGlobalCacheinitializeGlobalCache (edm::ParameterSet const &)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

DQM Analysis of 4D DT segments

Author
G. Mila - INFN Torino

Definition at line 24 of file DTSegmentsTask.h.

Constructor & Destructor Documentation

◆ DTSegmentsTask()

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

Constructor.

Definition at line 27 of file DTSegmentsTask.cc.

References checkNoisyChannels, debug, edm::ParameterSet::getParameter(), parameters, muonDTDigis_cfi::pset, AlCaHLTBitMon_QueryRunRegistry::string, and theRecHits4DLabel_.

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

◆ ~DTSegmentsTask()

DTSegmentsTask::~DTSegmentsTask ( )
override

Destructor.

Definition at line 40 of file DTSegmentsTask.cc.

40 {}

Member Function Documentation

◆ analyze()

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

book the histos

Reimplemented from DQMEDAnalyzer.

Definition at line 111 of file DTSegmentsTask.cc.

References DTStatusFlag::cellStatus(), checkNoisyChannels, gather_cfg::cout, debug, HLT_2024v13_cff::distance, nHits, phiHistos, FastTimerService_cff::range, singleTopDQM_cfi::setup, findQualityFiles::size, DTRecSegment2D::specificRecHits(), statusMapToken_, theRecHits4DLabel_, and thetaHistos.

111  {
112  // Get the map of noisy channels
113  // bool checkNoisyChannels = parameters.getUntrackedParameter<bool>("checkNoisyChannels",false);
114  ESHandle<DTStatusFlag> statusMap;
115  if (checkNoisyChannels) {
116  statusMap = setup.getHandle(statusMapToken_);
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 << " 4D segments" << endl;
131 
132  // Loop over the rechits of this ChamerId
133  for (DTRecSegment4DCollection::const_iterator segment4D = range.first; segment4D != range.second; ++segment4D) {
134  //FOR NOISY CHANNELS////////////////////////////////
135  bool segmNoisy = false;
136  if ((*segment4D).hasPhi()) {
137  const DTChamberRecSegment2D* phiSeg = (*segment4D).phiSegment();
138  vector<DTRecHit1D> phiHits = phiSeg->specificRecHits();
139  map<DTSuperLayerId, vector<DTRecHit1D> > hitsBySLMap;
140  for (vector<DTRecHit1D>::const_iterator hit = phiHits.begin(); hit != phiHits.end(); ++hit) {
141  DTWireId wireId = (*hit).wireId();
142 
143  // Check for noisy channels to skip them
144  if (checkNoisyChannels) {
145  bool isNoisy = false;
146  bool isFEMasked = false;
147  bool isTDCMasked = false;
148  bool isTrigMask = false;
149  bool isDead = false;
150  bool isNohv = false;
151  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
152  if (isNoisy) {
153  if (debug)
154  cout << "Wire: " << wireId << " is noisy, skipping!" << endl;
155  segmNoisy = true;
156  }
157  }
158  }
159  }
160 
161  if ((*segment4D).hasZed()) {
162  const DTSLRecSegment2D* zSeg = (*segment4D).zSegment(); // zSeg lives in the SL RF
163  // Check for noisy channels to skip them
164  vector<DTRecHit1D> zHits = zSeg->specificRecHits();
165  for (vector<DTRecHit1D>::const_iterator hit = zHits.begin(); hit != zHits.end(); ++hit) {
166  DTWireId wireId = (*hit).wireId();
167  if (checkNoisyChannels) {
168  bool isNoisy = false;
169  bool isFEMasked = false;
170  bool isTDCMasked = false;
171  bool isTrigMask = false;
172  bool isDead = false;
173  bool isNohv = false;
174  //cout<<"wire id "<<wireId<<endl;
175  statusMap->cellStatus(wireId, isNoisy, isFEMasked, isTDCMasked, isTrigMask, isDead, isNohv);
176  if (isNoisy) {
177  if (debug)
178  cout << "Wire: " << wireId << " is noisy, skipping!" << endl;
179  segmNoisy = true;
180  }
181  }
182  }
183  }
184 
185  if (segmNoisy) {
186  if (debug)
187  cout << "skipping the segment: it contains noisy cells" << endl;
188  continue;
189  }
190  //END FOR NOISY CHANNELS////////////////////////////////
191 
192  // Fill the histos
193  int nHits = 0;
194  if ((*segment4D).hasPhi()) {
195  nHits = (((*segment4D).phiSegment())->specificRecHits()).size();
196  if (debug)
197  cout << "Phi segment with number of hits: " << nHits << endl;
198  phiHistos[0]->Fill((*chamberId).wheel(), nHits);
199  phiHistos[1]->Fill((*chamberId).sector(), nHits);
200  phiHistos[2]->Fill((*chamberId).station(), nHits);
201  }
202  if ((*segment4D).hasZed()) {
203  nHits = (((*segment4D).zSegment())->specificRecHits()).size();
204  if (debug)
205  cout << "Zed segment with number of hits: " << nHits << endl;
206  thetaHistos[0]->Fill((*chamberId).wheel(), nHits);
207  thetaHistos[1]->Fill((*chamberId).sector(), nHits);
208  thetaHistos[2]->Fill((*chamberId).station(), nHits);
209  }
210 
211  } //loop over segments
212  } // loop over chambers
213 }
size
Write out results.
std::pair< const_iterator, const_iterator > range
iterator range
Definition: RangeMap.h:50
const edm::ESGetToken< DTStatusFlag, DTStatusFlagRcd > statusMapToken_
identifier iterator
Definition: RangeMap.h:130
edm::EDGetTokenT< DTRecSegment4DCollection > theRecHits4DLabel_
C::const_iterator const_iterator
constant access iterator type
Definition: RangeMap.h:43
std::vector< MonitorElement * > thetaHistos
std::vector< MonitorElement * > phiHistos
std::vector< DTRecHit1D > specificRecHits() const
Access to specific components.
TupleMultiplicity< TrackerTraits > const *__restrict__ uint32_t nHits
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:90

◆ bookHistograms()

void DTSegmentsTask::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  ,
edm::EventSetup const &   
)
overridevirtual

Implements DQMEDAnalyzer.

Definition at line 42 of file DTSegmentsTask.cc.

References dqm::implementation::IBooker::book2D(), dqm::implementation::NavigatorBase::cd(), phiHistos, dqm::implementation::NavigatorBase::setCurrentFolder(), and thetaHistos.

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

Member Data Documentation

◆ checkNoisyChannels

bool DTSegmentsTask::checkNoisyChannels
private

Definition at line 40 of file DTSegmentsTask.h.

Referenced by analyze(), and DTSegmentsTask().

◆ debug

bool DTSegmentsTask::debug
private

◆ parameters

edm::ParameterSet DTSegmentsTask::parameters
private

Definition at line 41 of file DTSegmentsTask.h.

Referenced by DTSegmentsTask().

◆ phiHistos

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

Definition at line 46 of file DTSegmentsTask.h.

Referenced by analyze(), and bookHistograms().

◆ statusMapToken_

const edm::ESGetToken<DTStatusFlag, DTStatusFlagRcd> DTSegmentsTask::statusMapToken_
private

Definition at line 43 of file DTSegmentsTask.h.

Referenced by analyze().

◆ theRecHits4DLabel_

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

Definition at line 50 of file DTSegmentsTask.h.

Referenced by analyze(), and DTSegmentsTask().

◆ thetaHistos

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

Definition at line 47 of file DTSegmentsTask.h.

Referenced by analyze(), and bookHistograms().