Introducing the interaction time into the aliroot generators. In case of gaussian...
authorcvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Aug 2011 13:37:49 +0000 (13:37 +0000)
committercvetan <cvetan@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 17 Aug 2011 13:37:49 +0000 (13:37 +0000)
32 files changed:
EPOS/AliGenEpos.cxx
EVGEN/AliGenBeamGas.cxx
EVGEN/AliGenBox.cxx
EVGEN/AliGenCocktailAfterBurner.cxx
EVGEN/AliGenEMCocktail.cxx
EVGEN/AliGenExtFile.cxx
EVGEN/AliGenFixed.cxx
EVGEN/AliGenGeVSim.cxx
EVGEN/AliGenHIJINGpara.cxx
EVGEN/AliGenHIJINGpara.h
EVGEN/AliGenHIJINGparaBa.cxx
EVGEN/AliGenMUONCocktail.cxx
EVGEN/AliGenMUONCocktailpp.cxx
EVGEN/AliGenMUONLMR.cxx
EVGEN/AliGenParam.cxx
EVGEN/AliGenPromptPhotons.cxx
EVGEN/AliGenSlowNucleons.cxx
EVGEN/AliGenThermalPhotons.cxx
EVGEN/AliGenThetaSlice.cxx
PYTHIA6/AliGenPythia.cxx
PYTHIA6/AliGenPythiaPlus.cxx
STEER/STEER/AliGenerator.cxx
STEER/STEER/AliGenerator.h
TDPMjet/AliGenDPMjet.cxx
TEPEMGEN/AliGenEpEmv1.cxx
THerwig/AliGenHerwig.cxx
THijing/AliGenHijing.cxx
THijing/AliGenHijing.h
THydjet/AliGenHydjet.cxx
TPHIC/AliGenTPHIC.cxx
TTherminator/AliGenTherminator.cxx
TUHKMgen/AliGenUHKM.cxx

index 495f900..fb4d9ce 100644 (file)
@@ -57,11 +57,14 @@ void AliGenEpos::Generate() {
          Float_t polar[3]    =   {0,0,0};
          Float_t origin0[3]  =   {0,0,0};
          Float_t origin[3]   =   {0,0,0};
+         Float_t time0 = 0.;
+         Float_t time  = 0.;
          fNprimaries = 0;
          Int_t nt  = 0; //output parameter for PushTrack
 
          Vertex();
          for (int j=0; j < 3; j++) origin0[j] = fVertex[j];
+         time0 = fTime;
 
          // Generate one event
 
@@ -91,13 +94,14 @@ void AliGenEpos::Generate() {
                          origin[0] = iparticle->Vx();
                          origin[1] = iparticle->Vy();
                          origin[2] = iparticle->Vz();
+                         time      = iparticle->T();
                          //doubled track with freeze out coordinates for femtoscopy
                          PushTrack(0,
                                          imo>=0?idsOnStack[imo]:-1,
                                          iparticle->GetPdgCode(),
                                iparticle->Px(),iparticle->Py(),iparticle->Pz(),iparticle->Energy(),
                                origin[0], origin[1], origin[2],
-                               iparticle->T(),
+                               time,
                                polar[0],polar[1],polar[2],
                                hasMother ? kPDecay:kPNoProcess,nt);
 
@@ -109,12 +113,13 @@ void AliGenEpos::Generate() {
                      origin[0] += origin0[0];
                      origin[1] += origin0[1];
                      origin[2] += origin0[2];
+                     time      += time0;
                          PushTrack(1,
                                          nt,   //doubled track as mother
                                          iparticle->GetPdgCode(),
                                iparticle->Px(),iparticle->Py(),iparticle->Pz(),iparticle->Energy(),
                                origin[0], origin[1], origin[2],
-                               iparticle->T(),
+                               time,
                                polar[0],polar[1],polar[2],
                                kPDecay,nt);
                      fNprimaries++;
@@ -124,12 +129,13 @@ void AliGenEpos::Generate() {
                          origin[0] = iparticle->Vx();
                          origin[1] = iparticle->Vy();
                          origin[2] = iparticle->Vz();
+                         time      = iparticle->T();
                          PushTrack(0,
                                          imo>=0?idsOnStack[imo]:-1,
                                          iparticle->GetPdgCode(),
                                iparticle->Px(),iparticle->Py(),iparticle->Pz(),iparticle->Energy(),
                                origin[0], origin[1], origin[2],
-                               iparticle->T(),
+                               time,
                                polar[0],polar[1],polar[2],
                                hasMother ? kPDecay:kPNoProcess,nt);
                      idsOnStack[i] = nt;
@@ -151,6 +157,7 @@ void AliGenEpos::Generate() {
 
          header->SetNProduced(fNprimaries);
          header->SetPrimaryVertex(eventVertex);
+         header->SetInteractionTime(time0);
 
          header->SetImpactParameter(GetTEpos()->GetBimevt());
          header->SetReactionPlaneAngle(GetTEpos()->GetPhievt());
index 2d3559a..753acb3 100644 (file)
@@ -79,7 +79,9 @@ void AliGenBeamGas::Generate()
 //    beam 1 or 2
 //      
       Float_t ibeam = (random[1] < 0.5) ? -1. : 1.;
-      
+
+      // Interaction time
+      Float_t time = origin[2]/TMath::Ccgs()*ibeam;
 //
 //    Read next event
 //      
@@ -103,7 +105,7 @@ void AliGenBeamGas::Generate()
          Int_t idpart     = iparticle->GetPdgCode();
          Int_t decayed    = iparticle->GetFirstDaughter();
          Int_t doTracking = fTrackIt && (decayed < 0) && (TMath::Abs(idpart) > 10);
-         PushTrack(doTracking,-1,idpart,p,origin,polar,0,kPPrimary,nt);
+         PushTrack(doTracking,-1,idpart,p,origin,polar,time,kPPrimary,nt);
          KeepTrack(nt);
       } // track loop
       nInt++;
index ec2cdbe..112da0d 100644 (file)
@@ -71,6 +71,7 @@ void AliGenBox::Generate()
     Float_t polar[3]= {0,0,0};
   //
     Float_t origin[3];
+    Float_t time;
     Float_t p[3];
     Int_t i, j, nt;
     Double_t pmom, theta, phi, pt;
@@ -79,9 +80,11 @@ void AliGenBox::Generate()
     Float_t random[6];
   //
     for (j=0;j<3;j++) origin[j]=fOrigin[j];
+    time = fTimeOrigin;
     if(fVertexSmear==kPerEvent) {
        Vertex();
        for (j=0;j<3;j++) origin[j]=fVertex[j];
+       time = fTime;
     }
 
     Double_t m = TDatabasePDG::Instance()->GetParticle(fIpart)->Mass();
@@ -134,13 +137,19 @@ void AliGenBox::Generate()
                origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                    TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
            }
+
+           Rndm(random,2);
+           time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+             TMath::Cos(2*random[0]*TMath::Pi())*
+             TMath::Sqrt(-2*TMath::Log(random[1]));
        }
-       PushTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
+       PushTrack(fTrackIt,-1,fIpart,p,origin,polar,time,kPPrimary,nt);
     }
 
     AliGenEventHeader* header = new AliGenEventHeader("BOX");
     header->SetPrimaryVertex(fVertex);
     header->SetNProduced(fNpart);
+    header->SetInteractionTime(fTime);
     
  // Passes header either to the container or to gAlice
     if (fContainer) {
index a254cdc..9d5c3da 100644 (file)
@@ -121,6 +121,7 @@ AddAfterBurner(AliGenerator *AfterBurner, char* Name, Float_t RateExp)
        AfterBurner->SetSigma(fOsigma[0], fOsigma[1], fOsigma[2]);
        AfterBurner->SetVertexSmear(fVertexSmear);
        AfterBurner->SetVertexSource(kContainer);
+       AfterBurner->SetTimeOrigin(fTimeOrigin);
     }
     AfterBurner->SetTrackingFlag(fTrackIt);
     //AfterBurner->SetContainer(this);
@@ -212,6 +213,8 @@ void AliGenCocktailAfterBurner::Generate()
        cout << "Number of events per run" <<  numberOfEvents << endl;
        TArrayF eventVertex;
        eventVertex.Set(3 * (numberOfEvents + fNBgEvents));
+       TArrayF eventTime;
+       eventTime.Set(numberOfEvents + fNBgEvents);
        fCurrentEvent=0;
       //Create stacks
        fInternalStacks      = new TObjArray(numberOfEvents + fNBgEvents); //Create array of internal stacks
@@ -225,6 +228,7 @@ void AliGenCocktailAfterBurner::Generate()
           fInternalStacks->Add(stack);
           Vertex();
           for (Int_t j = 0; j < 3; j++) eventVertex[3 * i +  j] = fVertex[j];
+          eventTime[i] = fTime;
           fHeaders[i] = new AliGenCocktailEventHeader();
           fCollisionGeometries[i] = 0;
        }
