]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/g4ConfigCommon.C
Correct EMCAL version according to Marco van Leeuwen
[u/mrichter/AliRoot.git] / macros / g4ConfigCommon.C
1 // $Id$
2 //
3 // AliRoot Configuration for running aliroot with Monte Carlo.
4 // Called from g4Config.C
5
6 Float_t EtaToTheta(Float_t arg);
7 static Int_t    eventsPerRun = 100;
8
9 void ConfigCommon(Bool_t interactiveSetup)
10 {
11   // ============================= 
12   // Root file
13   // ============================= 
14
15   // Create the output file
16   AliRunLoader* rl = 0;
17   rl = AliRunLoader::Open("galice.root",
18                            AliConfig::GetDefaultEventFolderName(),
19                            "recreate");
20   if (!rl) {
21     gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
22     return;
23   }
24   rl->SetCompressionLevel(2);
25   rl->SetNumberOfEventsPerFile(3);
26   gAlice->SetRunLoader(rl);
27
28   // Set External decayer
29   AliDecayer* decayer = new AliDecayerPythia();
30   decayer->SetForceDecay(kAll);
31   decayer->Init();
32   gMC->SetExternalDecayer(decayer);
33
34   // Physics process control
35   gMC ->SetProcess("DCAY",1);
36   gMC ->SetProcess("PAIR",1);
37   gMC ->SetProcess("COMP",1);
38   gMC ->SetProcess("PHOT",1);
39   gMC ->SetProcess("PFIS",0);
40   gMC ->SetProcess("DRAY",0);
41   gMC ->SetProcess("ANNI",1);
42   gMC ->SetProcess("BREM",1);
43   gMC ->SetProcess("MUNU",1);
44   //xx gMC ->SetProcess("CKOV",1);
45   gMC ->SetProcess("HADR",1); //Select pure GEANH (HADR 1) or GEANH/NUCRIN (HADR 3)
46   gMC ->SetProcess("LOSS",2);
47   gMC ->SetProcess("MULS",1);
48   //xx gMC ->SetProcess("RAYL",1);
49
50   // Energy cuts
51   // (in development)
52   Float_t cut    = 1.e-3; // 1MeV cut by default
53   Float_t tofmax = 1.e10; 
54
55   gMC ->SetCut("CUTGAM",cut);
56   gMC ->SetCut("CUTELE",cut);
57   gMC ->SetCut("CUTNEU",cut);
58   gMC ->SetCut("CUTHAD",cut);
59   gMC ->SetCut("CUTMUO",cut);
60   gMC ->SetCut("BCUTE",cut);
61   gMC ->SetCut("BCUTM",cut);
62   gMC ->SetCut("DCUTE",cut);
63   gMC ->SetCut("DCUTM",cut);
64   gMC ->SetCut("PPCUTM",cut);
65   gMC ->SetCut("TOFMAX",tofmax);
66
67   // ============================= 
68   // Event generator
69   // ============================= 
70
71   // --- Specify event type to be tracked through the ALICE setup
72   // --- All positions are in cm, angles in degrees, and P and E in GeV
73
74   Int_t nParticles = 100;
75   if (gSystem->Getenv("CONFIG_NPARTICLES")) 
76     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
77
78   AliGenCocktail *gener = new AliGenCocktail();
79   gener->SetPhiRange(0, 360);
80   // Set pseudorapidity range from -8 to 8.
81   Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
82   Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
83   gener->SetThetaRange(thmin,thmax);
84   gener->SetOrigin(0, 0, 0);  //vertex position
85   gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
86
87   AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
88   hijingparam->SetMomentumRange(0.2, 999);
89   gener->AddGenerator(hijingparam,"HIJING PARAM",1);
90
91   //    AliGenBox *genbox = new AliGenBox(nParticles);
92   //    genbox->SetPart(22);
93   //    genbox->SetPtRange(0.3, 10.00);
94   //    gener->AddGenerator(genbox,"GENBOX GAMMA for PHOS",1);
95   gener->Init();
96
97   // Activate this line if you want the vertex smearing to happen
98   // track by track
99
100   //gener->SetVertexSmear(perTrack); 
101
102   // ============================= 
103   // Magnetic field
104   // ============================= 
105
106   // Field (L3 0.4 T)
107   AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
108   gAlice->SetField(field);    
109   
110   // Old magnetic field
111   //gAlice->SetField(-999,2);    //Specify maximum magnetic field in Tesla (neg. ==> default field)
112
113   // ============================= 
114   // Alice modules
115   // ============================= 
116
117   if (!interactiveSetup) {
118
119     // Select modules 
120   Int_t iABSO  = 1;
121   Int_t iDIPO  = 1;
122   Int_t iFMD   = 1;
123   Int_t iFRAME = 1;
124   Int_t iHALL  = 1;
125   Int_t iITS   = 1;
126   Int_t iMAG   = 1;
127   Int_t iMUON  = 1;
128   Int_t iPHOS  = 1;
129   Int_t iPIPE  = 1;
130   Int_t iPMD   = 1;
131   Int_t iRICH  = 1;
132   Int_t iSHIL  = 1;
133   Int_t iSTART = 1;
134   Int_t iTOF   = 1;
135   Int_t iTPC   = 1;
136   Int_t iTRD   = 1;
137   Int_t iZDC   = 1;
138   Int_t iEMCAL = 1;
139   Int_t iCRT   = 0;  
140   Int_t iVZERO = 1;
141
142   // ONLY FOR GEANT4
143
144   // Exclude detectors with temporary problem
145   iCRT = 0;
146   iEMCAL = 0;
147  
148   // END OF ONLY FOR GEANT4
149
150
151     //=================== Alice BODY parameters =============================
152     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
153
154
155     if (iMAG)
156     {
157         //=================== MAG parameters ============================
158         // --- Start with Magnet since detector layouts may be depending ---
159         // --- on the selected Magnet dimensions ---
160         AliMAG *MAG = new AliMAG("MAG", "Magnet");
161     }
162
163
164     if (iABSO)
165     {
166         //=================== ABSO parameters ============================
167         AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
168     }
169
170     if (iDIPO)
171     {
172         //=================== DIPO parameters ============================
173
174         AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
175     }
176
177     if (iHALL)
178     {
179         //=================== HALL parameters ============================
180
181         AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
182     }
183
184
185     if (iFRAME)
186     {
187         //=================== FRAME parameters ============================
188
189         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
190     }
191
192     if (iSHIL)
193     {
194         //=================== SHIL parameters ============================
195
196         AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
197     }
198
199
200     if (iPIPE)
201     {
202         //=================== PIPE parameters ============================
203
204         AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
205     }
206  
207     if(iITS) 
208     {
209       //=================== ITS parameters ============================
210       //
211       // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
212       // almost all other detectors. This involves the fact that the ITS geometry
213       // still has several options to be followed in parallel in order to determine
214       // the best set-up which minimizes the induced background. All the geometries
215       // available to date are described in the following. Read carefully the comments
216       // and use the default version (the only one uncommented) unless you are making
217       // comparisons and you know what you are doing. In this case just uncomment the
218       // ITS geometry you want to use and run Aliroot.
219       //
220       // Detailed geometries:         
221       //
222       //
223       //
224 /*
225         AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","ITS PPR detailed version with asymmetric services");
226         ITS->SetMinorVersion(2);  // don't touch this parameter if you're not an ITS developer
227         ITS->SetReadDet(kTRUE);   // don't touch this parameter if you're not an ITS developer
228         //    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
229         ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
230         ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
231         ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [150,300]
232         ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [150,300]
233         ITS->SetRails(0);              // 1 --> rails in ; 0 --> rails out
234         ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
235 */
236       //
237       // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
238       // for reconstruction !):
239       //                                                       
240       //
241       AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
242       ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
243       ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
244       //
245       //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
246       //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
247       //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
248       //                      
249       //
250       //
251       // Geant3 <-> EUCLID conversion
252       // ============================
253       //
254       // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
255       // media to two ASCII files (called by default ITSgeometry.euc and
256       // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
257       // The default (=0) means that you dont want to use this facility.
258       //
259       ITS->SetEUCLID(0);  
260     }  
261
262     if (iTPC)
263     {
264         //============================ TPC parameters ===================
265         AliTPC *TPC = new AliTPCv2("TPC", "Default");
266     }
267
268     if (iTOF)
269     {
270         //=================== TOF parameters ============================
271         AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
272     }
273
274     if (iRICH)
275     {
276         //=================== RICH parameters ===========================
277         AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
278     }
279
280
281     if (iZDC)
282     {
283         //=================== ZDC parameters ============================
284
285         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
286     }
287
288     if (iTRD)
289     {
290         //=================== TRD parameters ============================
291
292         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
293
294         // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
295         TRD->SetGasMix(1);
296         // Switch on TR
297         AliTRDsim *TRDsim = TRD->CreateTR();
298     }
299
300     if (iFMD)
301     {
302         //=================== FMD parameters ============================
303
304         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
305     }
306
307     if (iMUON)
308     {
309         //=================== MUON parameters ===========================
310
311         AliMUON *MUON = new AliMUONv1("MUON", "default");
312     }
313     //=================== PHOS parameters ===========================
314
315     if (iPHOS)
316     {
317         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
318     }
319
320
321     if (iPMD)
322     {
323         //=================== PMD parameters ============================
324         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
325     }
326
327     if (iSTART)
328     {
329         //=================== START parameters ============================
330         AliSTART *START = new AliSTARTv1("START", "START Detector");
331     }
332
333     if (iEMCAL)
334     {
335         //=================== EMCAL parameters ============================
336         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
337     }
338
339     if (iCRT)
340     {
341         //=================== CRT parameters ============================
342
343         AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
344     }
345
346     if (iVZERO)
347     {
348         //=================== CRT parameters ============================
349         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
350     }
351
352   } // end (!isSetInteractively)
353
354   cout << "End of g4ConfigCommon.C" << endl;
355 }
356
357 Float_t EtaToTheta(Float_t arg){
358   return (180./TMath::Pi())*2.*atan(exp(-arg));
359 }