ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
bitPATTERN Class Reference

#include <bitPATTERN.h>

Inheritance diagram for bitPATTERN:
Collaboration diagram for bitPATTERN:

Public Member Functions

 bitPATTERN (const std::string &, const PATTERNidentity &, int)
 
 bitPATTERN (const bitPATTERN &)
 
 ~bitPATTERN ()
 
bitPATTERNoperator= (const bitPATTERN &)
 
void set (const RPCdigit *, int)
 
void unset (int)
 
void reset (void)
 
bool any (void) const
 
bool test (int) const
 
bool operator< (const bitPATTERN &)
 
const RPCdigitoperator[] (int) const
 
const PATTERNidentityid (void) const
 
int size (void) const
 
bitPATTERN operator& (const bitPATTERN &) const
 
bitPATTERNoperator&= (const bitPATTERN &)
 
bitPATTERN operator| (const bitPATTERN &) const
 
bitPATTERNoperator|= (const bitPATTERN &)
 
bitPATTERN operator^ (const bitPATTERN &) const
 
bitPATTERNoperator^= (const bitPATTERN &)
 
bitPATTERNoperator<< (int)
 
bitPATTERNoperator>> (int)
 
void dump (uint32_t &, uint32_t &) const
 
void Print (std::ostream &, bool detail) const
 
void set_number (int)
 
int number (void) const
 
void PrintElement (std::ostream &, std::string, bool) const
 
ObjectType tag () const
 
const std::string & name () const
 

Private Member Functions

void shift_left (void)
 
void shift_right (void)
 

Private Attributes

PATTERNidentity m_id
 
int m_size
 
const RPCdigit ** m_digits
 
int m_number
 
ObjectType m_tag
 
std::string m_name
 

Detailed Description

Definition at line 12 of file bitPATTERN.h.

Constructor & Destructor Documentation

◆ bitPATTERN() [1/2]

bitPATTERN::bitPATTERN ( const std::string &  name,
const PATTERNidentity id,
int  size 
)

Definition at line 9 of file bitPATTERN.cxx.

9  :
11  m_id(id),
12  m_size(size)
13 {
14  m_digits = new const RPCdigit* [m_size];
15  reset();
16 }

◆ bitPATTERN() [2/2]

bitPATTERN::bitPATTERN ( const bitPATTERN pattern)

Definition at line 18 of file bitPATTERN.cxx.

18  :
19  RPCtrigDataObject(0,pattern.name()),
20  m_id(pattern.id()),
21  m_size(pattern.size())
22 {
23  m_digits = new const RPCdigit* [m_size];
24  reset();
25  for(int i=0;i<m_size;++i) m_digits[i] = pattern[i];
26 }

◆ ~bitPATTERN()

bitPATTERN::~bitPATTERN ( )

Definition at line 28 of file bitPATTERN.cxx.

29 {
30  delete [] m_digits;
31 }

Member Function Documentation

◆ any()

bool bitPATTERN::any ( void  ) const

Definition at line 78 of file bitPATTERN.cxx.

79 {
80  for(int i=0;i<m_size;++i)
81  {
82  if (m_digits[i]) return true;
83  }
84  return false;
85 }

◆ dump()

void bitPATTERN::dump ( uint32_t &  first_32_pattern,
uint32_t &  second_32_pattern 
) const

Definition at line 220 of file bitPATTERN.cxx.

222 {
223  first_32_pattern = 0x0;
224  second_32_pattern = 0x0;
225 
226  if (m_size!=32 && m_size!=64) return;
227 
228  for (int i=0; i<32; ++i)
229  {
230  if (m_digits[i]) first_32_pattern |= (0x1<<i);
231  }
232 
233  if (m_size == 64)
234  {
235  for (int i=32; i<64; ++i)
236  {
237  if (m_digits[i]) second_32_pattern |= (0x1<<(i-32));
238  }
239  }
240 }

◆ id()

const PATTERNidentity& bitPATTERN::id ( void  ) const
inline

Definition at line 39 of file bitPATTERN.h.

39 {return m_id;}

◆ name()

const std::string& BaseObject::name ( ) const
inlineinherited

Definition at line 23 of file BaseObject.h.

23 { return m_name; }

◆ number()

int RPCtrigDataObject::number ( void  ) const
inlineinherited

Definition at line 29 of file RPCtrigDataObject.h.

29 {return m_number;}

◆ operator&()

bitPATTERN bitPATTERN::operator& ( const bitPATTERN pattern) const

Definition at line 103 of file bitPATTERN.cxx.

104 {
105  if(pattern.size() != m_size) return *this;
106  bitPATTERN result(name(),id(),m_size);
107 
108  for(int i=0;i<m_size;++i)
109  {
110  if ( m_digits[i] && pattern.test(i) ) result.set(m_digits[i],i);
111  }
112 
113  return result;
114 }

◆ operator&=()

bitPATTERN & bitPATTERN::operator&= ( const bitPATTERN pattern)

