ATLAS Offline Software
Loading...
Searching...
No Matches
TRT_TB04_RawData.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
6// TRT_TB04_RawData.cxx
7// Implementation file for class TRT_TB04_RawData
9// (c) ATLAS Detector software
11// Version 1.0 13/08/2002 Veronique Boisvert
12// Implementation provided by A. Zalite, February 2003
14
15#include <new>
18
19// default constructor
21 TRT_RDORawData(Identifier(), 0) //call base-class constructor
22{
23 m_timeword = 0;
24}
25
26// Constructor with parameters:
28 const unsigned int word) :
29 TRT_RDORawData( rdoId, word) //call base-class constructor
30{
31 m_timeword = 0;
32}
33
34// Constructor with parameters:
35//
37 const unsigned int word,
38 const unsigned int timeword) :
39 TRT_RDORawData( rdoId, word) //call base-class constructor
40{
41 if ( timeword > 25 ) // Fix for bad trigger phase info
42 m_timeword = 0;
43 else
44 m_timeword = timeword;
45}
46
47
48// Destructor:
49//should I be destructing something here?
52
53 // High level threshold:
55{
56 if (m_word & 0x04020100)
57 return true;
58 return false;
59}
60
61 // Time over threshold in ns for valid digits; zero otherwise:
63{
64 double binWidth = 3.125;
65
66 unsigned mask = 0x02000000;
67
68 int i;
69 for (i = 0; i < 24; ++i)
70 {
71 if (m_word & mask)
72 break;
73
74 mask >>= 1;
75 if (i == 7 || i == 15)
76 mask >>= 1;
77 }
78
79 //if (i == 0 || i > 16)
80 // return 0.;
81
82 mask = 0x00000001;
83
84 int j;
85 for (j = 0; j < 24; ++j)
86 {
87 if (m_word & mask)
88 break;
89
90 mask <<= 1;
91 if (j == 7 || j == 15)
92 mask <<= 1;
93 }
94
95 double time = (double) (24 - i - j) * binWidth;
96 return time;
97}
98
99/*
100 * drift time in bin
101 * This is the Wrong Way to do this. We lose half our precision in ns
102 * because we are returning the bin of the leading edge rather than its
103 * time in ns. The precision of the trigger phase is twice that of the
104 * time digitization, but we are forced to add time in 3.125ns steps.
105 */
107{
108 unsigned mask = 0x02000000;
109 int TimeAdjBin;
110
111 int i;
112 for (i = 0; i < 24; ++i)
113 {
114 if (m_word & mask)
115 break;
116
117 mask >>= 1;
118 if (i == 7 || i == 15)
119 mask >>= 1;
120 }
121
122 TimeAdjBin = m_timeword / 2; // 0.5 bin for each PLL step.
123
124 return i + TimeAdjBin;
125}
126
127
128//TRT_TB04_RawData *TRT_TB04_RawData::newObject(const Identifier rdoId, const unsigned int word)
129//{
130// TRT_TB04_RawData *p_rdo=0;
131
132 // create a new object and check
133// try {
134// p_rdo=new TRT_TB04_RawData(rdoId, word);
135// } catch (...) {
136// p_rdo=0;
137// }
138// return p_rdo;
139//}
140
unsigned int m_word
TRT_RDORawData(const Identifier rdoId, const unsigned int word)
virtual bool highLevel() const
High level threshold:
virtual double timeOverThreshold() const
Time over threshold in ns for valid digits; zero otherwise:
unsigned int m_timeword
virtual int driftTimeBin() const
void binWidth(TH1 *h)
Definition listroot.cxx:80