]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/FLOW/Documentation/examples/runGlauberMC.C
Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / PWGCF / FLOW / Documentation / examples / runGlauberMC.C
1 void runGlauberMC(Bool_t doPartProd=0,Int_t option=0,Int_t N=250000)
2 {
3   //load libraries
4   gSystem->Load("libVMC");
5   gSystem->Load("libPhysics");
6   gSystem->Load("libTree");
7   gSystem->Load("libPWGGlauber");
8
9   //set the random seed from current time
10   TTimeStamp time;
11   Int_t seed = time.GetSec();
12   gRandom->SetSeed(seed);
13
14   Int_t nevents = N; // number of events to simulate 
15   // supported systems are e.g. "p", "d", "Si", "Au", "Pb", "U" 
16   Option_t *sysA="Pb"; 
17   Option_t *sysB="Pb";
18   Double_t signn=64; // inelastic nucleon nucleon cross section
19   //const char *fname="GlauberMC_PbPb_ntuple.root"; // name output file
20
21   // run the code to produce an ntuple:
22   //  AliGlauberMC::runAndSaveNucleons(10000,"Pb","Pb",72);
23   Double_t mind=0.4;
24   //  AliGlauberMC::RunAndSaveNtuple(nevents,sysA,sysB,signn,mind);
25   Double_t r=6.62;
26   Double_t a=0.546;
27   const char *fname="glau_pbpb_ntuple.root";
28
29   AliGlauberMC mcg(sysA,sysB,signn);
30   mcg.SetMinDistance(mind);
31   mcg.Setr(r);
32   mcg.Seta(a);
33   if (option==1) 
34     mcg.SetDoFluc(0.55,78.5*0.92,0.82,kTRUE);
35   else if (option==2) 
36     mcg.SetDoFluc(1.01,72.5*0.92,0.74,kTRUE);
37   mcg.SetDoPartProduction(doPartProd);
38   
39   //////////////////
40   mcg.SetdNdEtaType(AliGlauberMC::kNBDSV);
41   mcg.GetdNdEtaParam()[0] = 2.49;    //npp
42   mcg.GetdNdEtaParam()[1] = 1.7;  //ratioSgm2Mu
43   mcg.GetdNdEtaParam()[2] = 0.13; //xhard
44   //////////////////
45
46   mcg.Run(nevents);
47
48   TNtuple  *nt = mcg.GetNtuple();
49   TFile out(fname,"recreate",fname,9);
50   if(nt) nt->Write();
51   printf("total cross section with a nucleon-nucleon cross section %.4f is %.4f\n\n",signn,mcg.GetTotXSect());
52   out.Close();
53 }