]> git.uio.no Git - u/mrichter/AliRoot.git/blame - test/generators/herwig/Config.C
Adding tests for different generators (Natalia)
[u/mrichter/AliRoot.git] / test / generators / herwig / Config.C
CommitLineData
97bd8e56 1//
2// Configuration for the first physics production 2008
3//
4
5// One can use the configuration macro in compiled mode by
6// root [0] gSystem->Load("libgeant321");
7// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
8// -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
9// root [0] .x grun.C(1,"Config.C++")
10
11#if !defined(__CINT__) || defined(__MAKECINT__)
12#include <Riostream.h>
13#include <TRandom.h>
14#include <TDatime.h>
15#include <TSystem.h>
16#include <TVirtualMC.h>
17#include <TGeant3TGeo.h>
18#include "STEER/AliRunLoader.h"
19#include "STEER/AliRun.h"
20#include "STEER/AliConfig.h"
21#include "PYTHIA6/AliDecayerPythia.h"
22#include "PYTHIA6/AliGenPythia.h"
23#include "TDPMjet/AliGenDPMjet.h"
24#include "THerwig/AliGenHerwig.h"
25#include "STEER/AliMagFCheb.h"
26#include "STRUCT/AliBODY.h"
27#include "STRUCT/AliMAG.h"
28#include "STRUCT/AliABSOv3.h"
29#include "STRUCT/AliDIPOv3.h"
30#include "STRUCT/AliHALLv3.h"
31#include "STRUCT/AliFRAMEv2.h"
32#include "STRUCT/AliSHILv3.h"
33#include "STRUCT/AliPIPEv3.h"
34#include "ITS/AliITSv11Hybrid.h"
35#include "TPC/AliTPCv2.h"
36#include "TOF/AliTOFv6T0.h"
37#include "HMPID/AliHMPIDv3.h"
38#include "ZDC/AliZDCv3.h"
39#include "TRD/AliTRDv1.h"
40#include "TRD/AliTRDgeometry.h"
41#include "FMD/AliFMDv1.h"
42#include "MUON/AliMUONv1.h"
43#include "PHOS/AliPHOSv1.h"
44#include "PHOS/AliPHOSSimParam.h"
45#include "PMD/AliPMDv1.h"
46#include "T0/AliT0v1.h"
47#include "EMCAL/AliEMCALv2.h"
48#include "ACORDE/AliACORDEv1.h"
49#include "VZERO/AliVZEROv7.h"
50#endif
51
52enum PDC06Proc_t
53{
54 kPythia6, kPhojet, kHerwig, kRunMax
55};
56
57const char * pprRunName[] =
58{ "kPythia6", "kPhojet", "kHerwig" };
59
60enum Mag_t
61{
62 kNoField, k5kG, kFieldMax
63};
64
65const char * pprField[] =
66{ "kNoField", "k5kG" };
67
68enum PprTrigConf_t
69{
70 kDefaultPPTrig, kDefaultPbPbTrig
71};
72
73const char * pprTrigConfName[] =
74{ "p-p", "Pb-Pb" };
75
76static PprTrigConf_t strig = kDefaultPPTrig;// default PP trigger configuration
77
78//--- Functions ---
79
80class AliGenPythia;
81AliGenerator *MbPythia();
82AliGenerator *MbPhojet();
83AliGenerator *Herwig();
84void ProcessEnvironmentVars();
85
86// Geterator, field, beam energy
87static PDC06Proc_t proc = kHerwig;
88static Mag_t mag = k5kG;
89static Float_t energy = 10000; // energy in CMS
90//========================//
91// Set Random Number seed //
92//========================//
93TDatime dt;
94static UInt_t seed = dt.Get();
95
96// Comment line
97static TString comment;
98
99void Config()
100{
101
102 // Get settings from environment variables
103 ProcessEnvironmentVars();
104
105 gRandom->SetSeed(seed);
106 cerr << "Seed for random number generation= " << seed << endl;
107
108 // Libraries required by geant321
109#if defined(__CINT__)
110 gSystem->Load("liblhapdf"); // Parton density functions
111 gSystem->Load("libEGPythia6"); // TGenerator interface
112 gSystem->Load("libpythia6"); // Pythia
113 gSystem->Load("libAliPythia6"); // ALICE specific implementations
114 gSystem->Load("libgeant321");
115#endif
116
117 new TGeant3TGeo("C++ Interface to Geant3");
118
119 //=======================================================================
120 // Create the output file
121
122
123 AliRunLoader* rl = 0x0;
124
125 cout << "Config.C: Creating Run Loader ..." << endl;
126 rl = AliRunLoader::Open("galice.root", AliConfig::GetDefaultEventFolderName(), "recreate");
127 if (rl == 0x0)
128 {
129 gAlice->Fatal("Config.C", "Can not instatiate the Run Loader");
130 return;
131 }
132 rl->SetCompressionLevel(2);
133 rl->SetNumberOfEventsPerFile(1000);
134 gAlice->SetRunLoader(rl);
135
136 // Set the trigger configuration: proton-proton
137 gAlice->SetTriggerDescriptor(pprTrigConfName[strig]);
138 cout << "Trigger configuration is set to " << pprTrigConfName[strig] << endl;
139
140 //
141 //=======================================================================
142 // ************* STEERING parameters FOR ALICE SIMULATION **************
143 // --- Specify event type to be tracked through the ALICE setup
144 // --- All positions are in cm, angles in degrees, and P and E in GeV
145
146
147 gMC->SetProcess("DCAY", 1);
148 gMC->SetProcess("PAIR", 1);
149 gMC->SetProcess("COMP", 1);
150 gMC->SetProcess("PHOT", 1);
151 gMC->SetProcess("PFIS", 0);
152 gMC->SetProcess("DRAY", 0);
153 gMC->SetProcess("ANNI", 1);
154 gMC->SetProcess("BREM", 1);
155 gMC->SetProcess("MUNU", 1);
156 gMC->SetProcess("CKOV", 1);
157 gMC->SetProcess("HADR", 1);
158 gMC->SetProcess("LOSS", 2);
159 gMC->SetProcess("MULS", 1);
160 gMC->SetProcess("RAYL", 1);
161
162 Float_t cut = 1.e-3; // 1MeV cut by default
163 Float_t tofmax = 1.e10;
164
165 gMC->SetCut("CUTGAM", cut);
166 gMC->SetCut("CUTELE", cut);
167 gMC->SetCut("CUTNEU", cut);
168 gMC->SetCut("CUTHAD", cut);
169 gMC->SetCut("CUTMUO", cut);
170 gMC->SetCut("BCUTE", cut);
171 gMC->SetCut("BCUTM", cut);
172 gMC->SetCut("DCUTE", cut);
173 gMC->SetCut("DCUTM", cut);
174 gMC->SetCut("PPCUTM", cut);
175 gMC->SetCut("TOFMAX", tofmax);
176
177 //======================//
178 // Set External decayer //
179 //======================//
180 TVirtualMCDecayer* decayer = new AliDecayerPythia();
181 decayer->SetForceDecay(kAll);
182 decayer->Init();
183 gMC->SetExternalDecayer(decayer);
184
185 //=========================//
186 // Generator Configuration //
187 //=========================//
188 AliGenerator* gener = 0x0;
189
190 switch (proc)
191 {
192 case kPythia6:
193 gener = MbPythia();
194 break;
195 case kPhojet:
196 gener = MbPhojet();
197 break;
198 case kHerwig:
199 gener = Herwig();
200 break;
201 }
202
203 // PRIMARY VERTEX
204 //
205 gener->SetOrigin(0., 0., 0.); // vertex position
206 //
207 // Size of the interaction diamond
208 // Longitudinal
209 Float_t sigmaz = 5.4 / TMath::Sqrt(2.); // [cm]
210 if (energy == 900)
211 sigmaz = 10.5 / TMath::Sqrt(2.); // [cm]
212 //
213 // Transverse
214 Float_t betast = 10; // beta* [m]
215 Float_t eps = 3.75e-6; // emittance [m]
216 Float_t gamma = energy / 2.0 / 0.938272; // relativistic gamma [1]
217 Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.; // [cm]
218 printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
219
220 gener->SetSigma(sigmaxy, sigmaxy, sigmaz); // Sigma in (X,Y,Z) (cm) on IP position
221 gener->SetCutVertexZ(3.); // Truncate at 3 sigma
222 gener->SetVertexSmear(kPerEvent);
223
224 gener->Init();
225
226 // FIELD
227 AliMagF* field = 0x0;
228
229 if (mag == kNoField)
230 {
231 comment = comment.Append(" | L3 field 0.0 T");
232 field = new AliMagF("Maps", "Maps", -1., -1., AliMagF::k2kG);
233 }
234 else if (mag == k5kG)
235 {
236 comment = comment.Append(" | L3 field 0.5 T");
237 field = new AliMagF("Maps", "Maps", -1., -1., AliMagF::k5kG);
238 }
239 printf("\n \n Comment: %s \n \n", comment.Data());
240
241 TGeoGlobalMagField::Instance()->SetField(field);
242
243 rl->CdGAFile();
244
245 Int_t iABSO = 1;
246 Int_t iACORDE = 0;
247 Int_t iDIPO = 1;
248 Int_t iEMCAL = 0;
249 Int_t iFMD = 1;
250 Int_t iFRAME = 1;
251 Int_t iHALL = 1;
252 Int_t iITS = 1;
253 Int_t iMAG = 1;
254 Int_t iMUON = 1;
255 Int_t iPHOS = 1;
256 Int_t iPIPE = 1;
257 Int_t iPMD = 0;
258 Int_t iHMPID = 1;
259 Int_t iSHIL = 1;
260 Int_t iT0 = 1;
261 Int_t iTOF = 1;
262 Int_t iTPC = 1;
263 Int_t iTRD = 1;
264 Int_t iVZERO = 1;
265 Int_t iZDC = 1;
266
267 //=================== Alice BODY parameters =============================
268 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
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 if (iABSO)
279 {
280 //=================== ABSO parameters ============================
281 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
282 }
283
284 if (iDIPO)
285 {
286 //=================== DIPO parameters ============================
287
288 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
289 }
290
291 if (iHALL)
292 {
293 //=================== HALL parameters ============================
294
295 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
296 }
297
298 if (iFRAME)
299 {
300 //=================== FRAME parameters ============================
301
302 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
303 FRAME->SetHoles(1);
304 }
305
306 if (iSHIL)
307 {
308 //=================== SHIL parameters ============================
309
310 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
311 }
312
313 if (iPIPE)
314 {
315 //=================== PIPE parameters ============================
316
317 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
318 }
319
320 if (iITS)
321 {
322 //=================== ITS parameters ============================
323
324 AliITS *ITS = new AliITSv11Hybrid("ITS", "ITS v11Hybrid");
325 }
326
327 if (iTPC)
328 {
329 //============================ TPC parameters =====================
330
331 AliTPC *TPC = new AliTPCv2("TPC", "Default");
332 }
333
334 if (iTOF)
335 {
336 //=================== TOF parameters ============================
337
338 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
339 }
340
341 if (iHMPID)
342 {
343 //=================== HMPID parameters ===========================
344
345 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
346
347 }
348
349 if (iZDC)
350 {
351 //=================== ZDC parameters ============================
352
353 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
354 }
355
356 if (iTRD)
357 {
358 //=================== TRD parameters ============================
359
360 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
361 AliTRDgeometry *geoTRD = TRD->GetGeometry();
362 // Partial geometry: modules at 0,1,7,8,9,10,17
363 // starting at 3h in positive direction
364 geoTRD->SetSMstatus(2, 0);
365 geoTRD->SetSMstatus(3, 0);
366 geoTRD->SetSMstatus(4, 0);
367 geoTRD->SetSMstatus(5, 0);
368 geoTRD->SetSMstatus(6, 0);
369 geoTRD->SetSMstatus(11, 0);
370 geoTRD->SetSMstatus(12, 0);
371 geoTRD->SetSMstatus(13, 0);
372 geoTRD->SetSMstatus(14, 0);
373 geoTRD->SetSMstatus(15, 0);
374 geoTRD->SetSMstatus(16, 0);
375 }
376
377 if (iFMD)
378 {
379 //=================== FMD parameters ============================
380
381 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
382 }
383
384 if (iMUON)
385 {
386 //=================== MUON parameters ===========================
387 // New MUONv1 version (geometry defined via builders)
388
389 AliMUON *MUON = new AliMUONv1("MUON", "default");
390 }
391
392 if (iPHOS)
393 {
394 //=================== PHOS parameters ===========================
395
396 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
397 //Set simulation parameters different from the default ones.
398 AliPHOSSimParam* simEmc = AliPHOSSimParam::GetInstance();
399
400 // APD noise of warm (+20C) PHOS:
401 // a2 = a1*(Y1/Y2)*(M1/M2), where a1 = 0.012 is APD noise at -25C,
402 // Y1 = 4.3 photo-electrons/MeV, Y2 = 1.7 p.e/MeV - light yields at -25C and +20C,
403 // M1 = 50, M2 = 50 - APD gain factors chosen for t1 = -25C and t2 = +20C,
404 // Y = MeanLightYield*APDEfficiency.
405
406 Float_t apdNoise = 0.012 * 2.5;
407 simEmc->SetAPDNoise(apdNoise);
408
409 //Raw Light Yield at +20C
410 simEmc->SetMeanLightYield(18800);
411
412 //ADC channel width at +18C.
413 simEmc->SetADCchannelW(0.0125);
414 }
415
416 if (iPMD)
417 {
418 //=================== PMD parameters ============================
419
420 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
421 }
422
423 if (iT0)
424 {
425 //=================== T0 parameters ============================
426 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
427 }
428
429 if (iEMCAL)
430 {
431 //=================== EMCAL parameters ============================
432
433 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
434 }
435
436 if (iACORDE)
437 {
438 //=================== ACORDE parameters ============================
439
440 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
441 }
442
443 if (iVZERO)
444 {
445 //=================== ACORDE parameters ============================
446
447 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
448 }
449}
450
451// PYTHIA
452AliGenerator* MbPythia()
453{
454 comment = comment.Append(" pp at 14 TeV: Pythia low-pt");
455
456 AliGenPythia* pythia = new AliGenPythia(-1);
457 pythia->SetMomentumRange(0, 999999.);
458 pythia->SetThetaRange(0., 180.);
459 pythia->SetYRange(-12., 12.);
460 pythia->SetPtRange(0, 1000.);
461 pythia->SetProcess(kPyMb);
462 pythia->SetEnergyCMS(energy);
463
464 return pythia;
465}
466
467// DPMJET
468AliGenerator* MbPhojet()
469{
470 comment = comment.Append(" pp at 14 TeV: Phojet low-pt");
471
472#if defined(__CINT__)
473 gSystem->Load("libdpmjet"); // Parton density functions
474 gSystem->Load("libTDPMjet"); // Parton density functions
475#endif
476
477 AliGenDPMjet* dpmjet = new AliGenDPMjet(-1);
478 dpmjet->SetMomentumRange(0, 999999.);
479 dpmjet->SetThetaRange(0., 180.);
480 dpmjet->SetYRange(-12., 12.);
481 dpmjet->SetPtRange(0, 1000.);
482 dpmjet->SetProcess(kDpmMb);
483 dpmjet->SetEnergyCMS(energy);
484
485 return dpmjet;
486}
487
488// HERWIG
489AliGenerator* Herwig()
490{
491 comment = comment.Append("pp at 14 TeV: Herwig");
492
493#if defined(__CINT__)
494 gSystem->Load("libherwig"); // HERWIG library
495 gSystem->Load("libTHerwig"); // HERWIG library
496#endif
497
498 AliGenHerwig *herwig = new AliGenHerwig(-1);
499 // final state kinematic cuts
500 herwig->SetOrigin(0,0,0); // vertex position
501 herwig->SetVertexSmear(kPerEvent);
502 herwig->SetSigma(0, 0, 5.6); // Sigma in (X,Y,Z) (cm) on IP position
503 // Beams
504 herwig->SetProjectile("P");
505 herwig->SetTarget("P");
506 // Beam momenta
507 herwig->SetBeamMomenta(3500., 3500.);
508 // bbar
509 herwig->SetProcess(1705);
510
511 return herwig;
512}
513
514void ProcessEnvironmentVars()
515{
516 // Run type
517 if (gSystem->Getenv("CONFIG_RUN_TYPE"))
518 {
519 for (Int_t iRun = 0; iRun < kRunMax; iRun++)
520 {
521 if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun]) == 0)
522 {
523 proc = (PDC06Proc_t) iRun;
524 cout << "Run type set to " << pprRunName[iRun] << endl;
525 }
526 }
527 }
528
529 // Field
530 if (gSystem->Getenv("CONFIG_FIELD"))
531 {
532 for (Int_t iField = 0; iField < kFieldMax; iField++)
533 {
534 if (strcmp(gSystem->Getenv("CONFIG_FIELD"), pprField[iField]) == 0)
535 {
536 mag = (Mag_t) iField;
537 cout << "Field set to " << pprField[iField] << endl;
538 }
539 }
540 }
541
542 // Energy
543 if (gSystem->Getenv("CONFIG_ENERGY"))
544 {
545 energy = atoi(gSystem->Getenv("CONFIG_ENERGY"));
546 cout << "Energy set to " << energy << " GeV" << endl;
547 }
548
549 // Random Number seed
550 if (gSystem->Getenv("CONFIG_SEED"))
551 {
552 seed = atoi(gSystem->Getenv("CONFIG_SEED"));
553 }
554}