]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TOF/AliTOFChannelOnlineStatusArray.cxx
4a7a1c7d9dfe00554745675cb0c4b55a49ef6428
[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 {
36         //default constructor
37 }
38 //________________________________________________________________
39 AliTOFChannelOnlineStatusArray::~AliTOFChannelOnlineStatusArray()
40 {
41         //distructor
42         delete [] fArray;
43 }
44 //________________________________________________________________
45 AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(Int_t size):
46         TObject(),
47         fSize(size),
48         fArray(new UChar_t[size])
49 {
50         // ctor with size
51         for (Int_t ich = 0; ich<size; ich ++){
52           SetStatus(ich,kTOFOnlineUnknown);
53         }
54 }
55 //________________________________________________________________
56 AliTOFChannelOnlineStatusArray::AliTOFChannelOnlineStatusArray(const AliTOFChannelOnlineStatusArray & source):
57       TObject(),
58       fSize(0),
59       fArray(0x0)
60
61         // copy constructor
62         this->fSize= source.fSize;
63         this->fArray= source.fArray;
64 }
65 //________________________________________________________________
66 AliTOFChannelOnlineStatusArray &AliTOFChannelOnlineStatusArray::operator=(const AliTOFChannelOnlineStatusArray & source) 
67
68         // assignment operator
69         this->fSize= source.fSize;
70         this->fArray= source.fArray;
71         return *this;
72 }
73 //________________________________________________________________
74 void AliTOFChannelOnlineStatusArray::SetStatus(Int_t pos, UChar_t parr)
75 {
76         // setting status for channel at position = pos
77         AliDebug(2,Form("status = %d",(UInt_t)parr));
78         if (pos>-1 && pos < fSize)fArray[pos] = parr;
79         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
80 }
81 //________________________________________________________________
82 void AliTOFChannelOnlineStatusArray::SetHWStatus(Int_t pos, UChar_t parr)
83 {
84         // setting status for channel at position = pos
85         AliDebug(2,Form("HW status = %d",(UInt_t)parr));
86         if (pos>-1 && pos < fSize) {
87                 fArray[pos] &= kTOFHWReset;
88                 fArray[pos] |= parr;
89         }
90         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
91 }
92 //________________________________________________________________
93 void AliTOFChannelOnlineStatusArray::SetPulserStatus(Int_t pos, UChar_t parr)
94 {
95         // setting status for channel at position = pos
96         AliDebug(2,Form("Pulser status = %d",(UInt_t)parr));
97         if (pos>-1 && pos < fSize){
98                 fArray[pos] &= kTOFPulserReset;
99                 fArray[pos] |= parr;
100         }
101         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
102 }
103 //________________________________________________________________
104 void AliTOFChannelOnlineStatusArray::SetNoiseStatus(Int_t pos, UChar_t parr)
105 {
106         // setting status for channel at position = pos
107         AliDebug(2,Form("Noise status = %d",(UInt_t)parr));
108         if (pos>-1 && pos < fSize){
109                 fArray[pos] &= kTOFNoiseReset;
110                 fArray[pos] |= parr;
111         }
112         AliDebug(2,Form("fArray[%d] = %d",pos,(UInt_t)fArray[pos]));
113 }
114 //________________________________________________________________
115 UChar_t AliTOFChannelOnlineStatusArray::GetStatus(Int_t pos) const 
116 {
117         // getting the status for channel at position = pos 
118         UChar_t parr = 0x0; 
119         if  (pos>-1 && pos < fSize)parr = fArray[pos];
120         return parr;
121 }
122 //________________________________________________________________
123 UChar_t AliTOFChannelOnlineStatusArray::GetHWStatus(Int_t pos) const 
124 {
125         // getting the HW status for channel at position = pos 
126         UChar_t parr = 0x0; 
127         if  (pos>-1 && pos < fSize)parr = fArray[pos];
128         AliDebug(2,Form("parr = %d ",(UInt_t)parr));
129         UChar_t hwSt = parr & kTOFHW;
130         //UChar_t hwSt = parr & 0x3;
131         return hwSt;
132 }
133 //________________________________________________________________
134 UChar_t AliTOFChannelOnlineStatusArray::GetPulserStatus(Int_t pos) const 
135 {
136         // getting the Pulser status for channel at position = pos 
137         UChar_t parr = 0x0; 
138         if  (pos>-1 && pos < fSize)parr = fArray[pos];
139         AliDebug(2,Form("parr = %d ",(UInt_t)parr));
140         UChar_t pulserSt = parr & kTOFPulser;
141         //UChar_t pulserSt = parr & 0xc;
142         return pulserSt;
143     }
144 //________________________________________________________________
145 UChar_t AliTOFChannelOnlineStatusArray::GetNoiseStatus(Int_t pos) const 
146 {
147         // getting the noise status for channel at position = pos 
148         UChar_t parr = 0x0; 
149         if  (pos>-1 && pos < fSize)parr = fArray[pos];
150         AliDebug(2,Form("parr = %d ",(UInt_t)parr));
151         UChar_t noiseSt = parr & kTOFNoise;
152         //      UChar_t noiseSt = parr & 0x30;
153         return noiseSt; 
154 }