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