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:303
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  int ndec(0);
61  const int bx1 = (bxX - m_GMTcandidatesBx[0]);
62  for (const auto& dec : ttuDec) {
63  if (dec.second) {
64  const int bx2 = dec.first;
65  const float bxdiffPacTT = 1.0 * (bx1 - bx2);
66  m_bxDistDiffPac[k]->Fill(bxdiffPacTT);
67  ++ndec;
68  }
69  }
70  }
71 
72  //.. DT
73  if (m_dtTrigger) {
74  int ndec(0);
75  const int bx1 = (bxX - m_DTcandidatesBx[0]);
76  for (const auto& dec : ttuDec) {
77  if (dec.second) {
78  const int bx2 = dec.first;
79  const float bxdiffDtTT = 1.0 * (bx1 - bx2);
80  m_bxDistDiffDt[k]->Fill(bxdiffDtTT);
81  ++ndec;
82  }
83  }
84  }
85  ttuDec.clear();
86  }
87 
88  m_GMTcandidatesBx.clear();
89  m_DTcandidatesBx.clear();
90 
91  //..............................................................................................
92  //
93  //... For Data Emulator comparison
94 
95  const TechnicalTriggerWord gtTTWord = gtRecord->technicalTriggerWord();
96 
97  std::vector<L1GtTechnicalTrigger> ttVec = emuTTRecord->gtTechnicalTrigger();
98 
99  int k = 0;
100  //int m_BxWindow = 0;
101  bool hasDataTrigger = false;
102  bool hasEmulatorTrigger = false;
103 
104  if (ttVec.empty())
105  return;
106 
107  for (const auto& bits : m_ttBits) {
108  hasDataTrigger = gtTTWord.at(bits);
109  m_ttBitsDecisionData->Fill(bits, (int)hasDataTrigger);
110 
111  hasEmulatorTrigger = ttVec[k].gtTechnicalTriggerResult();
112  m_ttBitsDecisionEmulator->Fill(ttVec[k].gtTechnicalTriggerBitNumber(), (int)hasEmulatorTrigger);
113 
114  discriminateDecision(hasDataTrigger, hasEmulatorTrigger, k);
115 
116  ++k;
117  }
118 }
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:23
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 203 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.

203  {
204  ibooker.setCurrentFolder(ttuFolder);
205  std::string hname;
206 
207  m_ttBitsDecisionData = ibooker.book1D("TechTrigger.Bits.Data", "Technical Trigger bits : Summary", 10, 23, 33);
208 
210  ibooker.book1D("TechTrigger.Bits.Emulator", "Technical Trigger bits : Summary", 10, 23, 33);
211  for (int k = 0; k < m_maxttBits; ++k) {
212  hname = fmt::format("BX.diff.PAC-TTU.bit.{}", m_ttBits[k]);
213  m_bxDistDiffPac[k] = ibooker.book1D(hname, "Timing difference between PAC and TTU", 7, -3, 3);
214 
215  hname = fmt::format("BX.diff.DT-TTU.bit.{}", m_ttBits[k]);
216  m_bxDistDiffDt[k] = ibooker.book1D(hname, "Timing difference between DT and TTU", 7, -3, 3);
217 
218  hname = fmt::format("Emu.Ttu.Compare.bit.{}", m_ttBits[k]);
219  m_dataVsemulator[k] = ibooker.book1D(hname, "Comparison between emulator and TT decisions", 10, 0, 10);
220  }
221 }
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 191 of file RPCTTUMonitor.cc.

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

Referenced by analyze().

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

◆ discriminateGMT()

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

Definition at line 120 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().

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