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