]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/ConfigBeautyPPR.C
Pythia libraries have to be loaded now.
[u/mrichter/AliRoot.git] / macros / ConfigBeautyPPR.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <Riostream.h>
3 #include <TRandom.h>
4 #include <TDatime.h>
5 #include <TSystem.h>
6 #include <TVirtualMC.h>
7 #include <TGeant3.h>
8 #include "STEER/AliRunLoader.h"
9 #include "STEER/AliRun.h"
10 #include "STEER/AliConfig.h"
11 #include "PYTHIA6/AliDecayerPythia.h"
12 #include "PYTHIA6/AliGenPythia.h"
13 #include "STEER/AliMagFCM.h"
14 #include "STRUCT/AliBODY.h"
15 #include "STRUCT/AliMAG.h"
16 #include "STRUCT/AliABSOv3.h"
17 #include "STRUCT/AliDIPOv3.h"
18 #include "STRUCT/AliHALLv3.h"
19 #include "STRUCT/AliFRAMEv2.h"
20 #include "STRUCT/AliSHILv3.h"
21 #include "STRUCT/AliPIPEv3.h"
22 #include "ITS/AliITSvPPRasymm.h"
23 #include "TPC/AliTPCv2.h"
24 #include "TOF/AliTOFv6T0.h"
25 #include "HMPID/AliHMPIDv2.h"
26 #include "ZDC/AliZDCv3.h"
27 #include "TRD/AliTRDv1.h"
28 #include "FMD/AliFMDv0.h"
29 #include "MUON/AliMUONv1.h"
30 #include "PHOS/AliPHOSv1.h"
31 #include "PMD/AliPMDv1.h"
32 #include "T0/AliT0v1.h"
33 #include "ACORDE/AliACORDEv1.h"
34 #endif
35
36 enum PprGeo_t
37   {
38     kHoles, kNoHoles
39   };
40 static PprGeo_t geo = kHoles;
41 void LoadPythia();
42
43 void Config()
44 {
45  
46   //
47   // Set Random Number seed
48   TDatime dt;
49   UInt_t curtime=dt.Get();
50   UInt_t procid=gSystem->GetPid();
51   UInt_t seed=curtime-procid;
52
53   //  gRandom->SetSeed(seed);
54   gRandom->SetSeed(12345);
55   cerr<<"Seed for random number generation= "<<seed<<endl; 
56   // Load Pythia libraries
57   LoadPythia();
58   // libraries required by geant321
59 #if defined(__CINT__)
60   gSystem->Load("libgeant321");
61 #endif
62
63   new TGeant3TGeo("C++ Interface to Geant3");
64
65   //=======================================================================
66   //  Create the output file
67    
68   if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
69     AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
70     AliCDBManager::Instance()->SetRun(0);
71   }
72   
73   AliRunLoader* rl=0x0;
74
75   cout<<"Config.C: Creating Run Loader ..."<<endl;
76   rl = AliRunLoader::Open("galice.root",
77                           AliConfig::GetDefaultEventFolderName(),
78                           "recreate");
79   if (rl == 0x0)
80     {
81       gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
82       return;
83     }
84   rl->SetCompressionLevel(2);
85   rl->SetNumberOfEventsPerFile(3);
86   gAlice->SetRunLoader(rl);
87   // gAlice->SetGeometryFromFile("geometry.root");
88   // gAlice->SetGeometryFromCDB();
89
90   // Set the trigger configuration
91   gAlice->SetTriggerDescriptor("Pb-Pb");
92   cout<<"Trigger configuration is set to  Pb-Pb"<<endl;
93
94   //
95   // Set External decayer
96   AliDecayer* decayer = new AliDecayerPythia();
97   decayer->SetForceDecay(kAll);
98   decayer->Init();
99   gMC->SetExternalDecayer(decayer);
100
101
102   //
103   //=======================================================================
104   // ************* STEERING parameters FOR ALICE SIMULATION **************
105   // --- Specify event type to be tracked through the ALICE setup
106   // --- All positions are in cm, angles in degrees, and P and E in GeV
107
108     gMC->SetProcess("DCAY",1);
109     gMC->SetProcess("PAIR",1);
110     gMC->SetProcess("COMP",1);
111     gMC->SetProcess("PHOT",1);
112     gMC->SetProcess("PFIS",0);
113     gMC->SetProcess("DRAY",0);
114     gMC->SetProcess("ANNI",1);
115     gMC->SetProcess("BREM",1);
116     gMC->SetProcess("MUNU",1);
117     gMC->SetProcess("CKOV",1);
118     gMC->SetProcess("HADR",1);
119     gMC->SetProcess("LOSS",2);
120     gMC->SetProcess("MULS",1);
121     gMC->SetProcess("RAYL",1);
122
123     Float_t cut = 1.e-3;        // 1MeV cut by default
124     Float_t tofmax = 1.e10;
125
126     gMC->SetCut("CUTGAM", cut);
127     gMC->SetCut("CUTELE", cut);
128     gMC->SetCut("CUTNEU", cut);
129     gMC->SetCut("CUTHAD", cut);
130     gMC->SetCut("CUTMUO", cut);
131     gMC->SetCut("BCUTE",  cut); 
132     gMC->SetCut("BCUTM",  cut); 
133     gMC->SetCut("DCUTE",  cut); 
134     gMC->SetCut("DCUTM",  cut); 
135     gMC->SetCut("PPCUTM", cut);
136     gMC->SetCut("TOFMAX", tofmax); 
137
138
139   // AliGenPythia *gener = new AliGenPythia(ntracks);
140   AliGenPythia *gener = new AliGenPythia(-1);
141
142   gener->SetMomentumRange(0,999);
143   gener->SetPhiRange(0.,360.);
144   gener->SetThetaRange(0,180);
145   gener->SetYRange(-999,999);
146   //gener->SetPtRange(0,100);
147   gener->SetOrigin(0,0,0);          // vertex position
148   //gener->SetVertexSmear(kPerEvent); 
149   gener->SetSigma(0,0,5.3);  // Sigma in (X,Y,Z) (cm) on IP position
150   gener->SetTrackingFlag(0);
151   // gener->SetForceDecay(kHadronicD);
152
153   //
154   // The following settings select the Pythia parameters tuned to agree
155   // with beauty NLO calculation for Pb-Pb @ 5.5 TeV with MNR code.
156   //
157   gener->SetProcess(kPyBeautyPbPbMNR);
158   gener->SetStrucFunc(kCTEQ4L);
159   gener->SetPtHard(2.75,-1.0);
160   gener->SetEnergyCMS(5500.);
161   gener->SetNuclei(208,208); // Pb-Pb collisions
162   // Force no decay heavy quark mesons
163   gener->SetForceDecay(kNoDecayHeavy);
164
165   gener->Init();
166   // 
167   // Activate this line if you want the vertex smearing to happen
168   // track by track
169   //
170   //gener->SetVertexSmear(perTrack); 
171
172   // Field (L3 0.4 T)
173   AliMagFCM* field = new AliMagFCM(
174               "Map2","$(ALICE_ROOT)/data/field01.dat", 2, 1., 10.);
175   field->SetSolenoidField(4.);
176   gAlice->SetField(field);    
177
178   Int_t iABSO=0;
179   Int_t iACORDE=0;
180   Int_t iDIPO=0;
181   Int_t iFMD=0;
182   Int_t iFRAME=0;
183   Int_t iHALL=0;
184   Int_t iITS=0;
185   Int_t iMAG=0;
186   Int_t iMUON=0;
187   Int_t iPHOS=0;
188   Int_t iPIPE=0;
189   Int_t iPMD=0;
190   Int_t iHMPID=0;
191   Int_t iSHIL=0;
192   Int_t iT0=0;
193   Int_t iTOF=0;
194   Int_t iTPC=0;
195   Int_t iTRD=0;
196   Int_t iZDC=0;
197
198   //=================== Alice BODY parameters =============================
199   AliBODY *BODY = new AliBODY("BODY","Alice envelop");
200
201   if(iMAG) {
202     //=================== MAG parameters ============================
203     // --- Start with Magnet since detector layouts may be depending ---
204     // --- on the selected Magnet dimensions ---
205     AliMAG *MAG  = new AliMAG("MAG","Magnet");
206   }
207
208
209   if(iABSO) {
210     //=================== ABSO parameters ============================
211     AliABSO *ABSO  = new AliABSOv3("ABSO","Muon Absorber");
212   }
213
214   if(iDIPO) {
215     //=================== DIPO parameters ============================
216
217     AliDIPO *DIPO  = new AliDIPOv3("DIPO","Dipole version 3");
218   }
219
220   if(iHALL) {
221     //=================== HALL parameters ============================
222
223     AliHALL *HALL  = new AliHALLv3("HALL","Alice Hall");
224   }
225
226
227   if(iFRAME) {
228     //=================== FRAME parameters ============================
229
230     AliFRAME *FRAME  = new AliFRAMEv2("FRAME","Space Frame");
231     if (geo == kHoles) {
232       FRAME->SetHoles(1);
233     } else {
234       FRAME->SetHoles(0);
235     }
236
237   }
238
239   if(iSHIL) {
240     //=================== SHIL parameters ============================
241
242     AliSHIL *SHIL  = new AliSHILv3("SHIL","Shielding");
243   }
244
245
246   if(iPIPE) {
247     //=================== PIPE parameters ============================
248
249     AliPIPE *PIPE  = new AliPIPEv3("PIPE","Beam Pipe");
250   }
251
252
253   if(iITS) {
254     //=================== ITS parameters ============================
255
256     AliITSvPPRasymm *ITS  = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services");
257   }
258   
259
260   if(iTPC) {
261     //============================ TPC parameters ===================
262     AliTPC *TPC  = new AliTPCv2("TPC","Default");
263   }
264
265
266   if(iTOF) {
267     //=================== TOF parameters ============================
268     AliTOF *TOF  = new AliTOFv6T0("TOF","normal TOF");
269   }
270
271   if(iHMPID) {
272     //=================== HMPID parameters ===========================
273     AliHMPID *HMPID  = new AliHMPIDv2("HMPID","normal HMPID");    
274
275   }
276
277
278   if(iZDC) {
279     //=================== ZDC parameters ============================
280
281     AliZDC *ZDC  = new AliZDCv3("ZDC","normal ZDC");
282   }
283
284   if(iACORDE) {
285     //=================== ACORDE parameters ============================
286
287     AliACORDE *ACORDE  = new AliACORDEv1("ACORDE","normal ACORDE");
288   }
289
290   if(iTRD) {
291     //=================== TRD parameters ============================
292   
293     AliTRD *TRD  = new AliTRDv1("TRD","TRD slow simulator");
294   }
295
296   if(iFMD) {
297     //=================== FMD parameters ============================
298
299     AliFMD *FMD  = new AliFMDv0("FMD","normal FMD");
300   }
301
302   if(iMUON) {
303     //=================== MUON parameters ===========================
304     AliMUON *MUON  = new AliMUONv1("MUON","default");
305   }
306  
307   //=================== PHOS parameters ===========================
308
309   if(iPHOS) {
310     AliPHOS *PHOS  = new AliPHOSv1("PHOS","GPS2");
311   }
312
313
314   if(iPMD) {
315     //=================== PMD parameters ============================
316
317     AliPMD *PMD  = new AliPMDv1("PMD","normal PMD");
318     PMD->SetPAR(1., 1., 0.8, 0.02);
319     PMD->SetIN(6., 18., -580., 27., 27.);
320     PMD->SetGEO(0.0, 0.2, 4.);
321     PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
322
323   }
324
325   if(iT0) {
326     //=================== T0 parameters ============================
327     AliT0 *T0  = new AliT0v1("T0","T0 Detector");
328   }
329
330          
331 }
332
333
334 void LoadPythia()
335 {
336     // Load Pythia related libraries
337     gSystem->Load("liblhapdf.so");      // Parton density functions
338     gSystem->Load("libEGPythia6.so");   // TGenerator interface
339     gSystem->Load("libpythia6.so");     // Pythia
340     gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
341 }