ATLAS Offline Software
Loading...
Searching...
No Matches
L1Topo Namespace Reference

Classes

class  Fibre
 Represents the L1Topo fibre word of the L1Topo DAQ header, with decoder and encoder. More...
class  Header
 Represents the L1Topo header word of the L1Topo DAQ data, with decoder and encoder. More...
class  L1TopoFPGA
class  L1TopoResult
class  L1TopoROD
class  L1TopoTOB
 Represents the L1Topo TOB word of the L1Topo ROI data, with decode and encoder. More...
class  ModuleID
 Represents the L1Topo module ID, with decoder and encoder. More...
class  Status
 Represents the L1Topo status word of the L1Topo DAQ header, with decoder and encoder. More...

Enumerations

enum class  BlockTypes {
  HEADER =0xc , FIBRE =0xd , STATUS =0xe , EM_TOB =0x0 ,
  TAU_TOB =0x1 , MUON_TOB =0x2 , JET1_TOB =0x4 , JET2_TOB =0x5 ,
  ENERGY_TOB =0x6 , L1TOPO_TOB =0x8
}
 L1Topo data block types and their 4-bit codes. More...
enum class  Error { ROB_ERROR =0 , ROD_ERROR , SLINK_STATUS_ERROR }
 The different types of error that can be flagged in the L1TopoRDO. More...

Functions

L1Topo::BlockTypes blockType (const uint32_t word, uint32_t offset=28, uint32_t size=0x0f)
 Function to return the block type of a data word from L1Topo.
std::string blockTypeString (L1Topo::BlockTypes type)
std::ostream & operator<< (std::ostream &, const Error)
 Helper to print errors as text rather than numbers.
std::ostream & operator<< (std::ostream &, const std::vector< Error > &)
 Helper to print vectors of errors.
std::ostream & operator<< (std::ostream &, const Fibre &)
 Helper for printing.
int signedBCN (const uint32_t sign, uint32_t offset)
 helper function to return a relative bunch crossing as a signed integer, given the sign bit and offset that are encoded in the header
std::pair< uint32_t, uint32_t > signAndOffsetBCN (const int bcn)
 reverse helper function to return the sign and offset bits given a relative bunch crossing number
std::ostream & operator<< (std::ostream &, const Header &)
 Helper for printing.
uint32_t decode (const uint32_t &word, const uint32_t &offset, const uint32_t &size)
 Helper function to decode word based on offset and size.
std::string formatHex8 (uint32_t word)
 Helper function to format a 32-bit integer as an 8-digit hex number for printing.
std::string formatHex4 (uint32_t word)
 Helper function to format a 32-bit integer as a 4-digit hex number for printing.
const std::string formatVecHex8 (const std::vector< uint32_t > &vec)
 Helper function to format a vector of 32-bit integers as 8-digit hex numbers for printing.
unsigned int triggerBitIndex (uint32_t moduleId, const L1Topo::L1TopoTOB &)
 OUT OF DATE DO NOT USE Helper to calculate the index needed to pack trigger bits into the full 128-bit decision. See 4-bit part of L1Topo TOB definition in https://twiki.cern.ch/twiki/pub/Atlas/L1CaloUpgrade/ROD_data_format_v1.0.4.xlsx.
unsigned int triggerBitIndexNew (uint32_t moduleId, const L1Topo::L1TopoTOB &, unsigned int bitIdx)
 Helper to calculate the index needed to pack trigger bits into the full 128-bit decision. See 4-bit part of L1Topo TOB definition in https://twiki.cern.ch/twiki/pub/Atlas/L1CaloUpgrade/ROD_data_format_v1.0.4.xlsx ; same as TriggerLine::calcCounter()?
unsigned int triggerBitIndexPhase1 (uint32_t topo, uint32_t fpga, size_t bitIdx)
std::pair< std::bitset< 128 >, std::bitset< 128 > > getDecisionAndOverflowBits (const L1TopoRDOCollection &)
 Get the trigger decision and overflow bits from the L1Topo ROI data block 'L1Topo TOB' and order them correctly in a bitset. Reference needed for layout.
