Adding macros to create Calibration objects
[u/mrichter/AliRoot.git] / TRD / TRDbase / 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
02f3bfcc 149 fData = new Char_t[fNchannels];
150 for (Int_t iBin = 0; iBin < fNchannels; iBin++) {
151 fData[iBin] = ((AliTRDCalSingleChamberStatus &) c).fData[iBin];
2745a409 152 }
7754cd1f 153
154}
155
156//_____________________________________________________________________________
157AliTRDCalSingleChamberStatus::~AliTRDCalSingleChamberStatus()
158{
159 //
160 // AliTRDCalSingleChamberStatus destructor
161 //
162
163 if (fData) {
164 delete [] fData;
165 fData = 0;
166 }
2745a409 167
7754cd1f 168}
169
170//_____________________________________________________________________________
171AliTRDCalSingleChamberStatus &AliTRDCalSingleChamberStatus::operator=(const AliTRDCalSingleChamberStatus &c)
172{
173 //
174 // Assignment operator
175 //
176
a2865918 177 if (this == &c) {
178 return *this;
179 }
180
181 fPla = c.fPla;
182 fCha = c.fCha;
183 fNrows = c.fNrows;
184 fNcols = c.fNcols;
185 fNchannels = c.fNchannels;
186
187 if (fData) {
188 delete [] fData;
189 }
190 fData = new Char_t[fNchannels];
191 for (Int_t iBin = 0; iBin < fNchannels; iBin++) {
192 fData[iBin] = ((AliTRDCalSingleChamberStatus &) c).fData[iBin];
193 }
194
7754cd1f 195 return *this;
196
197}
198
199//_____________________________________________________________________________
200void AliTRDCalSingleChamberStatus::Copy(TObject &c) const
201{
202 //
203 // Copy function
204 //
205
2745a409 206 Int_t iBin = 0;
7754cd1f 207
2745a409 208 ((AliTRDCalSingleChamberStatus &) c).fPla = fPla;
209 ((AliTRDCalSingleChamberStatus &) c).fCha = fCha;
7754cd1f 210
2745a409 211 ((AliTRDCalSingleChamberStatus &) c).fNrows = fNrows;
212 ((AliTRDCalSingleChamberStatus &) c).fNcols = fNcols;
7754cd1f 213
214 ((AliTRDCalSingleChamberStatus &) c).fNchannels = fNchannels;
215
2745a409 216 if (((AliTRDCalSingleChamberStatus &) c).fData) {
217 delete [] ((AliTRDCalSingleChamberStatus &) c).fData;
218 }
7754cd1f 219 ((AliTRDCalSingleChamberStatus &) c).fData = new Char_t[fNchannels];
220 for (iBin = 0; iBin < fNchannels; iBin++) {
221 ((AliTRDCalSingleChamberStatus &) c).fData[iBin] = fData[iBin];
222 }
223
224 TObject::Copy(c);
225
226}