-void AliITSsimulationSPD::HitToDigit(AliITSmodule *mod,Int_t hitpos,
- Int_t *frowpixel,Int_t *fcolpixel,
- Double_t *fenepixel,AliITSpList *pList) {
- // Steering function to determine the digits associated to a given
- // hit (hitpos)
- // The digits are created by charge sharing (ChargeSharing) and by
- // capacitive coupling (SetCoupling). At all the created digits is
- // associated the track number of the hit (ntrack)
- Double_t x1l=0.0,y1l=0.0,z1l=0.0,x2l=0.0,y2l=0.0,z2l=0.0;
- Int_t r1,r2,c1,c2,row,col,npixel = 0;
- Int_t ntrack;
- Double_t ene=0.0,etot=0.0;
- const Float_t kconv = 10000.; // cm -> microns
- const Float_t kconv1= 0.277e9; // GeV -> electrons equivalent
-
- if(!(mod->LineSegmentL(hitpos,x1l,x2l,y1l,y2l,z1l,z2l,etot,ntrack)))return;
-
- x2l += x1l; y2l += y1l; z2l += z1l; // Convert to ending coordinate.
- // positions shifted and converted in microns
- x1l = x1l*kconv + fSegmentation->Dx()/2.;
- z1l = z1l*kconv + fSegmentation->Dz()/2.;
- // positions shifted and converted in microns
- x2l = x2l*kconv + fSegmentation->Dx()/2.;
- z2l = z2l*kconv + fSegmentation->Dz()/2.;
- etot *= kconv1; // convert from GeV to electrons equivalent.
- Int_t module = mod->GetIndex();
-
- // to account for the effective sensitive area
- // introduced in geometry
- if (z1l<0 || z1l>fSegmentation->Dz()) return;
- if (z2l<0 || z2l>fSegmentation->Dz()) return;
- if (x1l<0 || x1l>fSegmentation->Dx()) return;
- if (x2l<0 || x2l>fSegmentation->Dx()) return;
-
- //Get the col and row number starting from 1
- // the x direction is not inverted for the second layer!!!
- fSegmentation->GetPadIxz(x1l, z1l, c1, r1);
- fSegmentation->GetPadIxz(x2l, z2l, c2, r2);
-
- // to account for unexpected equal entrance and
- // exit coordinates
- if (x1l==x2l) x2l=x2l+x2l*0.1;
- if (z1l==z2l) z2l=z2l+z2l*0.1;
-
- if ((r1==r2) && (c1==c2)){
- // no charge sharing
- npixel = 1;
- frowpixel[npixel-1] = r1;
- fcolpixel[npixel-1] = c1;
- fenepixel[npixel-1] = etot;
- } else {
- // charge sharing
- ChargeSharing(x1l,z1l,x2l,z2l,c1,r1,c2,r2,etot,
- npixel,frowpixel,fcolpixel,fenepixel);
- } // end if r1==r2 && c1==c2.
-
- for (Int_t npix=0;npix<npixel;npix++){
- row = frowpixel[npix];
- col = fcolpixel[npix];
- ene = fenepixel[npix];
- UpdateMapSignal(row,col,ntrack,hitpos,module,ene,pList);
- // Starting capacitive coupling effect
- SetCoupling(row,col,ntrack,hitpos,module,pList);
- } // end for npix
+void AliITSsimulationSPD::HitToSDigitFast(AliITSmodule *mod){
+ // Does the charge distributions using Gaussian diffusion charge charing. // Inputs:
+ // AliITSmodule *mod Pointer to this module
+ // Output:
+ // none.
+ // Return:
+ // none.
+ const Double_t kmictocm = 1.0e-4; // convert microns to cm.
+ const Int_t kn10=10;
+ const Double_t kti[kn10]={7.443716945e-3,2.166976971e-1,3.397047841e-1,
+ 4.325316833e-1,4.869532643e-1,5.130467358e-1,
+ 5.674683167e-1,6.602952159e-1,7.833023029e-1,
+ 9.255628306e-1};
+ const Double_t kwi[kn10]={1.477621124e-1,1.346333597e-1,1.095431813e-1,
+ 7.472567455e-2,3.333567215e-2,3.333567215e-2,
+ 7.472567455e-2,1.095431813e-1,1.346333597e-1,
+ 1.477621124e-1};
+ const Double_t kBunchLenght = 25e-9; // LHC clock
+ TObjArray *hits = mod->GetHits();
+ Int_t nhits = hits->GetEntriesFast();
+ Int_t h,ix,iz,i;
+ Int_t idtrack;
+ Double_t x0=0.0,x1=0.0,y0=0.0,y1=0.0,z0=0.0,z1=0.0,de=0.0,ld=0.0;
+ Double_t x,y,z,t,st,el,sig,sigx,sigz,fda;
+ AliITSsegmentationSPD* seg = (AliITSsegmentationSPD*)GetSegmentationModel(0);
+ AliITSSimuParam* simpar = fDetType->GetSimuParam();
+ Double_t thick = 0.5*kmictocm*seg->Dy(); // Half thickness
+ simpar->GetSPDSigmaDiffusionAsymmetry(fda);
+// cout << "Half Thickness " << thick << endl; // dom
+// cout << "Diffusion asymm " << fda << endl; // dom
+
+ AliDebug(1,Form("(mod=%p) fCoupling=%d",mod,fCoupling));
+ if(nhits<=0) return;
+ for(h=0;h<nhits;h++){
+ if(AliDebugLevel()>0) {
+ AliDebug(1,Form("Hits, %d", h));
+ cout << *(mod->GetHit(h)) << endl;
+ } // end if GetDebug
+ // Check if the hit is inside readout window
+ if (fStrobe)
+ if ((mod->GetHit(h)->GetTOF() < fStrobePhase) ||
+ (mod->GetHit(h)->GetTOF() > (fStrobePhase+(Double_t)fStrobeLenght*kBunchLenght))) continue;
+ if(!mod->LineSegmentL(h,x0,x1,y0,y1,z0,z1,de,idtrack)) continue;
+ st = TMath::Sqrt(x1*x1+y1*y1+z1*z1);
+ if(st>0.0) for(i=0;i<kn10;i++){ // Integrate over t
+ t = kti[i];
+ x = x0+x1*t;
+ y = y0+y1*t;
+ z = z0+z1*t;
+ if(!(seg->LocalToDet(x,z,ix,iz))) continue; // outside
+ el = kwi[i]*de/simpar->GetGeVToCharge();
+ if(GetDebug(1)){
+ if(el<=0.0) cout<<"el="<<el<<" kwi["<<i<<"]="<<kwi[i]
+ <<" de="<<de<<endl;
+ } // end if GetDebug
+ sig = simpar->SigmaDiffusion1D(TMath::Abs(thick + y));
+ sigx=sig;
+ sigz=sig*fda;
+ if (fLorentz) ld=(y+thick)*fTanLorAng;
+ SpreadChargeAsym(x,z,ix,iz,el,sigx,sigz,ld,idtrack,h);
+// cout << "sigx sigz " << sigx << " " << sigz << endl; // dom
+ } // end for i // End Integrate over t
+ else { // st == 0.0 deposit it at this point
+ x = x0;
+ y = y0;
+ z = z0;
+ if(!(seg->LocalToDet(x,z,ix,iz))) continue; // outside
+ el = de / simpar->GetGeVToCharge();
+ sig = simpar->SigmaDiffusion1D(TMath::Abs(thick + y));
+ sigx=sig;
+ sigz=sig*fda;
+ if (fLorentz) ld=(y+thick)*fTanLorAng;
+ SpreadChargeAsym(x,z,ix,iz,el,sigx,sigz,ld,idtrack,h);
+ } // end if st>0.0
+
+ } // Loop over all hits h
+
+ // Coupling
+ switch (fCoupling) {
+ default:
+ break;
+ case 1: // case 3:
+ for(i=0;i<GetMap()->GetEntries();i++)
+ if(GetMap()->GetpListItem(i)==0) continue;
+ else{
+ GetMap()->GetMapIndex(GetMap()->GetpListItem(i)->GetIndex(),iz,ix);
+ SetCoupling(iz,ix,idtrack,h);
+ } // end for i
+ break;
+ case 2: // case 4:
+ for(i=0;i<GetMap()->GetEntries();i++)
+ if(GetMap()->GetpListItem(i)==0) continue;
+ else{
+ GetMap()->GetMapIndex(GetMap()->GetpListItem(i)->GetIndex(),iz,ix);
+ SetCouplingOld(iz,ix,idtrack,h);
+ } // end for i
+ break;
+ } // end switch
+ if(GetDebug(2))Info("HitToSDigit","Finished fCoupling=%d",fCoupling);