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 **************************************************************************/
19 #include "AliITSresponseSDD.h"
21 ClassImp(AliITSresponseSDD)
22 //______________________________________________________________________
23 AliITSresponseSDD::AliITSresponseSDD(){
24 // Default constructor
31 SetNSigmaIntegration();
34 SetNoiseAfterElectronics();
45 // set the default zero suppression parameters
48 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2);
49 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2);
55 //______________________________________________________________________
56 AliITSresponseSDD::AliITSresponseSDD(const char *dataType){
65 SetNSigmaIntegration();
66 SetNLookUp(); // Sets fGaus
69 SetNoiseAfterElectronics();
76 SetDataType(dataType);
80 // set the default zero suppression parameters
83 fCPar[2]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2);
84 fCPar[3]=(Int_t)(fBaseline + 2.*fNoiseAfterEl + 0.2);
91 AliITSresponseSDD::~AliITSresponseSDD() {
93 if(fGaus) delete fGaus;
97 void AliITSresponseSDD::SetCompressParam(Int_t cp[8])
99 // set compression param
102 for (i=0; i<8; i++) {
104 //printf("\n CompressPar %d %d \n",i,fCPar[i]);
108 void AliITSresponseSDD::GiveCompressParam(Int_t cp[8])
110 // give compression param
113 for (i=0; i<8; i++) {
118 void AliITSresponseSDD::SetDeadChannels(Int_t nmod, Int_t nchip, Int_t nchan) {
120 for(Int_t m=0; m<fModules; m++)
121 for(Int_t n=0; n<fChips; n++)
122 for(Int_t p=0; p<fChannels; p++)
125 if(nmod < 0 || nmod > fModules) { cout << "Wrong number of dead modules: " << nmod << endl; return; }
126 Int_t nmax = (fModules-nmod)*fChips;
127 if(nchip < 0 || nchip > nmax) { cout << "Wrong number of dead chips: " << nchip << endl; return; }
128 nmax = ((fModules - nmod)*fChips - nchip)*fChannels;
129 if(nchan < 0 || nchan > nmax) { cout << "Wrong number of dead channels: " << nchan << endl; return; }
131 TRandom *gran = new TRandom();
133 // cout << "modules" << endl;
134 Int_t * mod = new Int_t [nmod];
135 Int_t i; //loop variable
136 for(i=0;i<nmod;i++) {
137 mod[i] = (Int_t) (1.+fModules*gran->Uniform());
138 cout << i+1 << ": Dead module nr: " << mod[i] << endl;
139 for(Int_t n=0; n<fChips; n++)
140 for(Int_t p=0; p<fChannels; p++)
141 fGain[mod[i]-1][n][p] = 0.;
144 // cout << "chips" << endl;
145 Int_t * chip = new Int_t[nchip];
146 Int_t * chip_mod = new Int_t[nchip];
149 Int_t module = (Int_t) (fModules*gran->Uniform() + 1.);
150 if(module <=0 || module > fModules) cout << "Wrong module: " << module << endl;
152 for(Int_t k=0;k<nmod;k++) if(module == mod[k]) flag_mod = 1;
153 if(flag_mod == 1) continue;
154 Int_t chi = (Int_t) (fChips*gran->Uniform() + 1.);
155 if(chi <=0 || chi > fChips) cout << "Wrong chip: " << chi << endl;
158 chip_mod[i-1] = module;
159 for(Int_t m=0; m<fChannels; m++) fGain[module-1][chi-1][m] = 0.;
160 cout << i << ": Dead chip nr. " << chip[i-1] << " in module nr: " << chip_mod[i-1] << endl;
163 // cout << "channels" << endl;
164 Int_t * channel = new Int_t[nchan];
165 Int_t * channel_chip = new Int_t[nchan];
166 Int_t * channel_mod = new Int_t[nchan];
169 Int_t k; //loop variable
170 Int_t module = (Int_t) (fModules*gran->Uniform() + 1.);
171 if(module <=0 || module > fModules) cout << "Wrong module: " << module << endl;
173 for(k=0;k<nmod;k++) if(module == mod[k]) flag_mod = 1;
174 if(flag_mod == 1) continue;
175 Int_t chipp = (Int_t) (fChips*gran->Uniform() + 1.);
176 if(chipp <=0 || chipp > fChips) cout << "Wrong chip: " << chipp << endl;
178 for(k=0;k<nchip;k++) if(chipp == chip[k] && module == chip_mod[k]) flag_chip = 1;
179 if(flag_chip == 1) continue;
181 channel[i-1] = (Int_t) (fChannels*gran->Uniform() + 1.);
182 if(channel[i-1] <=0 || channel[i-1] > fChannels) cout << "Wrong channel: " << channel[i-1] << endl;
183 channel_chip[i-1] = chipp;
184 channel_mod[i-1] = module;
185 fGain[module-1][chipp-1][channel[i-1]-1] = 0.;
186 cout << i << ": Dead channel nr. " << channel[i-1] << " in chip nr. " << channel_chip[i-1] << " in module nr: " << channel_mod[i-1] << endl;
193 delete [] channel_mod;
194 delete [] channel_chip;
197 void AliITSresponseSDD::PrintGains()
199 // Print SDD electronic gains
200 for(Int_t t=0; t<fModules;t++)
201 for(Int_t u=0; u<fChips;u++)
202 for(Int_t v=0; v<fChannels;v++)
203 cout << "Gain for Module: " << t+1 << ", Chip " << u+1 << ", Channel " << v+1 << " = " << fGain[t][u][v] << endl;
207 void AliITSresponseSDD::Print()
209 // Print SDD response Parameters
211 cout << "**************************************************" << endl;
212 cout << " Silicon Drift Detector Response Parameters " << endl;
213 cout << "**************************************************" << endl;
214 cout << "Diffusion Coefficients: " << fDiffCoeff << ", " << fDiffCoeff1 << endl;
216 cout << "Hardware compression parameters: " << endl;
217 for(Int_t i=0; i<8; i++) cout << "fCPar[" << i << "] = " << fCPar[i] << endl;
218 cout << "Noise before electronics (arbitrary units): " << fNoise << endl;
219 cout << "Baseline (ADC units): " << fBaseline << endl;
220 cout << "Noise after electronics (ADC units): " << fNoiseAfterEl << endl;
222 cout << "Dynamic Range: " << fDynamicRange << endl;
223 cout << "Charge Loss: " << fChargeLoss << endl;
224 cout << "Temperature: " << fTemperature << endl;
225 cout << "Drift Speed: " << fDriftSpeed << endl;
226 cout << "Electronics (1=PASCAL, 2=OLA): " << fElectronics << endl;
228 cout << "N. of Sigma for signal integration: " << fNsigmas << endl;
229 cout << "N. of bins in lookup table: " << fNcomps << endl;
231 cout << "Max. ADC Value: " << fMaxAdc << endl;
232 cout << "Min. Value: " << fMinVal << endl;
234 cout << "**************************************************" << endl;
235 cout << " Print Electronics Gains " << endl;
236 cout << "**************************************************" << endl;