Line data Source code
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 26 : ClassImp(AliTOFChannelOnlineArray)
27 :
28 : //________________________________________________________________
29 : AliTOFChannelOnlineArray::AliTOFChannelOnlineArray():
30 2 : TObject(),
31 2 : fSize(0),
32 2 : fArray(0x0)
33 10 : {
34 : //default constructor
35 4 : }
36 : //________________________________________________________________
37 : AliTOFChannelOnlineArray::~AliTOFChannelOnlineArray()
38 0 : {
39 : //distructor
40 0 : delete [] fArray;
41 0 : }
42 : //________________________________________________________________
43 : AliTOFChannelOnlineArray::AliTOFChannelOnlineArray(Int_t size):
44 0 : TObject(),
45 0 : fSize(size),
46 0 : fArray(new Float_t[size])
47 0 : {
48 : // ctor with size
49 0 : for (Int_t ich = 0; ich<size; ich ++){
50 0 : SetDelay(ich,0);
51 : }
52 0 : }
53 : //________________________________________________________________
54 : AliTOFChannelOnlineArray::AliTOFChannelOnlineArray(const AliTOFChannelOnlineArray & source):
55 0 : TObject(source),
56 0 : fSize(source.fSize),
57 0 : fArray(0x0)
58 0 : {
59 : // copy constructor
60 0 : fArray = new Float_t[fSize];
61 0 : for (Int_t ich = 0; ich<fSize; ich ++){
62 0 : fArray[ich] = source.fArray[ich];
63 : }
64 0 : }
65 : //________________________________________________________________
66 : AliTOFChannelOnlineArray &AliTOFChannelOnlineArray::operator=(const AliTOFChannelOnlineArray & source)
67 : {
68 : // assignment operator
69 :
70 0 : if (this == &source)
71 0 : return *this;
72 :
73 0 : TObject::operator=(source);
74 0 : fSize= source.fSize;
75 0 : delete [] fArray;
76 0 : fArray = new Float_t[fSize];
77 0 : memcpy(fArray,source.fArray,sizeof(Float_t)*fSize);
78 :
79 0 : return *this;
80 0 : }
81 : //________________________________________________________________
82 : void AliTOFChannelOnlineArray::SetDelay(Int_t pos, Float_t parr)
83 : {
84 : // setting status for channel at position = pos
85 0 : AliDebug(2,Form("status = %f",(Float_t)parr));
86 0 : if (pos>-1 && pos < fSize)fArray[pos] = parr;
87 0 : AliDebug(2,Form("fArray[%d] = %f",pos,(Float_t)fArray[pos]));
88 0 : }
89 : //________________________________________________________________
90 : Float_t AliTOFChannelOnlineArray::GetDelay(Int_t pos) const
91 : {
92 : // getting the status for channel at position = pos
93 : Float_t parr = 0x0;
94 0 : if (pos>-1 && pos < fSize)parr = fArray[pos];
95 0 : return parr;
96 : }
|