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