CMS 3D CMS Logo

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

#include <RPCTTUMonitor.h>

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

Public Member Functions

void discriminateDecision (bool, bool, int)
 
int discriminateGMT (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 RPCTTUMonitor (const edm::ParameterSet &)
 
 ~RPCTTUMonitor () override=default
 
- 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
 

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
- Protected Member Functions inherited from DQMEDAnalyzer
uint64_t meId () const
 

Private Attributes

MonitorElementm_bxDistDiffDt [8]
 
MonitorElementm_bxDistDiffPac [8]
 
MonitorElementm_dataVsemulator [8]
 
std::vector< int > m_DTcandidatesBx
 
bool m_dtTrigger
 
std::vector< int > m_GMTcandidatesBx
 
edm::EDGetTokenT< L1MuGMTReadoutCollectionm_gmtReadoutLabel
 
edm::EDGetTokenT< L1GlobalTriggerReadoutRecordm_gtReadoutLabel
 
int m_maxttBits
 
std::vector< int > m_RPCcandidatesBx
 
edm::EDGetTokenT< L1GtTechnicalTriggerRecordm_rpcTechTrigEmu
 
bool m_rpcTrigger
 
std::vector< unsigned > m_ttBits
 
MonitorElementm_ttBitsDecisionData
 
MonitorElementm_ttBitsDecisionEmulator
 
std::string outputFile
 
std::string ttuFolder
 

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 DQMEDAnalyzer
edm::EDPutTokenT< DQMTokenlumiToken_
 
edm::EDPutTokenT< DQMTokenrunToken_
 
unsigned int streamId_
 

Detailed Description

Definition at line 20 of file RPCTTUMonitor.h.

Constructor & Destructor Documentation

◆ RPCTTUMonitor()

RPCTTUMonitor::RPCTTUMonitor ( const edm::ParameterSet iConfig)
explicit

Definition at line 7 of file RPCTTUMonitor.cc.

References edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), m_gmtReadoutLabel, m_gtReadoutLabel, m_maxttBits, m_rpcTechTrigEmu, m_ttBits, outputFile, AlCaHLTBitMon_QueryRunRegistry::string, and ttuFolder.

7  {
8  ttuFolder = iConfig.getUntrackedParameter<std::string>("TTUFolder", "RPC/TTU");
9  outputFile = iConfig.getUntrackedParameter<std::string>("OutPutFile", "");
10 
11  m_gtReadoutLabel = consumes<L1GlobalTriggerReadoutRecord>(iConfig.getParameter<edm::InputTag>("GTReadoutRcd"));
12  m_gmtReadoutLabel = consumes<L1MuGMTReadoutCollection>(iConfig.getParameter<edm::InputTag>("GMTReadoutRcd"));
13  m_rpcTechTrigEmu = consumes<L1GtTechnicalTriggerRecord>(iConfig.getParameter<edm::InputTag>("L1TTEmuBitsLabel"));
14 
15  m_ttBits = iConfig.getParameter<std::vector<unsigned> >("BitNumbers");
16  m_maxttBits = m_ttBits.size();
17 }
std::string ttuFolder
Definition: RPCTTUMonitor.h:40
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_gtReadoutLabel
Definition: RPCTTUMonitor.h:55
edm::EDGetTokenT< L1MuGMTReadoutCollection > m_gmtReadoutLabel
Definition: RPCTTUMonitor.h:56
std::vector< unsigned > m_ttBits
Definition: RPCTTUMonitor.h:44
T getUntrackedParameter(std::string const &, T const &) const
std::string outputFile
Definition: RPCTTUMonitor.h:41
edm::EDGetTokenT< L1GtTechnicalTriggerRecord > m_rpcTechTrigEmu
Definition: RPCTTUMonitor.h:57

◆ ~RPCTTUMonitor()

RPCTTUMonitor::~RPCTTUMonitor ( )
overridedefault

Member Function Documentation

◆ analyze()

void RPCTTUMonitor::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

