]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFChannelOnlineStatusArray.cxx
Be sure to load mapping when needed
[u/mrichter/AliRoot.git] / TOF / AliTOFChannelOnlineStatusArray.cxx
CommitLineData
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
28ClassImp(AliTOFChannelOnlineStatusArray)
29
30//________________________________________________________________
31AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray():
32 TObject(),
33 fSize(0),
02ede0c4 34 fArray(0x0),
35 fLatencyWindow(0x0)
17149e6b 36{
37 //default constructor
38}
39//________________________________________________________________
e88f3330 40AliTOFChannelOnlineStatusArray::~AliTOFChannelOnlineStatusArray()
41{
42 //distructor
43 delete [] fArray;
02ede0c4 44 delete [] fLatencyWindow;
e88f3330 45}
46//________________________________________________________________
17149e6b 47AliTOFChannelOnlineStatusArray::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//________________________________________________________________
60AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(const AliTOFChannelOnlineStatusArray & source):
61 TObject(),
8a190ba2 62 fSize(source.fSize),
02ede0c4 63 fArray(source.fArray),
64 fLatencyWindow(source.fLatencyWindow)
17149e6b 65{
66 // copy constructor
17149e6b 67}
68//________________________________________________________________
69AliTOFChannelOnlineStatusArray &AliTOFChannelOnlineStatusArray::operator=(const AliTOFChannelOnlineStatusArray & source)
70{
71 // assignment operator
8a190ba2 72
73 if (this == &source)
74 return *this;
75
76 TObject::operator=(source);
77 fSize= source.fSize;
78 fArray= source.fArray;
02ede0c4 79 fLatencyWindow= source.fLatencyWindow;
8a190ba2 80 return *this;
17149e6b 81}
82//________________________________________________________________
83void AliTOFChannelOnlineStatusArray::SetStatus(Int_t pos, UChar_t parr)
84{
85 // setting status for channel at position = pos
86 AliDebug(2,Form("status = %d",(UInt_t)parr));
87 if (pos>-1 && pos < fSize)fArray[pos] = parr;
88 AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
89}
90//________________________________________________________________
91void AliTOFChannelOnlineStatusArray::SetHWStatus(Int_t pos, UChar_t parr)
92{
93 // setting status for channel at position = pos
94 AliDebug(2,Form("HW status = %d",(UInt_t)parr));
95 if (pos>-1 && pos < fSize) {
96 fArray[pos] &= kTOFHWReset;
97 fArray[pos] |= parr;
98 }
99 AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
100}
101//________________________________________________________________
102void AliTOFChannelOnlineStatusArray::SetPulserStatus(Int_t pos, UChar_t parr)
103{
104 // setting status for channel at position = pos
105 AliDebug(2,Form("Pulser status = %d",(UInt_t)parr));
106 if (pos>-1 && pos < fSize){
107 fArray[pos] &= kTOFPulserReset;
108 fArray[pos] |= parr;
109 }
110 AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
111}
112//________________________________________________________________
113void AliTOFChannelOnlineStatusArray::SetNoiseStatus(Int_t pos, UChar_t parr)
114{
115 // setting status for channel at position = pos
116 AliDebug(2,Form("Noise status = %d",(UInt_t)parr));
117 if (pos>-1 && pos < fSize){
118 fArray[pos] &= kTOFNoiseReset;
119 fArray[pos] |= parr;
120 }
121 AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
122}
123//________________________________________________________________
02ede0c4 124void AliTOFChannelOnlineStatusArray::SetLatencyWindow(Int_t pos, Int_t parr)
125{
051a7fe6 126 // setting latency window for channel at position = pos
134e5594 127 if (!fLatencyWindow) {
128 AliWarning("couldn't set latency window");
129 return;
130 }
02ede0c4 131 // setting latency window for channel at position = pos
132 AliDebug(2,Form("Latency window = %d",parr));
133 if (pos>-1 && pos < fSize){
134 fLatencyWindow[pos] = parr;
135 }
136 AliDebug(2,Form("fLatencyWindow[%d] = %d",pos,fLatencyWindow[pos]));
137}
138//________________________________________________________________
17149e6b 139UChar_t AliTOFChannelOnlineStatusArray::GetStatus(Int_t pos) const
140{
141 // getting the status for channel at position = pos
142 UChar_t parr = 0x0;
143 if (pos>-1 && pos < fSize)parr = fArray[pos];
144 return parr;
145}
146//________________________________________________________________
147UChar_t AliTOFChannelOnlineStatusArray::GetHWStatus(Int_t pos) const
148{
149 // getting the HW status for channel at position = pos
150 UChar_t parr = 0x0;
151 if (pos>-1 && pos < fSize)parr = fArray[pos];
152 AliDebug(2,Form("parr = %d ",(UInt_t)parr));
153 UChar_t hwSt = parr & kTOFHW;
154 //UChar_t hwSt = parr & 0x3;
155 return hwSt;
156}
157//________________________________________________________________
158UChar_t AliTOFChannelOnlineStatusArray::GetPulserStatus(Int_t pos) const
159{
160 // getting the Pulser status for channel at position = pos
161 UChar_t parr = 0x0;
162 if (pos>-1 && pos < fSize)parr = fArray[pos];
163 AliDebug(2,Form("parr = %d ",(UInt_t)parr));
164 UChar_t pulserSt = parr & kTOFPulser;
165 //UChar_t pulserSt = parr & 0xc;
166 return pulserSt;
167 }
168//________________________________________________________________
169UChar_t AliTOFChannelOnlineStatusArray::GetNoiseStatus(Int_t pos) const
170{
171 // getting the noise status for channel at position = pos
172 UChar_t parr = 0x0;
173 if (pos>-1 && pos < fSize)parr = fArray[pos];
174 AliDebug(2,Form("parr = %d ",(UInt_t)parr));
175 UChar_t noiseSt = parr & kTOFNoise;
176 // UChar_t noiseSt = parr & 0x30;
177 return noiseSt;
178}
02ede0c4 179//________________________________________________________________
180Int_t AliTOFChannelOnlineStatusArray::GetLatencyWindow(Int_t pos) const
181{
182 // getting the latency window for channel at position = pos
2bf4d9d6 183 Int_t lw = 0;
134e5594 184 if (!fLatencyWindow) {
185 AliWarning("cannot get latency window");
186 return lw;
187 }
02ede0c4 188 if (pos>-1 && pos < fSize)lw = fLatencyWindow[pos];
189 AliDebug(2,Form("lw = %d ",lw));
190 return lw;
191}