CMS 3D CMS Logo

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

#include <L1GtPackUnpackAnalyzer.h>

Inheritance diagram for L1GtPackUnpackAnalyzer:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 L1GtPackUnpackAnalyzer (const edm::ParameterSet &)
 
 ~L1GtPackUnpackAnalyzer () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 analyze each event More...
 
virtual void analyzeGMT (const edm::Event &, const edm::EventSetup &)
 GMT comparison. More...
 
virtual void analyzeGT (const edm::Event &, const edm::EventSetup &)
 GT comparison. More...
 
void beginJob () override
 
void endJob () override
 end of job More...
 

Private Attributes

edm::InputTag m_finalGtGmtInputTag
 input tag for the final GT DAQ and GMT records: More...
 
edm::InputTag m_initialDaqGtInputTag
 input tag for the initial GT DAQ record: More...
 
edm::InputTag m_initialMuGmtInputTag
 input tag for the initial GMT readout collection: More...
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

Description: pack - unpack validation for L1 GT DAQ record.

Implementation: Pack (DigiToRaw) and unpack (RawToDigi) a L1 GT DAQ record. Compare the initial DAQ record with the final one and print them if they are different.

Author
: Vasile Mihai Ghete - HEPHY Vienna

Description: see header file.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna

Definition at line 36 of file L1GtPackUnpackAnalyzer.h.

Constructor & Destructor Documentation

L1GtPackUnpackAnalyzer::L1GtPackUnpackAnalyzer ( const edm::ParameterSet parSet)
explicit

Definition at line 30 of file L1GtPackUnpackAnalyzer.cc.

References edm::ParameterSet::getParameter(), m_finalGtGmtInputTag, m_initialDaqGtInputTag, and m_initialMuGmtInputTag.

30  {
31  // input tag for the initial GT DAQ record:
32  m_initialDaqGtInputTag = parSet.getParameter<edm::InputTag>("InitialDaqGtInputTag");
33 
34  // input tag for the initial GMT readout collection:
35  m_initialMuGmtInputTag = parSet.getParameter<edm::InputTag>("InitialMuGmtInputTag");
36 
37  // input tag for the final GT DAQ and GMT records:
38  m_finalGtGmtInputTag = parSet.getParameter<edm::InputTag>("FinalGtGmtInputTag");
39 
40  edm::LogInfo("L1GtPackUnpackAnalyzer") << "\nInput tag for the initial GT DAQ record: "
41  << m_initialDaqGtInputTag << " \n"
42  << "\nInput tag for the initial GMT readout collection: "
43  << m_initialMuGmtInputTag << " \n"
44  << "\nInput tag for the final GT DAQ and GMT records: "
45  << m_finalGtGmtInputTag << " \n"
46  << std::endl;
47 }
T getParameter(std::string const &) const
edm::InputTag m_initialMuGmtInputTag
input tag for the initial GMT readout collection:
edm::InputTag m_initialDaqGtInputTag
input tag for the initial GT DAQ record:
edm::InputTag m_finalGtGmtInputTag
input tag for the final GT DAQ and GMT records:
L1GtPackUnpackAnalyzer::~L1GtPackUnpackAnalyzer ( )
override

Definition at line 50 of file L1GtPackUnpackAnalyzer.cc.

50  {
51  // empty
52 }

Member Function Documentation

void L1GtPackUnpackAnalyzer::analyze ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)
overrideprivate

analyze each event

Definition at line 284 of file L1GtPackUnpackAnalyzer.cc.

References analyzeGMT(), and analyzeGT().

284  {
285  // GT DAQ comparison
286  analyzeGT(iEvent, evSetup);
287 
288  // GMT comparison
289  analyzeGMT(iEvent, evSetup);
290 }
virtual void analyzeGMT(const edm::Event &, const edm::EventSetup &)
GMT comparison.
virtual void analyzeGT(const edm::Event &, const edm::EventSetup &)
GT comparison.
void L1GtPackUnpackAnalyzer::analyzeGMT ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)
privatevirtual

GMT comparison.

Definition at line 234 of file L1GtPackUnpackAnalyzer.cc.

References edm::Event::getByLabel(), L1MuGMTReadoutCollection::getRecords(), edm::HandleBase::isValid(), m_finalGtGmtInputTag, and m_initialMuGmtInputTag.

Referenced by analyze().

