ATLAS Offline Software
TrigT1CTPDefs.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 
7 // tdaq-common includes for CTP format definition
8 //#include "CTPfragment/CTPdataformat.h"
9 #include "CTPfragment/CTPdataformatVersion.h"
10 
11 namespace LVL1CTP {
12 
13  const std::string convertRawCTPData(const std::vector<uint32_t>& data, const bool longFormat, int ctpFormatVersionNumber)
14  {
15  std::ostringstream s;
16 
17 
18  CTPdataformatVersion ctpVersion(ctpFormatVersionNumber);
19 
20  // time is only stored once for the whole fragment
21  for (size_t i(0); (i < ctpVersion.getNumberTimeWords() ) && (i < data.size()); ++i) {
22  if (i == 0 || longFormat) s << "\nTime";
23  if (longFormat) s << std::setw(1) << i;
24  s << " " << std::setw(8) << data[i];
25  if (longFormat) s << std::endl;
26  }
27 
28  // return if data content is too short
29  if (data.size() < 2) return s.str();
30 
31 
32  // loop over the rest of the data fragment
33  for (unsigned int k(0); k < (data.size()-2)/ctpVersion.getDAQwordsPerBunch(); ++k) {
34 
35  // print single fragment
36 
37  // PIT
38  for (size_t i(0), p(k*ctpVersion.getDAQwordsPerBunch() + ctpVersion.getTIPpos());
39  (i < ctpVersion.getTIPwords() ) && (p < data.size());
40  ++i, ++p) {
41  if (i == 0 || longFormat) s << "\nTIP";
42  if (longFormat) s << std::setw(1) << i;
43  s << " 0x" << std::hex << std::setw(8) << std::setfill( '0' ) << data[p] << std::dec << std::setfill(' ');
44  if (longFormat) s << std::endl;
45  }
46 
47  // TBP
48  for (size_t i(0), p(k*ctpVersion.getDAQwordsPerBunch() + ctpVersion.getTBPpos());
49  (i < ctpVersion.getTBPwords() ) && (p < data.size());
50  ++i, ++p) {
51  if (i == 0 || longFormat) s << "\nTBP";
52  if (longFormat) s << std::setw(1) << i;
53  s << " 0x" << std::hex << std::setw(8) << std::setfill( '0' ) << data[p] << std::dec << std::setfill(' ');
54  if (longFormat) s << std::endl;
55  }
56 
57  // TAP
58  for (size_t i(0), p(k*ctpVersion.getDAQwordsPerBunch() + ctpVersion.getTAPpos());
59  (i < ctpVersion.getTAPwords() ) && (p < data.size());
60  ++i, ++p) {
61  if (i == 0 || longFormat) s << "\nTAP";
62  if (longFormat) s << std::setw(1) << i;
63  s << " 0x" << std::hex << std::setw(8) << std::setfill( '0' ) << data[p] << std::dec << std::setfill(' ');
64  if (longFormat) s << std::endl;
65  }
66 
67  // TAV
68  for (size_t i(0), p(k*ctpVersion.getDAQwordsPerBunch() + ctpVersion.getTAVpos());
69  (i < ctpVersion.getTAVwords() ) && (p < data.size());
70  ++i, ++p) {
71  if (i == 0 || longFormat) s << "\nTAV";
72  if (longFormat) s << std::setw(1) << i;
73  s << " 0x" << std::hex << std::setw(8) << std::setfill( '0' ) << data[p] << std::dec << std::setfill(' ');
74  if (longFormat) s << std::endl;
75  }
76 
77  }
78 
79  return s.str();
80  }
81 
82 } //namespace LVL1CTP
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
lumiFormat.i
int i
Definition: lumiFormat.py:85
LVL1CTP::convertRawCTPData
const std::string convertRawCTPData(const std::vector< uint32_t > &data, const bool longFormat, int ctpFormatVersionNumber)
helper function to dump raw CTP content
Definition: TrigT1CTPDefs.cxx:13
LVL1CTP
Definition: Lvl1ResultAccessTool.h:20
fitman.k
k
Definition: fitman.py:528
TrigT1CTPDefs.h