std::ostream & operator<< (std::ostream &, const L1TopoFPGA &)
std::ostream & operator<< (std::ostream &, const L1TopoROD &)
std::ostream & operator<< (std::ostream &, const L1TopoTOB &)
 Helper for printing.
bool operator== (const L1TopoTOB &, const L1TopoTOB &)
 Comparison operators, based on word.
bool operator!= (const L1TopoTOB &, const L1TopoTOB &)
 Comparison operators, based on word.
bool operator< (const L1TopoTOB &, const L1TopoTOB &)
 Comparison operators, based on word.
bool operator> (const L1TopoTOB &, const L1TopoTOB &)
 Comparison operators, based on word.
std::ostream & operator<< (std::ostream &os, const ModuleID &)
 print helpers
std::ostream & operator<< (std::ostream &, const Status &)

Variables

static const std::map< Error, std::string > errorText
 Define the text to print for each error type above - bad design to put it in the header file?

Enumeration Type Documentation

◆ BlockTypes

enum class L1Topo::BlockTypes
strong

L1Topo data block types and their 4-bit codes.

Enumerator
HEADER 
FIBRE 
STATUS 
EM_TOB 
TAU_TOB 
MUON_TOB 
JET1_TOB 
JET2_TOB 
ENERGY_TOB 
L1TOPO_TOB 

Definition at line 14 of file BlockTypes.h.

◆ Error

enum class L1Topo::Error
strong

The different types of error that can be flagged in the L1TopoRDO.

Enumerator
ROB_ERROR 
ROD_ERROR 
SLINK_STATUS_ERROR 

Definition at line 16 of file Error.h.

@ ROB_ERROR
ROB status error.
@ SLINK_STATUS_ERROR
Definition Error.h:16

Function Documentation

◆ blockType()

L1Topo::BlockTypes L1Topo::blockType ( const uint32_t word,
uint32_t offset = 28,
uint32_t size = 0x0f )

Function to return the block type of a data word from L1Topo.

Definition at line 9 of file BlockTypes.cxx.

9 {
10 return static_cast<BlockTypes>(word>>offset & size);
11 }
BlockTypes
L1Topo data block types and their 4-bit codes.
Definition BlockTypes.h:14

◆ blockTypeString()

std::string L1Topo::blockTypeString ( L1Topo::BlockTypes type)

Definition at line 14 of file BlockTypes.cxx.

14 {
15 if (type==L1Topo::BlockTypes::HEADER) {return "header";}
16 else if (type==L1Topo::BlockTypes::FIBRE) {return "fibre";}
17 else if (type==L1Topo::BlockTypes::STATUS) {return "status";}
18 else if (type==L1Topo::BlockTypes::EM_TOB) {return "EM TOB";}
19 else if (type==L1Topo::BlockTypes::TAU_TOB) {return "Tau TOB";}
20 else if (type==L1Topo::BlockTypes::MUON_TOB) {return "Muon TOB";}
21 else if (type==L1Topo::BlockTypes::JET1_TOB) {return "Jet1 TOB";}
22 else if (type==L1Topo::BlockTypes::JET2_TOB) {return "Jet2 TOB";}
23 else if (type==L1Topo::BlockTypes::ENERGY_TOB) {return "Energy TOB";}
24 else if (type==L1Topo::BlockTypes::L1TOPO_TOB) {return "L1Topo TOB";}
25 else {return "unknown";}
26 }

◆ decode()

uint32_t L1Topo::decode ( const uint32_t & word,
const uint32_t & offset,
const uint32_t & size )

Helper function to decode word based on offset and size.

Definition at line 107 of file Trigger/TrigT1/L1Topo/L1TopoRDO/src/Helpers.cxx.

