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:
one::DQMEDAnalyzer< T > one::dqmimplementation::DQMBaseClass< T... >

Public Member Functions

void discriminateDecision (bool, bool, int)
 
int discriminateGMT (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 RPCTTUMonitor (const edm::ParameterSet &)
 
 ~RPCTTUMonitor () override
 
- Public Member Functions inherited from one::DQMEDAnalyzer< T >
 DQMEDAnalyzer ()=default
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > const &)=delete
 
 DQMEDAnalyzer (DQMEDAnalyzer< T... > &&)=delete
 
 ~DQMEDAnalyzer () override=default
 

Protected Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 

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
 

Detailed Description

Definition at line 48 of file RPCTTUMonitor.h.

Constructor & Destructor Documentation

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

Definition at line 6 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.

6  {
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 
16  m_ttBits = iConfig.getParameter< std::vector<unsigned> >("BitNumbers");
17  m_maxttBits = m_ttBits.size();
18 
19 }
T getParameter(std::string const &) const
std::string ttuFolder
Definition: RPCTTUMonitor.h:70
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_gtReadoutLabel
Definition: RPCTTUMonitor.h:85
edm::EDGetTokenT< L1MuGMTReadoutCollection > m_gmtReadoutLabel
Definition: RPCTTUMonitor.h:86
std::vector< unsigned > m_ttBits
Definition: RPCTTUMonitor.h:74
std::string outputFile
Definition: RPCTTUMonitor.h:71
edm::EDGetTokenT< L1GtTechnicalTriggerRecord > m_rpcTechTrigEmu
Definition: RPCTTUMonitor.h:87
RPCTTUMonitor::~RPCTTUMonitor ( )
override

Definition at line 21 of file RPCTTUMonitor.cc.

21 {}

Member Function Documentation

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

Definition at line 25 of file RPCTTUMonitor.cc.

References edm::EventBase::bunchCrossing(), discriminateDecision(), discriminateGMT(), MonitorElement::Fill(), edm::Event::getByToken(), L1GtTechnicalTriggerRecord::gtTechnicalTrigger(), edm::HandleBase::isValid(), gen::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().

