]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/g4ConfigCommon2.C
added TOFheader writing in AOD
[u/mrichter/AliRoot.git] / macros / g4ConfigCommon2.C
1 // $Id: g4ConfigCommon.C 30849 2009-02-01 11:42:22Z fca $
2 //
3 // AliRoot Configuration for running aliroot with Monte Carlo.
4 // ConfigCommon2() includes the common setting for all MCs
5 // which has to be called after MC is instantiated.
6 // Called from g4Config.C
7 //
8 // By I. Hrivnacova, IPN Orsay
9
10 // Functions
11 Float_t EtaToTheta(Float_t arg);
12 AliGenerator* GeneratorFactory();
13
14 void ConfigCommon2()
15 {
16   cout << "Running ConfigCommon2.C ... " << endl;
17
18   //=======================================================================
19   // Steering parameters for ALICE simulation
20   //=======================================================================
21
22   gMC->SetProcess("DCAY",1);
23   gMC->SetProcess("PAIR",1);
24   gMC->SetProcess("COMP",1);
25   gMC->SetProcess("PHOT",1);
26   gMC->SetProcess("PFIS",0);
27   gMC->SetProcess("DRAY",0);
28   gMC->SetProcess("ANNI",1);
29   gMC->SetProcess("BREM",1);
30   gMC->SetProcess("MUNU",1);
31   gMC->SetProcess("CKOV",1);
32   gMC->SetProcess("HADR",1);
33   gMC->SetProcess("LOSS",2);
34   gMC->SetProcess("MULS",1);
35   //gMC->SetProcess("RAYL",1);
36
37   Float_t cut = 1.e-3;        // 1MeV cut by default
38   Float_t tofmax = 1.e10;
39
40   gMC->SetCut("CUTGAM", cut);
41   gMC->SetCut("CUTELE", cut);
42   gMC->SetCut("CUTNEU", cut);
43   gMC->SetCut("CUTHAD", cut);
44   gMC->SetCut("CUTMUO", cut);
45   gMC->SetCut("BCUTE",  cut); 
46   gMC->SetCut("BCUTM",  cut); 
47   gMC->SetCut("DCUTE",  cut); 
48   gMC->SetCut("DCUTM",  cut); 
49   gMC->SetCut("PPCUTM", cut);
50   gMC->SetCut("TOFMAX", tofmax); 
51
52   //=======================================================================
53   // External decayer
54   //=======================================================================
55
56   TVirtualMCDecayer *decayer = new AliDecayerPythia();
57   decayer->SetForceDecay(kAll);
58   decayer->Init();
59
60   //forbid some decays
61   AliPythia * py= AliPythia::Instance();
62   py->SetMDME(737,1,0); //forbid D*+->D+ + pi0
63   py->SetMDME(738,1,0);//forbid D*+->D+ + gamma
64
65   for(Int_t d=747; d<=762; d++){ 
66     py->SetMDME(d,1,0);
67   }
68
69   for(Int_t d=764; d<=807; d++){ 
70     py->SetMDME(d,1,0);
71   }
72
73   gMC->SetExternalDecayer(decayer);
74   
75   //=======================================================================
76   // Event generator
77   //=======================================================================
78
79   // Set Random Number seed
80   gRandom->SetSeed(123456); // Set 0 to use the currecnt time
81   AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
82
83   int nParticles = 100;
84   if (gSystem->Getenv("CONFIG_NPARTICLES")) {
85     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
86   }
87
88   AliGenCocktail *gener = new AliGenCocktail();
89   gener->SetPhiRange(0, 360);
90   // Set pseudorapidity range from -8 to 8.
91   Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
92   Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
93   gener->SetThetaRange(thmin,thmax);
94   gener->SetOrigin(0, 0, 0);  //vertex position
95   gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
96
97   AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
98   hijingparam->SetMomentumRange(0.2, 999);
99   gener->AddGenerator(hijingparam,"HIJING PARAM",1);
100   gener->Init();
101
102   // Activate this line if you want the vertex smearing to happen
103   // track by track
104   //
105   //gener->SetVertexSmear(perTrack); 
106
107 /*
108   // External generator configuration
109   AliGenerator* gener = GeneratorFactory();
110   gener->SetOrigin(0, 0, 0);    // vertex position
111   gener->SetSigma(0, 0, 5.3);   // Sigma in (X,Y,Z) (cm) on IP position
112   gener->SetCutVertexZ(1.);     // Truncate at 1 sigma
113   gener->SetVertexSmear(kPerEvent); 
114   gener->SetTrackingFlag(1);
115   gener->Init();
116 */    
117   cout << "Running ConfigCommon2.C finished ... " << endl;
118 }
119
120 Float_t EtaToTheta(Float_t arg){
121   return (180./TMath::Pi())*2.*atan(exp(-arg));
122 }
123
124 AliGenerator* GeneratorFactory() {
125
126   AliGenExtFile *gener = new AliGenExtFile(-1);
127   AliGenReaderTreeK * reader = new AliGenReaderTreeK();
128
129   reader->SetFileName("galice.root");
130   reader->AddDir("gen");
131   gener->SetReader(reader);
132      
133   return gener; 
134 }
135