Reimplemented from DQMEDAnalyzer.

Definition at line 20 of file RPCTTUMonitor.cc.

References gpuClustering::pixelStatus::bits, TauDecayModes::dec, discriminateDecision(), discriminateGMT(), dqm::impl::MonitorElement::Fill(), L1GtTechnicalTriggerRecord::gtTechnicalTrigger(), iEvent, edm::HandleBase::isValid(), dqmdumpme::k, m_bxDistDiffDt, m_bxDistDiffPac, m_DTcandidatesBx, m_dtTrigger, m_GMTcandidatesBx, m_gtReadoutLabel, m_maxttBits, m_rpcTechTrigEmu, m_rpcTrigger, m_ttBits, m_ttBitsDecisionData, m_ttBitsDecisionEmulator, and L1GlobalTriggerReadoutRecord::technicalTriggerWord().

20  {
21  //..............................................................................................
22  // Data .
24  iEvent.getByToken(m_gtReadoutLabel, gtRecord);
25 
26  if (!gtRecord.isValid()) {
27  edm::LogError("RPCTTUMonitor") << "can nout find L1GlobalTriggerRecord \n";
28  return;
29  }
30 
31  // Emulator .
33  iEvent.getByToken(m_rpcTechTrigEmu, emuTTRecord);
34 
35  if (!emuTTRecord.isValid()) {
36  edm::LogError("RPCTTUMonitor") << "can not find L1GtTechnicalTriggerRecord (emulator) \n";
37  return;
38  }
39 
40  //..............................................................................................
41  //
42  //Timing difference between RPC-PAT and DT
43 
44  const int dGMT = discriminateGMT(iEvent, iSetup);
45  if (dGMT < 0)
46  return;
47 
48  std::map<int, bool> ttuDec;
49 
50  const int bxX = iEvent.bunchCrossing(); // ... 1 to 3564
51 
52  for (int k = 0; k < m_maxttBits; ++k) {
53  for (int iebx = 0; iebx <= 2; iebx++) {
54  const TechnicalTriggerWord gtTTWord = gtRecord->technicalTriggerWord(iebx - 1);
55  ttuDec[iebx - 1] = gtTTWord[24 + k];
56  }
57 
58  //. RPC
59  if (m_rpcTrigger) {
60  const int bx1 = (bxX - m_GMTcandidatesBx[0]);
61  for (const auto& dec : ttuDec) {
62  if (dec.second) {
63  const int bx2 = dec.first;
64  const float bxdiffPacTT = 1.0 * (bx1 - bx2);
65  m_bxDistDiffPac[k]->Fill(bxdiffPacTT);
66  }
67  }
68  }
69 
70  //.. DT
71  if (m_dtTrigger) {
72  const int bx1 = (bxX - m_DTcandidatesBx[0]);
73  for (const auto& dec : ttuDec) {
74  if (dec.second) {
75  const int bx2 = dec.first;
76  const float bxdiffDtTT = 1.0 * (bx1 - bx2);
77  m_bxDistDiffDt[k]->Fill(bxdiffDtTT);
78  }
79  }
80  }
81  ttuDec.clear();
82  }
83 
84  m_GMTcandidatesBx.clear();
85  m_DTcandidatesBx.clear();
86 
87  //..............................................................................................
88  //
89  //... For Data Emulator comparison
90 
91  const TechnicalTriggerWord gtTTWord = gtRecord->technicalTriggerWord();
92 
93  std::vector<L1GtTechnicalTrigger> ttVec = emuTTRecord->gtTechnicalTrigger();
94 
95  int k = 0;
96  //int m_BxWindow = 0;
97  bool hasDataTrigger = false;
98  bool hasEmulatorTrigger = false;
99 
100  if (ttVec.empty())
101  return;
102 
103  for (const auto& bits : m_ttBits) {
104  hasDataTrigger = gtTTWord.at(bits);
105  m_ttBitsDecisionData->Fill(bits, (int)hasDataTrigger);
106 
107  hasEmulatorTrigger = ttVec[k].gtTechnicalTriggerResult();
108  m_ttBitsDecisionEmulator->Fill(ttVec[k].gtTechnicalTriggerBitNumber(), (int)hasEmulatorTrigger);
109 
110  discriminateDecision(hasDataTrigger, hasEmulatorTrigger, k);
111 
112  ++k;
113  }
114 }
std::vector< int > m_DTcandidatesBx
Definition: RPCTTUMonitor.h:50
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_gtReadoutLabel
Definition: RPCTTUMonitor.h:55
constexpr uint32_t bits
Definition: gpuClustering.h:25
Log< level::Error, false > LogError
std::vector< unsigned > m_ttBits
Definition: RPCTTUMonitor.h:44
void Fill(long long x)
MonitorElement * m_ttBitsDecisionEmulator
Definition: RPCTTUMonitor.h:35
MonitorElement * m_bxDistDiffDt[8]
Definition: RPCTTUMonitor.h:37
int iEvent
Definition: GenABIO.cc:224
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
const TechnicalTriggerWord & technicalTriggerWord(int bxInEventValue) const
const std::vector< L1GtTechnicalTrigger > & gtTechnicalTrigger() const
get / set the vector of technical triggers
int discriminateGMT(const edm::Event &iEvent, const edm::EventSetup &iSetup)
bool isValid() const
Definition: HandleBase.h:70
MonitorElement * m_bxDistDiffPac[8]
Definition: RPCTTUMonitor.h:36
std::vector< int > m_GMTcandidatesBx
Definition: RPCTTUMonitor.h:49
void discriminateDecision(bool, bool, int)
MonitorElement * m_ttBitsDecisionData
Definition: RPCTTUMonitor.h:34
edm::EDGetTokenT< L1GtTechnicalTriggerRecord > m_rpcTechTrigEmu
Definition: RPCTTUMonitor.h:57

