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