107 {
108 return static_cast<uint32_t>((word >> offset) & size);
109 }

◆ formatHex4()

std::string L1Topo::formatHex4 ( uint32_t word)

Helper function to format a 32-bit integer as a 4-digit hex number for printing.

Definition at line 117 of file Trigger/TrigT1/L1Topo/L1TopoRDO/src/Helpers.cxx.

117 {
118 std::ostringstream s;
119 s << std::showbase << std::hex << std::internal << std::setfill ('0') << std::setw( 6 ) << word << std::dec << std::noshowbase;
120 return s.str();
121 }

◆ formatHex8()

std::string L1Topo::formatHex8 ( uint32_t word)

Helper function to format a 32-bit integer as an 8-digit hex number for printing.

Definition at line 111 of file Trigger/TrigT1/L1Topo/L1TopoRDO/src/Helpers.cxx.

111 {
112 std::ostringstream s;
113 s << std::showbase << std::hex << std::internal << std::setfill ('0') << std::setw(10) << word << std::dec << std::noshowbase;
114 return s.str();
115 }

◆ formatVecHex8()

const std::string L1Topo::formatVecHex8 ( const std::vector< uint32_t > & vec)

Helper function to format a vector of 32-bit integers as 8-digit hex numbers for printing.

Definition at line 124 of file Trigger/TrigT1/L1Topo/L1TopoRDO/src/Helpers.cxx.

125{
126 std::ostringstream s;
127 s<<"[ ";
128 for (auto elem: vec){
129 s<<std::hex<<std::showbase<<std::setfill('0')<<std::setw(10)
130 <<elem<<" "<<std::dec<<std::noshowbase;
131 }
132 s<<"]";
133 return s.str();
134}
std::vector< size_t > vec

◆ getDecisionAndOverflowBits()

std::pair< std::bitset< 128 >, std::bitset< 128 > > L1Topo::getDecisionAndOverflowBits ( const L1TopoRDOCollection & col)

Get the trigger decision and overflow bits from the L1Topo ROI data block 'L1Topo TOB' and order them correctly in a bitset. Reference needed for layout.

Definition at line 169 of file Trigger/TrigT1/L1Topo/L1TopoRDO/src/Helpers.cxx.

169 {
170
171 // There is no uint128_t so a bit-wise approach is needed.
172 std::bitset<128> decision;
173 std::bitset<128> overflow;
174
175 //std::cout << "L1Topo::getDecisionAndOverflowBits: number of RDOs " << col.size() << std::endl;
176
177 for (L1TopoRDOCollection::const_iterator pRDO = col.begin(); pRDO != col.end(); ++pRDO){
178 const std::vector<uint32_t> data = (*pRDO)->getDataWords();
179 //std::cout << "L1Topo::getDecisionAndOverflowBits: number of data words " << data.size() << std::endl;
180 for(const uint32_t word: data){
182 L1Topo::L1TopoTOB c(word);
183 const uint32_t triggerByte = c.trigger_bits();
184 const uint32_t overflowByte = c.overflow_bits();
185 // Take one bit at a time and set it in the bitset
186 //std::cout << "L1Topo::getDecisionAndOverflowBits: " << c;
187 for (unsigned int i=0; i<8; ++i){
188 const unsigned int index = L1Topo::triggerBitIndexNew((*pRDO)->getSourceID(),c,i);
189 decision[index]=( triggerByte >>i)&1;
190 overflow[index]=(overflowByte >>i)&1;
191 }
192 //std::cout << " index " << index << " updated decision " << decision << std::endl;
193 //std::cout << " index " << index << " updated overflow " << overflow << std::endl;
194 }
195 else{
196 //std::cout << "L1Topo::getDecisionAndOverflowBits: skipping block as not L1Topo_TOB " << L1Topo::formatHex8(word) << std::endl;
197 }
198 }
199 }
200 return std::pair< std::bitset<128>,std::bitset<128> >(decision,overflow);
201 }
char data[hepevt_bytes_allocation_ATLAS]
Definition HepEvt.cxx:11
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Represents the L1Topo TOB word of the L1Topo ROI data, with decode and encoder.
Definition L1TopoTOB.h:17
L1Topo::BlockTypes blockType(const uint32_t word, uint32_t offset=28, uint32_t size=0x0f)
Function to return the block type of a data word from L1Topo.
Definition BlockTypes.cxx:9
unsigned int triggerBitIndexNew(uint32_t moduleId, const L1Topo::L1TopoTOB &, unsigned int bitIdx)
Helper to calculate the index needed to pack trigger bits into the full 128-bit decision....
Definition index.py:1

