]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/AliITSBadChannelsSPD.cxx
AliHMPIDDigitN no longer needed
[u/mrichter/AliRoot.git] / ITS / AliITSBadChannelsSPD.cxx
CommitLineData
3f0e013c 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/*
17$Log$
e56160b8 18Revision 1.2 2005/11/03 13:09:19 hristov
19Removing meaningless const declarations (linuxicc)
20
eb0b1051 21Revision 1.1 2005/10/11 12:31:50 masera
22Preprocessor classes for SPD (Paul Nilsson)
23
3f0e013c 24*/
25
26///////////////////////////////////////////////////////////////////////////
27// AliITSBadChannelsSPD implementation by P. Nilsson 2005
28// AUTHOR/CONTACT: Paul.Nilsson@cern.ch
29//
30// The class is used by the AliITSPreprocessorSPD class to store the
31// final noisy and dead channel objects in the calibration database for
32// the SPD.
33//
34// An instance of this container class contains all the "bad" channels,
35// i.e. the noisy or dead channels of the SPD. It contains TObjArrays
36// for each module of the SPD (240 in total for ALICE, and 6 for the 2004
37// joint ITS beam test. The instance object should, once filled with data,
38// be stored in the calibration database. This is done by the SPD
39// preprocessor.
40///////////////////////////////////////////////////////////////////////////
41
42#include "AliITSBadChannelsSPD.h"
43
44ClassImp(AliITSBadChannelsSPD)
45
46//__________________________________________________________________________
47AliITSBadChannelsSPD::AliITSBadChannelsSPD(void) :
48 fIndexArraySize(0),
49 fBadChannelsArraySize(0),
50 fIndexArray(0x0),
51 fBadChannelsArray(0x0)
52{
53 // Default constructor
54}
55
56//__________________________________________________________________________
57AliITSBadChannelsSPD::AliITSBadChannelsSPD(const AliITSBadChannelsSPD &bc) :
e56160b8 58 TObject(bc),
59fIndexArraySize(bc.fIndexArraySize),
60fBadChannelsArraySize(bc.fBadChannelsArraySize),
61fIndexArray(0),
62fBadChannelsArray(0){
3f0e013c 63 // Default copy constructor
64
3f0e013c 65 // Create new arrays
66 fIndexArray = new Int_t[fIndexArraySize];
67 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
68
69 // Copy arrays
70 for (Int_t i = 0; i < fIndexArraySize; i++)
71 {
72 fIndexArray[i] = bc.fIndexArray[i];
73 }
74 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
75 {
76 fBadChannelsArray[i] = bc.fBadChannelsArray[i];
77 }
78}
79
80//__________________________________________________________________________
81AliITSBadChannelsSPD::~AliITSBadChannelsSPD(void)
82{
83 // Default destructor
84
85 delete [] fIndexArray;
86 fIndexArray = 0;
87 delete [] fBadChannelsArray;
88 fBadChannelsArray = 0;
89}
90
91//__________________________________________________________________________
92AliITSBadChannelsSPD& AliITSBadChannelsSPD::operator=(const AliITSBadChannelsSPD &bc)
93{
94 // Assignment operator
95
96 // Guard against self-assignment
97 if (this != &bc)
98 {
99 // Copy array sizes
100 fIndexArraySize = bc.fIndexArraySize;
101 fBadChannelsArraySize = bc.fBadChannelsArraySize;
102
103 delete [] fIndexArray;
104 fIndexArray = new Int_t[fIndexArraySize];
105
106 delete [] fBadChannelsArray;
107 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
108
109 // Copy arrays
110 for (Int_t i = 0; i < fIndexArraySize; i++)
111 {
112 fIndexArray[i] = bc.fIndexArray[i];
113 }
114 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
115 {
116 fBadChannelsArray[i] = bc.fBadChannelsArray[i];
117 }
118 }
119
120 return *this;
121}
122
123
124//__________________________________________________________________________
125void AliITSBadChannelsSPD::Put(Int_t* &badChannelsArray, const Int_t &badChannelsArraySize,
126 Int_t* &indexArray, const Int_t &indexArraySize)
127{
128 // Add the bad channels and index arrays
129
130 fIndexArraySize = indexArraySize;
131 fBadChannelsArraySize = badChannelsArraySize;
132
133 fIndexArray = new Int_t[fIndexArraySize];
134 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
135
136 // Copy the arrays
137 for (Int_t i = 0; i < fIndexArraySize; i++)
138 {
139 fIndexArray[i] = indexArray[i];
140 }
141 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
142 {
143 fBadChannelsArray[i] = badChannelsArray[i];
144 }
145
146}
147
148//__________________________________________________________________________
149Bool_t AliITSBadChannelsSPD::Get(Int_t* &badChannelsArray, Int_t* &indexArray) const
150{
151 // Get the bad channels and the index arrays
152
153 Bool_t status = kTRUE;
154
155 // Set the array pointers
156 if (fIndexArraySize > 0)
157 {
158 badChannelsArray = fBadChannelsArray;
159 indexArray = fIndexArray;
160 }
161 else
162 {
163 status = kFALSE;
164 }
165
166 return status;
167}
168
169//__________________________________________________________________________
eb0b1051 170Int_t* AliITSBadChannelsSPD::CreateModuleArray(Int_t module) const
3f0e013c 171{
172 // Create an Int_t array for a given module
173
174 Int_t *moduleArray = 0;
175
176 const Int_t kSize = AliITSBadChannelsSPD::GetModuleArraySize(module);
177 if (kSize > 0)
178 {
179 // Create a new array
180 moduleArray = new Int_t[kSize];
181
182 // Copy the module data into the module array from the bad channels array
183 const Int_t kPosition = fIndexArray[module];
184 for (Int_t index = 0; index < kSize; index++)
185 {
186 moduleArray[index] = fBadChannelsArray[kPosition + index];
187 }
188 }
189
190 return moduleArray;
191}
192
193//__________________________________________________________________________
eb0b1051 194TObjArray* AliITSBadChannelsSPD::CreateModuleObjArray(Int_t module) const
3f0e013c 195{
196 // Create a TObjArray for a given module
197
198 TObjArray *moduleArray = 0;
199
200 const Int_t kSize = AliITSBadChannelsSPD::GetModuleObjArraySize(module);
201 if (kSize > 0)
202 {
203 // Create a new array
204 moduleArray = new TObjArray(kSize);
205
206 // Copy the module data into the module array from the bad channels array
207
208 // Get the start position of the data (skip the number of bad channels, i.e. the first stored number)
209 Int_t position = fIndexArray[module] + 1;
210
211 Int_t i = 0;
212 while (i < kSize)
213 {
214 // Create and add the current channel
215 AliITSChannelSPD *channel = new AliITSChannelSPD(fBadChannelsArray[position++], fBadChannelsArray[position++]);
216 moduleArray->Add(channel);
217
218 // Go to next bad channel
219 i++;
220 }
221 }
222
223 return moduleArray;
224}