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 <Riostream.h>
24 #include <TParticle.h>
28 #include "AliITShit.h"
29 #include "AliITSdigitSPD.h"
30 #include "AliITSmodule.h"
31 #include "AliITSMapA2.h"
32 #include "AliITSpList.h"
33 #include "AliITSsimulationSPDdubna.h"
34 #include "AliITSsegmentationSPD.h"
35 #include "AliITSresponseSPDdubna.h"
39 ClassImp(AliITSsimulationSPDdubna)
40 ////////////////////////////////////////////////////////////////////////
42 // Modified by Bjorn S. Nilsen
44 // Written by Boris Batyunya
47 // AliITSsimulationSPDdubna is to do the simulation of SPDs.
48 //______________________________________________________________________
49 AliITSsimulationSPDdubna::AliITSsimulationSPDdubna() : AliITSsimulation(){
50 // Default constructor.
56 // A default constructed AliITSsimulationSPDdubna class.
60 //______________________________________________________________________
61 AliITSsimulationSPDdubna::AliITSsimulationSPDdubna(AliITSsegmentation *seg,
62 AliITSresponse *resp){
63 // standard constructor
65 // AliITSsegmentation *seg A pointer to the segmentation class
66 // to be used for this simulation
67 // AliITSresponse *resp A pointer to the responce class to
68 // be used for this simulation
72 // A default constructed AliITSsimulationSPDdubna class.
77 //______________________________________________________________________
78 void AliITSsimulationSPDdubna::Init(AliITSsegmentation *seg,
79 AliITSresponse *resp){
82 // AliITSsegmentation *seg A pointer to the segmentation class
83 // to be used for this simulation
84 // AliITSresponse *resp A pointer to the responce class to
85 // be used for this simulation
90 const Double_t kmictocm = 1.0e-4; // convert microns to cm.
92 SetResponseModel(resp);
93 SetSegmentationModel(seg);
96 SetMap(new AliITSpList(GetNPixelsZ(),GetNPixelsX()));
98 GetResp()->SetDistanceOverVoltage(kmictocm*GetSeg()->Dy(),50.0);
100 //______________________________________________________________________
101 AliITSsimulationSPDdubna::~AliITSsimulationSPDdubna(){
115 //______________________________________________________________________
116 AliITSsimulationSPDdubna::AliITSsimulationSPDdubna(const
117 AliITSsimulationSPDdubna
118 &s) : AliITSsimulation(s){
121 // AliITSsimulationSPDdubna &s The original class for which
122 // this class is a copy of
130 //______________________________________________________________________
131 AliITSsimulationSPDdubna& AliITSsimulationSPDdubna::operator=(const
132 AliITSsimulationSPDdubna &s){
133 // Assignment operator
135 // AliITSsimulationSPDdubna &s The original class for which
136 // this class is a copy of
141 if(&s == this) return *this;
145 //______________________________________________________________________
146 void AliITSsimulationSPDdubna::InitSimulationModule(Int_t module, Int_t event){
147 // This function creates maps to build the list of tracks for each
148 // summable digit. Inputs defined by base class.
150 // Int_t module // Module number to be simulated
151 // Int_t event // Event number to be simulated
157 SetModuleNumber(module);
158 SetEventNumber(event);
161 //_____________________________________________________________________
162 void AliITSsimulationSPDdubna::SDigitiseModule(AliITSmodule *mod, Int_t mask,
164 // This function begins the work of creating S-Digits. Inputs defined
167 // AliITSmodule *mod // module
168 // Int_t mask // mask to be applied to the module
169 // Int_t event // Event number
173 // test // test returns kTRUE if the module contained hits
174 // // test returns kFALSE if it did not contain hits
176 mask = mod->GetNhits();
177 if(!mask) return;// if module has no hits don't create Sdigits
178 SetModuleNumber(mod->GetIndex());
179 SetEventNumber(event);
184 //______________________________________________________________________
185 void AliITSsimulationSPDdubna::WriteSDigits(){
186 // This function adds each S-Digit to pList
193 Int_t ix, nix, iz, niz;
194 static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
196 GetMap()->GetMaxMapIndex(niz, nix);
197 for(iz=0; iz<niz; iz++)for(ix=0; ix<nix; ix++){
198 if(GetMap()->GetSignalOnly(iz,ix)>0.0){
199 aliITS->AddSumDigit(*(GetMap()->GetpListItem(iz,ix)));
201 cout <<"SDigits " << iz << "," << ix << "," <<
202 *(GetMap()->GetpListItem(iz,ix)) << endl;
204 } // end if GetMap()->GetSignalOnly(iz,ix)>0.0
208 //______________________________________________________________________
209 void AliITSsimulationSPDdubna::FinishSDigitiseModule(){
210 // This function calls SDigitsToDigits which creates Digits from SDigits
221 //______________________________________________________________________
222 void AliITSsimulationSPDdubna::SDigitsToDigits(){
223 // This function adds electronic noise to the S-Digits and then adds them
232 ChargeToSignal(); // Charge To Signal both adds noise and
235 //______________________________________________________________________
236 void AliITSsimulationSPDdubna::DigitiseModule(AliITSmodule *mod, Int_t module,
238 // This function creates Digits straight from the hits and then adds
239 // electronic noise to the digits before adding them to pList
240 // Each of the input variables is passed along to HitToSDigit
242 // AliITSmodule *mod module
243 // Int_t module module number Dummy.
250 //This calls the module for HitToSDigit
251 fModule = dummy = module = mod->GetIndex();
256 //______________________________________________________________________
257 void AliITSsimulationSPDdubna::UpdateMapSignal(Int_t iz,Int_t ix,Int_t trk,
258 Int_t ht,Double_t signal){
259 // This function adds a signal to the pList from the pList class
261 // Int_t iz // row number
262 // Int_t ix // column number
263 // Int_t trk // track number
264 // Int_t ht // hit number
265 // Double_t signal // signal strength
271 GetMap()->AddSignal(iz,ix,trk,ht,GetModuleNumber(),signal);
273 //______________________________________________________________________
274 void AliITSsimulationSPDdubna::UpdateMapNoise(Int_t iz,Int_t ix,Float_t noise){
275 // This function adds noise to data in the MapA2 as well as the pList
277 // Int_t iz // row number
278 // Int_t ix // column number
279 // Int_t mod // module number
280 // Double_t sig // signal strength
281 // Double_t noise // electronic noise generated by ChargeToSignal
283 // All of the inputs are passed to AliITSMapA2::AddSignal or
284 // AliITSpList::AddNoise
288 GetMap()->AddNoise(iz,ix,GetModuleNumber(),noise);
290 //______________________________________________________________________
291 void AliITSsimulationSPDdubna::HitToDigit(AliITSmodule *mod){
292 // Standard interface to DigitiseModule
294 // AliITSmodule *mod Pointer to this module
300 DigitiseModule(mod,GetModuleNumber(),0);
302 //______________________________________________________________________
303 void AliITSsimulationSPDdubna::HitToSDigit(AliITSmodule *mod){
304 // Does the charge distributions using Gaussian diffusion charge charing.
306 // AliITSmodule *mod Pointer to this module
311 const Double_t kmictocm = 1.0e-4; // convert microns to cm.
312 TObjArray *hits = mod->GetHits();
313 Int_t nhits = hits->GetEntriesFast();
316 Double_t x0=0.0,x1=0.0,y0=0.0,y1=0.0,z0=0.0,z1=0.0,de=0.0;
317 Double_t x,y,z,t,tp,st,dt=0.2,el,sig;
318 Double_t thick = kmictocm*GetSeg()->Dy();
321 for(h=0;h<nhits;h++){
323 cout << "Hits=" << h << "," << *(mod->GetHit(h)) << endl;
325 if(mod->LineSegmentL(h,x0,x1,y0,y1,z0,z1,de,idtrack)){
326 st = TMath::Sqrt(x1*x1+y1*y1+z1*z1);
328 st = (Double_t)((Int_t)(1.0E+04*st)); // number of microns
329 if(st<=0.0) st = 1.0;
331 for(t=0;t<1.0;t+=dt){ // Integrate over t
333 el = GetResp()->GeVToCharge((Float_t)(dt*de));
335 if(el<=0.0) cout << "el="<<el<<" dt="<<dt<<" de="<<de<<endl;
340 GetSeg()->LocalToDet(x,z,ix,iz);
341 sig = GetResp()->SigmaDiffusion1D(thick + y);
342 SpreadCharge(x,z,ix,iz,el,sig,idtrack,h);
344 } else { // st == 0.0 deposit it at this point
345 el = GetResp()->GeVToCharge((Float_t)de);
349 GetSeg()->LocalToDet(x,z,ix,iz);
350 sig = GetResp()->SigmaDiffusion1D(thick + y);
351 SpreadCharge(x,z,ix,iz,el,sig,idtrack,h);
353 } // end if mod->LineSegmentL...
354 } // Loop over all hits h
356 //______________________________________________________________________
357 void AliITSsimulationSPDdubna::SpreadCharge(Double_t x0,Double_t z0,
359 Double_t el,Double_t sig,Int_t t,
361 // Spreads the charge over neighboring cells. Assume charge is distributed
362 // as charge(x,z) = (el/2*pi*sig*sig)*exp(-arg)
363 // arg=((x-x0)*(x-x0)/2*sig*sig)+((z-z0*z-z0)/2*sig*sig)
364 // Defined this way, the integral over all x and z is el.
366 // Double_t x0 x position of point where charge is liberated
367 // Double_t y0 y position of point where charge is liberated
368 // Double_t z0 z position of point where charge is liberated
369 // Int_t ix0 row of cell corresponding to point x0
370 // Int_t iz0 columb of cell corresponding to point z0
371 // Double_t el number of electrons liberated in this step
372 // Double_t sig Sigma difusion for this step (y0 dependent)
373 // Int_t t track number
374 // Int_t ti hit track index number
375 // Int_t hi hit "hit" index number
380 const Int_t knx = 3,knz = 2;
381 const Double_t kRoot2 = 1.414213562; // Sqrt(2).
382 const Double_t kmictocm = 1.0e-4; // convert microns to cm.
383 Int_t ix,iz,ixs,ixe,izs,ize;
385 Double_t x1,x2,z1,z2,s,sp;
388 GetMap()->AddSignal(iz0,ix0,t,hi,GetModuleNumber(),el);
391 sp = 1.0/(sig*kRoot2);
393 cout << "sig=" << sig << " sp=" << sp << endl;
395 ixs = TMath::Max(-knx+ix0,0);
396 ixe = TMath::Min(knx+ix0,GetSeg()->Npx()-1);
397 izs = TMath::Max(-knz+iz0,0);
398 ize = TMath::Min(knz+iz0,GetSeg()->Npz()-1);
399 for(ix=ixs;ix<=ixe;ix++) for(iz=izs;iz<=ize;iz++){
400 GetSeg()->DetToLocal(ix,iz,x,z); // pixel center
403 x2 = x1 + 0.5*kmictocm*GetSeg()->Dpx(ix); // Upper
404 x1 -= 0.5*kmictocm*GetSeg()->Dpx(ix); // Lower
405 z2 = z1 + 0.5*kmictocm*GetSeg()->Dpz(iz); // Upper
406 z1 -= 0.5*kmictocm*GetSeg()->Dpz(iz); // Lower
407 x1 -= x0; // Distance from where track traveled
408 x2 -= x0; // Distance from where track traveled
409 z1 -= z0; // Distance from where track traveled
410 z2 -= z0; // Distance from where track traveled
411 s = 0.25; // Correction based on definision of Erfc
412 s *= TMath::Erfc(sp*x1) - TMath::Erfc(sp*x2);
414 cout << "el=" << el << " ix0=" << ix0 << " ix=" << ix << " x0="<< x <<
415 " iz0=" << iz0 << " iz=" << iz << " z0=" << z <<
416 " sp*x1=" << sp*x1 <<" sp*x2=" << sp*x2 << " s=" << s;
418 s *= TMath::Erfc(sp*z1) - TMath::Erfc(sp*z2);
420 cout << " sp*z1=" << sp*z1 <<" sp*z2=" << sp*z2 << " s=" << s << endl;
422 GetMap()->AddSignal(iz,ix,t,hi,GetModuleNumber(),s*el);
425 //______________________________________________________________________
427 Double_t *AliITSsimulationSPDdubna::CreateFindCellEdges(Double_t x0,
428 Double_t x1,Double_t z0,Double_t z1,Int_t &n){
429 // Note: This function is a potensial source for a memory leak. The memory
430 // pointed to in its return, must be deleted.
432 // Double_t x0 The starting location of the track step in x
433 // Double_t x1 The distance allong x for the track step
434 // Double_t z0 The starting location of the track step in z
435 // Double_t z1 The distance allong z for the track step
437 // Int_t &n The size of the array returned. Minimal n=2.
439 // The pointer to the array of track steps.
440 Int_t ix0,ix1,ix,iz0,iz1,iz,i;
441 Double_t x,z,lx,ux,lz,uz,a,b,c,d;
444 GetSeg()->LocalToDet(x0,z0,ix0,iz0);
445 GetSeg()->LocalToDet(x1,z1,ix1,iz1);
446 n = 2 + TMath::Abs(ix1-ix0) + TMath::Abs(iz1-iz0);
453 GetSeg()->LocalToDet(x,z,ix,iz);
454 GetSeg()->CellBoundries(ix,iz,lx,ux,lz,uz);
456 if(a<=t[i-1]) a = 1.0;
458 if(b<=t[i-1]) b = 1.0;
460 if(c<=t[i-1]) c = 1.0;
462 if(d<=t[i-1]) d = 1.0;
463 t[i] = TMath::Min(TMath::Min(TMath::Min(a,b),c),d);
464 x = x0+x1*(t[i]*1.00000001);
465 z = z0+z1*(t[i]*1.00000001);
471 //______________________________________________________________________
472 void AliITSsimulationSPDdubna::HitToSDigitOld(AliITSmodule *mod){
473 // digitize module Old method
475 // AliITSmodule *mod Pointer to this module
480 const Float_t kEnToEl = 2.778e+8; // GeV->charge in electrons
482 const Float_t kconv = 10000.; // cm -> microns
484 Float_t spdLength = GetSeg()->Dz();
485 Float_t spdWidth = GetSeg()->Dx();
486 Float_t spdThickness = GetSeg()->Dy();
487 Float_t difCoef=GetResp()->SigmaDiffusion1D(1.0);
488 Float_t zPix0 = 1e+6;
489 Float_t xPix0 = 1e+6;
490 Float_t yPrev = 1e+6;
491 Float_t zPitch = GetSeg()->Dpz(0);
492 Float_t xPitch = GetSeg()->Dpx(0);
493 // Array of pointers to the label-signal list
494 Int_t indexRange[4] = {0,0,0,0};
496 // Fill detector maps with GEANT hits
497 // loop over hits in the module
500 Int_t hit, iZi, jz, jx;
502 TObjArray *fHits = mod->GetHits();
503 Int_t nhits = fHits->GetEntriesFast();
504 Float_t yPix0 = -spdThickness/2;
507 cout<<"len,wid,thickness,nx,nz,pitchx,pitchz,difcoef ="<<spdLength<<","
508 <<spdWidth<<","<<spdThickness<<","<<GetNPixelsX()<<","<<GetNPixelsZ()<<","
509 <<xPitch<<","<<zPitch<<","<<difCoef<<endl;
510 cout<<"SPDdubna: module,nhits ="<<GetModuleNumber()<<","<<nhits<<endl;
512 for (hit=0;hit<nhits;hit++) {
513 AliITShit *iHit = (AliITShit*) fHits->At(hit);
515 cout << "Hits=" << hit << "," << *iHit << endl;
517 //Int_t layer = iHit->GetLayer();
519 // work with the idtrack=entry number in the TreeH
520 //Int_t idhit,idtrack; //!
521 //mod->GetHitTrackAndHitIndex(hit,idtrack,idhit); //!
522 //Int_t idtrack=mod->GetHitTrackIndex(hit);
523 // or store straight away the particle position in the array
525 if(iHit->StatusEntering()) idhit=hit;
526 Int_t itrack = iHit->GetTrack();
529 if (lasttrack != itrack || hit==(nhits-1)) first = kTRUE;
531 //Int_t parent = iHit->GetParticle()->GetFirstMother();
532 Int_t partcode = iHit->GetParticle()->GetPdgCode();
534 // partcode (pdgCode): 11 - e-, 13 - mu-, 22 - gamma, 111 - pi0,
535 // 211 - pi+, 310 - K0s, 321 - K+, 2112 - n, 2212 - p, 3122 - lambda
537 Float_t pmod = iHit->GetParticle()->P(); // total momentum at the
541 if(partcode == 11 && pmod < 6) dray = 1; // delta ray is e-
544 // Get hit z and x(r*phi) cordinates for each module (detector)
547 Float_t zPix = kconv*iHit->GetZL();
548 Float_t xPix = kconv*iHit->GetXL();
549 Float_t yPix = kconv*iHit->GetYL();
552 Int_t status = iHit->GetTrackStatus();
555 if(zPix > spdLength/2) {
557 cout<<"!!! SPD: z outside ="<<zPix<<endl;
559 zPix = spdLength/2 - 10;
561 if(zPix < 0 && zPix < -spdLength/2) {
563 cout<<"!!! SPD: z outside ="<<zPix<<endl;
565 zPix = -spdLength/2 + 10;
567 if(xPix > spdWidth/2) {
569 cout<<"!!! SPD: x outside ="<<xPix<<endl;
571 xPix = spdWidth/2 - 10;
573 if(xPix < 0 && xPix < -spdWidth/2) {
575 cout<<"!!! SPD: x outside ="<<xPix<<endl;
577 xPix = -spdWidth/2 + 10;
581 // enter Si or after event in Si
586 } // end if status == 66
588 Float_t depEnergy = iHit->GetIonization();
589 // skip if the input point to Si
591 if(depEnergy <= 0.) continue;
593 // if track returns to the opposite direction:
596 } // end if yPix < yPrev
598 // take into account the holes diffusion inside the Silicon
599 // the straight line between the entrance and exit points in Si is
600 // divided into the several steps; the diffusion is considered
601 // for each end point of step and charge
602 // is distributed between the pixels through the diffusion.
604 // ---------- the diffusion in Z (beam) direction -------
605 Float_t charge = depEnergy*kEnToEl; // charge in e-
608 Float_t sigmaDif = 0.;
609 Float_t zdif = zPix - zPix0;
610 Float_t xdif = xPix - xPix0;
611 Float_t ydif = TMath::Abs(yPix - yPrev);
612 Float_t ydif0 = TMath::Abs(yPrev - yPix0);
614 if(ydif < 1) continue; // ydif is not zero
616 Float_t projDif = sqrt(xdif*xdif + zdif*zdif);
618 Int_t ndZ = (Int_t)TMath::Abs(zdif/zPitch) + 1;
619 Int_t ndX = (Int_t)TMath::Abs(xdif/xPitch) + 1;
621 // number of the steps along the track:
623 if(ndX > ndZ) nsteps = ndX;
624 if(nsteps < 20) nsteps = 20; // minimum number of the steps
627 drPath = (yPix-yPix0)*1.e-4;
628 drPath = TMath::Abs(drPath); // drift path in cm
629 sigmaDif = difCoef*sqrt(drPath); // sigma diffusion in cm
630 sigmaDif = sigmaDif*kconv; // sigma diffusion in microns
632 } // end if projDif < 5
634 if(projDif > 5) tang = ydif/projDif;
635 Float_t dCharge = charge/nsteps; // charge in e- for one step
636 Float_t dZ = zdif/nsteps;
637 Float_t dX = xdif/nsteps;
639 for (iZi = 1; iZi <= nsteps;iZi++) {
640 Float_t dZn = iZi*dZ;
641 Float_t dXn = iZi*dX;
642 Float_t zPixn = zPix0 + dZn;
643 Float_t xPixn = xPix0 + dXn;
646 Float_t dProjn = sqrt(dZn*dZn+dXn*dXn);
647 drPath = dProjn*tang*1.e-4; // drift path for iZi+1 step in cm
649 drPath = TMath::Abs(drPath) + ydif0*1.e-4;
652 drPath = ydif0*1.e-4 - TMath::Abs(drPath);
653 drPath = TMath::Abs(drPath);
654 } // end if trdown == 1
655 sigmaDif = difCoef*sqrt(drPath);
656 sigmaDif = sigmaDif*kconv; // sigma diffusion in microns
657 } // end if projdif >= 5
659 zPixn = (zPixn + spdLength/2.);
660 xPixn = (xPixn + spdWidth/2.);
662 GetSeg()->GetPadIxz(xPixn,zPixn,nXpix,nZpix);
663 zPitch = GetSeg()->Dpz(nZpix);
664 GetSeg()->GetPadTxz(xPixn,zPixn);
665 // set the window for the integration
668 if(nZpix == 1) jzmin =2;
669 if(nZpix == GetNPixelsZ()) jzmax = 2;
673 if(nXpix == 1) jxmin =2;
674 if(nXpix == GetNPixelsX()) jxmax = 2;
676 Float_t zpix = nZpix;
677 Float_t dZright = zPitch*(zpix - zPixn);
678 Float_t dZleft = zPitch - dZright;
680 Float_t xpix = nXpix;
681 Float_t dXright = xPitch*(xpix - xPixn);
682 Float_t dXleft = xPitch - dXright;
689 for(jz=jzmin; jz <=jzmax; jz++) {
691 dZprev = -zPitch - dZleft;
698 dZnext = dZright + zPitch;
700 // kz changes from 1 to the fNofPixels(270)
701 Int_t kz = nZpix + jz -2;
703 Float_t zArg1 = dZprev/sigmaDif;
704 Float_t zArg2 = dZnext/sigmaDif;
705 Float_t zProb1 = TMath::Erfc(zArg1);
706 Float_t zProb2 = TMath::Erfc(zArg2);
707 Float_t dZCharge =0.5*(zProb1-zProb2)*dCharge;
710 // ----------- holes diffusion in X(r*phi) direction --------
713 for(jx=jxmin; jx <=jxmax; jx++) {
715 dXprev = -xPitch - dXleft;
722 dXnext = dXright + xPitch;
724 Int_t kx = nXpix + jx -2;
725 Float_t xArg1 = dXprev/sigmaDif;
726 Float_t xArg2 = dXnext/sigmaDif;
727 Float_t xProb1 = TMath::Erfc(xArg1);
728 Float_t xProb2 = TMath::Erfc(xArg2);
729 Float_t dXCharge =0.5*(xProb1-xProb2)*dZCharge;
733 indexRange[0]=indexRange[1]=kz-1;
734 indexRange[2]=indexRange[3]=kx-1;
737 indexRange[0]=TMath::Min(indexRange[0],kz-1);
738 indexRange[1]=TMath::Max(indexRange[1],kz-1);
739 indexRange[2]=TMath::Min(indexRange[2],kx-1);
740 indexRange[3]=TMath::Max(indexRange[3],kx-1);
741 // The calling sequence for UpdateMapSignal was
742 // moved into the (dx > 1 e-) loop because it
743 // needs to call signal which is defined inside
745 UpdateMapSignal(kz-1,kx-1,
746 ((AliITShit*)(mod->GetHit(hit)))->GetTrack(),
753 if (status == 65) { // the step is inside of Si
756 } // end if status == 65
758 } // hit loop inside the module
760 //______________________________________________________________________
761 void AliITSsimulationSPDdubna::ChargeToSignal(){
762 // add noise and electronics, perform the zero suppression and add the
770 static AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
771 Float_t threshold = GetResp()->GetThreshold();
775 const Int_t nmaxtrk=AliITSdigitSPD::GetNTracks();
776 static AliITSdigitSPD dig;
778 for(iz=0; iz<GetNPixelsZ(); iz++) for(ix=0; ix<GetNPixelsX(); ix++){
779 if(GetResp()->IsPixelDead(GetModuleNumber(),ix,iz)) continue;
780 electronics = GetResp()->ApplyBaselineAndNoise();
781 sig = GetMap()->GetSignalOnly(iz,ix);
782 UpdateMapNoise(iz,ix,electronics);
784 cout << sig << "+" << electronics <<">threshold=" << threshold << endl;
786 if (sig+electronics <= threshold) continue;
790 dig.SetSignalSPD((Int_t) GetMap()->GetSignal(iz,ix));
791 for(j=0;j<nmaxtrk;j++){
792 if (j<GetMap()->GetNEnteries()) {
793 dig.SetTrack(j,GetMap()->GetTrack(iz,ix,j));
794 dig.SetHit(j,GetMap()->GetHit(iz,ix,j));
795 }else { // Default values
801 cout<<iz<<","<<ix<<","<<*(GetMap()->GetpListItem(iz,ix)) << endl;
803 aliITS->AddSimDigit(0,&dig);
806 //______________________________________________________________________
807 void AliITSsimulationSPDdubna::CreateHistograms(){
808 // create 1D histograms for tests
816 printf("SPD - create histograms\n");
818 fHis=new TObjArray(GetNPixelsZ());
819 TString spdName("spd_");
820 for (Int_t i=0;i<GetNPixelsZ();i++) {
822 sprintf(pixelz,"%d",i);
823 spdName.Append(pixelz);
824 fHis->AddAt(new TH1F(spdName.Data(),"SPD maps",
825 GetNPixelsX(),0.,(Float_t) GetNPixelsX()), i);
828 //______________________________________________________________________
829 void AliITSsimulationSPDdubna::ResetHistograms(){
830 // Reset histograms for this detector
838 for ( int i=0;i<GetNPixelsZ();i++ ) {
839 if (fHis->At(i)) ((TH1F*)fHis->At(i))->Reset();
843 //______________________________________________________________________
844 void AliITSsimulationSPDdubna::SetCoupling(Int_t row, Int_t col, Int_t ntrack,
846 // Take into account the coupling between adiacent pixels.
847 // The parameters probcol and probrow are the probability of the
848 // signal in one pixel shared in the two adjacent pixels along
849 // the column and row direction, respectively.
852 <img src="picts/ITS/barimodel_3.gif">
855 <font size=+2 color=red>
856 <a href="mailto:tiziano.virgili@cern.ch"></a>.
862 // Int_t row z cell index
863 // Int_t col x cell index
864 // Int_t ntrack track incex number
865 // Int_t idhit hit index number
866 // Int_t module module number
872 Double_t pulse1,pulse2;
873 Float_t couplR=0.0,couplC=0.0;
875 AliITSpList *pList = GetMap();
877 GetCouplings(couplR,couplC);
880 pulse1 = pList->GetSignalOnly(row,col);
882 for (Int_t isign=-1;isign<=1;isign+=2){// loop in row direction
886 xr = gRandom->Rndm();
887 // if ((j1<0) || (j1>GetNPixelsZ()-1) || (pulse1<GetThreshold())){
888 if ((j1<0) || (j1>GetNPixelsZ()-1) || (xr>couplR)){
892 UpdateMapSignal(j1,col,ntrack,idhit,pulse1);
894 flag = 1; // only first next!!
897 // loop in column direction
901 xr = gRandom->Rndm();
902 // if ((j2<0) || (j2>(GetNPixelsX()-1)) || (pulse2<GetThreshold())){
903 if ((j2<0) || (j2>GetNPixelsX()-1) || (xr>couplC)){
907 UpdateMapSignal(row,j2,ntrack,idhit,pulse2);
909 flag = 1; // only first next!!
914 //______________________________________________________________________
915 void AliITSsimulationSPDdubna::SetCouplingOld(Int_t row, Int_t col,
916 Int_t ntrack,Int_t idhit) {
917 // Take into account the coupling between adiacent pixels.
918 // The parameters probcol and probrow are the fractions of the
919 // signal in one pixel shared in the two adjacent pixels along
920 // the column and row direction, respectively.
923 <img src="picts/ITS/barimodel_3.gif">
926 <font size=+2 color=red>
927 <a href="mailto:Rocco.Caliandro@ba.infn.it"></a>.
933 // Int_t row z cell index
934 // Int_t col x cell index
935 // Int_t ntrack track incex number
936 // Int_t idhit hit index number
937 // Int_t module module number
943 Double_t pulse1,pulse2;
944 Float_t couplR=0.0,couplC=0.0;
945 AliITSpList *pList = GetMap();
947 GetCouplings(couplR,couplC);
950 pulse1 = pList->GetSignalOnly(row,col);
952 for (Int_t isign=-1;isign<=1;isign+=2){// loop in row direction
956 if ((j1<0) || (j1>GetNPixelsZ()-1) || (pulse1<GetThreshold())){
957 pulse1 = pList->GetSignalOnly(row,col);
961 UpdateMapSignal(j1,col,ntrack,idhit,pulse1);
965 // loop in column direction
969 if ((j2<0) || (j2>(GetNPixelsX()-1)) || (pulse2<GetThreshold())){
970 pulse2 = pList->GetSignalOnly(row,col);
974 UpdateMapSignal(row,j2,ntrack,idhit,pulse2);