]> git.uio.no Git - u/mrichter/AliRoot.git/blame - test/genkine/sim/Config.C
Load libgeant321 after the Pythia related libraries
[u/mrichter/AliRoot.git] / test / genkine / sim / Config.C
CommitLineData
3928b038 1// One can use the configuration macro in compiled mode by
2// root [0] gSystem->Load("libgeant321");
3// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
4// -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
5// root [0] .x grun.C(1,"ConfigPPR.C++")
6
7#if !defined(__CINT__) || defined(__MAKECINT__)
8#include <Riostream.h>
9#include <TRandom.h>
10#include <TSystem.h>
11#include <TVirtualMC.h>
12#include <TGeant3TGeo.h>
13#include <TPDGCode.h>
14#include <TF1.h>
15#include "STEER/AliRunLoader.h"
16#include "STEER/AliRun.h"
17#include "STEER/AliConfig.h"
18#include "STEER/AliGenerator.h"
19#include "STEER/AliLog.h"
20#include "PYTHIA6/AliDecayerPythia.h"
21#include "EVGEN/AliGenHIJINGpara.h"
22#include "THijing/AliGenHijing.h"
23#include "EVGEN/AliGenCocktail.h"
24#include "EVGEN/AliGenSlowNucleons.h"
25#include "EVGEN/AliSlowNucleonModelExp.h"
26#include "EVGEN/AliGenParam.h"
27#include "EVGEN/AliGenMUONlib.h"
28#include "EVGEN/AliGenSTRANGElib.h"
29#include "EVGEN/AliGenMUONCocktail.h"
30#include "EVGEN/AliGenCocktail.h"
31#include "EVGEN/AliGenGeVSim.h"
32#include "EVGEN/AliGeVSimParticle.h"
33#include "PYTHIA6/AliGenPythia.h"
34#include "STEER/AliMagFMaps.h"
35#include "STRUCT/AliBODY.h"
36#include "STRUCT/AliMAG.h"
96fb3353 37#include "STRUCT/AliABSOv3.h"
38#include "STRUCT/AliDIPOv3.h"
39#include "STRUCT/AliHALLv3.h"
3928b038 40#include "STRUCT/AliFRAMEv2.h"
96fb3353 41#include "STRUCT/AliSHILv3.h"
42#include "STRUCT/AliPIPEv3.h"
99887042 43#include "ITS/AliITSv11Hybrid.h"
3928b038 44#include "TPC/AliTPCv2.h"
0d7ef405 45#include "TOF/AliTOFv6T0.h"
99887042 46#include "HMPID/AliHMPIDv3.h"
cb14d625 47#include "ZDC/AliZDCv3.h"
3928b038 48#include "TRD/AliTRDv1.h"
49#include "FMD/AliFMDv1.h"
50#include "MUON/AliMUONv1.h"
51#include "EMCAL/AliEMCALv2.h"
52#include "PHOS/AliPHOSv1.h"
53#include "PMD/AliPMDv1.h"
54#include "T0/AliT0v1.h"
55#include "EMCAL/AliEMCALv2.h"
56#include "ACORDE/AliACORDEv0.h"
57#include "VZERO/AliVZEROv7.h"
58#include "EVGEN/AliGenExtFile.h"
59#include "EVGEN/AliGenReaderTreeK.h"
60#endif
61
62enum PprRad_t
63{
64 kGluonRadiation, kNoGluonRadiation
65};
66
67enum PprMag_t
68{
69 k2kG, k4kG, k5kG
70};
71
72enum PprTrigConf_t
73{
74 kDefaultPPTrig, kDefaultPbPbTrig
75};
76
77const char * pprTrigConfName[] = {
78 "p-p","Pb-Pb"
79};
80
3b90f080 81enum PprGeo_t
82 {
83 kHoles, kNoHoles
84 };
85
3928b038 86// This part for configuration
87
88static PprRad_t srad = kGluonRadiation;
89static PprMag_t smag = k5kG;
90static Int_t sseed = 12345; //Set 0 to use the current time
91
92static PprTrigConf_t strig = kDefaultPPTrig; // default PbPb trigger configuration
3b90f080 93static PprGeo_t geo = kHoles;
3928b038 94// Comment line
95static TString comment;
96
97// Functions
98Float_t EtaToTheta(Float_t arg);
99AliGenerator* GeneratorFactory();
100
101void Config()
102{
103 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
104 // Theta range given through pseudorapidity limits 22/6/2001
105
106 // Set Random Number seed
107 gRandom->SetSeed(sseed);
108 cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
109
110
111
d7b8d4b5 112 // libraries required by geant321 and Pythia6
3928b038 113#if defined(__CINT__)
d7b8d4b5 114 gSystem->Load("liblhapdf.so"); // Parton density functions
115 gSystem->Load("libEGPythia6.so"); // TGenerator interface
116 gSystem->Load("libpythia6.so"); // Pythia
117 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
3fc6785c 118 gSystem->Load("libgeant321");
3928b038 119#endif
120
121 new TGeant3TGeo("C++ Interface to Geant3");
122
123 AliRunLoader* rl=0x0;
124
125 cout<<"Config.C: Creating Run Loader ..."<<endl;
126 rl = AliRunLoader::Open("galice.root",
127 AliConfig::GetDefaultEventFolderName(),
128 "recreate");
129 if (rl == 0x0)
130 {
131 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
132 return;
133 }
134 rl->SetCompressionLevel(2);
135 rl->SetNumberOfEventsPerFile(100);
136 gAlice->SetRunLoader(rl);
137
138 // Set the trigger configuration
139 gAlice->SetTriggerDescriptor(pprTrigConfName[strig]);
140 cout<<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
141
142
143 //
144 // Set External decayer
145 AliDecayer *decayer = new AliDecayerPythia();
146 decayer->SetForceDecay(kAll);
147 decayer->Init();
148
149 //forbid some decays
150 AliPythia * py= AliPythia::Instance();
f1047fdc 151 py->SetMDME(737,1,0); //forbid D*+->D+ + pi0
152 py->SetMDME(738,1,0);//forbid D*+->D+ + gamma
3928b038 153
f1047fdc 154 for(Int_t d=747; d<=762; d++){
3928b038 155 py->SetMDME(d,1,0);
156 }
157
f1047fdc 158 for(Int_t d=764; d<=807; d++){
3928b038 159 py->SetMDME(d,1,0);
160 }
161
162
163
164 gMC->SetExternalDecayer(decayer);
165 //
166 //
167 //=======================================================================
168 //
169 //=======================================================================
170 // ************* STEERING parameters FOR ALICE SIMULATION **************
171 // --- Specify event type to be tracked through the ALICE setup
172 // --- All positions are in cm, angles in degrees, and P and E in GeV
173
174 gMC->SetProcess("DCAY",1);
175 gMC->SetProcess("PAIR",1);
176 gMC->SetProcess("COMP",1);
177 gMC->SetProcess("PHOT",1);
178 gMC->SetProcess("PFIS",0);
179 gMC->SetProcess("DRAY",0);
180 gMC->SetProcess("ANNI",1);
181 gMC->SetProcess("BREM",1);
182 gMC->SetProcess("MUNU",1);
183 gMC->SetProcess("CKOV",1);
184 gMC->SetProcess("HADR",1);
185 gMC->SetProcess("LOSS",2);
186 gMC->SetProcess("MULS",1);
187 gMC->SetProcess("RAYL",1);
188
189 Float_t cut = 1.e-3; // 1MeV cut by default
190 Float_t tofmax = 1.e10;
191
192 gMC->SetCut("CUTGAM", cut);
193 gMC->SetCut("CUTELE", cut);
194 gMC->SetCut("CUTNEU", cut);
195 gMC->SetCut("CUTHAD", cut);
196 gMC->SetCut("CUTMUO", cut);
197 gMC->SetCut("BCUTE", cut);
198 gMC->SetCut("BCUTM", cut);
199 gMC->SetCut("DCUTE", cut);
200 gMC->SetCut("DCUTM", cut);
201 gMC->SetCut("PPCUTM", cut);
202 gMC->SetCut("TOFMAX", tofmax);
203
204 // Debug and log level
205 // AliLog::SetGlobalDebugLevel(0);
206 // AliLog::SetGlobalLogLevel(AliLog::kError);
207
208 // Generator Configuration
209 AliGenerator* gener = GeneratorFactory();
210 gener->SetOrigin(0, 0, 0); // vertex position
211 gener->SetSigma(0, 0, 5.3); // Sigma in (X,Y,Z) (cm) on IP position
212 gener->SetCutVertexZ(1.); // Truncate at 1 sigma
213 gener->SetVertexSmear(kPerEvent);
214 gener->SetTrackingFlag(1);
215 gener->Init();
216
217 if (smag == k2kG) {
218 comment = comment.Append(" | L3 field 0.2 T");
219 } else if (smag == k4kG) {
220 comment = comment.Append(" | L3 field 0.4 T");
221 } else if (smag == k5kG) {
222 comment = comment.Append(" | L3 field 0.5 T");
223 }
224
225
226 if (srad == kGluonRadiation)
227 {
228 comment = comment.Append(" | Gluon Radiation On");
229
230 } else {
231 comment = comment.Append(" | Gluon Radiation Off");
232 }
233
234
235 printf("\n \n Comment: %s \n \n", comment.Data());
236
237
238// Field (L3 0.4 T)
239 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., smag);
240 field->SetL3ConstField(0); //Using const. field in the barrel
241 rl->CdGAFile();
242 gAlice->SetField(field);
243//
244 Int_t iABSO = 1;
245 Int_t iDIPO = 1;
246 Int_t iFMD = 1;
247 Int_t iFRAME = 1;
248 Int_t iHALL = 1;
249 Int_t iITS = 1;
250 Int_t iMAG = 1;
251 Int_t iMUON = 1;
252 Int_t iPHOS = 1;
253 Int_t iPIPE = 1;
254 Int_t iPMD = 1;
255 Int_t iHMPID = 1;
256 Int_t iSHIL = 1;
257 Int_t iT0 = 1;
258 Int_t iTOF = 1;
259 Int_t iTPC = 1;
260 Int_t iTRD = 1;
261 Int_t iZDC = 1;
262 Int_t iEMCAL = 1;
263 Int_t iVZERO = 1;
264 Int_t iACORDE = 0;
265
266 //=================== Alice BODY parameters =============================
267 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
268
269
270 if (iMAG)
271 {
272 //=================== MAG parameters ============================
273 // --- Start with Magnet since detector layouts may be depending ---
274 // --- on the selected Magnet dimensions ---
275 AliMAG *MAG = new AliMAG("MAG", "Magnet");
276 }
277
278
279 if (iABSO)
280 {
281 //=================== ABSO parameters ============================
96fb3353 282 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
3928b038 283 }
284
285 if (iDIPO)
286 {
287 //=================== DIPO parameters ============================
288
96fb3353 289 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
3928b038 290 }
291
292 if (iHALL)
293 {
294 //=================== HALL parameters ============================
295
96fb3353 296 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
3928b038 297 }
298
299
300 if (iFRAME)
301 {
302 //=================== FRAME parameters ============================
303
304 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
3b90f080 305 if (geo == kHoles) {
306 FRAME->SetHoles(1);
307 } else {
308 FRAME->SetHoles(0);
309 }
3928b038 310 }
311
312 if (iSHIL)
313 {
314 //=================== SHIL parameters ============================
315
96fb3353 316 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
3928b038 317 }
318
319
320 if (iPIPE)
321 {
322 //=================== PIPE parameters ============================
323
96fb3353 324 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
3928b038 325 }
326
e89fa83b 327 if (iITS)
328 {
329 //=================== ITS parameters ============================
3928b038 330
99887042 331 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
3928b038 332 }
333
334 if (iTPC)
335 {
336 //============================ TPC parameters =====================
337 AliTPC *TPC = new AliTPCv2("TPC", "Default");
338 }
339
340
341 if (iTOF) {
342 //=================== TOF parameters ============================
0d7ef405 343 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
3928b038 344 }
345
346
347 if (iHMPID)
348 {
349 //=================== HMPID parameters ===========================
99887042 350 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
3928b038 351
352 }
353
354
355 if (iZDC)
356 {
357 //=================== ZDC parameters ============================
358
cb14d625 359 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
3928b038 360 }
361
362 if (iTRD)
363 {
364 //=================== TRD parameters ============================
365
366 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
367 }
368
369 if (iFMD)
370 {
371 //=================== FMD parameters ============================
372 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
373 }
374
375 if (iMUON)
376 {
377 //=================== MUON parameters ===========================
378 // New MUONv1 version (geometry defined via builders)
379 AliMUON *MUON = new AliMUONv1("MUON", "default");
380 }
381 //=================== PHOS parameters ===========================
382
383 if (iPHOS)
384 {
385 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
386 }
387
388
389 if (iPMD)
390 {
391 //=================== PMD parameters ============================
392 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
393 }
394
395 if (iT0)
396 {
397 //=================== T0 parameters ============================
398 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
399 }
400
401 if (iEMCAL)
402 {
403 //=================== EMCAL parameters ============================
404 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
405 }
406
407 if (iACORDE)
408 {
409 //=================== ACORDE parameters ============================
410 AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
411 }
412
413 if (iVZERO)
414 {
415 //=================== VZERO parameters ============================
416 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
417 }
418
419
420}
421
422Float_t EtaToTheta(Float_t arg){
423 return (180./TMath::Pi())*2.*atan(exp(-arg));
424}
425
426
427
428AliGenerator* GeneratorFactory() {
429
430 AliGenExtFile *gener = new AliGenExtFile(-1);
431 AliGenReaderTreeK * reader = new AliGenReaderTreeK();
432
433 reader->SetFileName("galice.root");
434 reader->AddDir("../gen");
435 gener->SetReader(reader);
436
437 return gener;
438
439
440}
441