ATLAS Offline Software
Static Public Member Functions | List of all members
LVL1CTP::CTPUtil Class Reference

Class grouping useful functions together. More...

#include <CTPUtil.h>

Collaboration diagram for LVL1CTP::CTPUtil:

Static Public Member Functions

static int getMuonMult (unsigned int word, int threshold)
 get Muon multiplicty in legacy mode More...
 
static int getEMTMult (unsigned int word, int threshold)
 get EmTau multiplicty in legacy mode More...
 
static int getJetMult (unsigned int word, int threshold)
 get Jet multiplicty in legacy mode More...
 
static int getFJetMult (unsigned int word, int threshold)
 get Forward Jet multiplicty in legacy mode More...
 
static int getJetEMult (unsigned int word, int threshold)
 get Jet Energy multiplicty in legacy mode More...
 
static int getETMult (unsigned int word, int threshold)
 get transverse energy multiplicty in legacy mode More...
 
static int getTMMult (unsigned int word, int threshold)
 get missing Et multiplicty in legacy mode More...
 
static int getMult (uint64_t word, unsigned int startbit, unsigned int endbit)
 extract multiplicities using new trigger configuration interface More...
 
static int getMuonMult (const std::vector< unsigned int > &words, unsigned int startbit, unsigned int endbit)
 
static int getOptMult (std::bitset< 128 > bits, unsigned int startbit, unsigned int endbit)
 
static unsigned int getMultTopo (uint64_t word, unsigned int startbit, unsigned int endbit, unsigned int clock)
 extract multiplicities from Topo words, were the encoding is different More...
 
static unsigned int alignBits (int value, int startbit, int endbit)
 align bits More...
 
static unsigned int createMask (int startbit, int endbit)
 create mask More...
 
static std::bitset< 512 > convertToLargeBitset (const std::vector< uint32_t > &words)
 convert list of words into bitset More...
 
static std::bitset< 256 > convertToBitset (const std::vector< uint32_t > &words)
 convert list of words into bitset More...
 
static std::bitset< 512 > convertToLargeBitset (const std::vector< ROIB::CTPRoI > &words)
 convert list of CTPRoIs into bitset More...
 
static std::bitset< 256 > convertToBitset (const std::vector< ROIB::CTPRoI > &words)
 convert list of CTPRoIs into bitset More...
 
static std::string printHex (const std::vector< uint32_t > &rhs, const std::string &delimiter=",")
 print vector in hex format More...
 

Detailed Description

Class grouping useful functions together.

   I use this class mainly as a replacement of the former TMUtil class.
   I hope it will be much-much more efficient than TMUtil was. (That class
   was a horror...)
Author
Attila Krasznahorkay Attil.nosp@m.a.Kr.nosp@m.aszna.nosp@m.hork.nosp@m.ay@ce.nosp@m.rn.c.nosp@m.h
Wolfgang Ehrenfeld Wolfg.nosp@m.ang..nosp@m.Ehren.nosp@m.feld.nosp@m.@desy.nosp@m..de
Version
$Id: CTPUtil.h,v 1.8 2009-01-29 20:54:31 efeld Exp $

Definition at line 39 of file CTPUtil.h.

Member Function Documentation

◆ alignBits()

unsigned int LVL1CTP::CTPUtil::alignBits ( int  value,
int  startbit,
int  endbit 
)
static

align bits

Definition at line 138 of file CTPUtil.cxx.

138  {
139 
140  int ostart = std::min( startbit, endbit );
141  int oend = std::max( startbit, endbit );
142  int start = std::max( ostart, 0 );
143  int end = std::min( oend, 32 );
144 
145  unsigned int result = value;
146  if( ostart < 0 ) result >>= static_cast< int >( std::abs( static_cast< double >( ostart ) ) );
147  else result <<= ostart;
148  result &= createMask( start, end );
149 
150  return result;
151 
152  }

◆ convertToBitset() [1/2]

std::bitset< 256 > LVL1CTP::CTPUtil::convertToBitset ( const std::vector< ROIB::CTPRoI > &  words)
static

convert list of CTPRoIs into bitset

Definition at line 128 of file CTPUtil.cxx.

128  {
129  std::bitset<256> bitset;
130  for (size_t i(0); i < words.size(); ++i) {
131  std::bitset<256> bs = words[i].roIWord();
132  bs <<= (i * 32);
133  bitset |= bs;
134  }
135  return bitset;
136  }

◆ convertToBitset() [2/2]

