Example macro.
authormorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 Apr 2008 09:58:26 +0000 (09:58 +0000)
committermorsch <morsch@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 9 Apr 2008 09:58:26 +0000 (09:58 +0000)
PYTHIA8/pythia8.C [new file with mode: 0644]

diff --git a/PYTHIA8/pythia8.C b/PYTHIA8/pythia8.C
new file mode 100644 (file)
index 0000000..2461bbc
--- /dev/null
@@ -0,0 +1,116 @@
+AliGenerator*  CreateGenerator();
+
+void pythia8(Int_t nev = 1, char* filename = "galice.root")
+{
+//  Runloader
+    gSystem->Load("liblhapdf.so");    
+    gSystem->Load("libEGPythia6.so"); 
+    gSystem->Load("libpythia6.so");   
+    gSystem->Load("libAliPythia6.so");
+    gSystem->Load("libpythia8.so");   
+    gSystem->Load("libEGPythia8.so"); 
+    gSystem->Load("libAliPythia8.so");
+    
+    AliRunLoader* rl = AliRunLoader::Open("galice.root","FASTRUN","recreate");
+    
+    rl->SetCompressionLevel(2);
+    rl->SetNumberOfEventsPerFile(nev);
+    rl->LoadKinematics("RECREATE");
+    rl->MakeTree("E");
+    gAlice->SetRunLoader(rl);
+
+//  Create stack
+    rl->MakeStack();
+    AliStack* stack      = rl->Stack();
+//  Header
+    AliHeader* header = rl->GetHeader();
+//
+//  Create and Initialize Generator
+    AliGenerator *gener = CreateGenerator();
+    gener->Init();
+    
+//    gener->Init()>   Float_t myQhat=50.0;
+//    Float_t myk=myQhat*0.6e6/1.7;
+//    AliPythia::Instance()->InitQuenching(0,0.1,myk,0);
+
+    gener->SetStack(stack);
+    
+//
+//                        Event Loop
+//
+    Int_t iev;
+     
+    for (iev = 0; iev < nev; iev++) {
+
+       printf("\n \n Event number %d \n \n", iev);
+       
+//  Initialize event
+       header->Reset(0,iev);
+       rl->SetEventNumber(iev);
+       stack->Reset();
+       rl->MakeTree("K");
+//     stack->ConnectTree();
+    
+//  Generate event
+       gener->Generate();
+//  Analysis
+       Int_t npart = stack->GetNprimary();
+       printf("Analyse %d Particles\n", npart);
+       for (Int_t part=0; part<npart; part++) {
+           TParticle *MPart = stack->Particle(part);
+           Int_t mpart  = MPart->GetPdgCode();
+//         printf("Particle %d\n", mpart);
+       }
+       
+//  Finish event
+       header->SetNprimary(stack->GetNprimary());
+       header->SetNtrack(stack->GetNtrack());  
+//      I/O
+//     
+       stack->FinishEvent();
+       header->SetStack(stack);
+       rl->TreeE()->Fill();
+       rl->WriteKinematics("OVERWRITE");
+
+    } // event loop
+//
+//                         Termination
+//  Generator
+    gener->FinishRun();
+//  Write file
+    rl->WriteHeader("OVERWRITE");
+    gener->Write();
+    rl->Write();
+    
+}
+
+
+AliGenerator*  CreateGenerator()
+{
+    AliGenPythiaPlus* gener = new AliGenPythiaPlus(AliPythia8::Instance());
+//
+//
+//   vertex position and smearing 
+    gener->SetVertexSmear(kPerEvent);
+//   structure function
+//    gener->SetStrucFunc(kGRVHO);
+//   charm, beauty, charm_unforced, beauty_unforced, jpsi, jpsi_chi, mb
+    gener->SetProcess(kPyMb);
+//   Centre of mass energy 
+    gener->SetEnergyCMS(14000.);
+//   Pt transfer of the hard scattering
+//    gener->SetPtHard(50.,50.2);
+//    gener->SetQuench(1);
+    
+//   Initialize generator    
+    return gener;
+}
+
+
+
+
+
+
+
+