]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenParam.cxx
add dphi histograms for deta > 0.8
[u/mrichter/AliRoot.git] / EVGEN / AliGenParam.cxx
index ee8c3ff3aa764e9da230bbde8ff0b39d3a4e0440..71847f8a7cfb9636f7639ea1d31b3cd7a4c89e90 100644 (file)
@@ -64,6 +64,7 @@ ClassImp(AliGenParam)
        fBias(0.),
        fTrials(0),
        fDeltaPt(0.01),
+       fSelectAll(kFALSE),
        fDecayer(0)
 {
 // Default constructor
@@ -83,6 +84,7 @@ AliGenParam::AliGenParam(Int_t npart, const AliGenLib * Library,  Int_t param, c
      fBias(0.),
      fTrials(0),
      fDeltaPt(0.01),
+     fSelectAll(kFALSE),
      fDecayer(0)
 {
 // Constructor using number of particles parameterisation id and library
@@ -106,6 +108,7 @@ AliGenParam::AliGenParam(Int_t npart, Int_t param, const char* tname, const char
     fBias(0.),
     fTrials(0),
     fDeltaPt(0.01),
+    fSelectAll(kFALSE),
     fDecayer(0)
 {
 // Constructor using parameterisation id and number of particles
@@ -148,6 +151,7 @@ AliGenParam::AliGenParam(Int_t npart, Int_t param,
      fBias(0.),
      fTrials(0),
      fDeltaPt(0.01),
+     fSelectAll(kFALSE),
      fDecayer(0)
 {
 // Constructor
@@ -258,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], 
@@ -276,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;
@@ -339,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 : 
@@ -413,7 +424,7 @@ void AliGenParam::Generate()
 //
 // children
                      
-                     if ((ChildSelected(TMath::Abs(kf)) || fForceDecay == kAll) && trackIt[i])
+                     if ((ChildSelected(TMath::Abs(kf)) || fForceDecay == kAll || fSelectAll) && trackIt[i])
                      {
                          if (fCutOnChild) {
                              pc[0]=iparticle->Px();
@@ -442,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++;
@@ -472,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++;
@@ -488,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++;
          }
@@ -500,6 +511,7 @@ void AliGenParam::Generate()
 
   AliGenEventHeader* header = new AliGenEventHeader("PARAM");
   header->SetPrimaryVertex(fVertex);
+  header->SetInteractionTime(fTime);
   header->SetNProduced(fNprimaries);
   AddHeader(header);
 }