Definition at line 117 of file bitPATTERN.cxx.

118 {
119  if(pattern.size() != m_size) return *this;
120  for(int i=0;i<m_size;++i)
121  {
122  if ( !(m_digits[i] && pattern.test(i)) ) m_digits[i] = 0;
123  }
124  return *this;
125 }

◆ operator<()

bool bitPATTERN::operator< ( const bitPATTERN pattern)

Definition at line 46 of file bitPATTERN.cxx.

48 {
49  if(m_id < pattern.id()) return true;
50  else return false;
51 }

◆ operator<<()

bitPATTERN & bitPATTERN::operator<< ( int  num)

Definition at line 190 of file bitPATTERN.cxx.

192 {
193  if(num <= 0) return *this;
194  for(int i=0;i<num;++i) shift_left();
195  return *this;
196 }

◆ operator=()

bitPATTERN & bitPATTERN::operator= ( const bitPATTERN pattern)

Definition at line 35 of file bitPATTERN.cxx.

36 {
37  if(pattern.size() != m_size) return *this;
38 
39  reset();
40 
41  m_id = pattern.id();
42  for(int i=0;i<m_size;++i) m_digits[i] = pattern[i];
43  return *this;
44 }

◆ operator>>()

bitPATTERN & bitPATTERN::operator>> ( int  num)

Definition at line 199 of file bitPATTERN.cxx.

200 {
201  if(num <= 0) return *this;
202  for(int i=0;i<num;++i) shift_right();
203  return *this;
204 }

◆ operator[]()

const RPCdigit * bitPATTERN::operator[] ( int  bit) const

Definition at line 96 of file bitPATTERN.cxx.

97 {
98  if(bit >= m_size || bit < 0) return 0;
99  else return m_digits[bit];
100 }

◆ operator^()

bitPATTERN bitPATTERN::operator^ ( const bitPATTERN pattern) const

Definition at line 159 of file bitPATTERN.cxx.

160 {
161  if(pattern.size() != m_size) return *this;
162  bitPATTERN result(name(),id(),m_size);
163 
164  for(int i=0;i<m_size;++i)
165  {
166  if ( (m_digits[i] || pattern.test(i)) &&
167  !(m_digits[i] && pattern.test(i)) )
168  {
169  if(m_digits[i]) result.set(m_digits[i],i);
170  else result.set(pattern[i],i);
171  }
172  }
173 
174  return result;
175 }

◆ operator^=()

bitPATTERN & bitPATTERN::operator^= ( const bitPATTERN pattern)

Definition at line 178 of file bitPATTERN.cxx.

179 {
180  if(pattern.size() != m_size) return *this;
181  for(int i=0;i<m_size;++i)
182  {
183  if ( !((m_digits[i] || pattern.test(i)) &&
184  !(m_digits[i] && pattern.test(i)) ) ) m_digits[i] = 0;
185  else if(!m_digits[i]) m_digits[i] = pattern[i];
186  }
187  return *this;
188 }

◆ operator|()

bitPATTERN bitPATTERN::operator| ( const bitPATTERN pattern) const

Definition at line 128 of file bitPATTERN.cxx.

129 {
130  if(pattern.size() != m_size) return *this;
131  bitPATTERN result(name(),id(),m_size);
132 
133  for(int i=0;i<m_size;++i)
134  {
135  if ( m_digits[i] || pattern.test(i) )
136  {
137  if(m_digits[i]) result.set(m_digits[i],i);
138  else result.set(pattern[i],i);
139  }
140  }
141 
142  return result;
143 }

◆ operator|=()

bitPATTERN & bitPATTERN::operator|= ( const bitPATTERN pattern)

Definition at line 146 of file bitPATTERN.cxx.

147 {
148  if(pattern.size() != m_size) return *this;
149  for(int i=0;i<m_size;++i)
150  {
151  if ( !(m_digits[i] || pattern.test(i)) ) m_digits[i] = 0;
152  else if(!m_digits[i]) m_digits[i] = pattern[i];
153  }
154  return *this;
155 }

◆ Print()

void bitPATTERN::Print ( std::ostream &  stream,
bool  detail 
) const
virtual

Reimplemented from BaseObject.

Definition at line 243 of file bitPATTERN.cxx.

244 {
245  stream << name() << " (" << size() << ") ";
246 
247  if(any()) stream << "*> ";
248  else stream << " > ";
249 
250  for(int i=0;i<size();++i)
251  {
252  if(test(i)) stream << "1";
253  else stream << "0";
254  }
255 
256 
257  stream << endl;
258 
259  if(detail )
260  {
261  stream << "gives input to " << id() << endl;
262  for(int i=0;i<size();++i)
263  {
264  if(test(i))
265  {
266  stream << "bit " << i << " raised by:" << endl;
267  (*this)[i]->Print(stream,false);
268  }
269  }
270  }
271 }

◆ PrintElement()

void RPCtrigDataObject::PrintElement ( std::ostream &  ,
std::string  ,
bool   
) const
inlineinherited

