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 **************************************************************************/
17 #include <Riostream.h>
19 #include "AliITSCalibrationSDD.h"
21 //////////////////////////////////////////////////////
22 // Calibration class for set:ITS //
23 // Specific subdetector implementation //
24 // for silicon drift detectors //
27 //////////////////////////////////////////////////////
29 const Double_t AliITSCalibrationSDD::fgkTemperatureDefault = 296.;
30 const Double_t AliITSCalibrationSDD::fgkNoiseDefault = 10.;
31 const Double_t AliITSCalibrationSDD::fgkBaselineDefault = 20.;
32 const Double_t AliITSCalibrationSDD::fgkMinValDefault = 4;
33 //______________________________________________________________________
34 ClassImp(AliITSCalibrationSDD)
36 AliITSCalibrationSDD::AliITSCalibrationSDD(){
37 // default constructor
43 SetNoiseParam(fgkNoiseDefault,fgkBaselineDefault);
44 SetNoiseAfterElectronics();
45 SetThresholds(fgkMinValDefault,0.);
46 SetTemperature(fgkTemperatureDefault);
48 fCPar[1]=(Int_t) fBaseline;
49 fCPar[2]=(Int_t)(2.*fNoiseAfterEl + 0.5);
50 fCPar[3]=(Int_t)(2.*fNoiseAfterEl + 0.5);
56 //______________________________________________________________________
57 AliITSCalibrationSDD::AliITSCalibrationSDD(const char *dataType){
64 SetNoiseParam(fgkNoiseDefault,fgkBaselineDefault);
65 SetNoiseAfterElectronics();
66 SetThresholds(fgkMinValDefault,0.);
67 SetTemperature(fgkTemperatureDefault);
68 SetDataType(dataType);
69 fCPar[0]=(Int_t) fBaseline;
70 fCPar[1]=(Int_t) fBaseline;
71 fCPar[2]=(Int_t)(2.*fNoiseAfterEl + 0.5);
72 fCPar[3]=(Int_t)(2.*fNoiseAfterEl + 0.5);
78 //______________________________________________________________________
79 AliITSCalibrationSDD::AliITSCalibrationSDD(const AliITSCalibrationSDD &ob) : AliITSCalibration(ob) {
81 // Copies are not allowed. The method is protected to avoid misuse.
82 Error("AliITSCalibrationSDD","Copy constructor not allowed\n");
85 //______________________________________________________________________
86 AliITSCalibrationSDD& AliITSCalibrationSDD::operator=(const AliITSCalibrationSDD& /* ob */){
87 // Assignment operator
88 // Assignment is not allowed. The method is protected to avoid misuse.
89 Error("= operator","Assignment operator not allowed\n");
93 //______________________________________________________________________
94 void AliITSCalibrationSDD::SetCompressParam(Int_t cp[8]){
95 // set compression param
100 //printf("\n CompressPar %d %d \n",i,fCPar[i]);
103 //______________________________________________________________________
104 void AliITSCalibrationSDD::GiveCompressParam(Int_t cp[8]) const {
105 // give compression param
108 for (i=0; i<8; i++) {
113 //______________________________________________________________________
114 void AliITSCalibrationSDD::SetDeadChannels(Int_t nchip, Int_t nchan){
115 // Set fGain to zero to simulate a random distribution of
116 // dead modules, dead chips and single dead channels
118 for( Int_t m=0; m<fgkWings; m++ )
119 for( Int_t n=0; n<fgkChips; n++ )
120 for( Int_t p=0; p<fgkChannels; p++ )
123 //fDeadModules = nmod;
125 fDeadChannels = nchan;
128 //if( nmod == 0 && nchip == 0 && nchan == 0 ) return;
130 if( nchip == 0 && nchan == 0 ) return;
131 // if( nmod < 0 || nmod > fgkModules )
133 // cout << "Wrong number of dead modules: " << nmod << endl;
137 Int_t nmax = fgkWings*fgkChips;
138 if( nchip < 0 || nchip > nmax )
140 cout << "Wrong number of dead chips: " << nchip << endl;
143 nmax = (fgkWings*fgkChips - nchip)*fgkChannels;
144 if( nchan < 0 || nchan > nmax )
146 cout << "Wrong number of dead channels: " << nchan << endl;
150 TRandom *gran = new TRandom();
152 // cout << "modules" << endl;
153 Int_t * mod = new Int_t [nmod];
154 Int_t i; //loop variable
155 for( i=0; i<nmod; i++ )
157 mod[i] = (Int_t) (1.+fgkModules*gran->Uniform());
158 cout << i+1 << ": Dead module nr: " << mod[i] << endl;
159 for(Int_t n=0; n<fResponseSDD->Chips(); n++)
160 for(Int_t p=0; p<fResponseSDD->Channels(); p++)
161 fGain[mod[i]-1][n][p] = 0.;
164 // cout << "chips" << endl;
165 Int_t * chip = new Int_t[nchip];
169 Int_t wing = (Int_t) (fgkWings*gran->Uniform() + 1.);
170 if( wing <=0 || wing > fgkWings ) Error("SetDeadChannels","Wrong wing");
172 Int_t chi = (Int_t) (fgkChips*gran->Uniform() + 1.);
173 if( chi <=0 || chi > fgkChips ) Error("SetDeadChannels","Wrong chip:%d\n",chi);
176 for( Int_t m=0; m<fgkChannels; m++ )
177 fGain[wing-1][chi-1][m] = 0.;
180 Int_t * channel = new Int_t[nchan];
181 Int_t * channelChip = new Int_t[nchan];
185 Int_t k; //loop variable
186 Int_t wing = (Int_t) (fgkWings*gran->Uniform() + 1.);
187 if( wing <=0 || wing > fgkWings ) Error("SetDeadChannels","Wrong wing:%d\n",wing);
188 Int_t chipp = (Int_t) (fgkChips*gran->Uniform() + 1.);
189 if( chipp <=0 || chipp > fgkChips ) Error("SetDeadChannels","Wrong chip:%d",chipp);
191 for( k=0; k<nchip; k++)
192 if( chipp == chip[k] ) {
193 flagChip = 1; break; }
194 if( flagChip == 1 ) continue;
196 channel[i-1] = (Int_t) (fgkChannels*gran->Uniform() + 1.);
197 if( channel[i-1] <=0 || channel[i-1] > fgkChannels )
198 Error("SetDeadChannels","Wrong channel:%d\n",channel[i-1]);
199 channelChip[i-1] = chipp;
200 fGain[wing-1][chipp-1][channel[i-1]-1] = 0.;
205 delete [] channelChip;
207 //______________________________________________________________________
208 void AliITSCalibrationSDD::PrintGains() const{
211 if( GetDeadChips() == 0 &&
212 GetDeadChannels() == 0 )
215 // Print Electronics Gains
216 cout << "**************************************************" << endl;
217 cout << " Print Electronics Gains " << endl;
218 cout << "**************************************************" << endl;
220 // Print SDD electronic gains
221 for(Int_t t=0; t<fgkWings;t++)
222 for(Int_t u=0; u<fgkChips;u++)
223 for(Int_t v=0; v<fgkChannels;v++)
225 if( fGain[t][u][v] != 1.0 )
226 cout << "Gain for wing: " << t+1 << ", Chip " << u+1 <<
227 ", Channel " << v+1 << " = " << fGain[t][u][v] << endl;
230 //______________________________________________________________________
231 void AliITSCalibrationSDD::Print(){
232 // Print SDD response Parameters
234 cout << "**************************************************" << endl;
235 cout << " Silicon Drift Detector Response Parameters " << endl;
236 cout << "**************************************************" << endl;
237 cout << "Hardware compression parameters: " << endl;
238 for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] <<endl;
239 cout << "Noise before electronics (arbitrary units): " << fNoise << endl;
240 cout << "Baseline (ADC units): " << fBaseline << endl;
241 cout << "Noise after electronics (ADC units): " << fNoiseAfterEl << endl;
242 cout << "Temperature: " << Temperature() << " K " << endl;
243 cout << "Min. Value: " << fMinVal << endl;