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