2 // Configuration for the Physics Data Challenge 2006 modified to generate
3 // e,mu,pi,K,p for PID studies of the TRD.
4 // Per event, AliGenBox is used to generate 100 particles per species
5 // (50 positive and 50 negative ones). Barrel detectors only.
9 // One can use the configuration macro in compiled mode by
10 // root [0] gSystem->Load("libgeant321");
11 // root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
12 // -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
13 // root [0] .x grun.C(1,"Config_PDC06.C++")
15 #if !defined(__CINT__) || defined(__MAKECINT__)
16 #include <Riostream.h>
21 #include <TVirtualMC.h>
22 #include <TGeant3TGeo.h>
23 #include "EVGEN/AliGenCocktail.h"
24 #include "EVGEN/AliGenParam.h"
25 #include "EVGEN/AliGenMUONlib.h"
26 #include "STEER/AliRunLoader.h"
27 #include "STEER/AliRun.h"
28 #include "STEER/AliConfig.h"
29 #include "PYTHIA6/AliDecayerPythia.h"
30 #include "PYTHIA6/AliGenPythia.h"
31 #include "STEER/AliMagFMaps.h"
32 #include "STRUCT/AliBODY.h"
33 #include "STRUCT/AliMAG.h"
34 #include "STRUCT/AliABSOv0.h"
35 #include "STRUCT/AliDIPOv2.h"
36 #include "STRUCT/AliHALL.h"
37 #include "STRUCT/AliFRAMEv2.h"
38 #include "STRUCT/AliSHILv2.h"
39 #include "STRUCT/AliPIPEv0.h"
40 #include "ITS/AliITSgeom.h"
41 #include "ITS/AliITSvPPRasymmFMD.h"
42 #include "TPC/AliTPCv2.h"
43 #include "TOF/AliTOFv5T0.h"
44 #include "HMPID/AliHMPIDv1.h"
45 #include "ZDC/AliZDCv2.h"
46 #include "TRD/AliTRDv1.h"
47 #include "FMD/AliFMDv1.h"
48 #include "MUON/AliMUONv1.h"
49 #include "PHOS/AliPHOSv1.h"
50 #include "PMD/AliPMDv1.h"
51 #include "T0/AliT0v1.h"
52 #include "EMCAL/AliEMCALv2.h"
53 #include "ACORDE/AliACORDEv1.h"
54 #include "VZERO/AliVZEROv6.h"
60 //--- Heavy Flavour Production ---
61 kCharmPbPb5500, kCharmpPb8800, kCharmpp14000, kCharmpp14000wmi,
62 kD0PbPb5500, kD0pPb8800, kD0pp14000,
63 kDPlusPbPb5500, kDPluspPb8800, kDPluspp14000,
64 kBeautyPbPb5500, kBeautypPb8800, kBeautypp14000, kBeautypp14000wmi,
66 kPyMbNoHvq, kPyOmegaPlus, kPyOmegaMinus, kRunMax
69 const char * pprRunName[] = {
70 "kCharmPbPb5500", "kCharmpPb8800", "kCharmpp14000", "kCharmpp14000wmi",
71 "kD0PbPb5500", "kD0pPb8800", "kD0pp14000",
72 "kDPlusPbPb5500", "kDPluspPb8800", "kDPluspp14000",
73 "kBeautyPbPb5500", "kBeautypPb8800", "kBeautypp14000", "kBeautypp14000wmi",
74 "kPyMbNoHvq", "kPyOmegaPlus", "kPyOmegaMinus"
81 kNature, kHadr, kSemiEl, kSemiMu
83 //--- Rapidity Cut ---
86 kFull, kBarrel, kMuonArm
88 //--- Magnetic Field ---
94 AliGenPythia *PythiaHVQ(PDC06Proc_t proc);
95 AliGenerator *MbCocktail();
96 AliGenerator *PyMbTriggered(Int_t pdg);
97 void ProcessEnvironmentVars();
98 Float_t EtaToTheta(Float_t arg){
99 return (180./TMath::Pi())*2.*atan(exp(-arg));
102 // This part for configuration
103 static DecayHvFl_t decHvFl = kNature;
104 static YCut_t ycut = kBarrel;
105 static Mag_t mag = k5kG;
106 //========================//
107 // Set Random Number seed //
108 //========================//
110 static UInt_t seed = dt.Get();
112 // nEvts = -1 : you get 1 QQbar pair and all the fragmentation and
114 // nEvts = N>0 : you get N charm / beauty Hadrons
116 // stars = kTRUE : all heavy resonances and their decay stored
117 // = kFALSE: only final heavy hadrons and their decays stored
118 Bool_t stars = kTRUE;
120 // To be used only with kCharmppMNRwmi and kBeautyppMNRwmi
121 // To get a "reasonable" agreement with MNR results, events have to be
122 // generated with the minimum ptHard set to 2.76 GeV.
123 // To get a "perfect" agreement with MNR results, events have to be
124 // generated in four ptHard bins with the following relative
136 Float_t ptHardMin = 2.76;
137 Float_t ptHardMax = -1.;
141 static TString comment;
147 // Get settings from environment variables
148 ProcessEnvironmentVars();
150 gRandom->SetSeed(seed);
151 cerr<<"Seed for random number generation= "<<seed<<endl;
153 // libraries required by geant321
154 #if defined(__CINT__)
155 gSystem->Load("libgeant321");
158 new TGeant3TGeo("C++ Interface to Geant3");
160 //=======================================================================
161 // Create the output file
164 AliRunLoader* rl=0x0;
166 cout<<"Config.C: Creating Run Loader ..."<<endl;
167 rl = AliRunLoader::Open("galice.root",
168 AliConfig::GetDefaultEventFolderName(),
172 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
175 rl->SetCompressionLevel(2);
176 rl->SetNumberOfEventsPerFile(1000);
177 gAlice->SetRunLoader(rl);
180 //=======================================================================
181 // ************* STEERING parameters FOR ALICE SIMULATION **************
182 // --- Specify event type to be tracked through the ALICE setup
183 // --- All positions are in cm, angles in degrees, and P and E in GeV
186 gMC->SetProcess("DCAY",1);
187 gMC->SetProcess("PAIR",1);
188 gMC->SetProcess("COMP",1);
189 gMC->SetProcess("PHOT",1);
190 gMC->SetProcess("PFIS",0);
191 gMC->SetProcess("DRAY",0);
192 gMC->SetProcess("ANNI",1);
193 gMC->SetProcess("BREM",1);
194 gMC->SetProcess("MUNU",1);
195 gMC->SetProcess("CKOV",1);
196 gMC->SetProcess("HADR",1);
197 gMC->SetProcess("LOSS",2);
198 gMC->SetProcess("MULS",1);
199 gMC->SetProcess("RAYL",1);
201 Float_t cut = 1.e-3; // 1MeV cut by default
202 Float_t tofmax = 1.e10;
204 gMC->SetCut("CUTGAM", cut);
205 gMC->SetCut("CUTELE", cut);
206 gMC->SetCut("CUTNEU", cut);
207 gMC->SetCut("CUTHAD", cut);
208 gMC->SetCut("CUTMUO", cut);
209 gMC->SetCut("BCUTE", cut);
210 gMC->SetCut("BCUTM", cut);
211 gMC->SetCut("DCUTE", cut);
212 gMC->SetCut("DCUTM", cut);
213 gMC->SetCut("PPCUTM", cut);
214 gMC->SetCut("TOFMAX", tofmax);
219 // Set External decayer //
220 //======================//
221 TVirtualMCDecayer* decayer = new AliDecayerPythia();
226 decayer->SetForceDecay(kAll);
229 decayer->SetForceDecay(kHadronicD);
232 decayer->SetForceDecay(kSemiElectronic);
235 decayer->SetForceDecay(kSemiMuonic);
239 gMC->SetExternalDecayer(decayer);
241 //=========================//
242 // Generator Configuration //
243 //=========================//
245 AliGenCocktail *gener = new AliGenCocktail();
246 Double_t momen = 0.6;
248 // Set pseudorapidity range from -1 to 1.
249 Float_t thmin = EtaToTheta(1.); // theta min. <---> eta max
250 Float_t thmax = EtaToTheta(-1.); // theta max. <---> eta min
252 // electron generator
253 AliGenBox *eminus= new AliGenBox(Npart);
254 eminus->SetPart(kElectron);
255 eminus->SetMomentumRange(momen,momen);
256 eminus->SetPhiRange(0,360);
257 eminus->SetThetaRange(thmin,thmax);
258 eminus->SetOrigin(0., 0., 0.); // primary vertex position
259 eminus->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
261 // positron generator
262 AliGenBox *eplus= new AliGenBox(Npart);
263 eplus->SetPart(kPositron);
264 eplus->SetMomentumRange(momen,momen);
265 eplus->SetPhiRange(0,360);
266 eplus->SetThetaRange(thmin,thmax);
267 eplus->SetOrigin(0., 0., 0.); // primary vertex position
268 eplus->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
271 AliGenBox *muminus= new AliGenBox(Npart);
272 muminus->SetPart(kMuonMinus);
273 muminus->SetMomentumRange(momen,momen);
274 muminus->SetPhiRange(0,360);
275 muminus->SetThetaRange(thmin,thmax);
276 muminus->SetOrigin(0., 0., 0.); // primary vertex position
277 muminus->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
280 AliGenBox *muplus= new AliGenBox(Npart);
281 muplus->SetPart(kMuonPlus);
282 muplus->SetMomentumRange(momen,momen);
283 muplus->SetPhiRange(0,360);
284 muplus->SetThetaRange(thmin,thmax);
285 muplus->SetOrigin(0., 0., 0.); // primary vertex position
286 muplus->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
289 AliGenBox *piminus= new AliGenBox(Npart);
290 piminus->SetPart(kPiMinus);
291 piminus->SetMomentumRange(momen,momen);
292 piminus->SetPhiRange(0,360);
293 piminus->SetThetaRange(thmin,thmax);
294 piminus->SetOrigin(0., 0., 0.); // primary vertex position
295 piminus->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
298 AliGenBox *piplus= new AliGenBox(Npart);
299 piplus->SetPart(kPiPlus);
300 piplus->SetMomentumRange(momen,momen);
301 piplus->SetPhiRange(0,360);
302 piplus->SetThetaRange(thmin,thmax);
303 piplus->SetOrigin(0., 0., 0.); // primary vertex position
304 piplus->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
307 AliGenBox *kminus= new AliGenBox(Npart);
308 kminus->SetPart(kKMinus);
309 kminus->SetMomentumRange(momen,momen);
310 kminus->SetPhiRange(0,360);
311 kminus->SetThetaRange(thmin,thmax);
312 kminus->SetOrigin(0., 0., 0.); // primary vertex position
313 kminus->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
316 AliGenBox *kplus= new AliGenBox(Npart);
317 kplus->SetPart(kKPlus);
318 kplus->SetMomentumRange(momen,momen);
319 kplus->SetPhiRange(0,360);
320 kplus->SetThetaRange(thmin,thmax);
321 kplus->SetOrigin(0., 0., 0.); // primary vertex position
322 kplus->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
325 AliGenBox *proton= new AliGenBox(Npart);
326 proton->SetPart(kProton);
327 proton->SetMomentumRange(momen,momen);
328 proton->SetPhiRange(0,360);
329 proton->SetThetaRange(thmin,thmax);
330 proton->SetOrigin(0., 0., 0.); // primary vertex position
331 proton->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
334 AliGenBox *aproton= new AliGenBox(Npart);
335 aproton->SetPart(kProtonBar);
336 aproton->SetMomentumRange(momen,momen);
337 aproton->SetPhiRange(0,360);
338 aproton->SetThetaRange(thmin,thmax);
339 aproton->SetOrigin(0., 0., 0.); // primary vertex position
340 aproton->SetSigma(0.,0.,0.); // sigma (x,y,z) in cm, on position
344 gener->AddGenerator(eminus,"e-",1);
345 gener->AddGenerator(eplus,"e+",1);
346 gener->AddGenerator(muminus,"mu-",1);
347 gener->AddGenerator(muplus,"mu+",1);
348 gener->AddGenerator(piminus,"pi-",1);
349 gener->AddGenerator(piplus,"pi+",1);
350 gener->AddGenerator(kminus,"K-",1);
351 gener->AddGenerator(kplus,"K+",1);
352 gener->AddGenerator(proton,"p",1);
353 gener->AddGenerator(aproton,"anti-p",1);
360 comment = comment.Append(" | L3 field 0.2 T");
361 } else if (mag == k4kG) {
362 comment = comment.Append(" | L3 field 0.4 T");
363 } else if (mag == k5kG) {
364 comment = comment.Append(" | L3 field 0.5 T");
366 printf("\n \n Comment: %s \n \n", comment.Data());
368 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., mag);
369 field->SetL3ConstField(0); //Using const. field in the barrel
371 gAlice->SetField(field);
396 //=================== Alice BODY parameters =============================
397 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
402 //=================== MAG parameters ============================
403 // --- Start with Magnet since detector layouts may be depending ---
404 // --- on the selected Magnet dimensions ---
405 AliMAG *MAG = new AliMAG("MAG", "Magnet");
411 //=================== ABSO parameters ============================
412 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
417 //=================== DIPO parameters ============================
419 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
424 //=================== HALL parameters ============================
426 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
432 //=================== FRAME parameters ============================
434 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
440 //=================== SHIL parameters ============================
442 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
448 //=================== PIPE parameters ============================
450 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
455 //=================== ITS parameters ============================
457 // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
458 // almost all other detectors. This involves the fact that the ITS geometry
459 // still has several options to be followed in parallel in order to determine
460 // the best set-up which minimizes the induced background. All the geometries
461 // available to date are described in the following. Read carefully the comments
462 // and use the default version (the only one uncommented) unless you are making
463 // comparisons and you know what you are doing. In this case just uncomment the
464 // ITS geometry you want to use and run Aliroot.
466 // Detailed geometries:
469 //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
471 //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
473 AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
474 ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
475 ITS->SetReadDet(kTRUE); // don't touch this parameter if you're not an ITS developer
476 // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
477 ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
478 ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
479 ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300]
480 ITS->SetThicknessChip2(200.); // chip thickness on layer 2 must be in the range [150,300]
481 ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
482 ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
484 // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
485 // for reconstruction !):
488 //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
489 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
490 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
492 //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
493 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
494 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
498 // Geant3 <-> EUCLID conversion
499 // ============================
501 // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
502 // media to two ASCII files (called by default ITSgeometry.euc and
503 // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
504 // The default (=0) means that you dont want to use this facility.
511 //============================ TPC parameters =====================
512 AliTPC *TPC = new AliTPCv2("TPC", "Default");
517 //=================== TOF parameters ============================
518 AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
524 //=================== HMPID parameters ===========================
525 AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");
532 //=================== ZDC parameters ============================
534 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
539 //=================== TRD parameters ============================
541 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
542 AliTRDgeometry *geoTRD = TRD->GetGeometry();
548 //=================== FMD parameters ============================
549 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
554 //=================== MUON parameters ===========================
555 // New MUONv1 version (geometry defined via builders)
556 AliMUON *MUON = new AliMUONv1("MUON", "default");
558 //=================== PHOS parameters ===========================
562 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
568 //=================== PMD parameters ============================
569 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
574 //=================== T0 parameters ============================
575 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
580 //=================== EMCAL parameters ============================
581 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH");
586 //=================== ACORDE parameters ============================
587 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
592 //=================== ACORDE parameters ============================
593 AliVZERO *VZERO = new AliVZEROv6("VZERO", "normal VZERO");
598 void ProcessEnvironmentVars()
601 if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
602 for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
603 if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0) {
604 proc = (PDC06Proc_t)iRun;
605 cout<<"Run type set to "<<pprRunName[iRun]<<endl;
610 // Random Number seed
611 if (gSystem->Getenv("CONFIG_SEED")) {
612 seed = atoi(gSystem->Getenv("CONFIG_SEED"));