ROOT logo
// Example: generation of kinematics tree with selected properties.
// Below we select events containing the decays D* -> D0 pi, D0 -> K- pi+
// inside the barrel part of the ALICE detector (45 < theta < 135)

#if !defined(__CINT__) || defined(__MAKECINT__)
#include <Riostream.h>
#include <TH1F.h>
#include <TStopwatch.h>
#include <TDatime.h>
#include <TRandom.h>
#include <TDatabasePDG.h>
#include <TParticle.h>
#include <TArrayI.h>
#include <TTree.h>
#include <TPDGCode.h>
#include "AliGenerator.h"
#include "AliPDG.h"
#include "AliRunLoader.h"
#include "AliDecayer.h"
#include "AliDecayerPythia.h"
#include "AliRun.h"
#include "AliStack.h"
#include "AliHeader.h"
#include "AliGenAmpt.h"
#endif

void fastGenAmpt(Int_t nev = 100, const char* filename = "galice.root")
{
  AliPDG::AddParticlesToPdgDataBase();
  TDatabasePDG::Instance();

  // Run loader
  AliRunLoader* rl = AliRunLoader::Open(filename,"FASTRUN","recreate");
  rl->SetCompressionLevel(2);
  rl->SetNumberOfEventsPerFile(nev);
  rl->LoadKinematics("RECREATE");
  rl->MakeTree("E");
  rl->SetNumberOfEventsPerRun(nev);
  gAlice->SetRunLoader(rl);
  
  // Create stack
  rl->MakeStack();
  AliStack* stack = rl->Stack();
  
  // Header
  AliHeader* header = rl->GetHeader();
  
  AliGenAmpt *genHi = new AliGenAmpt(-1);
//=============================================================================
// THE DECAYER
  AliDecayer *decayer = new AliDecayerPythia();
  cout << "*****************************************" << endl;
  genHi->SetForceDecay( kHadronicD );
  genHi->SetDecayer( decayer );
//=============================================================================
  genHi->SetEnergyCMS(2760);
  genHi->SetReferenceFrame("CMS");
  genHi->SetProjectile("A", 208, 82);
  genHi->SetTarget    ("A", 208, 82);
  genHi->SetIsoft(4); //1: defaul - 4: string melting
  genHi->SetPtHardMin (3);
  //genHi->SetImpactParameterRange(9.,9.5);
  genHi->SetImpactParameterRange(0.,20.0);
  genHi->SetNtMax(150); //NTMAX: number of timesteps (D=150)
  genHi->SetXmu(3.2264); //parton screening mass in fm^(-1) (D=3.2264d0)
  genHi->SetJetQuenching(0); // enable jet quenching
  genHi->SetShadowing(1);    // enable shadowing
  genHi->SetDecaysOff(1);    // neutral pion and heavy particle decays switched off
  genHi->SetSpectators(0);   // track spectators 
  genHi->Init();

  rl->CdGAFile();

  TStopwatch timer;
  timer.Start();
  for (Int_t iev = 0; iev < nev; iev++) {
    cout <<"Event number "<< iev << endl;
    //  Initialize event
    header->Reset(0,iev);
    rl->SetEventNumber(iev);
    stack->Reset();
    rl->MakeTree("K");
    Int_t nprim = 0;
    Int_t ntrial = 0;
    Int_t ndstar = 0;
    stack->Reset();
    stack->ConnectTree(rl->TreeK());
    genHi->Generate();
    ntrial++;
    nprim = stack->GetNprimary();
    cout << "Number of particles " << nprim << endl;
    cout << "Number of trials " << ntrial << endl;
    header->SetNprimary(stack->GetNprimary());
    header->SetNtrack(stack->GetNtrack());  
    stack->FinishEvent();
    header->SetStack(stack);
    rl->TreeE()->Fill();
    rl->WriteKinematics("OVERWRITE");
  } // event loop
  timer.Stop();
  timer.Print();
  genHi->FinishRun();
  rl->WriteHeader("OVERWRITE");
  genHi->Write();
  rl->Write();
}
 fastGenAmpt.C:1
 fastGenAmpt.C:2
 fastGenAmpt.C:3
 fastGenAmpt.C:4
 fastGenAmpt.C:5
 fastGenAmpt.C:6
 fastGenAmpt.C:7
 fastGenAmpt.C:8
 fastGenAmpt.C:9
 fastGenAmpt.C:10
 fastGenAmpt.C:11
 fastGenAmpt.C:12
 fastGenAmpt.C:13
 fastGenAmpt.C:14
 fastGenAmpt.C:15
 fastGenAmpt.C:16
 fastGenAmpt.C:17
 fastGenAmpt.C:18
 fastGenAmpt.C:19
 fastGenAmpt.C:20
 fastGenAmpt.C:21
 fastGenAmpt.C:22
 fastGenAmpt.C:23
 fastGenAmpt.C:24
 fastGenAmpt.C:25
 fastGenAmpt.C:26
 fastGenAmpt.C:27
 fastGenAmpt.C:28
 fastGenAmpt.C:29
 fastGenAmpt.C:30
 fastGenAmpt.C:31
 fastGenAmpt.C:32
 fastGenAmpt.C:33
 fastGenAmpt.C:34
 fastGenAmpt.C:35
 fastGenAmpt.C:36
 fastGenAmpt.C:37
 fastGenAmpt.C:38
 fastGenAmpt.C:39
 fastGenAmpt.C:40
 fastGenAmpt.C:41
 fastGenAmpt.C:42
 fastGenAmpt.C:43
 fastGenAmpt.C:44
 fastGenAmpt.C:45
 fastGenAmpt.C:46
 fastGenAmpt.C:47
 fastGenAmpt.C:48
 fastGenAmpt.C:49
 fastGenAmpt.C:50
 fastGenAmpt.C:51
 fastGenAmpt.C:52
 fastGenAmpt.C:53
 fastGenAmpt.C:54
 fastGenAmpt.C:55
 fastGenAmpt.C:56
 fastGenAmpt.C:57
 fastGenAmpt.C:58
 fastGenAmpt.C:59
 fastGenAmpt.C:60
 fastGenAmpt.C:61
 fastGenAmpt.C:62
 fastGenAmpt.C:63
 fastGenAmpt.C:64
 fastGenAmpt.C:65
 fastGenAmpt.C:66
 fastGenAmpt.C:67
 fastGenAmpt.C:68
 fastGenAmpt.C:69
 fastGenAmpt.C:70
 fastGenAmpt.C:71
 fastGenAmpt.C:72
 fastGenAmpt.C:73
 fastGenAmpt.C:74
 fastGenAmpt.C:75
 fastGenAmpt.C:76
 fastGenAmpt.C:77
 fastGenAmpt.C:78
 fastGenAmpt.C:79
 fastGenAmpt.C:80
 fastGenAmpt.C:81
 fastGenAmpt.C:82
 fastGenAmpt.C:83
 fastGenAmpt.C:84
 fastGenAmpt.C:85
 fastGenAmpt.C:86
 fastGenAmpt.C:87
 fastGenAmpt.C:88
 fastGenAmpt.C:89
 fastGenAmpt.C:90
 fastGenAmpt.C:91
 fastGenAmpt.C:92
 fastGenAmpt.C:93
 fastGenAmpt.C:94
 fastGenAmpt.C:95
 fastGenAmpt.C:96
 fastGenAmpt.C:97
 fastGenAmpt.C:98
 fastGenAmpt.C:99
 fastGenAmpt.C:100
 fastGenAmpt.C:101
 fastGenAmpt.C:102
 fastGenAmpt.C:103
 fastGenAmpt.C:104
 fastGenAmpt.C:105
 fastGenAmpt.C:106
 fastGenAmpt.C:107