ATLAS Offline Software
Loading...
Searching...
No Matches
LVL1TGCTrigger::TGCHitPattern Class Reference

#include <TGCHitPattern.h>

Collaboration diagram for LVL1TGCTrigger::TGCHitPattern:

Public Member Functions

 TGCHitPattern ()
 TGCHitPattern (int len)
 ~TGCHitPattern ()
 TGCHitPattern (const TGCHitPattern &right)
TGCHitPatternoperator= (const TGCHitPattern &right)
void setLength (int length)
int getLength () const
void onChannel (int iChannel)
void offChannel (int iChannel)
void setChannel (int iChannel, bool pattern)
void setChannel (char *pat)
void clear ()
void print (int unit) const
void print () const
bool getChannel (int iChannel) const
void visual (int Cycle, int Width, int Tag) const
void setPattern (bool *newpattern)
void printb () const
void printb (std::ofstream *ofs) const
void dec2bin (int dec)
void push_back (TGCHitPattern *hp)

Private Attributes

bool * m_pattern
int m_length

Detailed Description

Definition at line 11 of file TGCHitPattern.h.

Constructor & Destructor Documentation

◆ TGCHitPattern() [1/3]

LVL1TGCTrigger::TGCHitPattern::TGCHitPattern ( )

Definition at line 12 of file TGCHitPattern.cxx.

◆ TGCHitPattern() [2/3]

LVL1TGCTrigger::TGCHitPattern::TGCHitPattern ( int len)

Definition at line 24 of file TGCHitPattern.cxx.

25 :m_pattern(0), m_length(len)
26{
27 if ( m_length > 0 ) {
28 m_pattern = new bool [len];
29 for(int i=0; i<m_length; i+=1) m_pattern[i] = false;
30 } else {
31 m_length = -1;
32 }
33}

◆ ~TGCHitPattern()

LVL1TGCTrigger::TGCHitPattern::~TGCHitPattern ( )

Definition at line 17 of file TGCHitPattern.cxx.

18{
19 if(m_pattern!=0) delete [] m_pattern;
20 m_pattern = 0;
21 m_length =-1;
22}

◆ TGCHitPattern() [3/3]

LVL1TGCTrigger::TGCHitPattern::TGCHitPattern ( const TGCHitPattern & right)

Definition at line 35 of file TGCHitPattern.cxx.

36 :m_pattern(0),m_length(-1)
37{
38 m_length = right.m_length;
39 if ( m_length > 0 ) {
40 m_pattern = new bool [m_length];
41 for(int i=0; i<m_length; i+=1 ) {
42 m_pattern[i] = right.m_pattern[i];
43 }
44 }
45}

Member Function Documentation

◆ clear()

void LVL1TGCTrigger::TGCHitPattern::clear ( )

Definition at line 105 of file TGCHitPattern.cxx.

106{
107 int i;
108 for( i=0; i<m_length; i+=1) m_pattern[i] = false;
109}

◆ dec2bin()

void LVL1TGCTrigger::TGCHitPattern::dec2bin ( int dec)

Definition at line 175 of file TGCHitPattern.cxx.

176{
177 for(int i= m_length -1; i >= 0; i--){
178 if( (dec >> i) & 1 )
179 m_pattern[m_length-1-i] = 1;
180 else
181 m_pattern[m_length-1-i] = 0;
182 }
183}

◆ getChannel()

bool LVL1TGCTrigger::TGCHitPattern::getChannel ( int iChannel) const

Definition at line 64 of file TGCHitPattern.cxx.

65{
66 if(iChannel < m_length){
67 return m_pattern[iChannel];
68 }else{
69 std::cerr << "internal error TGCHitPattern::getChannel()" << std::endl;
70 return 0;
71 }
72}

◆ getLength()

int LVL1TGCTrigger::TGCHitPattern::getLength ( ) const
inline

Definition at line 49 of file TGCHitPattern.h.

50{
51 return m_length;
52}

◆ offChannel()

void LVL1TGCTrigger::TGCHitPattern::offChannel ( int iChannel)
inline

Definition at line 61 of file TGCHitPattern.h.

62{
63 m_pattern[iChannel] = false;
64}

◆ onChannel()

void LVL1TGCTrigger::TGCHitPattern::onChannel ( int iChannel)
inline

Definition at line 55 of file TGCHitPattern.h.

56{
57 m_pattern[iChannel] = true;
58}

◆ operator=()

TGCHitPattern & LVL1TGCTrigger::TGCHitPattern::operator= ( const TGCHitPattern & right)

Definition at line 47 of file TGCHitPattern.cxx.

48{
49 if (this != &right) {
50 if ( m_pattern != 0 ) delete [] m_pattern;
51 m_pattern = 0;
52
53 m_length = right.m_length;
54 if ( m_length > 0 ) {
55 m_pattern = new bool [m_length];
56 for(int i=0; i<m_length; i+=1 ) {
57 m_pattern[i] = right.m_pattern[i];
58 }
59 }
60 }
61 return *this;
62}

