-void AliITSsimulationFastPoints::CreateFastRecPoints(AliITSmodule *mod){
- // Fast points simulator for all of the ITS.
- Int_t nhit,h,trk,ifirst;
- Float_t x,y,z,t,e;// local coordinate (cm) and time of flight, and dedx.
- Float_t x1,y1,z1;
- AliITShit *hit;
-
- fSx->Reset(); // Start out with things clearly zeroed
- fSz->Reset(); // Start out with things clearly zeroed
- e = 0.; // Start out with things clearly zeroed
- Double_t weight=1.;
- nhit = mod->GetNhits();
- ifirst = 1;
- for(h=0;h<nhit;h++){
- hit = mod->GetHit(h);
- hit->GetPositionL(x,y,z,t);
- if(ifirst) {x1=x;y1=y;z1=z;}
- e += hit->GetIonization();
- trk = hit->GetTrack();
- fSx->AddValue((Double_t)x,weight);
- fSz->AddValue((Double_t)z,weight);
- ifirst = 0;
- if(hit->StatusExiting()|| // leaving volume
- hit->StatusDisappeared()|| // interacted/decayed...
- hit->StatusStop() // dropped below E cuts.
- ){ // exiting track, write out RecPoint.
- // if(fSz->GetRMS()>1.E-1) {
- // TParticle *part = hit->GetParticle();
- // printf("idpart %d energy %f \n",part->GetPdgCode(),part->Energy());
- // printf("diffx=%e diffy=%e diffz=%e\n",x-x1,y-y1,z-z1);
- // }
- switch (mod->GetLayer()){
- case 1: case 2: // SPDs
- AddSPD(e,mod,trk);
- break;
- case 3: case 4: // SDDs
- AddSDD(e,mod,trk);
- break;
- case 5: case 6: // SSDs
- AddSSD(e,mod,trk);
- break;
- } // end switch
- fSx->Reset();
- fSz->Reset();
- e = 0.;
- ifirst = 1;
- continue;
- }// end if
- } // end for h
+void AliITSsimulationFastPoints::CreateFastRecPoints(AliITSmodule *mod,
+ Int_t module,
+ TRandom *random,
+ TClonesArray* recp) {
+ // Fast points simulator
+
+ TClonesArray &pt=*recp;
+ AliITS *aliITS = (AliITS*)gAlice->GetModule("ITS");
+ AliITSgeom *gm = aliITS->GetITSgeom();
+ const Float_t kdEdXtoQ = 1.0e+6; // GeV->KeV
+
+ Int_t lay,lad,det;
+ gm->GetModuleId(module,lay,lad,det);
+ Int_t ind=(lad-1)*gm->GetNdetectors(lay)+(det-1);
+ Int_t lyr=(lay-1);
+
+
+ Int_t ihit,flag,numofhits;
+ Float_t locals[3];
+ Float_t globals[3];
+ Double_t sigmarphi=0., sigmaz=0., sigmade=0., thrde=0.;
+ Float_t deltaXl,deltaZl,deltaDe;
+
+ Int_t hitlay, hitlad, hitdet, hitstatus;
+ Float_t hitpx, hitpy, hitpz, hitdestep;
+
+ Int_t hitstatus1, hittrack1;
+ Float_t hitx1, hity1, hitz1;
+ Float_t hitdestep1;
+ Float_t xMg,yMg,zMg;
+ Int_t irecp=0;
+ numofhits = mod->GetNhits();
+ //printf("numofhits %d \n",numofhits);
+ for(ihit=0;ihit<numofhits;ihit++){
+ AliITShit *hit=mod->GetHit(ihit);
+ hit->GetPositionG(hitx1,hity1,hitz1);
+ hitstatus1 = hit->GetTrackStatus();
+ hitdestep1 = hit->GetIonization();
+ hittrack1 = hit->GetTrack();
+
+ mod->MedianHit(module,hitx1,hity1,hitz1,hitstatus1,xMg,yMg,zMg,flag);
+ if (flag!=1) {
+ hitdestep = hit->GetIonization();
+
+ if (hitdestep > 0) {
+ hit->GetDetectorID(hitlay,hitlad,hitdet);
+ hit->GetMomentumG(hitpx,hitpy,hitpz);
+ hitstatus = hitstatus1;
+ // Transform to the module local frame
+ globals[0] = xMg;
+ globals[1] = yMg;
+ globals[2] = zMg;
+ gm->GtoL(hitlay,hitlad,hitdet,globals,locals);
+ // Retrieve sigma values for position and energy, and energy
+ // threshold
+ sigmarphi = SigmaRPhi(hitlay);
+ sigmaz = SigmaZ(hitlay);
+ sigmade = SigmaDe(hitlay);
+ thrde = ThrDe(hitlay);
+ deltaXl = random->Gaus(0,sigmarphi);
+ deltaZl = random->Gaus(0,sigmaz);
+ deltaDe = random->Gaus(0,sigmade);
+
+ // Apply energy threshold and trasform back to global reference
+ // system
+
+ if ( (hitdestep+deltaDe) > thrde ){
+ locals[0] += deltaXl;
+ locals[2] += deltaZl;
+ Int_t lab[4] = {hit->GetTrack(),-3,-3,ind};
+ Float_t q=kdEdXtoQ*(hitdestep+deltaDe);
+ if(hitlay<3) q=1.; // SPD binary readout
+ Float_t hitv[6] = {locals[0],locals[2],static_cast<Float_t>(sigmarphi*sigmarphi),static_cast<Float_t>(sigmaz*sigmaz),q,q};
+ Int_t info[3] = {0,0,lyr};
+ AliITSRecPoint rp(lab,hitv,info,kTRUE);
+
+ new (pt[irecp]) AliITSRecPoint(rp);
+ irecp++;
+ } // end if ( (hitdestep+deltaDe)
+ } // end if (hitdestep > 0)
+ } // end if (flag!=1)
+ } // end for ihit