3b170fc62dd57fb9f68850d4ee03925fac490a15
[u/mrichter/AliRoot.git] / TOF / AliTOFChannelOnlineArray.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 delay                  //
19 // using an array instead of a TObjArray                                     //
20 //                                                                           //
21 ///////////////////////////////////////////////////////////////////////////////
22
23 #include <AliTOFChannelOnlineArray.h>
24 #include <AliLog.h>
25
26 ClassImp(AliTOFChannelOnlineArray)
27
28 //________________________________________________________________
29 AliTOFChannelOnlineArray::AliTOFChannelOnlineArray():
30         TObject(),
31         fSize(0),
32         fArray(0x0)
33 {
34         //default constructor
35 }
36 //________________________________________________________________
37 AliTOFChannelOnlineArray::AliTOFChannelOnlineArray(Int_t size):
38         TObject(),
39         fSize(size),
40         fArray(new Float_t[size])
41 {
42         // ctor with size
43         for (Int_t ich = 0; ich<size; ich ++){
44           SetDelay(ich,0);
45         }
46 }
47 //________________________________________________________________
48 AliTOFChannelOnlineArray::AliTOFChannelOnlineArray(const AliTOFChannelOnlineArray & source):
49       TObject(),
50       fSize(0),
51       fArray(0x0)
52
53         // copy constructor
54         this->fSize= source.fSize;
55         this->fArray= source.fArray;
56 }
57 //________________________________________________________________
58 AliTOFChannelOnlineArray &AliTOFChannelOnlineArray::operator=(const AliTOFChannelOnlineArray & source) 
59
60         // assignment operator
61         this->fSize= source.fSize;
62         this->fArray= source.fArray;
63         return *this;
64 }
65 //________________________________________________________________
66 void AliTOFChannelOnlineArray::SetDelay(Int_t pos, Float_t parr)
67 {
68         // setting status for channel at position = pos
69         AliDebug(2,Form("status = %d",(Float_t)parr));
70         if (pos>-1 && pos < fSize)fArray[pos] = parr;
71         AliDebug(2,Form("fArray[%d] = %d",pos,(Float_t)fArray[pos]));
72 }
73 //________________________________________________________________
74 Float_t AliTOFChannelOnlineArray::GetDelay(Int_t pos) const 
75 {
76         // getting the status for channel at position = pos 
77         Float_t parr = 0x0; 
78         if  (pos>-1 && pos < fSize)parr = fArray[pos];
79         return parr;
80 }