26 {
27 
28  //..............................................................................................
29  // Data .
31  iEvent.getByToken( m_gtReadoutLabel, gtRecord);
32 
33  if ( !gtRecord.isValid() ) {
34  edm::LogError("RPCTTUMonitor") << "can nout find L1GlobalTriggerRecord \n";
35  return;
36  }
37 
38  // Emulator .
40  iEvent.getByToken( m_rpcTechTrigEmu , emuTTRecord);
41 
42  if ( !emuTTRecord.isValid() ) {
43  edm::LogError("RPCTTUMonitor") << "can not find L1GtTechnicalTriggerRecord (emulator) \n";
44  return;
45  }
46 
47  //..............................................................................................
48  //
49  //Timing difference between RPC-PAT and DT
50 
51  int dGMT(0);
52  dGMT = discriminateGMT( iEvent , iSetup );
53  if ( dGMT < 0 ) return;
54 
55  std::map<int,bool> ttuDec;
56  std::map<int,bool>::iterator decItr;
57 
58  int bxX = iEvent.bunchCrossing(); // ... 1 to 3564
59 
60  for( int k=0; k < m_maxttBits; ++k) {
61  for( int iebx=0; iebx<=2; iebx++) {
62  const TechnicalTriggerWord gtTTWord = gtRecord->technicalTriggerWord(iebx-1);
63  ttuDec[iebx-1] = gtTTWord[ 24+k ];
64  }
65 
66  //. RPC
67  if ( m_rpcTrigger ) {
68 
69  int ndec(0);
70  int bx1 = (bxX - m_GMTcandidatesBx[0]);
71  for( decItr = ttuDec.begin(); decItr != ttuDec.end(); ++decItr ){
72  if ( (*decItr).second ) {
73  int bx2 = (*decItr).first;
74  float bxdiffPacTT = 1.0*( bx1 - bx2);
75  m_bxDistDiffPac[k]->Fill( bxdiffPacTT );
76  ++ndec;
77  }
78  }
79  }
80 
81  //.. DT
82  if ( m_dtTrigger ) {
83 
84  int ndec(0);
85  int bx1 = (bxX - m_DTcandidatesBx[0]);
86  for( decItr = ttuDec.begin(); decItr != ttuDec.end(); ++decItr ){
87  if ( (*decItr).second ) {
88  int bx2 = (*decItr).first;
89  float bxdiffDtTT = 1.0*( bx1 - bx2);
90  m_bxDistDiffDt[k]->Fill( bxdiffDtTT );
91  ++ndec;
92  }
93  }
94  }
95  ttuDec.clear();
96 
97  }
98 
99  m_GMTcandidatesBx.clear();
100  m_DTcandidatesBx.clear();
101 
102  //..............................................................................................
103  //
104  //... For Data Emulator comparison
105 
106  const TechnicalTriggerWord gtTTWord = gtRecord->technicalTriggerWord();
107 
108  std::vector<L1GtTechnicalTrigger> ttVec = emuTTRecord->gtTechnicalTrigger();
109 
110  std::vector<unsigned>::iterator bitsItr;
111  int k = 0;
112  //int m_BxWindow = 0;
113  bool hasDataTrigger = false;
114  bool hasEmulatorTrigger = false;
115 
116  if ( ttVec.empty() ) return;
117 
118  for ( bitsItr = m_ttBits.begin(); bitsItr != m_ttBits.end(); ++bitsItr ) {
119 
120  hasDataTrigger = gtTTWord.at( (*bitsItr) );
121  m_ttBitsDecisionData->Fill( (*bitsItr), (int)hasDataTrigger );
122 
123  hasEmulatorTrigger = ttVec[k].gtTechnicalTriggerResult();
124  m_ttBitsDecisionEmulator->Fill( ttVec[k].gtTechnicalTriggerBitNumber(), (int)hasEmulatorTrigger );
125 
126  discriminateDecision(hasDataTrigger ,hasEmulatorTrigger , k );
127 
128  ++k;
129 
130  }
131 
132 
133 }
std::vector< int > m_DTcandidatesBx
Definition: RPCTTUMonitor.h:80
const TechnicalTriggerWord & technicalTriggerWord(int bxInEventValue) const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_gtReadoutLabel
Definition: RPCTTUMonitor.h:85
int bunchCrossing() const
Definition: EventBase.h:64
std::vector< unsigned > m_ttBits
Definition: RPCTTUMonitor.h:74
void Fill(long long x)
MonitorElement * m_ttBitsDecisionEmulator
Definition: RPCTTUMonitor.h:65
MonitorElement * m_bxDistDiffDt[8]
Definition: RPCTTUMonitor.h:67
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
bool isValid() const
Definition: HandleBase.h:74
int k[5][pyjets_maxn]
int discriminateGMT(const edm::Event &iEvent, const edm::EventSetup &iSetup)
MonitorElement * m_bxDistDiffPac[8]
Definition: RPCTTUMonitor.h:66
std::vector< int > m_GMTcandidatesBx
Definition: RPCTTUMonitor.h:79
const std::vector< L1GtTechnicalTrigger > & gtTechnicalTrigger() const
get / set the vector of technical triggers
void discriminateDecision(bool, bool, int)
MonitorElement * m_ttBitsDecisionData
Definition: RPCTTUMonitor.h:64
edm::EDGetTokenT< L1GtTechnicalTriggerRecord > m_rpcTechTrigEmu
Definition: RPCTTUMonitor.h:87
void RPCTTUMonitor::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  r,
edm::EventSetup const &  iSetup 
)
overrideprotected

Definition at line 235 of file RPCTTUMonitor.cc.

References DQMStore::IBooker::book1D(), gen::k, m_bxDistDiffDt, m_bxDistDiffPac, m_dataVsemulator, m_maxttBits, m_ttBits, m_ttBitsDecisionData, m_ttBitsDecisionEmulator, DQMStore::IBooker::setCurrentFolder(), and ttuFolder.