◆ bookHistograms()

void RPCTTUMonitor::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  r,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Implements DQMEDAnalyzer.

Definition at line 199 of file RPCTTUMonitor.cc.

References dqm::implementation::IBooker::book1D(), dqm-mbProfile::format, dqmdumpme::k, m_bxDistDiffDt, m_bxDistDiffPac, m_dataVsemulator, m_maxttBits, m_ttBits, m_ttBitsDecisionData, m_ttBitsDecisionEmulator, dqm::implementation::NavigatorBase::setCurrentFolder(), AlCaHLTBitMon_QueryRunRegistry::string, and ttuFolder.

199  {
200  ibooker.setCurrentFolder(ttuFolder);
201  std::string hname;
202 
203  m_ttBitsDecisionData = ibooker.book1D("TechTrigger.Bits.Data", "Technical Trigger bits : Summary", 10, 23, 33);
204 
206  ibooker.book1D("TechTrigger.Bits.Emulator", "Technical Trigger bits : Summary", 10, 23, 33);
207  for (int k = 0; k < m_maxttBits; ++k) {
208  hname = fmt::format("BX.diff.PAC-TTU.bit.{}", m_ttBits[k]);
209  m_bxDistDiffPac[k] = ibooker.book1D(hname, "Timing difference between PAC and TTU", 7, -3, 3);
210 
211  hname = fmt::format("BX.diff.DT-TTU.bit.{}", m_ttBits[k]);
212  m_bxDistDiffDt[k] = ibooker.book1D(hname, "Timing difference between DT and TTU", 7, -3, 3);
213 
214  hname = fmt::format("Emu.Ttu.Compare.bit.{}", m_ttBits[k]);
215  m_dataVsemulator[k] = ibooker.book1D(hname, "Comparison between emulator and TT decisions", 10, 0, 10);
216  }
217 }
std::string ttuFolder
Definition: RPCTTUMonitor.h:40
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:36
std::vector< unsigned > m_ttBits
Definition: RPCTTUMonitor.h:44
MonitorElement * m_dataVsemulator[8]
Definition: RPCTTUMonitor.h:38
MonitorElement * m_ttBitsDecisionEmulator
Definition: RPCTTUMonitor.h:35
MonitorElement * m_bxDistDiffDt[8]
Definition: RPCTTUMonitor.h:37
MonitorElement * m_bxDistDiffPac[8]
Definition: RPCTTUMonitor.h:36
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
MonitorElement * m_ttBitsDecisionData
Definition: RPCTTUMonitor.h:34

