]>
Commit | Line | Data |
---|---|---|
e526983e | 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 | /* $Id: AliTRDPrfInfo.cxx 27946 2008-08-13 15:26:24Z cblume $ */ | |
17 | ||
18 | /////////////////////////////////////////////////////////////////////////////// | |
19 | // // | |
20 | // Calibration base class for a single ROC // | |
21 | // Contains one UShort_t value per pad // | |
22 | // However, values are set and get as float, there are stored internally as // | |
23 | // (UShort_t) value * 10000 // | |
24 | // // | |
25 | /////////////////////////////////////////////////////////////////////////////// | |
26 | ||
e526983e | 27 | #include "AliTRDPrfInfo.h" |
e526983e | 28 | |
29 | ClassImp(AliTRDPrfInfo) | |
30 | ||
31 | //_____________________________________________________________________________ | |
32 | AliTRDPrfInfo::AliTRDPrfInfo() | |
33 | :TObject() | |
34 | ,fSize(0) | |
35 | ,fData(0) | |
36 | { | |
37 | // | |
38 | // Default constructor | |
39 | // | |
40 | ||
41 | } | |
42 | ||
43 | //_____________________________________________________________________________ | |
44 | AliTRDPrfInfo::AliTRDPrfInfo(Int_t n) | |
45 | :TObject() | |
46 | ,fSize(n) | |
47 | ,fData(0) | |
48 | { | |
49 | // | |
50 | // Constructor that initializes a given size | |
51 | // | |
52 | ||
53 | fData = new UChar_t[n]; | |
54 | for(Int_t k = 0; k < fSize; k++){ | |
55 | fData[k] = 0; | |
56 | } | |
57 | } | |
58 | //_____________________________________________________________________________ | |
59 | AliTRDPrfInfo::AliTRDPrfInfo(const AliTRDPrfInfo &c) | |
60 | :TObject(c) | |
61 | ,fSize(c.fSize) | |
62 | ,fData(0) | |
63 | { | |
64 | // | |
65 | // AliTRDPrfInfo copy constructor | |
66 | // | |
67 | ||
68 | Int_t iBin = 0; | |
69 | ||
70 | fData = new UChar_t[fSize]; | |
71 | for (iBin = 0; iBin < fSize; iBin++) { | |
72 | fData[iBin] = ((AliTRDPrfInfo &) c).fData[iBin]; | |
73 | } | |
74 | ||
75 | } | |
76 | //_____________________________________________________________________________ | |
77 | AliTRDPrfInfo::~AliTRDPrfInfo() | |
78 | { | |
79 | // | |
80 | // AliTRDPrfInfo destructor | |
81 | // | |
82 | ||
83 | if (fData) { | |
84 | delete [] fData; | |
85 | fData = 0; | |
86 | } | |
87 | ||
88 | } | |
89 | //_____________________________________________________________________________ | |
90 | AliTRDPrfInfo &AliTRDPrfInfo::operator=(const AliTRDPrfInfo &c) | |
91 | { | |
92 | // | |
93 | // Assignment operator | |
94 | // | |
95 | ||
96 | if (this != &c) ((AliTRDPrfInfo &) c).Copy(*this); | |
97 | return *this; | |
98 | ||
99 | } | |
100 | ||
101 | //_____________________________________________________________________________ | |
102 | void AliTRDPrfInfo::Copy(TObject &c) const | |
103 | { | |
104 | // | |
105 | // Copy function | |
106 | // | |
107 | ||
108 | Int_t iBin = 0; | |
109 | ||
110 | ((AliTRDPrfInfo &) c).fSize = fSize; | |
111 | ||
112 | if (((AliTRDPrfInfo &) c).fData) delete [] ((AliTRDPrfInfo &) c).fData; | |
113 | ((AliTRDPrfInfo &) c).fData = new UChar_t[fSize]; | |
114 | for (iBin = 0; iBin < fSize; iBin++) { | |
115 | ((AliTRDPrfInfo &) c).fData[iBin] = fData[iBin]; | |
116 | } | |
117 | ||
118 | TObject::Copy(c); | |
119 | ||
120 | } | |
121 | //_____________________________________________________________________________ | |
122 | void AliTRDPrfInfo::SetSize(Int_t n) | |
123 | { | |
124 | // | |
125 | // Set the size | |
126 | // | |
127 | ||
128 | if(fData) delete [] fData; | |
129 | fData = new UChar_t[n]; | |
130 | ||
131 | fSize = n; | |
132 | ||
133 | } |