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 : /* $Id$ */
17 :
18 : ///////////////////////////////////////////////////////////////////////////////
19 : // //
20 : // Calibration base class for a single ROC //
21 : // Contains one char value per pad //
22 : // //
23 : ///////////////////////////////////////////////////////////////////////////////
24 :
25 : #include "AliTRDCalSingleChamberStatus.h"
26 :
27 48 : ClassImp(AliTRDCalSingleChamberStatus)
28 :
29 : //_____________________________________________________________________________
30 : AliTRDCalSingleChamberStatus::AliTRDCalSingleChamberStatus()
31 1620 : :TObject()
32 1620 : ,fPla(0)
33 1620 : ,fCha(0)
34 1620 : ,fNrows(0)
35 1620 : ,fNcols(0)
36 1620 : ,fNchannels(0)
37 1620 : ,fData(0)
38 8100 : {
39 : //
40 : // Default constructor
41 : //
42 :
43 3240 : }
44 :
45 : //_____________________________________________________________________________
46 : AliTRDCalSingleChamberStatus::AliTRDCalSingleChamberStatus(Int_t p, Int_t c, Int_t cols)
47 0 : :TObject()
48 0 : ,fPla(p)
49 0 : ,fCha(c)
50 0 : ,fNrows(0)
51 0 : ,fNcols(cols)
52 0 : ,fNchannels(0)
53 0 : ,fData(0)
54 0 : {
55 : //
56 : // Constructor that initializes a given pad plane type
57 : //
58 :
59 : //
60 : // The pad plane parameter
61 : //
62 0 : switch (p) {
63 : case 0:
64 0 : if (c == 2) {
65 : // L0C0 type
66 0 : fNrows = 12;
67 0 : }
68 : else {
69 : // L0C1 type
70 0 : fNrows = 16;
71 : }
72 : break;
73 : case 1:
74 0 : if (c == 2) {
75 : // L1C0 type
76 0 : fNrows = 12;
77 0 : }
78 : else {
79 : // L1C1 type
80 0 : fNrows = 16;
81 : }
82 : break;
83 : case 2:
84 0 : if (c == 2) {
85 : // L2C0 type
86 0 : fNrows = 12;
87 0 : }
88 : else {
89 : // L2C1 type
90 0 : fNrows = 16;
91 : }
92 : break;
93 : case 3:
94 0 : if (c == 2) {
95 : // L3C0 type
96 0 : fNrows = 12;
97 0 : }
98 : else {
99 : // L3C1 type
100 0 : fNrows = 16;
101 : }
102 : break;
103 : case 4:
104 0 : if (c == 2) {
105 : // L4C0 type
106 0 : fNrows = 12;
107 0 : }
108 : else {
109 : // L4C1 type
110 0 : fNrows = 16;
111 : }
112 : break;
113 : case 5:
114 0 : if (c == 2) {
115 : // L5C0 type
116 0 : fNrows = 12;
117 0 : }
118 : else {
119 : // L5C1 type
120 0 : fNrows = 16;
121 : }
122 : break;
123 : };
124 :
125 0 : fNchannels = fNrows * fNcols;
126 0 : if (fNchannels != 0) {
127 0 : fData = new Char_t[fNchannels];
128 0 : }
129 0 : for (Int_t i=0; i<fNchannels; ++i) {
130 0 : fData[i] = 0;
131 : }
132 :
133 0 : }
134 :
135 : //_____________________________________________________________________________
136 : AliTRDCalSingleChamberStatus::AliTRDCalSingleChamberStatus(const AliTRDCalSingleChamberStatus &c)
137 0 : :TObject(c)
138 0 : ,fPla(c.fPla)
139 0 : ,fCha(c.fCha)
140 0 : ,fNrows(c.fNrows)
141 0 : ,fNcols(c.fNcols)
142 0 : ,fNchannels(c.fNchannels)
143 0 : ,fData(0)
144 0 : {
145 : //
146 : // AliTRDCalSingleChamberStatus copy constructor
147 : //
148 :
149 0 : fData = new Char_t[fNchannels];
150 0 : for (Int_t iBin = 0; iBin < fNchannels; iBin++) {
151 0 : fData[iBin] = ((AliTRDCalSingleChamberStatus &) c).fData[iBin];
152 : }
153 :
154 0 : }
155 :
156 : //_____________________________________________________________________________
157 : AliTRDCalSingleChamberStatus::~AliTRDCalSingleChamberStatus()
158 0 : {
159 : //
160 : // AliTRDCalSingleChamberStatus destructor
161 : //
162 :
163 0 : if (fData) {
164 0 : delete [] fData;
165 0 : fData = 0;
166 0 : }
167 :
168 0 : }
169 :
170 : //_____________________________________________________________________________
171 : AliTRDCalSingleChamberStatus &AliTRDCalSingleChamberStatus::operator=(const AliTRDCalSingleChamberStatus &c)
172 : {
173 : //
174 : // Assignment operator
175 : //
176 :
177 0 : if (this == &c) {
178 0 : return *this;
179 : }
180 :
181 0 : fPla = c.fPla;
182 0 : fCha = c.fCha;
183 0 : fNrows = c.fNrows;
184 0 : fNcols = c.fNcols;
185 0 : fNchannels = c.fNchannels;
186 :
187 0 : if (fData) {
188 0 : delete [] fData;
189 : }
190 0 : fData = new Char_t[fNchannels];
191 0 : for (Int_t iBin = 0; iBin < fNchannels; iBin++) {
192 0 : fData[iBin] = ((AliTRDCalSingleChamberStatus &) c).fData[iBin];
193 : }
194 :
195 0 : return *this;
196 :
197 0 : }
198 :
199 : //_____________________________________________________________________________
200 : void AliTRDCalSingleChamberStatus::Copy(TObject &c) const
201 : {
202 : //
203 : // Copy function
204 : //
205 :
206 : Int_t iBin = 0;
207 :
208 0 : ((AliTRDCalSingleChamberStatus &) c).fPla = fPla;
209 0 : ((AliTRDCalSingleChamberStatus &) c).fCha = fCha;
210 :
211 0 : ((AliTRDCalSingleChamberStatus &) c).fNrows = fNrows;
212 0 : ((AliTRDCalSingleChamberStatus &) c).fNcols = fNcols;
213 :
214 0 : ((AliTRDCalSingleChamberStatus &) c).fNchannels = fNchannels;
215 :
216 0 : if (((AliTRDCalSingleChamberStatus &) c).fData) {
217 0 : delete [] ((AliTRDCalSingleChamberStatus &) c).fData;
218 : }
219 0 : ((AliTRDCalSingleChamberStatus &) c).fData = new Char_t[fNchannels];
220 0 : for (iBin = 0; iBin < fNchannels; iBin++) {
221 0 : ((AliTRDCalSingleChamberStatus &) c).fData[iBin] = fData[iBin];
222 : }
223 :
224 0 : TObject::Copy(c);
225 :
226 0 : }
|