234  {
235  // define an output stream to print into
236  // it can then be directed to whatever log level is desired
237  std::ostringstream myCoutStream;
238 
239  // get initial L1MuGMTReadoutCollection
241  iEvent.getByLabel(m_initialMuGmtInputTag, gmtRcInitial);
242 
243  if (!gmtRcInitial.isValid()) {
244  edm::LogError("L1GtPackUnpackAnalyzer")
245  << "Initial L1MuGMTReadoutCollection with input tag \n " << m_initialMuGmtInputTag << " not found.\n\n"
246  << std::endl;
247  return;
248  }
249 
250  std::vector<L1MuGMTReadoutRecord> muRecordsInitial = gmtRcInitial->getRecords();
251 
252  // get final L1MuGMTReadoutCollection
254  iEvent.getByLabel(m_finalGtGmtInputTag, gmtRcFinal);
255 
256  if (!gmtRcFinal.isValid()) {
257  edm::LogError("L1GtPackUnpackAnalyzer")
258  << "Final L1MuGMTReadoutCollection with input tag \n " << m_finalGtGmtInputTag << " not found.\n\n"
259  << std::endl;
260  return;
261  }
262 
263  std::vector<L1MuGMTReadoutRecord> muRecordsFinal = gmtRcFinal->getRecords();
264 
265  int muRecordsInitialSize = muRecordsInitial.size();
266  int muRecordsFinalSize = muRecordsFinal.size();
267 
268  if (muRecordsInitialSize == muRecordsFinalSize) {
269  myCoutStream << "\nInitial and final L1MuGMTReadoutCollection record size: identical.\n";
270  myCoutStream << " Size: " << muRecordsInitialSize << std::endl;
271  } else {
272  myCoutStream << "\nInitial and final L1MuGMTReadoutCollection record size: different.\n";
273  myCoutStream << " Initial size: " << muRecordsInitialSize << std::endl;
274  myCoutStream << " Final size: " << muRecordsFinalSize << std::endl;
275  }
276 
277  edm::LogInfo("L1GtPackUnpackAnalyzer") << myCoutStream.str() << std::endl;
278 
279  myCoutStream.str("");
280  myCoutStream.clear();
281 }
edm::InputTag m_initialMuGmtInputTag
input tag for the initial GMT readout collection:
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
std::vector< L1MuGMTReadoutRecord > const & getRecords() const
edm::InputTag m_finalGtGmtInputTag
input tag for the final GT DAQ and GMT records:
void L1GtPackUnpackAnalyzer::analyzeGT ( const edm::Event iEvent,
const edm::EventSetup evSetup 
)
privatevirtual

GT comparison.

Definition at line 62 of file L1GtPackUnpackAnalyzer.cc.

References L1GtPsbWord::boardId(), L1GtPsbWord::bxInEvent(), edm::Event::getByLabel(), L1GlobalTriggerReadoutRecord::gtFdlVector(), L1GlobalTriggerReadoutRecord::gtfeWord(), L1GlobalTriggerReadoutRecord::gtPsbVector(), edm::HandleBase::isValid(), m_finalGtGmtInputTag, m_initialDaqGtInputTag, L1GlobalTriggerReadoutRecord::muCollectionRefProd(), L1GtPsbWord::print(), L1GtfeWord::print(), and L1GtFdlWord::print().

Referenced by analyze().