◆ operator!=()

bool L1Topo::operator!= ( const L1TopoTOB & lhs,
const L1TopoTOB & rhs )

Comparison operators, based on word.

Definition at line 30 of file L1TopoTOB.cxx.

30 {
31 return (lhs.word()!=rhs.word());
32 }
uint32_t word() const
accessor method for data word
Definition L1TopoTOB.cxx:87

◆ operator<()

bool L1Topo::operator< ( const L1TopoTOB & lhs,
const L1TopoTOB & rhs )

Comparison operators, based on word.

Definition at line 33 of file L1TopoTOB.cxx.

33 {
34 return (lhs.word()<rhs.word());
35 }

◆ operator<<() [1/9]

std::ostream & L1Topo::operator<< ( std::ostream & os,
const Error e )

Helper to print errors as text rather than numbers.

Definition at line 8 of file Error.cxx.

8 {
9 std::string text = "Unknown Error";
10 auto it = errorText.find(e);
11 if (it != errorText.end()){
12 text = it->second;
13 }
14 os << text;
15 return os;
16 }
static const std::map< Error, std::string > errorText
Define the text to print for each error type above - bad design to put it in the header file?
Definition Error.h:18

◆ operator<<() [2/9]

std::ostream & L1Topo::operator<< ( std::ostream & os,
const Fibre & f )

Helper for printing.

Definition at line 56 of file Fibre.cxx.

56 {
57
58 os << " Fibre status,sizes: ";
59 for (unsigned int i=0; i<5 && i<f.status().size() && i<f.count().size(); ++i){
60 os << "(" << f.status().at(i) << "," << f.count().at(i) << ") ";
61 }
62 return os;
63 }

◆ operator<<() [3/9]

std::ostream & L1Topo::operator<< ( std::ostream & os,
const Header & h )

Helper for printing.

Definition at line 89 of file L1Topo/L1TopoRDO/src/Header.cxx.

89 {
90 os << " Block header:"
91 << " version " << h.version()
92 << std::hex
93 << " active_fibres 0x" << h.active_fibres()
94 << " payload_crc 0x" << h.payload_crc()
95 << std::dec
96 << " fpga " << h.fpga()
97 << " relative bcn " << h.bcn()
98 << " last_block " << h.last_block();
99 return os;
100 }
Header file for AthHistogramAlgorithm.

◆ operator<<() [4/9]

std::ostream & L1Topo::operator<< ( std::ostream & os,
const L1TopoFPGA & s )

Definition at line 89 of file L1TopoFPGA.cxx.

89 {
90 os << std::hex << std::showbase << s.fpgaTrailer1() << std::dec <<
91 " Block Size= " << s.fpgaBlockSize() << " topoNumber= " << s.topoNumber() <<
92 " fpgaNumber= " << s.fpgaNumber() << " numSlices= " << s.numSlices() <<
93 " sliceNumber= " << s.sliceNumber() <<
94 "\n" <<
95 std::hex << std::showbase << s.fpgaTrailer2() << std::dec <<
96 " CRC= " << s.crc() <<
97 " Errors: CT= " << s.ct() << " sm= " << s.sm() <<
98 " pe= " <<s.pe() << " lm= " << s.lm() << " hm= " << s.hm() << " pt= " << s.pt() <<
99 std::dec << "\n";
100 return os;
101 }

