CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions
DTTnPEfficiencyTask Class Reference
Inheritance diagram for DTTnPEfficiencyTask:
BaseTnPEfficiencyTask DQMEDAnalyzer edm::stream::EDProducer< edm::GlobalCache< DQMEDAnalyzerGlobalCache >, edm::EndRunProducer, edm::EndLuminosityBlockProducer, edm::Accumulator >

Public Member Functions

 DTTnPEfficiencyTask (const edm::ParameterSet &config)
 Constructor. More...
 
 ~DTTnPEfficiencyTask () override
 Destructor. More...
 
- Public Member Functions inherited from BaseTnPEfficiencyTask
 BaseTnPEfficiencyTask (const edm::ParameterSet &config)
 Constructor. More...
 
 ~BaseTnPEfficiencyTask () 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
 
 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
 

Protected Member Functions

void analyze (const edm::Event &event, const edm::EventSetup &context) override
 Analyze. More...
 
void bookHistograms (DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &context) override
 
void bookWheelHistos (DQMStore::IBooker &iBooker, int wheel, std::string folder="")
 Book wheel granularity histograms. More...
 
std::string topFolder () const override
 Return the top folder. More...
 
- Protected Member Functions inherited from BaseTnPEfficiencyTask
void dqmBeginRun (const edm::Run &run, const edm::EventSetup &context) override
 BeginRun. More...
 
bool hasTrigger (std::vector< int > &trigIndices, const trigger::TriggerObjectCollection &trigObjs, edm::Handle< trigger::TriggerEvent > &trigEvent, const reco::Muon &muon)
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

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 Attributes inherited from BaseTnPEfficiencyTask
const double m_borderCut
 
const bool m_detailedAnalysis
 
const double m_dxCut
 
std::map< std::string, MonitorElement * > m_histos
 
const edm::EDGetTokenT< reco::MuonCollectionm_muToken
 
int m_nEvents
 
std::vector< std::vector< unsigned > > m_probeIndices
 
std::vector< std::vector< unsigned > > m_tagIndices
 
- Protected Attributes inherited from DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 14 of file DTTnPEfficiencyTask.cc.

Constructor & Destructor Documentation

◆ DTTnPEfficiencyTask()

DTTnPEfficiencyTask::DTTnPEfficiencyTask ( const edm::ParameterSet config)

Constructor.

Definition at line 34 of file DTTnPEfficiencyTask.cc.

References LogTrace.

35  LogTrace("DQMOffline|MuonDPG|DTTnPEfficiencyTask") << "[DTTnPEfficiencyTask]: Constructor" << std::endl;
36 }
Definition: config.py:1
#define LogTrace(id)
BaseTnPEfficiencyTask(const edm::ParameterSet &config)
Constructor.

◆ ~DTTnPEfficiencyTask()

DTTnPEfficiencyTask::~DTTnPEfficiencyTask ( )
override

Destructor.

Definition at line 38 of file DTTnPEfficiencyTask.cc.

References LogTrace, and BaseTnPEfficiencyTask::m_nEvents.

38  {
39  LogTrace("DQMOffline|MuonDPG|DTTnPEfficiencyTask")
40  << "[DTTnPEfficiencyTask]: analyzed " << m_nEvents << " events" << std::endl;
41 }
#define LogTrace(id)

Member Function Documentation

◆ analyze()

void DTTnPEfficiencyTask::analyze ( const edm::Event event,
const edm::EventSetup context 
)
overrideprotectedvirtual

Analyze.

Reimplemented from BaseTnPEfficiencyTask.

Definition at line 107 of file DTTnPEfficiencyTask.cc.

