]>
Commit | Line | Data |
---|---|---|
17149e6b | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /////////////////////////////////////////////////////////////////////////////// | |
17 | // // | |
18 | // class for TOF Online calibration: defining channel status // | |
19 | // New object created, to use an array instead of a TObjArray. // | |
20 | // Storing all the info coming from HW FEE map, pulser runs, and noise // | |
21 | // runs in a single object (char). // | |
22 | // // | |
23 | /////////////////////////////////////////////////////////////////////////////// | |
24 | ||
25 | #include <AliTOFChannelOnlineStatusArray.h> | |
26 | #include <AliLog.h> | |
27 | ||
28 | ClassImp(AliTOFChannelOnlineStatusArray) | |
29 | ||
30 | //________________________________________________________________ | |
31 | AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(): | |
32 | TObject(), | |
33 | fSize(0), | |
02ede0c4 | 34 | fArray(0x0), |
35 | fLatencyWindow(0x0) | |
17149e6b | 36 | { |
37 | //default constructor | |
38 | } | |
39 | //________________________________________________________________ | |
e88f3330 | 40 | AliTOFChannelOnlineStatusArray::~AliTOFChannelOnlineStatusArray() |
41 | { | |
42 | //distructor | |
43 | delete [] fArray; | |
02ede0c4 | 44 | delete [] fLatencyWindow; |
e88f3330 | 45 | } |
46 | //________________________________________________________________ | |
17149e6b | 47 | AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(Int_t size): |
48 | TObject(), | |
49 | fSize(size), | |
02ede0c4 | 50 | fArray(new UChar_t[size]), |
51 | fLatencyWindow(new Int_t[size]) | |
17149e6b | 52 | { |
53 | // ctor with size | |
54 | for (Int_t ich = 0; ich<size; ich ++){ | |
55 | SetStatus(ich,kTOFOnlineUnknown); | |
2bf4d9d6 | 56 | SetLatencyWindow(ich, 0); |
17149e6b | 57 | } |
58 | } | |
59 | //________________________________________________________________ | |
60 | AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(const AliTOFChannelOnlineStatusArray & source): | |
61 | TObject(), | |
8a190ba2 | 62 | fSize(source.fSize), |
227c3238 | 63 | fArray(0x0), |
64 | fLatencyWindow(0x0) | |
17149e6b | 65 | { |
66 | // copy constructor | |
227c3238 | 67 | fArray = new UChar_t[fSize]; |
68 | fLatencyWindow = new Int_t[fSize]; | |
69 | for (Int_t ich = 0; ich<fSize; ich ++){ | |
70 | fArray[ich] = source.fArray[ich]; | |
71 | fLatencyWindow[ich] = source.fLatencyWindow[ich]; | |
72 | } | |
17149e6b | 73 | } |
74 | //________________________________________________________________ | |
75 | AliTOFChannelOnlineStatusArray &AliTOFChannelOnlineStatusArray::operator=(const AliTOFChannelOnlineStatusArray & source) | |
76 | { | |
77 | // assignment operator | |
8a190ba2 | 78 | |
79 | if (this == &source) | |
80 | return *this; | |
81 | ||
82 | TObject::operator=(source); | |
83 | fSize= source.fSize; | |
16e3d8ea | 84 | fArray = new UChar_t[fSize]; |
85 | fLatencyWindow = new Int_t[fSize]; | |
86 | memcpy(fArray,source.fArray,sizeof(UChar_t)*fSize); | |
87 | memcpy(fLatencyWindow,source.fLatencyWindow,sizeof(Int_t)*fSize); | |
88 | ||
8a190ba2 | 89 | return *this; |
17149e6b | 90 | } |
91 | //________________________________________________________________ | |
92 | void AliTOFChannelOnlineStatusArray::SetStatus(Int_t pos, UChar_t parr) | |
93 | { | |
94 | // setting status for channel at position = pos | |
95 | AliDebug(2,Form("status = %d",(UInt_t)parr)); | |
96 | if (pos>-1 && pos < fSize)fArray[pos] = parr; | |
97 | AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos])); | |
98 | } | |
99 | //________________________________________________________________ | |
100 | void AliTOFChannelOnlineStatusArray::SetHWStatus(Int_t pos, UChar_t parr) | |
101 | { | |
102 | // setting status for channel at position = pos | |
103 | AliDebug(2,Form("HW status = %d",(UInt_t)parr)); | |
104 | if (pos>-1 && pos < fSize) { | |
105 | fArray[pos] &= kTOFHWReset; | |
106 | fArray[pos] |= parr; | |
107 | } | |
108 | AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos])); | |
109 | } | |
110 | //________________________________________________________________ | |
111 | void AliTOFChannelOnlineStatusArray::SetPulserStatus(Int_t pos, UChar_t parr) | |
112 | { | |
113 | // setting status for channel at position = pos | |
114 | AliDebug(2,Form("Pulser status = %d",(UInt_t)parr)); | |
115 | if (pos>-1 && pos < fSize){ | |
116 | fArray[pos] &= kTOFPulserReset; | |
117 | fArray[pos] |= parr; | |
118 | } | |
119 | AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos])); | |
120 | } | |
121 | //________________________________________________________________ | |
122 | void AliTOFChannelOnlineStatusArray::SetNoiseStatus(Int_t pos, UChar_t parr) | |
123 | { | |
124 | // setting status for channel at position = pos | |
125 | AliDebug(2,Form("Noise status = %d",(UInt_t)parr)); | |
126 | if (pos>-1 && pos < fSize){ | |
127 | fArray[pos] &= kTOFNoiseReset; | |
128 | fArray[pos] |= parr; | |
129 | } | |
130 | AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos])); | |
131 | } | |
132 | //________________________________________________________________ | |
02ede0c4 | 133 | void AliTOFChannelOnlineStatusArray::SetLatencyWindow(Int_t pos, Int_t parr) |
134 | { | |
051a7fe6 | 135 | // setting latency window for channel at position = pos |
134e5594 | 136 | if (!fLatencyWindow) { |
137 | AliWarning("couldn't set latency window"); | |
138 | return; | |
139 | } | |
02ede0c4 | 140 | // setting latency window for channel at position = pos |
141 | AliDebug(2,Form("Latency window = %d",parr)); | |
142 | if (pos>-1 && pos < fSize){ | |
143 | fLatencyWindow[pos] = parr; | |
144 | } | |
145 | AliDebug(2,Form("fLatencyWindow[%d] = %d",pos,fLatencyWindow[pos])); | |
146 | } | |
147 | //________________________________________________________________ | |
17149e6b | 148 | UChar_t AliTOFChannelOnlineStatusArray::GetStatus(Int_t pos) const |
149 | { | |
150 | // getting the status for channel at position = pos | |
151 | UChar_t parr = 0x0; | |
152 | if (pos>-1 && pos < fSize)parr = fArray[pos]; | |
153 | return parr; | |
154 | } | |
155 | //________________________________________________________________ | |
156 | UChar_t AliTOFChannelOnlineStatusArray::GetHWStatus(Int_t pos) const | |
157 | { | |
158 | // getting the HW status for channel at position = pos | |
159 | UChar_t parr = 0x0; | |
160 | if (pos>-1 && pos < fSize)parr = fArray[pos]; | |
161 | AliDebug(2,Form("parr = %d ",(UInt_t)parr)); | |
162 | UChar_t hwSt = parr & kTOFHW; | |
163 | //UChar_t hwSt = parr & 0x3; | |
164 | return hwSt; | |
165 | } | |
166 | //________________________________________________________________ | |
167 | UChar_t AliTOFChannelOnlineStatusArray::GetPulserStatus(Int_t pos) const | |
168 | { | |
169 | // getting the Pulser status for channel at position = pos | |
170 | UChar_t parr = 0x0; | |
171 | if (pos>-1 && pos < fSize)parr = fArray[pos]; | |
172 | AliDebug(2,Form("parr = %d ",(UInt_t)parr)); | |
173 | UChar_t pulserSt = parr & kTOFPulser; | |
174 | //UChar_t pulserSt = parr & 0xc; | |
175 | return pulserSt; | |
176 | } | |
177 | //________________________________________________________________ | |
178 | UChar_t AliTOFChannelOnlineStatusArray::GetNoiseStatus(Int_t pos) const | |
179 | { | |
180 | // getting the noise status for channel at position = pos | |
181 | UChar_t parr = 0x0; | |
182 | if (pos>-1 && pos < fSize)parr = fArray[pos]; | |
183 | AliDebug(2,Form("parr = %d ",(UInt_t)parr)); | |
184 | UChar_t noiseSt = parr & kTOFNoise; | |
185 | // UChar_t noiseSt = parr & 0x30; | |
186 | return noiseSt; | |
187 | } | |
02ede0c4 | 188 | //________________________________________________________________ |
189 | Int_t AliTOFChannelOnlineStatusArray::GetLatencyWindow(Int_t pos) const | |
190 | { | |
191 | // getting the latency window for channel at position = pos | |
2bf4d9d6 | 192 | Int_t lw = 0; |
134e5594 | 193 | if (!fLatencyWindow) { |
194 | AliWarning("cannot get latency window"); | |
195 | return lw; | |
196 | } | |
02ede0c4 | 197 | if (pos>-1 && pos < fSize)lw = fLatencyWindow[pos]; |
198 | AliDebug(2,Form("lw = %d ",lw)); | |
199 | return lw; | |
200 | } |