235  {
236 
237  ibooker.setCurrentFolder(ttuFolder);
238 
239 
240  m_ttBitsDecisionData = ibooker.book1D("TechTrigger.Bits.Data",
241  "Technical Trigger bits : Summary",
242  10, 23, 33 );
243 
244  m_ttBitsDecisionEmulator = ibooker.book1D("TechTrigger.Bits.Emulator",
245  "Technical Trigger bits : Summary",
246  10, 23, 33 );
247  for( int k=0; k < m_maxttBits; ++k) {
248 
249  std::ostringstream hname;
250 
251  hname << "BX.diff.PAC-TTU.bit." << m_ttBits[k];
252 
253  m_bxDistDiffPac[k] = ibooker.book1D(hname.str().c_str(),
254  "Timing difference between PAC and TTU",
255  7, -3, 3);
256 
257  hname.str("");
258 
259  hname << "BX.diff.DT-TTU.bit." << m_ttBits[k];
260 
261  m_bxDistDiffDt[k] = ibooker.book1D(hname.str().c_str(),
262  "Timing difference between DT and TTU",
263  7, -3, 3);
264 
265  hname.str("");
266 
267  hname << "Emu.Ttu.Compare.bit." << m_ttBits[k];
268 
269  m_dataVsemulator[k] = ibooker.book1D(hname.str().c_str(),
270  "Comparison between emulator and TT decisions",
271  10, 0, 10 );
272 
273  hname.str("");
274 
275  }
276 
277 
278 }
std::string ttuFolder
Definition: RPCTTUMonitor.h:70
std::vector< unsigned > m_ttBits
Definition: RPCTTUMonitor.h:74
MonitorElement * m_dataVsemulator[8]
Definition: RPCTTUMonitor.h:68
MonitorElement * m_ttBitsDecisionEmulator
Definition: RPCTTUMonitor.h:65
MonitorElement * m_bxDistDiffDt[8]
Definition: RPCTTUMonitor.h:67
void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:268
MonitorElement * book1D(Args &&...args)
Definition: DQMStore.h:106
int k[5][pyjets_maxn]
MonitorElement * m_bxDistDiffPac[8]
Definition: RPCTTUMonitor.h:66
MonitorElement * m_ttBitsDecisionData
Definition: RPCTTUMonitor.h:64
void RPCTTUMonitor::discriminateDecision ( bool  data,
bool  emu,
int  indx 
)

Definition at line 218 of file RPCTTUMonitor.cc.

References MonitorElement::Fill(), and m_dataVsemulator.

Referenced by analyze().

218  {
219 
220  if ( data == 1 && emu == 1 ){
221  m_dataVsemulator[indx]->Fill( 1 );
222  }else if ( data == 1 && emu == 0 ){
223  m_dataVsemulator[indx]->Fill( 3 );
224  }else if ( data == 0 && emu == 1 ){
225  m_dataVsemulator[indx]->Fill( 5 );
226  }else if ( data == 0 && emu == 0 ){
227  m_dataVsemulator[indx]->Fill( 7 );
228  }
229 
230 }
MonitorElement * m_dataVsemulator[8]
Definition: RPCTTUMonitor.h:68
void Fill(long long x)
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
int RPCTTUMonitor::discriminateGMT ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)

Definition at line 135 of file RPCTTUMonitor.cc.

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

Referenced by analyze().

