ATLAS Offline Software
Loading...
Searching...
No Matches
RoIDecoder.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3*/
4// $Id: RoIDecoder.cxx 187728 2009-05-27 16:18:06Z krasznaa $
5/***************************************************************************
6 RoIDecoder.cxx - description
7 -------------------
8 begin : Fri Apr 19 2002
9 email : moyse@ph.qmw.ac.uk
10 ***************************************************************************/
11
12
13#ifndef TRIGGERSPACE
14// running in Athena
16#else
17// running in TRIGGERSPACE
18#include "RoIDecoder.h"
19#endif
20
21#include <math.h>
22#include <iostream>
23
25 m_DEBUG( false ) {
26
27}
28
32
34unsigned int LVL1::RoIDecoder::extractBits( unsigned int word, const unsigned int start,
35 const unsigned int length ) const {
36
37 // this works as follows. Imagine start=3, bits=4 and word=11011100
38 // so this routine should return 0111
39 // now:
40 // word>>(first-1) = 110111
41 // (1<<length) = 010000
42 // (1<<length)-1 = 001111
43 word = ( word >> ( start - 1 ) );
44
45 unsigned int bitmask = ( 1 << length ) - 1;
46 // and finally:
47 // 110111&001111 = 0111
48 return ( word & bitmask ); // return only bits in bitmask
49}
50
double length(const pvec &v)
unsigned int extractBits(unsigned int word, const unsigned int start, const unsigned int length) const
returns the value of bits in word between bit "start" and bit "start" + "length"
virtual ~RoIDecoder()