1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
20 /// \brief Configuration macro for generation of kinematics tree which
21 /// can be then used as an external event generator.
23 /// According to: $ALICE_ROOT/test/genkine/gen/fastGen.C
25 #if !defined(__CINT__) || defined(__MAKECINT__)
26 #include <Riostream.h>
28 #include <TStopwatch.h>
31 #include <TDatabasePDG.h>
32 #include <TParticle.h>
35 #include "AliGenerator.h"
37 #include "AliRunLoader.h"
40 #include "AliHeader.h"
41 #include "PYTHIA6/AliGenPythia.h"
42 #include "PYTHIA6/AliPythia.h"
45 void gen(Int_t nev = 1,
46 const char* genConfig = "$ALICE_ROOT/MUON/genTestConfig.C")
49 // gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT");
50 gSystem->Load("liblhapdf.so"); // Parton density functions
51 gSystem->Load("libEGPythia6.so"); // TGenerator interface
52 gSystem->Load("libpythia6.so"); // Pythia
53 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
55 AliPDG::AddParticlesToPdgDataBase();
56 TDatabasePDG::Instance();
59 AliRunLoader* rl = AliRunLoader::Open("galice.root","FASTRUN","recreate");
61 rl->SetCompressionLevel(2);
62 rl->SetNumberOfEventsPerFile(nev);
63 rl->LoadKinematics("RECREATE");
65 gAlice->SetRunLoader(rl);
69 AliStack* stack = rl->Stack();
72 AliHeader* header = rl->GetHeader();
74 // Create and Initialize Generator
75 gROOT->LoadMacro(genConfig);
76 AliGenerator* gener = genConfig();
81 // Forbid some decays. Do it after gener->Init(0, because
82 // the initialization of the generator includes reading of the decay table.
91 for (Int_t iev = 0; iev < nev; iev++) {
93 cout <<"Event number "<< iev << endl;
97 rl->SetEventNumber(iev);
103 stack->ConnectTree(rl->TreeK());
105 cout << "Number of particles " << stack->GetNprimary() << endl;
108 header->SetNprimary(stack->GetNprimary());
109 header->SetNtrack(stack->GetNtrack());
112 stack->FinishEvent();
113 header->SetStack(stack);
115 rl->WriteKinematics("OVERWRITE");
125 rl->WriteHeader("OVERWRITE");