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