◆ discriminateDecision()

void RPCTTUMonitor::discriminateDecision ( bool  data,
bool  emu,
int  indx 
)

Definition at line 187 of file RPCTTUMonitor.cc.

References data, dqm::impl::MonitorElement::Fill(), and m_dataVsemulator.

Referenced by analyze().

187  {
188  if (data == 1 && emu == 1) {
189  m_dataVsemulator[indx]->Fill(1);
190  } else if (data == 1 && emu == 0) {
191  m_dataVsemulator[indx]->Fill(3);
192  } else if (data == 0 && emu == 1) {
193  m_dataVsemulator[indx]->Fill(5);
194  } else if (data == 0 && emu == 0) {
195  m_dataVsemulator[indx]->Fill(7);
196  }
197 }
MonitorElement * m_dataVsemulator[8]
Definition: RPCTTUMonitor.h:38
void Fill(long long x)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:80

◆ discriminateGMT()

int RPCTTUMonitor::discriminateGMT ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 116 of file RPCTTUMonitor.cc.

References L1MuGMTReadoutCollection::getRecords(), iEvent, edm::HandleBase::isValid(), m_DTcandidatesBx, m_dtTrigger, m_GMTcandidatesBx, m_gmtReadoutLabel, m_rpcTrigger, edm::Handle< T >::product(), and findQualityFiles::rr.

Referenced by analyze().

116  {
118  iEvent.getByToken(m_gmtReadoutLabel, pCollection);
119 
120  if (!pCollection.isValid()) {
121  edm::LogError("discriminateGMT") << "can't find L1MuGMTReadoutCollection with label \n";
122 
123  return -1;
124  }
125 
126  int gmtDec(0);
127 
128  bool rpcBar_l1a = false;
129  bool dtBar_l1a = false;
130 
131  m_dtTrigger = false;
132  m_rpcTrigger = false;
133 
134  // get GMT readout collection
135  const L1MuGMTReadoutCollection* gmtRC = pCollection.product();
136 
137  // get record vector
138  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtRC->getRecords();
139 
140  edm::LogInfo("DiscriminateGMT") << "nRecords: " << gmt_records.size() << '\n';
141 
142  for (const auto& rr : gmt_records) {
143  const int BxInEvent = rr.getBxInEvent();
144  const int BxInEventNew = rr.getBxNr();
145 
146  // RPC barrel muon candidates
147  int nrpcB = 0;
148  int ndtB = 0;
149 
150  std::vector<L1MuRegionalCand> BrlRpcCands = rr.getBrlRPCCands();
151  std::vector<L1MuRegionalCand> BrlDtCands = rr.getDTBXCands();
152 
153  for (const auto& rc : BrlRpcCands) {
154  if (!rc.empty()) {
155  m_GMTcandidatesBx.push_back(BxInEventNew);
156 
157  nrpcB++;
158  }
159  }
160 
161  for (const auto& rc : BrlDtCands) {
162  if (!rc.empty()) {
163  m_DTcandidatesBx.push_back(BxInEventNew);
164  ndtB++;
165  }
166  }
167 
168  if (BxInEvent == 0 && nrpcB > 0)
169  rpcBar_l1a = true;
170  if (BxInEvent == 0 && ndtB > 0)
171  dtBar_l1a = true;
172  }
173 
174  if (rpcBar_l1a) {
175  gmtDec = 1;
176  m_rpcTrigger = true;
177  }
178 
179  if (dtBar_l1a) {
180  gmtDec = 2;
181  m_dtTrigger = true;
182  }
183 
184  return gmtDec;
185 }
std::vector< int > m_DTcandidatesBx
Definition: RPCTTUMonitor.h:50
T const * product() const
Definition: Handle.h:70
edm::EDGetTokenT< L1MuGMTReadoutCollection > m_gmtReadoutLabel
Definition: RPCTTUMonitor.h:56
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224
Log< level::Info, false > LogInfo
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
bool isValid() const
Definition: HandleBase.h:70
std::vector< int > m_GMTcandidatesBx
Definition: RPCTTUMonitor.h:49