◆ print() [1/2]

void LVL1TGCTrigger::TGCHitPattern::print ( ) const

Definition at line 124 of file TGCHitPattern.cxx.

125{
126
127#ifdef BITPATTERN
128 std::cout << " [" << m_length << "bit] ";
129#endif
130#ifdef BITPATTERN
131 for( int i=0; i<m_length; i+=1)
132 std::cout << m_pattern[i] <<std::endl;
133#endif
134#ifdef TGCCOUT
135 for( int i=0; i<m_length; i+=1)
136 if(m_pattern[i]) std::cout<<' '<<i;
137 std::cout << std::endl;
138#endif
139}

◆ print() [2/2]

void LVL1TGCTrigger::TGCHitPattern::print ( int unit) const

Definition at line 111 of file TGCHitPattern.cxx.

112{
113 int i;
114 for( i=0; i<m_length; i+=1){
115 if(i%unit==0) std::cout<<"\n_";
116 if(m_pattern[i])
117 std::cout << 1;
118 else
119 std::cout << 0;
120 }
121 std::cout << std::endl;
122}
const PlainObject unit() const
This is a plugin that makes Eigen look like CLHEP & defines some convenience methods.

◆ printb() [1/2]

void LVL1TGCTrigger::TGCHitPattern::printb ( ) const

Definition at line 141 of file TGCHitPattern.cxx.

142{
143#ifdef TGCCOUT
144 for( int i=0; i<m_length; i+=1){
145 std::cout << m_pattern[i];
146 }
147#endif
148}

◆ printb() [2/2]

void LVL1TGCTrigger::TGCHitPattern::printb ( std::ofstream * ofs) const

Definition at line 150 of file TGCHitPattern.cxx.

151{
152 int i;
153 for( i=0; i<m_length; i+=1){
154 *ofs << m_pattern[i];
155 }
156}

◆ push_back()

void LVL1TGCTrigger::TGCHitPattern::push_back ( TGCHitPattern * hp)

Definition at line 158 of file TGCHitPattern.cxx.

159{
160 bool* ptmp;
161 ptmp = 0;
162 ptmp = new bool [hp->getLength() + m_length];
163 int i;
164 for(i=0; i<m_length ; i++){
165 ptmp[i] = m_pattern[i];
166 }
167 for(i=m_length; i<(hp->getLength() + m_length); i++){
168 ptmp[i] = hp->getChannel(i-m_length);
169 }
170 if(m_pattern)delete [] m_pattern;
171 m_pattern = ptmp;
172 m_length = hp->getLength() + m_length;
173}

◆ setChannel() [1/2]

void LVL1TGCTrigger::TGCHitPattern::setChannel ( char * pat)

Definition at line 90 of file TGCHitPattern.cxx.

90 {
91 int size = strlen(pat);
92 if(size == m_length){
93 for(int i = 0; i < size; i++){
94 if(pat[i]-'0'){
95 setChannel(i, true);
96 }
97 }
98 } else {
99#ifdef TGCCOUT
100 std::cout << "TGCHitPattern::setChannel() error : size is different" << std::endl;
101#endif
102 }
103}
void setChannel(int iChannel, bool pattern)

◆ setChannel() [2/2]

void LVL1TGCTrigger::TGCHitPattern::setChannel ( int iChannel,
bool pattern )

Definition at line 85 of file TGCHitPattern.cxx.

86{
87 m_pattern[iChannel] = hit;
88}

◆ setLength()

void LVL1TGCTrigger::TGCHitPattern::setLength ( int length)

Definition at line 74 of file TGCHitPattern.cxx.

75{
76 m_length = lengthIn;
77
78 if ( m_length > 0 ) {
79 if ( m_pattern != 0) delete [] m_pattern;
80 m_pattern = new bool [m_length];
81 }
82}

◆ setPattern()

void LVL1TGCTrigger::TGCHitPattern::setPattern ( bool * newpattern)

Definition at line 239 of file TGCHitPattern.cxx.

240{
241 if(m_pattern)delete [] m_pattern;
242 m_pattern = newpattern;
243}

◆ visual()

void LVL1TGCTrigger::TGCHitPattern::visual ( int Cycle,
int Width,
int Tag ) const

Definition at line 232 of file TGCHitPattern.cxx.

233{
234 // do nothing
235}

Member Data Documentation

◆ m_length

int LVL1TGCTrigger::TGCHitPattern::m_length
private

Definition at line 45 of file TGCHitPattern.h.

◆ m_pattern

bool* LVL1TGCTrigger::TGCHitPattern::m_pattern
private

Definition at line 44 of file TGCHitPattern.h.


The documentation for this class was generated from the following files: