]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - THijing/AliGenHijing.cxx
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / THijing / AliGenHijing.cxx
index b1125c7f843cdb65bb3a1364374673cdf561e889..43cbbd8fd793212b2ee754ec5ea5cdf518e84e7c 100644 (file)
@@ -74,8 +74,9 @@ AliGenHijing::AliGenHijing()
      fLHC(kFALSE),
      fRandomPz(kFALSE),
      fNoHeavyQuarks(kFALSE),
-     fEventTime(0.),
-     fHeader(AliGenHijingEventHeader("Hijing"))
+     fHeader(AliGenHijingEventHeader("Hijing")),
+     fSigmaNN(-1),
+     fNoElas(0)
 {
   // Constructor
   fEnergyCMS = 5500.;
@@ -119,8 +120,9 @@ AliGenHijing::AliGenHijing(Int_t npart)
      fLHC(kFALSE),
      fRandomPz(kFALSE),
      fNoHeavyQuarks(kFALSE),
-     fEventTime(0.),
-     fHeader(AliGenHijingEventHeader("Hijing"))
+     fHeader(AliGenHijingEventHeader("Hijing")),
+     fSigmaNN(-1),
+     fNoElas(0)
 {
 // Default PbPb collisions at 5. 5 TeV
 //
@@ -160,8 +162,14 @@ void AliGenHijing::Init()
     fHijing->SetIHPR2(21, fKeep);
     fHijing->SetHIPR1(8,  fPtHardMin);         
     fHijing->SetHIPR1(9,  fPtHardMax);         
-    fHijing->SetHIPR1(10, fPtMinJet);  
+    fHijing->SetHIPR1(10, fPtMinJet); 
+    if (fSigmaNN>0)
+      fHijing->SetHIPR1(31, fSigmaNN/2.);      
     fHijing->SetHIPR1(50, fSimpleJet);
+    //
+    // Switching off elastic scattering
+    if (fNoElas)
+      fHijing->SetIHPR2(14, 0);
 //
 //  Quenching
 //
@@ -222,6 +230,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 +247,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 +294,7 @@ void AliGenHijing::Generate()
       fVertex[0] = origin0[0];
       fVertex[1] = origin0[1]; 
       fVertex[2] = origin0[2];
-      
+      fTime = time0;
 //
 //      First select parent particles
 //
@@ -354,11 +365,6 @@ void AliGenHijing::Generate()
          } // 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
 
@@ -375,16 +381,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) {
@@ -412,6 +410,7 @@ void AliGenHijing::Generate()
          }
       }
   } // event loop
+
   MakeHeader();
   SetHighWaterMark(nt);
 }
@@ -493,7 +492,7 @@ void AliGenHijing::EvaluateCrossSections()
     fDnDb      = new TGraph(i, b, si2);
 }
 
-Bool_t AliGenHijing::DaughtersSelection(TParticle* iparticle)
+Bool_t AliGenHijing::DaughtersSelection(const TParticle* iparticle)
 {
 //
 // Looks recursively if one of the daughters has been selected
@@ -545,7 +544,7 @@ Bool_t AliGenHijing::SelectFlavor(Int_t pid)
     return res;
 }
 
-Bool_t AliGenHijing::Stable(TParticle*  particle) const
+Bool_t AliGenHijing::Stable(const TParticle*  particle) const
 {
 // Return true for a stable particle
 //
@@ -575,6 +574,7 @@ void AliGenHijing::MakeHeader()
     fHeader.SetSpectators(fProjectileSpecn, fProjectileSpecp,
                          fTargetSpecn,fTargetSpecp);
     fHeader.SetReactionPlaneAngle(fHijing->GetHINT1(20));
+    fHeader.SetTrueNPart(fHijing->GetNPART());
 
 // 4-momentum vectors of the triggered jets.
 //
@@ -603,7 +603,24 @@ void AliGenHijing::MakeHeader()
     fHeader.SetTrials(fTrials);
 // Event Vertex
     fHeader.SetPrimaryVertex(fVertex);
-    fHeader.SetInteractionTime(fEventTime);
+    fHeader.SetInteractionTime(fTime);
+
+    Int_t nsd1 = 0,nsd2 = 0,ndd = 0;
+    Int_t nT = fHijing->GetNT();
+    Int_t nP = fHijing->GetNP();
+    for (Int_t i = 1; i <= nP; ++i) {
+      for (Int_t j = 1; j <= nT; ++j) {
+      Int_t tp = fHijing->GetNFP(i, 5);
+      Int_t tt = fHijing->GetNFT(j, 5);
+      if (tp == 2)
+        nsd1++;
+      if (tt == 2)
+        nsd2++;
+      if (tp == 2 && tt == 2)
+        ndd++;
+      }
+    }
+    fHeader.SetNDiffractive(nsd1, nsd2, ndd);
     AddHeader(&fHeader);
     fCollisionGeometry = &fHeader;
 }