@@ -261,11 +265,13 @@ void AliGenCocktailAfterBurner::Generate()
            // Set the vertex for the generator
            Int_t ioff = 3 * i;
            fCurrentGenerator->SetVertex(eventVertex.At(ioff), eventVertex.At(ioff + 1), eventVertex.At(ioff + 2));
+           fCurrentGenerator->SetTime(eventTime.At(i));
            fHeader = fHeaders[i];
-           // Set the vertex for the cocktail
+           // Set the vertex and time for the cocktail
            TArrayF v(3);
            for (Int_t j=0; j<3; j++) v[j] = eventVertex.At(ioff + j);
            fHeader->SetPrimaryVertex(v);
+           fHeader->SetInteractionTime(eventTime.At(i));
            // Generate event
            fCurrentGenerator->Generate();
            //
index 29e0d28..e1a5efc 100644 (file)
@@ -196,6 +196,7 @@ void AliGenEMCocktail::Generate()
   while((entry = (AliGenCocktailEntry*)next())) {
     gen = entry->Generator();
     gen->SetVertex(fVertex.At(0), fVertex.At(1), fVertex.At(2));
+    gen->SetTime(fTime);
     
     if (fNPart > 0) {
       igen++;  
@@ -261,6 +262,7 @@ void AliGenEMCocktail::Generate()
   for (Int_t j=0; j < 3; j++) eventVertex[j] = fVertex[j];
   
   fHeader->SetPrimaryVertex(eventVertex);
+  fHeader->SetInteractionTime(fTime);
 
   gAlice->SetGenEventHeader(fHeader);
 }
index 6fd9974..b2c5adc 100644 (file)
@@ -88,6 +88,7 @@ void AliGenExtFile::Generate()
   Double_t polar[3]  = {0,0,0};
   //
   Double_t origin[3] = {0,0,0};
+  Double_t time = 0.;
   Double_t p[4];
   Float_t random[6];
   Int_t i = 0, j, nt;
@@ -154,17 +155,21 @@ void AliGenExtFile::Generate()
                    fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                    TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
            }
+           Rndm(random,2);
+           time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+             TMath::Cos(2*random[0]*TMath::Pi())*
+             TMath::Sqrt(-2*TMath::Log(random[1]));
        } else {
            origin[0] = fVertex[0] + jparticle->Vx();
            origin[1] = fVertex[1] + jparticle->Vy();
            origin[2] = fVertex[2] + jparticle->Vz();
+           time = fTime + jparticle->T();
        }
-       Double_t tof = jparticle->T();
        Int_t doTracking = fTrackIt && selected && (jparticle->TestBit(kTransportBit));
        Int_t parent     = jparticle->GetFirstMother();
        
        PushTrack(doTracking, parent, idpart,
-                 p[0], p[1], p[2], p[3], origin[0], origin[1], origin[2], tof,
+                 p[0], p[1], p[2], p[3], origin[0], origin[1], origin[2], time,
                  polar[0], polar[1], polar[2],
                  kPPrimary, nt, 1., jparticle->GetStatusCode());
 
@@ -177,6 +182,7 @@ void AliGenExtFile::Generate()
     AliGenEventHeader * header = new AliGenEventHeader();
     header->SetNProduced(fNprimaries);
     header->SetPrimaryVertex(fVertex);
+    header->SetInteractionTime(fTime);
     AddHeader(header);
     break;
     
index 9402c8d..8dacf59 100644 (file)
@@ -70,12 +70,14 @@ void AliGenFixed::Generate()
   Int_t i, j, nt;
   //
   Float_t o[3] = {0., 0., 0.}; 
+  Float_t time = 0.;
   if(fVertexSmear == kPerEvent) {
       Vertex();
       for (j = 0;j < 3; j++) o[j] = fVertex[j];
+      time = fTime;
   }
   
   for(i = 0; i < fNpart; i++) 
-    PushTrack(fTrackIt, -1, fIpart, fP, o , polar, 0, kPPrimary, nt);
+    PushTrack(fTrackIt, -1, fIpart, fP, o , polar, time, kPPrimary, nt);
 }
   