Member Data Documentation

◆ m_bxDistDiffDt

MonitorElement* RPCTTUMonitor::m_bxDistDiffDt[8]
private

Definition at line 37 of file RPCTTUMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ m_bxDistDiffPac

MonitorElement* RPCTTUMonitor::m_bxDistDiffPac[8]
private

Definition at line 36 of file RPCTTUMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ m_dataVsemulator

MonitorElement* RPCTTUMonitor::m_dataVsemulator[8]
private

Definition at line 38 of file RPCTTUMonitor.h.

Referenced by bookHistograms(), and discriminateDecision().

◆ m_DTcandidatesBx

std::vector<int> RPCTTUMonitor::m_DTcandidatesBx
private

Definition at line 50 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

◆ m_dtTrigger

bool RPCTTUMonitor::m_dtTrigger
private

Definition at line 46 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

◆ m_GMTcandidatesBx

std::vector<int> RPCTTUMonitor::m_GMTcandidatesBx
private

Definition at line 49 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

◆ m_gmtReadoutLabel

edm::EDGetTokenT<L1MuGMTReadoutCollection> RPCTTUMonitor::m_gmtReadoutLabel
private

Definition at line 56 of file RPCTTUMonitor.h.

Referenced by discriminateGMT(), and RPCTTUMonitor().

◆ m_gtReadoutLabel

edm::EDGetTokenT<L1GlobalTriggerReadoutRecord> RPCTTUMonitor::m_gtReadoutLabel
private

Definition at line 55 of file RPCTTUMonitor.h.

Referenced by analyze(), and RPCTTUMonitor().

◆ m_maxttBits

int RPCTTUMonitor::m_maxttBits
private

Definition at line 43 of file RPCTTUMonitor.h.

Referenced by analyze(), bookHistograms(), and RPCTTUMonitor().

◆ m_RPCcandidatesBx

std::vector<int> RPCTTUMonitor::m_RPCcandidatesBx
private

Definition at line 51 of file RPCTTUMonitor.h.

◆ m_rpcTechTrigEmu

edm::EDGetTokenT<L1GtTechnicalTriggerRecord> RPCTTUMonitor::m_rpcTechTrigEmu
private

Definition at line 57 of file RPCTTUMonitor.h.

Referenced by analyze(), and RPCTTUMonitor().

◆ m_rpcTrigger

bool RPCTTUMonitor::m_rpcTrigger
private

Definition at line 47 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

◆ m_ttBits

std::vector<unsigned> RPCTTUMonitor::m_ttBits
private

Definition at line 44 of file RPCTTUMonitor.h.

Referenced by analyze(), bookHistograms(), and RPCTTUMonitor().

◆ m_ttBitsDecisionData

MonitorElement* RPCTTUMonitor::m_ttBitsDecisionData
private

Definition at line 34 of file RPCTTUMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ m_ttBitsDecisionEmulator

MonitorElement* RPCTTUMonitor::m_ttBitsDecisionEmulator
private

Definition at line 35 of file RPCTTUMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ outputFile

std::string RPCTTUMonitor::outputFile
private

◆ ttuFolder

std::string RPCTTUMonitor::ttuFolder
private

Definition at line 40 of file RPCTTUMonitor.h.

Referenced by bookHistograms(), and RPCTTUMonitor().