1 #if !defined(__CINT__) || defined(__MAKECINT__)
5 #include <TVirtualMC.h>
7 #include "STEER/AliRunLoader.h"
8 #include "STEER/AliRun.h"
9 #include "STEER/AliConfig.h"
10 #include "PYTHIA6/AliDecayerPythia.h"
11 #include "EVGEN/AliGenCocktail.h"
12 #include "EVGEN/AliGenFixed.h"
13 #include "EVGEN/AliGenBox.h"
14 #include "EVGEN/AliGenScan.h"
15 #include "EVGEN/AliGenHIJINGpara.h"
16 #include "THijing/AliGenHijing.h"
17 #include "PYTHIA6/AliGenPythia.h"
18 #include "THerwig/AliGenHerwig.h"
19 #include "EVGEN/AliGenParam.h"
20 #include "EVGEN/AliGenMUONlib.h"
21 #include "EVGEN/AliGenPHOSlib.h"
22 #include "EVGEN/AliGenGSIlib.h"
23 #include "EVGEN/AliGenFLUKAsource.h"
24 #include "EVGEN/AliGenExtFile.h"
25 #include "EVGEN/AliGenHalo.h"
26 #include "EVGEN/AliGenReaderTreeK.h"
27 #include "STRUCT/AliBODY.h"
28 #include "STRUCT/AliMAG.h"
31 enum gentype_t {hijing, hijingParam, gun, box, pythia, herwig, mcatnlo,
32 param1, param2, param3, param4,
33 cocktail, fluka, halo, ntuple, scan};
35 gentype_t gentype = mcatnlo;
42 // Set Random Number seed
43 gRandom->SetSeed(12345); //Set 0 to use the current time
44 cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
47 // libraries required by geant321
49 gSystem->Load("libgeant321");
52 new TGeant3TGeo("C++ Interface to Geant3");
54 //=======================================================================
55 // Create the output file
59 cout<<"Config.C: Creating Run Loader ..."<<endl;
60 rl = AliRunLoader::Open("galice.root",
61 AliConfig::GetDefaultEventFolderName(),
65 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
68 rl->SetCompressionLevel(2);
69 rl->SetNumberOfEventsPerFile(3);
70 gAlice->SetRunLoader(rl);
73 // Set External decayer
74 AliDecayer* decayer = new AliDecayerPythia();
75 decayer->SetForceDecay(kAll);
77 gMC->SetExternalDecayer(decayer);
81 //=======================================================================
82 // ************* STEERING parameters FOR ALICE SIMULATION **************
83 // --- Specify event type to be tracked through the ALICE setup
84 // --- All positions are in cm, angles in degrees, and P and E in GeV
87 gMC->SetProcess("DCAY",1);
88 gMC->SetProcess("PAIR",1);
89 gMC->SetProcess("COMP",1);
90 gMC->SetProcess("PHOT",1);
91 gMC->SetProcess("PFIS",0);
92 gMC->SetProcess("DRAY",0);
93 gMC->SetProcess("ANNI",1);
94 gMC->SetProcess("BREM",1);
95 gMC->SetProcess("MUNU",1);
96 gMC->SetProcess("CKOV",1);
97 gMC->SetProcess("HADR",1);
98 gMC->SetProcess("LOSS",2);
99 gMC->SetProcess("MULS",1);
100 gMC->SetProcess("RAYL",1);
102 Float_t cut = 1.e-3; // 1MeV cut by default
103 Float_t tofmax = 1.e10;
105 gMC->SetCut("CUTGAM", cut);
106 gMC->SetCut("CUTELE", cut);
107 gMC->SetCut("CUTNEU", cut);
108 gMC->SetCut("CUTHAD", cut);
109 gMC->SetCut("CUTMUO", cut);
110 gMC->SetCut("BCUTE", cut);
111 gMC->SetCut("BCUTM", cut);
112 gMC->SetCut("DCUTE", cut);
113 gMC->SetCut("DCUTM", cut);
114 gMC->SetCut("PPCUTM", cut);
115 gMC->SetCut("TOFMAX", tofmax);
118 AliGenerator * gGener = 0x0;
122 //*********************************************
123 // Example for Fixed Particle Gun
124 //*********************************************
126 AliGenFixed *gener = new AliGenFixed(ntracks);
127 gener->SetMomentum(50);
130 gener->SetOrigin(0,0,0); //vertex position
131 gener->SetPart(kNeutron);
136 //*********************************************
137 // Example for Moving Particle Gun *
138 //*********************************************
140 AliGenBox *gener = new AliGenBox(ntracks);
141 gener->SetMomentumRange(3,4);
142 gener->SetPhiRange(0,360);
143 gener->SetThetaRange(90, 180. );
144 gener->SetOrigin(0,0,0);
146 gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
147 gener->SetPart(kMuonPlus);
152 //*********************************************
153 // Scanning on a grid *
154 //*********************************************
156 AliGenScan *gener = new AliGenScan(-1);
157 gener->SetMomentumRange(4,4);
158 gener->SetPhiRange(0,360);
159 gener->SetThetaRange(9,9);
161 gener->SetSigma(6,6,0); //Sigma in (X,Y,Z) (cm) on IP position
162 gener->SetPart(kMuonPlus);
163 gener->SetRange(20, -100, 100, 20, -100, 100, 1, 500, 500);
170 AliGenHIJINGpara *gener = new AliGenHIJINGpara(ntracks);
171 gener->SetMomentumRange(0,999);
172 gener->SetPhiRange(0,360);
173 gener->SetThetaRange(2,10);
174 gener->SetOrigin(0,0,0); //vertex position
175 gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
181 AliGenHijing *gener = new AliGenHijing(-1);
182 // centre of mass energy
183 gener->SetEnergyCMS(5500);
185 gener->SetReferenceFrame("CMS ");
187 gener->SetProjectile("A ", 208, 82);
188 gener->SetTarget ("A ", 208, 82);
189 // impact parameter range
190 gener->SetImpactParameterRange(0, 3.);
191 // evaluate cross section before run
192 gener->SetEvaluate(0);
193 // tell hijing to keep the full parent child chain
194 gener->KeepFullEvent();
195 // enable jet quenching
196 gener->SetJetQuenching(1);
198 gener->SetShadowing(1);
199 // neutral pion and heavy particle decays switched off
200 gener->SetDecaysOff(1);
202 gener->SetTrigger(0);
203 // kinematic selection
204 gener->SetSelectAll(0);
206 gener->SetMomentumRange(0,999);
208 gener->SetPhiRange(0.,360.);
210 gener->SetThetaRange(0,180.);
211 // select flavor (0: no, 4: charm+beauty, 5:beauty)
214 gener->SetOrigin(0., 0.0 ,0);
215 gener->SetSigma(0,0,5.3);
216 gener->SetVertexSmear(kPerEvent);
218 gener->SetTrackingFlag(0);
224 //********************************************
225 // Example for Charm Production with Pythia *
226 //********************************************
228 AliGenPythia *gener = new AliGenPythia(-1);
229 // final state kinematic cuts
230 gener->SetMomentumRange(0,999);
231 gener->SetPhiRange(0. ,360.);
232 gener->SetThetaRange(0., 180.);
233 gener->SetYRange(-10,10);
234 gener->SetPtRange(0,100);
235 // vertex position and smearing
236 gener->SetOrigin(0,0,0); // vertex position
237 gener->SetVertexSmear(kPerEvent);
238 gener->SetSigma(0,0,5.6); // Sigma in (X,Y,Z) (cm) on IP position
239 // Structure function. See the list in EVGEN/AliStructFuncType.h
240 gener->SetStrucFunc(kGRVHO);
241 // Select corection for nuclear structure functions
242 // gener->SetNuclei(208,208);
244 // Process type. See the list in PYTHIA6/AliPythia.h
245 gener->SetProcess(kPyBeauty);
247 // Pt transfer of the hard scattering
248 gener->SetPtHard(0.,5.);
249 // Decay type (semielectronic, semimuonic, nodecay)
250 gener->SetForceDecay(kSemiElectronic);
251 // Centre of mass energy
252 gener->SetEnergyCMS(5500.);
254 gener->SetTrackingFlag(0);
260 //********************************************
261 // Example for Charm Production with Pythia *
262 //********************************************
264 AliGenHerwig *gener = new AliGenHerwig(-1);
265 // final state kinematic cuts
266 gener->SetMomentumRange(0,7000);
267 gener->SetPhiRange(0. ,360.);
268 gener->SetThetaRange(0., 180.);
269 gener->SetYRange(-10,10);
270 gener->SetPtRange(0,7000);
271 // vertex position and smearing
272 gener->SetOrigin(0,0,0); // vertex position
273 gener->SetVertexSmear(kPerEvent);
274 gener->SetSigma(0,0,5.6); // Sigma in (X,Y,Z) (cm) on IP position
276 gener->SetBeamMomenta(7000,7000);
278 gener->SetProjectile("P");
279 gener->SetTarget("P");
280 // Structure function
281 gener->SetStrucFunc(kGRVHO);
283 gener->SetPtHardMin(200);
286 gener->SetProcess(8000);
288 gener->SetTrackingFlag(0);
295 AliGenHerwig *gener = new AliGenHerwig(-1);
296 gener->SetMomentumRange(0,7000);
297 gener->SetPhiRange(0. ,360.);
298 gener->SetThetaRange(0., 180.);
299 gener->SetYRange(-10,10);
300 gener->SetPtRange(0,7000);
301 gener->SetOrigin(0,0,0); // vertex position
302 gener->SetVertexSmear(kPerEvent);
303 gener->SetSigma(0,0,5.6); // Sigma in (X,Y,Z) (cm) on IP position
304 gener->SetBeamMomenta(7000,7000);
305 gener->SetProjectile("P");
306 gener->SetTarget("P");
307 gener->SetStrucFunc(kCTEQ5M);
308 gener->SetProcess(-1705);
309 gener->SetHardProcessFile("sb.events");
310 gener->SetEventListRange(0,1);
311 gener->SetTrackingFlag(0);
317 //*******************************************************
318 // Example for J/psi Production from Parameterisation
319 // using default library (AliMUONlib)
320 //*******************************************************
323 new AliGenParam(ntracks, AliGenMUONlib::kUpsilon);
324 gener->SetMomentumRange(0,999);
325 gener->SetPtRange(0,999);
326 gener->SetPhiRange(0. , 360.);
327 gener->SetYRange(2.5,4);
328 gener->SetCutOnChild(1);
329 gener->SetChildThetaRange(2,9);
330 gener->SetOrigin(0,0,0); //vertex position
331 gener->SetSigma(0,0,5.3); //Sigma in (X,Y,Z) (cm) on IP position
332 gener->SetForceDecay(kDiMuon);
333 gener->SetTrackingFlag(0);
339 //*******************************************************
340 // Example for Omega Production from Parameterisation
341 // specifying library.
342 //*******************************************************
344 AliGenParam *gener = new AliGenParam(1000,new AliGenPHOSlib(),
345 AliGenPHOSlib::kOmega);
346 gener->SetWeighting(kNonAnalog);
347 gener->SetForceDecay(kNoDecay);
348 gener->SetPtRange(0,100);
349 gener->SetThetaRange(45,135);
350 gener->SetTrackingFlag(0);
356 //*******************************************************
357 // Example for Upsilon Production from Parameterisation
358 // specifying library.
360 //*******************************************************
362 AliGenParam *gener = new AliGenParam(1000,new AliGenGSIlib(),
363 AliGenGSIlib::kUpsilon, "MUON");
364 gener->SetMomentumRange(0,999);
365 gener->SetPtRange(0,999);
366 gener->SetPhiRange(0., 360.);
367 gener->SetYRange(2.5,4);
368 gener->SetCutOnChild(1);
369 gener->SetChildThetaRange(2,9);
370 gener->SetOrigin(0,0,0); //vertex position
371 gener->SetSigma(0,0,5.3); //Sigma in (X,Y,Z) (cm) on IP position
372 gener->SetForceDecay(kDiMuon);
373 gener->SetTrackingFlag(0);
379 //*******************************************************
380 // Example for Omega Production from Parameterisation
381 // specifying library.
382 // The alternative way.
383 //*******************************************************
385 AliGenLib* Lib=new AliGenPHOSlib();
386 Int_t iOmega = AliGenPHOSlib::kOmega;
387 AliGenParam *gener = new AliGenParam(50, iOmega,
388 Lib->GetPt(iOmega, ""),
389 Lib->GetY (iOmega, ""),
390 Lib->GetIp(iOmega, ""));
391 gener->SetPtRange(0,999);
392 gener->SetWeighting(kNonAnalog);
393 gener->SetForceDecay(kNoDecay);
394 gener->SetTrackingFlag(0);
400 //*******************************************************
401 // Example for a FLUKA Boundary Source *
402 //*******************************************************
404 AliGenFLUKAsource *gener = new AliGenFLUKAsource(-1);
405 gener->SetFileName("$(ALICE_ROOT)/data/all32.root");
406 gener->SetPartFlag(9);
407 gener->SetAgeMax(1.e-5);
409 gener->SetFraction(0.0315);
410 // gener->SetFraction(0.75*0.0315);
412 // gener->SetPartFlag(10);
413 gener->SetMomentumRange(0,999);
414 gener->SetPhiRange(0.,360.);
415 gener->SetThetaRange(0., 180.);
416 gener->SetAgeMax(1.e-5);
419 // gener->SetFraction(0.0315);
425 //*******************************************************
426 // Example for reading from a external file *
427 //*******************************************************
429 AliGenExtFile *gener = new AliGenExtFile(-1);
430 gener->SetVertexSmear(kPerEvent);
431 gener->SetTrackingFlag(1);
433 AliGenReaderTreeK * reader = new AliGenReaderTreeK();
434 reader->SetFileName("$(ALICE_ROOT)/data/dtujet93.root");
435 gener->SetReader(reader);
441 //*******************************************************
442 // Example for Tunnel Halo Source *
443 //*******************************************************
445 AliGenHalo *gener = new AliGenHalo(ntracks);
446 gener->SetFileName("/h1/morsch/marsip/marsip5.mu");
452 //*******************************************************
453 // Example for a Cocktail *
454 //*******************************************************
456 AliGenCocktail *gener = new AliGenCocktail();
458 gener->SetPhiRange(0,360);
459 gener->SetYRange(2.5,4);
460 gener->SetThetaRange(2,9);
461 gener->SetPtRange(0,10);
462 gener->SetOrigin(0,0,0); //vertex position
463 gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
464 gener->SetMomentumRange(0,999);
466 AliGenParam *jpsi = new AliGenParam(1,AliGenMUONlib::kJpsi);
467 jpsi->SetForceDecay(kDiMuon);
468 jpsi->SetCutOnChild(1);
471 AliGenFLUKAsource *bg = new AliGenFLUKAsource(-1);
472 bg->AddFile("$(ALICE_ROOT)/data/all32.root");
475 bg->SetAgeMax(1.e-5);
477 // gener->SetFraction(0.0315);
478 bg->SetFraction(0.01*0.0315);
480 gener->AddGenerator(jpsi,"J/Psi", 1);
481 gener->AddGenerator(bg,"Background",1);
488 // Activate this line if you want the vertex smearing to happen
491 // gener->SetVertexSmear(kPerTrack);
495 gAlice->SetField(-999,2); //Specify maximum magnetic field in Tesla (neg. ==> default field)
500 //=================== Alice BODY parameters =============================
501 AliBODY *BODY = new AliBODY("BODY","Alice envelop");
505 //=================== MAG parameters ============================
506 // --- Start with Magnet since detector layouts may be depending ---
507 // --- on the selected Magnet dimensions ---
508 AliMAG *MAG = new AliMAG("MAG","Magnet");