Using VZERO v6
[u/mrichter/AliRoot.git] / macros / Config_gener.C
CommitLineData
de78d77f 1#if !defined(__CINT__) || defined(__MAKECINT__)
2#include <Riostream.h>
3#include <TRandom.h>
4#include <TSystem.h>
5#include <TVirtualMC.h>
6#include <TGeant3.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"
08b9b499 18#include "THerwig/AliGenHerwig.h"
de78d77f 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"
29#endif
30
08b9b499 31enum gentype_t {hijing, hijingParam, gun, box, pythia, herwig,
11a136ef 32 param1, param2, param3, param4,
08b9b499 33 cocktail, fluka, halo, ntuple, scan};
916c29ab 34
08b9b499 35gentype_t gentype = herwig;
916c29ab 36
de78d77f 37Int_t ntracks=1;
916c29ab 38
39void Config()
40{
41
de78d77f 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;
45
46
47 // libraries required by geant321
48#if defined(__CINT__)
49 gSystem->Load("libgeant321");
50#endif
51
b0470150 52 new TGeant3TGeo("C++ Interface to Geant3");
916c29ab 53
54//=======================================================================
55// Create the output file
56
de78d77f 57 AliRunLoader* rl=0x0;
58
59 cout<<"Config.C: Creating Run Loader ..."<<endl;
60 rl = AliRunLoader::Open("galice.root",
f5a857b2 61 AliConfig::GetDefaultEventFolderName(),
de78d77f 62 "recreate");
63 if (rl == 0x0)
64 {
65 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
66 return;
67 }
68 rl->SetCompressionLevel(2);
69 rl->SetNumberOfEventsPerFile(3);
70 gAlice->SetRunLoader(rl);
71
11a136ef 72//
73// Set External decayer
de78d77f 74 AliDecayer* decayer = new AliDecayerPythia();
75 decayer->SetForceDecay(kAll);
76 decayer->Init();
77 gMC->SetExternalDecayer(decayer);
11a136ef 78
6a3df6c9 79
916c29ab 80//
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
85
6a3df6c9 86
de78d77f 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);
101
102 Float_t cut = 1.e-3; // 1MeV cut by default
103 Float_t tofmax = 1.e10;
104
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);
116
6a3df6c9 117
de78d77f 118 AliGenerator * gGener = 0x0;
119 switch(gentype)
120 {
121 case gun:
916c29ab 122//*********************************************
123// Example for Fixed Particle Gun
124//*********************************************
de78d77f 125 {
126 AliGenFixed *gener = new AliGenFixed(ntracks);
127 gener->SetMomentum(50);
128 gener->SetPhi(180.);
129 gener->SetTheta(5.);
130 gener->SetOrigin(0,0,0); //vertex position
131 gener->SetPart(13); //GEANT particle type
132 gGener = gener;
133 }
134 break;
135 case box:
916c29ab 136//*********************************************
137// Example for Moving Particle Gun *
138//*********************************************
de78d77f 139 {
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);
145 //vertex position
146 gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
147 gener->SetPart(5); //GEANT particle type
148 gGener = gener;
149 }
150 break;
151 case scan:
916c29ab 152//*********************************************
153// Scanning on a grid *
154//*********************************************
de78d77f 155 {
156 AliGenScan *gener = new AliGenScan(-1);
157 gener->SetMomentumRange(4,4);
158 gener->SetPhiRange(0,360);
159 gener->SetThetaRange(9,9);
160 //vertex position
161 gener->SetSigma(6,6,0); //Sigma in (X,Y,Z) (cm) on IP position
162 gener->SetPart(5);
163 gener->SetRange(20, -100, 100, 20, -100, 100, 1, 500, 500);
164 gGener = gener;
165 }
166 break;
916c29ab 167
de78d77f 168 case hijingParam:
169 {
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
176 gGener = gener;
177 }
178 break;
179 case hijing:
180 {
181 AliGenHijing *gener = new AliGenHijing(-1);
50ea53d9 182// centre of mass energy
de78d77f 183 gener->SetEnergyCMS(5500);
50ea53d9 184// reference frame
de78d77f 185 gener->SetReferenceFrame("CMS ");
50ea53d9 186// projectile
de78d77f 187 gener->SetProjectile("A ", 208, 82);
188 gener->SetTarget ("A ", 208, 82);
50ea53d9 189// impact parameter range
de78d77f 190 gener->SetImpactParameterRange(0, 3.);
50ea53d9 191// evaluate cross section before run
b86fedbb 192 gener->SetEvaluate(0);
50ea53d9 193// tell hijing to keep the full parent child chain
de78d77f 194 gener->KeepFullEvent();
50ea53d9 195// enable jet quenching
de78d77f 196 gener->SetJetQuenching(1);
50ea53d9 197// enable shadowing
de78d77f 198 gener->SetShadowing(1);
50ea53d9 199// neutral pion and heavy particle decays switched off
de78d77f 200 gener->SetDecaysOff(1);
50ea53d9 201// trigger
de78d77f 202 gener->SetTrigger(0);
50ea53d9 203// kinematic selection
de78d77f 204 gener->SetSelectAll(0);
50ea53d9 205// momentum range
de78d77f 206 gener->SetMomentumRange(0,999);
50ea53d9 207// phi range
b86fedbb 208 gener->SetPhiRange(0.,360.);
50ea53d9 209// theta range
de78d77f 210 gener->SetThetaRange(0,180.);
50ea53d9 211// select flavor (0: no, 4: charm+beauty, 5:beauty)
b86fedbb 212 gener->SetFlavor(0);
50ea53d9 213//
de78d77f 214 gener->SetOrigin(0., 0.0 ,0);
215 gener->SetSigma(0,0,5.3);
216 gener->SetVertexSmear(kPerEvent);
50ea53d9 217// no tracking
de78d77f 218 gener->SetTrackingFlag(0);
219 gGener = gener;
220 }
221 break;
d6249ec3 222
de78d77f 223 case pythia:
916c29ab 224//********************************************
225// Example for Charm Production with Pythia *
226//********************************************
de78d77f 227 {
228 AliGenPythia *gener = new AliGenPythia(-1);
e417bd32 229// final state kinematic cuts
de78d77f 230 gener->SetMomentumRange(0,999);
b86fedbb 231 gener->SetPhiRange(0. ,360.);
de78d77f 232 gener->SetThetaRange(0., 180.);
233 gener->SetYRange(-10,10);
234 gener->SetPtRange(0,100);
e417bd32 235// vertex position and smearing
de78d77f 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);
e417bd32 241// Select corection for nuclear structure functions
242// gener->SetNuclei(208,208);
243//
de78d77f 244// Process type. See the list in PYTHIA6/AliPythia.h
245 gener->SetProcess(kPyBeauty);
e417bd32 246//
247// Pt transfer of the hard scattering
de78d77f 248 gener->SetPtHard(0.,5.);
e417bd32 249// Decay type (semielectronic, semimuonic, nodecay)
de78d77f 250 gener->SetForceDecay(kSemiElectronic);
e417bd32 251// Centre of mass energy
de78d77f 252 gener->SetEnergyCMS(5500.);
e417bd32 253// No Tracking
08b9b499 254 gener->SetTrackingFlag(0);
255 gGener = gener;
256 }
257 break;
258
259 case herwig:
260//********************************************
261// Example for Charm Production with Pythia *
262//********************************************
263 {
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
275// Beam momenta
276 gener->SetBeamMomenta(7000,7000);
277// Beams
278 gener->SetProjectile("P");
279 gener->SetTarget("P");
280// Structure function
281 gener->SetStrucFunc(kGRVHO);
282// Hard scatering
283 gener->SetPtHardMin(200);
284 gener->SetPtRMS(20);
285// Min bias
286 gener->SetProcess(8000);
287// No Tracking
de78d77f 288 gener->SetTrackingFlag(0);
289 gGener = gener;
290 }
291 break;
395b2e02 292
de78d77f 293 case param1:
916c29ab 294//*******************************************************
395b2e02 295// Example for J/psi Production from Parameterisation
296// using default library (AliMUONlib)
916c29ab 297//*******************************************************
de78d77f 298 {
299 AliGenParam *gener =
300 new AliGenParam(ntracks, AliGenMUONlib::kUpsilon);
301 gener->SetMomentumRange(0,999);
302 gener->SetPtRange(0,999);
b86fedbb 303 gener->SetPhiRange(0. , 360.);
de78d77f 304 gener->SetYRange(2.5,4);
305 gener->SetCutOnChild(1);
306 gener->SetChildThetaRange(2,9);
307 gener->SetOrigin(0,0,0); //vertex position
308 gener->SetSigma(0,0,5.3); //Sigma in (X,Y,Z) (cm) on IP position
309 gener->SetForceDecay(kDiMuon);
310 gener->SetTrackingFlag(0);
311 gGener = gener;
312 }
313 break;
395b2e02 314
de78d77f 315 case param2:
395b2e02 316//*******************************************************
317// Example for Omega Production from Parameterisation
318// specifying library.
319//*******************************************************
de78d77f 320 {
321 AliGenParam *gener = new AliGenParam(1000,new AliGenPHOSlib(),
322 AliGenPHOSlib::kOmega);
323 gener->SetWeighting(kNonAnalog);
324 gener->SetForceDecay(kNoDecay);
325 gener->SetPtRange(0,100);
326 gener->SetThetaRange(45,135);
327 gener->SetTrackingFlag(0);
328 gGener = gener;
329 }
330 break;
395b2e02 331
de78d77f 332 case param3:
395b2e02 333//*******************************************************
334// Example for Upsilon Production from Parameterisation
335// specifying library.
336// GSI style
337//*******************************************************
de78d77f 338 {
339 AliGenParam *gener = new AliGenParam(1000,new AliGenGSIlib(),
340 AliGenGSIlib::kUpsilon, "MUON");
341 gener->SetMomentumRange(0,999);
342 gener->SetPtRange(0,999);
b86fedbb 343 gener->SetPhiRange(0., 360.);
de78d77f 344 gener->SetYRange(2.5,4);
345 gener->SetCutOnChild(1);
346 gener->SetChildThetaRange(2,9);
347 gener->SetOrigin(0,0,0); //vertex position
348 gener->SetSigma(0,0,5.3); //Sigma in (X,Y,Z) (cm) on IP position
349 gener->SetForceDecay(kDiMuon);
350 gener->SetTrackingFlag(0);
351 gGener = gener;
352 }
353 break;
395b2e02 354
de78d77f 355 case param4:
395b2e02 356//*******************************************************
357// Example for Omega Production from Parameterisation
358// specifying library.
359// The alternative way.
360//*******************************************************
de78d77f 361 {
362 AliGenLib* Lib=new AliGenPHOSlib();
363 Int_t iOmega = AliGenPHOSlib::kOmega;
364 AliGenParam *gener = new AliGenParam(50, iOmega,
365 Lib->GetPt(iOmega, ""),
366 Lib->GetY (iOmega, ""),
367 Lib->GetIp(iOmega, ""));
368 gener->SetPtRange(0,999);
369 gener->SetWeighting(kNonAnalog);
370 gener->SetForceDecay(kNoDecay);
371 gener->SetTrackingFlag(0);
372 gGener = gener;
373 }
374 break;
375
376 case fluka:
916c29ab 377//*******************************************************
378// Example for a FLUKA Boundary Source *
379//*******************************************************
de78d77f 380 {
381 AliGenFLUKAsource *gener = new AliGenFLUKAsource(-1);
382 gener->SetFileName("$(ALICE_ROOT)/data/all32.root");
383 gener->SetPartFlag(9);
384 gener->SetAgeMax(1.e-5);
916c29ab 385// 31.7 events
de78d77f 386 gener->SetFraction(0.0315);
916c29ab 387// gener->SetFraction(0.75*0.0315);
de78d77f 388 rl->CdGAFile();
916c29ab 389// gener->SetPartFlag(10);
de78d77f 390 gener->SetMomentumRange(0,999);
b86fedbb 391 gener->SetPhiRange(0.,360.);
de78d77f 392 gener->SetThetaRange(0., 180.);
393 gener->SetAgeMax(1.e-5);
916c29ab 394
395// 31.7 events
396// gener->SetFraction(0.0315);
de78d77f 397 gGener = gener;
398 }
399 break;
916c29ab 400
de78d77f 401 case ntuple:
916c29ab 402//*******************************************************
403// Example for reading from a external file *
404//*******************************************************
de78d77f 405 {
406 AliGenExtFile *gener = new AliGenExtFile(-1);
407 gener->SetVertexSmear(kPerEvent);
408 gener->SetTrackingFlag(1);
409
410 AliGenReaderTreeK * reader = new AliGenReaderTreeK();
411 reader->SetFileName("$(ALICE_ROOT)/data/dtujet93.root");
412 gener->SetReader(reader);
413 gGener = gener;
414 }
415 break;
916c29ab 416
de78d77f 417 case halo:
916c29ab 418//*******************************************************
419// Example for Tunnel Halo Source *
420//*******************************************************
de78d77f 421 {
422 AliGenHalo *gener = new AliGenHalo(ntracks);
423 gener->SetFileName("/h1/morsch/marsip/marsip5.mu");
424 gGener = gener;
425 }
426 break;
427
428 case cocktail:
916c29ab 429//*******************************************************
430// Example for a Cocktail *
431//*******************************************************
de78d77f 432 {
433 AliGenCocktail *gener = new AliGenCocktail();
916c29ab 434
de78d77f 435 gener->SetPhiRange(0,360);
436 gener->SetYRange(2.5,4);
437 gener->SetThetaRange(2,9);
438 gener->SetPtRange(0,10);
439 gener->SetOrigin(0,0,0); //vertex position
440 gener->SetSigma(0,0,0); //Sigma in (X,Y,Z) (cm) on IP position
441 gener->SetMomentumRange(0,999);
916c29ab 442
de78d77f 443 AliGenParam *jpsi = new AliGenParam(1,AliGenMUONlib::kJpsi);
444 jpsi->SetForceDecay(kDiMuon);
445 jpsi->SetCutOnChild(1);
916c29ab 446
447
de78d77f 448 AliGenFLUKAsource *bg = new AliGenFLUKAsource(-1);
449 bg->AddFile("$(ALICE_ROOT)/data/all32.root");
450 rl->CdGAFile();
451 bg->SetPartFlag(9);
452 bg->SetAgeMax(1.e-5);
916c29ab 453// 31.7 events
454// gener->SetFraction(0.0315);
de78d77f 455 bg->SetFraction(0.01*0.0315);
916c29ab 456
de78d77f 457 gener->AddGenerator(jpsi,"J/Psi", 1);
458 gener->AddGenerator(bg,"Background",1);
916c29ab 459
de78d77f 460 gGener = gener;
461 }
462 break;
463 }
916c29ab 464
465// Activate this line if you want the vertex smearing to happen
466// track by track
467//
aee8290b 468// gener->SetVertexSmear(kPerTrack);
916c29ab 469
de78d77f 470 gGener->Init();
916c29ab 471
de78d77f 472 gAlice->SetField(-999,2); //Specify maximum magnetic field in Tesla (neg. ==> default field)
916c29ab 473
de78d77f 474 Int_t iMAG=1;
475 rl->CdGAFile();
916c29ab 476
477//=================== Alice BODY parameters =============================
de78d77f 478 AliBODY *BODY = new AliBODY("BODY","Alice envelop");
916c29ab 479
480
de78d77f 481 if(iMAG) {
916c29ab 482//=================== MAG parameters ============================
483// --- Start with Magnet since detector layouts may be depending ---
484// --- on the selected Magnet dimensions ---
de78d77f 485 AliMAG *MAG = new AliMAG("MAG","Magnet");
486 }
916c29ab 487}