24 return static_cast<int>( ( word >> ( 3 *
threshold ) ) & 0x7 );
30 return static_cast<int>( ( word >> ( 3 *
threshold + 1 ) ) & 0x7 );
42 return static_cast<int>( ( word >> ( 2 *
threshold + 1 ) ) & 0x3 );
48 return static_cast<int>( ( word >> ( 25 +
threshold ) ) & 0x1 );
54 return static_cast<int>( ( word >> ( 9 +
threshold ) ) & 0x1 );
60 return static_cast<int>( ( word >> ( 1 +
threshold ) ) & 0x1 );
66 return static_cast<int>( ( word >> startbit ) &
static_cast<unsigned int>(
pow( 2, endbit - startbit + 1 ) - 1 ) );
70 int CTPUtil::getMuonMult(
const std::vector<unsigned int>& words,
unsigned int startbit,
unsigned int endbit ) {
72 std::bitset<256> mask =
pow( 2, endbit - startbit + 1 ) - 1;
74 return static_cast<int>((bits&mask).to_ulong());
78 std::bitset<128> mask =
pow( 2, endbit - startbit + 1 ) - 1;
80 return static_cast<int>((bits&mask).to_ulong());
83 unsigned int CTPUtil::getMultTopo( uint64_t word,
unsigned int cableStart,
unsigned int cableEnd,
unsigned int clock ) {
85 unsigned int mult = 0;
87 for(
int cb = (
int)cableEnd; cb >= (int)cableStart; --cb) {
88 unsigned int b = 2 * cb + clock;
90 mult += (word & ( 1UL << b )) ? 1 : 0 ;
98 std::bitset<256> bitset;
99 for (
size_t i(0); i < words.size(); ++i) {
100 std::bitset<256> bs = words[i];
109 std::bitset<512> bitset;
110 for (
size_t i(0); i < words.size(); ++i) {
111 std::bitset<512> bs = words[i].roIWord();
119 std::bitset<512> bitset;
120 for (
size_t i(0); i < words.size(); ++i) {
121 std::bitset<512> bs = words[i];
129 std::bitset<256> bitset;
130 for (
size_t i(0); i < words.size(); ++i) {
131 std::bitset<256> bs = words[i].roIWord();
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 );
145 unsigned int result = value;
146 if( ostart < 0 )
result >>=
static_cast< int >( std::abs(
static_cast< double >( ostart ) ) );
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 ) );
160 for(
int i = 0; i <= ( end - start ); ++i ) {
172 std::ostringstream s;
175 s << std::hex << std::setfill(
'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];
184 s << std::dec << std::setfill(
' ');
constexpr int pow(int base, int exp) noexcept
static int getEMTMult(unsigned int word, int threshold)
get EmTau multiplicty in legacy mode
static int getJetMult(unsigned int word, int threshold)
get Jet multiplicty in legacy mode
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
static int getOptMult(std::bitset< 128 > bits, unsigned int startbit, unsigned int endbit)
static std::string printHex(const std::vector< uint32_t > &rhs, const std::string &delimiter=",")
print vector in hex format
static unsigned int alignBits(int value, int startbit, int endbit)
align bits
static int getETMult(unsigned int word, int threshold)
get transverse energy multiplicty in legacy mode
static unsigned int createMask(int startbit, int endbit)
create mask
static int getJetEMult(unsigned int word, int threshold)
get Jet Energy multiplicty in legacy mode
static std::bitset< 256 > convertToBitset(const std::vector< uint32_t > &words)
convert list of words into bitset
static int getTMMult(unsigned int word, int threshold)
get missing Et multiplicty in legacy mode
static int getFJetMult(unsigned int word, int threshold)
get Forward Jet multiplicty in legacy mode
static int getMult(uint64_t word, unsigned int startbit, unsigned int endbit)
extract multiplicities using new trigger configuration interface
static int getMuonMult(unsigned int word, int threshold)
get Muon multiplicty in legacy mode
static std::bitset< 512 > convertToLargeBitset(const std::vector< uint32_t > &words)
convert list of words into bitset