]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWGLF/FORWARD/analysis2/sim/Config.C
Files for simulation jobs
[u/mrichter/AliRoot.git] / PWGLF / FORWARD / analysis2 / sim / Config.C
CommitLineData
f8b7a926 1// -------------------------------------------------------------------
2struct Setup
3{
4 TString runType; // Event generator chosen
5 UInt_t seed; // Random number seed - (env)
6 Float_t minB; // Least imp.param. (env)
7 Float_t maxB; // Largest imp.param. (env)
8 Int_t hftype; // Heavy flavour type (random)
9 /**
10 * Get the value of an environment variable as a float
11 *
12 * @param envName Enviroment variable name
13 * @param def Default value
14 *
15 * @return As float, or default
16 */
17 static Float_t Env2Float(const char* envName, Float_t def)
18 {
19 TString val(gSystem->Getenv(envName));
20 if (val.IsNull()) return def;
21 return val.Atof();
22 }
23 /**
24 * Get the value of an environment variable as a unsigned int
25 *
26 * @param envName Enviroment variable name
27 * @param def Default value
28 *
29 * @return As unsigned int, or default
30 */
31 static UInt_t Env2UInt(const char* envName, UInt_t def)
32 {
33 TString val(gSystem->Getenv(envName));
34 if (val.IsNull()) return def;
35 return UInt_t(val.Atoll());
36 }
37 /**
38 * Get the value of an environment variable as a int
39 *
40 * @param envName Enviroment variable name
41 * @param def Default value
42 *
43 * @return As int, or default
44 */
45 static UInt_t Env2Int(const char* envName, Int_t def)
46 {
47 TString val(gSystem->Getenv(envName));
48 if (val.IsNull()) return def;
49 return val.Atoi();
50 }
51
52 /**
53 * Constructor - retrieves needed information from CDB manager and
54 * environment.
55 */
56 Setup()
57 : runType(""),
58 seed(0),
59 minB(0),
60 maxB(100),
61 hftype(-1)
62 {
63 TDatime now;
64 runType = gSystem->Getenv("CONFIG_RUN_TYPE");
65 seed = Env2UInt("CONFIG_SEED", now.Get());
66 minB = Env2Float("CONFIG_BMIN", 0);
67 maxB = Env2Float("CONFIG_BMAX", 100);
68 if (runType[0] == 'k') runType.Remove(0,1);
69 runType.ToLower();
70
71 // gROOT->Macro("GetGRP.C");
72
73 Int_t pytR = gRandom->Rndm();
74 if (pytR < 0.16) hftype = 0;
75 else if (pytR < 0.32) hftype = 1;
76 else if (pytR < 0.48) hftype = 2;
77 else if (pytR < 0.64) hftype = 3;
78 else if (pytR < 0.72) hftype = 4;
79 else if (pytR < 0.80) hftype = 5;
80 else hftype = 6;
81
82 if (runType.IsNull() || runType == "default") DeduceRunType();
83
84 Print();
85 }
86 void Print()
87 {
88 Printf("=======================================================\n"
89 " Set-up of the simulation\n");
90 grp->Print();
91 Printf("Run type: '%s'", runType.Data());
92 Printf("Seed: %d", seed);
93 Printf("\n"
94 "=======================================================");
95 }
96 /**
97 * Set the default generator based on the beam type
98 *
99 * - p-p PYTHIA
100 * - p-A or A-p DPMJet
101 * - A-A Hijing
102 */
103 void DeduceRunType()
104 {
105 if (grp->IsPP()) runType = "pythia";
106 else if (grp->IsPA() || grp->IsAP()) runType = "dpmjet";
107 else if (grp->IsAA()) runType = "hijing";
108 }
109 void LoadGen() {
110 if (!gROOT->GetClass("AliStructFuncType"))
111 gSystem->Load("liblhapdf"); // Parton density functions
112 if (!gROOT->GetClass("TPythia6"))
113 gSystem->Load("libEGPythia6") // TGenerator interface
114 if (!runType.EqualTo("hydjet"))
115 LoadPythia(false);
116 }
117 /**
118 * Load the pythia libraries
119 *
120 * @param vers Optional version post-fix
121 */
122 void LoadPythia(Bool_t gen=true, const char* vers="6.4.21")
123 {
124 if (gen) LoadGen();
125 char m = vers[0];
126 if (gROOT->GetClass(Form("AliPythia6%c", m))) return;
127 gSystem->Load(Form("libpythia%s", vers));
128 gSystem->Load(Form("libAliPythia%c", m));
129 }
130 /**
131 * Load HIJING libraries
132 */
133 void LoadHijing()
134 {
135 LoadPythia();
136 if (gROOT->GetClass("THijing")) return;
137 gSystem->Load("libhijing");
138 gSystem->Load("libTHijing");
139 AliPDG::AddParticlesToPdgDataBase();
140 }
141 /**
142 * Load HydJet libraries
143 */
144 void LoadHydjet()
145 {
146 if (gROOT->GetClass("TUHKMgen")) return;
147 gSystem->Load("libTUHKMgen");
148 }
149 /**
150 * Load DPMJet libraries
151 */
152 void LoadDpmjet()
153 {
154 LoadPythia();
155 if (gROOT->GetClass("TDPMjet")) return;
156 gSystem->Load("libdpmjet");
157 gSystem->Load("libTDPMjet");
158 }
159 /**
160 * Load AMPT libraries
161 */
162 void LoadAmpt()
163 {
164 LoadPythia();
165 if (gROOT->GetClass("TAmpt")) return;
166 gSystem->Load("libampt");
167 gSystem->Load("libTAmpt");
168 }
169 /**
170 * Make the generator
171 *
172 * @return Point to newly allocated generator or null
173 */
174 AliGenerator* MakeGenerator()
175 {
176 Bool_t asym = grp->IsPA()||grp->IsAP();
177 TString& rt = runType;
178 if (rt.EndsWith("perugia0chadr")) return PythiaHF(0);
179 if (rt.EndsWith("perugia0bchadr")) return PythiaHF(1);
180 if (rt.EndsWith("perugia0cele")) return PythiaHF(2);
181 if (rt.EndsWith("perugia0bele")) return PythiaHF(3);
182 if (rt.EndsWith("perugia0jspi2e")) return PythiaHF(4);
183 if (rt.EndsWith("perugia0btojspi2e")) return PythiaHF(5);
184 if (rt.BeginsWith("pythia")) return Pythia(rt);
185 if (rt.BeginsWith("hijing2000hf")) return HFCocktail(rt);
186 if (rt.BeginsWith("hijing2000")) return Hijing(asym,
187 false, 2.3);
188 if (rt.BeginsWith("hijing")) return Hijing(asym,
189 grp->IsAA(), 0);
190 if (rt.BeginsWith("ampthf")) return HFCocktail(rt);
191 if (rt.BeginsWith("ampt")) return Ampt();
192 if (rt.BeginsWith("dpmjet")) return Dpmjet();
193 if (rt.BeginsWith("phojet")) return Dpmjet();
194 if (rt.BeginsWith("hydjet")) return Hydjet();
195
196 Fatal("", "Invalid run type \"%s\" specified", runType.Data());
197 return 0;
198 }
199 TVirtualMCDecayer* MakeDecayer()
200 {
201 if (runType.BeginsWith("hydjet")) return 0;
202
203 LoadPythia();
204 TVirtualMCDecayer* decayer = new AliDecayerPythia();
205 if (runType.EqualTo("hijing2000hf") && hftype < 2)
206 decayer->SetForceDecay(kHadronicD);
207 else
208 decayer->SetForceDecay(kAll);
209 decayer->Init();
210 return decayer;
211 }
212
213 // === PYTHIA ========================================================
214 // Normal
215 AliGenerator* Pythia(const TString & tune)
216 {
217 // Int_t kCTEQ6l = 8;
218 if (!grp->IsPP()) Fatal("Setup", "Pythia6 only works for pp");
219
220 TString t(tune);
221 t.ToUpper();
222 t.ReplaceAll("PYTHIA6", "");
223 t.ReplaceAll("PYTHIA", "");
224 Info("Setup", "Making Pythia6 event generator (tune: %s)", t.Data());
225
226 LoadPythia();
227 AliGenPythia* pythia = new AliGenPythia(-1);
228 pythia->SetMomentumRange(0, 999999.);
229 pythia->SetThetaRange(0., 180.);
230 pythia->SetYRange(-12.,12.);
231 pythia->SetPtRange(0,1000.);
232 pythia->SetProcess(kPyMb);
233 pythia->SetEnergyCMS(grp->energy);
234
235 if (t == "D6T") {
236 // Tune
237 // 109 D6T : Rick Field's CDF Tune D6T
238 // (NB: needs CTEQ6L pdfs externally)
239 pythia->SetTune(109); // F I X
240 pythia->SetStrucFunc(kCTEQ6l);
241 }
242 else if (t == "PERUGIA0") {
243 // Tune
244 // 320 Perugia 0
245 pythia->SetTune(320);
246 pythia->UseNewMultipleInteractionsScenario();
247 }
248 else if (t == "ATLAS") {
249 // Tune
250 // C 306 ATLAS-CSC: Arthur Moraes' (new) ATLAS tune
251 // (needs CTEQ6L externally)
252 pythia->SetTune(306);
253 pythia->SetStrucFunc(kCTEQ6l);
254 }
255 else if (t == "JETS") {
256 pythia->SetProcess(kPyJets);
257 pythia->SetStrucFunc(kCTEQ6l);
258 pythia->SetJetEtaRange(-1.5, 1.5);
259 pythia->SetJetEtRange(50., 800.);
260 pythia->SetPtHard(45., 1000.);
261 pythia->SetPycellParameters(2.2, 300, 432, 0., 4., 5., 0.7);
262 }
263 else if (t == "ATLAS_FLAT") {
264 // set high multiplicity trigger
265 // this weight achieves a flat multiplicity distribution
266 TH1 *weight = new TH1D("weight","weight",201,-0.5,200.5);
267 weight->SetBinContent(1,5.49443);
268 weight->SetBinContent(2,8.770816);
269 weight->SetBinContent(6,0.4568624);
270 weight->SetBinContent(7,0.2919915);
271 weight->SetBinContent(8,0.6674189);
272 weight->SetBinContent(9,0.364737);
273 weight->SetBinContent(10,0.8818444);
274 weight->SetBinContent(11,0.531885);
275 weight->SetBinContent(12,1.035197);
276 weight->SetBinContent(13,0.9394057);
277 weight->SetBinContent(14,0.9643193);
278 weight->SetBinContent(15,0.94543);
279 weight->SetBinContent(16,0.9426507);
280 weight->SetBinContent(17,0.9423649);
281 weight->SetBinContent(18,0.789456);
282 weight->SetBinContent(19,1.149026);
283 weight->SetBinContent(20,1.100491);
284 weight->SetBinContent(21,0.6350525);
285 weight->SetBinContent(22,1.351941);
286 weight->SetBinContent(23,0.03233504);
287 weight->SetBinContent(24,0.9574557);
288 weight->SetBinContent(25,0.868133);
289 weight->SetBinContent(26,1.030998);
290 weight->SetBinContent(27,1.08897);
291 weight->SetBinContent(28,1.251382);
292 weight->SetBinContent(29,0.1391099);
293 weight->SetBinContent(30,1.192876);
294 weight->SetBinContent(31,0.448944);
295 for (Int_t i = 32; i <= 201; i++) weight->SetBinContent(i,1);
296 weight->SetEntries(526);
297
298 Int_t limit = weight->GetRandom();
299 pythia->SetTriggerChargedMultiplicity(limit, 1.4);
300 }
301 return pythia;
302 }
303 AliGenerator* PythiaHF(Int_t type, Bool_t harder=0)
304 {
305 LoadPythia();
306 if (type == 6) return Pythia("jets");
307 if (type == 4) {
308 AliGenParam *jpsi = AliGenParam(1, AliGenMUONlib::kJpsi,
309 (harder?"CDF pp 8.8":"CDF pp 7"),"Jpsi");
310 jpsi->SetPtRange(0.,999.);
311 jpsi->SetYRange(-1.0, 1.0);
312 jpsi->SetPhiRange(0.,360.);
313 jpsi->SetForceDecay(kDiElectron);
314 return jpsi;
315 }
316 AliGenPythia* pythia = static_cast<AliGenPythia*>(Pythia("PERUGIA0"));
317 switch (type) {
318 case 0: // chadr
319 pythia->SetProcess(kPyCharmppMNRwmi);
320 pythia->SetForceDecay(kHadronicD);
321 break;
322 case 1: // bchadr
323 pythia->SetProcess(kPyBeautyppMNRwmi);
324 pythia->SetForceDecay(kHadronicD);
325 break;
326 case 2: // cele
327 pythia->SetProcess(kPyCharmppMNRwmi);
328 pythia->SetCutOnChild(1);
329 pythia->SetPdgCodeParticleforAcceptanceCut(11);
330 pythia->SetChildYRange(-1.2,1.2);
331 pythia->SetChildPtRange(0,10000.);
332 break;
333 case 3: // bele
334 pythia->SetProcess(kPyBeautyppMNRwmi);
335 pythia->SetCutOnChild(1);
336 pythia->SetPdgCodeParticleforAcceptanceCut(11);
337 pythia->SetChildYRange(-1.2,1.2);
338 pythia->SetChildPtRange(0,10000.);
339 break;
340 case 5:
341 pythia->SetProcess(kPyBeautyppMNRwmi);
342 pythia->SetCutOnChild(1);
343 pythia->SetPdgCodeParticleforAcceptanceCut(443);
344 pythia->SetChildYRange(-2,2);
345 pythia->SetChildPtRange(0,10000.);
346 }
347 return pythia;
348 }
349 /**
350 * Make a Min-Bias AA, pA, or Ap Hijing generator
351 *
352 * @param slowN If true, make a cocktail with slow neutrons
353 *
354 * @return Generator
355 */
356 AliGenerator* Hijing(Bool_t slowN=false, Bool_t quench=1, Float_t ptHard=0)
357 {
358 LoadHijing();
359 AliGenHijing *gener = new AliGenHijing(-1);
360 // centre of mass energy
361 gener->SetEnergyCMS(grp->energy);
362 gener->SetImpactParameterRange(minB, maxB);
363 // reference frame
364 gener->SetReferenceFrame("CMS");
365 // projectil
366 gener->SetProjectile(grp->beam1.Name(), grp->beam1.a, grp->beam1.z);
367 gener->SetTarget (grp->beam2.Name(), grp->beam2.a, grp->beam2.z);
368 // tell hijing to keep the full parent child chain
369 gener->KeepFullEvent();
370 // enable jet quenching
371 gener->SetJetQuenching(quench);
372 // enable shadowing
373 gener->SetShadowing(slowN);
374 // Don't track spectators
375 gener->SetSpectators(!slowN);
376 //
377 if (ptHard > 0) hi->SetPtHardMin(ptHard);
378
379 // kinematic selection
380 gener->SetSelectAll(0);
381 // Boosted CMS
382 gener->SetBoostLHC(grp->IsPA() || grp->IsAP());
383 // No need for cocktail
384 if (!slowN || !grp->IsPA() || !grp->IsAP()) return gener;
385
386 AliGenCocktail* cocktail = new AliGenCocktail();
387 cocktail->SetProjectile(grp->beam1.Name(), grp->beam1.a, grp->beam1.z);
388 cocktail->SetTarget (grp->beam2.Name(), grp->beam2.a, grp->beam2.z);
389 cocktail->SetEnergyCMS(grp->energy);
390
391 AliGenSlowNucleons* gray = new AliGenSlowNucleons(1);
392 AliCollisionGeometry* coll = gener->CollisionGeometry();
393 AliSlowNucleonModelExp* model = new AliSlowNucleonModelExp();
394 // Not yet in the release...
395 // model->SetSaturation(kTRUE);
396 gray->SetSlowNucleonModel(model);
397 gray->SetTarget(grp->beam2.a, grp->beam2.z);
398 gray->SetThetaDist(1);
399 gray->SetProtonDirection(grp->beam1.IsP() ? 1 : 2);
400 // gray->SetDebug(1);
401 gray->SetNominalCmsEnergy(2*grp->beamEnergy);
402 gray->NeedsCollisionGeometry();
403 gray->SetCollisionGeometry(coll);
404
405 cocktail->AddGenerator(gener, "Hijing pPb", 1);
406 cocktail->AddGenerator(gray, "Gray Particles", 1);
407
408 return cocktail;
409 }
410 /**
411 * Make a DPMJet generator for AA, pA, or Ap.
412 *
413 * @param fragments If true, make fragments
414 *
415 * @return Generator
416 */
417 AliGenerator* Dpmjet(Bool_t fragments=0)
418 {
419 LoadDpmjet();
420 AliGenDPMjet* dpmjet = new AliGenDPMjet(-1);
421 dpmjet->SetEnergyCMS(grp->energy);
422 dpmjet->SetProjectile(grp->beam1.Name(), grp->beam1.a, grp->beam1.z);
423 dpmjet->SetTarget (grp->beam2.Name(), grp->beam2.a, grp->beam2.z);
424 dpmjet->SetImpactParameterRange(minB, maxB);
425 dpmjet->SetProjectileBeamEnergy(grp->beam1.z*grp->beamEnergy/grp->beam1.a);
426 if (grp->IsAA()) {
427 dpmjet->SetPi0Decay(0);
428 }
429 else if (grp->IsPA() || grp->IsAP()) {
430 dpmjet->SetTriggerParticle(3312, 1.2, 2.0);
431 dpmjet->SetFragmentProd(fragments); // Alwas disabled
432 }
433 else if (grp->IsPP()) { // PhoJet
434 dpmjet->SetMomentumRange(0, 999999.);
435 dpmjet->SetThetaRange(0., 180.);
436 dpmjet->SetYRange(-12.,12.);
437 dpmjet->SetPtRange(0,1000.);
438 }
439 return dpmjet;
440 }
441 /**
442 * Make an AMPT generator for AA collisions
443 *
444 * @return Generator
445 */
446 AliGenerator* Ampt()
447 {
448 LoadAmpt();
449 AliGenAmpt *genHi = new AliGenAmpt(-1);
450 genHi->SetEnergyCMS(grp->energy);
451 genHi->SetReferenceFrame("CMS");
452 genHi->SetProjectile(grp->beam1.Name(), grp->beam1.a, grp->beam1.z);
453 genHi->SetTarget (grp->beam2.Name(), grp->beam2.a, grp->beam2.z);
454 genHi->SetPtHardMin (2);
455 genHi->SetImpactParameterRange(bMin,bMax);
456 // disable jet quenching
457 genHi->SetJetQuenching(0);
458 // enable shadowing
459 genHi->SetShadowing(1);
460 // neutral pion and heavy particle decays switched off
461 genHi->SetDecaysOff(1);
462 genHi->SetSpectators(0); // track spectators
463 genHi->KeepFullEvent();
464 genHi->SetSelectAll(0);
465 return genHi;
466 }
467 /**
468 * Make an HydJet generator for A-A
469 *
470 * @return Generator
471 */
472 AliGenerator* Hydjet()
473 {
474 LoadHydjet();
475 AliGenUHKM *genHi = new AliGenUHKM(-1);
476 genHi->SetAllParametersLHC();
477 genHi->SetProjectile(grp->beam1.Name(), grp->beam1.a, grp->beam1.z);
478 genHi->SetTarget (grp->beam2.Name(), grp->beam2.a, grp->beam2.z);
479 genHi->SetEcms(grp->energy);
480 genHi->SetEnergyCMS(grp->energy);
481 genHi->SetBmin(bMin);
482 genHi->SetBmax(bMax);
483 genHi->SetPyquenPtmin(9);
484 return genHi;
485 }
486 /**
487 * Make a heavy flavour cocktail
488 *
489 * @param base Underlying event.
490 *
491 * @return Generator
492 */
493 AliGeneator* HFCocktail(const TString& base)
494 {
495
496 AliGenCocktail *cocktail = new AliGenCocktail();
497 cocktail->SetProjectile(grp->beam1.Name(), grp->beam1.a, grp->beam1.z);
498 cocktail->SetTarget (grp->beam2.Name(), grp->beam2.a, grp->beam2.z);
499 cocktail->SetEnergyCMS(grp->energy);
500
501 // Add underlying event
502 if (base.BeginsWith("ampt", TString::kIgnoreCase)) {
503 hi = Ampt();
504 cocktail->AddGenerator(hi,"ampt",1);
505 }
506 else {
507 hi = Hijing(grp->IsPA() || grp->IsAP(), false, 2.3);
508 cocktail->AddGenerator(hi,"hijing",1);
509
510 }
511
512 // --- Default formula -------------------------------------------
513 TForumla* one = new TFormula("one", "1.");
514
515 // --- Pythia ----------------------------------------------------
516 AliGenerator* pythia = PythiaHF(hftype);
517 switch (hftype) {
518 case 6:
519 cocktail->AddGenerator(pythia, "pythiaJets", 1, one);
520 break;
521 defualt:
522 cocktail
523 ->AddGenerator(pythia, "pythiaHF", 1,
524 new TFormula("Signals",
525 "20.*(x<5.)+80./3.*(1.-x/20.)*(x>5.)"));
526 break;
527 }
528 // --- Dummy -----------------------------------------------------
529 AliGenParam* param = 0;
530
531 // --- Phos stuff ------------------------------------------------
532 AliGenPHOSlib *plib = new AliGenPHOSlib();
533 Double_t lower[] = { 0, 3, 6, 9, 12, -1 };
534 Double_t *pLow = lower;
535 for (Int_t i = 0; i < 5; i++) {
536 param = new AliGenParam(5, plib, AliGenPHOSlib::kPi0);
537 param->SetPhiRange(0., 360.) ;
538 param->SetYRange(-1.2, 1.2) ;
539 param->SetPtRange(lower[i], 30.) ;
540 cocktail->AddGenerator(param,Form("Pi0HagPt%d", i), 1., one);
541 }
542
543 // --- Jpsi->mu+ mu-----------------------------------------------
544 param = new AliGenParam(1, AliGenMUONlib::kJpsi, "CDF pp 3.94", "Jpsi");
545 param->SetPtRange(0.,999.);
546 param->SetYRange(-4.2, -2.3);
547 param->SetPhiRange(0.,360.);
548 param->SetForceDecay(kDiMuon);
549 param->SetCutOnChild(1);
550 param->SetChildPhiRange(0.,360.);
551 param->SetChildThetaRange(168.5,178.5);
552 cocktail->AddGenerator(param, "Jpsi2M", 1, one);
553
554 // --- Chi_c -> J/Psi + gamma, J/Psi -> e+e- ---------------------
555 Float_t thmin = (180./TMath::Pi())*2.*atan(exp(-1.2));
556 Float_t thmax = (180./TMath::Pi())*2.*atan(exp( 1.2));
557 param = new AliGenParam(1, AliGenMUONlib::kChic,"default","Chic");
558 param->SetMomentumRange(0, 999.); // Wide cut on the momentum
559 param->SetPtRange(0, 100.); // Wide cut on Pt
560 param->SetYRange(-2.5, 2.5);
561 param->SetCutOnChild(1); // Enable cuts on decay products
562 param->SetChildPhiRange(0., 360.);
563 // In the acceptance of the Central Barrel
564 param->SetChildThetaRange(thmin, thmax);
565 // Chi_c -> J/Psi + gamma, J/Psi -> e+e-
566 param->SetForceDecay(kChiToJpsiGammaToElectronElectron);
567 cocktail->AddGenerator(param, "Chi_c", 1, one);
568
569 // --- Dummy -----------------------------------------------------
570 AliGenBox* box = 0;
571
572 // --- Some particles --------------------------------------------
573 Double_t boxR = gRandom->Integer(3)+1;
574 Int_t boxP[] = { 310, 3122, 3312, 3322,
575 (boxR==1 ?3334: boxR==2 ?-3334: -3312) };
576 Int_t boxN[] = { 1, 1, 3, 3, 1 }
577 const char* boxT[] = { "K0s", "Lambda", "Xi-", "Xi0",
578 (boxR==1 ? "Omega-": boxR==2 ? "Omega+": "Xi+") };
579 for (Int_t i = 0; i < 5; i++) {
580 box = new AliGenBox(boxN[i]);
581 box->SetPart(boxP[i]);
582 box->SetPtRange(0,13);
583 box->SetThetaRange(45, 135);
584 cocktail->AddGenerator(box, boxT[i], 1, one);
585 }
586
587 // --- High pT charged particle ----------------------------------
588 TFormula* hptF = new TFormula("High Pt",
589 "5.*(x<5.)+20./3.*(1.-x/20.)*(x > 5.)");
590 Int_t hptP[] = { 211, 321, 2212 };
591 const char* hptT[] = { "pi", "K", "p" };
592 for (Int_t i = 0; i < 3; i++) {
593 for (Int_t j = -1; j <= 1; j++) {
594 box->SetPart(j*hptP[i]);
595 box->SetPtRange(2., 50.);
596 box->SetThetaRange(thmin, thmax);
597 cocktail->AddGenerator(box, Form("%s%c",hptT[i],(j<0,'-','+')),1,hptF);
598 }
599 }
600 return cocktail;
601 }
602};
603
604
605
606
607
608void Config()
609{
610 // --- Get settings from environment variables --------------------
611 Setup s;
612
613 // ---- Seed random number generator -------------------------------
614 gRandom->SetSeed(s.seed);
615 std::cerr << "Seed for random number generation= " << s.seed << std::endl;
616
617 //------------------------------------------------------------------
618 //
619 // Geometry and tracking
620 //
621 // --- Libraries required by geant321 ------------------------------
622 s.LoadGen();
623 gSystem->Load("libgeant321");
624 new TGeant3TGeo("C++ Interface to Geant3");
625
626 // -----------------------------------------------------------------
627 // Create the output file
628 std::cout<< "Config.C: Creating Run Loader ..." << std::endl;
629 AliRunLoader* rl = AliRunLoader::Open("galice.root",
630 AliConfig::GetDefaultEventFolderName(),
631 "recreate");
632 if (!rl) Fatal("Config","Can not instatiate the Run Loader");
633
634 rl->SetCompressionLevel(2);
635 rl->SetNumberOfEventsPerFile(1000);
636 gAlice->SetRunLoader(rl);
637
638 // --- Trigger configuration ---------------------------------------
639 // AliSimulation::Instance()->SetTriggerConfig(grp->IsAA() ? "Pb-Pb" : "p-p");
640
641 //
642 //=======================================================================
643 // Steering parameters for ALICE simulation
644 //
645 // --- Specify event type to be tracked through the ALICE setup
646 // --- All positions are in cm, angles in degrees, and P and E in GeV
647
648 // --- Process switches --------------------------------------------
649 gMC->SetProcess("DCAY",1);
650 gMC->SetProcess("PAIR",1);
651 gMC->SetProcess("COMP",1);
652 gMC->SetProcess("PHOT",1);
653 gMC->SetProcess("PFIS",0);
654 gMC->SetProcess("DRAY",0);
655 gMC->SetProcess("ANNI",1);
656 gMC->SetProcess("BREM",1);
657 gMC->SetProcess("MUNU",1);
658 gMC->SetProcess("CKOV",1);
659 gMC->SetProcess("HADR",1);
660 gMC->SetProcess("LOSS",2);
661 gMC->SetProcess("MULS",1);
662 gMC->SetProcess("RAYL",1);
663
664 Float_t cut = 1.e-3; // 1MeV cut by default
665 Float_t tofmax = 1.e10;
666
667 // --- Tracking cuts -----------------------------------------------
668 gMC->SetCut("CUTGAM", cut);
669 gMC->SetCut("CUTELE", cut);
670 gMC->SetCut("CUTNEU", cut);
671 gMC->SetCut("CUTHAD", cut);
672 gMC->SetCut("CUTMUO", cut);
673 gMC->SetCut("BCUTE", cut);
674 gMC->SetCut("BCUTM", cut);
675 gMC->SetCut("DCUTE", cut);
676 gMC->SetCut("DCUTM", cut);
677 gMC->SetCut("PPCUTM", cut);
678 gMC->SetCut("TOFMAX", tofmax);
679
680 // --- Set External decayer ----------------------------------------
681 TVirtualMCDecayer* decayer = s.MakeDecayer();
682 if (decayer) gMC->SetExternalDecayer(decayer);
683
684 //------------------------------------------------------------------
685 //
686 // Generator Configuration
687 //
688 // --- Make the generator - this loads libraries
689 AliGenerator* gener = s.MakeGenerator();
690 gener->Init();
691
692 // --- Go back to galice.root --------------------------------------
693 rl->CdGAFile();
694
695 // --- Switch on and off detectors ---------------------------------
696 Int_t iABSO = 1;
697 Int_t iACORDE= 0;
698 Int_t iDIPO = 1;
699 Int_t iEMCAL = 1;
700 Int_t iFMD = 1;
701 Int_t iFRAME = 1;
702 Int_t iHALL = 1;
703 Int_t iITS = 1;
704 Int_t iMAG = 1;
705 Int_t iMUON = 1;
706 Int_t iPHOS = 1;
707 Int_t iPIPE = 1;
708 Int_t iPMD = 1;
709 Int_t iHMPID = 1;
710 Int_t iSHIL = 1;
711 Int_t iT0 = 1;
712 Int_t iTOF = 1;
713 Int_t iTPC = 1;
714 Int_t iTRD = 1;
715 Int_t iVZERO = 1;
716 Int_t iZDC = 1;
717
718
719 //=================== Alice BODY parameters =============================
720 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
721
722
723 if (iMAG) new AliMAG("MAG", "Magnet");
724 if (iABSO) new AliABSOv3("ABSO", "Muon Absorber");
725 if (iDIPO) new AliDIPOv3("DIPO", "Dipole version 3");
726 if (iHALL) new AliHALLv3("HALL", "Alice Hall");
727 if (iFRAME) (new AliFRAMEv2("FRAME", "Space Frame"))->SetHoles(1);
728 if (iSHIL) new AliSHILv3("SHIL", "Shielding Version 3");
729 if (iPIPE) new AliPIPEv3("PIPE", "Beam Pipe");
730 if (iITS) new AliITSv11("ITS","ITS v11");
731 // if (iITS) new AliITSv11Hybrid("ITS","ITS v11Hybrid");
732 if (iTPC) new AliTPCv2("TPC", "Default");
733 if (iTOF) new AliTOFv6T0("TOF", "normal TOF");
734 if (iHMPID) new AliHMPIDv3("HMPID", "normal HMPID");
735 if (iZDC) {
736 AliZDC *ZDC = 0;
737 if (grp->period.EqualTo("LHC10h")) {
738 // Need to use older ZDC for PbPb
739 ZDC = new AliZDCv3("ZDC", "normal ZDC");
740 ZDC->SetSpectatorsTrack();
741 }
742 else
743 ZDC = new AliZDCv4("ZDC", "normal ZDC");
744 if (grp->Year() < 2011) { //?
745 // What are these? Do they need to be set properly?
746 //Collimators aperture
747 ZDC->SetVCollSideCAperture(0.85);
748 ZDC->SetVCollSideCCentre(0.);
749 ZDC->SetVCollSideAAperture(0.75);
750 ZDC->SetVCollSideACentre(0.);
751 //Detector position
752 ZDC->SetYZNC(1.6);
753 ZDC->SetYZNA(1.6);
754 ZDC->SetYZPC(1.6);
755 ZDC->SetYZPA(1.6);
756 }
757 ZDC->SetLumiLength(0.);
758 if (grp->IsPA() || grp->IsAP()) {
759 ZDC->SetpAsystem();
760 ZDC->SetBeamEnergy(82.*grp->beamEnergy/208.);
761 }
762 }
763 if (iTRD) {
764 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
765 AliTRDgeometry *geoTRD = TRD->GetGeometry();
766 // Total of 18 super modules. We turn them all off by default
767 for (Int_t i = 0; i < 18; i++) geoTRD->SetSMstatus(i, 0);
768
769 // '09-'10 had 7 super modules
770 geoTRD->SetSMstatus( 0,1);
771 geoTRD->SetSMstatus( 1,1);
772 geoTRD->SetSMstatus( 7,1);
773 geoTRD->SetSMstatus( 8,1);
774 geoTRD->SetSMstatus( 9,1);
775 geoTRD->SetSMstatus(14,1);//?
776 geoTRD->SetSMstatus(17,1);
777
778 // In jan '11 3 more were added
779 if (grp->Year() > 2010) {
780 geoTRD->SetSMstatus(11, 1);
781 geoTRD->SetSMstatus(15, 1);
782 geoTRD->SetSMstatus(16, 1);//?
783 }
784
785 // In the 2012 shutdow 3 more were added
786 if (grp->Year() > 2012) {
787 geoTRD->SetSMstatus( 2,1);
788 geoTRD->SetSMstatus( 3,1);
789 geoTRD->SetSMstatus( 6,1);
790 }
791 if (grp->Year() > 2014) {
792 geoTRD->SetSMstatus( 4,1);
793 geoTRD->SetSMstatus( 5,1);
794 geoTRD->SetSMstatus(10,1);
795 geoTRD->SetSMstatus(12,1);
796 geoTRD->SetSMstatus(13,1);
797 }
798 }
799 if (iFMD) new AliFMDv1("FMD", "normal FMD");
800 if (iMUON) {
801 AliMUON *MUON = new AliMUONv1("MUON", "default");
802 MUON->SetTriggerEffCells(1); // not needed if raw masks
803 MUON->SetTriggerResponseV1(2);
804 }
805 if (iPHOS) new AliPHOSv1("PHOS", "noCPV_Modules123");
806 if (iPMD) new AliPMDv1("PMD", "normal PMD");
807 if (iT0) new AliT0v1("T0", "T0 Detector");
808 if (iEMCAL) new AliEMCALv2("EMCAL", "EMCAL_COMPLETE12SMV1");
809 if (iACORDE) new AliACORDEv1("ACORDE", "normal ACORDE");
810 if (iVZERO) new AliVZEROv7("VZERO", "normal VZERO");
811}
812
813
814
815
816//
817// EOF
818//