index bbcda72..074ba68 100644 (file)
@@ -756,7 +756,7 @@ void AliGenGeVSim::Generate() {
   orgin[0] = fVertex[0];
   orgin[1] = fVertex[1];
   orgin[2] = fVertex[2];
-
+  time = fTime;
 
   // Particle params database
 
@@ -881,6 +881,7 @@ void AliGenGeVSim::Generate() {
   TArrayF eventVertex(3,orgin);
 
   header->SetPrimaryVertex(eventVertex);
+  header->SetInteractionTime(time);
   header->SetEventPlane(fPsi);
   header->SetEllipticFlow(fPhiFormula->GetParameter(2));
 
index e630b8e..737b0cd 100644 (file)
@@ -307,6 +307,7 @@ void AliGenHIJINGpara::Generate()
     const Int_t kKaons[4] = {kK0Long, kK0Short, kKPlus, kKMinus};
     //
     Float_t origin[3];
+    Float_t time;
     Float_t pt, pl, ptot, wgt;
     Float_t phi, theta;
     Float_t p[3];
@@ -318,16 +319,19 @@ void AliGenHIJINGpara::Generate()
     Float_t random[6];
     //
     for (j=0;j<3;j++) origin[j]=fOrigin[j];
+    time = fTimeOrigin;
 
     if(fVertexSmear == kPerEvent) {
        Vertex();
        for (j=0; j < 3; j++) origin[j] = fVertex[j];
+       time = fTime;
     } // if kPerEvent
     TArrayF eventVertex;
     eventVertex.Set(3);
     eventVertex[0] = origin[0];
     eventVertex[1] = origin[1];
     eventVertex[2] = origin[2];
+    Float_t eventTime = time;
      
     for(i=0;i<fNpart;i++) {
        while(1) {
@@ -366,6 +370,10 @@ void AliGenHIJINGpara::Generate()
                    origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                        TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
                }
+               Rndm(random,2);
+               time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+                 TMath::Cos(2*random[0]*TMath::Pi())*
+                 TMath::Sqrt(-2*TMath::Log(random[1]));
            }
 
            if (fAnalog == 0) { 
@@ -378,12 +386,12 @@ void AliGenHIJINGpara::Generate()
            if (part == kPi0 && fPi0Decays){
 //
 //          Decay pi0 if requested
-               PushTrack(0,-1,part,p,origin,polar,0,kPPrimary,fNt,wgt);
+               PushTrack(0,-1,part,p,origin,polar,time,kPPrimary,fNt,wgt);
                KeepTrack(fNt);
-               DecayPi0(origin, p);
+               DecayPi0(origin, p, time);
            } else {
       // printf("fNt %d", fNt);
-               PushTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,fNt,wgt);
+               PushTrack(fTrackIt,-1,part,p,origin,polar,time,kPPrimary,fNt,wgt);
 
                KeepTrack(fNt);
            }
@@ -398,6 +406,7 @@ void AliGenHIJINGpara::Generate()
     AliGenEventHeader* header = new AliGenEventHeader("HIJINGparam");
 // Event Vertex
     header->SetPrimaryVertex(eventVertex);
+    header->SetInteractionTime(eventTime);
     header->SetNProduced(fNpartProd);
     gAlice->SetGenEventHeader(header); 
 }
@@ -406,7 +415,7 @@ void AliGenHIJINGpara::SetPtRange(Float_t ptmin, Float_t ptmax) {
     AliGenerator::SetPtRange(ptmin, ptmax);
 }
 
-void AliGenHIJINGpara::DecayPi0(Float_t* orig, Float_t * p) 
+void AliGenHIJINGpara::DecayPi0(Float_t* orig, Float_t * p, Float_t time) 
 {
 //
 //    Decay the pi0
@@ -437,7 +446,7 @@ void AliGenHIJINGpara::DecayPi0(Float_t* orig, Float_t * p)
        p[2] = iParticle->Pz();
        Int_t part = iParticle->GetPdgCode();
 
-       PushTrack(fTrackIt, fNt, part, p, orig, polar, 0, kPDecay, nt, fParentWeight);
+       PushTrack(fTrackIt, fNt, part, p, orig, polar, time, kPDecay, nt, fParentWeight);
        KeepTrack(nt);
     }
     fNt = nt;
index c60c2ff..89c5030 100644 (file)
@@ -41,7 +41,7 @@ class AliGenHIJINGpara : public AliGenerator
   TF1* fETAkac;         // Parametrised eta distribution fro ka
   AliDecayer* fDecayer; // ! Pointer to pythia object for decays
 
-  void DecayPi0(Float_t* orig, Float_t * p);
+  void DecayPi0(Float_t* orig, Float_t * p, Float_t time);
 
  private:
   AliGenHIJINGpara(const AliGenHIJINGpara &HIJINGpara);
index a52398b..9d80934 100644 (file)
@@ -269,6 +269,7 @@ void AliGenHIJINGparaBa::Generate()
     const Int_t kBaryons[4] = {kProton, kProtonBar, kNeutron, kNeutronBar};
     //
     Float_t origin[3];
+    Float_t time;
     Float_t pt, pl, ptot;
     Float_t phi, theta;
     Float_t p[3];
@@ -280,6 +281,7 @@ void AliGenHIJINGparaBa::Generate()
     Float_t random[6];
     //
     for (j=0;j<3;j++) origin[j]=fOrigin[j];
+    time = fTimeOrigin;
 
     if(fVertexSmear == kPerEvent) {
        Float_t dv[3];
@@ -292,12 +294,18 @@ void AliGenHIJINGparaBa::Generate()
            }
        }
        for (j=0; j < 3; j++) origin[j] += dv[j];
+
+       Rndm(random,2);
+       time += fOsigma[2]/TMath::Ccgs()*
+         TMath::Cos(2*random[0]*TMath::Pi())*
+         TMath::Sqrt(-2*TMath::Log(random[1]));
     } // if kPerEvent
     TArrayF eventVertex;
     eventVertex.Set(3);
     eventVertex[0] = origin[0];
     eventVertex[1] = origin[1];
     eventVertex[2] = origin[2];
+    Float_t eventTime = time;
 
     for(i=0;i<fNpart;i++) {
        while(1) {
@@ -332,8 +340,13 @@ void AliGenHIJINGparaBa::Generate()
                    origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                        TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
                }
+
+               Rndm(random,2);
+               time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+                 TMath::Cos(2*random[0]*TMath::Pi())*
+                 TMath::Sqrt(-2*TMath::Log(random[1]));
            }
-           PushTrack(fTrackIt,-1,part,p,origin,polar,0,kPPrimary,nt,fParentWeight);
+           PushTrack(fTrackIt,-1,part,p,origin,polar,time,kPPrimary,nt,fParentWeight);
            break;
        } // while(1)
     } // Particle loop
@@ -341,6 +354,7 @@ void AliGenHIJINGparaBa::Generate()
     AliGenEventHeader* header = new AliGenEventHeader("HIJINGparam");
 // Event Vertex
     header->SetPrimaryVertex(eventVertex);
+    header->SetInteractionTime(eventTime);
     gAlice->SetGenEventHeader(header); 
 }
 