std::bitset< 256 > LVL1CTP::CTPUtil::convertToBitset ( const std::vector< uint32_t > &  words)
static

convert list of words into bitset

Definition at line 97 of file CTPUtil.cxx.

97  {
98  std::bitset<256> bitset;
99  for (size_t i(0); i < words.size(); ++i) {
100  std::bitset<256> bs = words[i];
101  bs <<= (i * 32);
102  bitset |= bs;
103  }
104  return bitset;
105  }

◆ convertToLargeBitset() [1/2]

std::bitset< 512 > LVL1CTP::CTPUtil::convertToLargeBitset ( const std::vector< ROIB::CTPRoI > &  words)
static

convert list of CTPRoIs into bitset

Definition at line 108 of file CTPUtil.cxx.

108  {
109  std::bitset<512> bitset;
110  for (size_t i(0); i < words.size(); ++i) {
111  std::bitset<512> bs = words[i].roIWord();
112  bs <<= (i * 32);
113  bitset |= bs;
114  }
115  return bitset;
116  }

◆ convertToLargeBitset() [2/2]

std::bitset< 512 > LVL1CTP::CTPUtil::convertToLargeBitset ( const std::vector< uint32_t > &  words)
static

convert list of words into bitset

Definition at line 118 of file CTPUtil.cxx.

118  {
119  std::bitset<512> bitset;
120  for (size_t i(0); i < words.size(); ++i) {
121  std::bitset<512> bs = words[i];
122  bs <<= (i * 32);
123  bitset |= bs;
124  }
125  return bitset;
126  }

◆ createMask()

unsigned int LVL1CTP::CTPUtil::createMask ( int  startbit,
int  endbit 
)
static

create mask

Definition at line 154 of file CTPUtil.cxx.

154  {
155 
156  int start = std::min( std::max( startbit, 0 ), std::max( endbit, 0 ) );
157  int end = std::max( std::min( startbit, 32 ), std::min( endbit, 32 ) );
158 
159  unsigned int result = 0;
160  for( int i = 0; i <= ( end - start ); ++i ) {
161  result <<= 1;
162  result |= 1;
163  }
164  result <<= start;
165 
166  return result;
167 
168  }

◆ getEMTMult()

int LVL1CTP::CTPUtil::getEMTMult ( unsigned int  word,
int  threshold 
)
static

get EmTau multiplicty in legacy mode

Definition at line 28 of file CTPUtil.cxx.

28  {
29 
30  return static_cast<int>( ( word >> ( 3 * threshold + 1 ) ) & 0x7 );
31 
32  }

◆ getETMult()

int LVL1CTP::CTPUtil::getETMult ( unsigned int  word,
int  threshold 
)
static

get transverse energy multiplicty in legacy mode

Definition at line 52 of file CTPUtil.cxx.

52  {
53 
54  return static_cast<int>( ( word >> ( 9 + threshold ) ) & 0x1 );
55 
56  }

◆ getFJetMult()

int LVL1CTP::CTPUtil::getFJetMult ( unsigned int  word,
int  threshold 
)
static

get Forward Jet multiplicty in legacy mode

Definition at line 40 of file CTPUtil.cxx.

40  {
41 
42  return static_cast<int>( ( word >> ( 2 * threshold + 1 ) ) & 0x3 );
43 
44  }

◆ getJetEMult()

int LVL1CTP::CTPUtil::getJetEMult ( unsigned int  word,
int  threshold 
)
static

get Jet Energy multiplicty in legacy mode

Definition at line 46 of file CTPUtil.cxx.

46  {
47 
48  return static_cast<int>( ( word >> ( 25 + threshold ) ) & 0x1 );
49 
50  }

◆ getJetMult()

int LVL1CTP::CTPUtil::getJetMult ( unsigned int  word,
int  threshold 
)
static

get Jet multiplicty in legacy mode

Definition at line 34 of file CTPUtil.cxx.

34  {
35 
36  return CTPUtil::getEMTMult( word, threshold );
37 
38  }

◆ getMult()

int LVL1CTP::CTPUtil::getMult ( uint64_t  word,
unsigned int  startbit,
unsigned int  endbit 
)
static

extract multiplicities using new trigger configuration interface

Definition at line 64 of file CTPUtil.cxx.

64  {
65 
66  return static_cast<int>( ( word >> startbit ) & static_cast<unsigned int>( pow( 2, endbit - startbit + 1 ) - 1 ) );
67 
68  }

◆ getMultTopo()

