STEER/STEER: Install AliRawDataHeaderSim.h for HMPID AMORE module
[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
11fd300a 31enum gentype_t {hijing, hijingParam, gun, box, pythia, herwig, mcatnlo,
11a136ef 32 param1, param2, param3, param4,
08b9b499 33 cocktail, fluka, halo, ntuple, scan};
916c29ab 34
11fd300a 35gentype_t gentype = mcatnlo;
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
9bb2665f 131 gener->SetPart(kNeutron);
de78d77f 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
9bb2665f 147 gener->SetPart(kMuonPlus);
de78d77f 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
9bb2665f 162 gener->SetPart(kMuonPlus);
de78d77f 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
11fd300a 293 case mcatnlo:
294 {
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);
312 gGener = gener;
313 }
314 break;
315
de78d77f 316 case param1:
916c29ab 317//*******************************************************
395b2e02 318// Example for J/psi Production from Parameterisation
319// using default library (AliMUONlib)
916c29ab 320//*******************************************************
de78d77f 321 {
322 AliGenParam *gener =
323 new AliGenParam(ntracks, AliGenMUONlib::kUpsilon);
324 gener->SetMomentumRange(0,999);
325 gener->SetPtRange(0,999);
b86fedbb 326 gener->SetPhiRange(0. , 360.);
de78d77f 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);
334 gGener = gener;
335 }
336 break;
395b2e02 337
de78d77f 338 case param2:
395b2e02 339//*******************************************************
340// Example for Omega Production from Parameterisation
341// specifying library.
342//*******************************************************
de78d77f 343 {
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);
351 gGener = gener;
352 }
353 break;
395b2e02 354
de78d77f 355 case param3:
395b2e02 356//*******************************************************
357// Example for Upsilon Production from Parameterisation
358// specifying library.
359// GSI style
360//*******************************************************
de78d77f 361 {
362 AliGenParam *gener = new AliGenParam(1000,new AliGenGSIlib(),
363 AliGenGSIlib::kUpsilon, "MUON");
364 gener->SetMomentumRange(0,999);
365 gener->SetPtRange(0,999);
b86fedbb 366 gener->SetPhiRange(0., 360.);
de78d77f 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);
374 gGener = gener;
375 }
376 break;
395b2e02 377
de78d77f 378 case param4:
395b2e02 379//*******************************************************
380// Example for Omega Production from Parameterisation
381// specifying library.
382// The alternative way.
383//*******************************************************
de78d77f 384 {
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);
395 gGener = gener;
396 }
397 break;
398
399 case fluka:
916c29ab 400//*******************************************************
401// Example for a FLUKA Boundary Source *
402//*******************************************************
de78d77f 403 {
404 AliGenFLUKAsource *gener = new AliGenFLUKAsource(-1);
405 gener->SetFileName("$(ALICE_ROOT)/data/all32.root");
406 gener->SetPartFlag(9);
407 gener->SetAgeMax(1.e-5);
916c29ab 408// 31.7 events
de78d77f 409 gener->SetFraction(0.0315);
916c29ab 410// gener->SetFraction(0.75*0.0315);
de78d77f 411 rl->CdGAFile();
916c29ab 412// gener->SetPartFlag(10);
de78d77f 413 gener->SetMomentumRange(0,999);
b86fedbb 414 gener->SetPhiRange(0.,360.);
de78d77f 415 gener->SetThetaRange(0., 180.);
416 gener->SetAgeMax(1.e-5);
916c29ab 417
418// 31.7 events
419// gener->SetFraction(0.0315);
de78d77f 420 gGener = gener;
421 }
422 break;
916c29ab 423
de78d77f 424 case ntuple:
916c29ab 425//*******************************************************
426// Example for reading from a external file *
427//*******************************************************
de78d77f 428 {
429 AliGenExtFile *gener = new AliGenExtFile(-1);
430 gener->SetVertexSmear(kPerEvent);
431 gener->SetTrackingFlag(1);
432
433 AliGenReaderTreeK * reader = new AliGenReaderTreeK();
434 reader->SetFileName("$(ALICE_ROOT)/data/dtujet93.root");
435 gener->SetReader(reader);
436 gGener = gener;
437 }
438 break;
916c29ab 439
de78d77f 440 case halo:
916c29ab 441//*******************************************************
442// Example for Tunnel Halo Source *
443//*******************************************************
de78d77f 444 {
445 AliGenHalo *gener = new AliGenHalo(ntracks);
446 gener->SetFileName("/h1/morsch/marsip/marsip5.mu");
447 gGener = gener;
448 }
449 break;
450
451 case cocktail:
916c29ab 452//*******************************************************
453// Example for a Cocktail *
454//*******************************************************
de78d77f 455 {
456 AliGenCocktail *gener = new AliGenCocktail();
916c29ab 457
de78d77f 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);
916c29ab 465
de78d77f 466 AliGenParam *jpsi = new AliGenParam(1,AliGenMUONlib::kJpsi);
467 jpsi->SetForceDecay(kDiMuon);
468 jpsi->SetCutOnChild(1);
916c29ab 469
470
de78d77f 471 AliGenFLUKAsource *bg = new AliGenFLUKAsource(-1);
472 bg->AddFile("$(ALICE_ROOT)/data/all32.root");
473 rl->CdGAFile();
474 bg->SetPartFlag(9);
475 bg->SetAgeMax(1.e-5);
916c29ab 476// 31.7 events
477// gener->SetFraction(0.0315);
de78d77f 478 bg->SetFraction(0.01*0.0315);
916c29ab 479
de78d77f 480 gener->AddGenerator(jpsi,"J/Psi", 1);
481 gener->AddGenerator(bg,"Background",1);
916c29ab 482
de78d77f 483 gGener = gener;
484 }
485 break;
486 }
916c29ab 487
488// Activate this line if you want the vertex smearing to happen
489// track by track
490//
aee8290b 491// gener->SetVertexSmear(kPerTrack);
916c29ab 492
de78d77f 493 gGener->Init();
916c29ab 494
de78d77f 495 gAlice->SetField(-999,2); //Specify maximum magnetic field in Tesla (neg. ==> default field)
916c29ab 496
de78d77f 497 Int_t iMAG=1;
498 rl->CdGAFile();
916c29ab 499
500//=================== Alice BODY parameters =============================
de78d77f 501 AliBODY *BODY = new AliBODY("BODY","Alice envelop");
916c29ab 502
503
de78d77f 504 if(iMAG) {
916c29ab 505//=================== MAG parameters ============================
506// --- Start with Magnet since detector layouts may be depending ---
507// --- on the selected Magnet dimensions ---
de78d77f 508 AliMAG *MAG = new AliMAG("MAG","Magnet");
509 }
916c29ab 510}