]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/ConfigCharmPPR.C
New default geometry descriptions: HMPIDv2 and ITSv11Hybrid
[u/mrichter/AliRoot.git] / macros / ConfigCharmPPR.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/AliITSv11Hybrid.h"
23 #include "TPC/AliTPCv2.h"
24 #include "TOF/AliTOFv6T0.h"
25 #include "HMPID/AliHMPIDv3.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   if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
66     AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
67     AliCDBManager::Instance()->SetRun(0);
68   }
69
70   //=======================================================================
71   //  Create the output file
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
109   gMC->SetProcess("DCAY",1);
110   gMC->SetProcess("PAIR",1);
111   gMC->SetProcess("COMP",1);
112   gMC->SetProcess("PHOT",1);
113   gMC->SetProcess("PFIS",0);
114   gMC->SetProcess("DRAY",0);
115   gMC->SetProcess("ANNI",1);
116   gMC->SetProcess("BREM",1);
117   gMC->SetProcess("MUNU",1);
118   gMC->SetProcess("CKOV",1);
119   gMC->SetProcess("HADR",1);
120   gMC->SetProcess("LOSS",2);
121   gMC->SetProcess("MULS",1);
122   gMC->SetProcess("RAYL",1);
123   
124   Float_t cut = 1.e-3;        // 1MeV cut by default
125   Float_t tofmax = 1.e10;
126
127   gMC->SetCut("CUTGAM", cut);
128   gMC->SetCut("CUTELE", cut);
129   gMC->SetCut("CUTNEU", cut);
130   gMC->SetCut("CUTHAD", cut);
131   gMC->SetCut("CUTMUO", cut);
132   gMC->SetCut("BCUTE",  cut); 
133   gMC->SetCut("BCUTM",  cut); 
134   gMC->SetCut("DCUTE",  cut); 
135   gMC->SetCut("DCUTM",  cut); 
136   gMC->SetCut("PPCUTM", cut);
137   gMC->SetCut("TOFMAX", tofmax); 
138   
139
140   // AliGenPythia *gener = new AliGenPythia(ntracks);
141   AliGenPythia *gener = new AliGenPythia(-1);
142
143   gener->SetMomentumRange(0,999);
144   gener->SetPhiRange(0., 360.);
145   gener->SetThetaRange(0,180);
146   gener->SetYRange(-999,999);
147   //gener->SetPtRange(0,100);
148   gener->SetOrigin(0,0,0);          // vertex position
149   //gener->SetVertexSmear(kPerEvent); 
150   gener->SetSigma(0,0,5.3);  // Sigma in (X,Y,Z) (cm) on IP position
151   gener->SetTrackingFlag(0);
152   // gener->SetForceDecay(kHadronicD);
153
154   //
155   // The following settings select the Pythia parameters tuned to agree
156   // with charm NLO calculation for Pb-Pb @ 5.5 TeV with MNR code.
157   //
158   gener->SetProcess(kPyCharmPbPbMNR);
159   gener->SetStrucFunc(kCTEQ4L);
160   gener->SetPtHard(2.1,-1.0);
161   gener->SetEnergyCMS(5500.);
162   gener->SetNuclei(208,208); // Pb-Pb collisions
163
164   gener->Init();
165   // 
166   // Activate this line if you want the vertex smearing to happen
167   // track by track
168   //
169   //gener->SetVertexSmear(perTrack); 
170
171   // Field (L3 0.4 T)
172   AliMagFCM* field = new AliMagFCM(
173                      "Map2","$(ALICE_ROOT)/data/field01.dat", 2, 1., 10.);
174   field->SetSolenoidField(4.);
175   gAlice->SetField(field);    
176
177   Int_t iABSO=0;
178   Int_t iACORDE=0;
179   Int_t iDIPO=0;
180   Int_t iFMD=0;
181   Int_t iFRAME=0;
182   Int_t iHALL=0;
183   Int_t iITS=0;
184   Int_t iMAG=0;
185   Int_t iMUON=0;
186   Int_t iPHOS=0;
187   Int_t iPIPE=0;
188   Int_t iPMD=0;
189   Int_t iHMPID=0;
190   Int_t iSHIL=0;
191   Int_t iT0=0;
192   Int_t iTOF=0;
193   Int_t iTPC=0;
194   Int_t iTRD=0;
195   Int_t iZDC=0;
196
197   //=================== Alice BODY parameters =============================
198   AliBODY *BODY = new AliBODY("BODY","Alice envelop");
199
200   if(iMAG) {
201     //=================== MAG parameters ============================
202     // --- Start with Magnet since detector layouts may be depending ---
203     // --- on the selected Magnet dimensions ---
204     AliMAG *MAG  = new AliMAG("MAG","Magnet");
205   }
206
207
208   if(iABSO) {
209     //=================== ABSO parameters ============================
210     AliABSO *ABSO  = new AliABSOv3("ABSO","Muon Absorber");
211   }
212
213   if(iDIPO) {
214     //=================== DIPO parameters ============================
215
216     AliDIPO *DIPO  = new AliDIPOv3("DIPO","Dipole version 3");
217   }
218
219   if(iHALL) {
220     //=================== HALL parameters ============================
221
222     AliHALL *HALL  = new AliHALLv3("HALL","Alice Hall");
223   }
224
225
226   if(iFRAME) {
227     //=================== FRAME parameters ============================
228
229     AliFRAME *FRAME  = new AliFRAMEv2("FRAME","Space Frame");
230     if (geo == kHoles) {
231       FRAME->SetHoles(1);
232     } else {
233       FRAME->SetHoles(0);
234     }
235
236   }
237
238   if(iSHIL) {
239     //=================== SHIL parameters ============================
240
241     AliSHIL *SHIL  = new AliSHILv3("SHIL","Shielding");
242   }
243
244
245   if(iPIPE) {
246     //=================== PIPE parameters ============================
247
248     AliPIPE *PIPE  = new AliPIPEv3("PIPE","Beam Pipe");
249   }
250
251
252   if (iITS)
253   {
254     //=================== ITS parameters ============================
255
256     AliITS *ITS  = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
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 AliHMPIDv3("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   //=================== ACORDE parameters ===========================
315
316   if(iACORDE) {
317     AliACORDE *ACORDE  = new AliACORDEv1("ACORDE","Normal ACORDEGPS2");
318   }
319
320
321   if(iPMD) {
322     //=================== PMD parameters ============================
323
324     AliPMD *PMD  = new AliPMDv1("PMD","normal PMD");
325     PMD->SetPAR(1., 1., 0.8, 0.02);
326     PMD->SetIN(6., 18., -580., 27., 27.);
327     PMD->SetGEO(0.0, 0.2, 4.);
328     PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
329
330   }
331
332   if(iT0) {
333     //=================== T0 parameters ============================
334     AliT0 *T0  = new AliT0v1("T0","T0 Detector");
335   }
336
337          
338 }
339
340 void LoadPythia()
341 {
342     // Load Pythia related libraries
343     gSystem->Load("liblhapdf.so");      // Parton density functions
344     gSystem->Load("libEGPythia6.so");   // TGenerator interface
345     gSystem->Load("libpythia6.so");     // Pythia
346     gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
347 }