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