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.1 2005/10/11 12:31:50 masera
19 Preprocessor classes for SPD (Paul Nilsson)
23 ///////////////////////////////////////////////////////////////////////////
24 // AliITSBadChannelsSPD implementation by P. Nilsson 2005
25 // AUTHOR/CONTACT: Paul.Nilsson@cern.ch
27 // The class is used by the AliITSPreprocessorSPD class to store the
28 // final noisy and dead channel objects in the calibration database for
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
37 ///////////////////////////////////////////////////////////////////////////
39 #include "AliITSBadChannelsSPD.h"
41 ClassImp(AliITSBadChannelsSPD)
43 //__________________________________________________________________________
44 AliITSBadChannelsSPD::AliITSBadChannelsSPD(void) :
46 fBadChannelsArraySize(0),
48 fBadChannelsArray(0x0)
50 // Default constructor
53 //__________________________________________________________________________
54 AliITSBadChannelsSPD::AliITSBadChannelsSPD(const AliITSBadChannelsSPD &bc) :
57 // Default copy constructor
60 fIndexArraySize = bc.fIndexArraySize;
61 fBadChannelsArraySize = bc.fBadChannelsArraySize;
64 fIndexArray = new Int_t[fIndexArraySize];
65 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
68 for (Int_t i = 0; i < fIndexArraySize; i++)
70 fIndexArray[i] = bc.fIndexArray[i];
72 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
74 fBadChannelsArray[i] = bc.fBadChannelsArray[i];
78 //__________________________________________________________________________
79 AliITSBadChannelsSPD::~AliITSBadChannelsSPD(void)
83 delete [] fIndexArray;
85 delete [] fBadChannelsArray;
86 fBadChannelsArray = 0;
89 //__________________________________________________________________________
90 AliITSBadChannelsSPD& AliITSBadChannelsSPD::operator=(const AliITSBadChannelsSPD &bc)
92 // Assignment operator
94 // Guard against self-assignment
98 fIndexArraySize = bc.fIndexArraySize;
99 fBadChannelsArraySize = bc.fBadChannelsArraySize;
101 delete [] fIndexArray;
102 fIndexArray = new Int_t[fIndexArraySize];
104 delete [] fBadChannelsArray;
105 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
108 for (Int_t i = 0; i < fIndexArraySize; i++)
110 fIndexArray[i] = bc.fIndexArray[i];
112 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
114 fBadChannelsArray[i] = bc.fBadChannelsArray[i];
122 //__________________________________________________________________________
123 void AliITSBadChannelsSPD::Put(Int_t* &badChannelsArray, const Int_t &badChannelsArraySize,
124 Int_t* &indexArray, const Int_t &indexArraySize)
126 // Add the bad channels and index arrays
128 fIndexArraySize = indexArraySize;
129 fBadChannelsArraySize = badChannelsArraySize;
131 fIndexArray = new Int_t[fIndexArraySize];
132 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
135 for (Int_t i = 0; i < fIndexArraySize; i++)
137 fIndexArray[i] = indexArray[i];
139 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
141 fBadChannelsArray[i] = badChannelsArray[i];
146 //__________________________________________________________________________
147 Bool_t AliITSBadChannelsSPD::Get(Int_t* &badChannelsArray, Int_t* &indexArray) const
149 // Get the bad channels and the index arrays
151 Bool_t status = kTRUE;
153 // Set the array pointers
154 if (fIndexArraySize > 0)
156 badChannelsArray = fBadChannelsArray;
157 indexArray = fIndexArray;
167 //__________________________________________________________________________
168 Int_t* AliITSBadChannelsSPD::CreateModuleArray(Int_t module) const
170 // Create an Int_t array for a given module
172 Int_t *moduleArray = 0;
174 const Int_t kSize = AliITSBadChannelsSPD::GetModuleArraySize(module);
177 // Create a new array
178 moduleArray = new Int_t[kSize];
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++)
184 moduleArray[index] = fBadChannelsArray[kPosition + index];
191 //__________________________________________________________________________
192 TObjArray* AliITSBadChannelsSPD::CreateModuleObjArray(Int_t module) const
194 // Create a TObjArray for a given module
196 TObjArray *moduleArray = 0;
198 const Int_t kSize = AliITSBadChannelsSPD::GetModuleObjArraySize(module);
201 // Create a new array
202 moduleArray = new TObjArray(kSize);
204 // Copy the module data into the module array from the bad channels array
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;
212 // Create and add the current channel
213 AliITSChannelSPD *channel = new AliITSChannelSPD(fBadChannelsArray[position++], fBadChannelsArray[position++]);
214 moduleArray->Add(channel);
216 // Go to next bad channel