]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/Config_PythiaHeavyFlavours.C
VZERO default version v3
[u/mrichter/AliRoot.git] / macros / Config_PythiaHeavyFlavours.C
1 //*******************************************************************//
2 // Configuration file for charm / beauty generation with PYTHIA      //
3 //                                                                   //
4 // The parameters have been tuned in order to reproduce the inclusive//
5 // heavy quark pt distribution given by the NLO pQCD calculation by  //
6 // Mangano, Nason and Ridolfi.                                       //
7 //                                                                   //
8 // For details and for the NORMALIZATION of the yields see:          //
9 // - "Charm and beauty production at the LHC", ALICE note submitted  //
10 //   and available at: http://www.pd.infn.it/alipd/Docs.html         //
11 // - Current version of the ALICE PPR (Chapter 6.5)                  //
12 //   at: http://alice.web.cern.ch/Alice/ppr/web/CurrentVersion.html  //
13 //*******************************************************************//
14 #if !defined(__CINT__) || defined(__MAKECINT__)
15 #include <Riostream.h>
16 #include <TRandom.h>
17 #include <TDatime.h>
18 #include <TSystem.h>
19 #include <TVirtualMC.h>
20 #include <TGeant3.h>
21 #include "STEER/AliRunLoader.h"
22 #include "STEER/AliRun.h"
23 #include "STEER/AliConfig.h"
24 #include "PYTHIA6/AliDecayerPythia.h"
25 #include "PYTHIA6/AliGenPythia.h"
26 #include "STEER/AliMagFMaps.h"
27 #include "STRUCT/AliBODY.h"
28 #include "STRUCT/AliMAG.h"
29 #include "STRUCT/AliABSOv0.h"
30 #include "STRUCT/AliDIPOv2.h"
31 #include "STRUCT/AliHALL.h"
32 #include "STRUCT/AliFRAMEv2.h"
33 #include "STRUCT/AliSHILv2.h"
34 #include "STRUCT/AliPIPEv0.h"
35 #include "ITS/AliITSvPPRasymmFMD.h"
36 #include "TPC/AliTPCv2.h"
37 #include "TOF/AliTOFv4T0.h"
38 #include "RICH/AliRICHv1.h"
39 #include "ZDC/AliZDCv1.h"
40 #include "TRD/AliTRDv1.h"
41 #include "FMD/AliFMDv0.h"
42 #include "MUON/AliMUONv1.h"
43 #include "PHOS/AliPHOSv1.h"
44 #include "PMD/AliPMDv1.h"
45 #include "START/AliSTARTv1.h"
46 #include "CRT/AliCRTv1.h"
47 #endif
48
49 //--- Heavy Flavour Production ---
50 enum ProcessHvFl_t 
51 {
52   kCharmPbPb5500,  kCharmpPb8800,  kCharmpp14000,
53   kD0PbPb5500,     kD0pPb8800,     kD0pp14000,
54   kBeautyPbPb5500, kBeautypPb8800, kBeautypp14000
55 };
56 //--- Decay Mode ---
57 enum DecayHvFl_t 
58 {
59   kNature,  kHadr, kSemiEl, kSemiMu
60 };
61 //--- Rapidity Cut ---
62 enum YCut_t
63 {
64   kFull, kBarrel, kMuonArm
65 };
66 //--- Magnetic Field ---
67 enum Mag_t
68 {
69     k2kG, k4kG, k5kG
70 };
71 //--- Functions ---
72 AliGenPythia *PythiaHVQ(ProcessHvFl_t proc);
73
74
75 // This part for configuration
76 static ProcessHvFl_t procHvFl = kCharmPbPb5500;
77 static DecayHvFl_t   decHvFl  = kNature; 
78 static YCut_t        ycut     = kFull;
79 static Mag_t         mag      = k4kG; 
80 // nEvts = -1  : you get 1 QQbar pair and all the fragmentation and 
81 //               decay chain
82 // nEvts = N>0 : you get N charm / beauty Hadrons 
83 Int_t nEvts = -1; 
84 // stars = kTRUE : all heavy resonances and their decay stored
85 //       = kFALSE: only final heavy hadrons and their decays stored
86 Bool_t stars = kTRUE;
87
88
89 // Comment line
90 static TString comment;
91
92 void Config()
93 {
94  
95   //========================//
96   // Set Random Number seed //
97   //========================//
98   TDatime dt;
99   UInt_t curtime=dt.Get();
100   UInt_t procid=gSystem->GetPid();
101   UInt_t seed=curtime-procid;
102
103   //  gRandom->SetSeed(seed);
104   gRandom->SetSeed(12345);
105   cerr<<"Seed for random number generation= "<<seed<<endl; 
106
107   // libraries required by geant321
108 #if defined(__CINT__)
109   gSystem->Load("libgeant321");
110 #endif
111
112   new TGeant3("C++ Interface to Geant3");
113
114   //=======================================================================
115   //  Create the output file
116
117    
118   AliRunLoader* rl=0x0;
119
120   cout<<"Config.C: Creating Run Loader ..."<<endl;
121   rl = AliRunLoader::Open("galice.root",
122                           AliConfig::fgkDefaultEventFolderName,
123                           "recreate");
124   if (rl == 0x0)
125     {
126       gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
127       return;
128     }
129   rl->SetCompressionLevel(2);
130   rl->SetNumberOfEventsPerFile(3);
131   gAlice->SetRunLoader(rl);
132
133   //
134   //=======================================================================
135   // ************* STEERING parameters FOR ALICE SIMULATION **************
136   // --- Specify event type to be tracked through the ALICE setup
137   // --- All positions are in cm, angles in degrees, and P and E in GeV
138
139
140     gMC->SetProcess("DCAY",1);
141     gMC->SetProcess("PAIR",1);
142     gMC->SetProcess("COMP",1);
143     gMC->SetProcess("PHOT",1);
144     gMC->SetProcess("PFIS",0);
145     gMC->SetProcess("DRAY",0);
146     gMC->SetProcess("ANNI",1);
147     gMC->SetProcess("BREM",1);
148     gMC->SetProcess("MUNU",1);
149     gMC->SetProcess("CKOV",1);
150     gMC->SetProcess("HADR",1);
151     gMC->SetProcess("LOSS",2);
152     gMC->SetProcess("MULS",1);
153     gMC->SetProcess("RAYL",1);
154
155     Float_t cut = 1.e-3;        // 1MeV cut by default
156     Float_t tofmax = 1.e10;
157
158     gMC->SetCut("CUTGAM", cut);
159     gMC->SetCut("CUTELE", cut);
160     gMC->SetCut("CUTNEU", cut);
161     gMC->SetCut("CUTHAD", cut);
162     gMC->SetCut("CUTMUO", cut);
163     gMC->SetCut("BCUTE",  cut); 
164     gMC->SetCut("BCUTM",  cut); 
165     gMC->SetCut("DCUTE",  cut); 
166     gMC->SetCut("DCUTM",  cut); 
167     gMC->SetCut("PPCUTM", cut);
168     gMC->SetCut("TOFMAX", tofmax); 
169
170
171
172
173   // Set External decayer //
174   //======================//
175   TVirtualMCDecayer* decayer = new AliDecayerPythia();
176   // DECAYS
177   //
178   switch(decHvFl) {
179   case kNature:
180     decayer->SetForceDecay(kAll);
181     break;
182   case kHadr:
183     decayer->SetForceDecay(kHadronicD);
184     break;
185   case kSemiEl:
186     decayer->SetForceDecay(kSemiElectronic);
187     break;
188   case kSemiMu:
189     decayer->SetForceDecay(kSemiMuonic);
190     break;
191   }
192   decayer->Init();
193   gMC->SetExternalDecayer(decayer);
194
195   //=========================//
196   // Generator Configuration //
197   //=========================//
198   AliGenPythia *pythia = PythiaHVQ(procHvFl);
199   // FeedDown option
200   pythia->SetFeedDownHigherFamily(kFALSE);
201   // Stack filling option
202   if(!stars) pythia->SetStackFillOpt(AliGenPythia::kParentSelection);
203   // Set Count mode
204   if(nEvts>0) pythia->SetCountMode(AliGenPythia::kCountParents);
205   // DECAYS
206   //
207   switch(decHvFl) {
208   case kNature:
209     pythia->SetForceDecay(kAll);
210     break;
211   case kHadr:
212     pythia->SetForceDecay(kHadronicD);
213     break;
214   case kSemiEl:
215     pythia->SetForceDecay(kSemiElectronic);
216     break;
217   case kSemiMu:
218     pythia->SetForceDecay(kSemiMuonic);
219     break;
220   }
221   // GEOM & KINE CUTS
222   //
223   pythia->SetMomentumRange(0,99999999);
224   pythia->SetPhiRange(0., 360.);
225   pythia->SetThetaRange(0,180);
226   switch(ycut) {
227   case kFull:
228     pythia->SetYRange(-999,999);
229     break;
230   case kBarrel:
231     pythia->SetYRange(-2,2);
232     break;
233   case kMuonArm:
234     pythia->SetYRange(1,6);
235     break;
236   }
237
238   // PRIMARY VERTEX
239   //
240   pythia->SetOrigin(0, 0, 0);    // vertex position
241   pythia->SetSigma(0, 0, 5.3);   // Sigma in (X,Y,Z) (cm) on IP position
242   pythia->SetCutVertexZ(1.);     // Truncate at 1 sigma
243   pythia->SetVertexSmear(kPerEvent); 
244
245
246
247   pythia->SetTrackingFlag(0);
248   // Specify GEANT tracking limits (Rmax, Zmax)
249   //gAlice->TrackingLimits(90.,1.0e10);
250
251
252   pythia->Init();
253
254   // FIELD
255   //    
256   if (mag == k2kG) {
257     comment = comment.Append(" | L3 field 0.2 T");
258   } else if (mag == k4kG) {
259     comment = comment.Append(" | L3 field 0.4 T");
260   } else if (mag == k5kG) {
261     comment = comment.Append(" | L3 field 0.5 T");
262   }
263   printf("\n \n Comment: %s \n \n", comment.Data());
264     
265   AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., mag);
266   rl->CdGAFile();
267   gAlice->SetField(field);    
268
269
270   // By default all ALICE is switched off
271   Int_t iABSO=0;
272   Int_t iCRT=0;
273   Int_t iDIPO=0;
274   Int_t iFMD=0;
275   Int_t iFRAME=0;
276   Int_t iHALL=0;
277   Int_t iITS=0;
278   Int_t iMAG=0;
279   Int_t iMUON=0;
280   Int_t iPHOS=0;
281   Int_t iPIPE=0;
282   Int_t iPMD=0;
283   Int_t iRICH=0;
284   Int_t iSHIL=0;
285   Int_t iSTART=0;
286   Int_t iTOF=0;
287   Int_t iTPC=0;
288   Int_t iTRD=0;
289   Int_t iZDC=0;
290
291   //=================== Alice BODY parameters =============================
292   AliBODY *BODY = new AliBODY("BODY","Alice envelop");
293
294   if(iMAG) {
295     //=================== MAG parameters ============================
296     // --- Start with Magnet since detector layouts may be depending ---
297     // --- on the selected Magnet dimensions ---
298     AliMAG *MAG  = new AliMAG("MAG","Magnet");
299   }
300
301
302   if(iABSO) {
303     //=================== ABSO parameters ============================
304     AliABSO *ABSO  = new AliABSOv0("ABSO","Muon Absorber");
305   }
306
307   if(iDIPO) {
308     //=================== DIPO parameters ============================
309
310     AliDIPO *DIPO  = new AliDIPOv2("DIPO","Dipole version 2");
311   }
312
313   if(iHALL) {
314     //=================== HALL parameters ============================
315
316     AliHALL *HALL  = new AliHALL("HALL","Alice Hall");
317   }
318
319
320   if(iFRAME) {
321     //=================== FRAME parameters ============================
322
323     AliFRAME *FRAME  = new AliFRAMEv2("FRAME","Space Frame");
324
325   }
326
327   if(iSHIL) {
328     //=================== SHIL parameters ============================
329
330     AliSHIL *SHIL  = new AliSHILv2("SHIL","Shielding");
331   }
332
333
334   if(iPIPE) {
335     //=================== PIPE parameters ============================
336
337     AliPIPE *PIPE  = new AliPIPEv0("PIPE","Beam Pipe");
338   }
339
340
341   if(iITS) {
342
343 //=================== ITS parameters ============================
344     //
345     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
346     // almost all other detectors. This involves the fact that the ITS geometry
347     // still has several options to be followed in parallel in order to determine
348     // the best set-up which minimizes the induced background. All the geometries
349     // available to date are described in the following. Read carefully the comments
350     // and use the default version (the only one uncommented) unless you are making
351     // comparisons and you know what you are doing. In this case just uncomment the
352     // ITS geometry you want to use and run Aliroot.
353     //
354     // Detailed geometries:         
355     //
356     //
357     //AliITS *ITS  = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
358     //
359     //AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
360     //
361     AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
362     ITS->SetMinorVersion(2);                                         // don't touch this parameter if you're not an ITS developer
363     ITS->SetReadDet(kFALSE);                                         // don't touch this parameter if you're not an ITS developer
364     ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
365     ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [150,300]
366     ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [150,300]
367     ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [100,300]
368     ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [100,300]
369     ITS->SetRails(1);              // 1 --> rails in ; 0 --> rails out
370     ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
371     //
372     //AliITSvPPRsymm *ITS  = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric services");
373     //ITS->SetMinorVersion(2);                                       // don't touch this parameter if you're not an ITS developer
374     //ITS->SetReadDet(kFALSE);                                       // don't touch this parameter if you're not an ITS developer
375     //ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRsymm2.det"); // don't touch this parameter if you're not an ITS developer
376     //ITS->SetThicknessDet1(300.);   // detector thickness on layer 1 must be in the range [150,300]
377     //ITS->SetThicknessDet2(300.);   // detector thickness on layer 2 must be in the range [150,300]
378     //ITS->SetThicknessChip1(300.);  // chip thickness on layer 1 must be in the range [100,300]
379     //ITS->SetThicknessChip2(300.);  // chip thickness on layer 2 must be in the range [100,300]
380     //ITS->SetRails(1);              // 1 --> rails in ; 0 --> rails out
381     //ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
382     //
383     //
384     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
385     // for reconstruction !):
386     //                                                     
387     //
388     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
389     //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
390     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
391     //
392     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
393     //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
394     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
395     //                      
396     //
397     //
398     // Geant3 <-> EUCLID conversion
399     // ============================
400     //
401     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
402     // media to two ASCII files (called by default ITSgeometry.euc and
403     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
404     // The default (=0) means that you dont want to use this facility.
405     //
406     ITS->SetEUCLID(0);  
407   }
408   
409
410   if(iTPC) {
411     //============================ TPC parameters ================================
412     // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
413     // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
414     // --- sectors are specified, any value other than that requires at least one 
415     // --- sector (lower or upper)to be specified!
416     // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
417     // ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
418     // --- SecLows - number of lower sectors specified (up to 6)
419     // --- SecUps - number of upper sectors specified (up to 12)
420     // --- Sens - sensitive strips for the Slow Simulator !!!
421     // --- This does NOT work if all S or L-sectors are specified, i.e.
422     // --- if SecAL or SecAU < 0
423     //
424     //
425     //-----------------------------------------------------------------------------
426
427     //  gROOT->LoadMacro("SetTPCParam.C");
428     //  AliTPCParam *param = SetTPCParam();
429     AliTPC *TPC  = new AliTPCv2("TPC","Default");
430     // All sectors included 
431     TPC->SetSecAL(-1);
432     TPC->SetSecAU(-1);
433
434   }
435
436
437   if(iTOF) {
438     //=================== TOF parameters ============================
439     AliTOF *TOF  = new AliTOFv4T0("TOF","normal TOF");
440   }
441
442   if(iRICH) {
443     //=================== RICH parameters ===========================
444     AliRICH *RICH  = new AliRICHv1("RICH","normal RICH");    
445
446   }
447
448
449   if(iZDC) {
450     //=================== ZDC parameters ============================
451
452     AliZDC *ZDC  = new AliZDCv1("ZDC","normal ZDC");
453   }
454
455   if(iCRT) {
456     //=================== CRT parameters ============================
457
458     AliCRT *CRT  = new AliCRTv1("CRT","normal CRT");
459   }
460
461   if(iTRD) {
462     //=================== TRD parameters ============================
463   
464     AliTRD *TRD  = new AliTRDv1("TRD","TRD slow simulator");
465   
466     // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
467     TRD->SetGasMix(1);
468   
469     // With hole in front of PHOS
470     TRD->SetPHOShole();
471     // With hole in front of RICH
472     TRD->SetRICHhole();
473     // Switch on TR
474     AliTRDsim *TRDsim = TRD->CreateTR();
475   }
476
477   if(iFMD) {
478     //=================== FMD parameters ============================
479
480     AliFMD *FMD  = new AliFMDv0("FMD","normal FMD");
481   }
482
483   if(iMUON) {
484     //=================== MUON parameters ===========================
485     AliMUON *MUON  = new AliMUONv1("MUON","default");
486   }
487  
488   //=================== PHOS parameters ===========================
489
490   if(iPHOS) {
491     AliPHOS *PHOS  = new AliPHOSv1("PHOS","GPS2");
492   }
493
494
495   //=================== CRT parameters ===========================
496
497   if(iCRT) {
498     AliCRT *CRT  = new AliCRTv1("CRT","Normal CRTGPS2");
499   }
500
501
502   if(iPMD) {
503     //=================== PMD parameters ============================
504
505     AliPMD *PMD  = new AliPMDv1("PMD","normal PMD");
506     PMD->SetPAR(1., 1., 0.8, 0.02);
507     PMD->SetIN(6., 18., -580., 27., 27.);
508     PMD->SetGEO(0.0, 0.2, 4.);
509     PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
510
511   }
512
513   if(iSTART) {
514     //=================== START parameters ============================
515     AliSTART *START  = new AliSTARTv1("START","START Detector");
516   }
517
518          
519 }
520 //
521 //           PYTHIA
522 //
523 AliGenPythia *PythiaHVQ(ProcessHvFl_t proc) {
524
525   AliGenPythia * gener = 0x0;
526
527   switch(proc) {
528   case kCharmPbPb5500:
529     comment = comment.Append(" Charm in Pb-Pb at 5.5 TeV");
530     gener = new AliGenPythia(nEvts);
531     gener->SetProcess(kPyCharmPbPbMNR);
532     gener->SetStrucFunc(kCTEQ4L);
533     gener->SetPtHard(2.1,-1.0);
534     gener->SetEnergyCMS(5500.);
535     gener->SetNuclei(208,208);
536     break;
537   case kCharmpPb8800:
538     comment = comment.Append(" Charm in p-Pb at 8.8 TeV");
539     gener = new AliGenPythia(nEvts);
540     gener->SetProcess(kPyCharmpPbMNR);
541     gener->SetStrucFunc(kCTEQ4L);
542     gener->SetPtHard(2.1,-1.0);
543     gener->SetEnergyCMS(8800.);
544     gener->SetProjectile("P",1,1);
545     gener->SetTarget("Pb",208,82);
546     break;
547   case kCharmpp14000:
548     comment = comment.Append(" Charm in pp at 14 TeV");
549     gener = new AliGenPythia(nEvts);
550     gener->SetProcess(kPyCharmppMNR);
551     gener->SetStrucFunc(kCTEQ4L);
552     gener->SetPtHard(2.1,-1.0);
553     gener->SetEnergyCMS(14000.);
554     break;
555   case kD0PbPb5500:
556     comment = comment.Append(" D0 in Pb-Pb at 5.5 TeV");
557     gener = new AliGenPythia(nEvts);
558     gener->SetProcess(kPyD0PbPbMNR);
559     gener->SetStrucFunc(kCTEQ4L);
560     gener->SetPtHard(2.1,-1.0);
561     gener->SetEnergyCMS(5500.);
562     gener->SetNuclei(208,208);
563     break;
564   case kD0pPb8800:
565     comment = comment.Append(" D0 in p-Pb at 8.8 TeV");
566     gener = new AliGenPythia(nEvts);
567     gener->SetProcess(kPyD0pPbMNR);
568     gener->SetStrucFunc(kCTEQ4L);
569     gener->SetPtHard(2.1,-1.0);
570     gener->SetEnergyCMS(8800.);
571     gener->SetProjectile("P",1,1);
572     gener->SetTarget("Pb",208,82);
573     break;
574   case kD0pp14000:
575     comment = comment.Append(" D0 in pp at 14 TeV");
576     gener = new AliGenPythia(nEvts);
577     gener->SetProcess(kPyD0ppMNR);
578     gener->SetStrucFunc(kCTEQ4L);
579     gener->SetPtHard(2.1,-1.0);
580     gener->SetEnergyCMS(14000.);
581     break;
582   case kBeautyPbPb5500:
583     comment = comment.Append(" Beauty in Pb-Pb at 5.5 TeV");
584     gener = new AliGenPythia(nEvts);
585     gener->SetProcess(kPyBeautyPbPbMNR);
586     gener->SetStrucFunc(kCTEQ4L);
587     gener->SetPtHard(2.75,-1.0);
588     gener->SetEnergyCMS(5500.);
589     gener->SetNuclei(208,208);
590     break;
591   case kBeautypPb8800:
592     comment = comment.Append(" Beauty in p-Pb at 8.8 TeV");
593     gener = new AliGenPythia(nEvts);
594     gener->SetProcess(kPyBeautypPbMNR);
595     gener->SetStrucFunc(kCTEQ4L);
596     gener->SetPtHard(2.75,-1.0);
597     gener->SetEnergyCMS(8800.);
598     gener->SetProjectile("P",1,1);
599     gener->SetTarget("Pb",208,82);
600     break;
601   case kBeautypp14000:
602     comment = comment.Append(" Beauty in pp at 14 TeV");
603     gener = new AliGenPythia(nEvts);
604     gener->SetProcess(kPyBeautyppMNR);
605     gener->SetStrucFunc(kCTEQ4L);
606     gener->SetPtHard(2.75,-1.0);
607     gener->SetEnergyCMS(14000.);
608     break;
609   }
610
611   return gener;
612 }
613
614
615
616
617