]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/Config.C
Moved mode lines to end of files
[u/mrichter/AliRoot.git] / FMD / Config.C
1 static Int_t    eventsPerRun = 1;
2 static Int_t    nParticles   = 1000;
3
4 enum PprRun_t {
5   test50,
6   kParam_8000,   
7   kParam_4000,  
8   kParam_2000,
9   kHijing_cent1, 
10   kHijing_cent2,
11   kHijing_per1,  
12   kHijing_per2, 
13   kHijing_per3, 
14   kHijing_per4,  
15   kHijing_per5,
16   kHijing_jj25,  
17   kHijing_jj50, 
18   kHijing_jj75, 
19   kHijing_jj100, 
20   kHijing_jj200,
21   kHijing_gj25,  
22   kHijing_gj50, 
23   kHijing_gj75, 
24   kHijing_gj100, 
25   kHijing_gj200,
26   kHijing_pA, 
27   kPythia6, 
28   kPythia6Jets, 
29   kD0PbPb5500, 
30   kD_TRD, 
31   kB_TRD, 
32   kJpsi_TRD,
33   kU_TRD, 
34   kPyJJ, 
35   kPyGJ
36 };
37
38 enum PprGeo_t {
39   kHoles, 
40   kNoHoles
41 };
42
43 enum PprRad_t {
44   kGluonRadiation, 
45   kNoGluonRadiation
46 };
47
48 enum PprMag_t {
49   k2kG, 
50   k4kG, 
51   k5kG
52 };
53
54 enum MC_t {
55   kFLUKA, 
56   kGEANT3, 
57   kGEANT4
58 };
59
60
61 // This part for configuration
62 //static PprRun_t srun = test50;
63 static PprRun_t srun = kPythia6;
64 static PprGeo_t sgeo = kHoles;
65 static PprRad_t srad = kGluonRadiation;
66 static PprMag_t smag = k5kG;
67 static MC_t     smc  = kFLUKA;
68
69 // Comment line
70 static TString  comment;
71
72 // Functions
73 Float_t EtaToTheta(Float_t arg);
74
75
76 void Config()
77 {
78   cout << "==> Config.C..." << endl;
79   
80   // Set Random Number seed
81   gRandom->SetSeed(12345);
82   cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
83
84   switch (smc) {
85   case kFLUKA: 
86     {
87       // 
88       // libraries required by fluka21
89       // 
90       gSystem->Load("libGeom");
91       cout << "\t* Loading TFluka..." << endl;  
92       gSystem->Load("libTFluka");    
93       
94       // 
95       // FLUKA MC
96       //
97       cout << "\t* Instantiating TFluka..." << endl;
98       TFluka* fluka = new TFluka("C++ Interface to Fluka", 0/*verbosity*/);
99       //
100       // Use kTRUE as argument to generate alice.pemf first
101       //
102       TString alice_pemf(gSystem->Which(".", "FlukaVmc.pemf"));
103       if (!alice_pemf.IsNull()) 
104         fluka->SetGeneratePemf(kFALSE);
105       else
106         fluka->SetGeneratePemf(kTRUE);
107     }
108     break;
109   case kGEANT3: 
110     {
111       //
112       // Libraries needed by GEANT 3.21 
113       //
114       gSystem->Load("libgeant321");
115       
116       // 
117       // GEANT 3.21 MC 
118       // 
119       TGeant3* geant3 = new TGeant3("C++ Interface to Geant3");
120     }
121     break;
122   default:
123     gAlice->Fatal("Config.C", "No MC type chosen");
124     return;
125   }
126   
127   //
128   // Run loader
129   //
130   cout<<"Config.C: Creating Run Loader ..."<<endl;
131   AliRunLoader* rl = AliRunLoader::Open("galice.root",
132                                         AliConfig::GetDefaultEventFolderName(),
133                                         "recreate");
134   if (!rl) {
135     gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
136     return;
137   }
138   rl->SetCompressionLevel(2);
139   rl->SetNumberOfEventsPerFile(3);
140   gAlice->SetRunLoader(rl);
141
142   //
143   // Set External decayer
144   // 
145   AliDecayer *decayer = new AliDecayerPythia();
146   decayer->SetForceDecay(kAll);
147   decayer->Init();
148   gMC->SetExternalDecayer(decayer);
149
150
151   //
152   // Physics process control
153   // 
154   gMC->SetProcess("DCAY",1);
155   gMC->SetProcess("PAIR",1);
156   gMC->SetProcess("COMP",1);
157   gMC->SetProcess("PHOT",1);
158   gMC->SetProcess("PFIS",0);
159   gMC->SetProcess("DRAY",1);
160   gMC->SetProcess("ANNI",1);
161   gMC->SetProcess("BREM",1);
162   gMC->SetProcess("MUNU",1);
163   gMC->SetProcess("CKOV",1); 
164   gMC->SetProcess("HADR",1);
165   gMC->SetProcess("LOSS",2);
166   gMC->SetProcess("MULS",1);  
167   gMC->SetProcess("RAYL",1);
168
169   Float_t cut = 1.e-3;        // 1MeV cut by default
170   Float_t tofmax = 1.e10;
171
172   gMC->SetCut("CUTGAM", cut);
173   gMC->SetCut("CUTELE", cut);
174   gMC->SetCut("CUTNEU", cut);
175   gMC->SetCut("CUTHAD", cut);
176   gMC->SetCut("CUTMUO", cut);
177   gMC->SetCut("BCUTE",  cut);
178   gMC->SetCut("BCUTM",  cut);
179   gMC->SetCut("DCUTE",  cut);
180   gMC->SetCut("DCUTM",  cut);
181   gMC->SetCut("PPCUTM", cut);
182   gMC->SetCut("TOFMAX", tofmax);
183
184   //
185   //=======================================================================
186   // STEERING parameters FOR ALICE SIMULATION 
187   // 
188   // Specify event type to be tracked through the ALICE setup.  All
189   // positions are in cm, angles in degrees, and P and E in GeV
190   // 
191   if (gSystem->Getenv("CONFIG_NPARTICLES"))
192     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
193
194   cout << "\t* Creating and configuring generator for " << nParticles 
195        << " particles..." << endl;
196   AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
197   gener->SetMomentumRange(0., 999);
198   gener->SetPhiRange(0, 360);
199
200   // Set pseudorapidity range from -6 to 6.
201   Float_t thmin = EtaToTheta( 6.);   // theta min. <---> eta max
202   Float_t thmax = EtaToTheta(-6.);   // theta max. <---> eta min 
203   gener->SetThetaRange(thmin,thmax);
204   gener->SetOrigin(0, 0, 0);  //vertex position
205   gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
206   gener->Init();
207   // 
208   // Activate this line if you want the vertex smearing to happen
209   // track by track
210   //
211   gAlice->SetDebug(10);
212
213   // 
214   // Comments 
215   // 
216   switch (smag) {
217   case k2kG: comment = comment.Append(" | L3 field 0.2 T"); break;
218   case k4kG: comment = comment.Append(" | L3 field 0.4 T"); break;
219   case k5kG: comment = comment.Append(" | L3 field 0.5 T"); break;
220   }
221
222   switch (srad) {
223   case kGluonRadiation: 
224     comment = comment.Append(" | Gluon Radiation On");  break;
225   default:
226     comment = comment.Append(" | Gluon Radiation Off"); break;
227   }
228
229   switch(sgeo) {
230   case kHoles: comment = comment.Append(" | Holes for PHOS/RICH"); break;
231   default:     comment = comment.Append(" | No holes for PHOS/RICH"); break;
232   }
233
234   std::cout << "\n\n Comment: " << comment << "\n" << std::endl;
235
236   // 
237   // Field (L3 0.4 T)
238   // 
239   AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., smag);
240   field->SetL3ConstField(0); //Using const. field in the barrel
241   rl->CdGAFile();
242   gAlice->SetField(field);
243
244   // 
245   // Used detectors 
246   // 
247   Bool_t useABSO  = kFALSE; 
248   Bool_t useCRT   = kFALSE; 
249   Bool_t useDIPO  = kFALSE; 
250   Bool_t useFMD   = kTRUE; 
251   Bool_t useFRAME = kFALSE; 
252   Bool_t useHALL  = kFALSE; 
253   Bool_t useITS   = kFALSE; 
254   Bool_t useMAG   = kFALSE; 
255   Bool_t useMUON  = kFALSE; 
256   Bool_t usePHOS  = kFALSE; 
257   Bool_t usePIPE  = kFALSE; 
258   Bool_t usePMD   = kFALSE; 
259   Bool_t useRICH  = kFALSE; 
260   Bool_t useSHIL  = kFALSE; 
261   Bool_t useSTART = kFALSE; 
262   Bool_t useTOF   = kFALSE; 
263   Bool_t useTPC   = kFALSE;
264   Bool_t useTRD   = kFALSE; 
265   Bool_t useZDC   = kFALSE; 
266   Bool_t useEMCAL = kFALSE; 
267   Bool_t useVZERO = kFALSE;
268
269   cout << "\t* Creating the detectors ..." << endl;
270   //=================== Alice BODY parameters =============================
271   //=================== Alice BODY parameters =============================
272   AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
273   
274   
275   if (useMAG) {
276     //=================== MAG parameters ============================
277     // Start with Magnet since detector layouts may be depending on
278     // the selected Magnet dimensions 
279     AliMAG *MAG = new AliMAG("MAG", "Magnet");
280   }
281
282   if (useABSO) {
283     //=================== ABSO parameters ============================
284     AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
285   }
286
287   if (useDIPO) {
288     //=================== DIPO parameters ============================
289     
290     AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
291   }
292
293   if (useHALL) {
294     //=================== HALL parameters ============================
295     AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
296   }
297
298
299   if (useFRAME) {
300     //=================== FRAME parameters ============================
301     AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
302     switch (sgeo) {
303     case kHoles: FRAME->SetHoles(1); break;
304     default:     FRAME->SetHoles(0); break;
305     }
306   }
307
308   if (useSHIL) {
309     //=================== SHIL parameters ============================
310     AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
311   }
312
313
314   if (usePIPE) {
315     //=================== PIPE parameters ============================
316     AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
317   }
318   
319   if (useITS) {
320     //=================== ITS parameters ============================
321     //
322     // As the innermost detector in ALICE, the Inner Tracking System
323     // "impacts" on almost all other detectors. This involves the fact
324     // that the ITS geometry still has several options to be followed
325     // in parallel in order to determine the best set-up which
326     // minimizes the induced background. All the geometries available
327     // to date are described in the following. Read carefully the
328     // comments and use the default version (the only one uncommented)
329     // unless you are making comparisons and you know what you are
330     // doing. In this case just uncomment the ITS geometry you want to
331     // use and run Aliroot.
332     //
333     // Detailed geometries:
334     //
335     //
336     // AliITS *ITS = 
337     //   new AliITSv5symm("ITS", "Updated ITS TDR detailed version "
338     //                    "with symmetric services");
339     // AliITS *ITS  = 
340     //   new AliITSv5asymm("ITS","Updates ITS TDR detailed version "
341     //                     "with asymmetric services");
342     //
343     AliITSvPPRasymmFMD *ITS  = 
344       new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version "
345                              "with asymmetric services");
346      // don't touch this parameter if you're not an ITS developer
347     ITS->SetMinorVersion(2); 
348     // don't touch this parameter if you're not an ITS developer
349     ITS->SetReadDet(kTRUE);
350     // don't touch this parameter if you're not an ITS developer
351     // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  
352     // detector thickness on layer 1 must be in the range [100,300]
353     ITS->SetThicknessDet1(200.);   
354     // detector thickness on layer 2 must be in the range [100,300]
355     ITS->SetThicknessDet2(200.);   
356     // chip thickness on layer 1 must be in the range [150,300]
357     ITS->SetThicknessChip1(200.);  
358     // chip thickness on layer 2 must be in the range [150,300]
359     ITS->SetThicknessChip2(200.);
360     // 1 --> rails in ; 0 --> rails out
361     ITS->SetRails(0);          
362     // 1 --> water ; 0 --> freon
363     ITS->SetCoolingFluid(1);   
364
365     // Coarse geometries (warning: no hits are produced with these
366     // coarse geometries and they unuseful for reconstruction !):
367     //
368     //
369     // AliITSvPPRcoarseasymm *ITS  = 
370     //   new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version "
371     //                             "with asymmetric services");
372     // 1 --> rails in ; 0 --> rails out
373     // ITS->SetRails(0);
374     // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
375     // ITS->SetSupportMaterial(0);      
376     //
377     // AliITS *ITS  = 
378     //  new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version "
379     //                           "with symmetric services");
380     // 1 --> rails in ; 0 --> rails out
381     // ITS->SetRails(0);                
382     // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
383     // ITS->SetSupportMaterial(0);      
384     //
385     // Geant3 <-> EUCLID conversion
386     // ============================
387     //
388     // SetEUCLID is a flag to output (=1) or not to output (=0) both
389     // geometry and media to two ASCII files (called by default
390     // ITSgeometry.euc and ITSgeometry.tme) in a format understandable
391     // to the CAD system EUCLID.  The default (=0) means that you dont
392     // want to use this facility.
393     //
394     ITS->SetEUCLID(0);
395   }
396
397   if (useTPC) {
398     //============================ TPC parameters ====================
399     //
400     // This allows the user to specify sectors for the SLOW (TPC
401     // geometry 2) Simulator. SecAL (SecAU) <0 means that ALL lower
402     // (upper) sectors are specified, any value other than that
403     // requires at least one sector (lower or upper)to be specified!
404     //
405     // Reminder: 
406     //   sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
407     //   sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
408     //
409     //   SecLows - number of lower sectors specified (up to 6)
410     //   SecUps  - number of upper sectors specified (up to 12)
411     //   Sens    - sensitive strips for the Slow Simulator !!!
412     //
413     // This does NOT work if all S or L-sectors are specified, i.e.
414     // if SecAL or SecAU < 0
415     //
416     //
417     //----------------------------------------------------------------
418     //  gROOT->LoadMacro("SetTPCParam.C");
419     //  AliTPCParam *param = SetTPCParam();
420     AliTPC *TPC = new AliTPCv2("TPC", "Default");
421     
422     // All sectors included
423     TPC->SetSecAL(-1);
424     TPC->SetSecAU(-1);
425   }
426
427   if (useTOF) {
428     //=================== TOF parameters ============================
429     AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF");
430   }
431
432   if (useRICH) {
433     //=================== RICH parameters ===========================
434     AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
435
436   }
437
438   if (useZDC) {
439     //=================== ZDC parameters ============================
440     AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
441   }
442
443   if (useTRD) {
444     //=================== TRD parameters ============================
445     AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
446
447     // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
448     TRD->SetGasMix(1);
449     if (sgeo == kHoles) {
450       // With hole in front of PHOS
451       TRD->SetPHOShole();
452       // With hole in front of RICH
453       TRD->SetRICHhole();
454     }
455     // Switch on TR
456     AliTRDsim *TRDsim = TRD->CreateTR();
457   }
458
459   if (useFMD) {
460     //=================== FMD parameters ============================
461     AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
462   }
463
464   if (useMUON) {
465     //=================== MUON parameters ===========================
466     AliMUON *MUON = new AliMUONv1("MUON", "default");
467     MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilder(MUON));
468     MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilder(MUON));
469     MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
470     MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
471   }
472
473   if (usePHOS) {
474     //=================== PHOS parameters ===========================
475     AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
476   }
477
478   if (usePMD) {
479     //=================== PMD parameters ============================
480     AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
481   }
482
483   if (useSTART) {
484     //=================== START parameters ============================
485     AliSTART *START = new AliSTARTv1("START", "START Detector");
486   }
487
488   if (useEMCAL) {
489     //=================== EMCAL parameters ============================
490     AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCAL_55_25");
491   }
492
493   if (useCRT) {
494     //=================== CRT parameters ============================
495     AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
496   }
497
498   if (useVZERO) {
499     //=================== CRT parameters ============================
500     AliVZERO *VZERO = new AliVZEROv3("VZERO", "normal VZERO");
501   }
502 }
503
504 Float_t EtaToTheta(Float_t arg)
505 {
506   return (180./TMath::Pi())*2.*atan(exp(-arg));
507 }
508