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