index 89fe4de..46dd2c8 100644 (file)
@@ -384,6 +384,7 @@ void AliGenMUONCocktail::Generate()
                while((entry = (AliGenCocktailEntry*)next())) {
                        gen = entry->Generator();
                        gen->SetVertex(fVertex.At(0), fVertex.At(1), fVertex.At(2));
+                       gen->SetTime(fTime);
                        if ( (npart = gRandom->Poisson(entry->Rate())) >0 ) {
                                igen++; 
                                if (igen == 1) entry->SetFirst(0);
@@ -413,7 +414,7 @@ void AliGenMUONCocktail::Generate()
                        (gAlice->GetMCApp()->Particle(iPart)->Theta()*180./TMath::Pi()>fMuonThetaMinCut) &&
                        (gAlice->GetMCApp()->Particle(iPart)->Theta()*180./TMath::Pi()<fMuonThetaMaxCut) &&
                        (gAlice->GetMCApp()->Particle(iPart)->Pt()>fMuonPtCut)                             ) { 
-                                       gAlice->GetMCApp()->Particle(iPart)->SetProductionVertex(fVertex.At(0), fVertex.At(1), fVertex.At(2), 0.);   
+                                       gAlice->GetMCApp()->Particle(iPart)->SetProductionVertex(fVertex.At(0), fVertex.At(1), fVertex.At(2), fTime);   
                                        GoodMuons.AddLast(gAlice->GetMCApp()->Particle(iPart));
                                        numberOfMuons++;
                        }                       
index 4c6763b..c9b8376 100644 (file)
@@ -470,6 +470,7 @@ void AliGenMUONCocktailpp::Generate()
            gen = entry->Generator();
            genName = entry->GetName();
            gen->SetVertex(fVertex.At(0), fVertex.At(1), fVertex.At(2));
+           gen->SetTime(fTime);
 
            npart = (strcmp(genName,"Pythia") == 0) ? 1 :
                gRandom->Poisson(entry->Rate());
@@ -519,6 +520,7 @@ void AliGenMUONCocktailpp::Generate()
     for (Int_t j=0; j < 3; j++) eventVertex[j] = fVertex[j];
 
     fHeader->SetPrimaryVertex(eventVertex);
+    fHeader->SetInteractionTime(fTime);
 
     gAlice->SetGenEventHeader(fHeader);
 
index d046a3c..f6119c1 100644 (file)
@@ -222,11 +222,14 @@ void AliGenMUONLMR::Generate() {
   Int_t nmuons = -1, npartPushed = 0, pdgPushed[100]; 
   Double_t polar[3]= {0,0,0};  // Polarisation of the parent particle (for GEANT tracking)
   Double_t origin0[3];         // Origin of the generated parent particle (for GEANT tracking)
+  Double_t time0;              // Time0  of the generated parent particle
   // Calculating vertex position per event
   for (Int_t j=0;j<3;j++) origin0[j]=fOrigin[j];
+  time0 = fTimeOrigin;
   if(fVertexSmear==kPerEvent) {
     Vertex();
     for (Int_t j=0;j<3;j++) origin0[j]=fVertex[j];
+    time0 = fTime;
   }
   
   printf ("In Generate()\n");
@@ -338,7 +341,7 @@ void AliGenMUONLMR::Generate() {
     if (TMath::Abs(pdgPushed[ipart]) != 13) { // particle is not a muon, hence it's a mother
       PushTrack(0,-1,pdgPushed[ipart],
                pxPushed[ipart],pyPushed[ipart],pzPushed[ipart],ePushed[ipart],
-               origin0[0],origin0[1],origin0[2],0.,
+               origin0[0],origin0[1],origin0[2],time0,
                polar[0],polar[1],polar[2],
                kPPrimary,ntmother,1,11);
       KeepTrack(ntmother); 
@@ -346,7 +349,7 @@ void AliGenMUONLMR::Generate() {
     else { 
       PushTrack(1,ntmother,pdgPushed[ipart],
                pxPushed[ipart],pyPushed[ipart],pzPushed[ipart],ePushed[ipart],
-               origin0[0],origin0[1],origin0[2],0.,
+               origin0[0],origin0[1],origin0[2],time0,
                polar[0],polar[1],polar[2],
                kPDecay,ntchild,1,1);
       KeepTrack(ntchild); 
@@ -355,6 +358,7 @@ void AliGenMUONLMR::Generate() {
   SetHighWaterMark(ntchild); 
   AliGenEventHeader* header = new AliGenEventHeader("LMR");
   header->SetPrimaryVertex(fVertex);
+  header->SetInteractionTime(fTime);
   header->SetNProduced(fNprimaries);
   AddHeader(header); 
 }
index 9428bb8..71847f8 100644 (file)
@@ -262,6 +262,7 @@ void AliGenParam::Generate()
 //
   Float_t polar[3]= {0,0,0};  // Polarisation of the parent particle (for GEANT tracking)
   Float_t origin0[3];         // Origin of the generated parent particle (for GEANT tracking)
+  Float_t time0;              // Time0 of the generated parent particle
   Float_t pt, pl, ptot;       // Transverse, logitudinal and total momenta of the parent particle
   Float_t phi, theta;         // Phi and theta spherical angles of the parent particle momentum
   Float_t p[3], pc[3], 
@@ -280,9 +281,11 @@ void AliGenParam::Generate()
  
 // Calculating vertex position per event
   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;
   }
   
   Int_t ipa=0;
@@ -343,6 +346,10 @@ void AliGenParam::Generate()
                      fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                      TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
              }
+             Rndm(random,2);
+             time0 = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+               TMath::Cos(2*random[0]*TMath::Pi())*
+               TMath::Sqrt(-2*TMath::Log(random[1]));
          }
          
 // Looking at fForceDecay : 
@@ -446,7 +453,7 @@ void AliGenParam::Generate()
 // Parent
                  
                  
-                 PushTrack(0, -1, iPart, p, origin0, polar, 0, kPPrimary, nt, wgtp, ((decayed)? 11 : 1));
+                 PushTrack(0, -1, iPart, p, origin0, polar, time0, kPPrimary, nt, wgtp, ((decayed)? 11 : 1));
                  pParent[0] = nt;
                  KeepTrack(nt); 
                  fNprimaries++;
@@ -476,7 +483,7 @@ void AliGenParam::Generate()
                         
                          PushTrack(fTrackIt * trackIt[i], iparent, kf,
                                           pc, och, polar,
-                                          0, kPDecay, nt, wgtch, ksc);
+                                          time0 + iparticle->T(), kPDecay, nt, wgtch, ksc);
                          pParent[i] = nt;
                          KeepTrack(nt); 
                          fNprimaries++;
@@ -492,7 +499,7 @@ void AliGenParam::Generate()
          else  // nodecay option, so parent will be tracked by GEANT (pions, kaons, eta, omegas, baryons)
          {
            gAlice->GetMCApp()->
-               PushTrack(fTrackIt,-1,iPart,p,origin0,polar,0,kPPrimary,nt,wgtp, 1);
+               PushTrack(fTrackIt,-1,iPart,p,origin0,polar,time0,kPPrimary,nt,wgtp, 1);
             ipa++; 
            fNprimaries++;
          }
@@ -504,6 +511,7 @@ void AliGenParam::Generate()
 
   AliGenEventHeader* header = new AliGenEventHeader("PARAM");
   header->SetPrimaryVertex(fVertex);
+  header->SetInteractionTime(fTime);
   header->SetNProduced(fNprimaries);
   AddHeader(header);
 }
index 4ffb5ad..952723d 100644 (file)
@@ -194,15 +194,18 @@ void AliGenPromptPhotons::Generate()
 
     Float_t polar[3]= {0,0,0};
     Float_t origin[3];
+    Float_t time;
     Float_t p[3];
     Float_t random[6];
     Int_t nt;
 
     for (Int_t j=0;j<3;j++) origin[j]=fOrigin[j];
+    time = fTimeOrigin;
 /*
     if(fVertexSmear==kPerEvent) {
       Vertex();
       for (j=0;j<3;j++) origin[j]=fVertex[j];
+      time = fTime;
     }
 */
     TArrayF eventVertex;
@@ -210,6 +213,7 @@ void AliGenPromptPhotons::Generate()
     eventVertex[0] = origin[0];
     eventVertex[1] = origin[1];
     eventVertex[2] = origin[2];
+    Float_t eventTime = time;
 
     Int_t nGam;
     Float_t b,pt,rapidity,phi,ww;
@@ -237,9 +241,13 @@ void AliGenPromptPhotons::Generate()
              origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
              TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
            }
+           Rndm(random,2);
+           time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+             TMath::Cos(2*random[0]*TMath::Pi())*
+             TMath::Sqrt(-2*TMath::Log(random[1]));
          }
 
-         PushTrack(fTrackIt,-1,22,p,origin,polar,0,kPPrimary,nt,1.);
+         PushTrack(fTrackIt,-1,22,p,origin,polar,time,kPPrimary,nt,1.);
         }
       }
 
@@ -247,6 +255,7 @@ void AliGenPromptPhotons::Generate()
     AliGenEventHeader* header = new AliGenEventHeader("PromptPhotons");
 // Event Vertex
     header->SetPrimaryVertex(eventVertex);
+    header->SetInteractionTime(eventTime);                         
     header->SetNProduced(fNpart);
     gAlice->SetGenEventHeader(header);
 
