]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFChannelOnlineStatusArray.cxx
Moving PWG1 to PWGPP
[u/mrichter/AliRoot.git] / TOF / AliTOFChannelOnlineStatusArray.cxx
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),
34         fArray(0x0),
35         fLatencyWindow(0x0)
36 {
37         //default constructor
38 }
39 //________________________________________________________________
40 AliTOFChannelOnlineStatusArray::~AliTOFChannelOnlineStatusArray()
41 {
42         //distructor
43         delete [] fArray;
44         delete [] fLatencyWindow;
45 }
46 //________________________________________________________________
47 AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(Int_t size):
48         TObject(),
49         fSize(size),
50         fArray(new UChar_t[size]),
51         fLatencyWindow(new Int_t[size])
52 {
53         // ctor with size
54         for (Int_t ich = 0; ich<size; ich ++){
55           SetStatus(ich,kTOFOnlineUnknown);
56           SetLatencyWindow(ich, 0);
57         }
58 }
59 //________________________________________________________________
60 AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(const AliTOFChannelOnlineStatusArray & source):
61       TObject(),
62       fSize(source.fSize),
63       fArray(0x0),
64       fLatencyWindow(0x0)
65
66         // copy constructor
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         }
73 }
74 //________________________________________________________________
75 AliTOFChannelOnlineStatusArray &AliTOFChannelOnlineStatusArray::operator=(const AliTOFChannelOnlineStatusArray & source) 
76
77         // assignment operator
78
79   if (this == &source)
80     return *this;
81
82   TObject::operator=(source);
83   fSize= source.fSize;
84   fArray = new UChar_t[fSize];
85   fLatencyWindow = new Int_t[fSize];
86   for (Int_t ich = 0; ich<fSize; ich ++){
87           fArray[ich] = source.fArray[ich];
88           fLatencyWindow[ich] = source.fLatencyWindow[ich];
89   }
90   return *this;
91 }
92 //________________________________________________________________
93 void AliTOFChannelOnlineStatusArray::SetStatus(Int_t pos, UChar_t parr)
94 {
95         // setting status for channel at position = pos
96         AliDebug(2,Form("status = %d",(UInt_t)parr));
97         if (pos>-1 && pos < fSize)fArray[pos] = parr;
98         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
99 }
100 //________________________________________________________________
101 void AliTOFChannelOnlineStatusArray::SetHWStatus(Int_t pos, UChar_t parr)
102 {
103         // setting status for channel at position = pos
104         AliDebug(2,Form("HW status = %d",(UInt_t)parr));
105         if (pos>-1 && pos < fSize) {
106                 fArray[pos] &= kTOFHWReset;
107                 fArray[pos] |= parr;
108         }
109         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
110 }
111 //________________________________________________________________
112 void AliTOFChannelOnlineStatusArray::SetPulserStatus(Int_t pos, UChar_t parr)
113 {
114         // setting status for channel at position = pos
115         AliDebug(2,Form("Pulser status = %d",(UInt_t)parr));
116         if (pos>-1 && pos < fSize){
117                 fArray[pos] &= kTOFPulserReset;
118                 fArray[pos] |= parr;
119         }
120         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
121 }
122 //________________________________________________________________
123 void AliTOFChannelOnlineStatusArray::SetNoiseStatus(Int_t pos, UChar_t parr)
124 {
125         // setting status for channel at position = pos
126         AliDebug(2,Form("Noise status = %d",(UInt_t)parr));
127         if (pos>-1 && pos < fSize){
128                 fArray[pos] &= kTOFNoiseReset;
129                 fArray[pos] |= parr;
130         }
131         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
132 }
133 //________________________________________________________________
134 void AliTOFChannelOnlineStatusArray::SetLatencyWindow(Int_t pos, Int_t parr)
135 {
136         // setting latency window for channel at position = pos
137   if (!fLatencyWindow) {
138     AliWarning("couldn't set latency window");
139     return;
140   }
141         // setting latency window for channel at position = pos
142         AliDebug(2,Form("Latency window = %d",parr));
143         if (pos>-1 && pos < fSize){
144           fLatencyWindow[pos] = parr;
145         }
146         AliDebug(2,Form("fLatencyWindow[%d] = %d",pos,fLatencyWindow[pos]));
147 }
148 //________________________________________________________________
149 UChar_t AliTOFChannelOnlineStatusArray::GetStatus(Int_t pos) const 
150 {
151         // getting the status for channel at position = pos 
152         UChar_t parr = 0x0; 
153         if  (pos>-1 && pos < fSize)parr = fArray[pos];
154         return parr;
155 }
156 //________________________________________________________________
157 UChar_t AliTOFChannelOnlineStatusArray::GetHWStatus(Int_t pos) const 
158 {
159         // getting the HW status for channel at position = pos 
160         UChar_t parr = 0x0; 
161         if  (pos>-1 && pos < fSize)parr = fArray[pos];
162         AliDebug(2,Form("parr = %d ",(UInt_t)parr));
163         UChar_t hwSt = parr & kTOFHW;
164         //UChar_t hwSt = parr & 0x3;
165         return hwSt;
166 }
167 //________________________________________________________________
168 UChar_t AliTOFChannelOnlineStatusArray::GetPulserStatus(Int_t pos) const 
169 {
170         // getting the Pulser status for channel at position = pos 
171         UChar_t parr = 0x0; 
172         if  (pos>-1 && pos < fSize)parr = fArray[pos];
173         AliDebug(2,Form("parr = %d ",(UInt_t)parr));
174         UChar_t pulserSt = parr & kTOFPulser;
175         //UChar_t pulserSt = parr & 0xc;
176         return pulserSt;
177     }
178 //________________________________________________________________
179 UChar_t AliTOFChannelOnlineStatusArray::GetNoiseStatus(Int_t pos) const 
180 {
181         // getting the noise status for channel at position = pos 
182         UChar_t parr = 0x0; 
183         if  (pos>-1 && pos < fSize)parr = fArray[pos];
184         AliDebug(2,Form("parr = %d ",(UInt_t)parr));
185         UChar_t noiseSt = parr & kTOFNoise;
186         //      UChar_t noiseSt = parr & 0x30;
187         return noiseSt; 
188 }
189 //________________________________________________________________
190 Int_t AliTOFChannelOnlineStatusArray::GetLatencyWindow(Int_t pos) const 
191 {
192         // getting the latency window for channel at position = pos 
193   Int_t lw = 0; 
194   if (!fLatencyWindow) {
195     AliWarning("cannot get latency window");
196     return lw;
197   }
198   if  (pos>-1 && pos < fSize)lw = fLatencyWindow[pos];
199   AliDebug(2,Form("lw = %d ",lw));
200   return lw;
201 }