]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TAmpt/AliGenAmpt.cxx
Simplify AliAnaPhoton, move conversion utilities to other analysis class
[u/mrichter/AliRoot.git] / TAmpt / AliGenAmpt.cxx
index 7ac88de4ea81076532de1cd7a93f8912e91c7ded..02ee244b38d00952e999022f9f9d8126d2cb62a3 100644 (file)
@@ -73,8 +73,7 @@ AliGenAmpt::AliGenAmpt()
     fLHC(kFALSE),
     fRandomPz(kFALSE),
     fNoHeavyQuarks(kFALSE),
-    fEventTime(0.),
-    fIsoft(1),
+    fIsoft(4),
     fNtMax(150),
     fIpop(1),
     fXmu(3.2264),
@@ -126,7 +125,6 @@ AliGenAmpt::AliGenAmpt(Int_t npart)
     fLHC(kFALSE),
     fRandomPz(kFALSE),
     fNoHeavyQuarks(kFALSE),
-    fEventTime(0.),
     fIsoft(1),
     fNtMax(150),
     fIpop(1),
@@ -235,6 +233,7 @@ void AliGenAmpt::Generate()
   Float_t polar[3]    =   {0,0,0};
   Float_t origin[3]   =   {0,0,0};
   Float_t origin0[3]  =   {0,0,0};
+  Float_t time0 = 0.;
   Float_t p[3];
   Float_t tof;
 
@@ -249,11 +248,13 @@ void AliGenAmpt::Generate()
   fTrials = 0;
   for (j = 0;j < 3; j++) 
     origin0[j] = fOrigin[j];
+  time0 = fTimeOrigin;
 
   if(fVertexSmear == kPerEvent) {
     Vertex();
     for (j=0; j < 3; j++) 
       origin0[j] = fVertex[j];
+    time0 = fTime;
   } 
 
   Float_t sign = (fRandomPz && (Rndm() < 0.5))? -1. : 1.;
@@ -287,7 +288,7 @@ void AliGenAmpt::Generate()
         TParticle *iparticle = (TParticle *)fParticles.At(i);
         if (!Stable(iparticle)) 
           continue;
-        kf        = iparticle->GetPdgCode();
+        kf        = TMath::Abs(iparticle->GetPdgCode());
         if (kf==92)
           continue;
         if (0) { // this turned out to be too cumbersome!
@@ -373,6 +374,7 @@ void AliGenAmpt::Generate()
     fVertex[0] = origin0[0];
     fVertex[1] = origin0[1];   
     fVertex[2] = origin0[2];
+    fTime = time0;
       
     // First select parent particles
     for (Int_t i = 0; i < np; i++) {
@@ -436,15 +438,10 @@ void AliGenAmpt::Generate()
       if (selected) {
         nc++;
         pSelected[i] = 1;
-        if (1) printf("---> %d %d %d %s\n",i,nc,kf,iparticle->GetName());
+        if (0) printf("---> %d %d %d %s\n",i,nc,kf,iparticle->GetName());
       } // selected
     } // particle loop final state
 
-    //Time of the interactions
-    Float_t tInt = 0.;
-    if (fPileUpTimeWindow > 0.) 
-      tInt = fPileUpTimeWindow * (2. * gRandom->Rndm() - 1.);
-
     // Write particles to stack
     for (Int_t i = 0; i<np; i++) {
       TParticle *iparticle = (TParticle *) fParticles.At(i);
@@ -459,16 +456,8 @@ void AliGenAmpt::Generate()
         origin[0] = origin0[0]+iparticle->Vx()/10;
         origin[1] = origin0[1]+iparticle->Vy()/10;
         origin[2] = origin0[2]+iparticle->Vz()/10;
-        fEventTime = 0.;
-             
-        if (TestBit(kVertexRange)) {
-          fEventTime = sign * origin0[2] / 2.99792458e10;
-          tof = kconv * iparticle->T() + fEventTime;
-        } else {
-          tof = kconv * iparticle->T();
-          fEventTime = tInt;
-          if (fPileUpTimeWindow > 0.) tof += tInt;
-        }
+       tof = time0+kconv * iparticle->T();
+
         imo = -1;
         TParticle* mother = 0;
         if (hasMother) {
@@ -666,7 +655,7 @@ void AliGenAmpt::MakeHeader()
   fHeader->SetTrials(fTrials);
   // Event Vertex
   fHeader->SetPrimaryVertex(fVertex);
-  fHeader->SetInteractionTime(fEventTime);
+  fHeader->SetInteractionTime(fTime);
 
   fCollisionGeometry = fHeader;
   AddHeader(fHeader);