Definition at line 31 of file RPCtrigDataObject.h.

31 {}

◆ reset()

void bitPATTERN::reset ( void  )

Definition at line 69 of file bitPATTERN.cxx.

70 {
71  for(int i=0;i<m_size;++i)
72  {
73  m_digits[i] = 0;
74  }
75 }

◆ set()

void bitPATTERN::set ( const RPCdigit digit,
int  bit 
)

Definition at line 54 of file bitPATTERN.cxx.

55 {
56  if(bit >= m_size || bit < 0) return;
57  m_digits[bit] = digit;
58 }

◆ set_number()

void RPCtrigDataObject::set_number ( int  number)
inherited

Definition at line 42 of file RPCtrigDataObject.cxx.

43 {
44  m_number = number;
45 }

◆ shift_left()

void bitPATTERN::shift_left ( void  )
private

Definition at line 207 of file bitPATTERN.cxx.

208 {
209  for(int i=1;i<m_size;++i) m_digits[i-1] = m_digits[i];
210  m_digits[m_size-1] = 0;
211 }

◆ shift_right()

void bitPATTERN::shift_right ( void  )
private

Definition at line 214 of file bitPATTERN.cxx.

215 {
216  for(int i=m_size-2;i>=0;--i) m_digits[i+1] = m_digits[i];
217  m_digits[0] = 0;
218 }

◆ size()

int bitPATTERN::size ( void  ) const
inline

Definition at line 41 of file bitPATTERN.h.

41 {return m_size;}

◆ tag()

ObjectType BaseObject::tag ( ) const
inlineinherited

Definition at line 22 of file BaseObject.h.

22 { return m_tag; }

◆ test()

bool bitPATTERN::test ( int  bit) const

Definition at line 88 of file bitPATTERN.cxx.

89 {
90  if(bit >= m_size || bit < 0) return false;
91  if (m_digits[bit]) return true;
92  else return false;
93 }

◆ unset()

void bitPATTERN::unset ( int  bit)

Definition at line 61 of file bitPATTERN.cxx.

62 {
63  if(bit >= m_size || bit < 0) return;
64  m_digits[bit] = 0;
65 }

Member Data Documentation

◆ m_digits

const RPCdigit** bitPATTERN::m_digits
private

Definition at line 17 of file bitPATTERN.h.

◆ m_id

PATTERNidentity bitPATTERN::m_id
private

Definition at line 15 of file bitPATTERN.h.

◆ m_name

std::string BaseObject::m_name
privateinherited

Definition at line 16 of file BaseObject.h.

◆ m_number

int RPCtrigDataObject::m_number
privateinherited

Definition at line 17 of file RPCtrigDataObject.h.

◆ m_size

int bitPATTERN::m_size
private

Definition at line 16 of file bitPATTERN.h.

◆ m_tag

ObjectType BaseObject::m_tag
privateinherited

Definition at line 15 of file BaseObject.h.


The documentation for this class was generated from the following files:
mergePhysValFiles.pattern
pattern
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:26
RPCtrigDataObject::m_number
int m_number
Definition: RPCtrigDataObject.h:17
RPCtrigDataObject::RPCtrigDataObject
RPCtrigDataObject(int, const std::string &)
Definition: RPCtrigDataObject.cxx:10
BaseObject::name
const std::string & name() const
Definition: BaseObject.h:23
bitPATTERN::test
bool test(int) const
Definition: bitPATTERN.cxx:88
get_generator_info.result
result
Definition: get_generator_info.py:21
bitPATTERN::reset
void reset(void)
Definition: bitPATTERN.cxx:69
BaseObject::m_name
std::string m_name
Definition: BaseObject.h:16
bitPATTERN
Definition: bitPATTERN.h:13
bitPATTERN::id
const PATTERNidentity & id(void) const
Definition: bitPATTERN.h:39
detail
Definition: extract_histogram_tag.cxx:14
checkRpcDigits.digit
digit
Definition: checkRpcDigits.py:186
bitPATTERN::m_digits
const RPCdigit ** m_digits
Definition: bitPATTERN.h:17
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
bitPATTERN::shift_right
void shift_right(void)
Definition: bitPATTERN.cxx:214
bitPATTERN::shift_left
void shift_left(void)
Definition: bitPATTERN.cxx:207
lumiFormat.i
int i
Definition: lumiFormat.py:85
bitPATTERN::m_size
int m_size
Definition: bitPATTERN.h:16
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
bitPATTERN::any
bool any(void) const
Definition: bitPATTERN.cxx:78
RPCdigit
Definition: RPCdigit.h:16
RPCtrigDataObject::number
int number(void) const
Definition: RPCtrigDataObject.h:29
BaseObject::m_tag
ObjectType m_tag
Definition: BaseObject.h:15
bitPATTERN::m_id
PATTERNidentity m_id
Definition: bitPATTERN.h:15
bitPATTERN::size
int size(void) const
Definition: bitPATTERN.h:41