◆ operator<<() [5/9]

std::ostream & L1Topo::operator<< ( std::ostream & os,
const L1TopoROD & s )

Definition at line 93 of file L1TopoROD.cxx.

93 {
94 os << std::hex << std::showbase << s.rodTrailer1() << std::dec <<
95 " Shelf= " << s.shelf() << " ROD= " << s.rod() <<
96 " Link error map= " << s.linkErrMap() << " Payload length= " << s.payloadLength() <<
97 "\n" <<
98 std::hex << std::showbase << s.rodTrailer2() << std::dec <<
99 " CRC= " << s.crc() << " Link errors= " << s.linkErrs() <<
100 " ROD errors: CT= " << s.ct() << " pc= " << s.pc() << " hc= " << s.hc() <<
101 " pe= " <<s.pe() << " lm= " << s.lm() << " hm= " << s.hm() << " pt= " << s.pt() <<
102 std::dec << "\n";
103 return os;
104 }

◆ operator<<() [6/9]

std::ostream & L1Topo::operator<< ( std::ostream & os,
const L1TopoTOB & c )

Helper for printing.

Definition at line 103 of file L1TopoTOB.cxx.

103 {
104 os << " L1Topo TOB: "
105 << " ctp_signal 0x" << std::hex << c.ctp_signal() << std::dec
106 << " ( index " << c.index() << " clock " << c.clock() << " fpga " << c.fpga() << " )"
107 << " CRC error bits 0b" << std::bitset<5>(c.error_bits())
108 << " overflow bits 0b" << std::bitset<8>(c.overflow_bits())
109 << " trigger bits 0b" << std::bitset<8>(c.trigger_bits())
110 << std::dec << "\n";
111 return os;
112 }

◆ operator<<() [7/9]

std::ostream & L1Topo::operator<< ( std::ostream & os,
const Status & s )

Definition at line 44 of file Status.cxx.

44 {
45 os << " Status: overflow " << s.overflow() << " crc mismatch " << s.crc();
46 return os;
47 }

◆ operator<<() [8/9]

std::ostream & L1Topo::operator<< ( std::ostream & os,
const std::vector< Error > & v )

Helper to print vectors of errors.

Definition at line 18 of file Error.cxx.

18 {
19 os << "[";
20 std::string prefix="";
21 for (auto e : v){
22 os << prefix << e;
23 prefix=", ";
24 }
25 os << "]";
26 return os;
27 }

◆ operator<<() [9/9]

std::ostream & L1Topo::operator<< ( std::ostream & os,
const ModuleID & m )

print helpers

Definition at line 57 of file ModuleID.cxx.

57 {
58 os << "ModuleID: " << " " << formatHex4(m.id()) << " 0b" << std::bitset<8>(m.id()) << " link " << m.link() << " " << " module " << m.module();
59 if (m.isDAQ()){
60 os << " DAQ";
61 }
62 else if (m.isROI()){
63 os << " ROI";
64 }
65 return os;
66 }
std::string formatHex4(uint32_t word)
Helper function to format a 32-bit integer as a 4-digit hex number for printing.

◆ operator==()

bool L1Topo::operator== ( const L1TopoTOB & lhs,
const L1TopoTOB & rhs )

Comparison operators, based on word.

Definition at line 27 of file L1TopoTOB.cxx.

27 {
28 return (lhs.word()==rhs.word());
29 }

◆ operator>()

bool L1Topo::operator> ( const L1TopoTOB & lhs,
const L1TopoTOB & rhs )

Comparison operators, based on word.

Definition at line 36 of file L1TopoTOB.cxx.

36 {
37 return (lhs.word()>rhs.word());
38 }

◆ signAndOffsetBCN()

std::pair< uint32_t, uint32_t > L1Topo::signAndOffsetBCN ( const int bcn)

