Fixes for bug #52499: Field polarities inconsistiency
[u/mrichter/AliRoot.git] / prod / LHC08d15 / Config.C
CommitLineData
333b9f18 1// One can use the configuration macro in compiled mode by
2// root [0] gSystem->Load("libgeant321");
3// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
4// -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
5// root [0] .x grun.C(1,"Config_PDC07.C++")
6
7#if !defined(__CINT__) || defined(__MAKECINT__)
8#include <Riostream.h>
9#include <TRandom.h>
10#include <TDatime.h>
11#include <TSystem.h>
12#include <TVirtualMC.h>
13#include <TGeant3TGeo.h>
14#include "EVGEN/AliGenCocktail.h"
15#include "EVGEN/AliGenParam.h"
16#include "EVGEN/AliGenMUONlib.h"
17#include "STEER/AliRunLoader.h"
18#include "STEER/AliRun.h"
19#include "STEER/AliConfig.h"
20#include "PYTHIA6/AliDecayerPythia.h"
21#include "PYTHIA6/AliGenPythia.h"
99c7d495 22#include "STEER/AliMagF.h"
333b9f18 23#include "STRUCT/AliBODY.h"
24#include "STRUCT/AliMAG.h"
25#include "STRUCT/AliABSOv3.h"
26#include "STRUCT/AliDIPOv3.h"
27#include "STRUCT/AliHALLv3.h"
28#include "STRUCT/AliFRAMEv2.h"
29#include "STRUCT/AliSHILv3.h"
30#include "STRUCT/AliPIPEv3.h"
31#include "ITS/AliITSv11Hybrid.h"
32#include "TPC/AliTPCv2.h"
33#include "TOF/AliTOFv6T0.h"
34#include "HMPID/AliHMPIDv3.h"
35#include "ZDC/AliZDCv3.h"
36#include "TRD/AliTRDv1.h"
37#include "TRD/AliTRDgeometry.h"
38#include "FMD/AliFMDv1.h"
39#include "MUON/AliMUONv1.h"
40#include "PHOS/AliPHOSv1.h"
41#include "PHOS/AliPHOSSimParam.h"
42#include "PMD/AliPMDv1.h"
43#include "T0/AliT0v1.h"
44#include "EMCAL/AliEMCALv2.h"
45#include "ACORDE/AliACORDEv1.h"
46#include "VZERO/AliVZEROv7.h"
47#endif
48
49
50enum PDC07Proc_t
51{
52//--- Heavy Flavour Production ---
53 kCharmPbPb5500, kCharmpPb8800, kCharmpp14000, kCharmpp14000wmi,
54 kD0PbPb5500, kD0pPb8800, kD0pp14000,
55 kDPlusPbPb5500, kDPluspPb8800, kDPluspp14000,
56 kBeautyPbPb5500, kBeautypPb8800, kBeautypp14000, kBeautypp14000wmi,
57 // -- Pythia Mb
58 kPyMbNoHvq, kPyOmegaPlus, kPyOmegaMinus, kPyJetJet, kBeautyppwmiJet,kPyBJetEMCAL,
59 kPyGammaJetPHOS, kPyJetJetPHOS, kPyJetJetPHOSv2, kPyGammaBremsPHOS,
60 kPyGammaJetEMCAL, kPyJetJetEMCAL, kPyGammaBremsEMCAL, kRunMax
61};
62
63const char * pprRunName[] = {
64 "kCharmPbPb5500", "kCharmpPb8800", "kCharmpp14000", "kCharmpp14000wmi",
65 "kD0PbPb5500", "kD0pPb8800", "kD0pp14000",
66 "kDPlusPbPb5500", "kDPluspPb8800", "kDPluspp14000",
67 "kBeautyPbPb5500", "kBeautypPb8800", "kBeautypp14000", "kBeautypp14000wmi",
68 "kPyMbNoHvq", "kPyOmegaPlus", "kPyOmegaMinus", "kPyJetJet", "kBeautyppwmiJet", "kPyBJetEMCAL",
69 "kPyGammaJetPHOS", "kPyJetJetPHOS", "kPyJetJetPHOSv2", "kPyGammaBremsPHOS",
70 "kPyGammaJetEMCAL", "kPyJetJetEMCAL", "kPyGammaBremsEMCAL"
71};
72
73
74//--- Decay Mode ---
75enum DecayHvFl_t
76{
77 kNature, kHadr, kSemiEl, kSemiMu
78};
79//--- Magnetic Field ---
80enum Mag_t
81{
82 kNoField, k5kG, kFieldMax
83};
84//--- Trigger config ---
85enum TrigConf_t
86{
87 kDefaultPPTrig, kDefaultPbPbTrig
88};
89
90const char * TrigConfName[] = {
91 "p-p","Pb-Pb"
92};
93
94//--- Functions ---
95class AliGenPythia ;
96AliGenPythia *PythiaHVQ(PDC07Proc_t proc);
97AliGenPythia *PythiaHard(PDC07Proc_t proc);
98AliGenerator *MbCocktail();
99AliGenerator *PyMbTriggered(Int_t pdg);
100void ProcessEnvironmentVars();
101
102// This part for configuration
103static DecayHvFl_t decHvFl = kNature;
104static Mag_t mag = k5kG;
105static TrigConf_t trig = kDefaultPPTrig; // default pp trigger configuration
106static Int_t runNumber = 0;
107static Int_t eventNumber = 0;
108//========================//
109// Set Random Number seed //
110//========================//
111TDatime dt;
112static UInt_t seed = dt.Get();
113
114// nEvts = -1 : you get 1 QQbar pair and all the fragmentation and
115// decay chain
116// nEvts = N>0 : you get N charm / beauty Hadrons
117Int_t nEvts = -1;
118// stars = kTRUE : all heavy resonances and their decay stored
119// = kFALSE: only final heavy hadrons and their decays stored
120Bool_t stars = kTRUE;
121
122// To be used only with kCharmpp14000wmi and kBeautypp14000wmi
123// To get a "reasonable" agreement with MNR results, events have to be
124// generated with the minimum ptHard set to 2.76 GeV.
125// To get a "perfect" agreement with MNR results, events have to be
126// generated in four ptHard bins with the following relative
127// normalizations:
128// CHARM
129// 2.76-3 GeV: 25%
130// 3-4 GeV: 40%
131// 4-8 GeV: 29%
132// >8 GeV: 6%
133// BEAUTY
134// 2.76-4 GeV: 5%
135// 4-6 GeV: 31%
136// 6-8 GeV: 28%
137// >8 GeV: 36%
138
139
140Float_t eCMS=14000;
141//PDC07Proc_t proc = kPyJetJet;
142//PDC07Proc_t proc = kPyGammaJetEMCAL;
143PDC07Proc_t proc = kPyBJetEMCAL;
144Int_t nPtHardGJBins = 11;
145Int_t ptHardGJLo[] = {5 ,10,20,30,40,50,60,70,80,90 ,100};
146Int_t ptHardGJHi[] = {10,20,30,40,50,60,70,80,90,100,-1};
147Int_t nPtHardJJBins = 17;
148Int_t ptHardJJLo[] = {2 ,12,16,20,24,29,35,41,50,60,72,86 ,104,124,149,179,215};
149Int_t ptHardJJHi[] = {12,16,20,24,29,35,41,50,60,72,86,104,124,149,179,215,258};
150Float_t ptHardMin = 10.;
151Float_t ptHardMax = 20.;
152Float_t ptGammaPi0Min = 0.;
153Int_t iquenching = 0;
154Float_t qhat = 20.; //for iquenching equal 1 and 4
155//Float_t medlength = 6.; // for iquenching equal to 4
156Int_t year = 0; //ALICE geometry configuration
157Bool_t pi0FragPhotonInDet = kFALSE ;
158
159// Comment line
160static TString comment;
161
162void Config()
163{
164
165 // Get settings from environment variables
166 ProcessEnvironmentVars();
167
168 gSystem->Load("liblhapdf.so"); // Parton density functions
169 gSystem->Load("libEGPythia6.so"); // TGenerator interface
170 if(iquenching !=4) gSystem->Load("libpythia6.so"); // Pythia
171 else gSystem->Load("libqpythia.so"); // qpythia
172 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
173
174 // libraries required by geant321
175#if defined(__CINT__)
176 gSystem->Load("liblhapdf");
177 gSystem->Load("libEGPythia6");
178 if(iquenching !=4) gSystem->Load("libpythia6.so"); // Pythia
179 else gSystem->Load("libqpythia.so"); // qpythia
180 gSystem->Load("libAliPythia6");
181 gSystem->Load("libgeant321");
182#endif
183
184 new TGeant3TGeo("C++ Interface to Geant3");
185
186 // Output every 100 tracks
187 ((TGeant3*)gMC)->SetSWIT(4,100);
188
189 //=======================================================================
190
191 // Run loader
192 AliRunLoader* rl=0x0;
193 rl = AliRunLoader::Open("galice.root",
194 AliConfig::GetDefaultEventFolderName(),
195 "recreate");
196 if (rl == 0x0)
197 {
198 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
199 return;
200 }
201 rl->SetCompressionLevel(2);
202 rl->SetNumberOfEventsPerFile(1000);
203 gAlice->SetRunLoader(rl);
204
205 // Set the trigger configuration
206 gAlice->SetTriggerDescriptor(TrigConfName[trig]);
207 cout<<"Trigger configuration is set to "<<TrigConfName[trig]<<endl;
208
209 //
210 //=======================================================================
211 // ************* STEERING parameters FOR ALICE SIMULATION **************
212 // --- Specify event type to be tracked through the ALICE setup
213 // --- All positions are in cm, angles in degrees, and P and E in GeV
214
215
216 gMC->SetProcess("DCAY",1);
217 gMC->SetProcess("PAIR",1);
218 gMC->SetProcess("COMP",1);
219 gMC->SetProcess("PHOT",1);
220 gMC->SetProcess("PFIS",0);
221 gMC->SetProcess("DRAY",0);
222 gMC->SetProcess("ANNI",1);
223 gMC->SetProcess("BREM",1);
224 gMC->SetProcess("MUNU",1);
225 gMC->SetProcess("CKOV",1);
226 gMC->SetProcess("HADR",1);
227 gMC->SetProcess("LOSS",2);
228 gMC->SetProcess("MULS",1);
229 gMC->SetProcess("RAYL",1);
230
231 Float_t cut = 1.e-3; // 1MeV cut by default
232 Float_t tofmax = 1.e10;
233
234 gMC->SetCut("CUTGAM", cut);
235 gMC->SetCut("CUTELE", cut);
236 gMC->SetCut("CUTNEU", cut);
237 gMC->SetCut("CUTHAD", cut);
238 gMC->SetCut("CUTMUO", cut);
239 gMC->SetCut("BCUTE", cut);
240 gMC->SetCut("BCUTM", cut);
241 gMC->SetCut("DCUTE", cut);
242 gMC->SetCut("DCUTM", cut);
243 gMC->SetCut("PPCUTM", cut);
244 gMC->SetCut("TOFMAX", tofmax);
245
246 //======================//
247 // Set External decayer //
248 //======================//
249 TVirtualMCDecayer* decayer = new AliDecayerPythia();
250 // DECAYS
251 //
252 switch(decHvFl) {
253 case kNature:
254 decayer->SetForceDecay(kNeutralPion);
255 break;
256 case kHadr:
257 decayer->SetForceDecay(kHadronicD);
258 break;
259 case kSemiEl:
260 decayer->SetForceDecay(kSemiElectronic);
261 break;
262 case kSemiMu:
263 decayer->SetForceDecay(kSemiMuonic);
264 break;
265 }
266 decayer->Init();
267 gMC->SetExternalDecayer(decayer);
268 //if(proc == kPyJetJetPHOSv2) // in this case we decay the pi0
269 // decayer->SetForceDecay(kNeutralPion);
270
271 //=========================//
272 // Generator Configuration //
273 //=========================//
274 AliGenPythia* gener = 0x0;
275
276 if (proc <= kBeautypp14000wmi) {
277 AliGenPythia *pythia = PythiaHVQ(proc);
278 // FeedDown option
279 pythia->SetFeedDownHigherFamily(kFALSE);
280 // Stack filling option
281 if(!stars) pythia->SetStackFillOpt(AliGenPythia::kParentSelection);
282 // Set Count mode
283 if(nEvts>0) pythia->SetCountMode(AliGenPythia::kCountParents);
284 //
285 // DECAYS
286 //
287 switch(decHvFl) {
288 case kNature:
289 pythia->SetForceDecay(kNeutralPion);
290 break;
291 case kHadr:
292 pythia->SetForceDecay(kHadronicD);
293 break;
294 case kSemiEl:
295 pythia->SetForceDecay(kSemiElectronic);
296 break;
297 case kSemiMu:
298 pythia->SetForceDecay(kSemiMuonic);
299 break;
300 }
301 //
302 // GEOM & KINE CUTS
303 //
304 pythia->SetMomentumRange(0,99999999);
305 pythia->SetPhiRange(0., 360.);
306 pythia->SetThetaRange(0,180);
307 switch(ycut) {
308 case kFull:
309 pythia->SetYRange(-12,12);
310 break;
311 case kBarrel:
312 pythia->SetYRange(-2,2);
313 break;
314 case kMuonArm:
315 pythia->SetYRange(1,6);
316 break;
317 }
318 gener = pythia;
319 } else if (proc == kPyMbNoHvq) {
320 gener = MbCocktail();
321 } else if (proc == kPyOmegaMinus) {
322 gener = PyMbTriggered(3334);
323 } else if (proc == kPyOmegaPlus) {
324 gener = PyMbTriggered(-3334);
325 } else if (proc <= kPyGammaBremsEMCAL) {
326 AliGenPythia *pythia = PythiaHard(proc);
327 // FeedDown option
328 pythia->SetFeedDownHigherFamily(kFALSE);
329 // Set Count mode
330 if(nEvts>0) pythia->SetCountMode(AliGenPythia::kCountParents);
331
332 //
333 // GEOM & KINE CUTS
334 //
335 pythia->SetMomentumRange(0,99999999);
336// if(proc == kPyJetJetPHOSv2)
337// pythia->SetForceDecay(kNeutralPion);
338// else
339// pythia->SetForceDecay(kAll);
340
341 pythia->SetForceDecay(kNeutralPion);
342 pythia->SetPycellParameters(2., 274, 432, 0., 4., 5., 1.0);
343 pythia->SetGluonRadiation(1,1); //ISR and FRS effects on.
344 pythia->SetPtKick(3.); // set the intrinsic kt to about 5.3 GeV/c
345 gener = pythia;
346 }
347
348 //gener->SetTrackingFlag(1);
349
350 //Quenching
351 gener->SetQuench(iquenching);
352 Float_t k = 6e5*(qhat/1.7) ; //qhat=1.7, k = 6e5, default value
353 if(iquenching == 1)//quenching weights
354 AliPythia::Instance()->InitQuenching(0.,0.1,k,0,0.95,6);
355 else if(iquenching == 4)//q-pythia
356 gener->SetQhat(k); // !transport coefficient (GeV2/fm)
357
358
359 // PRIMARY VERTEX
360
361 gener->SetOrigin(0., 0., 0.); // vertex position
362
363 // Size of the interaction diamond
364 // Longitudinal
365 Float_t sigmaz = 7.55 / TMath::Sqrt(2.); // [cm] 14 TeV (p-p), 5.5 TeV (Pb-Pb)
366 if(eCMS == 10000) sigmaz = 5.4 / TMath::Sqrt(2.); // [cm] 10 TeV
367 if(eCMS == 900) sigmaz = 10.5 / TMath::Sqrt(2.); // [cm] 0.9 TeV
368 cout<<">>> SigmaZ x srqt(2.) "<< sigmaz * TMath::Sqrt(2.) << endl;
369
370 // Transverse
371 Float_t betast = 10; // beta* [m]
372 Float_t eps = 3.75e-6; // emittance [m]
373 Float_t gamma = eCMS / 2.0 / 0.938272; // relativistic gamma [1]
374 Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.; // [cm]
375 printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
376
377 gener->SetSigma(sigmaxy, sigmaxy, sigmaz); // Sigma in (X,Y,Z) (cm) on IP position
378 gener->SetCutVertexZ(3.); // Truncate at 3 sigma
379 gener->SetVertexSmear(kPerEvent);
380
381 gener->Init();
382
383
384 // FIELD
385 //
99c7d495 386
387 AliMagWrapCheb* field = 0x0;
388 AliMagF* field = 0x0;
333b9f18 389 if (mag == kNoField) {
390 comment = comment.Append(" | L3 field 0.0 T");
99c7d495 391 field = new AliMagF("Maps","Maps", 2, 0., 0., 10., AliMagF::k5kGUniform);
333b9f18 392 } else if (mag == k5kG) {
393 comment = comment.Append(" | L3 field 0.5 T");
99c7d495 394 field = new AliMagF("Maps","Maps", 2, -1., -1., 10., AliMagF::k5kG);
333b9f18 395 }
396 printf("\n \n Comment: %s \n \n", comment.Data());
99c7d495 397 TGeoGlobalMagField::Instance()->SetField(field);
398
333b9f18 399 rl->CdGAFile();
400 gAlice->SetField(field);
401
402
403 Int_t iABSO = 1;
404 Int_t iACORDE = 0;
405 Int_t iDIPO = 1;
406 Int_t iEMCAL = 1;
407 Int_t iFMD = 1;
408 Int_t iFRAME = 1;
409 Int_t iHALL = 1;
410 Int_t iITS = 1;
411 Int_t iMAG = 1;
412 Int_t iMUON = 1;
413 Int_t iPHOS = 1;
414 Int_t iPIPE = 1;
415 Int_t iPMD = 1;
416 Int_t iHMPID = 1;
417 Int_t iSHIL = 1;
418 Int_t iT0 = 1;
419 Int_t iTOF = 1;
420 Int_t iTPC = 1;
421 Int_t iTRD = 1;
422 Int_t iVZERO = 1;
423 Int_t iZDC = 1;
424
425
426 //=================== Alice BODY parameters =============================
427 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
428
429
430 if (iMAG)
431 {
432 //=================== MAG parameters ============================
433 // --- Start with Magnet since detector layouts may be depending ---
434 // --- on the selected Magnet dimensions ---
435 AliMAG *MAG = new AliMAG("MAG", "Magnet");
436 }
437
438
439 if (iABSO)
440 {
441 //=================== ABSO parameters ============================
442 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
443 }
444
445 if (iDIPO)
446 {
447 //=================== DIPO parameters ============================
448
449 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
450 }
451
452 if (iHALL)
453 {
454 //=================== HALL parameters ============================
455
456 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
457 }
458
459
460 if (iFRAME)
461 {
462 //=================== FRAME parameters ============================
463
464 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
465 FRAME->SetHoles(1);
466 }
467
468 if (iSHIL)
469 {
470 //=================== SHIL parameters ============================
471
472 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
473 }
474
475
476 if (iPIPE)
477 {
478 //=================== PIPE parameters ============================
479
480 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
481 }
482
483 if (iITS)
484 {
485 //=================== ITS parameters ============================
486
487 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
488 }
489
490 if (iTPC)
491 {
492 //============================ TPC parameters =====================
493
494 AliTPC *TPC = new AliTPCv2("TPC", "Default");
495 }
496
497
498 if (iTOF) {
499 //=================== TOF parameters ============================
500
501 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
502 }
503
504
505 if (iHMPID)
506 {
507 //=================== HMPID parameters ===========================
508
509 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
510 }
511
512
513 if (iZDC)
514 {
515 //=================== ZDC parameters ============================
516
517 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
518 }
519
520 if (iTRD)
521 {
522 //=================== TRD parameters ============================
523
524 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
525 AliTRDgeometry *geoTRD = TRD->GetGeometry();
526 if(year == 2009){
527 // Partial geometry: modules at 0,8,9,17
528 // Partial geometry: modules at 1,7,10,16 expected for 2009
529 // starting at 3h in positive direction
530
531 //geoTRD->SetSMstatus(1,0);
532 //geoTRD->SetSMstatus(2,0);
533 //geoTRD->SetSMstatus(3,0);
534 //geoTRD->SetSMstatus(4,0);
535 //geoTRD->SetSMstatus(5,0);
536 //geoTRD->SetSMstatus(6,0);
537 //geoTRD->SetSMstatus(7,0);
538
539
540 //geoTRD->SetSMstatus(10,0);
541 //geoTRD->SetSMstatus(11,0);
542 //geoTRD->SetSMstatus(12,0);
543 //geoTRD->SetSMstatus(13,0);
544 //geoTRD->SetSMstatus(14,0);
545 //geoTRD->SetSMstatus(15,0);
546 //geoTRD->SetSMstatus(16,0);
547
548 geoTRD->SetSMstatus(2,0);
549 geoTRD->SetSMstatus(3,0);
550 geoTRD->SetSMstatus(4,0);
551 geoTRD->SetSMstatus(5,0);
552 geoTRD->SetSMstatus(6,0);
553
554 geoTRD->SetSMstatus(11,0);
555 geoTRD->SetSMstatus(12,0);
556 geoTRD->SetSMstatus(13,0);
557 geoTRD->SetSMstatus(14,0);
558 geoTRD->SetSMstatus(15,0);
559 }
560 }
561
562 if (iFMD)
563 {
564 //=================== FMD parameters ============================
565 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
566 }
567
568 if (iMUON)
569 {
570 //=================== MUON parameters ===========================
571 // New MUONv1 version (geometry defined via builders)
572 AliMUON *MUON = new AliMUONv1("MUON", "default");
573 }
574 //=================== PHOS parameters ===========================
575
576 if (iPHOS)
577 {
578 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
579 }
580
581
582 if (iPMD)
583 {
584 //=================== PMD parameters ============================
585 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
586 }
587
588 if (iT0)
589 {
590 //=================== T0 parameters ============================
591 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
592 }
593
594 if (iEMCAL)
595 {
596 //=================== EMCAL parameters ============================
597 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
598 }
599
600 if (iACORDE)
601 {
602 //=================== ACORDE parameters ============================
603 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
604 }
605
606 if (iVZERO)
607 {
608 //=================== VZERO parameters ============================
609 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
610 }
611
612 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
613}
614
615// PYTHIA
616
617AliGenPythia *PythiaHVQ(PDC07Proc_t proc) {
618//*******************************************************************//
619// Configuration file for charm / beauty generation with PYTHIA //
620// //
621// The parameters have been tuned in order to reproduce the inclusive//
622// heavy quark pt distribution given by the NLO pQCD calculation by //
623// Mangano, Nason and Ridolfi. //
624// //
625// For details and for the NORMALIZATION of the yields see: //
626// N.Carrer and A.Dainese, //
627// "Charm and beauty production at the LHC", //
628// ALICE-INT-2003-019, [arXiv:hep-ph/0311225]; //
629// PPR Chapter 6.6, CERN/LHCC 2005-030 (2005). //
630//*******************************************************************//
631 AliGenPythia * gener = 0x0;
632
633 switch(proc) {
634 case kCharmPbPb5500:
635 comment = comment.Append(" Charm in Pb-Pb at 5.5 TeV");
636 gener = new AliGenPythia(nEvts);
637 gener->SetProcess(kPyCharmPbPbMNR);
638 gener->SetStrucFunc(kCTEQ4L);
639 gener->SetPtHard(2.1,-1.0);
640 gener->SetEnergyCMS(5500.);
641 gener->SetNuclei(208,208);
642 break;
643 case kCharmpPb8800:
644 comment = comment.Append(" Charm in p-Pb at 8.8 TeV");
645 gener = new AliGenPythia(nEvts);
646 gener->SetProcess(kPyCharmpPbMNR);
647 gener->SetStrucFunc(kCTEQ4L);
648 gener->SetPtHard(2.1,-1.0);
649 gener->SetEnergyCMS(8800.);
650 gener->SetProjectile("P",1,1);
651 gener->SetTarget("Pb",208,82);
652 break;
653 case kCharmpp14000:
654 comment = comment.Append(" Charm in pp at 14 TeV");
655 gener = new AliGenPythia(nEvts);
656 gener->SetProcess(kPyCharmppMNR);
657 gener->SetStrucFunc(kCTEQ4L);
658 gener->SetPtHard(2.1,-1.0);
659 gener->SetEnergyCMS(14000.);
660 break;
661 case kCharmpp14000wmi:
662 comment = comment.Append(" Charm in pp at 14 TeV with mult. interactions");
663 gener = new AliGenPythia(-1);
664 gener->SetProcess(kPyCharmppMNRwmi);
665 gener->SetStrucFunc(kCTEQ5L);
666 gener->SetPtHard(ptHardMin,ptHardMax);
667 gener->SetEnergyCMS(14000.);
668 break;
669 case kD0PbPb5500:
670 comment = comment.Append(" D0 in Pb-Pb at 5.5 TeV");
671 gener = new AliGenPythia(nEvts);
672 gener->SetProcess(kPyD0PbPbMNR);
673 gener->SetStrucFunc(kCTEQ4L);
674 gener->SetPtHard(2.1,-1.0);
675 gener->SetEnergyCMS(5500.);
676 gener->SetNuclei(208,208);
677 break;
678 case kD0pPb8800:
679 comment = comment.Append(" D0 in p-Pb at 8.8 TeV");
680 gener = new AliGenPythia(nEvts);
681 gener->SetProcess(kPyD0pPbMNR);
682 gener->SetStrucFunc(kCTEQ4L);
683 gener->SetPtHard(2.1,-1.0);
684 gener->SetEnergyCMS(8800.);
685 gener->SetProjectile("P",1,1);
686 gener->SetTarget("Pb",208,82);
687 break;
688 case kD0pp14000:
689 comment = comment.Append(" D0 in pp at 14 TeV");
690 gener = new AliGenPythia(nEvts);
691 gener->SetProcess(kPyD0ppMNR);
692 gener->SetStrucFunc(kCTEQ4L);
693 gener->SetPtHard(2.1,-1.0);
694 gener->SetEnergyCMS(14000.);
695 break;
696 case kDPlusPbPb5500:
697 comment = comment.Append(" DPlus in Pb-Pb at 5.5 TeV");
698 gener = new AliGenPythia(nEvts);
699 gener->SetProcess(kPyDPlusPbPbMNR);
700 gener->SetStrucFunc(kCTEQ4L);
701 gener->SetPtHard(2.1,-1.0);
702 gener->SetEnergyCMS(5500.);
703 gener->SetNuclei(208,208);
704 break;
705 case kDPluspPb8800:
706 comment = comment.Append(" DPlus in p-Pb at 8.8 TeV");
707 gener = new AliGenPythia(nEvts);
708 gener->SetProcess(kPyDPluspPbMNR);
709 gener->SetStrucFunc(kCTEQ4L);
710 gener->SetPtHard(2.1,-1.0);
711 gener->SetEnergyCMS(8800.);
712 gener->SetProjectile("P",1,1);
713 gener->SetTarget("Pb",208,82);
714 break;
715 case kDPluspp14000:
716 comment = comment.Append(" DPlus in pp at 14 TeV");
717 gener = new AliGenPythia(nEvts);
718 gener->SetProcess(kPyDPlusppMNR);
719 gener->SetStrucFunc(kCTEQ4L);
720 gener->SetPtHard(2.1,-1.0);
721 gener->SetEnergyCMS(14000.);
722 break;
723 case kBeautyPbPb5500:
724 comment = comment.Append(" Beauty in Pb-Pb at 5.5 TeV");
725 gener = new AliGenPythia(nEvts);
726 gener->SetProcess(kPyBeautyPbPbMNR);
727 gener->SetStrucFunc(kCTEQ4L);
728 gener->SetPtHard(2.75,-1.0);
729 gener->SetEnergyCMS(5500.);
730 gener->SetNuclei(208,208);
731 break;
732 case kBeautypPb8800:
733 comment = comment.Append(" Beauty in p-Pb at 8.8 TeV");
734 gener = new AliGenPythia(nEvts);
735 gener->SetProcess(kPyBeautypPbMNR);
736 gener->SetStrucFunc(kCTEQ4L);
737 gener->SetPtHard(2.75,-1.0);
738 gener->SetEnergyCMS(8800.);
739 gener->SetProjectile("P",1,1);
740 gener->SetTarget("Pb",208,82);
741 break;
742 case kBeautypp14000:
743 comment = comment.Append(" Beauty in pp at 14 TeV");
744 gener = new AliGenPythia(nEvts);
745 gener->SetProcess(kPyBeautyppMNR);
746 gener->SetStrucFunc(kCTEQ4L);
747 gener->SetPtHard(2.75,-1.0);
748 gener->SetEnergyCMS(14000.);
749 break;
750 case kBeautypp14000wmi:
751 comment = comment.Append(" Beauty in pp at 14 TeV with mult. interactions");
752 gener = new AliGenPythia(-1);
753 gener->SetProcess(kPyBeautyppMNRwmi);
754 gener->SetStrucFunc(kCTEQ5L);
755 gener->SetPtHard(ptHardMin,ptHardMax);
756 gener->SetEnergyCMS(14000.);
757 break;
758 }
759
760 return gener;
761}
762
763AliGenPythia *PythiaHard(PDC07Proc_t proc) {
764//*******************************************************************//
765// Configuration file for hard QCD processes generation with PYTHIA //
766// //
767//*******************************************************************//
768 AliGenPythia * gener = 0x0;
769
770 switch(proc) {
771
772 case kPyJetJet:
773 comment = comment.Append(" pp->jet + jet over at 14 TeV, no restriction");
774 AliGenPythia * gener = new AliGenPythia(nEvts);
775 gener->SetEnergyCMS(eCMS);// Centre of mass energy
776 gener->SetProcess(kPyJets);// Process type
777 gener->SetJetEtaRange(-1.5, 1.5);// Final state kinematic cuts
778 gener->SetJetPhiRange(0., 360.);
779 gener->SetJetEtRange(10., 1000.);
780 gener->SetPtHard(ptHardMin, ptHardMax);// Pt transfer of the hard scattering
781 gener->SetStrucFunc(kCTEQ4L);
782 break;
783 case kBeautyppwmiJet:
784 comment = comment.Append(" Beauty Jets, no acceptance cuts");
785 AliGenPythia *gener = new AliGenPythia(-1);
786 gener->SetProcess(kPyBeautyppMNRwmi);
787 gener->SetStrucFunc(kCTEQ4L);
788 //Jet specific stuff below
789 gener->SetPtHard(ptHardMin,ptHardMax);
790 gener->SetJetEtaRange(-1,1); //used like that in LHC08d10, does nothing?
791 gener->SetJetPhiRange(60.,210.);//used like that in LHC08d10, does nothing?
792 gener->SetJetEtRange(10.,1000.);//used like that in LHC08d10,does nothing
793 //jet specific stuff above
794 gener->SetEnergyCMS(eCMS);
795 gener->SetForceDecay(kSemiElectronic);
796 gener->SetYRange(-2,2);
797 gener->SetFeedDownHigherFamily(kFALSE);
798 gener->SetCountMode(AliGenPythia::kCountParents);
799 break;
800 case kPyBJetEMCAL:
801 comment = comment.Append(" Beauty Jets over EMCAL");
802 AliGenPythia *gener = new AliGenPythia(-1);
803 gener->SetProcess(kPyBeautyJets);
804 gener->SetStrucFunc(kCTEQ4L);
805 //Jet specific stuff below
806 gener->SetPtHard(ptHardMin,ptHardMax);
807 gener->SetJetEtaRange(-1,1);
808 gener->SetJetPhiRange(60.,210.);
809 gener->SetJetEtRange(10.,1000.);
810 //jet specific stuff above
811 gener->SetEnergyCMS(eCMS);
812 gener->SetForceDecay(kSemiElectronic);
813 gener->SetYRange(-2,2);
814 gener->SetFeedDownHigherFamily(kFALSE);
815 gener->SetCountMode(AliGenPythia::kCountParents);
816 gener->SetElectronMinPt(1.);
817 gener->SetElectronInEMCAL(kTRUE);
818 break;
819 case kPyGammaJetPHOS:
820 comment = comment.Append(" pp->jet + gamma over PHOS");
821 gener = new AliGenPythia(nEvts);
822 gener->SetEnergyCMS(eCMS);
823 gener->SetProcess(kPyDirectGamma);
824 gener->SetStrucFunc(kCTEQ4L);
825 gener->SetPtHard(ptHardMin,ptHardMax);
826 //gener->SetYHard(-1.0,1.0);
827 gener->SetGammaEtaRange(-0.13,0.13);
828 gener->SetGammaPhiRange(219.,321.);//Over 5 modules +-2 deg
829 break;
830 case kPyJetJetPHOS:
831 comment = comment.Append(" pp->jet + jet over PHOS");
832 gener = new AliGenPythia(nEvts);
833 gener->SetEnergyCMS(eCMS);
834 gener->SetProcess(kPyJets);
835 gener->SetStrucFunc(kCTEQ4L);
836 gener->SetPtHard(ptHardMin,ptHardMax);
837 //gener->SetYHard(-1.0,1.0);
838 gener->SetJetEtaRange(-1.,1.);
839 gener->SetJetPhiRange(200.,340.);
840 gener->SetJetEtRange(10., 1000.);
841 gener->SetPi0InPHOS(pi0FragPhotonInDet);
842 gener->SetFragPhotonOrPi0MinPt(ptGammaPi0Min);
843
844 printf("\n \n Event generator: Minimum pT of particle in calorimeter %f \n \n", ptGammaPi0Min);
845 break;
846 case kPyGammaBremsPHOS:
847 comment = comment.Append(" pp->jet + jet+bremsphoton over PHOS at 14 TeV");
848 gener = new AliGenPythia(nEvts);
849 gener->SetEnergyCMS(eCMS);
850 gener->SetProcess(kPyJets);
851 gener->SetStrucFunc(kCTEQ4L);
852 gener->SetPtHard(ptHardMin,ptHardMax);
853 //gener->SetYHard(-1.0,1.0);
854 gener->SetJetEtaRange(-1.,1.);
855 gener->SetJetPhiRange(200.,340.);
856 gener->SetFragPhotonInPHOS(pi0FragPhotonInDet);
857 gener->SetFragPhotonOrPi0MinPt(ptGammaPi0Min);
858 printf("\n \n Event generator: Minimum pT of particle in calorimeter %f \n \n", ptGammaPi0Min);
859 break;
860 case kPyJetJetPHOSv2:
861 comment = comment.Append(" pp->jet + jet over PHOS version2 ");
862 gener = new AliGenPythia(nEvts);
863 gener->SetEnergyCMS(eCMS);
864 gener->SetProcess(kPyJets);
865 gener->SetStrucFunc(kCTEQ4L);
866 gener->SetPtHard(ptHardMin,ptHardMax);
867 //gener->SetYHard(-1.0,1.0);
868 gener->SetJetEtaRange(-1.,1.);
869 gener->SetJetPhiRange(200.,340.);
870 //gener->SetPi0InPHOS(kTRUE);
871 gener->SetPhotonInPHOSeta(pi0FragPhotonInDet);
872 gener->SetPhotonMinPt(ptGammaPi0Min);
873 gener->SetForceDecay(kAll);
874 break;
875 case kPyGammaJetEMCAL:
876 comment = comment.Append(" pp->jet + gamma over EMCAL at 14 TeV");
877 gener = new AliGenPythia(nEvts);
878 gener->SetEnergyCMS(eCMS);
879 gener->SetProcess(kPyDirectGamma);
880 gener->SetStrucFunc(kCTEQ4L);
881 gener->SetPtHard(ptHardMin,ptHardMax);
882 //gener->SetYHard(-1.0,1.0);
883 gener->SetGammaEtaRange(-0.701,0.701);
884 gener->SetGammaPhiRange(79.,191.);//Over 6 supermodules +-2 deg
885 break;
886 case kPyJetJetEMCAL:
887 comment = comment.Append(" pp->jet + jet over EMCAL at 14 TeV");
888 gener = new AliGenPythia(nEvts);
889 gener->SetEnergyCMS(eCMS);
890 gener->SetProcess(kPyJets);
891 gener->SetStrucFunc(kCTEQ4L);
892 gener->SetPtHard(ptHardMin,ptHardMax);
893 //gener->SetYHard(-1.0,1.0);
894 gener->SetJetEtaRange(-1,1);
895 gener->SetJetPhiRange(60.,210.);
896 gener->SetJetEtRange(10., 1000.);
897 gener->SetPi0InEMCAL(pi0FragPhotonInDet);
898 gener->SetFragPhotonOrPi0MinPt(ptGammaPi0Min);
899 printf("\n \n Event generator: Minimum pT of particle in calorimeter %f \n \n", ptGammaPi0Min);
900 break;
901 case kPyGammaBremsEMCAL:
902 comment = comment.Append(" pp->jet + jet+bremsphoton over EMCAL at 14 TeV");
903 gener = new AliGenPythia(nEvts);
904 gener->SetEnergyCMS(eCMS);
905 gener->SetProcess(kPyJets);
906 gener->SetStrucFunc(kCTEQ4L);
907 gener->SetPtHard(ptHardMin,ptHardMax);
908 //gener->SetYHard(-1.0,1.0);
909 gener->SetJetEtaRange(-1,1);
910 gener->SetJetPhiRange(60.,210.);
911 gener->SetJetEtRange(10., 1000.);
912 gener->SetFragPhotonInEMCAL(pi0FragPhotonInDet);
913 gener->SetFragPhotonOrPi0MinPt(ptGammaPi0Min);
914
915 printf("\n \n Event generator: Minimum pT of particle in calorimeter %f \n \n", ptGammaPi0Min);
916 break;
917
918 }
919
920 return gener;
921}
922
923AliGenerator* MbCocktail()
924{
925 comment = comment.Append(" pp at 14 TeV: Pythia low-pt, no heavy quarks + J/Psi from parameterisation");
926 AliGenCocktail * gener = new AliGenCocktail();
927 gener->UsePerEventRates();
928
929// Pythia
930
931 AliGenPythia* pythia = new AliGenPythia(-1);
932 pythia->SetMomentumRange(0, 999999.);
933 pythia->SetThetaRange(0., 180.);
934 pythia->SetYRange(-12.,12.);
935 pythia->SetPtRange(0,1000.);
936 pythia->SetProcess(kPyMb);
937 pythia->SetEnergyCMS(14000.);
938 pythia->SwitchHFOff();
939
940// J/Psi parameterisation
941
942 AliGenParam* jpsi = new AliGenParam(1, AliGenMUONlib::kJpsi, "CDF scaled", "Jpsi");
943 jpsi->SetPtRange(0.,100.);
944 jpsi->SetYRange(-8., 8.);
945 jpsi->SetPhiRange(0., 360.);
946 jpsi->SetForceDecay(kAll);
947
948 gener->AddGenerator(pythia, "Pythia", 1.);
949 gener->AddGenerator(jpsi, "J/Psi", 8.e-4);
950
951 return gener;
952}
953
954AliGenerator* PyMbTriggered(Int_t pdg)
955{
956 AliGenPythia* pythia = new AliGenPythia(-1);
957 pythia->SetMomentumRange(0, 999999.);
958 pythia->SetThetaRange(0., 180.);
959 pythia->SetYRange(-12.,12.);
960 pythia->SetPtRange(0,1000.);
961 pythia->SetProcess(kPyMb);
962 pythia->SetEnergyCMS(14000.);
963 pythia->SetTriggerParticle(pdg, 0.9);
964 return pythia;
965}
966
967void ProcessEnvironmentVars()
968{
969 cout << "######################################" << endl;
970 cout << "## Processing environment variables ##" << endl;
971 cout << "######################################" << endl;
972
973 // Run Number
974 if (gSystem->Getenv("RUN")) {
975 runNumber = atoi(gSystem->Getenv("RUN"));
976 }
977 //cout<<"Run number "<<runNumber<<endl;
978
979 // Event Number
980 if (gSystem->Getenv("EVENT")) {
981 eventNumber = atoi(gSystem->Getenv("EVENT"));
982 }
983 //cout<<"Event number "<<eventNumber<<endl;
984
985 // Random Number seed
986 if (gSystem->Getenv("CONFIG_SEED")) {
987 seed = atoi(gSystem->Getenv("CONFIG_SEED"));
988 }
989 else if(gSystem->Getenv("EVENT") && gSystem->Getenv("RUN")){
990 seed = runNumber * 100000 + eventNumber;
991 }
992
993 gRandom->SetSeed(seed);
994
995 cout<<"////////////////////////////////////////////////////////////////////////////////////"<<endl;
996 cout<<"Seed for random number generation= "<< seed<<" "<< gRandom->GetSeed()<<endl;
997 cout<<"////////////////////////////////////////////////////////////////////////////////////"<<endl;
998
999 // Run type
1000 if (gSystem->Getenv("DC_RUN_TYPE")) {
1001 cout<<"run type "<<gSystem->Getenv("DC_RUN_TYPE")<<endl;
1002 for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
1003 if (strcmp(gSystem->Getenv("DC_RUN_TYPE"), pprRunName[iRun])==0) {
1004 proc = (PDC07Proc_t)iRun;
1005 }
1006 }
1007 }
1008 else
1009 cout << "Environment variable DC_RUN_TYPE is not defined" << endl;
1010 if (gSystem->Getenv("YEAR"))
1011 year = atoi(gSystem->Getenv("YEAR"));
1012 if (gSystem->Getenv("ECMS"))
1013 eCMS = atof(gSystem->Getenv("ECMS"));
1014 if (gSystem->Getenv("TRIGGER"))
1015 trig = atoi(gSystem->Getenv("TRIGGER"));
1016 if ( gSystem->Getenv("PI0GAMMAINDET") )
1017 pi0FragPhotonInDet = atoi(gSystem->Getenv("PI0GAMMAINDET"));
1018 if (gSystem->Getenv("PTGAMMAPI0MIN"))
1019 ptGammaPi0Min = atof(gSystem->Getenv("PTGAMMAPI0MIN"));
1020 if (gSystem->Getenv("QUENCHING"))
1021 iquenching = atof(gSystem->Getenv("QUENCHING"));
1022 if (gSystem->Getenv("QHAT"))
1023 qhat = atof(gSystem->Getenv("QHAT"));
1024 //if (gSystem->Getenv("MEDLENGHT"))
1025 // medlength = atof(gSystem->Getenv("MEDLENGHT"));
1026 if (gSystem->Getenv("PTHARDMIN"))
1027 ptHardMin = atof(gSystem->Getenv("PTHARDMIN"));
1028 if (gSystem->Getenv("PTHARDMAX"))
1029 ptHardMax = atof(gSystem->Getenv("PTHARDMAX"));
1030
1031 if(gSystem->Getenv("PTHARDMIN") && gSystem->Getenv("PTHARDMAX")){
1032 if( strncmp(pprRunName[proc],"kPyJetJet",9)==0 || strncmp(pprRunName[proc],"kPyBJetEMCAL",11)==0 ){
1033 ptHardMin = ptHardJJLo[runNumber%nPtHardJJBins];
1034 ptHardMax = ptHardJJHi[runNumber%nPtHardJJBins];
1035 }
1036 else if( strncmp(pprRunName[proc],"kPyGammaJet",11)==0){
1037 ptHardMin = ptHardGJLo[runNumber%nPtHardGJBins];
1038 ptHardMax = ptHardGJHi[runNumber%nPtHardGJBins];
1039 }
1040 }
1041
1042 cout<<">> Run type set to "<<pprRunName[proc]<<endl;
1043 cout<<">> Collision energy set to "<<eCMS <<endl;
1044 cout<<">> Collisions trigger type "<<trig<<" "<<TrigConfName[trig]<<endl;
1045 cout<<">> ptHard limits: "<<ptHardMin<<" to " <<ptHardMax<<" GeV"<<endl;
1046 if(pi0FragPhotonInDet) cout<<">> pt gamma/pi0 threshold "<< ptGammaPi0Min<<" GeV "<<endl;
1047 if(iquenching) cout<<">> quenching on? "<< iquenching<<" qhat "<<qhat//<<" medlength "<<medlength
1048 <<endl;
1049 cout<<">> Year geometry : "<<year<<endl;
1050 cout << "######################################" << endl;
1051 cout << "######################################" << endl;
1052}