1 #if !defined(__CINT__) || defined(__MAKECINT__)
6 #include <TVirtualMC.h>
7 #include <TGeant3TGeo.h>
8 #include "AliRunLoader.h"
10 #include "AliConfig.h"
11 #include "AliDecayerPythia.h"
12 #include "AliGenPythia.h"
13 #include "AliGenDPMjet.h"
14 #include "AliMagFCheb.h"
17 #include "AliABSOv3.h"
18 #include "AliDIPOv3.h"
19 #include "AliHALLv3.h"
20 #include "AliFRAMEv2.h"
21 #include "AliSHILv3.h"
22 #include "AliPIPEv3.h"
23 #include "AliPIPEv4.h"
24 #include "AliITSv11.h"
26 #include "AliTOFv6T0.h"
27 #include "AliHMPIDv3.h"
30 #include "AliTRDgeometry.h"
32 #include "AliMUONv1.h"
33 #include "AliPHOSv1.h"
34 #include "AliPHOSSimParam.h"
37 #include "AliEMCALv2.h"
38 #include "AliACORDEv1.h"
39 #include "AliVZEROv7.h"
43 enum PDCProc_t {kGenBox,
50 kPythiaPerugia0Jpsi2mu,
51 kPythiaPerugia0BtoJpsi2mu,
56 const Char_t* pprRunName[] = {"kGenBox",
63 "kPythiaPerugia0Jpsi2mu",
64 "kPythiaPerugia0BtoJpsi2mu",
67 "kHijing2500Cocktail"};
69 enum Mag_t { kNoField, k5kG, kFieldMax };
71 const Char_t* pprField[] = { "kNoField", "k5kG", "kFieldMax" };
75 // ----------------------- Generator, field, beam energy,... ------------------------------------------------------------
76 static PDCProc_t proc = kGenBox;
77 static PDCProc_t signal = kGenBox; // only in case kHijing2500Cocktail is the proc
78 static Mag_t mag = k5kG;
79 static Float_t energy = 5500.; // energy in CMS
80 static Float_t bMin = 0.;
81 static Float_t bMax = = 5.; // 0-5 fm corresponds to around 0-10% (see https://twiki.cern.ch/twiki/bin/viewauth/ALICE/CentStudies#Tables_with_centrality_bins_for)
82 static Double_t JpsiPol = 0; // Jpsi polarisation
83 static Bool_t JpsiHarderPt = kFALSE; // Jpsi harder pt spectrum (8.8 TeV)
84 // ----------------------------------------------------------------------------------------------------------------------
86 static TString comment;
88 //====================================================================================================================================================
92 // AliLog::SetClassDebugLevel("AliMFT", 1);
96 new TGeant3TGeo("C++ Interface to Geant3");
98 // Create the output file
100 AliRunLoader* rl=0x0;
102 printf("Config.C: Creating Run Loader ...");
103 rl = AliRunLoader::Open("galice.root", AliConfig::GetDefaultEventFolderName(), "recreate");
105 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
108 rl->SetCompressionLevel(2);
109 rl->SetNumberOfEventsPerFile(1000);
110 gAlice->SetRunLoader(rl);
112 // ************* STEERING parameters FOR ALICE SIMULATION **************
113 // --- Specify event type to be tracked through the ALICE setup
114 // --- All positions are in cm, angles in degrees, and P and E in GeV
116 gMC->SetProcess("DCAY",1);
117 gMC->SetProcess("PAIR",1);
118 gMC->SetProcess("COMP",1);
119 gMC->SetProcess("PHOT",1);
120 gMC->SetProcess("PFIS",0);
121 gMC->SetProcess("DRAY",0);
122 gMC->SetProcess("ANNI",1);
123 gMC->SetProcess("BREM",1);
124 gMC->SetProcess("MUNU",1);
125 gMC->SetProcess("CKOV",1);
126 gMC->SetProcess("HADR",1);
127 gMC->SetProcess("LOSS",2);
128 gMC->SetProcess("MULS",1);
129 gMC->SetProcess("RAYL",1);
131 Float_t cut = 1.e-3; // 1MeV cut by default
132 Float_t tofmax = 1.e10;
134 gMC->SetCut("CUTGAM", cut);
135 gMC->SetCut("CUTELE", cut);
136 gMC->SetCut("CUTNEU", cut);
137 gMC->SetCut("CUTHAD", cut);
138 gMC->SetCut("CUTMUO", cut);
139 gMC->SetCut("BCUTE", cut);
140 gMC->SetCut("BCUTM", cut);
141 gMC->SetCut("DCUTE", cut);
142 gMC->SetCut("DCUTM", cut);
143 gMC->SetCut("PPCUTM", cut);
144 gMC->SetCut("TOFMAX", tofmax);
146 TVirtualMCDecayer *decayer = new AliDecayerPythia();
147 decayer->SetForceDecay(kAll);
149 gMC->SetExternalDecayer(decayer);
152 AliGenerator* gener = 0x0;
153 if (proc == kPythia6) gener = MbPythia();
154 else if (proc == kPythiaPerugia0) gener = MbPythiaTunePerugia0();
155 else if (proc == kHijing) gener = Hijing();
156 else if (proc == kHijing2500) gener = Hijing2500();
157 else if (proc == kHijing2500Cocktail) gener = Hijing2500Cocktail();
158 else if (proc == kGenBox) gener = GenBox();
159 else if (proc == kGenMuonLMR) gener = GenMuonLMR();
160 else if (proc == kGenParamJpsi) gener = GenParamJpsi();
161 else if (proc == kGenCorrHF) gener = GenCorrHF();
162 else if (proc == kGenPionKaon) gener = GenParamPionKaon();
163 else if (proc == kPythiaPerugia0BtoJpsi2mu) gener = MbPythiaTunePerugia0BtoJpsi2mu();
165 // Size of the interaction diamond
166 Float_t sigmaz = 5.4 / TMath::Sqrt(2.); // [cm]
167 Float_t betast = 3.5; // beta* [m]
168 Float_t eps = 3.75e-6; // emittance [m]
169 Float_t gamma = energy / 2.0 / 0.938272; // relativistic gamma [1]
170 Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.; // [cm]
172 printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
174 // gener->SetSigma(sigmaxy, sigmaxy, sigmaz); // Sigma in (X,Y,Z) (cm) on IP position
175 // gener->SetVertexSmear(kPerEvent);
178 printf("\n \n Comment: %s \n \n", comment.Data());
180 // TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG, AliMagF::kBeamTypeAA, 2750.));
181 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG, AliMagF::kBeamTypepp, 7000.));
211 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
213 if (iMAG) AliMAG *MAG = new AliMAG("MAG", "Magnet");
214 if (iABSO) AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
215 if (iDIPO) AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
216 if (iHALL) AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
217 if (iSHIL) AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
218 if (iITS) AliITS *ITS = new AliITSv11("ITS","ITS v11");
219 if (iTPC) AliTPC *TPC = new AliTPCv2("TPC", "Default");
220 if (iTOF) AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
221 if (iHMPID) AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
222 if (iFMD) AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
223 if (iPHOS) AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV_Modules123");
224 if (iPMD) AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
225 if (iT0) AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
226 if (iEMCAL) AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEARV1");
227 if (iACORDE) AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
228 if (iVZERO) AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
230 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
234 // AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
235 AliPIPE *PIPE = new AliPIPEv4("PIPE", "Beam Pipe", 1.98, 0.08);
238 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
239 ZDC->SetSpectatorsTrack();
240 ZDC->SetLumiLength(0.);
243 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
246 AliMUON *MUON = new AliMUONv1("MUON", "default");
247 MUON->SetTriggerEffCells(1); // not needed if raw masks
248 Char_t* digitstore="AliMUONDigitStoreV2S";
249 MUON->SetDigitStoreClassName(digitstore);
252 AliMFT *MFT = new AliMFT("MFT", "normal MFT");
255 TIter next(gAlice->Modules());
257 printf("gAlice->Modules:\n");
258 while((detector = (AliModule*)next())) printf("%s\n",detector->GetName());
262 //====================================================================================================================================================
264 AliGenerator* GenBox() {
266 AliGenBox *gener = new AliGenBox(2);
267 gener->SetMomentumRange(10.0, 10.1);
268 gener->SetPhiRange(0., 360.);
269 gener->SetThetaRange(171.0,178.0);
270 gener->SetPart(kMuonMinus); // Muons
271 gener->SetOrigin(0., 0., 0.); // vertex position
277 //====================================================================================================================================================
279 AliGenerator* GenMuonLMR() {
281 AliGenMUONLMR *gener = new AliGenMUONLMR();
282 gener->SetMomentumRange(0,999);
283 gener->SetPtRange(0,100.);
284 gener->SetYRange(-4.5, -2.0);
285 gener->SetChildThetaRange(171.0,178.0);
286 gener->SetChildMomentumRange(4.0, 999.);
287 gener->SetOrigin(0.0, 0.0, 0.0); // vertex position
288 gener->SetSigma(0.0, 0.0, 0.0); // vertex position smearing
289 enum {kEta2Body, kEtaDalitz, kRho2Body, kOmega2Body, kOmegaDalitz, kPhi2Body, kEtaPrimeDalitz, kPionLMR, kKaonLMR};
290 gener->GenerateSingleProcess(kOmega2Body, 10);
291 gener->SetCutOnChild(1);
297 //====================================================================================================================================================
299 AliGenerator* GenParamJpsi() {
301 AliGenParam *gener = new AliGenParam(5, AliGenMUONlib::kJpsi);
302 gener->SetMomentumRange(0,999);
303 gener->SetPtRange(0,100.);
304 gener->SetYRange(-4.0, -2.5);
305 gener->SetPhiRange(0., 360.);
306 gener->SetChildThetaRange(171.0,177.0);
307 gener->SetChildMomentumRange(5.0, 999.);
308 gener->SetOrigin(0.0, 0.0, 0.0); // vertex position
309 gener->SetSigma(0.0, 0.0, 0.0); // Sigma in (X,Y,Z) (cm) on IP position
310 gener->SetForceDecay(kDiMuon);
311 gener->SetTrackingFlag(1);
312 gener->SetCutOnChild(1);
318 //====================================================================================================================================================
320 AliGenerator* GenParamPionKaon() {
322 AliGenParamPionsKaons *gener = new AliGenParamPionsKaons(100,"$ALICE_ROOT/MFT/PionKaonKinematics.root");
323 gener->SetPtRange(0, 5.);
324 gener->SetPhiRange(0., 360.);
325 gener->SetYRange(-10., 0.);
326 gener->SetOrigin(0.0, 0.0, 0.0); // vertex position
327 gener->SetSigma(0.0, 0.0, 0.0); // vertex position smearing
328 // gener->SetCutOnChild(1);
334 //====================================================================================================================================================
336 AliGenerator* GenCorrHF() {
338 AliGenCorrHF *gener = new AliGenCorrHF(1, 4, 6); // for charm, 1 pair per event
339 // AliGenCorrHF *gener = new AliGenCorrHF(1, 5, 6); // for beauty, 1 pair per event
341 gener->SetMomentumRange(0,9999);
342 gener->SetCutOnChild(1); // 1/0 means cuts on children enable/disable
343 gener->SetChildThetaRange(171.0,178.0);
344 gener->SetChildMomentumRange(4.0, 999.);
345 gener->SetOrigin(0,0,0); //vertex position
346 gener->SetForceDecay(kSemiMuonic);
347 gener->SetTrackingFlag(1);
354 //====================================================================================================================================================
356 AliGenerator* MbPythia() {
358 comment = comment.Append(" pp: Pythia low-pt");
361 AliGenPythia* pythia = new AliGenPythia(-1);
362 pythia->SetMomentumRange(0, 999999.);
363 // pythia->SetThetaRange(0., 180.);
364 // pythia->SetChildYRange(-12.,0.);
365 // pythia->SetPtRange(0,1000.);
366 // pythia->SetCutOnChild(1);
367 pythia->SetProcess(kPyMb);
368 pythia->SetEnergyCMS(energy);
369 pythia->SetForceDecay(kSemiMuonic);
374 //====================================================================================================================================================
376 AliGenerator* MbPythiaTunePerugia0() {
378 comment = comment.Append(" pp: Pythia low-pt (Perugia0)");
381 AliGenPythia* pythia = new AliGenPythia(-1);
382 pythia->SetMomentumRange(0, 999999.);
383 pythia->SetThetaRange(0., 180.);
384 pythia->SetYRange(-12.,12.);
385 pythia->SetPtRange(0,1000.);
386 pythia->SetProcess(kPyMb);
387 pythia->SetEnergyCMS(energy);
390 pythia->SetTune(320);
391 pythia->UseNewMultipleInteractionsScenario();
396 //====================================================================================================================================================
398 AliGenerator* MbPythiaTunePerugia0Jpsi2mu() {
400 comment = comment.Append("Jpsi forced to dimuons");
401 AliGenParam *jpsi=0x0;
402 if (JpsiHarderPt) jpsi = new AliGenParam(1, AliGenMUONlib::kJpsi, "CDF pp 8.8", "Jpsi"); // 8.8 TeV
403 else jpsi = new AliGenParam(1, AliGenMUONlib::kJpsi, "CDF pp 7", "Jpsi"); // 7 TeV
404 jpsi->SetPtRange(0.,999.);
405 jpsi->SetYRange(-1.0, 1.0);
406 jpsi->SetPhiRange(0.,360.);
407 jpsi->SetOrigin(0,0,0);
408 jpsi->SetForceDecay(kDiMuon);
413 //====================================================================================================================================================
415 AliGenerator* MbPythiaTunePerugia0BtoJpsi2mu() {
417 comment = comment.Append(" pp: Pythia (Perugia0) BtoJpsi (1 bbbar per event, 1 b-hadron, 1 J/psi");
420 AliGenPythia* pythia = new AliGenPythia(-1);
421 pythia->SetMomentumRange(0, 999999.);
422 pythia->SetYRange(-4.5, -2.0);
423 pythia->SetPtRange(0,1000.);
424 pythia->SetProcess(kPyBeautyppMNRwmi);
425 pythia->SetEnergyCMS(energy);
428 pythia->SetTune(320);
429 pythia->UseNewMultipleInteractionsScenario();
432 pythia->SetCutOnChild(1);
433 pythia->SetPdgCodeParticleforAcceptanceCut(443);
434 pythia->SetChildYRange(-4.5, -2.0);
435 pythia->SetChildPtRange(0,10000.);
438 pythia->SetForceDecay(kBJpsiDiMuon);
444 //====================================================================================================================================================
446 AliGenerator* HijingParam() {
448 AliGenHIJINGpara *gener = new AliGenHIJINGpara(2000);
449 gener->SetMomentumRange(0,999);
450 gener->SetPhiRange(0,360);
451 gener->SetThetaRange(171, 179);
452 gener->SetOrigin(0,0,0); // vertex position
453 gener->SetSigma(0,0,0); // Sigma in (X,Y,Z) (cm) on IP position
460 //====================================================================================================================================================
462 AliGenerator* Hijing() {
464 AliGenHijing *gener = new AliGenHijing(-1);
465 // centre of mass energy
466 gener->SetEnergyCMS(energy);
467 gener->SetImpactParameterRange(bMin, bMax);
469 gener->SetReferenceFrame("CMS");
471 gener->SetProjectile("A", 208, 82);
472 gener->SetTarget ("A", 208, 82);
473 // tell hijing to keep the full parent child chain
474 gener->KeepFullEvent();
475 // enable jet quenching
476 gener->SetJetQuenching(1);
478 gener->SetShadowing(1);
479 // Don't track spectators
480 gener->SetSpectators(0);
481 // kinematic selection
482 gener->SetSelectAll(0);
486 //====================================================================================================================================================
488 AliGenerator* Hijing2500() {
490 AliGenHijing *gener = (AliGenHijing*) Hijing();
491 gener->SetJetQuenching(0);
492 gener->SetPtHardMin (4.5);
497 //====================================================================================================================================================
499 AliGenerator* Hijing2500Cocktail() {
501 comment = comment.Append(" PbPb: Hjing2500 at 5.5 + muon signals");
503 AliGenCocktail *cocktail = new AliGenCocktail();
504 cocktail->SetProjectile("A", 208, 82);
505 cocktail->SetTarget ("A", 208, 82);
506 cocktail->SetEnergyCMS(energy);
508 // 1 Hijing event: provides underlying event and collision geometry
509 AliGenHijing *hijing = Hijing2500();
510 cocktail->AddGenerator(hijing,"hijing",1);
512 // generator for the custom signal
513 AliGenerator* signalGen = 0x0;
516 signalGen = GenBox();
519 signalGen = GenMuonLMR();
522 signalGen = GenCorrHF();
525 signalGen = GenBox();
528 cocktail->AddGenerator(signalGen, "signal", 1);
530 cocktail->SetTrackingFlag(1);
536 //====================================================================================================================================================
540 #if defined(__CINT__)
542 gSystem->Load("liblhapdf"); // Parton density functions
543 gSystem->Load("libEGPythia6"); // TGenerator interface
544 if (proc == kPythia6) {
545 gSystem->Load("libpythia6"); // Pythia 6.2
546 gSystem->Load("libAliPythia6"); // ALICE specific implementations
549 gSystem->Load("libpythia6.4.21"); // Pythia 6.4
550 gSystem->Load("libAliPythia6"); // ALICE specific implementations
553 if (proc == kHijing || proc == kHijing2500 || proc == kHijing2500Cocktail) {
554 gSystem->Load("libhijing");
555 gSystem->Load("libTHijing");
558 gSystem->Load("libgeant321");
564 //====================================================================================================================================================