index 88341bf..13b0e5b 100644 (file)
@@ -180,6 +180,7 @@ void AliGenSlowNucleons::Generate()
    //
     Float_t p[3], theta=0;
     Float_t origin[3] = {0., 0., 0.};
+    Float_t time = 0.;
     Float_t polar [3] = {0., 0., 0.};    
     Int_t nt, i, j;
     Int_t kf;
@@ -187,6 +188,7 @@ void AliGenSlowNucleons::Generate()
     if(fVertexSmear == kPerEvent) {
        Vertex();
        for (j=0; j < 3; j++) origin[j] = fVertex[j];
+       time = fTime;
     } // if kPerEvent
 //
 //  Gray protons
@@ -197,7 +199,7 @@ void AliGenSlowNucleons::Generate()
        GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p, theta);
        if (fDebug) fCosThetaGrayHist->Fill(TMath::Cos(theta));
        PushTrack(fTrackIt, -1, kf, p, origin, polar,
-                0., kPNoProcess, nt, 1.);
+                time, kPNoProcess, nt, 1.);
        KeepTrack(nt);
     }
 //
@@ -209,7 +211,7 @@ void AliGenSlowNucleons::Generate()
        GenerateSlow(fCharge, fTemperatureG, fBetaSourceG, p, theta);
        if (fDebug) fCosThetaGrayHist->Fill(TMath::Cos(theta));
        PushTrack(fTrackIt, -1, kf, p, origin, polar,
-                0., kPNoProcess, nt, 1.);
+                time, kPNoProcess, nt, 1.);
        KeepTrack(nt);
     }
 //
@@ -220,7 +222,7 @@ void AliGenSlowNucleons::Generate()
     for(i = 0; i < fNbp; i++) {
        GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p, theta);
        PushTrack(fTrackIt, -1, kf, p, origin, polar,
-                0., kPNoProcess, nt, 1.);
+                time, kPNoProcess, nt, 1.);
        KeepTrack(nt);
     }
 //
@@ -231,7 +233,7 @@ void AliGenSlowNucleons::Generate()
     for(i = 0; i < fNbn; i++) {
        GenerateSlow(fCharge, fTemperatureB, fBetaSourceB, p, theta);
        PushTrack(fTrackIt, -1, kf, p, origin, polar,
-                0., kPNoProcess, nt, 1.);
+                time, kPNoProcess, nt, 1.);
        KeepTrack(nt);
     }
 }
index 66b3161..13d5b15 100644 (file)
@@ -573,15 +573,18 @@ void AliGenThermalPhotons::Generate()
 
     Float_t polar[3]= {0,0,0};
     Float_t origin[3];
+    Float_t time;
     Float_t p[3];
     Float_t random[6];
     Int_t nt;
 
     for (Int_t j=0;j<3;j++) origin[j]=fOrigin[j];
+    time = fTimeOrigin;
 /*
     if(fVertexSmear==kPerEvent) {
       Vertex();
       for (j=0;j<3;j++) origin[j]=fVertex[j];
+      time = fTime;
     }
 */
     TArrayF eventVertex;
@@ -589,6 +592,7 @@ void AliGenThermalPhotons::Generate()
     eventVertex[0] = origin[0];
     eventVertex[1] = origin[1];
     eventVertex[2] = origin[2];
+    Float_t eventTime = time;
 
     Int_t nGam;
     Float_t impPar,area,pt,rapidity,phi,ww;
@@ -621,9 +625,13 @@ void AliGenThermalPhotons::Generate()
              origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
              TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
            }
+           Rndm(random,2);
+           time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+             TMath::Cos(2*random[0]*TMath::Pi())*
+             TMath::Sqrt(-2*TMath::Log(random[1]));
          }
 
-         PushTrack(fTrackIt,-1,22,p,origin,polar,0,kPPrimary,nt,1.);
+         PushTrack(fTrackIt,-1,22,p,origin,polar,time,kPPrimary,nt,1.);
         }
       }
 
@@ -632,6 +640,7 @@ void AliGenThermalPhotons::Generate()
     AliGenEventHeader* header = new AliGenEventHeader("ThermalPhotons");
 // Event Vertex
     header->SetPrimaryVertex(eventVertex);
+    header->SetInteractionTime(eventTime);
     header->SetNProduced(fNpart);
     gAlice->SetGenEventHeader(header);
 
index a9077c3..7adff4b 100644 (file)
@@ -67,6 +67,7 @@ void AliGenThetaSlice::Generate()
   
     Float_t polar[3]= {0,0,0};
     Float_t origin[3];
+    Float_t time;
     Float_t p[3];
     Int_t i, j, nt;
     Double_t pmom, theta, phi, pt;
@@ -75,12 +76,17 @@ void AliGenThetaSlice::Generate()
     if (fNpart == 0) return;
 
     for (j=0;j<3;j++) origin[j]=fOrigin[j];
+    time = fTimeOrigin;
     if(fVertexSmear==kPerEvent) {
        Rndm(random,6);
        for (j=0;j<3;j++) {
            origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
        }
+       Rndm(random,2);
+       time += fOsigma[2]/TMath::Ccgs()*
+         TMath::Cos(2*random[0]*TMath::Pi())*
+         TMath::Sqrt(-2*TMath::Log(random[1]));
     }
     Float_t thetaInterval = 0.;
     if (fNpart > 1) {
@@ -108,8 +114,12 @@ void AliGenThetaSlice::Generate()
                origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
                    TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
            }
+           Rndm(random,2);
+           time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+             TMath::Cos(2*random[0]*TMath::Pi())*
+             TMath::Sqrt(-2*TMath::Log(random[1]));
        }
-       PushTrack(fTrackIt,-1,fIpart,p,origin,polar,0,kPPrimary,nt);
+       PushTrack(fTrackIt,-1,fIpart,p,origin,polar,time,kPPrimary,nt);
     }
 }
 
index 8917619..6c46455 100644 (file)
@@ -834,7 +834,7 @@ void AliGenPythia::Generate()
                    origin[1] = fVertex[1]+iparticle->Vy()/10; // [cm]
                    origin[2] = fVertex[2]+iparticle->Vz()/10; // [cm]
                    
-                   Float_t tof   = kconv*iparticle->T();
+                   Float_t tof   = fTime + kconv*iparticle->T();
                    Int_t ipa     = iparticle->GetFirstMother()-1;
                    Int_t iparent = (ipa > -1) ? pParent[ipa] : -1;
  
@@ -1174,7 +1174,7 @@ Int_t  AliGenPythia::GenerateMB()
            origin[1] = fVertex[1]+iparticle->Vy()/10; // [cm]
            origin[2] = fVertex[2]+iparticle->Vz()/10; // [cm]
            
