CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
RPCTTUMonitor Class Reference

#include <RPCTTUMonitor.h>

Inheritance diagram for RPCTTUMonitor:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void discriminateDecision (bool, bool, int)
 
int discriminateGMT (const edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 RPCTTUMonitor (const edm::ParameterSet &)
 
 ~RPCTTUMonitor ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &)
 
virtual void beginJob ()
 
virtual void beginRun (const edm::EventSetup &)
 
virtual void endJob ()
 

Private Attributes

DQMStoredbe
 
MonitorElementm_bxDistDiffDt [8]
 
MonitorElementm_bxDistDiffPac [8]
 
MonitorElementm_dataVsemulator [8]
 
std::vector< int > m_DTcandidatesBx
 
bool m_dtTrigger
 
std::vector< int > m_GMTcandidatesBx
 
edm::EDGetTokenT
< L1MuGMTReadoutCollection
m_gmtReadoutLabel
 
edm::EDGetTokenT
< L1GlobalTriggerReadoutRecord
m_gtReadoutLabel
 
int m_maxttBits
 
std::vector< int > m_RPCcandidatesBx
 
edm::EDGetTokenT
< L1GtTechnicalTriggerRecord
m_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 edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 72 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:95
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_gtReadoutLabel
edm::EDGetTokenT< L1MuGMTReadoutCollection > m_gmtReadoutLabel
std::vector< unsigned > m_ttBits
Definition: RPCTTUMonitor.h:99
std::string outputFile
Definition: RPCTTUMonitor.h:96
edm::EDGetTokenT< L1GtTechnicalTriggerRecord > m_rpcTechTrigEmu
RPCTTUMonitor::~RPCTTUMonitor ( )

Definition at line 21 of file RPCTTUMonitor.cc.

21 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 25 of file RPCTTUMonitor.cc.

References edm::EventBase::bunchCrossing(), discriminateDecision(), discriminateGMT(), MonitorElement::Fill(), edm::Event::getByToken(), 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, and m_ttBitsDecisionEmulator.

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.size() <= 0 ) 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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< L1GlobalTriggerReadoutRecord > m_gtReadoutLabel
int bunchCrossing() const
Definition: EventBase.h:62
std::vector< unsigned > m_ttBits
Definition: RPCTTUMonitor.h:99
void Fill(long long x)
MonitorElement * m_ttBitsDecisionEmulator
Definition: RPCTTUMonitor.h:89
MonitorElement * m_bxDistDiffDt[8]
Definition: RPCTTUMonitor.h:91
std::vector< bool > TechnicalTriggerWord
technical trigger bits (64 bits)
bool isValid() const
Definition: HandleBase.h:76
int k[5][pyjets_maxn]
int discriminateGMT(const edm::Event &iEvent, const edm::EventSetup &iSetup)
MonitorElement * m_bxDistDiffPac[8]
Definition: RPCTTUMonitor.h:90
std::vector< int > m_GMTcandidatesBx
void discriminateDecision(bool, bool, int)
MonitorElement * m_ttBitsDecisionData
Definition: RPCTTUMonitor.h:88
edm::EDGetTokenT< L1GtTechnicalTriggerRecord > m_rpcTechTrigEmu
void RPCTTUMonitor::beginJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 239 of file RPCTTUMonitor.cc.

239 {}
void RPCTTUMonitor::beginRun ( const edm::EventSetup iSetup)
privatevirtual

Definition at line 241 of file RPCTTUMonitor.cc.

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

241  {
242 
245 
246 
248 
249 
250  m_ttBitsDecisionData = dbe->book1D("TechTrigger.Bits.Data",
251  "Technical Trigger bits : Summary",
252  10, 23, 33 );
253 
254  m_ttBitsDecisionEmulator = dbe->book1D("TechTrigger.Bits.Emulator",
255  "Technical Trigger bits : Summary",
256  10, 23, 33 );
257  for( int k=0; k < m_maxttBits; ++k) {
258 
259  std::ostringstream hname;
260 
261  hname << "BX.diff.PAC-TTU.bit." << m_ttBits[k];
262 
263  m_bxDistDiffPac[k] = dbe->book1D(hname.str().c_str(),
264  "Timing difference between PAC and TTU",
265  7, -3, 3);
266 
267  hname.str("");
268 
269  hname << "BX.diff.DT-TTU.bit." << m_ttBits[k];
270 
271  m_bxDistDiffDt[k] = dbe->book1D(hname.str().c_str(),
272  "Timing difference between DT and TTU",
273  7, -3, 3);
274 
275  hname.str("");
276 
277  hname << "Emu.Ttu.Compare.bit." << m_ttBits[k];
278 
279  m_dataVsemulator[k] = dbe->book1D(hname.str().c_str(),
280  "Comparison between emulator and TT decisions",
281  10, 0, 10 );
282 
283  hname.str("");
284 
285  }
286 
287 
288 }
std::string ttuFolder
Definition: RPCTTUMonitor.h:95
MonitorElement * book1D(const char *name, const char *title, int nchX, double lowX, double highX)
Book 1D histogram.
Definition: DQMStore.cc:872
std::vector< unsigned > m_ttBits
Definition: RPCTTUMonitor.h:99
MonitorElement * m_dataVsemulator[8]
Definition: RPCTTUMonitor.h:92
MonitorElement * m_ttBitsDecisionEmulator
Definition: RPCTTUMonitor.h:89
MonitorElement * m_bxDistDiffDt[8]
Definition: RPCTTUMonitor.h:91
int k[5][pyjets_maxn]
MonitorElement * m_bxDistDiffPac[8]
Definition: RPCTTUMonitor.h:90
void showDirStructure(void) const
Definition: DQMStore.cc:2961
MonitorElement * m_ttBitsDecisionData
Definition: RPCTTUMonitor.h:88
DQMStore * dbe
Definition: RPCTTUMonitor.h:94
void setCurrentFolder(const std::string &fullpath)
Definition: DQMStore.cc:584
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().

