]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TPC/ConfigKr.C
o adapt Macro to new TPC structure (Benjamin Hess)
[u/mrichter/AliRoot.git] / TPC / ConfigKr.C
1 /// \file ConfigKr.C
2 ///
3 /// One can use the configuration macro in compiled mode by
4 ///
5 /// ~~~{.c++}
6 /// gSystem->Load("libgeant321");
7 /// gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
8 ///                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
9 /// .x grun.C(1,"ConfigKr.C++")
10 /// ~~~
11
12 #if !defined(__CINT__) || defined(__MAKECINT__)
13 #include <Riostream.h>
14 #include <TRandom.h>
15 #include <TSystem.h>
16 #include <TVirtualMC.h>
17 #include <TGeant3TGeo.h>
18 #include "STEER/AliRunLoader.h"
19 #include "STEER/AliRun.h"
20 #include "STEER/AliConfig.h"
21 #include "PYTHIA6/AliDecayerPythia.h"
22 #include "EVGEN/AliGenCocktail.h"
23 #include "EVGEN/AliGenHIJINGpara.h"
24 #include "STEER/AliMagF.h"
25 #include "STRUCT/AliBODY.h"
26 #include "STRUCT/AliMAG.h"
27 #include "STRUCT/AliABSOv3.h"
28 #include "STRUCT/AliDIPOv3.h"
29 #include "STRUCT/AliHALLv3.h"
30 #include "STRUCT/AliFRAMEv2.h"
31 #include "STRUCT/AliSHILv3.h"
32 #include "STRUCT/AliPIPEv3.h"
33 #include "ITS/AliITSvPPRasymmFMD.h"
34 #include "TPC/AliTPCv2.h"
35 #include "TOF/AliTOFv6T0.h"
36 #include "HMPID/AliHMPIDv1.h"
37 #include "ZDC/AliZDCv2.h"
38 #include "TRD/AliTRDv1.h"
39 #include "FMD/AliFMDv1.h"
40 #include "MUON/AliMUONv1.h"
41 #include "PHOS/AliPHOSv1.h"
42 #include "PMD/AliPMDv1.h"
43 #include "T0/AliT0v1.h"
44 #include "EMCAL/AliEMCALv2.h"
45 #include "ACORDE/AliACORDEv1.h"
46 #include "VZERO/AliVZEROv7.h"
47 #endif
48
49 Float_t EtaToTheta(Float_t arg);
50
51 void Config()
52 {
53     // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
54     // Theta range given through pseudorapidity limits 22/6/2001
55
56     // Set Random Number seed
57   gRandom->SetSeed(123456); // Set 0 to use the currecnt time
58   AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
59
60
61    // libraries required by geant321
62 #if defined(__CINT__)
63     gSystem->Load("libgeant321");
64 #endif
65
66     new     TGeant3TGeo("C++ Interface to Geant3");
67
68     AliRunLoader* rl=0x0;
69
70     AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
71
72     rl = AliRunLoader::Open("galice.root",
73                             AliConfig::GetDefaultEventFolderName(),
74                             "recreate");
75     if (rl == 0x0)
76       {
77         gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
78         return;
79       }
80     rl->SetCompressionLevel(2);
81     rl->SetNumberOfEventsPerFile(3);
82     gAlice->SetRunLoader(rl);
83
84     // Set the trigger configuration
85     AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
86     cout<<"Trigger configuration is set to  Pb-Pb"<<endl;
87
88     //
89     // Set External decayer
90     TVirtualMCDecayer *decayer = new AliDecayerPythia();
91
92     decayer->SetForceDecay(kAll);
93     decayer->Init();
94     gMC->SetExternalDecayer(decayer);
95     //=======================================================================
96     // ************* STEERING parameters FOR ALICE SIMULATION **************
97     // --- Specify event type to be tracked through the ALICE setup
98     // --- All positions are in cm, angles in degrees, and P and E in GeV
99
100
101     gMC->SetProcess("DCAY",1);
102     gMC->SetProcess("PAIR",1);
103     gMC->SetProcess("COMP",1);
104     gMC->SetProcess("PHOT",1);
105     gMC->SetProcess("PFIS",0);
106     gMC->SetProcess("DRAY",0);
107     gMC->SetProcess("ANNI",1);
108     gMC->SetProcess("BREM",1);
109     gMC->SetProcess("MUNU",1);
110     gMC->SetProcess("CKOV",1);
111     gMC->SetProcess("HADR",1);
112     gMC->SetProcess("LOSS",2);
113     gMC->SetProcess("MULS",1);
114     gMC->SetProcess("RAYL",1);
115
116     Float_t cut = 1.e-3;        // 1MeV cut by default
117     Float_t tofmax = 1.e10;
118
119     gMC->SetCut("CUTGAM", cut);
120     gMC->SetCut("CUTELE", cut);
121     gMC->SetCut("CUTNEU", cut);
122     gMC->SetCut("CUTHAD", cut);
123     gMC->SetCut("CUTMUO", cut);
124     gMC->SetCut("BCUTE",  cut); 
125     gMC->SetCut("BCUTM",  cut); 
126     gMC->SetCut("DCUTE",  cut); 
127     gMC->SetCut("DCUTM",  cut); 
128     gMC->SetCut("PPCUTM", cut);
129     gMC->SetCut("TOFMAX", tofmax); 
130
131
132     AliGenCocktail *gener = new AliGenCocktail();
133     //
134     Int_t nKrDecays = 100; // number of Kr decays
135     for(Int_t i=0;i<nKrDecays;i++){
136       AliGenKrypton *krypton = new AliGenKrypton();
137       gener->AddGenerator(krypton,"Krypton",1);
138     }
139     gener->Init();
140
141     // Field (L3 0.4 T)
142     TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
143
144     // detectors - only the TPC is relevant
145
146     Int_t   iABSO  =  0;
147     Int_t   iDIPO  =  0;
148     Int_t   iFMD   =  0;
149     Int_t   iFRAME =  0;
150     Int_t   iHALL  =  0;
151     Int_t   iITS   =  0;
152     Int_t   iMAG   =  0;
153     Int_t   iMUON  =  0;
154     Int_t   iPHOS  =  0;
155     Int_t   iPIPE  =  0;
156     Int_t   iPMD   =  0;
157     Int_t   iHMPID  =  0;
158     Int_t   iSHIL  =  0;
159     Int_t   iT0 =  0;
160     Int_t   iTOF   =  0;
161     Int_t   iTPC   =  1;
162     Int_t   iTRD   =  0;
163     Int_t   iZDC   =  0;
164     Int_t   iEMCAL =  0;
165     Int_t   iACORDE   =  0;
166     Int_t   iVZERO =  0;
167     rl->CdGAFile();
168     //=================== Alice BODY parameters =============================
169     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
170
171     if (iMAG)
172     {
173         //=================== MAG parameters ============================
174         // --- Start with Magnet since detector layouts may be depending ---
175         // --- on the selected Magnet dimensions ---
176         AliMAG *MAG = new AliMAG("MAG", "Magnet");
177     }
178
179
180     if (iABSO)
181     {
182         //=================== ABSO parameters ============================
183         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
184     }
185
186     if (iDIPO)
187     {
188         //=================== DIPO parameters ============================
189
190         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
191     }
192
193     if (iHALL)
194     {
195         //=================== HALL parameters ============================
196
197         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
198     }
199
200
201     if (iFRAME)
202     {
203         //=================== FRAME parameters ============================
204
205         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
206     }
207
208     if (iSHIL)
209     {
210         //=================== SHIL parameters ============================
211
212         AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
213     }
214
215
216     if (iPIPE)
217     {
218         //=================== PIPE parameters ============================
219
220         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
221     }
222  
223     if(iITS) {
224
225     //=================== ITS parameters ============================
226     //
227     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
228     // almost all other detectors. This involves the fact that the ITS geometry
229     // still has several options to be followed in parallel in order to determine
230     // the best set-up which minimizes the induced background. All the geometries
231     // available to date are described in the following. Read carefully the comments
232     // and use the default version (the only one uncommented) unless you are making
233     // comparisons and you know what you are doing. In this case just uncomment the
234     // ITS geometry you want to use and run Aliroot.
235     //
236     // Detailed geometries:         
237     //
238     //
239     //
240         AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","ITS PPR detailed version with asymmetric services");
241         ITS->SetMinorVersion(2);  // don't touch this parameter if you're not an ITS developer
242         ITS->SetReadDet(kFALSE);          // don't touch this parameter if you're not an ITS developer
243         //    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
244         ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
245         ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
246         ITS->SetThicknessChip1(150.);  // chip thickness on layer 1 must be in the range [150,300]
247         ITS->SetThicknessChip2(150.);  // chip thickness on layer 2 must be in the range [150,300]
248         ITS->SetRails(0);              // 1 --> rails in ; 0 --> rails out
249         ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
250
251  
252     //
253     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
254     // for reconstruction !):
255     //                                                     
256     //
257     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
258     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
259     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
260     //
261     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
262     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
263     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
264     //                      
265     //
266     //
267     // Geant3 <-> EUCLID conversion
268     // ============================
269     //
270     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
271     // media to two ASCII files (called by default ITSgeometry.euc and
272     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
273     // The default (=0) means that you dont want to use this facility.
274     //
275      ITS->SetEUCLID(0);  
276     }
277
278     if (iTPC)
279     {
280         //============================ TPC parameters ===================
281         AliTPC *TPC = new AliTPCv4("TPC", "Default");
282     }
283
284
285     if (iTOF) {
286         //=================== TOF parameters ============================
287         AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
288     }
289
290
291     if (iHMPID)
292     {
293         //=================== HMPID parameters ===========================
294         AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");
295
296     }
297
298
299     if (iZDC)
300     {
301         //=================== ZDC parameters ============================
302
303         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
304     }
305
306     if (iTRD)
307     {
308         //=================== TRD parameters ============================
309
310         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
311     }
312
313     if (iFMD)
314     {
315         //=================== FMD parameters ============================
316         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
317    }
318
319     if (iMUON)
320     {
321         //=================== MUON parameters ===========================
322         // New MUONv1 version (geometry defined via builders)
323         AliMUON *MUON = new AliMUONv1("MUON", "default");
324     }
325     //=================== PHOS parameters ===========================
326
327     if (iPHOS)
328     {
329         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
330     }
331
332
333     if (iPMD)
334     {
335         //=================== PMD parameters ============================
336         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
337     }
338
339     if (iT0)
340     {
341         //=================== T0 parameters ============================
342         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
343     }
344
345     if (iEMCAL)
346     {
347         //=================== EMCAL parameters ============================
348         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
349     }
350
351      if (iACORDE)
352     {
353         //=================== ACORDE parameters ============================
354         AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
355     }
356
357      if (iVZERO)
358     {
359         //=================== ACORDE parameters ============================
360         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
361     }
362
363      AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
364
365 }
366
367 Float_t EtaToTheta(Float_t arg){
368   return (180./TMath::Pi())*2.*atan(exp(-arg));
369 }