reverse helper function to return the sign and offset bits given a relative bunch crossing number

Definition at line 83 of file L1Topo/L1TopoRDO/src/Header.cxx.

83 {
84 uint32_t offset = std::abs(bcn);
85 uint32_t sign = (bcn<0)?1:0; // negative bcn encoded as 1
86 return std::pair<uint32_t,uint32_t>(sign,offset);
87 }
int sign(int a)

◆ signedBCN()

int L1Topo::signedBCN ( const uint32_t sign,
uint32_t offset )

helper function to return a relative bunch crossing as a signed integer, given the sign bit and offset that are encoded in the header

Definition at line 79 of file L1Topo/L1TopoRDO/src/Header.cxx.

79 {
80 return static_cast<int>(offset) * (sign>0 ? -1 : 1); // sign=0 is false
81 }

◆ triggerBitIndex()

unsigned int L1Topo::triggerBitIndex ( uint32_t moduleId,
const L1Topo::L1TopoTOB & c )

OUT OF DATE DO NOT USE Helper to calculate the index needed to pack trigger bits into the full 128-bit decision. See 4-bit part of L1Topo TOB definition in https://twiki.cern.ch/twiki/pub/Atlas/L1CaloUpgrade/ROD_data_format_v1.0.4.xlsx.

Definition at line 137 of file Trigger/TrigT1/L1Topo/L1TopoRDO/src/Helpers.cxx.

137 {
138 uint32_t module = (moduleId >>4) & 0x1;
139 uint32_t index = 64*module + 32*c.fpga() + 16*c.clock() + 8*c.index();
140 return index;
141 }

◆ triggerBitIndexNew()

unsigned int L1Topo::triggerBitIndexNew ( uint32_t moduleId,
const L1Topo::L1TopoTOB & c,
unsigned int bitIdx )

Helper to calculate the index needed to pack trigger bits into the full 128-bit decision. See 4-bit part of L1Topo TOB definition in https://twiki.cern.ch/twiki/pub/Atlas/L1CaloUpgrade/ROD_data_format_v1.0.4.xlsx ; same as TriggerLine::calcCounter()?

Definition at line 144 of file Trigger/TrigT1/L1Topo/L1TopoRDO/src/Helpers.cxx.

144 {
145 uint32_t module = (moduleId >>4) & 0x1;
146 uint32_t index = 64*module + 32*c.fpga() + c.clock() + 2*(8*c.index() + bitIdx);
147 //std::cout << "L1Topo::triggerBitIndexNew DEBUG index=" << index << " for module=" << module << " fpga=" << c.fpga() << " clock=" << c.clock() << " index=" << c.index() << " bitIdx=" << bitIdx << std::endl;
148 return index;
149 }

◆ triggerBitIndexPhase1()

unsigned int L1Topo::triggerBitIndexPhase1 ( uint32_t topo,
uint32_t fpga,
size_t bitIdx )

Definition at line 152 of file Trigger/TrigT1/L1Topo/L1TopoRDO/src/Helpers.cxx.

152 {
153 uint32_t index = (topo==3 ? (fpga+2)*32:fpga*32);
154 index += bitIdx<16 ? 2*(bitIdx) : 2*(bitIdx-16)+1;
155 return index;
156 }

Variable Documentation

◆ errorText

const std::map<Error, std::string> L1Topo::errorText
static
Initial value:
= {
{Error::ROB_ERROR,"ROB Error"},
{Error::ROD_ERROR,"ROD Error"},
{Error::SLINK_STATUS_ERROR,"S-Link Status Error"}
}

Define the text to print for each error type above - bad design to put it in the header file?

Definition at line 18 of file Error.h.

18 {
19 {Error::ROB_ERROR,"ROB Error"},
20 {Error::ROD_ERROR,"ROD Error"},
21 {Error::SLINK_STATUS_ERROR,"S-Link Status Error"}
22 };