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 **************************************************************************/
20 ///////////////////////////////////////////////////////////////////////////
21 // AliITSBadChannelsSPD implementation by P. Nilsson 2005
22 // AUTHOR/CONTACT: Paul.Nilsson@cern.ch
24 // The class is used by the AliITSPreprocessorSPD class to store the
25 // final noisy and dead channel objects in the calibration database for
28 // An instance of this container class contains all the "bad" channels,
29 // i.e. the noisy or dead channels of the SPD. It contains TObjArrays
30 // for each module of the SPD (240 in total for ALICE, and 6 for the 2004
31 // joint ITS beam test. The instance object should, once filled with data,
32 // be stored in the calibration database. This is done by the SPD
34 ///////////////////////////////////////////////////////////////////////////
36 #include "AliITSBadChannelsSPD.h"
38 ClassImp(AliITSBadChannelsSPD)
40 //__________________________________________________________________________
41 AliITSBadChannelsSPD::AliITSBadChannelsSPD(void) :
43 fBadChannelsArraySize(0),
45 fBadChannelsArray(0x0)
47 // Default constructor
50 //__________________________________________________________________________
51 AliITSBadChannelsSPD::AliITSBadChannelsSPD(const AliITSBadChannelsSPD &bc) :
54 // Default copy constructor
57 fIndexArraySize = bc.fIndexArraySize;
58 fBadChannelsArraySize = bc.fBadChannelsArraySize;
61 fIndexArray = new Int_t[fIndexArraySize];
62 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
65 for (Int_t i = 0; i < fIndexArraySize; i++)
67 fIndexArray[i] = bc.fIndexArray[i];
69 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
71 fBadChannelsArray[i] = bc.fBadChannelsArray[i];
75 //__________________________________________________________________________
76 AliITSBadChannelsSPD::~AliITSBadChannelsSPD(void)
80 delete [] fIndexArray;
82 delete [] fBadChannelsArray;
83 fBadChannelsArray = 0;
86 //__________________________________________________________________________
87 AliITSBadChannelsSPD& AliITSBadChannelsSPD::operator=(const AliITSBadChannelsSPD &bc)
89 // Assignment operator
91 // Guard against self-assignment
95 fIndexArraySize = bc.fIndexArraySize;
96 fBadChannelsArraySize = bc.fBadChannelsArraySize;
98 delete [] fIndexArray;
99 fIndexArray = new Int_t[fIndexArraySize];
101 delete [] fBadChannelsArray;
102 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
105 for (Int_t i = 0; i < fIndexArraySize; i++)
107 fIndexArray[i] = bc.fIndexArray[i];
109 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
111 fBadChannelsArray[i] = bc.fBadChannelsArray[i];
119 //__________________________________________________________________________
120 void AliITSBadChannelsSPD::Put(Int_t* &badChannelsArray, const Int_t &badChannelsArraySize,
121 Int_t* &indexArray, const Int_t &indexArraySize)
123 // Add the bad channels and index arrays
125 fIndexArraySize = indexArraySize;
126 fBadChannelsArraySize = badChannelsArraySize;
128 fIndexArray = new Int_t[fIndexArraySize];
129 fBadChannelsArray = new Int_t[fBadChannelsArraySize];
132 for (Int_t i = 0; i < fIndexArraySize; i++)
134 fIndexArray[i] = indexArray[i];
136 for (Int_t i = 0; i < fBadChannelsArraySize; i++)
138 fBadChannelsArray[i] = badChannelsArray[i];
143 //__________________________________________________________________________
144 Bool_t AliITSBadChannelsSPD::Get(Int_t* &badChannelsArray, Int_t* &indexArray) const
146 // Get the bad channels and the index arrays
148 Bool_t status = kTRUE;
150 // Set the array pointers
151 if (fIndexArraySize > 0)
153 badChannelsArray = fBadChannelsArray;
154 indexArray = fIndexArray;
164 //__________________________________________________________________________
165 Int_t* AliITSBadChannelsSPD::CreateModuleArray(const Int_t module) const
167 // Create an Int_t array for a given module
169 Int_t *moduleArray = 0;
171 const Int_t kSize = AliITSBadChannelsSPD::GetModuleArraySize(module);
174 // Create a new array
175 moduleArray = new Int_t[kSize];
177 // Copy the module data into the module array from the bad channels array
178 const Int_t kPosition = fIndexArray[module];
179 for (Int_t index = 0; index < kSize; index++)
181 moduleArray[index] = fBadChannelsArray[kPosition + index];
188 //__________________________________________________________________________
189 TObjArray* AliITSBadChannelsSPD::CreateModuleObjArray(const Int_t module) const
191 // Create a TObjArray for a given module
193 TObjArray *moduleArray = 0;
195 const Int_t kSize = AliITSBadChannelsSPD::GetModuleObjArraySize(module);
198 // Create a new array
199 moduleArray = new TObjArray(kSize);
201 // Copy the module data into the module array from the bad channels array
203 // Get the start position of the data (skip the number of bad channels, i.e. the first stored number)
204 Int_t position = fIndexArray[module] + 1;
209 // Create and add the current channel
210 AliITSChannelSPD *channel = new AliITSChannelSPD(fBadChannelsArray[position++], fBadChannelsArray[position++]);
211 moduleArray->Add(channel);
213 // Go to next bad channel