]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/macro/FlukaConfig.C
Small fixes
[u/mrichter/AliRoot.git] / TFluka / macro / FlukaConfig.C
1 static Int_t    eventsPerRun = 100;
2 void Config()
3 {
4   cout << "==> Config.C..." << endl;
5   
6   // Set Random Number seed
7   // gRandom->SetSeed(12345);
8   
9   
10   // libraries required by fluka21
11   cout << "\t* Loading TFluka..." << endl;
12   gSystem->Load("libTFluka");    
13   
14   cout << "\t* Instantiating TFluka..." << endl;
15   new  TFluka("C++ Interface to Fluka", 3/*verbositylevel*/);
16   
17   cout << "\t* Recreating galice.root if needed..." << endl;
18   if (!gSystem->Getenv("CONFIG_FILE")) {
19     TFile  *rootfile = new TFile("galice.root", "recreate");
20     
21     rootfile->SetCompressionLevel(2);
22   }
23   
24   TFluka *fluka = (TFluka *) gMC;
25   fluka->SetInputFileName("alice.inp");
26   
27   //cout << "<== Config.C..." << endl;
28   //return;
29   //
30   // Set External decayer
31   TVirtualMCDecayer *decayer = new AliDecayerPythia();
32   
33   decayer->SetForceDecay(kAll);
34   decayer->Init();
35   gMC->SetExternalDecayer(decayer);
36   //
37   //
38   // Physics process control
39   gMC ->SetProcess("DCAY",1);
40   gMC ->SetProcess("PAIR",1);
41   gMC ->SetProcess("COMP",1);
42   gMC ->SetProcess("PHOT",1);
43   gMC ->SetProcess("PFIS",0);
44   gMC ->SetProcess("DRAY",0);
45   gMC ->SetProcess("ANNI",1);
46   gMC ->SetProcess("BREM",1);
47   gMC ->SetProcess("MUNU",1);
48   //xx gMC ->SetProcess("CKOV",1);
49   gMC ->SetProcess("HADR",1); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
50   gMC ->SetProcess("LOSS",2);
51   gMC ->SetProcess("MULS",1);
52   //xx gMC ->SetProcess("RAYL",1);
53
54   // Energy cuts
55   // (in development)
56   Float_t cut    = 1.e-3; // 1MeV cut by default
57   Float_t tofmax = 1.e10; 
58
59   gMC ->SetCut("CUTGAM",cut);
60   gMC ->SetCut("CUTELE",cut);
61   gMC ->SetCut("CUTNEU",cut);
62   gMC ->SetCut("CUTHAD",cut);
63   gMC ->SetCut("CUTMUO",cut);
64   gMC ->SetCut("BCUTE",cut);
65   gMC ->SetCut("BCUTM",cut);
66   gMC ->SetCut("DCUTE",cut);
67   gMC ->SetCut("DCUTM",cut);
68   gMC ->SetCut("PPCUTM",cut);
69   gMC ->SetCut("TOFMAX",tofmax);
70
71   //
72   //=======================================================================
73   // ************* STEERING parameters FOR ALICE SIMULATION **************
74   // --- Specify event type to be tracked through the ALICE setup
75   // --- All positions are in cm, angles in degrees, and P and E in GeV
76   if (gSystem->Getenv("CONFIG_NPARTICLES"))
77     int     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
78   else
79     int     nParticles = 50;
80   cout << "\t* Creating and configuring generator for " << nParticles 
81        << " particles..." << endl;
82   
83   AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
84   
85   gener->SetMomentumRange(0, 999);
86   gener->SetPhiRange(0, 360);
87   // Set pseudorapidity range from -8 to 8.
88   Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
89   Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
90   gener->SetThetaRange(thmin,thmax);
91   gener->SetOrigin(0, 0, 0);  //vertex position
92   gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
93   gener->Init();
94   // 
95   // Activate this line if you want the vertex smearing to happen
96   // track by track
97   //
98   //gener->SetVertexSmear(perTrack); 
99
100   cout << "\t* Setting magnetic field..." << endl; 
101   gAlice->SetField(-999, 2);  //Specify maximum magnetic field in Tesla (neg. ==> default field)
102
103   cout << "\t* Defining which detectors to load..." << endl;
104   
105   Int_t   iABSO = 0;
106   Int_t   iCRT = 0;
107   Int_t   iDIPO = 0;
108   Int_t   iFMD = 0;
109   Int_t   iFRAME = 0;
110   Int_t   iHALL = 0;
111   Int_t   iITS = 0;
112   Int_t   iMAG = 0;
113   Int_t   iMUON = 0;
114   Int_t   iPHOS = 0;
115   Int_t   iPIPE = 0;
116   Int_t   iPMD = 0;
117   Int_t   iRICH = 0;
118   Int_t   iSHIL = 0;
119   Int_t   iSTART = 0;
120   Int_t   iTOF = 0;
121   Int_t   iTPC = 1;
122   Int_t   iTRD = 0;
123   Int_t   iZDC = 0;
124   Int_t   iEMCAL = 0;
125   
126   cout << "\t* Creating the detectors ..." << endl;
127   //=================== Alice BODY parameters =============================
128   AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
129   cout << "\t\t+ BODY..." << endl;
130   
131   
132   if (iMAG)
133     {
134       //=================== MAG parameters ============================
135       // --- Start with Magnet since detector layouts may be depending ---
136       // --- on the selected Magnet dimensions ---
137       cout << "\t\t+ Magnet..." << endl;
138       AliMAG *MAG = new AliMAG("MAG", "Magnet");
139     }
140   
141   
142   if (iABSO)
143     {
144       //=================== ABSO parameters ============================
145       cout << "\t\t+ ABSO..." << endl;
146       AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
147     }
148   
149   if (iDIPO)
150     {
151       //=================== DIPO parameters ============================
152       cout << "\t\t+ DIPO..." << endl;     
153       AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
154     }
155   
156   if (iHALL)
157     {
158       //=================== HALL parameters ============================
159       cout << "\t\t+ HALL..." << endl;
160       AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
161     }
162   
163   
164   if (iFRAME)
165     {
166       //=================== FRAME parameters ============================
167       
168       cout << "\t\t+ FRAME..." << endl;
169       AliFRAME *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
170       
171     }
172   
173   if (iSHIL)
174     {
175       //=================== SHIL parameters ============================
176       
177       cout << "\t\t+ SHIL..." << endl;
178       AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding");
179     }
180   
181   
182   if (iPIPE)
183     {
184       //=================== PIPE parameters ============================
185       
186       cout << "\t\t+ PIPE..." << endl;
187       AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
188     }
189   
190   if(iITS) {
191       cout << "\t\t+ ITS..." << endl;
192     
193     //=================== ITS parameters ============================
194     //
195     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
196     // almost all other detectors. This involves the fact that the ITS geometry
197     // still has several options to be followed in parallel in order to determine
198     // the best set-up which minimizes the induced background. All the geometries
199     // available to date are described in the following. Read carefully the comments
200     // and use the default version (the only one uncommented) unless you are making
201     // comparisons and you know what you are doing. In this case just uncomment the
202     // ITS geometry you want to use and run Aliroot.
203     //
204     // Detailed geometries:         
205     //
206     //
207     //AliITS *ITS  = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
208     //
209     //AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
210     //
211     AliITSvPPRasymm *ITS  = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services");
212     ITS->SetMinorVersion(2);                                     // don't touch this parameter if you're not an ITS developer
213     ITS->SetReadDet(kFALSE);                                     // don't touch this parameter if you're not an ITS developer
214     //    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
215     ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
216     ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
217     ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [150,300]
218     ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [150,300]
219     ITS->SetRails(1);        // 1 --> rails in ; 0 --> rails out
220     ITS->SetCoolingFluid(1);   // 1 --> water ; 0 --> freon
221     //
222     //AliITSvPPRsymm *ITS  = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric services");
223     //ITS->SetMinorVersion(2);                                       // don't touch this parameter if you're not an ITS developer
224     //ITS->SetReadDet(kFALSE);                                       // don't touch this parameter if you're not an ITS developer
225     //ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRsymm2.det"); // don't touch this parameter if you're not an ITS developer
226     //ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
227     //ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
228     //ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [150,300]
229     //ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [150,300]
230     //ITS->SetRails(1);              // 1 --> rails in ; 0 --> rails out
231     //ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
232     //
233     //
234     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
235     // for reconstruction !):
236     //                                                     
237     //
238     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
239     //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
240     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
241     //
242     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
243     //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
244     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
245     //                      
246     //
247     //
248     // Geant3 <-> EUCLID conversion
249     // ============================
250     //
251     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
252     // media to two ASCII files (called by default ITSgeometry.euc and
253     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
254     // The default (=0) means that you dont want to use this facility.
255     //
256     ITS->SetEUCLID(0);  
257   }
258   
259   
260   if (iTPC)
261     {
262       cout << "\t\t+ TPC..." << endl;
263       //============================ TPC parameters ================================
264       // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
265       // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
266       // --- sectors are specified, any value other than that requires at least one 
267       // --- sector (lower or upper)to be specified!
268       // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
269       // ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
270       // --- SecLows - number of lower sectors specified (up to 6)
271       // --- SecUps - number of upper sectors specified (up to 12)
272       // --- Sens - sensitive strips for the Slow Simulator !!!
273       // --- This does NOT work if all S or L-sectors are specified, i.e.
274       // --- if SecAL or SecAU < 0
275       //
276       //
277       //-----------------------------------------------------------------------------
278       
279       //  gROOT->LoadMacro("SetTPCParam.C");
280       //  AliTPCParam *param = SetTPCParam();
281       AliTPC *TPC = new AliTPCv2("TPC", "Default");
282       
283       // All sectors included 
284       TPC->SetSecAL(-1);
285       TPC->SetSecAU(-1);
286       
287     }
288   
289   if (iTOF)
290     {
291       cout << "\t\t+ TOF..." << endl;
292       //=================== TOF parameters ============================
293       AliTOF *TOF = new AliTOFv2("TOF", "normal TOF");
294     }
295   
296   if (iRICH)
297     {
298       cout << "\t\t+ RICH..." << endl;
299       //=================== RICH parameters ===========================
300         AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
301         
302     }
303   
304   
305   if (iZDC)
306     {
307       cout << "\t\t+ ZDC..." << endl;
308       //=================== ZDC parameters ============================
309       
310       AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
311     }
312   
313   if (iCRT)
314     {
315       cout << "\t\t+ CRT..." << endl;
316       //=================== CRT parameters ============================
317       
318       AliCRT *CRT = new AliCRTv0("CRT", "normal CRT");
319     }
320   
321   if (iTRD)
322     {
323       cout << "\t\t+ TRD..." << endl;
324       //=================== TRD parameters ============================
325       
326       AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
327       
328       // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
329       TRD->SetGasMix(1);
330       
331       // With hole in front of PHOS
332       TRD->SetPHOShole();
333       // With hole in front of RICH
334       TRD->SetRICHhole();
335       // Switch on TR
336       AliTRDsim *TRDsim = TRD->CreateTR();
337     }
338   
339   if (iFMD)
340     {
341       cout << "\t\t+ FMD..." << endl;
342       //=================== FMD parameters ============================
343       
344       AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
345       FMD->SetRingsSi1(256);
346       FMD->SetRingsSi2(64);
347       FMD->SetSectorsSi1(20);
348       FMD->SetSectorsSi2(24);
349     }
350   
351   if (iMUON)
352     {
353       cout << "\t\t+ MUON..." << endl;
354       //=================== MUON parameters ===========================
355       
356       AliMUON *MUON = new AliMUONv1("MUON", "default");
357     }
358   //=================== PHOS parameters ===========================
359   
360   if (iPHOS)
361     {
362       cout << "\t\t+ PHOS..." << endl;
363       AliPHOS *PHOS = new AliPHOSv1("PHOS", "GPS2");
364     }
365   
366   
367   if (iPMD)
368     {
369       cout << "\t\t+ PMD..." << endl;
370       //=================== PMD parameters ============================
371       
372       AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
373       
374       PMD->SetPAR(1., 1., 0.8, 0.02);
375       PMD->SetIN(6., 18., -580., 27., 27.);
376       PMD->SetGEO(0.0, 0.2, 4.);
377       PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
378       
379     }
380   
381   if (iEMCAL && !iRICH)
382     {
383       cout << "\t\t+ EMCAL (no RICH)..." << endl;
384       //=================== EMCAL parameters ============================
385       AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a");
386     }
387   
388   if (iSTART)
389     {
390       cout << "\t\t+ START..." << endl;
391       //=================== START parameters ============================
392       AliSTART *START = new AliSTARTv1("START", "START Detector");
393     }
394   
395   
396   cout << "<== Config.C..." << endl;
397 }
398
399 Float_t EtaToTheta(Float_t arg){
400   return (180./TMath::Pi())*2.*atan(exp(-arg));
401 }