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
 EDAnalyzer ()
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndex indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndex > &) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) 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
 
typedef WorkerT< EDAnalyzerWorkerType
 
- 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::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
CurrentProcessingContext const * currentContext () const
 
- 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

$Date$ $Revision$

Description: see header file.

Implementation: <TODO: enter implementation details>

Author
: Vasile Mihai Ghete - HEPHY Vienna

$Date$ $Revision$

Definition at line 38 of file L1GtPackUnpackAnalyzer.h.

Constructor & Destructor Documentation

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

Definition at line 34 of file L1GtPackUnpackAnalyzer.cc.

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

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

60 {
61  // empty
62 }

Member Function Documentation

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

analyze each event

Implements edm::EDAnalyzer.

Definition at line 351 of file L1GtPackUnpackAnalyzer.cc.

References analyzeGMT(), and analyzeGT().

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

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

Referenced by analyze().

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

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

68 {
69  // empty
70 }
void L1GtPackUnpackAnalyzer::endJob ( void  )
privatevirtual

end of job

Reimplemented from edm::EDAnalyzer.

Definition at line 364 of file L1GtPackUnpackAnalyzer.cc.

365 {
366 
367  // empty
368 
369 }

Member Data Documentation

edm::InputTag L1GtPackUnpackAnalyzer::m_finalGtGmtInputTag
private

input tag for the final GT DAQ and GMT records:

Definition at line 70 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 64 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 67 of file L1GtPackUnpackAnalyzer.h.

Referenced by analyzeGMT(), and L1GtPackUnpackAnalyzer().