-           Float_t tof = fEventTime + kconv * iparticle->T();
+           Float_t tof = fTime + fEventTime + kconv * iparticle->T();
 
            PushTrack(fTrackIt*trackIt, iparent, kf, 
                      p[0], p[1], p[2], p[3], 
@@ -1263,7 +1263,7 @@ void AliGenPythia::MakeHeader()
 //
 // Event Vertex 
     fHeader->SetPrimaryVertex(fVertex);
-    fHeader->SetInteractionTime(fEventTime);
+    fHeader->SetInteractionTime(fTime+fEventTime);
 //
 // Number of primaries
     fHeader->SetNProduced(fNprimaries);
index 0bf7a35..4a19b5f 100644 (file)
@@ -748,7 +748,7 @@ void AliGenPythiaPlus::Generate()
                    origin[1] = fVertex[1]+iparticle->Vy()/10; // [cm]
                    origin[2] = fVertex[2]+iparticle->Vz()/10; // [cm]
                    
-                   Float_t tof   = kconv*iparticle->T();
+                   Float_t tof   = fTime + kconv*iparticle->T();
                    Int_t ipa = (fPythia->Version() == 6) ? (iparticle->GetFirstMother() - 1) :(iparticle->GetFirstMother()) ;
                    Int_t iparent = (ipa > -1) ? pParent[ipa] : -1;
  
@@ -1004,7 +1004,7 @@ Int_t  AliGenPythiaPlus::GenerateMB()
            origin[1] = fVertex[1]+iparticle->Vy()/10; // [cm]
            origin[2] = fVertex[2]+iparticle->Vz()/10; // [cm]
            
-           Float_t tof = fEventTime + kconv * iparticle->T();
+           Float_t tof = fTime + fEventTime + kconv * iparticle->T();
 
            PushTrack(fTrackIt*trackIt, iparent, kf, 
                      p[0], p[1], p[2], p[3], 
@@ -1103,7 +1103,7 @@ void AliGenPythiaPlus::MakeHeader()
 //
 // Event Vertex 
     fHeader->SetPrimaryVertex(fVertex);
-    
+    fHeader->SetInteractionTime(fTime+fEventTime);    
 //
 // Number of primaries
     fHeader->SetNProduced(fNprimaries);
index e94345f..b856d83 100644 (file)
@@ -79,6 +79,8 @@ AliGenerator::AliGenerator():
   fOrigin(3),
   fOsigma(3),
   fVertex(3),
+  fTimeOrigin(0.),
+  fTime(0.),
   fStack(0),
   fContainer(0),
   fCollisionGeometry(0),
@@ -147,6 +149,8 @@ AliGenerator::AliGenerator(Int_t npart):
   fOrigin(3),
   fOsigma(3),
   fVertex(3),
+  fTimeOrigin(0.),
+  fTime(0.),
   fStack(0),
   fContainer(0),
   fCollisionGeometry(0),
@@ -334,6 +338,7 @@ void AliGenerator::VertexExternal()
     fVertex[0] = vertex.X();
     fVertex[1] = vertex.Y();
     fVertex[2] = vertex.Z();
+    fTime = 0.;
 }
 
 //_______________________________________________________________________
@@ -355,10 +360,18 @@ void AliGenerator::VertexInternal()
            }
        }
        for (j=0; j < 3; j++) fVertex[j] = fOrigin[j] + dv[j];
+
+       // In case of gaussian smearing we smear also the event/collision time
+       Rndm(random,2);
+       fTime = fTimeOrigin + fOsigma[2]/TMath::Ccgs()*
+         TMath::Cos(2*random[0]*TMath::Pi())*
+         TMath::Sqrt(-2*TMath::Log(random[1]));
+       
     } else {
        Rndm(random,3);
        for (j=0; j < 3; j++)
            fVertex[j] =  fVMin[j] + random[j] * (fVMax[j] - fVMin[j]);
+       fTime = 0.;
     }
 }
 
index cdb5d23..eb78a0e 100644 (file)
@@ -65,6 +65,10 @@ class AliGenerator : public TNamed, public AliRndm
     void SetVertexGenerator(AliVertexGenerator* vertexGenerator)
       {fVertexGenerator = vertexGenerator; fVertexSource = kExternal; fVertexSmear = kPerEvent;}
     void SetPileUpTimeWindow(Float_t pileUpTimeW) {fPileUpTimeWindow = pileUpTimeW;}
+    virtual void SetTime(Float_t time)
+       {fTime = time;}
+    virtual void SetTimeOrigin(Float_t timeorig)
+        {fTimeOrigin = timeorig;}
     
     virtual void SetTrackingFlag(Int_t flag=1) {fTrackIt=flag;}
     void Vertex();
@@ -143,6 +147,9 @@ class AliGenerator : public TNamed, public AliRndm
     TArrayF     fOrigin;     // Origin of event
     TArrayF     fOsigma;     // Sigma of the Origin of event
     TArrayF     fVertex;        //! Vertex of current event
+    
+    Float_t     fTimeOrigin; // Time0 origin in a run or event sample
+    Float_t     fTime;       // Event time smeared around time0 origin using sigma vertex
 
     AliStack*   fStack;         //! Local pointer to stack
     AliGenerator* fContainer;   //! Local pointer to container
@@ -170,7 +177,7 @@ class AliGenerator : public TNamed, public AliRndm
     AliGenerator(const AliGenerator &gen);
     AliGenerator & operator=(const AliGenerator &gen);
 
-    ClassDef(AliGenerator,4) // Base class for event generators
+    ClassDef(AliGenerator,5) // Base class for event generators
 };
 
 #endif
index c3d1507..4c85390 100644 (file)
@@ -335,7 +335,7 @@ void AliGenDPMjet::Generate()
              origin[1] = fVertex[1]+iparticle->Vy()/10; // [cm]
              origin[2] = fVertex[2]+iparticle->Vz()/10; // [cm]
                    
-             tof = kconv*iparticle->T();
+             tof = fTime + kconv*iparticle->T();
              
              imo = -1;
              TParticle* mother = 0;
@@ -453,6 +453,7 @@ void AliGenDPMjet::MakeHeader()
     ((AliGenDPMjetEventHeader*) header)->SetTrials(fTrials);
     // Event Vertex
     header->SetPrimaryVertex(fVertex);
+    header->SetInteractionTime(fTime);
     gAlice->SetGenEventHeader(header);    
     AddHeader(header);
 }
index 3aa0f17..78f2414 100644 (file)
@@ -132,6 +132,7 @@ void AliGenEpEmv1::Generate()
 
   Float_t polar[3]= {0,0,0};
   Float_t origin[3];
+  Float_t time = 0.;
   Float_t p[3];
 
   Double_t ptElectron,ptPositron, phiElectron,phiPositron, mt;
@@ -146,12 +147,17 @@ void AliGenEpEmv1::Generate()
           yElectron,yPositron,xElectron,xPositron,phi12);
 
   for (j=0;j<3;j++) origin[j]=fOrigin[j];
+  time = fTimeOrigin;
   if(fVertexSmear==kPerEvent) {
     Rndm(random,6);
     for (j=0;j<3;j++) {
       origin[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
        TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
     }
+    Rndm(random,2);
+    time += fOsigma[2]/TMath::Ccgs()*
+      TMath::Cos(2*random[0]*TMath::Pi())*
+      TMath::Sqrt(-2*TMath::Log(random[1]));
   }
 
   Rndm(random,1);
@@ -168,7 +174,7 @@ void AliGenEpEmv1::Generate()
   id =  11;
   if (fDebug == 2)
     printf("id=%+3d, p = (%+11.4e,%+11.4e,%+11.4e) GeV\n",id,p[0],p[1],p[2]);
-  PushTrack(fTrackIt,-1, id,p,origin,polar,0,kPPrimary,nt,weight);
+  PushTrack(fTrackIt,-1, id,p,origin,polar,time,kPPrimary,nt,weight);
 
   // Produce positron
   mt = TMath::Sqrt(ptPositron*ptPositron + fMass*fMass);
@@ -178,7 +184,7 @@ void AliGenEpEmv1::Generate()
   id = -11;
   if (fDebug == 2)
     printf("id=%+3d, p = (%+11.4e,%+11.4e,%+11.4e) GeV\n",id,p[0],p[1],p[2]);
-  PushTrack(fTrackIt,-1, id,p,origin,polar,0,kPPrimary,nt,weight);
+  PushTrack(fTrackIt,-1, id,p,origin,polar,time,kPPrimary,nt,weight);
   
   fEvent++;
   if (fEvent%1000 == 0) {
@@ -186,6 +192,7 @@ void AliGenEpEmv1::Generate()
           fEvent,fEpEmGen->GetXsection(),fEpEmGen->GetDsection());
   }
   fHeader.SetEventWeight(weight);