136 {
137 
138  //.............................................................................................
139 
141  iEvent.getByToken(m_gmtReadoutLabel,pCollection);
142 
143  if ( ! pCollection.isValid() ) {
144  edm::LogError("discriminateGMT") << "can't find L1MuGMTReadoutCollection with label \n";
145 
146  return -1;
147  }
148 
149  //.............................................................................................
150 
151  int gmtDec(0);
152 
153  bool rpcBar_l1a = false;
154  bool dtBar_l1a = false;
155 
156  m_dtTrigger = false;
157  m_rpcTrigger = false;
158 
159  // get GMT readout collection
160  const L1MuGMTReadoutCollection * gmtRC = pCollection.product();
161 
162  // get record vector
163  std::vector<L1MuGMTReadoutRecord>::const_iterator RRItr;
164  std::vector<L1MuGMTReadoutRecord> gmt_records = gmtRC->getRecords();
165 
166  edm::LogInfo("DiscriminateGMT") << "nRecords: " << gmt_records.size() << '\n';
167 
168  for( RRItr = gmt_records.begin(); RRItr != gmt_records.end(); ++RRItr ) {
169 
170  int BxInEvent = RRItr->getBxInEvent();
171  int BxInEventNew = RRItr->getBxNr();
172 
173  // RPC barrel muon candidates
174  int nrpcB = 0;
175  int ndtB = 0;
176 
177  std::vector<L1MuRegionalCand> BrlRpcCands = RRItr->getBrlRPCCands();
178  std::vector<L1MuRegionalCand> BrlDtCands = RRItr->getDTBXCands ();
179 
180  std::vector<L1MuRegionalCand>::const_iterator RCItr;
181 
182  for( RCItr = BrlRpcCands.begin(); RCItr !=BrlRpcCands.end(); ++RCItr) {
183  if ( !(*RCItr).empty() ) {
184 
185  m_GMTcandidatesBx.push_back( BxInEventNew );
186 
187  nrpcB++;
188  }
189  }
190 
191  for( RCItr = BrlDtCands.begin(); RCItr !=BrlDtCands.end(); ++RCItr) {
192  if ( !(*RCItr).empty() ) {
193  m_DTcandidatesBx.push_back( BxInEventNew );
194  ndtB++;
195  }
196  }
197 
198  if( BxInEvent == 0 && nrpcB > 0) rpcBar_l1a = true;
199  if( BxInEvent == 0 && ndtB > 0) dtBar_l1a = true;
200 
201  }
202 
203  if( rpcBar_l1a ) {
204  gmtDec = 1;
205  m_rpcTrigger = true;
206 
207  }
208 
209  if( dtBar_l1a ) {
210  gmtDec = 2;
211  m_dtTrigger = true;
212  }
213 
214  return gmtDec;
215 
216 }
std::vector< int > m_DTcandidatesBx
Definition: RPCTTUMonitor.h:80
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< L1MuGMTReadoutCollection > m_gmtReadoutLabel
Definition: RPCTTUMonitor.h:86
bool isValid() const
Definition: HandleBase.h:74
T const * product() const
Definition: Handle.h:74
std::vector< int > m_GMTcandidatesBx
Definition: RPCTTUMonitor.h:79
std::vector< L1MuGMTReadoutRecord > const & getRecords() const

Member Data Documentation

MonitorElement* RPCTTUMonitor::m_bxDistDiffDt[8]
private

Definition at line 67 of file RPCTTUMonitor.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCTTUMonitor::m_bxDistDiffPac[8]
private

Definition at line 66 of file RPCTTUMonitor.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCTTUMonitor::m_dataVsemulator[8]
private

Definition at line 68 of file RPCTTUMonitor.h.

Referenced by bookHistograms(), and discriminateDecision().

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

Definition at line 80 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

bool RPCTTUMonitor::m_dtTrigger
private

Definition at line 76 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

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

Definition at line 79 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

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

Definition at line 86 of file RPCTTUMonitor.h.

Referenced by discriminateGMT(), and RPCTTUMonitor().

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

Definition at line 85 of file RPCTTUMonitor.h.

Referenced by analyze(), and RPCTTUMonitor().

int RPCTTUMonitor::m_maxttBits
private

Definition at line 73 of file RPCTTUMonitor.h.

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

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

Definition at line 81 of file RPCTTUMonitor.h.

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

Definition at line 87 of file RPCTTUMonitor.h.

Referenced by analyze(), and RPCTTUMonitor().

bool RPCTTUMonitor::m_rpcTrigger
private

Definition at line 77 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

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

Definition at line 74 of file RPCTTUMonitor.h.

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

MonitorElement* RPCTTUMonitor::m_ttBitsDecisionData
private

Definition at line 64 of file RPCTTUMonitor.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* RPCTTUMonitor::m_ttBitsDecisionEmulator
private

Definition at line 65 of file RPCTTUMonitor.h.

Referenced by analyze(), and bookHistograms().

std::string RPCTTUMonitor::outputFile
private
std::string RPCTTUMonitor::ttuFolder
private

Definition at line 70 of file RPCTTUMonitor.h.

Referenced by bookHistograms(), and RPCTTUMonitor().