ATLAS Offline Software
BeamSpotStatusCode.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef INDET_BEAMSPOTSTATUSCODE
6 #define INDET_BEAMSPOTSTATUSCODE
7 
12 namespace InDet {
20  public:
22  m_word(0)
23  {}
25  //Online/offline
26  bool isOnline() const {return isOnline(m_word);}
27  static bool isOnline(int word){
28  int i = getItem(word, m_onlineBit, m_onlineLength);
29  return ( i > 0 ? true : false );
30  }
32  static void setOnlineStatus(bool isOnline, int & word){
33  setWordBit( formBit( m_onlineBit, (isOnline?1:0)), word);}
34 
35  //fit status
36  int fitStatus() const {return fitStatus(m_word);}
37  static int fitStatus(int word) { return getItem(word, m_fitStatusBit, m_fitStatusLength);}
39  static void setFitStatus(int status, int & word) {
41 
42  //algorthim type
43  int algType() const { return algType(m_word);}
44  static int algType(int word) { return getItem(word, m_algorithmTypeBit, m_algorithmTypeLength);}
46  static void setAlgType(int type, int & word) {
48 
49  //width
50  bool fitWidth() const {return fitWidth(m_word);}
51  static bool fitWidth(int word){ return getItem(word, m_widthBit, m_widthLength);}
53  static void setFitWidth(bool fitWidth, int & word) {
54  setWordBit( formBit( m_widthBit, (fitWidth?1:0)),word); }
55 
56 
57  void clearWord() { m_word = 0;}
58  void setWord(int word) { m_word = word;}
59  int getWord() const {return m_word;}
60 
61 private:
62  int getItem( int bit, int length) const {return getItem(m_word, bit,length);}
63  static int getItem( int word, int bit, int length) {
64  int temp = 0;
65  for (int i =0; i < length; ++i) {
66  temp = (temp << 1) + 1;
67  }
68  return (word >> bit) & temp;
69  }
70 
71  static int formBit( int bit, int word) {
72  return (word << bit);
73  }
74  static void setWordBit(int flag, int & word) {
75  word = (word | flag);
76  }
77 
78  static const int m_onlineBit,m_onlineLength;
79  static const int m_fitStatusBit, m_fitStatusLength;
81  static const int m_widthBit, m_widthLength;
82 
83  int m_word;
84 
85 };
86 
87 }
88 
89 
90 #endif
91 
InDet::BeamSpotStatusCode::getItem
int getItem(int bit, int length) const
Definition: BeamSpotStatusCode.h:62
InDet::BeamSpotStatusCode::fitWidth
static bool fitWidth(int word)
Definition: BeamSpotStatusCode.h:51
InDet::BeamSpotStatusCode::m_onlineBit
static const int m_onlineBit
Definition: BeamSpotStatusCode.h:78
InDet::BeamSpotStatusCode::formBit
static int formBit(int bit, int word)
Definition: BeamSpotStatusCode.h:71
InDet::BeamSpotStatusCode::setAlgType
static void setAlgType(int type, int &word)
Definition: BeamSpotStatusCode.h:46
InDet::BeamSpotStatusCode::setAlgType
void setAlgType(int type)
Definition: BeamSpotStatusCode.h:45
InDet
Primary Vertex Finder.
Definition: VP1ErrorUtils.h:36
InDet::BeamSpotStatusCode::setFitWidth
static void setFitWidth(bool fitWidth, int &word)
Definition: BeamSpotStatusCode.h:53
InDet::BeamSpotStatusCode::m_algorithmTypeBit
static const int m_algorithmTypeBit
Definition: BeamSpotStatusCode.h:80
InDet::BeamSpotStatusCode::setWordBit
static void setWordBit(int flag, int &word)
Definition: BeamSpotStatusCode.h:74
InDet::BeamSpotStatusCode::clearWord
void clearWord()
Definition: BeamSpotStatusCode.h:57
InDet::BeamSpotStatusCode::isOnline
static bool isOnline(int word)
Definition: BeamSpotStatusCode.h:27
InDet::BeamSpotStatusCode::getWord
int getWord() const
Definition: BeamSpotStatusCode.h:59
InDet::BeamSpotStatusCode::m_widthLength
static const int m_widthLength
Definition: BeamSpotStatusCode.h:81
InDet::BeamSpotStatusCode::m_fitStatusLength
static const int m_fitStatusLength
Definition: BeamSpotStatusCode.h:79
InDet::BeamSpotStatusCode::isOnline
bool isOnline() const
Definition: BeamSpotStatusCode.h:26
InDet::BeamSpotStatusCode::~BeamSpotStatusCode
~BeamSpotStatusCode()
Definition: BeamSpotStatusCode.h:24
InDet::BeamSpotStatusCode::fitStatus
int fitStatus() const
Definition: BeamSpotStatusCode.h:36
InDet::BeamSpotStatusCode::setOnlineStatus
static void setOnlineStatus(bool isOnline, int &word)
Definition: BeamSpotStatusCode.h:32
InDet::BeamSpotStatusCode::m_word
int m_word
Definition: BeamSpotStatusCode.h:83
InDet::BeamSpotStatusCode::m_algorithmTypeLength
static const int m_algorithmTypeLength
Definition: BeamSpotStatusCode.h:80
InDet::BeamSpotStatusCode::getItem
static int getItem(int word, int bit, int length)
Definition: BeamSpotStatusCode.h:63
InDet::BeamSpotStatusCode::setFitStatus
void setFitStatus(int status)
Definition: BeamSpotStatusCode.h:38
lumiFormat.i
int i
Definition: lumiFormat.py:85
master.flag
bool flag
Definition: master.py:29
InDet::BeamSpotStatusCode
Class to hold the definition and accessor methods for the beamspot status-word.
Definition: BeamSpotStatusCode.h:19
InDet::BeamSpotStatusCode::algType
static int algType(int word)
Definition: BeamSpotStatusCode.h:44
InDet::BeamSpotStatusCode::fitWidth
bool fitWidth() const
Definition: BeamSpotStatusCode.h:50
InDet::BeamSpotStatusCode::m_widthBit
static const int m_widthBit
Definition: BeamSpotStatusCode.h:81
InDet::BeamSpotStatusCode::BeamSpotStatusCode
BeamSpotStatusCode()
Definition: BeamSpotStatusCode.h:21
InDet::BeamSpotStatusCode::setFitWidth
void setFitWidth(bool fitWidth)
Definition: BeamSpotStatusCode.h:52
InDet::BeamSpotStatusCode::m_fitStatusBit
static const int m_fitStatusBit
Definition: BeamSpotStatusCode.h:79
InDet::BeamSpotStatusCode::setWord
void setWord(int word)
Definition: BeamSpotStatusCode.h:58
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
InDet::BeamSpotStatusCode::setOnlineStatus
void setOnlineStatus(bool isOnline)
Definition: BeamSpotStatusCode.h:31
InDet::BeamSpotStatusCode::setFitStatus
static void setFitStatus(int status, int &word)
Definition: BeamSpotStatusCode.h:39
InDet::BeamSpotStatusCode::fitStatus
static int fitStatus(int word)
Definition: BeamSpotStatusCode.h:37
merge.status
status
Definition: merge.py:17
InDet::BeamSpotStatusCode::algType
int algType() const
Definition: BeamSpotStatusCode.h:43
InDet::BeamSpotStatusCode::m_onlineLength
static const int m_onlineLength
Definition: BeamSpotStatusCode.h:78
length
double length(const pvec &v)
Definition: FPGATrackSimLLPDoubletHoughTransformTool.cxx:26