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