1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
18 Revision 1.2 2005/11/03 13:09:19 hristov
19 Removing meaningless const declarations (linuxicc)
21 Revision 1.1 2005/10/11 12:31:50 masera
22 Preprocessor classes for SPD (Paul Nilsson)
26 ///////////////////////////////////////////////////////////////////////////
27 // AliITSBadChannelsSPD implementation by P. Nilsson 2005
28 // AUTHOR/CONTACT: Paul.Nilsson@cern.ch
30 // The class is used by the AliITSPreprocessorSPD class to store the
31 // final noisy and dead channel objects in the calibration database for
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
40 ///////////////////////////////////////////////////////////////////////////
42 #include "AliITSBadChannelsSPD.h"
44 ClassImp(AliITSBadChannelsSPD)
46 //__________________________________________________________________________
47 AliITSBadChannelsSPD::AliITSBadChannelsSPD(void) :
49 fBadChannelsArraySize(0),
51 fBadChannelsArray(0x0)
53 // Default constructor
56 //__________________________________________________________________________
57 AliITSBadChannelsSPD::AliITSBadChannelsSPD(const AliITSBadChannelsSPD &bc) :
59 fIndexArraySize(bc.fIndexArraySize),
60 fBadChannelsArraySize(bc.fBadChannelsArraySize),
63 // Default copy constructor
66 fIndexArray = new Int_t[fIndexArraySize];
67 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
70 for (Int_t i = 0; i < fIndexArraySize; i++)
72 fIndexArray[i] = bc.fIndexArray[i];
74 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
76 fBadChannelsArray[i] = bc.fBadChannelsArray[i];
80 //__________________________________________________________________________
81 AliITSBadChannelsSPD::~AliITSBadChannelsSPD(void)
85 delete [] fIndexArray;
87 delete [] fBadChannelsArray;
88 fBadChannelsArray = 0;
91 //__________________________________________________________________________
92 AliITSBadChannelsSPD& AliITSBadChannelsSPD::operator=(const AliITSBadChannelsSPD &bc)
94 // Assignment operator
96 // Guard against self-assignment
100 fIndexArraySize = bc.fIndexArraySize;
101 fBadChannelsArraySize = bc.fBadChannelsArraySize;
103 delete [] fIndexArray;
104 fIndexArray = new Int_t[fIndexArraySize];
106 delete [] fBadChannelsArray;
107 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
110 for (Int_t i = 0; i < fIndexArraySize; i++)
112 fIndexArray[i] = bc.fIndexArray[i];
114 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
116 fBadChannelsArray[i] = bc.fBadChannelsArray[i];
124 //__________________________________________________________________________
125 void AliITSBadChannelsSPD::Put(Int_t* &badChannelsArray, const Int_t &badChannelsArraySize,
126 Int_t* &indexArray, const Int_t &indexArraySize)
128 // Add the bad channels and index arrays
130 fIndexArraySize = indexArraySize;
131 fBadChannelsArraySize = badChannelsArraySize;
133 fIndexArray = new Int_t[fIndexArraySize];
134 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
137 for (Int_t i = 0; i < fIndexArraySize; i++)
139 fIndexArray[i] = indexArray[i];
141 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
143 fBadChannelsArray[i] = badChannelsArray[i];
148 //__________________________________________________________________________
149 Bool_t AliITSBadChannelsSPD::Get(Int_t* &badChannelsArray, Int_t* &indexArray) const
151 // Get the bad channels and the index arrays
153 Bool_t status = kTRUE;
155 // Set the array pointers
156 if (fIndexArraySize > 0)
158 badChannelsArray = fBadChannelsArray;
159 indexArray = fIndexArray;
169 //__________________________________________________________________________
170 Int_t* AliITSBadChannelsSPD::CreateModuleArray(Int_t module) const
172 // Create an Int_t array for a given module
174 Int_t *moduleArray = 0;
176 const Int_t kSize = AliITSBadChannelsSPD::GetModuleArraySize(module);
179 // Create a new array
180 moduleArray = new Int_t[kSize];
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++)
186 moduleArray[index] = fBadChannelsArray[kPosition + index];
193 //__________________________________________________________________________
194 TObjArray* AliITSBadChannelsSPD::CreateModuleObjArray(Int_t module) const
196 // Create a TObjArray for a given module
198 TObjArray *moduleArray = 0;
200 const Int_t kSize = AliITSBadChannelsSPD::GetModuleObjArraySize(module);
203 // Create a new array
204 moduleArray = new TObjArray(kSize);
206 // Copy the module data into the module array from the bad channels array
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;
214 // Create and add the current channel
215 AliITSChannelSPD *channel = new AliITSChannelSPD(fBadChannelsArray[position++], fBadChannelsArray[position++]);
216 moduleArray->Add(channel);
218 // Go to next bad channel