References funct::abs(), BaseTnPEfficiencyTask::analyze(), visDQMUpload::context, MuonSubdetId::DT, PVValHelper::dx, mps_fire::i, dqmiolumiharvest::j, BaseTnPEfficiencyTask::m_borderCut, BaseTnPEfficiencyTask::m_detailedAnalysis, BaseTnPEfficiencyTask::m_dxCut, BaseTnPEfficiencyTask::m_histos, BaseTnPEfficiencyTask::m_muToken, BaseTnPEfficiencyTask::m_probeIndices, PDWG_BPHSkim_cff::muons, nano_mu_digi_cff::sector, relativeConstraints::station, AlCaHLTBitMon_QueryRunRegistry::string, to_string(), and makeMuonMisalignmentScenario::wheel.

107  {
109 
111  event.getByToken(m_muToken, muons);
112 
113  //DT variables
114  std::vector<std::vector<int>> probe_coll_DT_wh;
115  std::vector<std::vector<int>> probe_coll_DT_sec;
116  std::vector<std::vector<int>> probe_coll_DT_sta;
117  std::vector<std::vector<float>> probe_coll_DT_dx;
118  std::vector<uint8_t> probe_coll_DT_staMatch;
119 
120  std::vector<unsigned> probe_indices;
121  if (!m_probeIndices.empty())
122  probe_indices = m_probeIndices.back();
123 
124  //Fill probe dx + subdetector coordinates
125  for (const auto i : probe_indices) {
126  //DT variables
127  std::vector<int> probe_DT_wh;
128  std::vector<int> probe_DT_sec;
129  std::vector<int> probe_DT_sta;
130  std::vector<float> probe_DT_dx;
131  uint8_t DT_stationMatching = 0;
132 
133  float dt_matched = false; // fill detailed plots only for probes matching DT
134 
135  for (const auto& chambMatch : (*muons).at(i).matches()) {
136  // look in DTs
137  if (chambMatch.detector() == MuonSubdetId::DT) {
138  if (chambMatch.edgeX < m_borderCut && chambMatch.edgeY < m_borderCut) {
139  dt_matched = true; //fill detailed plots if at least one CSC match
140 
141  DTChamberId chId(chambMatch.id.rawId());
142 
143  int wheel = chId.wheel();
144  int sector = chId.sector();
145  int station = chId.station();
146 
147  reco::MuonSegmentMatch closest_matchedSegment;
148  double smallestDx = 999.;
149 
150  for (auto& seg : chambMatch.segmentMatches) {
151  float dx = std::abs(chambMatch.x - seg.x);
152  if (dx < smallestDx) {
153  smallestDx = dx;
154  closest_matchedSegment = seg;
155  }
156  }
157 
158  DT_stationMatching = DT_stationMatching | (1 << (station - 1));
159 
160  probe_DT_wh.push_back(wheel);
161  probe_DT_sec.push_back(sector);
162  probe_DT_sta.push_back(station);
163  probe_DT_dx.push_back(smallestDx);
164  }
165  } else
166  continue;
167  } //loop over chamber matches
168 
169  //Fill detailed plots
170  if (m_detailedAnalysis && dt_matched) {
171  m_histos.find("probeEta")->second->Fill((*muons).at(i).eta());
172  m_histos.find("probePhi")->second->Fill((*muons).at(i).phi());
173  m_histos.find("probeNumberOfMatchedStations")->second->Fill((*muons).at(i).numberOfMatchedStations());
174  m_histos.find("probePt")->second->Fill((*muons).at(i).pt());
175  }
176 
177  //Fill DT variables
178  probe_coll_DT_wh.push_back(probe_DT_wh);
179  probe_coll_DT_sec.push_back(probe_DT_sec);
180  probe_coll_DT_sta.push_back(probe_DT_sta);
181  probe_coll_DT_dx.push_back(probe_DT_dx);
182  probe_coll_DT_staMatch.push_back(DT_stationMatching);
183  } //loop over probe collection
184 
185  //Loop over probes
186  for (unsigned i = 0; i < probe_indices.size(); ++i) {
187  uint8_t DT_matchPatt = probe_coll_DT_staMatch.at(i);
188 
189  //Loop over DT matches
190  unsigned nDT_matches = probe_coll_DT_wh.at(i).size();
191  for (unsigned j = 0; j < nDT_matches; ++j) {
192  //DT variables
193  int DT_wheel = probe_coll_DT_wh.at(i).at(j);
194  int DT_station = probe_coll_DT_sta.at(i).at(j);
195  int DT_sector = probe_coll_DT_sec.at(i).at(j);
196  float DT_dx = probe_coll_DT_dx.at(i).at(j);
197 
198  //Fill DT plots
199  if ((DT_matchPatt & (1 << (DT_station - 1))) != 0 && //avoids 0 station matching
200  (DT_matchPatt & (1 << (DT_station - 1))) !=
201  DT_matchPatt) //avoids matching with the station under consideration only
202  {
203  if (DT_dx < m_dxCut) {
204  std::string hName = std::string("DT_nPassingProbePerCh_W") + std::to_string(DT_wheel);
205  m_histos.find(hName)->second->Fill(DT_sector, DT_station);
206  m_histos.find("DT_nPassingProbe_allCh")->second->Fill((DT_station) + 4 * (DT_wheel + 2));
207  } else {
208  std::string hName = std::string("DT_nFailingProbePerCh_W") + std::to_string(DT_wheel);
209  m_histos.find(hName)->second->Fill(DT_sector, DT_station);
210  m_histos.find("DT_nFailingProbe_allCh")->second->Fill((DT_station) + 4 * (DT_wheel + 2));
211  }
212  }
213  }
214  }
215 }
const edm::EDGetTokenT< reco::MuonCollection > m_muToken
static std::string to_string(const XMLCh *ch)
std::vector< std::vector< unsigned > > m_probeIndices
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::map< std::string, MonitorElement * > m_histos
void analyze(const edm::Event &event, const edm::EventSetup &context) override
Analyze.
static constexpr int DT
Definition: MuonSubdetId.h:11
Definition: event.py:1

