]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EVGEN/AliGenHijing.cxx
New class used for primary vertex finding (AliITSVertexerTracks)
[u/mrichter/AliRoot.git] / EVGEN / AliGenHijing.cxx
index 878017b26d411ed23270af2140161a754b9f1264..156cd52b87cd18be4ed9c9616beebc685d43fe60 100644 (file)
 
 /*
 $Log$
+Revision 1.46  2003/01/07 14:12:33  morsch
+Provides collision geometry.
+
+Revision 1.45  2002/12/16 09:44:49  morsch
+Default for fRadiation is 3.
+
+Revision 1.44  2002/10/14 14:55:35  hristov
+Merging the VirtualMC branch to the main development branch (HEAD)
+
+Revision 1.42.4.1  2002/08/28 15:06:50  alibrary
+Updating to v3-09-01
+
+Revision 1.43  2002/08/09 12:09:52  morsch
+Direct gamma trigger correctly included.
+
+Revision 1.42  2002/03/12 11:07:08  morsch
+Add status code of particle to SetTrack call.
+
+Revision 1.41  2002/03/05 11:25:33  morsch
+- New quenching options
+- Correction in CheckTrigger()
+
+Revision 1.40  2002/02/12 11:05:53  morsch
+Get daughter indices right.
+
+Revision 1.39  2002/02/12 09:16:39  morsch
+Correction in SelectFlavor()
+
+Revision 1.38  2002/02/12 08:53:21  morsch
+SetNoGammas can be used to inhibit writing of gammas and pi0.
+
+Revision 1.37  2002/02/08 16:50:50  morsch
+Add name and title in constructor.
+
+Revision 1.36  2002/01/31 20:17:55  morsch
+Allow for triggered jets with simplified topology: Exact pT, back-to-back
+
+Revision 1.35  2001/12/13 07:56:25  hristov
+Set pointers to zero in the default constructor
+
+Revision 1.34  2001/12/11 16:55:42  morsch
+Correct initialization for jet phi-range.
+
 Revision 1.33  2001/12/05 10:18:51  morsch
 Possibility of kinematic biasing of jet phi range. (J. Klay)
 
@@ -136,24 +179,28 @@ AliGenerator interface class to HIJING using THijing (test version)
 //
 // andreas.morsch@cern.ch
 
-#include "AliGenHijing.h"
-#include "AliGenHijingEventHeader.h"
-#include "AliRun.h"
-#include "AliPDG.h"
-
 #include <TArrayI.h>
-#include <TParticle.h>
-#include <THijing.h>
 #include <TGraph.h>
+#include <THijing.h>
 #include <TLorentzVector.h>
+#include <TPDGCode.h>
+#include <TParticle.h>
 
+#include "AliGenHijing.h"
+#include "AliGenHijingEventHeader.h"
+#include "AliRun.h"
 
- ClassImp(AliGenHijing)
+
+  ClassImp(AliGenHijing)
 
 AliGenHijing::AliGenHijing()
                  :AliGenMC()
 {
 // Constructor
+    fParticles = 0;
+    fHijing    = 0;
+    fDsigmaDb  = 0;
+    fDnDb      = 0;
 }
 
 AliGenHijing::AliGenHijing(Int_t npart)
@@ -161,6 +208,9 @@ AliGenHijing::AliGenHijing(Int_t npart)
 {
 // Default PbPb collisions at 5. 5 TeV
 //
+    fName = "Hijing";
+    fTitle= "Particle Generator using HIJING";
+
     SetEnergyCMS();
     SetImpactParameterRange();
     SetTarget();
@@ -181,8 +231,13 @@ AliGenHijing::AliGenHijing(Int_t npart)
     fDsigmaDb   =  0;
     fDnDb       =  0;
     fPtMinJet   = -2.5;        
-    fRadiation  =  1;
+    fRadiation  =  3;
     fEventVertex.Set(3);
+//
+    SetSimpleJets();
+    SetNoGammas();
+//
+    fParticles = new TClonesArray("TParticle",10000);    
 //
 // Set random number generator   
     sRandom = fRandom;
@@ -201,6 +256,7 @@ AliGenHijing::~AliGenHijing()
 // Destructor
     if ( fDsigmaDb) delete  fDsigmaDb;  
     if ( fDnDb)     delete  fDnDb;  
+    delete fParticles;
 }
 
 void AliGenHijing::Init()
@@ -217,19 +273,52 @@ void AliGenHijing::Init()
     fHijing=(THijing*) fgMCEvGen;
     fHijing->SetIHPR2(2,  fRadiation);
     fHijing->SetIHPR2(3,  fTrigger);
-    fHijing->SetIHPR2(4,  fQuench);
     fHijing->SetIHPR2(6,  fShadowing);
     fHijing->SetIHPR2(12, fDecaysOff);    
     fHijing->SetIHPR2(21, fKeep);
     fHijing->SetHIPR1(10, fPtMinJet);  
-    fHijing->Initialize();
-
+    fHijing->SetHIPR1(50, fSimpleJet);
+//
+//  Quenching
+//
+//
+//  fQuench = 0:  no quenching
+//  fQuench = 1:  hijing default
+//  fQuench = 2:  new LHC  parameters for HIPR1(11) and HIPR1(14)
+//  fQuench = 3:  new RHIC parameters for HIPR1(11) and HIPR1(14)
+//  fQuench = 4:  new LHC  parameters with log(e) dependence
+//  fQuench = 5:  new RHIC parameters with log(e) dependence
+    fHijing->SetIHPR2(50, 0);
+    if (fQuench > 0) 
+       fHijing->SetIHPR2(4,  1);
+    else
+       fHijing->SetIHPR2(4,  0);
+// New LHC parameters from Xin-Nian Wang
+    if (fQuench == 2) {
+       fHijing->SetHIPR1(14, 1.1);
+       fHijing->SetHIPR1(11, 3.7);
+    } else if (fQuench == 3) {
+       fHijing->SetHIPR1(14, 0.20);
+       fHijing->SetHIPR1(11, 2.5);
+    } else if (fQuench == 4) {
+       fHijing->SetIHPR2(50, 1);
+       fHijing->SetHIPR1(14, 4.*0.34);
+       fHijing->SetHIPR1(11, 3.7);
+    } else if (fQuench == 5) {
+       fHijing->SetIHPR2(50, 1);
+       fHijing->SetHIPR1(14, 0.34);
+       fHijing->SetHIPR1(11, 2.5);
+    }
+    
+    
     
 //
-    if (fEvaluate) EvaluateCrossSections();
+//  Initialize Hijing  
+//    
+    fHijing->Initialize();
 //
+    if (fEvaluate) EvaluateCrossSections();
 //
-//  Initialize random generator
 }
 
 void AliGenHijing::Generate()
@@ -242,7 +331,6 @@ void AliGenHijing::Generate()
   Float_t p[3], random[6];
   Float_t tof;
 
-  static TClonesArray *particles;
 //  converts from mm/c to s
   const Float_t kconv = 0.001/2.999792458e8;
 //
@@ -251,7 +339,7 @@ void AliGenHijing::Generate()
   Int_t j, kf, ks, imo;
   kf = 0;
     
-  if(!particles) particles = new TClonesArray("TParticle",10000);
+
     
   fTrials = 0;
   for (j = 0;j < 3; j++) origin0[j] = fOrigin[j];
@@ -281,134 +369,132 @@ void AliGenHijing::Generate()
 // --------------------------------------------------------------------------
       fHijing->GenerateEvent();
       fTrials++;
+      fHijing->ImportParticles(fParticles,"All");
       if (fTrigger != kNoTrigger) {
          if (!CheckTrigger()) continue;
       }
-
-      fHijing->ImportParticles(particles,"All");
-      if (fLHC) Boost(particles);
+      if (fLHC) Boost();
       
       
-      Int_t np = particles->GetEntriesFast();
+      Int_t np = fParticles->GetEntriesFast();
       printf("\n **************************************************%d\n",np);
       Int_t nc = 0;
       if (np == 0 ) continue;
       Int_t i;
-      Int_t * newPos = new Int_t[np];
+      Int_t* newPos     = new Int_t[np];
+      Int_t* pSelected  = new Int_t[np];
 
-      for (i = 0; i < np; i++) *(newPos+i) = i;
+      for (i = 0; i < np; i++) {
+         newPos[i]    = i;
+         pSelected[i] = 0;
+      }
+      
 //      Get event vertex
 //
-      TParticle *  iparticle = (TParticle *) particles->At(0);
+      TParticle *  iparticle = (TParticle *) fParticles->At(0);
       fEventVertex[0] = origin0[0];
       fEventVertex[1] = origin0[1];    
       fEventVertex[2] = origin0[2];
       
 //
-//      First write parent particles
+//      First select parent particles
 //
 
       for (i = 0; i < np; i++) {
-         iparticle       = (TParticle *) particles->At(i);
+         iparticle = (TParticle *) fParticles->At(i);
+
 // Is this a parent particle ?
          if (Stable(iparticle)) continue;
 //
-        Bool_t  hasMother            =  (iparticle->GetFirstMother()   >=0);
-        Bool_t  selected             =  kTRUE;
-        Bool_t  hasSelectedDaughters =  kFALSE;
+         Bool_t  selected             =  kTRUE;
+         Bool_t  hasSelectedDaughters =  kFALSE;
+         
+         
+         kf        = iparticle->GetPdgCode();
+         ks        = iparticle->GetStatusCode();
+         if (kf == 92) continue;
            
-           
-        kf        = iparticle->GetPdgCode();
-        ks        = iparticle->GetStatusCode();
-        if (kf == 92) continue;
-           
-        if (!fSelectAll) selected = KinematicSelection(iparticle, 0)&&SelectFlavor(kf);
-        hasSelectedDaughters = DaughtersSelection(iparticle, particles);
-//
-// Put particle on the stack if it is either selected or it is the mother of at least one seleted particle
-//
-        if (selected || hasSelectedDaughters) {
-           nc++;
-           p[0] = iparticle->Px();
-           p[1] = iparticle->Py();
-           p[2] = iparticle->Pz();
-           origin[0] = origin0[0]+iparticle->Vx()/10;
-           origin[1] = origin0[1]+iparticle->Vy()/10;
-           origin[2] = origin0[2]+iparticle->Vz()/10;
-           tof = kconv*iparticle->T();
-           imo = -1;
-           TParticle* mother = 0;
-           if (hasMother) {
-               imo = iparticle->GetFirstMother();
-               mother = (TParticle *) particles->At(imo);
-               imo = (mother->GetPdgCode() != 92) ? imo =* (newPos+imo) : -1;
-               
-           }
-// Put particle on the stack ... 
-//             printf("\n set track mother: %d %d %d %d %d %d ",i,imo, kf, nt+1, selected, hasSelectedDaughters);
-           
-           SetTrack(0,imo,kf,p,origin,polar, tof,kPPrimary,nt);
-// ... and keep it there
-           KeepTrack(nt);
+         if (!fSelectAll) selected = KinematicSelection(iparticle, 0) && 
+                              SelectFlavor(kf);
+         hasSelectedDaughters = DaughtersSelection(iparticle);
+//
+// Put particle on the stack if it is either selected or 
+// it is the mother of at least one seleted particle
 //
-           *(newPos+i)=nt;
-        } // selected
+         if (selected || hasSelectedDaughters) {
+             nc++;
+             pSelected[i] = 1;
+         } // selected
       } // particle loop parents
 //
-// Now write the final state particles
+// Now select the final state particles
 //
 
       for (i = 0; i<np; i++) {
-        TParticle *  iparticle       = (TParticle *) particles->At(i);
+         TParticle *  iparticle = (TParticle *) fParticles->At(i);
 // Is this a final state particle ?
-        if (!Stable(iparticle)) continue;
-
-        Bool_t  hasMother            =  (iparticle->GetFirstMother()   >=0);
-        Bool_t  selected             =  kTRUE;
-        kf        = iparticle->GetPdgCode();
-        ks        = iparticle->GetStatusCode();
+         if (!Stable(iparticle)) continue;
+      
+         Bool_t  selected             =  kTRUE;
+         kf        = iparticle->GetPdgCode();
+         ks        = iparticle->GetStatusCode();
+         
 // --------------------------------------------------------------------------
 // Count spectator neutrons and protons
-        if(ks == 0 || ks == 1 || ks == 10 || ks == 11){
-         if(kf == kNeutron) fSpecn += 1;
-         if(kf == kProton)  fSpecp += 1;
-       }
+         if(ks == 0 || ks == 1 || ks == 10 || ks == 11){
+             if(kf == kNeutron) fSpecn += 1;
+             if(kf == kProton)  fSpecp += 1;
+         }
 // --------------------------------------------------------------------------
 //         
-        if (!fSelectAll) {
-           selected = KinematicSelection(iparticle,0)&&SelectFlavor(kf);
-           if (!fSpectators && selected) selected = (ks != 0 && ks != 1 && ks != 10
-                                                     && ks != 11);
-        }
+         if (!fSelectAll) {
+             selected = KinematicSelection(iparticle,0)&&SelectFlavor(kf);
+             if (!fSpectators && selected) selected = (ks != 0 && ks != 1 && ks != 10
+                                                       && ks != 11);
+         }
 //
 // Put particle on the stack if selected
 //
-        if (selected) {
-           nc++;
-           p[0] = iparticle->Px();
-           p[1] = iparticle->Py();
-           p[2] = iparticle->Pz();
-           origin[0] = origin0[0]+iparticle->Vx()/10;
-           origin[1] = origin0[1]+iparticle->Vy()/10;
-           origin[2] = origin0[2]+iparticle->Vz()/10;
-           tof = kconv*iparticle->T();
-           imo = -1;
-           TParticle* mother = 0;
-           if (hasMother) {
-               imo = iparticle->GetFirstMother();
-               mother = (TParticle *) particles->At(imo);
-               imo = (mother->GetPdgCode() != 92) ? imo=*(newPos+imo) : -1;
-           }   
-// Put particle on the stack
-           SetTrack(fTrackIt,imo,kf,p,origin,polar,
-                                                    tof,kPNoProcess,nt);
-           KeepTrack(nt);
-           *(newPos+i)=nt;
-        } // selected
+         if (selected) {
+             nc++;
+             pSelected[i] = 1;
+         } // selected
       } // particle loop final state
+//
+// Write particles to stack
+//
+      for (i = 0; i<np; i++) {
+         TParticle *  iparticle = (TParticle *) fParticles->At(i);
+         Bool_t  hasMother   = (iparticle->GetFirstMother()     >=0);
+         Bool_t  hasDaughter = (iparticle->GetFirstDaughter()   >=0);
+
+         if (pSelected[i]) {
+             kf   = iparticle->GetPdgCode();
+             ks   = iparticle->GetStatusCode();
+             p[0] = iparticle->Px();
+             p[1] = iparticle->Py();
+             p[2] = iparticle->Pz();
+             origin[0] = origin0[0]+iparticle->Vx()/10;
+             origin[1] = origin0[1]+iparticle->Vy()/10;
+             origin[2] = origin0[2]+iparticle->Vz()/10;
+             tof = kconv*iparticle->T();
+             imo = -1;
+             TParticle* mother = 0;
+             if (hasMother) {
+                 imo = iparticle->GetFirstMother();
+                 mother = (TParticle *) fParticles->At(imo);
+                 imo = (mother->GetPdgCode() != 92) ? imo = newPos[imo] : -1;
+             } // if has mother   
+             Bool_t tFlag = (fTrackIt && !hasDaughter);
+             SetTrack(tFlag,imo,kf,p,origin,polar,
+                      tof,kPNoProcess,nt, 1., ks);
+             KeepTrack(nt);
+             newPos[i] = nt;
+         } // if selected
+      } // particle loop
       delete[] newPos;
-
+      delete[] pSelected;
+      
       printf("\n I've put %i particles on the stack \n",nc);
       if (nc > 0) {
          jev += nc;
@@ -420,7 +506,6 @@ void AliGenHijing::Generate()
       }
   } // event loop
   MakeHeader();
-  
   SetHighWaterMark(nt);
 }
 
@@ -493,7 +578,7 @@ void AliGenHijing::EvaluateCrossSections()
     fDnDb      = new TGraph(i, b, si2);
 }
 
-Bool_t AliGenHijing::DaughtersSelection(TParticle* iparticle, TClonesArray* particles)
+Bool_t AliGenHijing::DaughtersSelection(TParticle* iparticle)
 {
 //
 // Looks recursively if one of the daughters has been selected
@@ -508,12 +593,12 @@ Bool_t AliGenHijing::DaughtersSelection(TParticle* iparticle, TClonesArray* part
        imin = iparticle->GetFirstDaughter();
        imax = iparticle->GetLastDaughter();       
        for (i = imin; i <= imax; i++){
-           TParticle *  jparticle = (TParticle *) particles->At(i);    
+           TParticle *  jparticle = (TParticle *) fParticles->At(i);   
            Int_t ip = jparticle->GetPdgCode();
            if (KinematicSelection(jparticle,0)&&SelectFlavor(ip)) {
                selected=kTRUE; break;
            }
-           if (DaughtersSelection(jparticle, particles)) {selected=kTRUE; break; }
+           if (DaughtersSelection(jparticle)) {selected=kTRUE; break; }
        }
     } else {
        return kFALSE;
@@ -528,17 +613,28 @@ Bool_t AliGenHijing::SelectFlavor(Int_t pid)
 // 0: all
 // 4: charm and beauty
 // 5: beauty
-    if (fFlavor == 0) return kTRUE;
+    Bool_t res = 0;
     
-    Int_t ifl = TMath::Abs(pid/100);
-    if (ifl > 10) ifl/=10;
-    return (fFlavor == ifl);
+    if (fFlavor == 0) {
+       res = kTRUE;
+    } else {
+       Int_t ifl = TMath::Abs(pid/100);
+       if (ifl > 10) ifl/=10;
+       res = (fFlavor == ifl);
+    }
+//
+//  This part if gamma writing is inhibited
+    if (fNoGammas) 
+       res = res && (pid != kGamma && pid != kPi0);
+//
+    return res;
 }
 
 Bool_t AliGenHijing::Stable(TParticle*  particle)
 {
 // Return true for a stable particle
 //
+    
     if (particle->GetFirstDaughter() < 0 )
     {
        return kTRUE;
@@ -548,7 +644,7 @@ Bool_t AliGenHijing::Stable(TParticle*  particle)
 }
 
 
-void AliGenHijing::Boost(TClonesArray* particles)
+void AliGenHijing::Boost()
 {
 //
 // Boost cms into LHC lab frame
@@ -562,10 +658,10 @@ void AliGenHijing::Boost(TClonesArray* particles)
     printf("\n Boosting particles to lab frame %f %f %f", dy, beta, gamma);
     
     Int_t i;
-    Int_t np = particles->GetEntriesFast();
+    Int_t np = fParticles->GetEntriesFast();
     for (i = 0; i < np; i++) 
     {
-       TParticle* iparticle = (TParticle*) particles->At(i);
+       TParticle* iparticle = (TParticle*) fParticles->At(i);
 
        Double_t e   = iparticle->Energy();
        Double_t px  = iparticle->Px();
@@ -622,41 +718,70 @@ void AliGenHijing::MakeHeader()
     ((AliGenHijingEventHeader*) header)->SetTrials(fTrials);
 // Event Vertex
     header->SetPrimaryVertex(fEventVertex);
-    gAlice->SetGenEventHeader(header);    
+    gAlice->SetGenEventHeader(header);   
+    fCollisionGeometry = (AliGenHijingEventHeader*)  header;
 }
 
 Bool_t AliGenHijing::CheckTrigger()
 {
 // Check the kinematic trigger condition
-// 
-    TLorentzVector* jet1 = new TLorentzVector(fHijing->GetHINT1(26), 
-                                             fHijing->GetHINT1(27),
-                                             fHijing->GetHINT1(28),
-                                             fHijing->GetHINT1(29));
-
-    TLorentzVector* jet2 = new TLorentzVector(fHijing->GetHINT1(36), 
-                                             fHijing->GetHINT1(37),
-                                             fHijing->GetHINT1(38),
-                                             fHijing->GetHINT1(39));
-    Double_t eta1      = jet1->Eta();
-    Double_t eta2      = jet2->Eta();
-    Double_t phi1      = jet1->Phi();
-    Double_t phi2      = jet2->Phi();
+//
     Bool_t   triggered = kFALSE;
-    //Check eta range first...    
-    if ((eta1 < fEtaMaxJet && eta1 > fEtaMinJet) ||
-       (eta2 < fEtaMaxJet && eta2 > fEtaMinJet))
-    {
-       //Eta is okay, now check phi range
-        if ((phi1 < fPhiMaxJet && phi1 > fPhiMinJet) ||
-            (phi2 < fPhiMaxJet && phi2 > fPhiMinJet))
-        {
+    if (fTrigger == 1) {
+//
+//  jet-jet Trigger    
+       
+       TLorentzVector* jet1 = new TLorentzVector(fHijing->GetHINT1(26), 
+                                                 fHijing->GetHINT1(27),
+                                                 fHijing->GetHINT1(28),
+                                                 fHijing->GetHINT1(29));
+       
+       TLorentzVector* jet2 = new TLorentzVector(fHijing->GetHINT1(36), 
+                                                 fHijing->GetHINT1(37),
+                                                 fHijing->GetHINT1(38),
+                                                 fHijing->GetHINT1(39));
+       Double_t eta1      = jet1->Eta();
+       Double_t eta2      = jet2->Eta();
+       Double_t phi1      = jet1->Phi();
+       Double_t phi2      = jet2->Phi();
+//    printf("\n Trigger: %f %f %f %f",
+//        fEtaMinJet, fEtaMaxJet, fPhiMinJet, fPhiMaxJet);
+       if (
+           (eta1 < fEtaMaxJet && eta1 > fEtaMinJet &&  
+            phi1 < fPhiMaxJet && phi1 > fPhiMinJet) 
+           ||
+           (eta2 < fEtaMaxJet && eta2 > fEtaMinJet &&  
+            phi2 < fPhiMaxJet && phi2 > fPhiMinJet)
+           ) 
            triggered = kTRUE;
-        }
-    }
+    } else if (fTrigger == 2) {
+//  Gamma Jet
+//
+       Int_t np = fParticles->GetEntriesFast();
+       for (Int_t i = 0; i < np; i++) {
+           TParticle* part = (TParticle*) fParticles->At(i);
+           Int_t kf = part->GetPdgCode();
+           Int_t ks = part->GetStatusCode();
+           if (kf == 22 && ks == 40) {
+               Float_t phi = part->Phi();
+               Float_t eta = part->Eta();
+               if  (eta < fEtaMaxJet && 
+                    eta > fEtaMinJet &&
+                    phi < fPhiMaxJet && 
+                    phi > fPhiMinJet) {
+                   triggered = 1;
+                   break;
+               } // check phi,eta within limits
+           } // direct gamma ? 
+       } // particle loop
+    } // fTrigger == 2
     return triggered;
 }
 
+
+
+
 AliGenHijing& AliGenHijing::operator=(const  AliGenHijing& rhs)
 {
 // Assignment operator