]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TRD/Macros/AliTRDConfigPID.C
Using symbolic particle types everywhere
[u/mrichter/AliRoot.git] / TRD / Macros / AliTRDConfigPID.C
... / ...
CommitLineData
1//
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.
6// s.masciocchi@gsi.de
7//
8
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++")
14
15#if !defined(__CINT__) || defined(__MAKECINT__)
16#include <Riostream.h>
17#include <TPDGCode.h>
18#include <TRandom.h>
19#include <TDatime.h>
20#include <TSystem.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/AliACORDEv0.h"
54#include "VZERO/AliVZEROv6.h"
55#endif
56
57
58enum PDC06Proc_t
59{
60//--- Heavy Flavour Production ---
61 kCharmPbPb5500, kCharmpPb8800, kCharmpp14000, kCharmpp14000wmi,
62 kD0PbPb5500, kD0pPb8800, kD0pp14000,
63 kDPlusPbPb5500, kDPluspPb8800, kDPluspp14000,
64 kBeautyPbPb5500, kBeautypPb8800, kBeautypp14000, kBeautypp14000wmi,
65// -- Pythia Mb
66 kPyMbNoHvq, kPyOmegaPlus, kPyOmegaMinus, kRunMax
67};
68
69const char * pprRunName[] = {
70 "kCharmPbPb5500", "kCharmpPb8800", "kCharmpp14000", "kCharmpp14000wmi",
71 "kD0PbPb5500", "kD0pPb8800", "kD0pp14000",
72 "kDPlusPbPb5500", "kDPluspPb8800", "kDPluspp14000",
73 "kBeautyPbPb5500", "kBeautypPb8800", "kBeautypp14000", "kBeautypp14000wmi",
74 "kPyMbNoHvq", "kPyOmegaPlus", "kPyOmegaMinus"
75};
76
77
78//--- Decay Mode ---
79enum DecayHvFl_t
80{
81 kNature, kHadr, kSemiEl, kSemiMu
82};
83//--- Rapidity Cut ---
84enum YCut_t
85{
86 kFull, kBarrel, kMuonArm
87};
88//--- Magnetic Field ---
89enum Mag_t
90{
91 k2kG, k4kG, k5kG
92};
93//--- Functions ---
94AliGenPythia *PythiaHVQ(PDC06Proc_t proc);
95AliGenerator *MbCocktail();
96AliGenerator *PyMbTriggered(Int_t pdg);
97void ProcessEnvironmentVars();
98Float_t EtaToTheta(Float_t arg){
99 return (180./TMath::Pi())*2.*atan(exp(-arg));
100}
101
102// This part for configuration
103static DecayHvFl_t decHvFl = kNature;
104static YCut_t ycut = kBarrel;
105static Mag_t mag = k5kG;
106//========================//
107// Set Random Number seed //
108//========================//
109TDatime dt;
110static UInt_t seed = dt.Get();
111
112// nEvts = -1 : you get 1 QQbar pair and all the fragmentation and
113// decay chain
114// nEvts = N>0 : you get N charm / beauty Hadrons
115Int_t nEvts = -1;
116// stars = kTRUE : all heavy resonances and their decay stored
117// = kFALSE: only final heavy hadrons and their decays stored
118Bool_t stars = kTRUE;
119
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
125// normalizations:
126// CHARM
127// 2.76-3 GeV: 25%
128// 3-4 GeV: 40%
129// 4-8 GeV: 29%
130// >8 GeV: 6%
131// BEAUTY
132// 2.76-4 GeV: 5%
133// 4-6 GeV: 31%
134// 6-8 GeV: 28%
135// >8 GeV: 36%
136Float_t ptHardMin = 2.76;
137Float_t ptHardMax = -1.;
138
139
140// Comment line
141static TString comment;
142
143void Config()
144{
145
146
147 // Get settings from environment variables
148 ProcessEnvironmentVars();
149
150 gRandom->SetSeed(seed);
151 cerr<<"Seed for random number generation= "<<seed<<endl;
152
153 // libraries required by geant321
154#if defined(__CINT__)
155 gSystem->Load("libgeant321");
156#endif
157
158 new TGeant3TGeo("C++ Interface to Geant3");
159
160 //=======================================================================
161 // Create the output file
162
163
164 AliRunLoader* rl=0x0;
165
166 cout<<"Config.C: Creating Run Loader ..."<<endl;
167 rl = AliRunLoader::Open("galice.root",
168 AliConfig::GetDefaultEventFolderName(),
169 "recreate");
170 if (rl == 0x0)
171 {
172 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
173 return;
174 }
175 rl->SetCompressionLevel(2);
176 rl->SetNumberOfEventsPerFile(1000);
177 gAlice->SetRunLoader(rl);
178
179 //
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
184
185
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);
200
201 Float_t cut = 1.e-3; // 1MeV cut by default
202 Float_t tofmax = 1.e10;
203
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);
215
216
217
218
219 // Set External decayer //
220 //======================//
221 TVirtualMCDecayer* decayer = new AliDecayerPythia();
222 // DECAYS
223 //
224 switch(decHvFl) {
225 case kNature:
226 decayer->SetForceDecay(kAll);
227 break;
228 case kHadr:
229 decayer->SetForceDecay(kHadronicD);
230 break;
231 case kSemiEl:
232 decayer->SetForceDecay(kSemiElectronic);
233 break;
234 case kSemiMu:
235 decayer->SetForceDecay(kSemiMuonic);
236 break;
237 }
238 decayer->Init();
239 gMC->SetExternalDecayer(decayer);
240
241 //=========================//
242 // Generator Configuration //
243 //=========================//
244
245 AliGenCocktail *gener = new AliGenCocktail();
246 Double_t momen = 0.6;
247 Int_t Npart = 50;
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
251
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
260
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
269
270 // mu- generator
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
278
279 // mu+ generator
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
287
288 // pi- generator
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
296
297 // pi+ generator
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
305
306 // K- generator
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
314
315 // K+ generator
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
323
324 // p generator
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
332
333 // anti-p generator
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
341
342
343
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);
354
355 gener->Init();
356
357 // FIELD
358 //
359 if (mag == k2kG) {
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");
365 }
366 printf("\n \n Comment: %s \n \n", comment.Data());
367
368 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., mag);
369 field->SetL3ConstField(0); //Using const. field in the barrel
370 rl->CdGAFile();
371 gAlice->SetField(field);
372
373 Int_t iABSO = 1;
374 Int_t iACORDE = 0;
375 Int_t iDIPO = 0;
376 Int_t iEMCAL = 0;
377 Int_t iFMD = 0;
378 Int_t iFRAME = 1;
379 Int_t iHALL = 1;
380 Int_t iITS = 1;
381 Int_t iMAG = 1;
382 Int_t iMUON = 0;
383 Int_t iPHOS = 1;
384 Int_t iPIPE = 1;
385 Int_t iPMD = 0;
386 Int_t iHMPID = 1;
387 Int_t iSHIL = 0;
388 Int_t iT0 = 0;
389 Int_t iTOF = 1;
390 Int_t iTPC = 1;
391 Int_t iTRD = 1;
392 Int_t iVZERO = 0;
393 Int_t iZDC = 0;
394
395
396 //=================== Alice BODY parameters =============================
397 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
398
399
400 if (iMAG)
401 {
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");
406 }
407
408
409 if (iABSO)
410 {
411 //=================== ABSO parameters ============================
412 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
413 }
414
415 if (iDIPO)
416 {
417 //=================== DIPO parameters ============================
418
419 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
420 }
421
422 if (iHALL)
423 {
424 //=================== HALL parameters ============================
425
426 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
427 }
428
429
430 if (iFRAME)
431 {
432 //=================== FRAME parameters ============================
433
434 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
435 FRAME->SetHoles(0);
436 }
437
438 if (iSHIL)
439 {
440 //=================== SHIL parameters ============================
441
442 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
443 }
444
445
446 if (iPIPE)
447 {
448 //=================== PIPE parameters ============================
449
450 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
451 }
452
453 if(iITS) {
454
455 //=================== ITS parameters ============================
456 //
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.
465 //
466 // Detailed geometries:
467 //
468 //
469 //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
470 //
471 //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
472 //
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
483
484 // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
485 // for reconstruction !):
486 //
487 //
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
491 //
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
495 //
496 //
497 //
498 // Geant3 <-> EUCLID conversion
499 // ============================
500 //
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.
505 //
506 ITS->SetEUCLID(0);
507 }
508
509 if (iTPC)
510 {
511 //============================ TPC parameters =====================
512 AliTPC *TPC = new AliTPCv2("TPC", "Default");
513 }
514
515
516 if (iTOF) {
517 //=================== TOF parameters ============================
518 AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
519 }
520
521
522 if (iHMPID)
523 {
524 //=================== HMPID parameters ===========================
525 AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");
526
527 }
528
529
530 if (iZDC)
531 {
532 //=================== ZDC parameters ============================
533
534 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
535 }
536
537 if (iTRD)
538 {
539 //=================== TRD parameters ============================
540
541 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
542 AliTRDgeometry *geoTRD = TRD->GetGeometry();
543
544 }
545
546 if (iFMD)
547 {
548 //=================== FMD parameters ============================
549 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
550 }
551
552 if (iMUON)
553 {
554 //=================== MUON parameters ===========================
555 // New MUONv1 version (geometry defined via builders)
556 AliMUON *MUON = new AliMUONv1("MUON", "default");
557 }
558 //=================== PHOS parameters ===========================
559
560 if (iPHOS)
561 {
562 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
563 }
564
565
566 if (iPMD)
567 {
568 //=================== PMD parameters ============================
569 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
570 }
571
572 if (iT0)
573 {
574 //=================== T0 parameters ============================
575 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
576 }
577
578 if (iEMCAL)
579 {
580 //=================== EMCAL parameters ============================
581 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH");
582 }
583
584 if (iACORDE)
585 {
586 //=================== ACORDE parameters ============================
587 AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
588 }
589
590 if (iVZERO)
591 {
592 //=================== ACORDE parameters ============================
593 AliVZERO *VZERO = new AliVZEROv6("VZERO", "normal VZERO");
594 }
595}
596
597
598void ProcessEnvironmentVars()
599{
600 // Run type
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;
606 }
607 }
608 }
609
610 // Random Number seed
611 if (gSystem->Getenv("CONFIG_SEED")) {
612 seed = atoi(gSystem->Getenv("CONFIG_SEED"));
613 }
614}
615
616
617