ATLAS Offline Software
driftCircle.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRT_DIGITIZATION_TRT_DRIFTCIRCLE_H
6 #define TRT_DIGITIZATION_TRT_DRIFTCIRCLE_H
7 
8 // driftCircle.h
9 // This local copy is only for development/debugging purposes
10 // Adapted from TRT_DriftCircle.h
11 // For basic tuning and development tests.
12 // 13/10/2012 Andrew.Beddall@cern.ch
13 
14 void bits32(unsigned int n) {
15  for (unsigned int k=0; k<32; k++) {
16  unsigned int i = n & 0x80000000u;
17  bool b = (i==0x80000000u);
18  std::cout << b;
19  n=n<<1;
20  }
21  std::cout << std::endl;
22 }
23 
24 void bits27(unsigned int n) {
25  for (unsigned int k=0; k<32; k++) {
26  if (k>4) {
27  unsigned int i = n & 0x80000000u;
28  bool b = (i==0x80000000u);
29  if (!((k-5)%9)) std::cout << " ";
30  std::cout << b;
31  if (!((k-5)%9)) std::cout << " ";
32  }
33  n=n<<1;
34  }
35  std::cout << std::endl;
36 }
37 
38 void bits24(unsigned int n) {
39  for (unsigned int k=0; k<32; k++) {
40  if (k>4) {
41  unsigned int i = n & 0x80000000u;
42  bool b = (i==0x80000000u);
43  if (((k-5)%9)) std::cout << b;
44  }
45  n=n<<1;
46  }
47  std::cout << std::endl;
48 }
49 
50 int driftTimeBin(unsigned int m_word) {
51  unsigned mask = 0x02000000;
52  bool SawZero = false;
53  int i;
54  for(i=0;i<24;++i)
55  { if ( (m_word & mask) && SawZero) break;
56  else if ( !(m_word & mask) ) SawZero = true;
57  mask>>=1;
58  if(i==7 || i==15) mask>>=1;
59  }
60  if(i==24) i=0;
61  return i;
62 }
63 
64 int trailingEdge(unsigned int m_word) {
65  unsigned mask = 0x00000001;
66  bool SawZero=false;
67  int i;
68  for (i = 0; i < 24; ++i)
69  {
70  if ( (m_word & mask) && SawZero )
71  break;
72  else if ( !(m_word & mask) )
73  SawZero = true;
74  mask <<= 1;
75  if (i == 7 || i == 15)
76  mask <<= 1;
77  }
78 
79  if ( 24 == i )
80  return i;
81  return (23 - i);
82 }
83 
84 bool lowLevelMiddle(unsigned int m_word) {
85  return (m_word & 0x0001FE00);
86 }
87 
88 bool highLevel(unsigned int m_word) {
89  return (m_word & 0x04020100);
90 }
91 
92 bool highLevel1(unsigned int m_word) {
93  return (m_word & 0x04000000);
94 }
95 
96 bool highLevel2(unsigned int m_word) {
97  return (m_word & 0x00020000);
98 }
99 
100 bool highLevel3(unsigned int m_word) {
101  return (m_word & 0x00000100);
102 }
103 
104 bool firstBinHigh(unsigned int m_word) {
105  return (m_word & 0x02000000);
106 }
107 
108 bool lastBinHigh(unsigned int m_word) {
109  return (m_word & 0x1);
110 }
111 
112 double rawDriftTime(unsigned int m_word) {
113  return (driftTimeBin(m_word)+0.5)*3.125;
114 }
115 
116 double timeOverThreshold(unsigned int m_word) {
117  double binWidth = 3.125;
118  int LE = driftTimeBin(m_word);
119  int TE = trailingEdge(m_word);
120  if ( (24 == LE) || (24 == TE) || (0 == TE) || (23 == LE) ) return 0.0;
121  return (double) (TE - LE + 1) * binWidth;
122 }
123 
124 int bitTimeOverThreshold(unsigned int m_word) {
125  return floor(timeOverThreshold(m_word)/3.125+0.5);
126 }
127 
128 int nLTbits(unsigned int m_word) {
129  unsigned mask = 0x02000000;
130  int m=0;
131  for (int i=0;i<24;++i) {
132  if ( m_word & mask ) m++;
133  mask>>=1;
134  if (i==7 || i==15) mask>>=1;
135  }
136  return m;
137 }
138 
139 void print_mword_properties(unsigned int mword) {
140  int LE = driftTimeBin(mword);
141  int TE = trailingEdge(mword);
142  int ToT = bitTimeOverThreshold(mword);
143  int nLT = nLTbits(mword);
144  std::cout << "AJB " << LE << " " << TE << " " << ToT << " " << nLT << std::endl;
145 }
146 
147 /*
148  bool driftTimeValid(unsigned int m_word) {
149  return m_word & 0x08000000;
150  }
151 
152  void setDriftTimeValid(bool valid) {
153  unsigned maskfalse = 0xF7FFFFFF;
154  unsigned masktrue = 0x08000000;
155  if( valid ) {
156  m_word |= masktrue;
157  } else {
158  m_word &= maskfalse; }
159  }
160 
161  bool isNoise(unsigned int m_word) {
162  if( timeOverThreshold(unsigned int m_word) < 5. || timeOverThreshold(unsigned int m_word) > 60. ) return true;
163  return false;
164  }
165 */
166 
167 #endif
plotBeamSpotCompare.x1
x1
Definition: plotBeamSpotCompare.py:216
lastBinHigh
bool lastBinHigh(unsigned int m_word)
Definition: driftCircle.h:108
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
highLevel2
bool highLevel2(unsigned int m_word)
Definition: driftCircle.h:96
bits27
void bits27(unsigned int n)
Definition: driftCircle.h:24
bits32
void bits32(unsigned int n)
Definition: driftCircle.h:14
highLevel1
bool highLevel1(unsigned int m_word)
Definition: driftCircle.h:92
Trk::u
@ u
Enums for curvilinear frames.
Definition: ParamDefs.h:77
binWidth
void binWidth(TH1 *h)
Definition: listroot.cxx:80
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
bitTimeOverThreshold
int bitTimeOverThreshold(unsigned int m_word)
Definition: driftCircle.h:124
highLevel
bool highLevel(unsigned int m_word)
Definition: driftCircle.h:88
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
SignEnum::LE
@ LE
Definition: SignEnums.h:21
highLevel3
bool highLevel3(unsigned int m_word)
Definition: driftCircle.h:100
bits24
void bits24(unsigned int n)
Definition: driftCircle.h:38
rawDriftTime
double rawDriftTime(unsigned int m_word)
Definition: driftCircle.h:112
lowLevelMiddle
bool lowLevelMiddle(unsigned int m_word)
Definition: driftCircle.h:84
firstBinHigh
bool firstBinHigh(unsigned int m_word)
Definition: driftCircle.h:104
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
nLTbits
int nLTbits(unsigned int m_word)
Definition: driftCircle.h:128
print_mword_properties
void print_mword_properties(unsigned int mword)
Definition: driftCircle.h:139
timeOverThreshold
double timeOverThreshold(unsigned int m_word)
Definition: driftCircle.h:116
trailingEdge
int trailingEdge(unsigned int m_word)
Definition: driftCircle.h:64
fitman.k
k
Definition: fitman.py:528
driftTimeBin
int driftTimeBin(unsigned int m_word)
Definition: driftCircle.h:50