219 {
220 
221  if ( data == 1 && emu == 1 )
222  m_dataVsemulator[indx]->Fill( 1 );
223 
224  if ( data == 1 && emu == 0 )
225  m_dataVsemulator[indx]->Fill( 3 );
226 
227  if ( data == 0 && emu == 1 )
228  m_dataVsemulator[indx]->Fill( 5 );
229 
230  if ( data == 0 && emu == 0 )
231  m_dataVsemulator[indx]->Fill( 7 );
232 
233 
234 }
MonitorElement * m_dataVsemulator[8]
Definition: RPCTTUMonitor.h:92
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
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::EDGetTokenT< L1MuGMTReadoutCollection > m_gmtReadoutLabel
bool isValid() const
Definition: HandleBase.h:76
T const * product() const
Definition: Handle.h:81
std::vector< int > m_GMTcandidatesBx
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
void RPCTTUMonitor::endJob ( void  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 292 of file RPCTTUMonitor.cc.

References dbe, outputFile, and DQMStore::save().

292  {
293 
294  if(outputFile != "")
295  dbe->save(outputFile);
296 
297  dbe=0;
298 }
void save(const std::string &filename, const std::string &path="", const std::string &pattern="", const std::string &rewrite="", const uint32_t run=0, SaveReferenceTag ref=SaveWithReference, int minStatus=dqm::qstatus::STATUS_OK, const std::string &fileupdate="RECREATE")
Definition: DQMStore.cc:2296
std::string outputFile
Definition: RPCTTUMonitor.h:96
DQMStore * dbe
Definition: RPCTTUMonitor.h:94

Member Data Documentation

DQMStore* RPCTTUMonitor::dbe
private

Definition at line 94 of file RPCTTUMonitor.h.

Referenced by beginRun(), and endJob().

MonitorElement* RPCTTUMonitor::m_bxDistDiffDt[8]
private

Definition at line 91 of file RPCTTUMonitor.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCTTUMonitor::m_bxDistDiffPac[8]
private

Definition at line 90 of file RPCTTUMonitor.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCTTUMonitor::m_dataVsemulator[8]
private

Definition at line 92 of file RPCTTUMonitor.h.

Referenced by beginRun(), and discriminateDecision().

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

Definition at line 105 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

bool RPCTTUMonitor::m_dtTrigger
private

Definition at line 101 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

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

Definition at line 104 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

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

Definition at line 111 of file RPCTTUMonitor.h.

Referenced by discriminateGMT(), and RPCTTUMonitor().

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

Definition at line 110 of file RPCTTUMonitor.h.

Referenced by analyze(), and RPCTTUMonitor().

int RPCTTUMonitor::m_maxttBits
private

Definition at line 98 of file RPCTTUMonitor.h.

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

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

Definition at line 106 of file RPCTTUMonitor.h.

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

Definition at line 112 of file RPCTTUMonitor.h.

Referenced by analyze(), and RPCTTUMonitor().

bool RPCTTUMonitor::m_rpcTrigger
private

Definition at line 102 of file RPCTTUMonitor.h.

Referenced by analyze(), and discriminateGMT().

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

Definition at line 99 of file RPCTTUMonitor.h.

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

MonitorElement* RPCTTUMonitor::m_ttBitsDecisionData
private

Definition at line 88 of file RPCTTUMonitor.h.

Referenced by analyze(), and beginRun().

MonitorElement* RPCTTUMonitor::m_ttBitsDecisionEmulator
private

Definition at line 89 of file RPCTTUMonitor.h.

Referenced by analyze(), and beginRun().

std::string RPCTTUMonitor::outputFile
private

Definition at line 96 of file RPCTTUMonitor.h.

Referenced by endJob(), and RPCTTUMonitor().

std::string RPCTTUMonitor::ttuFolder
private

Definition at line 95 of file RPCTTUMonitor.h.

Referenced by beginRun(), and RPCTTUMonitor().