]>
Commit | Line | Data |
---|---|---|
b0f5e3fc | 1 | #include <iostream.h> |
2 | #include <TRandom.h> | |
3 | #include <TH1.h> | |
e8189707 | 4 | #include <TMath.h> |
9f033001 | 5 | #include <TString.h> |
6 | #include <TParticle.h> | |
e8189707 | 7 | |
b0f5e3fc | 8 | |
9 | #include "AliRun.h" | |
e8189707 | 10 | #include "AliITS.h" |
9f033001 | 11 | #include "AliITShit.h" |
12 | #include "AliITSdigit.h" | |
13 | #include "AliITSmodule.h" | |
e8189707 | 14 | #include "AliITSMapA2.h" |
b0f5e3fc | 15 | #include "AliITSsimulationSPD.h" |
9f033001 | 16 | #include "AliITSsegmentation.h" |
17 | #include "AliITSresponse.h" | |
18 | ||
e8189707 | 19 | |
20 | ||
b0f5e3fc | 21 | |
22 | ClassImp(AliITSsimulationSPD) | |
23 | //////////////////////////////////////////////////////////////////////// | |
24 | // Version: 0 | |
25 | // Written by Boris Batyunya | |
26 | // December 20 1999 | |
27 | // | |
28 | // AliITSsimulationSPD is the simulation of SPDs | |
b0f5e3fc | 29 | //________________________________________________________________________ |
30 | ||
e8189707 | 31 | |
32 | AliITSsimulationSPD::AliITSsimulationSPD() | |
33 | { | |
b0f5e3fc | 34 | // constructor |
e8189707 | 35 | fResponse = 0; |
b0f5e3fc | 36 | fSegmentation = 0; |
9f033001 | 37 | fMapA2=0; |
e8189707 | 38 | fHis = 0; |
39 | fNoise=0.; | |
40 | fBaseline=0.; | |
9f033001 | 41 | fNPixelsZ=0; |
42 | fNPixelsX=0; | |
b0f5e3fc | 43 | } |
e8189707 | 44 | |
45 | ||
b0f5e3fc | 46 | //_____________________________________________________________________________ |
47 | ||
48 | AliITSsimulationSPD::AliITSsimulationSPD(AliITSsegmentation *seg, AliITSresponse *resp) { | |
e8189707 | 49 | // standard constructor |
50 | ||
9f033001 | 51 | fHis = 0; |
b0f5e3fc | 52 | fResponse = resp; |
53 | fSegmentation = seg; | |
54 | ||
55 | fResponse->GetNoiseParam(fNoise,fBaseline); | |
56 | ||
b0f5e3fc | 57 | fMapA2 = new AliITSMapA2(fSegmentation); |
e8189707 | 58 | |
59 | // | |
5a200b64 | 60 | |
b0f5e3fc | 61 | fNPixelsZ=fSegmentation->Npz(); |
62 | fNPixelsX=fSegmentation->Npx(); | |
63 | ||
64 | } | |
65 | ||
66 | //_____________________________________________________________________________ | |
67 | ||
68 | AliITSsimulationSPD::~AliITSsimulationSPD() { | |
69 | // destructor | |
70 | ||
71 | delete fMapA2; | |
72 | ||
73 | if (fHis) { | |
74 | fHis->Delete(); | |
75 | delete fHis; | |
76 | } | |
77 | } | |
78 | ||
e8189707 | 79 | |
b0f5e3fc | 80 | //__________________________________________________________________________ |
81 | AliITSsimulationSPD::AliITSsimulationSPD(const AliITSsimulationSPD &source){ | |
82 | // Copy Constructor | |
83 | if(&source == this) return; | |
84 | this->fMapA2 = source.fMapA2; | |
85 | this->fNoise = source.fNoise; | |
86 | this->fBaseline = source.fBaseline; | |
87 | this->fNPixelsX = source.fNPixelsX; | |
88 | this->fNPixelsZ = source.fNPixelsZ; | |
89 | this->fHis = source.fHis; | |
90 | return; | |
91 | } | |
92 | ||
93 | //_________________________________________________________________________ | |
94 | AliITSsimulationSPD& | |
95 | AliITSsimulationSPD::operator=(const AliITSsimulationSPD &source) { | |
96 | // Assignment operator | |
97 | if(&source == this) return *this; | |
98 | this->fMapA2 = source.fMapA2; | |
99 | this->fNoise = source.fNoise; | |
100 | this->fBaseline = source.fBaseline; | |
101 | this->fNPixelsX = source.fNPixelsX; | |
102 | this->fNPixelsZ = source.fNPixelsZ; | |
103 | this->fHis = source.fHis; | |
104 | return *this; | |
105 | } | |
106 | //_____________________________________________________________________________ | |
107 | ||
e8189707 | 108 | void AliITSsimulationSPD::DigitiseModule(AliITSmodule *mod, Int_t module, Int_t dummy) |
109 | { | |
b0f5e3fc | 110 | // digitize module |
e8189707 | 111 | |
112 | const Float_t kEnToEl = 2.778e+8; // GeV->charge in electrons | |
b0f5e3fc | 113 | // for 3.6 eV/pair |
114 | const Float_t kconv = 10000.; // cm -> microns | |
115 | ||
e8189707 | 116 | Float_t spdLength = fSegmentation->Dz(); |
b0f5e3fc | 117 | Float_t spdWidth = fSegmentation->Dx(); |
118 | ||
5a200b64 | 119 | Float_t difCoef, dum; |
e8189707 | 120 | fResponse->DiffCoeff(difCoef,dum); |
b0f5e3fc | 121 | |
122 | Float_t zPix0 = 1e+6; | |
123 | Float_t xPix0 = 1e+6; | |
e8189707 | 124 | Float_t yPrev = 1e+6; |
b0f5e3fc | 125 | |
126 | Float_t zPitch = fSegmentation->Dpz(0); | |
127 | Float_t xPitch = fSegmentation->Dpx(0); | |
128 | ||
b0f5e3fc | 129 | TObjArray *fHits = mod->GetHits(); |
130 | Int_t nhits = fHits->GetEntriesFast(); | |
131 | if (!nhits) return; | |
b0f5e3fc | 132 | |
133 | // Array of pointers to the label-signal list | |
134 | ||
e8189707 | 135 | Int_t maxNDigits = fNPixelsX*fNPixelsZ + fNPixelsX ;; |
136 | Float_t **pList = new Float_t* [maxNDigits]; | |
137 | memset(pList,0,sizeof(Float_t*)*maxNDigits); | |
b0f5e3fc | 138 | Int_t indexRange[4] = {0,0,0,0}; |
139 | ||
140 | // Fill detector maps with GEANT hits | |
141 | // loop over hits in the module | |
a3e16987 | 142 | static Bool_t first; |
5a200b64 | 143 | Int_t lasttrack=-2; |
e8189707 | 144 | Int_t hit, iZi, jz, jx; |
145 | for (hit=0;hit<nhits;hit++) { | |
b0f5e3fc | 146 | AliITShit *iHit = (AliITShit*) fHits->At(hit); |
e8189707 | 147 | Int_t layer = iHit->GetLayer(); |
5a200b64 | 148 | Float_t yPix0 = -73; |
149 | if(layer == 1) yPix0 = -77; | |
e8189707 | 150 | |
b0f5e3fc | 151 | // work with the idtrack=entry number in the TreeH |
5a200b64 | 152 | Int_t idhit,idtrack; |
153 | mod->GetHitTrackAndHitIndex(hit,idtrack,idhit); | |
e8189707 | 154 | //Int_t idtrack=mod->GetHitTrackIndex(hit); |
b0f5e3fc | 155 | // or store straight away the particle position in the array |
156 | // of particles : | |
9f033001 | 157 | |
5a200b64 | 158 | //b.b. if(iHit->StatusEntering()) idhit=hit; |
e8189707 | 159 | Int_t itrack = iHit->GetTrack(); |
a3e16987 | 160 | Int_t dray = 0; |
b0f5e3fc | 161 | |
a3e16987 | 162 | if (lasttrack != itrack || hit==(nhits-1)) first = kTRUE; |
163 | ||
164 | // Int_t parent = iHit->GetParticle()->GetFirstMother(); | |
165 | Int_t partcode = iHit->GetParticle()->GetPdgCode(); | |
166 | ||
167 | // partcode (pdgCode): 11 - e-, 13 - mu-, 22 - gamma, 111 - pi0, 211 - pi+ | |
168 | // 310 - K0s, 321 - K+, 2112 - n, 2212 - p, 3122 - lambda | |
169 | ||
170 | Float_t px = iHit->GetPXL(); | |
171 | Float_t py = iHit->GetPYL(); | |
172 | Float_t pz = iHit->GetPZL(); | |
173 | Float_t pmod = 1000*sqrt(px*px+py*py+pz*pz); | |
174 | ||
175 | ||
176 | if(partcode == 11 && pmod < 6) dray = 1; // delta ray is e- | |
177 | // at p < 6 MeV/c | |
178 | ||
179 | ||
b0f5e3fc | 180 | // Get hit z and x(r*phi) cordinates for each module (detector) |
181 | // in local system. | |
182 | ||
e8189707 | 183 | Float_t zPix = kconv*iHit->GetZL(); |
184 | Float_t xPix = kconv*iHit->GetXL(); | |
185 | Float_t yPix = kconv*iHit->GetYL(); | |
b0f5e3fc | 186 | |
187 | // Get track status | |
e8189707 | 188 | Int_t status = iHit->GetTrackStatus(); |
189 | ||
190 | // Check boundaries | |
5a200b64 | 191 | if(zPix > spdLength/2) zPix = spdLength/2 - 10; |
192 | if(zPix < 0 && zPix < -spdLength/2) zPix = -spdLength/2 + 10; | |
193 | if(xPix > spdWidth/2) xPix = spdWidth/2 - 10; | |
194 | if(xPix < 0 && xPix < -spdWidth/2) zPix = -spdWidth/2 + 10; | |
b0f5e3fc | 195 | |
e8189707 | 196 | Int_t trdown = 0; |
b0f5e3fc | 197 | |
198 | // enter Si or after event in Si | |
199 | if (status == 66 ) { | |
200 | zPix0 = zPix; | |
201 | xPix0 = xPix; | |
202 | yPrev = yPix; | |
203 | } | |
5a200b64 | 204 | |
e8189707 | 205 | Float_t depEnergy = iHit->GetIonization(); |
b0f5e3fc | 206 | // skip if the input point to Si |
5a200b64 | 207 | |
e8189707 | 208 | if(depEnergy <= 0.) continue; |
5a200b64 | 209 | |
b0f5e3fc | 210 | // if track returns to the opposite direction: |
5a200b64 | 211 | if (yPix < yPrev) { |
b0f5e3fc | 212 | trdown = 1; |
e8189707 | 213 | } |
b0f5e3fc | 214 | |
5a200b64 | 215 | |
b0f5e3fc | 216 | // take into account the holes diffusion inside the Silicon |
217 | // the straight line between the entrance and exit points in Si is | |
218 | // divided into the several steps; the diffusion is considered | |
219 | // for each end point of step and charge | |
220 | // is distributed between the pixels through the diffusion. | |
221 | ||
222 | ||
223 | // ---------- the diffusion in Z (beam) direction ------- | |
224 | ||
e8189707 | 225 | Float_t charge = depEnergy*kEnToEl; // charge in e- |
226 | Float_t drPath = 0.; | |
227 | Float_t tang = 0.; | |
228 | Float_t sigmaDif = 0.; | |
229 | Float_t zdif = zPix - zPix0; | |
230 | Float_t xdif = xPix - xPix0; | |
5a200b64 | 231 | Float_t ydif = TMath::Abs(yPix - yPrev); |
232 | Float_t ydif0 = TMath::Abs(yPrev - yPix0); | |
b0f5e3fc | 233 | |
5a200b64 | 234 | if(ydif < 1) continue; // ydif is not zero |
b0f5e3fc | 235 | |
e8189707 | 236 | Float_t projDif = sqrt(xdif*xdif + zdif*zdif); |
237 | Int_t ndZ = (Int_t)TMath::Abs(zdif/zPitch) + 1; | |
238 | Int_t ndX = (Int_t)TMath::Abs(xdif/xPitch) + 1; | |
b0f5e3fc | 239 | |
240 | // number of the steps along the track: | |
e8189707 | 241 | Int_t nsteps = ndZ; |
b0f5e3fc | 242 | if(ndX > ndZ) nsteps = ndX; |
243 | if(nsteps < 6) nsteps = 6; // minimum number of the steps | |
244 | ||
5a200b64 | 245 | if (projDif < 5 ) { |
246 | drPath = (yPix-yPix0)*1.e-4; | |
b0f5e3fc | 247 | drPath = TMath::Abs(drPath); // drift path in cm |
248 | sigmaDif = difCoef*sqrt(drPath); // sigma diffusion in cm | |
5a200b64 | 249 | sigmaDif = sigmaDif*kconv; // sigma diffusion in microns |
250 | nsteps = 1; | |
b0f5e3fc | 251 | } |
252 | ||
5a200b64 | 253 | if(projDif > 5) tang = ydif/projDif; |
254 | Float_t dCharge = charge/nsteps; // charge in e- for one step | |
255 | Float_t dZ = zdif/nsteps; | |
256 | Float_t dX = xdif/nsteps; | |
257 | ||
e8189707 | 258 | for (iZi = 1;iZi <= nsteps;iZi++) { |
259 | Float_t dZn = iZi*dZ; | |
260 | Float_t dXn = iZi*dX; | |
261 | Float_t zPixn = zPix0 + dZn; | |
262 | Float_t xPixn = xPix0 + dXn; | |
b0f5e3fc | 263 | |
5a200b64 | 264 | if(projDif >= 5) { |
e8189707 | 265 | Float_t dProjn = sqrt(dZn*dZn+dXn*dXn); |
e8189707 | 266 | drPath = dProjn*tang*1.e-4; // drift path for iZi step in cm |
5a200b64 | 267 | if(trdown == 0) { |
268 | drPath = TMath::Abs(drPath) + ydif0*1.e-4; | |
b0f5e3fc | 269 | } |
270 | if(trdown == 1) { | |
5a200b64 | 271 | drPath = ydif0*1.e-4 - TMath::Abs(drPath); |
272 | drPath = TMath::Abs(drPath); | |
b0f5e3fc | 273 | } |
274 | sigmaDif = difCoef*sqrt(drPath); | |
275 | sigmaDif = sigmaDif*kconv; // sigma diffusion in microns | |
276 | } | |
5a200b64 | 277 | |
e8189707 | 278 | zPixn = (zPixn + spdLength/2.); |
279 | xPixn = (xPixn + spdWidth/2.); | |
280 | Int_t nZpix, nXpix; | |
281 | fSegmentation->GetPadIxz(xPixn,zPixn,nXpix,nZpix); | |
b0f5e3fc | 282 | zPitch = fSegmentation->Dpz(nZpix); |
e8189707 | 283 | fSegmentation->GetPadTxz(xPixn,zPixn); |
b0f5e3fc | 284 | // set the window for the integration |
e8189707 | 285 | Int_t jzmin = 1; |
286 | Int_t jzmax = 3; | |
b0f5e3fc | 287 | if(nZpix == 1) jzmin =2; |
288 | if(nZpix == fNPixelsZ) jzmax = 2; | |
289 | ||
e8189707 | 290 | Int_t jxmin = 1; |
291 | Int_t jxmax = 3; | |
b0f5e3fc | 292 | if(nXpix == 1) jxmin =2; |
293 | if(nXpix == fNPixelsX) jxmax = 2; | |
294 | ||
e8189707 | 295 | Float_t zpix = nZpix; |
296 | Float_t dZright = zPitch*(zpix - zPixn); | |
297 | Float_t dZleft = zPitch - dZright; | |
298 | ||
299 | Float_t xpix = nXpix; | |
300 | Float_t dXright = xPitch*(xpix - xPixn); | |
301 | Float_t dXleft = xPitch - dXright; | |
302 | ||
303 | Float_t dZprev = 0.; | |
304 | Float_t dZnext = 0.; | |
305 | Float_t dXprev = 0.; | |
306 | Float_t dXnext = 0.; | |
b0f5e3fc | 307 | |
308 | for(jz=jzmin; jz <=jzmax; jz++) { | |
309 | if(jz == 1) { | |
310 | dZprev = -zPitch - dZleft; | |
311 | dZnext = -dZleft; | |
312 | } | |
313 | if(jz == 2) { | |
314 | dZprev = -dZleft; | |
315 | dZnext = dZright; | |
316 | } | |
317 | if(jz == 3) { | |
318 | dZprev = dZright; | |
319 | dZnext = dZright + zPitch; | |
320 | } | |
e8189707 | 321 | // kz changes from 1 to the fNofPixels(270) |
322 | Int_t kz = nZpix + jz -2; | |
b0f5e3fc | 323 | |
e8189707 | 324 | Float_t zArg1 = dZprev/sigmaDif; |
325 | Float_t zArg2 = dZnext/sigmaDif; | |
326 | Float_t zProb1 = TMath::Erfc(zArg1); | |
327 | Float_t zProb2 = TMath::Erfc(zArg2); | |
328 | Float_t dZCharge =0.5*(zProb1-zProb2)*dCharge; | |
b0f5e3fc | 329 | |
b0f5e3fc | 330 | |
331 | // ----------- holes diffusion in X(r*phi) direction -------- | |
332 | ||
333 | if(dZCharge > 1.) { | |
334 | for(jx=jxmin; jx <=jxmax; jx++) { | |
335 | if(jx == 1) { | |
336 | dXprev = -xPitch - dXleft; | |
337 | dXnext = -dXleft; | |
338 | } | |
339 | if(jx == 2) { | |
340 | dXprev = -dXleft; | |
341 | dXnext = dXright; | |
342 | } | |
343 | if(jx == 3) { | |
344 | dXprev = dXright; | |
345 | dXnext = dXright + xPitch; | |
346 | } | |
e8189707 | 347 | Int_t kx = nXpix + jx -2; |
b0f5e3fc | 348 | |
e8189707 | 349 | Float_t xArg1 = dXprev/sigmaDif; |
350 | Float_t xArg2 = dXnext/sigmaDif; | |
351 | Float_t xProb1 = TMath::Erfc(xArg1); | |
352 | Float_t xProb2 = TMath::Erfc(xArg2); | |
353 | Float_t dXCharge =0.5*(xProb1-xProb2)*dZCharge; | |
b0f5e3fc | 354 | |
355 | if(dXCharge > 1.) { | |
e8189707 | 356 | Int_t index = kz-1; |
357 | ||
b0f5e3fc | 358 | if (first) { |
359 | indexRange[0]=indexRange[1]=index; | |
e8189707 | 360 | indexRange[2]=indexRange[3]=kx-1; |
b0f5e3fc | 361 | first=kFALSE; |
362 | } | |
363 | ||
e8189707 | 364 | indexRange[0]=TMath::Min(indexRange[0],kz-1); |
365 | indexRange[1]=TMath::Max(indexRange[1],kz-1); | |
366 | indexRange[2]=TMath::Min(indexRange[2],kx-1); | |
367 | indexRange[3]=TMath::Max(indexRange[3],kx-1); | |
368 | ||
b0f5e3fc | 369 | // build the list of digits for this module |
e8189707 | 370 | Double_t signal=fMapA2->GetSignal(index,kx-1); |
b0f5e3fc | 371 | signal+=dXCharge; |
e8189707 | 372 | fMapA2->SetHit(index,kx-1,(double)signal); |
b0f5e3fc | 373 | } // dXCharge > 1 e- |
374 | } // jx loop | |
375 | } // dZCharge > 1 e- | |
376 | } // jz loop | |
377 | } // iZi loop | |
378 | ||
379 | if (status == 65) { // the step is inside of Si | |
380 | zPix0 = zPix; | |
381 | xPix0 = xPix; | |
382 | } | |
a3e16987 | 383 | yPrev = yPix; |
b0f5e3fc | 384 | |
a3e16987 | 385 | if(dray == 0) { |
e8189707 | 386 | GetList(itrack,idhit,pList,indexRange); |
b0f5e3fc | 387 | } |
e8189707 | 388 | |
389 | lasttrack=itrack; | |
b0f5e3fc | 390 | } // hit loop inside the module |
391 | ||
392 | ||
393 | // introduce the electronics effects and do zero-suppression | |
394 | ChargeToSignal(pList); | |
395 | ||
396 | // clean memory | |
397 | ||
398 | fMapA2->ClearMap(); | |
399 | ||
400 | ||
401 | } | |
402 | ||
403 | //--------------------------------------------- | |
e8189707 | 404 | void AliITSsimulationSPD::GetList(Int_t label,Int_t idhit,Float_t **pList,Int_t *indexRange) |
405 | { | |
406 | // lop over nonzero digits | |
b0f5e3fc | 407 | |
e8189707 | 408 | |
409 | //set protection | |
410 | for(int k=0;k<4;k++) { | |
411 | if (indexRange[k] < 0) indexRange[k]=0; | |
412 | } | |
b0f5e3fc | 413 | |
e8189707 | 414 | for(Int_t iz=indexRange[0];iz<indexRange[1]+1;iz++){ |
415 | for(Int_t ix=indexRange[2];ix<indexRange[3]+1;ix++){ | |
b0f5e3fc | 416 | |
e8189707 | 417 | Float_t signal=fMapA2->GetSignal(iz,ix); |
a3e16987 | 418 | |
e8189707 | 419 | if (!signal) continue; |
420 | ||
421 | Int_t globalIndex = iz*fNPixelsX+ix; // GlobalIndex starts from 0! | |
b0f5e3fc | 422 | if(!pList[globalIndex]){ |
a3e16987 | 423 | |
b0f5e3fc | 424 | // |
e8189707 | 425 | // Create new list (9 elements - 3 signals and 3 tracks + 3 hits) |
b0f5e3fc | 426 | // |
427 | ||
e8189707 | 428 | pList[globalIndex] = new Float_t [9]; |
b0f5e3fc | 429 | |
e8189707 | 430 | // set list to -3 |
b0f5e3fc | 431 | |
e8189707 | 432 | *pList[globalIndex] = -3.; |
433 | *(pList[globalIndex]+1) = -3.; | |
434 | *(pList[globalIndex]+2) = -3.; | |
b0f5e3fc | 435 | *(pList[globalIndex]+3) = 0.; |
436 | *(pList[globalIndex]+4) = 0.; | |
437 | *(pList[globalIndex]+5) = 0.; | |
e8189707 | 438 | *(pList[globalIndex]+6) = -1.; |
439 | *(pList[globalIndex]+7) = -1.; | |
440 | *(pList[globalIndex]+8) = -1.; | |
b0f5e3fc | 441 | |
442 | ||
443 | *pList[globalIndex] = (float)label; | |
444 | *(pList[globalIndex]+3) = signal; | |
e8189707 | 445 | *(pList[globalIndex]+6) = (float)idhit; |
b0f5e3fc | 446 | } |
447 | else{ | |
448 | ||
449 | // check the signal magnitude | |
450 | ||
e8189707 | 451 | Float_t highest = *(pList[globalIndex]+3); |
452 | Float_t middle = *(pList[globalIndex]+4); | |
453 | Float_t lowest = *(pList[globalIndex]+5); | |
b0f5e3fc | 454 | |
455 | signal -= (highest+middle+lowest); | |
456 | ||
457 | // | |
458 | // compare the new signal with already existing list | |
459 | // | |
460 | ||
461 | if(signal<lowest) continue; // neglect this track | |
462 | ||
463 | if (signal>highest){ | |
464 | *(pList[globalIndex]+5) = middle; | |
465 | *(pList[globalIndex]+4) = highest; | |
466 | *(pList[globalIndex]+3) = signal; | |
467 | ||
468 | *(pList[globalIndex]+2) = *(pList[globalIndex]+1); | |
469 | *(pList[globalIndex]+1) = *pList[globalIndex]; | |
470 | *pList[globalIndex] = label; | |
e8189707 | 471 | |
472 | *(pList[globalIndex]+8) = *(pList[globalIndex]+7); | |
473 | *(pList[globalIndex]+7) = *(pList[globalIndex]+6); | |
474 | *(pList[globalIndex]+6) = idhit; | |
b0f5e3fc | 475 | } |
476 | else if (signal>middle){ | |
477 | *(pList[globalIndex]+5) = middle; | |
478 | *(pList[globalIndex]+4) = signal; | |
479 | ||
480 | *(pList[globalIndex]+2) = *(pList[globalIndex]+1); | |
481 | *(pList[globalIndex]+1) = label; | |
e8189707 | 482 | |
483 | *(pList[globalIndex]+8) = *(pList[globalIndex]+7); | |
484 | *(pList[globalIndex]+7) = idhit; | |
b0f5e3fc | 485 | } |
486 | else{ | |
487 | *(pList[globalIndex]+5) = signal; | |
488 | *(pList[globalIndex]+2) = label; | |
e8189707 | 489 | *(pList[globalIndex]+8) = idhit; |
b0f5e3fc | 490 | } |
491 | } | |
492 | } // end of loop pixels in x | |
493 | } // end of loop over pixels in z | |
494 | ||
495 | ||
496 | } | |
497 | ||
498 | ||
499 | //--------------------------------------------- | |
e8189707 | 500 | void AliITSsimulationSPD::ChargeToSignal(Float_t **pList) |
501 | { | |
502 | // add noise and electronics, perform the zero suppression and add the | |
503 | // digit to the list | |
b0f5e3fc | 504 | |
505 | AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS"); | |
506 | ||
507 | ||
5a200b64 | 508 | TRandom *random = new TRandom(); |
b0f5e3fc | 509 | Float_t threshold = (float)fResponse->MinVal(); |
510 | ||
e8189707 | 511 | Int_t digits[3], tracks[3], hits[3],gi,j1; |
b0f5e3fc | 512 | Float_t charges[3]; |
513 | Float_t electronics; | |
514 | Float_t signal,phys; | |
e8189707 | 515 | for(Int_t iz=0;iz<fNPixelsZ;iz++){ |
516 | for(Int_t ix=0;ix<fNPixelsX;ix++){ | |
5a200b64 | 517 | electronics = fBaseline + fNoise*random->Gaus(); |
b0f5e3fc | 518 | signal = (float)fMapA2->GetSignal(iz,ix); |
519 | signal += electronics; | |
e8189707 | 520 | gi =iz*fNPixelsX+ix; // global index |
b0f5e3fc | 521 | if (signal > threshold) { |
522 | digits[0]=iz; | |
523 | digits[1]=ix; | |
524 | digits[2]=1; | |
b0f5e3fc | 525 | for(j1=0;j1<3;j1++){ |
e8189707 | 526 | if (pList[gi]) { |
5a200b64 | 527 | //b.b. tracks[j1]=-3; |
e8189707 | 528 | tracks[j1] = (Int_t)(*(pList[gi]+j1)); |
529 | hits[j1] = (Int_t)(*(pList[gi]+j1+6)); | |
530 | }else { | |
531 | tracks[j1]=-2; //noise | |
532 | hits[j1] = -1; | |
533 | } | |
b0f5e3fc | 534 | charges[j1] = 0; |
535 | } | |
a3e16987 | 536 | |
537 | if(tracks[0] == tracks[1] && tracks[0] == tracks[2]) { | |
538 | tracks[1] = -3; | |
539 | hits[1] = -1; | |
540 | tracks[2] = -3; | |
541 | hits[2] = -1; | |
542 | } | |
543 | if(tracks[0] == tracks[1] && tracks[0] != tracks[2]) { | |
544 | tracks[1] = -3; | |
545 | hits[1] = -1; | |
546 | } | |
547 | if(tracks[0] == tracks[2] && tracks[0] != tracks[1]) { | |
548 | tracks[2] = -3; | |
549 | hits[2] = -1; | |
550 | } | |
551 | if(tracks[1] == tracks[2] && tracks[0] != tracks[1]) { | |
552 | tracks[2] = -3; | |
553 | hits[2] = -1; | |
554 | } | |
555 | ||
b0f5e3fc | 556 | phys=0; |
e8189707 | 557 | aliITS->AddSimDigit(0,phys,digits,tracks,hits,charges); |
b0f5e3fc | 558 | } |
e8189707 | 559 | if(pList[gi]) delete [] pList[gi]; |
b0f5e3fc | 560 | } |
561 | } | |
562 | delete [] pList; | |
563 | ||
b0f5e3fc | 564 | } |
565 | ||
566 | ||
567 | //____________________________________________ | |
568 | ||
e8189707 | 569 | void AliITSsimulationSPD::CreateHistograms() |
570 | { | |
571 | // create 1D histograms for tests | |
572 | ||
573 | printf("SPD - create histograms\n"); | |
b0f5e3fc | 574 | |
9f033001 | 575 | fHis=new TObjArray(fNPixelsZ); |
5a200b64 | 576 | TString spdName("spd_"); |
e8189707 | 577 | for (Int_t i=0;i<fNPixelsZ;i++) { |
e8189707 | 578 | Char_t pixelz[4]; |
579 | sprintf(pixelz,"%d",i+1); | |
9f033001 | 580 | spdName.Append(pixelz); |
581 | (*fHis)[i] = new TH1F(spdName.Data(),"SPD maps", | |
b0f5e3fc | 582 | fNPixelsX,0.,(Float_t) fNPixelsX); |
b0f5e3fc | 583 | } |
b0f5e3fc | 584 | } |
585 | ||
586 | //____________________________________________ | |
587 | ||
e8189707 | 588 | void AliITSsimulationSPD::ResetHistograms() |
589 | { | |
b0f5e3fc | 590 | // |
591 | // Reset histograms for this detector | |
592 | // | |
5a200b64 | 593 | |
e8189707 | 594 | for ( int i=0;i<fNPixelsZ;i++ ) { |
b0f5e3fc | 595 | if ((*fHis)[i]) ((TH1F*)(*fHis)[i])->Reset(); |
596 | } | |
597 | ||
598 | } | |
e8189707 | 599 | |
600 | ||
601 | ||
602 | ||
603 | ||
604 | ||
605 | ||
606 | ||
607 |