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
L1GtPackUnpackAnalyzer Class Reference

#include <L1GtPackUnpackAnalyzer.h>

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

Public Member Functions

 L1GtPackUnpackAnalyzer (const edm::ParameterSet &)
 
 ~L1GtPackUnpackAnalyzer ()
 
- 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
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) 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 &)
 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...
 
virtual void beginJob ()
 
virtual void endJob ()
 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
 
- 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

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 32 of file L1GtPackUnpackAnalyzer.cc.

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

33 {
34 
35  // input tag for the initial GT DAQ record:
36  m_initialDaqGtInputTag = parSet.getParameter<edm::InputTag>("InitialDaqGtInputTag");
37 
38  // input tag for the initial GMT readout collection:
39  m_initialMuGmtInputTag = parSet.getParameter<edm::InputTag>("InitialMuGmtInputTag");
40 
41  // input tag for the final GT DAQ and GMT records:
42  m_finalGtGmtInputTag = parSet.getParameter<edm::InputTag>("FinalGtGmtInputTag");
43 
44 
45  edm::LogInfo("L1GtPackUnpackAnalyzer")
46  << "\nInput tag for the initial GT DAQ record: "
47  << m_initialDaqGtInputTag << " \n"
48  << "\nInput tag for the initial GMT readout collection: "
49  << m_initialMuGmtInputTag << " \n"
50  << "\nInput tag for the final GT DAQ and GMT records: "
51  << m_finalGtGmtInputTag << " \n"
52  << std::endl;
53 
54 }
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 ( )

Definition at line 57 of file L1GtPackUnpackAnalyzer.cc.

58 {
59  // empty
60 }

Member Function Documentation

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

analyze each event

Implements edm::EDAnalyzer.

Definition at line 349 of file L1GtPackUnpackAnalyzer.cc.

References analyzeGMT(), and analyzeGT().

350 {
351 
352  // GT DAQ comparison
353  analyzeGT(iEvent, evSetup);
354 
355  // GMT comparison
356  analyzeGMT(iEvent, evSetup);
357 
358 }
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 288 of file L1GtPackUnpackAnalyzer.cc.

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

Referenced by analyze().

289  {
290 
291  // define an output stream to print into
292  // it can then be directed to whatever log level is desired
293  std::ostringstream myCoutStream;
294 
295  // get initial L1MuGMTReadoutCollection
297  iEvent.getByLabel(m_initialMuGmtInputTag, gmtRcInitial);
298 
299  if (!gmtRcInitial.isValid()) {
300  edm::LogError("L1GtPackUnpackAnalyzer")
301  << "Initial L1MuGMTReadoutCollection with input tag \n "
302  << m_initialMuGmtInputTag << " not found.\n\n"
303  << std::endl;
304  return;
305 
306  }
307 
308  std::vector<L1MuGMTReadoutRecord> muRecordsInitial = gmtRcInitial->getRecords();
309 
310  // get final L1MuGMTReadoutCollection
312  iEvent.getByLabel(m_finalGtGmtInputTag, gmtRcFinal);
313 
314  if (!gmtRcFinal.isValid()) {
315  edm::LogError("L1GtPackUnpackAnalyzer")
316  << "Final L1MuGMTReadoutCollection with input tag \n "
317  << m_finalGtGmtInputTag << " not found.\n\n"
318  << std::endl;
319  return;
320 
321  }
322 
323  std::vector<L1MuGMTReadoutRecord> muRecordsFinal = gmtRcFinal->getRecords();
324 
325  int muRecordsInitialSize = muRecordsInitial.size();
326  int muRecordsFinalSize = muRecordsFinal.size();
327 
328  if (muRecordsInitialSize == muRecordsFinalSize) {
329  myCoutStream
330  << "\nInitial and final L1MuGMTReadoutCollection record size: identical.\n";
331  myCoutStream << " Size: " << muRecordsInitialSize << std::endl;
332  }
333  else {
334  myCoutStream
335  << "\nInitial and final L1MuGMTReadoutCollection record size: different.\n";
336  myCoutStream << " Initial size: " << muRecordsInitialSize << std::endl;
337  myCoutStream << " Final size: " << muRecordsFinalSize << std::endl;
338 
339  }
340 
341  edm::LogInfo("L1GtPackUnpackAnalyzer") << myCoutStream.str() << std::endl;
342 
343  myCoutStream.str("");
344  myCoutStream.clear();
345 
346 }
edm::InputTag m_initialMuGmtInputTag
input tag for the initial GMT readout collection:
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:402
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 72 of file L1GtPackUnpackAnalyzer.cc.

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

Referenced by analyze().