unsigned int LVL1CTP::CTPUtil::getMultTopo ( uint64_t  word,
unsigned int  startbit,
unsigned int  endbit,
unsigned int  clock 
)
static

extract multiplicities from Topo words, were the encoding is different

Definition at line 83 of file CTPUtil.cxx.

83  {
84 
85  unsigned int mult = 0;
86 
87  for(int cb = (int)cableEnd; cb >= (int)cableStart; --cb) { // must be signed int
88  unsigned int b = 2 * cb + clock;
89  mult <<= 1;
90  mult += (word & ( 1UL << b )) ? 1 : 0 ;
91  }
92 
93  return mult;
94  }

◆ getMuonMult() [1/2]

int LVL1CTP::CTPUtil::getMuonMult ( const std::vector< unsigned int > &  words,
unsigned int  startbit,
unsigned int  endbit 
)
static

Definition at line 70 of file CTPUtil.cxx.

70  {
71  std::bitset<256> bits = convertToBitset(words);
72  std::bitset<256> mask = pow( 2, endbit - startbit + 1 ) - 1;
73  bits >>= startbit;
74  return static_cast<int>((bits&mask).to_ulong());
75  }

◆ getMuonMult() [2/2]

int LVL1CTP::CTPUtil::getMuonMult ( unsigned int  word,
int  threshold 
)
static

get Muon multiplicty in legacy mode

Definition at line 22 of file CTPUtil.cxx.

22  {
23 
24  return static_cast<int>( ( word >> ( 3 * threshold ) ) & 0x7 );
25 
26  }

◆ getOptMult()

int LVL1CTP::CTPUtil::getOptMult ( std::bitset< 128 >  bits,
unsigned int  startbit,
unsigned int  endbit 
)
static

Definition at line 77 of file CTPUtil.cxx.

77  {
78  std::bitset<128> mask = pow( 2, endbit - startbit + 1 ) - 1;
79  bits >>= startbit;
80  return static_cast<int>((bits&mask).to_ulong());
81  }

◆ getTMMult()

int LVL1CTP::CTPUtil::getTMMult ( unsigned int  word,
int  threshold 
)
static

get missing Et multiplicty in legacy mode

Definition at line 58 of file CTPUtil.cxx.

58  {
59 
60  return static_cast<int>( ( word >> ( 1 + threshold ) ) & 0x1 );
61 
62  }

◆ printHex()

std::string LVL1CTP::CTPUtil::printHex ( const std::vector< uint32_t > &  rhs,
const std::string &  delimiter = "," 
)
static

print vector in hex format

Definition at line 170 of file CTPUtil.cxx.

171  {
172  std::ostringstream s;
173 
174  // switch to hex format
175  s << std::hex << std::setfill( '0' );
176 
177  if (rhs.size() > 0)
178  s << " 0x" << std::setw(8) << rhs[0];
179  for (size_t i(1); i < rhs.size(); ++i) {
180  s << delimiter << " 0x" << std::setw(8) << rhs[i];
181  }
182 
183  // switch back to normal format
184  s << std::dec << std::setfill(' ');
185 
186  return s.str();
187  }

The documentation for this class was generated from the following files:
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
get_generator_info.result
result
Definition: get_generator_info.py:21
LVL1CTP::CTPUtil::createMask
static unsigned int createMask(int startbit, int endbit)
create mask
Definition: CTPUtil.cxx:154
max
#define max(a, b)
Definition: cfImp.cxx:41
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
mergePhysValFiles.start
start
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:14
conifer::pow
constexpr int pow(int x)
Definition: conifer.h:20
athena.value
value
Definition: athena.py:122
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
python.AthDsoLogger.delimiter
delimiter
Definition: AthDsoLogger.py:71
lumiFormat.i
int i
Definition: lumiFormat.py:92
LVL1CTP::CTPUtil::convertToBitset
static std::bitset< 256 > convertToBitset(const std::vector< uint32_t > &words)
convert list of words into bitset
Definition: CTPUtil.cxx:97
LVL1CTP::CTPUtil::getEMTMult
static int getEMTMult(unsigned int word, int threshold)
get EmTau multiplicty in legacy mode
Definition: CTPUtil.cxx:28
min
#define min(a, b)
Definition: cfImp.cxx:40
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
threshold
Definition: chainparser.cxx:74
checkFileSG.words
words
Definition: checkFileSG.py:76
dumpTgcDigiThreshold.threshold
list threshold
Definition: dumpTgcDigiThreshold.py:34