◆ bookHistograms()

void DTTnPEfficiencyTask::bookHistograms ( DQMStore::IBooker iBooker,
edm::Run const &  run,
edm::EventSetup const &  context 
)
overrideprotectedvirtual

Reimplemented from BaseTnPEfficiencyTask.

Definition at line 43 of file DTTnPEfficiencyTask.cc.

References ALCARECODTCalibSynchDQM_cff::baseDir, dqm::implementation::IBooker::book1D(), BaseTnPEfficiencyTask::bookHistograms(), bookWheelHistos(), visDQMUpload::context, LogTrace, BaseTnPEfficiencyTask::m_histos, writedatasetfile::run, dqm::impl::MonitorElement::setAxisTitle(), dqm::impl::MonitorElement::setBinLabel(), dqm::implementation::NavigatorBase::setCurrentFolder(), topFolder(), and makeMuonMisalignmentScenario::wheel.

45  {
47 
48  LogTrace("DQMOffline|MuonDPG|DTTnPEfficiencyTask") << "[DTTnPEfficiencyTask]: bookHistograms" << std::endl;
49 
50  for (int wheel = -2; wheel <= 2; ++wheel) {
51  bookWheelHistos(iBooker, wheel, "Task");
52  }
53  auto baseDir = topFolder() + "Task/";
54  iBooker.setCurrentFolder(baseDir);
55 
56  MonitorElement* me_DT_pass_allCh = iBooker.book1D("DT_nPassingProbe_allCh", "DT_nPassingProbe_allCh", 20, 0.5, 20.5);
57  MonitorElement* me_DT_fail_allCh = iBooker.book1D("DT_nFailingProbe_allCh", "DT_nFailingProbe_allCh", 20, 0.5, 20.5);
58 
59  me_DT_pass_allCh->setBinLabel(1, "MB1/YB-2", 1);
60  me_DT_pass_allCh->setBinLabel(2, "MB2/YB-2", 1);
61  me_DT_pass_allCh->setBinLabel(3, "MB3/YB-2", 1);
62  me_DT_pass_allCh->setBinLabel(4, "MB4/YB-2", 1);
63  me_DT_pass_allCh->setBinLabel(5, "MB1/YB-1", 1);
64  me_DT_pass_allCh->setBinLabel(6, "MB2/YB-1", 1);
65  me_DT_pass_allCh->setBinLabel(7, "MB3/YB-1", 1);
66  me_DT_pass_allCh->setBinLabel(8, "MB4/YB-1", 1);
67  me_DT_pass_allCh->setBinLabel(9, "MB1/YB0", 1);
68  me_DT_pass_allCh->setBinLabel(10, "MB2/YB0", 1);
69  me_DT_pass_allCh->setBinLabel(11, "MB3/YB0", 1);
70  me_DT_pass_allCh->setBinLabel(12, "MB4/YB0", 1);
71  me_DT_pass_allCh->setBinLabel(13, "MB1/YB1", 1);
72  me_DT_pass_allCh->setBinLabel(14, "MB2/YB1", 1);
73  me_DT_pass_allCh->setBinLabel(15, "MB3/YB1", 1);
74  me_DT_pass_allCh->setBinLabel(16, "MB4/YB1", 1);
75  me_DT_pass_allCh->setBinLabel(17, "MB1/YB2", 1);
76  me_DT_pass_allCh->setBinLabel(18, "MB2/YB2", 1);
77  me_DT_pass_allCh->setBinLabel(19, "MB3/YB2", 1);
78  me_DT_pass_allCh->setBinLabel(20, "MB4/YB2", 1);
79  me_DT_pass_allCh->setAxisTitle("Number of passing probes", 2);
80 
81  me_DT_fail_allCh->setBinLabel(1, "MB1/YB-2", 1);
82  me_DT_fail_allCh->setBinLabel(2, "MB2/YB-2", 1);
83  me_DT_fail_allCh->setBinLabel(3, "MB3/YB-2", 1);
84  me_DT_fail_allCh->setBinLabel(4, "MB4/YB-2", 1);
85  me_DT_fail_allCh->setBinLabel(5, "MB1/YB-1", 1);
86  me_DT_fail_allCh->setBinLabel(6, "MB2/YB-1", 1);
87  me_DT_fail_allCh->setBinLabel(7, "MB3/YB-1", 1);
88  me_DT_fail_allCh->setBinLabel(8, "MB4/YB-1", 1);
89  me_DT_fail_allCh->setBinLabel(9, "MB1/YB0", 1);
90  me_DT_fail_allCh->setBinLabel(10, "MB2/YB0", 1);
91  me_DT_fail_allCh->setBinLabel(11, "MB3/YB0", 1);
92  me_DT_fail_allCh->setBinLabel(12, "MB4/YB0", 1);
93  me_DT_fail_allCh->setBinLabel(13, "MB1/YB1", 1);
94  me_DT_fail_allCh->setBinLabel(14, "MB2/YB1", 1);
95  me_DT_fail_allCh->setBinLabel(15, "MB3/YB1", 1);
96  me_DT_fail_allCh->setBinLabel(16, "MB4/YB1", 1);
97  me_DT_fail_allCh->setBinLabel(17, "MB1/YB2", 1);
98  me_DT_fail_allCh->setBinLabel(18, "MB2/YB2", 1);
99  me_DT_fail_allCh->setBinLabel(19, "MB3/YB2", 1);
100  me_DT_fail_allCh->setBinLabel(20, "MB4/YB2", 1);
101  me_DT_fail_allCh->setAxisTitle("Number of failing probes", 2);
102 
103  m_histos["DT_nPassingProbe_allCh"] = me_DT_pass_allCh;
104  m_histos["DT_nFailingProbe_allCh"] = me_DT_fail_allCh;
105 }
void bookWheelHistos(DQMStore::IBooker &iBooker, int wheel, std::string folder="")
Book wheel granularity histograms.
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
#define LogTrace(id)
std::string topFolder() const override
Return the top folder.
std::map< std::string, MonitorElement * > m_histos
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
void bookHistograms(DQMStore::IBooker &iBooker, edm::Run const &run, edm::EventSetup const &context) override
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