73 {
74 
75  // define an output stream to print into
76  // it can then be directed to whatever log level is desired
77  std::ostringstream myCoutStream;
78 
79  // get the initial L1GlobalTriggerReadoutRecord
80  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordInitial;
81  iEvent.getByLabel(m_initialDaqGtInputTag, gtReadoutRecordInitial);
82 
83  if (!gtReadoutRecordInitial.isValid()) {
84  edm::LogError("L1GtTrigReport")
85  << "Initial L1GlobalTriggerReadoutRecord with input tag \n "
86  << m_initialDaqGtInputTag << " not found.\n\n"
87  << std::endl;
88  return;
89 
90  }
91 
92  // get the final L1GlobalTriggerReadoutRecord
93  edm::Handle<L1GlobalTriggerReadoutRecord> gtReadoutRecordFinal;
94  iEvent.getByLabel(m_finalGtGmtInputTag, gtReadoutRecordFinal);
95 
96  if (!gtReadoutRecordFinal.isValid()) {
97  edm::LogError("L1GtTrigReport")
98  << "Final L1GlobalTriggerReadoutRecord with input tag \n "
99  << m_finalGtGmtInputTag << " not found.\n\n"
100  << std::endl;
101  return;
102 
103  }
104 
105  // compare GTFE
106  const L1GtfeWord& gtfeWordInitial = gtReadoutRecordInitial->gtfeWord();
107  const L1GtfeWord& gtfeWordFinal = gtReadoutRecordFinal->gtfeWord();
108 
109  if (gtfeWordInitial == gtfeWordFinal) {
110  myCoutStream << "\nInitial and final GTFE blocks: identical.\n";
111  gtfeWordInitial.print(myCoutStream);
112  } else {
113  myCoutStream << "\nInitial and final GTFE blocks: different.\n";
114 
115  myCoutStream << "\nInitial GTFE block\n";
116  gtfeWordInitial.print(myCoutStream);
117 
118  myCoutStream << "\nFinal GTFE block\n";
119  gtfeWordFinal.print(myCoutStream);
120 
121  }
122 
123  edm::LogInfo("L1GtPackUnpackAnalyzer")
124  << myCoutStream.str()
125  << std::endl;
126 
127 
128  myCoutStream.str("");
129  myCoutStream.clear();
130 
131  // FDL comparison
132  const std::vector<L1GtFdlWord>& gtFdlVectorInitial = gtReadoutRecordInitial->gtFdlVector();
133  const std::vector<L1GtFdlWord>& gtFdlVectorFinal = gtReadoutRecordFinal->gtFdlVector();
134 
135  int gtFdlVectorInitialSize = gtFdlVectorInitial.size();
136  int gtFdlVectorFinalSize = gtFdlVectorFinal.size();
137 
138  if (gtFdlVectorInitialSize == gtFdlVectorFinalSize) {
139  myCoutStream << "\nInitial and final FDL vector size: identical.\n";
140  myCoutStream << " Size: " << gtFdlVectorInitialSize << std::endl;
141 
142  for (int iFdl = 0; iFdl < gtFdlVectorInitialSize; ++iFdl) {
143 
144  const L1GtFdlWord& fdlWordInitial = gtFdlVectorInitial[iFdl];
145  const L1GtFdlWord& fdlWordFinal = gtFdlVectorFinal[iFdl];
146 
147  if (fdlWordInitial == fdlWordFinal) {
148  myCoutStream << "\nInitial and final FDL blocks: identical.\n";
149  fdlWordInitial.print(myCoutStream);
150 
151  } else {
152  myCoutStream << "\nInitial and final FDL blocks: different.\n";
153 
154  myCoutStream << "\nInitial FDL block\n";
155  fdlWordInitial.print(myCoutStream);
156 
157  myCoutStream << "\nFinal FDL block\n";
158  fdlWordFinal.print(myCoutStream);
159 
160  }
161 
162  }
163  }
164  else {
165  myCoutStream << "\nInitial and final FDL vector size: different.\n";
166  myCoutStream << " Initial size: " << gtFdlVectorInitialSize << std::endl;
167  myCoutStream << " Final size: " << gtFdlVectorFinalSize << std::endl;
168 
169  }
170 
171  edm::LogInfo("L1GtPackUnpackAnalyzer") << myCoutStream.str() << std::endl;
172 
173  myCoutStream.str("");
174  myCoutStream.clear();
175 
176 
177  // PSB comparison
178  const std::vector<L1GtPsbWord>& gtPsbVectorInitial = gtReadoutRecordInitial->gtPsbVector();
179  const std::vector<L1GtPsbWord>& gtPsbVectorFinal = gtReadoutRecordFinal->gtPsbVector();
180 
181  int gtPsbVectorInitialSize = gtPsbVectorInitial.size();
182  int gtPsbVectorFinalSize = gtPsbVectorFinal.size();
183 
184  if (gtPsbVectorInitialSize == gtPsbVectorFinalSize) {
185  myCoutStream << "\nInitial and final PSB vector size: identical.\n";
186  myCoutStream << " Size: " << gtPsbVectorInitialSize << std::endl;
187 
188  // the order of PSB block in the gtPsbVector is different in emulator and unpacker
189  // TODO can be fixed?
190  for (int iPsb = 0; iPsb < gtPsbVectorInitialSize; ++iPsb) {
191 
192  const L1GtPsbWord& psbWordInitial = gtPsbVectorInitial[iPsb];
193  const boost::uint16_t boardIdInitial = psbWordInitial.boardId();
194  const int bxInEventInitial = psbWordInitial.bxInEvent();
195 
196  // search the corresponding PSB in the final record using the
197  // BoardId and the BxInEvent
198 
199  bool foundPSB = false;
200 
201  for (int iPsbF = 0; iPsbF < gtPsbVectorFinalSize; ++iPsbF) {
202 
203  const L1GtPsbWord& psbWordFinal = gtPsbVectorFinal[iPsbF];
204  const boost::uint16_t boardIdFinal = psbWordFinal.boardId();
205  const int bxInEventFinal = psbWordFinal.bxInEvent();
206 
207  if ((boardIdFinal == boardIdInitial) && (bxInEventInitial
208  == bxInEventFinal)) {
209 
210  foundPSB = true;
211 
212  // compare the boards
213  if (psbWordInitial == psbWordFinal) {
214  myCoutStream
215  << "\nInitial and final PSB blocks: identical.\n";
216  psbWordInitial.print(myCoutStream);
217 
218  }
219  else {
220  myCoutStream
221  << "\nInitial and final PSB blocks: different.\n";
222 
223  myCoutStream << "\nInitial PSB block\n";
224  psbWordInitial.print(myCoutStream);
225 
226  myCoutStream << "\nFinal PSB block\n";
227  psbWordFinal.print(myCoutStream);
228 
229  }
230  }
231 
232  }
233 
234  if (!foundPSB) {
235  myCoutStream
236  << "\nNo final PSB with boardID = " << boardIdInitial
237  << " and BxINEvent = " << bxInEventInitial << " was found"
238  << "\nInitial and final PSB vectors: different";
239 
240  }
241 
242  }
243  }
244  else {
245  myCoutStream << "\nInitial and final PSB vector size: different.\n";
246  myCoutStream << " Initial size: " << gtPsbVectorInitialSize << std::endl;
247  myCoutStream << " Final size: " << gtPsbVectorFinalSize << std::endl;
248 
249  }
250 
251  edm::LogInfo("L1GtPackUnpackAnalyzer") << myCoutStream.str() << std::endl;
252 
253  myCoutStream.str("");
254  myCoutStream.clear();
255 
256 
257 
258 
259 
260  // get reference to muon collection
261  const edm::RefProd<L1MuGMTReadoutCollection> muCollRefProdInitial =
262  gtReadoutRecordInitial->muCollectionRefProd();
263 
264  const edm::RefProd<L1MuGMTReadoutCollection> muCollRefProdFinal =
265  gtReadoutRecordFinal->muCollectionRefProd();
266 
267  if (muCollRefProdInitial == muCollRefProdFinal) {
268  myCoutStream
269  << "\nInitial and final RefProd<L1MuGMTReadoutCollection>: identical.\n";
270  }
271  else {
272  myCoutStream
273  << "\nInitial and final RefProd<L1MuGMTReadoutCollection>: different.\n";
274 
275  }
276 
277  edm::LogInfo("L1GtPackUnpackAnalyzer")
278  << myCoutStream.str()
279  << std::endl;
280 
281  myCoutStream.str("");
282  myCoutStream.clear();
283 
284 
285 }
const cms_uint16_t boardId() const
get/set board ID
Definition: L1GtPsbWord.h:66
virtual void print(std::ostream &myCout) const
pretty print the content of a L1GtfeWord
Definition: L1GtfeWord.cc:321
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:402
void print(std::ostream &myCout) const
pretty print the content of a L1GtFdlWord
Definition: L1GtFdlWord.cc:766
void print(std::ostream &myCout) const
pretty print
Definition: L1GtPsbWord.cc:453
const int bxInEvent() const
get/set bunch cross in the GT event record
Definition: L1GtPsbWord.h:87
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  )
privatevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 65 of file L1GtPackUnpackAnalyzer.cc.

66 {
67  // empty
68 }
void L1GtPackUnpackAnalyzer::endJob ( void  )
privatevirtual

end of job

Reimplemented from edm::EDAnalyzer.

Definition at line 362 of file L1GtPackUnpackAnalyzer.cc.

363 {
364 
365  // empty
366 
367 }

Member Data Documentation

edm::InputTag L1GtPackUnpackAnalyzer::m_finalGtGmtInputTag
private

input tag for the final GT DAQ and GMT records:

Definition at line 68 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 62 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 65 of file L1GtPackUnpackAnalyzer.h.

Referenced by analyzeGMT(), and L1GtPackUnpackAnalyzer().