]> git.uio.no Git - u/mrichter/AliRoot.git/blob - AliGeant4/macro/g4Config.C
fParticlesArray removed (its usage replaced with calls to AliRun)
[u/mrichter/AliRoot.git] / AliGeant4 / macro / g4Config.C
1 void Config()
2 {
3   // ============================= 
4   // Root file
5   // ============================= 
6
7   // Create the output file
8   TFile *rootfile = new TFile("galice.root","recreate");
9   rootfile->SetCompressionLevel(2);
10
11   // ============================= 
12   // Geant4
13   // ============================= 
14
15   // load Geant4 and AliRoot steer libraries
16   if (!gInterpreter->IsLoaded("g4libs.C")) gROOT->LoadMacro("g4libs.C");
17   gInterpreter->ProcessLine("g4libs()");
18   gInterpreter->ProcessLine("steerlibs()");
19
20   // Create Geant4   
21   if (!gInterpreter->IsLoaded("g4menu.C")) gROOT->LoadMacro("g4menu.C");
22   gInterpreter->ProcessLine("CreateGeant4()");
23
24   // Physics process control
25   // (in development)
26   gMC ->SetProcess("DCAY",1);
27   gMC ->SetProcess("PAIR",1);
28   gMC ->SetProcess("COMP",1);
29   gMC ->SetProcess("PHOT",1);
30   gMC ->SetProcess("PFIS",0);
31   gMC ->SetProcess("DRAY",0);
32   gMC ->SetProcess("ANNI",1);
33   gMC ->SetProcess("BREM",1);
34   gMC ->SetProcess("MUNU",1);
35   //xx gMC ->SetProcess("CKOV",1);
36   gMC ->SetProcess("HADR",1); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
37   gMC ->SetProcess("LOSS",2);
38   gMC ->SetProcess("MULS",1);
39   //xx gMC ->SetProcess("RAYL",1);
40
41   // Energy cuts
42   // (in development)
43   Float_t cut    = 1.e-3; // 1MeV cut by default
44   gMC ->SetCut("CUTGAM",cut);
45   gMC ->SetCut("CUTELE",cut);
46   gMC ->SetCut("CUTNEU",cut);
47   gMC ->SetCut("CUTHAD",cut);
48   gMC ->SetCut("CUTMUO",cut);
49   gMC ->SetCut("BCUTE",cut);
50   gMC ->SetCut("BCUTM",cut);
51   gMC ->SetCut("DCUTE",cut);
52   gMC ->SetCut("DCUTM",cut);
53  //xx gMC ->SetCut("PPCUTM",cut);
54
55   // ============================= 
56   // Event generator
57   // ============================= 
58
59   // --- Specify event type to be tracked through the ALICE setup
60   // --- All positions are in cm, angles in degrees, and P and E in GeV
61
62   int nParticles;
63   if (gSystem->Getenv("CONFIG_NPARTICLES")) 
64     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
65   else
66     nParticles = 1000; 
67
68   AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
69   gener->SetMomentumRange(0,999);
70   gener->SetPhiRange(0,360);
71   gener->SetThetaRange(0.,180.);
72   gener->SetOrigin(0,0,0);        //vertex position
73   gener->SetSigma(0,0,0);         //Sigma in (X,Y,Z) (cm) on IP position
74   gener->Init();
75
76   // Activate this line if you want the vertex smearing to happen
77   // track by track
78
79   //gener->SetVertexSmear(perTrack); 
80
81   // ============================= 
82   // Magnetic field
83   // ============================= 
84
85   //?? gAlice->SetField(-999,2);    //Specify maximum magnetic field in Tesla (neg. ==> default field)
86
87   // ============================= 
88   // Alice modules
89   // ============================= 
90
91   //Bool_t isSetInteractively = false;
92   Bool_t isSetInteractively = true;
93
94   if (!isSetInteractively) {
95
96     //  Load modules libraries
97     gInterpreter->ProcessLine("detlibs()");
98
99     // Select modules 
100
101   Int_t iABSO=1;
102   Int_t iCASTOR=1;
103   Int_t iDIPO=1;
104   Int_t iFMD=1;
105   Int_t iFRAME=1;
106   Int_t iHALL=1;
107   Int_t iITS=1;
108   Int_t iMAG=1;
109   Int_t iMUON=1;
110   Int_t iPHOS=1;
111   Int_t iPIPE=1;
112   Int_t iPMD=1;
113   Int_t iRICH=1;
114   Int_t iSHIL=1;
115   Int_t iSTART=1;
116   Int_t iTOF=1;
117   Int_t iTPC=1;
118   Int_t iTRD=1;
119   Int_t iZDC=1;
120
121     // Exclude detectors that do not work with Geant4
122       iCASTOR=0;
123     // Detectors with temporary problem
124       iZDC=0;
125
126 // From G3 Config.C
127 // Without any modification 
128
129
130   //=================== Alice BODY parameters =============================
131   AliBODY *BODY = new AliBODY("BODY","Alice envelop");
132
133
134   if(iMAG) {
135     //=================== MAG parameters ============================
136     // --- Start with Magnet since detector layouts may be depending ---
137     // --- on the selected Magnet dimensions ---
138     AliMAG *MAG  = new AliMAG("MAG","Magnet");
139   }
140
141
142   if(iABSO) {
143     //=================== ABSO parameters ============================
144     AliABSO *ABSO  = new AliABSOv0("ABSO","Muon Absorber");
145   }
146
147   if(iDIPO) {
148     //=================== DIPO parameters ============================
149
150     AliDIPO *DIPO  = new AliDIPOv2("DIPO","Dipole version 2");
151   }
152
153   if(iHALL) {
154     //=================== HALL parameters ============================
155
156     AliHALL *HALL  = new AliHALL("HALL","Alice Hall");
157   }
158
159
160   if(iFRAME) {
161     //=================== FRAME parameters ============================
162
163     AliFRAME *FRAME  = new AliFRAMEv1("FRAME","Space Frame");
164
165   }
166
167   if(iSHIL) {
168     //=================== SHIL parameters ============================
169
170     AliSHIL *SHIL  = new AliSHILv0("SHIL","Shielding");
171   }
172
173
174   if(iPIPE) {
175     //=================== PIPE parameters ============================
176
177     AliPIPE *PIPE  = new AliPIPEv0("PIPE","Beam Pipe");
178   }
179
180
181   if(iITS) {
182     //=================== ITS parameters ============================
183     //
184     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
185     // almost all other detectors. This involves the fact that the ITS geometry 
186     // still has several options to be followed in parallel in order to determine 
187     // the best set-up which minimizes the induced background. All the geometries
188     // available to date are described in the following. Read carefully the comments 
189     // and use the default version (the only one uncommented) unless you are making
190     // comparisons and you know what you are doing. In this case just uncomment the
191     // ITS geometry you want to use and run Aliroot. 
192     //
193     // Detailed geometries:
194     // ====================
195     //
196     //
197     //AliITS *ITS  = new AliITSv3("ITS","Old ITS detailed version as of the ALICE TP");
198     //
199     //AliITS *ITS  = new AliITSv5("ITS","Current ITS detailed version used for the ITS TDR");
200     //
201     //AliITS *ITS  = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
202     //
203     AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
204     //
205     //
206     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful for reconstruction !):
207     // ======================================================================================================================
208     //
209     //
210     //AliITS *ITS  = new AliITSv1("ITS","Old ITS coarse version as of the ALICE TP");
211     //
212     //AliITS *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS coarse version with asymmetric services");
213     //
214     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS coarse version with symmetric services");
215     //
216     //
217     // Geant3 <-> EUCLID conversion
218     // ============================
219     //
220     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and 
221     // media to two ASCII files (called by default ITSgeometry.euc and 
222     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID. 
223     // The default (=0) means that you dont want to use this facility.
224     //
225     ITS->SetEUCLID(0);
226   }
227
228
229   if(iTPC) {
230     //============================ TPC parameters ================================
231     // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
232     // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
233     // --- sectors are specified, any value other than that requires at least one 
234     // --- sector (lower or upper)to be specified!
235     // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
236     // ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
237     // --- SecLows - number of lower sectors specified (up to 6)
238     // --- SecUps - number of upper sectors specified (up to 12)
239     // --- Sens - sensitive strips for the Slow Simulator !!!
240     // --- This does NOT work if all S or L-sectors are specified, i.e.
241     // --- if SecAL or SecAU < 0
242     //
243     //
244     //-----------------------------------------------------------------------------
245
246     //  gROOT->LoadMacro("SetTPCParam.C");
247     //  AliTPCParam *param = SetTPCParam();
248     AliTPC *TPC  = new AliTPCv2("TPC","Default");
249     // All sectors included 
250     TPC->SetSecAL(-1);
251     TPC->SetSecAU(-1);
252
253   }
254
255   if(iTOF) {
256     //=================== TOF parameters ============================
257     AliTOF *TOF  = new AliTOFv2("TOF","normal TOF");
258   }
259
260   if(iRICH) {
261     //=================== RICH parameters ===========================
262     AliRICH *RICH  = new AliRICHv1("RICH","normal RICH");
263     
264   }
265
266
267   if(iZDC) {
268     //=================== ZDC parameters ============================
269
270     AliZDC *ZDC  = new AliZDCv1("ZDC","normal ZDC");
271   }
272
273   if(iCASTOR) {
274     //=================== CASTOR parameters ============================
275
276     AliCASTOR *CASTOR  = new AliCASTORv1("CASTOR","normal CASTOR");
277   }
278
279   if(iTRD) {
280     //=================== TRD parameters ============================
281   
282     AliTRD *TRD  = new AliTRDv1("TRD","TRD slow simulator");
283   
284     // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
285     TRD->SetGasMix(1);
286   
287     // With hole in front of PHOS
288     TRD->SetPHOShole();
289     // With hole in front of RICH
290     TRD->SetRICHhole();
291     // Switch on TR
292     AliTRDsim *TRDsim = TRD->CreateTR();
293   }
294
295   if(iFMD) {
296     //=================== FMD parameters ============================
297
298     AliFMD *FMD  = new AliFMDv0("FMD","normal FMD");
299   }
300
301   if(iMUON) {
302     //=================== MUON parameters ===========================
303
304     AliMUON *MUON  = new AliMUONv0("MUON","normal MUON");
305   }
306  
307   //=================== PHOS parameters ===========================
308
309   if(iPHOS) {
310     AliPHOS *PHOS  = new AliPHOSv1("PHOS","GPS2");
311   }
312
313
314   if(iPMD) {
315     //=================== PMD parameters ============================
316
317     AliPMD *PMD  = new AliPMDv1("PMD","normal PMD");
318     PMD->SetPAR(1., 1., 0.8, 0.02);
319     PMD->SetIN(6., 18., -580., 27., 27.);
320     PMD->SetGEO(0.0, 0.2, 4.);
321     PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
322
323   }
324
325   if(iSTART) {
326     //=================== START parameters ============================
327     AliSTART *START  = new AliSTARTv1("START","START Detector");
328   }
329
330   } // end (!isSetInteractively)
331
332 }