62  {
63  // define an output stream to print into
64  // it can then be directed to whatever log level is desired
65  std::ostringstream myCoutStream;
66 
67  // get the initial L1GlobalTriggerReadoutRecord
68  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordInitial;
69  iEvent.getByLabel(m_initialDaqGtInputTag, gtReadoutRecordInitial);
70 
71  if (!gtReadoutRecordInitial.isValid()) {
72  edm::LogError("L1GtTrigReport") << "Initial L1GlobalTriggerReadoutRecord with input tag \n "
73  << m_initialDaqGtInputTag << " not found.\n\n"
74  << std::endl;
75  return;
76  }
77 
78  // get the final L1GlobalTriggerReadoutRecord
79  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordFinal;
80  iEvent.getByLabel(m_finalGtGmtInputTag, gtReadoutRecordFinal);
81 
82  if (!gtReadoutRecordFinal.isValid()) {
83  edm::LogError("L1GtTrigReport") << "Final L1GlobalTriggerReadoutRecord with input tag \n " << m_finalGtGmtInputTag
84  << " not found.\n\n"
85  << std::endl;
86  return;
87  }
88 
89  // compare GTFE
90  const L1GtfeWord& gtfeWordInitial = gtReadoutRecordInitial->gtfeWord();
91  const L1GtfeWord& gtfeWordFinal = gtReadoutRecordFinal->gtfeWord();
92 
93  if (gtfeWordInitial == gtfeWordFinal) {
94  myCoutStream << "\nInitial and final GTFE blocks: identical.\n";
95  gtfeWordInitial.print(myCoutStream);
96  } else {
97  myCoutStream << "\nInitial and final GTFE blocks: different.\n";
98 
99  myCoutStream << "\nInitial GTFE block\n";
100  gtfeWordInitial.print(myCoutStream);
101 
102  myCoutStream << "\nFinal GTFE block\n";
103  gtfeWordFinal.print(myCoutStream);
104  }
105 
106  edm::LogInfo("L1GtPackUnpackAnalyzer") << myCoutStream.str() << std::endl;
107 
108  myCoutStream.str("");
109  myCoutStream.clear();
110 
111  // FDL comparison
112  const std::vector<L1GtFdlWord>& gtFdlVectorInitial = gtReadoutRecordInitial->gtFdlVector();
113  const std::vector<L1GtFdlWord>& gtFdlVectorFinal = gtReadoutRecordFinal->gtFdlVector();
114 
115  int gtFdlVectorInitialSize = gtFdlVectorInitial.size();
116  int gtFdlVectorFinalSize = gtFdlVectorFinal.size();
117 
118  if (gtFdlVectorInitialSize == gtFdlVectorFinalSize) {
119  myCoutStream << "\nInitial and final FDL vector size: identical.\n";
120  myCoutStream << " Size: " << gtFdlVectorInitialSize << std::endl;
121 
122  for (int iFdl = 0; iFdl < gtFdlVectorInitialSize; ++iFdl) {
123  const L1GtFdlWord& fdlWordInitial = gtFdlVectorInitial[iFdl];
124  const L1GtFdlWord& fdlWordFinal = gtFdlVectorFinal[iFdl];
125 
126  if (fdlWordInitial == fdlWordFinal) {
127  myCoutStream << "\nInitial and final FDL blocks: identical.\n";
128  fdlWordInitial.print(myCoutStream);
129 
130  } else {
131  myCoutStream << "\nInitial and final FDL blocks: different.\n";
132 
133  myCoutStream << "\nInitial FDL block\n";
134  fdlWordInitial.print(myCoutStream);
135 
136  myCoutStream << "\nFinal FDL block\n";
137  fdlWordFinal.print(myCoutStream);
138  }
139  }
140  } else {
141  myCoutStream << "\nInitial and final FDL vector size: different.\n";
142  myCoutStream << " Initial size: " << gtFdlVectorInitialSize << std::endl;
143  myCoutStream << " Final size: " << gtFdlVectorFinalSize << std::endl;
144  }
145 
146  edm::LogInfo("L1GtPackUnpackAnalyzer") << myCoutStream.str() << std::endl;
147 
148  myCoutStream.str("");
149  myCoutStream.clear();
150 
151  // PSB comparison
152  const std::vector<L1GtPsbWord>& gtPsbVectorInitial = gtReadoutRecordInitial->gtPsbVector();
153  const std::vector<L1GtPsbWord>& gtPsbVectorFinal = gtReadoutRecordFinal->gtPsbVector();
154 
155  int gtPsbVectorInitialSize = gtPsbVectorInitial.size();
156  int gtPsbVectorFinalSize = gtPsbVectorFinal.size();
157 
158  if (gtPsbVectorInitialSize == gtPsbVectorFinalSize) {
159  myCoutStream << "\nInitial and final PSB vector size: identical.\n";
160  myCoutStream << " Size: " << gtPsbVectorInitialSize << std::endl;
161 
162  // the order of PSB block in the gtPsbVector is different in emulator and unpacker
163  // TODO can be fixed?
164  for (int iPsb = 0; iPsb < gtPsbVectorInitialSize; ++iPsb) {
165  const L1GtPsbWord& psbWordInitial = gtPsbVectorInitial[iPsb];
166  const uint16_t boardIdInitial = psbWordInitial.boardId();
167  const int bxInEventInitial = psbWordInitial.bxInEvent();
168 
169  // search the corresponding PSB in the final record using the
170  // BoardId and the BxInEvent
171 
172  bool foundPSB = false;
173 
174  for (int iPsbF = 0; iPsbF < gtPsbVectorFinalSize; ++iPsbF) {
175  const L1GtPsbWord& psbWordFinal = gtPsbVectorFinal[iPsbF];
176  const uint16_t boardIdFinal = psbWordFinal.boardId();
177  const int bxInEventFinal = psbWordFinal.bxInEvent();
178 
179  if ((boardIdFinal == boardIdInitial) && (bxInEventInitial == bxInEventFinal)) {
180  foundPSB = true;
181 
182  // compare the boards
183  if (psbWordInitial == psbWordFinal) {
184  myCoutStream << "\nInitial and final PSB blocks: identical.\n";
185  psbWordInitial.print(myCoutStream);
186 
187  } else {
188  myCoutStream << "\nInitial and final PSB blocks: different.\n";
189 
190  myCoutStream << "\nInitial PSB block\n";
191  psbWordInitial.print(myCoutStream);
192 
193  myCoutStream << "\nFinal PSB block\n";
194  psbWordFinal.print(myCoutStream);
195  }
196  }
197  }
198 
199  if (!foundPSB) {
200  myCoutStream << "\nNo final PSB with boardID = " << boardIdInitial << " and BxINEvent = " << bxInEventInitial
201  << " was found"
202  << "\nInitial and final PSB vectors: different";
203  }
204  }
205  } else {
206  myCoutStream << "\nInitial and final PSB vector size: different.\n";
207  myCoutStream << " Initial size: " << gtPsbVectorInitialSize << std::endl;
208  myCoutStream << " Final size: " << gtPsbVectorFinalSize << std::endl;
209  }
210 
211  edm::LogInfo("L1GtPackUnpackAnalyzer") << myCoutStream.str() << std::endl;
212 
213  myCoutStream.str("");
214  myCoutStream.clear();
215 
216  // get reference to muon collection
217  const edm::RefProd<L1MuGMTReadoutCollection> muCollRefProdInitial = gtReadoutRecordInitial->muCollectionRefProd();
218 
219  const edm::RefProd<L1MuGMTReadoutCollection> muCollRefProdFinal = gtReadoutRecordFinal->muCollectionRefProd();
220 
221  if (muCollRefProdInitial == muCollRefProdFinal) {
222  myCoutStream << "\nInitial and final RefProd<L1MuGMTReadoutCollection>: identical.\n";
223  } else {
224  myCoutStream << "\nInitial and final RefProd<L1MuGMTReadoutCollection>: different.\n";
225  }
226 
227  edm::LogInfo("L1GtPackUnpackAnalyzer") << myCoutStream.str() << std::endl;
228 
229  myCoutStream.str("");
230  myCoutStream.clear();
231 }
const cms_uint16_t boardId() const
get/set board ID
Definition: L1GtPsbWord.h:58
virtual void print(std::ostream &myCout) const
pretty print the content of a L1GtfeWord
Definition: L1GtfeWord.cc:253
const std::vector< L1GtFdlWord > gtFdlVector() const
get the vector of L1GtFdlWord
const L1GtfeWord gtfeWord() const
get / set GTFE word (record) in the GT readout record
const std::vector< L1GtPsbWord > gtPsbVector() const
get the vector of L1GtPsbWord
bool isValid() const
Definition: HandleBase.h:70
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:488
const edm::RefProd< L1MuGMTReadoutCollection > muCollectionRefProd() const
get / set reference to L1MuGMTReadoutCollection
void print(std::ostream &myCout) const
pretty print the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:595
void print(std::ostream &myCout) const
pretty print
Definition: L1GtPsbWord.cc:348
const int bxInEvent() const
get/set bunch cross in the GT event record
Definition: L1GtPsbWord.h:71
edm::InputTag m_initialDaqGtInputTag
input tag for the initial GT DAQ record:
edm::InputTag m_finalGtGmtInputTag
input tag for the final GT DAQ and GMT records:
void L1GtPackUnpackAnalyzer::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 57 of file L1GtPackUnpackAnalyzer.cc.

57  {
58  // empty
59 }
void L1GtPackUnpackAnalyzer::endJob ( void  )
overrideprivatevirtual

end of job

Reimplemented from edm::EDAnalyzer.

Definition at line 293 of file L1GtPackUnpackAnalyzer.cc.

293  {
294  // empty
295 }

Member Data Documentation

edm::InputTag L1GtPackUnpackAnalyzer::m_finalGtGmtInputTag
private

input tag for the final GT DAQ and GMT records:

Definition at line 64 of file L1GtPackUnpackAnalyzer.h.

Referenced by analyzeGMT(), analyzeGT(), and L1GtPackUnpackAnalyzer().

edm::InputTag L1GtPackUnpackAnalyzer::m_initialDaqGtInputTag
private

input tag for the initial GT DAQ record:

Definition at line 58 of file L1GtPackUnpackAnalyzer.h.

Referenced by analyzeGT(), and L1GtPackUnpackAnalyzer().

edm::InputTag L1GtPackUnpackAnalyzer::m_initialMuGmtInputTag
private

input tag for the initial GMT readout collection:

Definition at line 61 of file L1GtPackUnpackAnalyzer.h.

Referenced by analyzeGMT(), and L1GtPackUnpackAnalyzer().