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