◆ bookWheelHistos()

void DTTnPEfficiencyTask::bookWheelHistos ( DQMStore::IBooker iBooker,
int  wheel,
std::string  folder = "" 
)
protected

Book wheel granularity histograms.

Definition at line 217 of file DTTnPEfficiencyTask.cc.

References ALCARECODTCalibSynchDQM_cff::baseDir, dqm::implementation::IBooker::book2D(), printsummarytable::folder, mps_fire::i, LogTrace, BaseTnPEfficiencyTask::m_histos, dqm::impl::MonitorElement::setAxisTitle(), dqm::impl::MonitorElement::setBinLabel(), dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, to_string(), topFolder(), and makeMuonMisalignmentScenario::wheel.

Referenced by bookHistograms().

217  {
218  auto baseDir = topFolder() + folder + "/";
219  iBooker.setCurrentFolder(baseDir);
220 
221  LogTrace("DQMOffline|MuonDPG|DTTnPEfficiencyTask")
222  << "[DTTnPEfficiencyTask]: booking histos in " << baseDir << std::endl;
223 
224  auto hName_DT_pass = std::string("DT_nPassingProbePerCh_W") + std::to_string(wheel);
225  auto hName_DT_fail = std::string("DT_nFailingProbePerCh_W") + std::to_string(wheel);
226 
227  MonitorElement* me_DT_pass = iBooker.book2D(hName_DT_pass.c_str(), hName_DT_pass.c_str(), 14, 0.5, 14.5, 4, 0., 4.5);
228  MonitorElement* me_DT_fail = iBooker.book2D(hName_DT_fail.c_str(), hName_DT_fail.c_str(), 14, 0.5, 14.5, 4, 0., 4.5);
229 
230  me_DT_pass->setBinLabel(1, "MB1", 2);
231  me_DT_pass->setBinLabel(2, "MB2", 2);
232  me_DT_pass->setBinLabel(3, "MB3", 2);
233  me_DT_pass->setBinLabel(4, "MB4", 2);
234  for (int i = 1; i < 15; ++i) {
235  me_DT_pass->setBinLabel(i, std::to_string(i), 1);
236  }
237  me_DT_pass->setAxisTitle("Sector", 1);
238  me_DT_pass->setAxisTitle("Number of passing probes", 3);
239 
240  me_DT_fail->setBinLabel(1, "MB1", 2);
241  me_DT_fail->setBinLabel(2, "MB2", 2);
242  me_DT_fail->setBinLabel(3, "MB3", 2);
243  me_DT_fail->setBinLabel(4, "MB4", 2);
244  for (int i = 1; i < 15; ++i) {
245  me_DT_fail->setBinLabel(i, std::to_string(i), 1);
246  }
247  me_DT_fail->setAxisTitle("Sector", 1);
248  me_DT_fail->setAxisTitle("Number of failing probes", 3);
249 
250  m_histos[hName_DT_pass] = me_DT_pass;
251  m_histos[hName_DT_fail] = me_DT_fail;
252 }
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
static std::string to_string(const XMLCh *ch)
#define LogTrace(id)
std::string topFolder() const override
Return the top folder.
std::map< std::string, MonitorElement * > m_histos
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
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:212
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

◆ topFolder()

std::string DTTnPEfficiencyTask::topFolder ( ) const
overrideprotectedvirtual

Return the top folder.

Implements BaseTnPEfficiencyTask.

Definition at line 254 of file DTTnPEfficiencyTask.cc.

Referenced by bookHistograms(), and bookWheelHistos().

254 { return "DT/Segment_TnP/"; };