+  fHeader.SetInteractionTime(time);
   AddHeader(&fHeader);
 }
 
index 8746825..291ff73 100644 (file)
@@ -340,7 +340,7 @@ void AliGenHerwig::Generate()
                origin[1] = fVertex[1] + iparticle->Vy()/10; // [cm]
                origin[2] = fVertex[2] + iparticle->Vz()/10; // [cm]
 
-               Float_t tof = kconv*iparticle->T();
+               Float_t tof = fTime + kconv*iparticle->T();
                Int_t   iparent = (imo > -1) ? newPos[imo] : -1;
                Int_t   trackIt = (ks == 1) && fTrackIt;
                PushTrack(trackIt, iparent, kf,
@@ -527,7 +527,7 @@ void AliGenHerwig::MakeHeader()
 //
 // Event Vertex 
     fHeader->SetPrimaryVertex(fVertex);
-    
+    fHeader->SetInteractionTime(fTime);
 //
 // Number of primaries
     fHeader->SetNProduced(fNprimaries);
index e8bb091..915e8cf 100644 (file)
@@ -74,7 +74,6 @@ AliGenHijing::AliGenHijing()
      fLHC(kFALSE),
      fRandomPz(kFALSE),
      fNoHeavyQuarks(kFALSE),
-     fEventTime(0.),
      fHeader(AliGenHijingEventHeader("Hijing"))
 {
   // Constructor
@@ -119,7 +118,6 @@ AliGenHijing::AliGenHijing(Int_t npart)
      fLHC(kFALSE),
      fRandomPz(kFALSE),
      fNoHeavyQuarks(kFALSE),
-     fEventTime(0.),
      fHeader(AliGenHijingEventHeader("Hijing"))
 {
 // Default PbPb collisions at 5. 5 TeV
@@ -222,6 +220,7 @@ void AliGenHijing::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;
 
@@ -238,10 +237,12 @@ void AliGenHijing::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;
   } 
 
 
@@ -283,7 +284,7 @@ void AliGenHijing::Generate()
       fVertex[0] = origin0[0];
       fVertex[1] = origin0[1]; 
       fVertex[2] = origin0[2];
-      
+      fTime = time0;
 //
 //      First select parent particles
 //
@@ -355,11 +356,6 @@ void AliGenHijing::Generate()
       } // 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 (i = 0; i<np; i++) {
@@ -375,16 +371,8 @@ void AliGenHijing::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) {
@@ -603,7 +591,7 @@ void AliGenHijing::MakeHeader()
     fHeader.SetTrials(fTrials);
 // Event Vertex
     fHeader.SetPrimaryVertex(fVertex);
-    fHeader.SetInteractionTime(fEventTime);
+    fHeader.SetInteractionTime(fTime);
     AddHeader(&fHeader);
     fCollisionGeometry = &fHeader;
 }
index a1f4e03..500b6a4 100644 (file)
@@ -127,7 +127,6 @@ class AliGenHijing : public AliGenMC
     Int_t       fLHC;            // Assume LHC as lab frame
     Bool_t      fRandomPz;       // Randomise sign of pz  event by event
     Bool_t      fNoHeavyQuarks;  // If true no heavy quarks are produced
-    Float_t     fEventTime;      // The event time
     AliGenHijingEventHeader     fHeader; // MC Header
     
  private:
@@ -141,7 +140,7 @@ class AliGenHijing : public AliGenMC
     // check if stable
     Bool_t Stable(const TParticle*  particle) const;
     
-    ClassDef(AliGenHijing, 7) // AliGenerator interface to Hijing
+    ClassDef(AliGenHijing, 8) // AliGenerator interface to Hijing
 };
 #endif
 
index 675244b..915c174 100755 (executable)
@@ -112,6 +112,7 @@ void AliGenHydjet::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;
 
@@ -123,9 +124,11 @@ void AliGenHydjet::Generate()
   kf = 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;
   }
 
   while(1)
@@ -148,6 +151,7 @@ void AliGenHydjet::Generate()
       fVertex[0] = origin0[0];
       fVertex[1] = origin0[1];
       fVertex[2] = origin0[2];
+      fTime = time0;
 
 //
 // Now select the final state particles
@@ -185,7 +189,7 @@ void AliGenHydjet::Generate()
            origin[0] = fVertex[0]+iparticle->Vx()/10;
            origin[1] = fVertex[1]+iparticle->Vy()/10;
            origin[2] = fVertex[2]+iparticle->Vz()/10;
-           tof   = kconv*iparticle->T();
+           tof   = fTime + kconv*iparticle->T();
 
            imo = -1;
            //imo = iparticle->GetFirstMother();
@@ -263,6 +267,7 @@ void AliGenHydjet::MakeHeader()
 
 // Event Vertex
     header->SetPrimaryVertex(fVertex);
+    header->SetInteractionTime(fTime);
     AddHeader(header);
     fCollisionGeometry = (AliGenHydjetEventHeader*)  header;
 }
index 7d841a3..9f3ea15 100644 (file)
@@ -132,6 +132,7 @@ void AliGenTPHIC::Generate()
 
   Float_t polar[3]   = {0,0,0};
   Float_t origin0[3] = {0,0,0};
+  Float_t time0 = 0.;
   Float_t origin[3]  = {0,0,0};
   Float_t p[3], tof;
   Double_t weight;
@@ -150,13 +151,18 @@ void AliGenTPHIC::Generate()
     Info("Generate()","one event is produced");
 
   Int_t j;
-  for (j=0;j<3;j++) origin[j]=fOrigin[j];
+  for (j=0;j<3;j++) origin0[j]=fOrigin[j];
+  time0 = fTimeOrigin;
   if(fVertexSmear==kPerEvent) {
     Rndm(random,6);
     for (j=0;j<3;j++) {
       origin0[j]+=fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())*
        TMath::Sqrt(-2*TMath::Log(random[2*j+1]));
     }
+    Rndm(random,2);
+    time0 += fOsigma[2]/TMath::Ccgs()*
+      TMath::Cos(2*random[0]*TMath::Pi())*
+      TMath::Sqrt(-2*TMath::Log(random[1]));
   }
 
   Int_t ip;
@@ -176,7 +182,7 @@ void AliGenTPHIC::Generate()
     origin[2] = origin0[2]+iparticle->Vz()/10.;
     kf = CheckPDGCode(iparticle->GetPdgCode());
     iparent = -1;
-    tof     = kconv*iparticle->T();
+    tof     = time0 + kconv*iparticle->T();
     if (ks == 1) trackIt = 1;
     else         trackIt = 0;
     PushTrack(fTrackIt*trackIt,iparent,kf,p,origin,polar,tof,kPPrimary,nt,weight,ks);
index 4f42251..58b5047 100644 (file)
@@ -98,7 +98,9 @@ void AliGenTherminator::Generate()
 
   Float_t polar[3]    =   {0,0,0};
   Float_t origin[3]   =   {0,0,0};
+  Float_t time        =   0.;
   Float_t origin0[3]  =   {0,0,0};
+  Float_t time0       =   0.;
   Float_t p[3];
   Float_t mass, energy;
 
@@ -108,6 +110,7 @@ void AliGenTherminator::Generate()
 
   Vertex();
   for (j=0; j < 3; j++) origin0[j] = fVertex[j];
+  time0 = fTime;
 
   // Generate one event
 
@@ -152,7 +155,8 @@ void AliGenTherminator::Generate()
       origin[0] = vrho*TMath::Cos(vphi + evrot);
       origin[1] = vrho*TMath::Sin(vphi + evrot);
       origin[2] = iparticle->Vz();
-      
+      time      = iparticle->T();
+
       imo = -1;
       //      TParticle* mother = 0;
       if (hasMother) {
@@ -164,7 +168,7 @@ void AliGenTherminator::Generate()
       //      printf("Pushing Track %d with status %d mother %d\n", kf, tFlag, imo>=0?idsOnStack[imo]:imo);
       PushTrack(tFlag,imo>=0?idsOnStack[imo]:imo,kf,
                p[0],p[1],p[2],energy,
-               origin[0],origin[1],origin[2],iparticle->T(),
+               origin[0],origin[1],origin[2],time,
                polar[0],polar[1],polar[2],
                hasMother ? kPDecay:kPNoProcess,nt);
       idsOnStack[i] = nt;
@@ -197,7 +201,8 @@ void AliGenTherminator::Generate()
       origin[0] = vrho*TMath::Cos(vphi + evrot);
       origin[1] = vrho*TMath::Sin(vphi + evrot);
       origin[2] = iparticle->Vz();
-      
+      time      = iparticle->T();
+
       imo = -1;
       //      TParticle* mother = 0;
       if (hasMother) {
@@ -210,7 +215,7 @@ void AliGenTherminator::Generate()
 //       printf("Pushing Track %d with status %d mother %d\n", kf, tFlag, imo>=0?idsOnStack[imo]:imo);
       PushTrack(tFlag,imo>=0?idsOnStack[imo]:imo,kf,
                p[0],p[1],p[2],energy,
-               origin[0],origin[1],origin[2],iparticle->T(),
+               origin[0],origin[1],origin[2],time,
                polar[0],polar[1],polar[2],
                hasMother ? kPDecay:kPNoProcess,nt);
       idsOnStack[i] = nt;
@@ -220,6 +225,7 @@ void AliGenTherminator::Generate()
       origin[0] = origin0[0]+vrho*TMath::Cos(vphi + evrot);
       origin[1] = origin0[1]+vrho*TMath::Sin(vphi + evrot);
       origin[2] = origin0[2]+iparticle->Vz();
+      time      = time0+iparticle->T();
 
       imo = nt;
       //      mother = (TParticle *) fParticles.At(nt);
@@ -228,7 +234,7 @@ void AliGenTherminator::Generate()
 //       printf("Pushing Track %d with status %d mother %d\n", kf, tFlag, imo);
       PushTrack(tFlag,imo,kf,
                p[0],p[1],p[2],energy,
-               origin[0],origin[1],origin[2],iparticle->T(),
+               origin[0],origin[1],origin[2],time,
                polar[0],polar[1],polar[2],
                hasMother ? kPDecay:kPNoProcess,nt);
       fNprimaries++;
@@ -245,6 +251,7 @@ void AliGenTherminator::Generate()
   eventVertex[0] = origin0[0];
   eventVertex[1] = origin0[1];
   eventVertex[2] = origin0[2];
+  Float_t eventTime = time0;
 
 // Builds the event header, to be called after each event
   AliGenEventHeader* header = new AliGenHijingEventHeader("Therminator");
@@ -257,6 +264,7 @@ void AliGenTherminator::Generate()
 
   ((AliGenHijingEventHeader*) header)->SetNProduced(fNprimaries);
   ((AliGenHijingEventHeader*) header)->SetPrimaryVertex(eventVertex);
+  ((AliGenHijingEventHeader*) header)->SetInteractionTime(eventTime);
   ((AliGenHijingEventHeader*) header)->SetImpactParameter(0.0);
   ((AliGenHijingEventHeader*) header)->SetTotalEnergy(0.0);
   ((AliGenHijingEventHeader*) header)->SetHardScatters(0);
@@ -293,6 +301,7 @@ void AliGenTherminator::Generate()
 //     ((AliGenHijingEventHeader*) header)->SetTrials(fTrials);
 // Event Vertex
   header->SetPrimaryVertex(fVertex);
+  header->SetInteractionTime(fTime);
   AddHeader(header);
   fCollisionGeometry = (AliGenHijingEventHeader*)  header;
 
index 7e659fb..8e19451 100755 (executable)
@@ -324,12 +324,14 @@ void AliGenUHKM::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 v[3];
   Float_t mass=0.0, energy=0.0;
 
   Vertex();
   for(Int_t j=0; j<3; j++) origin0[j] = fVertex[j];
+  time0 = fTime;
 
   // Generate the event and import particles
   fUHKMgen->GenerateEvent();
@@ -451,13 +453,14 @@ void AliGenUHKM::Generate()
       origin[0] = origin0[0]+v[0];
       origin[1] = origin0[1]+v[1];
       origin[2] = origin0[2]+v[2];
+      Float_t time = time0+iparticle->T();
       imo = nt;
       
       trackFlag = fTrackIt;    // Track this particle, unless otherwise specified by fTrackIt
       
       PushTrack(trackFlag, imo, kf,
                p[0], p[1], p[2], energy,
-               origin[0], origin[1], origin[2], iparticle->T(),
+               origin[0], origin[1], origin[2], time,
                polar[0], polar[1], polar[2],
                hasMother ? kPDecay:kPNoProcess, nt);
       
@@ -473,6 +476,7 @@ void AliGenUHKM::Generate()
   eventVertex[0] = origin0[0];
   eventVertex[1] = origin0[1];
   eventVertex[2] = origin0[2];
+  Float_t eventTime = time0;
 
   // Builds the event header, to be called after each event
   AliGenEventHeader* header = new AliGenHijingEventHeader("UHKM");
@@ -486,6 +490,7 @@ void AliGenUHKM::Generate()
 
   ((AliGenHijingEventHeader*) header)->SetNProduced(fNprimaries);
   ((AliGenHijingEventHeader*) header)->SetPrimaryVertex(eventVertex);
+  ((AliGenHijingEventHeader*) header)->SetInteractionTime(eventTime);
   ((AliGenHijingEventHeader*) header)->SetImpactParameter(b);
   ((AliGenHijingEventHeader*) header)->SetTotalEnergy(0.0);
   ((AliGenHijingEventHeader*) header)->SetHardScatters(0);
@@ -495,6 +500,7 @@ void AliGenUHKM::Generate()
   ((AliGenHijingEventHeader*) header)->SetReactionPlaneAngle(0);//evrot);
 
   header->SetPrimaryVertex(fVertex);
+  header->SetInteractionTime(fTime);
   AddHeader(header);
   fCollisionGeometry = (AliGenHijingEventHeader*)  header;