]>
Commit | Line | Data |
---|---|---|
88ba9030 | 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/AliGenHIJINGpara.h" | |
19 | #include "STEER/AliMagF.h" | |
20 | #include "STRUCT/AliBODY.h" | |
21 | #include "STRUCT/AliMAG.h" | |
22 | #include "STRUCT/AliABSOv0.h" | |
23 | #include "STRUCT/AliDIPOv2.h" | |
24 | #include "STRUCT/AliHALL.h" | |
25 | #include "STRUCT/AliFRAMEv2.h" | |
26 | #include "STRUCT/AliSHILv2.h" | |
27 | #include "STRUCT/AliPIPEv0.h" | |
28 | #include "ITS/AliITSvPPRasymmFMD.h" | |
29 | #include "TPC/AliTPCv2.h" | |
30 | #include "TOF/AliTOFv6T0.h" | |
31 | #include "RICH/AliRICHv1.h" | |
32 | #include "ZDC/AliZDCv2.h" | |
33 | #include "TRD/AliTRDv1.h" | |
34 | #include "TRD/AliTRDgeometry.h" | |
35 | #include "FMD/AliFMDv1.h" | |
36 | #include "MUON/AliMUONv1.h" | |
37 | #include "MUON/AliMUONSt1GeometryBuilderV2.h" | |
38 | #include "MUON/AliMUONSt2GeometryBuilderV2.h" | |
39 | #include "MUON/AliMUONSlatGeometryBuilder.h" | |
40 | #include "MUON/AliMUONTriggerGeometryBuilder.h" | |
41 | #include "PHOS/AliPHOSv1.h" | |
42 | #include "PMD/AliPMDv1.h" | |
43 | #include "START/AliSTARTv1.h" | |
44 | #include "EMCAL/AliEMCALv2.h" | |
45 | #include "CRT/AliCRTv0.h" | |
46 | #include "VZERO/AliVZEROv5.h" | |
47 | #endif | |
48 | ||
49 | static Int_t sseed = 12345; //Set 0 to use the current time | |
50 | static Int_t mesonPDG = 111; // PDG code of a neutral meson to generate | |
51 | static TString beams = "pp" ; // colliding system | |
52 | ||
53 | Float_t EtaToTheta(Float_t arg); | |
54 | enum PprGeo_t | |
55 | { | |
56 | kHoles, kNoHoles | |
57 | }; | |
58 | static PprGeo_t geo = kHoles; | |
59 | ||
60 | void ProcessEnvironmentVars(); | |
61 | ||
62 | void Config() | |
63 | { | |
64 | // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00 | |
65 | // Theta range given through pseudorapidity limits 22/6/2001 | |
66 | ||
67 | ProcessEnvironmentVars(); | |
68 | ||
69 | // Set Random Number seed | |
70 | gRandom->SetSeed(sseed); | |
71 | AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__); | |
72 | ||
73 | ||
74 | // libraries required by geant321 | |
75 | #if defined(__CINT__) | |
b0635849 | 76 | gSystem->Load("liblhapdf"); // Parton density functions |
77 | gSystem->Load("libEGPythia6"); // TGenerator interface | |
78 | gSystem->Load("libpythia6"); // Pythia | |
79 | gSystem->Load("libAliPythia6"); // ALICE specific implementations | |
88ba9030 | 80 | |
81 | gSystem->Load("libgeant321"); | |
82 | #endif | |
83 | ||
84 | new TGeant3TGeo("C++ Interface to Geant3"); | |
85 | ||
86 | AliRunLoader* rl=0x0; | |
87 | ||
88 | AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__); | |
89 | ||
90 | rl = AliRunLoader::Open("galice.root", | |
91 | AliConfig::GetDefaultEventFolderName(), | |
92 | "recreate"); | |
93 | if (rl == 0x0) | |
94 | { | |
95 | gAlice->Fatal("Config.C","Can not instatiate the Run Loader"); | |
96 | return; | |
97 | } | |
98 | rl->SetCompressionLevel(2); | |
99 | rl->SetNumberOfEventsPerFile(2000); | |
100 | gAlice->SetRunLoader(rl); | |
101 | ||
102 | // | |
103 | // Set External decayer | |
104 | TVirtualMCDecayer *decayer = new AliDecayerPythia(); | |
105 | ||
106 | decayer->SetForceDecay(kAll); | |
107 | decayer->Init(); | |
108 | gMC->SetExternalDecayer(decayer); | |
109 | //======================================================================= | |
110 | // ************* STEERING parameters FOR ALICE SIMULATION ************** | |
111 | // --- Specify event type to be tracked through the ALICE setup | |
112 | // --- All positions are in cm, angles in degrees, and P and E in GeV | |
113 | ||
114 | ||
115 | gMC->SetProcess("DCAY",1); | |
116 | gMC->SetProcess("PAIR",1); | |
117 | gMC->SetProcess("COMP",1); | |
118 | gMC->SetProcess("PHOT",1); | |
119 | gMC->SetProcess("PFIS",0); | |
120 | gMC->SetProcess("DRAY",0); | |
121 | gMC->SetProcess("ANNI",1); | |
122 | gMC->SetProcess("BREM",1); | |
123 | gMC->SetProcess("MUNU",1); | |
124 | gMC->SetProcess("CKOV",1); | |
125 | gMC->SetProcess("HADR",1); | |
126 | gMC->SetProcess("LOSS",2); | |
127 | gMC->SetProcess("MULS",1); | |
128 | gMC->SetProcess("RAYL",1); | |
129 | ||
130 | Float_t cut = 1.e-3; // 1MeV cut by default | |
131 | Float_t tofmax = 1.e10; | |
132 | ||
133 | gMC->SetCut("CUTGAM", cut); | |
134 | gMC->SetCut("CUTELE", cut); | |
135 | gMC->SetCut("CUTNEU", cut); | |
136 | gMC->SetCut("CUTHAD", cut); | |
137 | gMC->SetCut("CUTMUO", cut); | |
138 | gMC->SetCut("BCUTE", cut); | |
139 | gMC->SetCut("BCUTM", cut); | |
140 | gMC->SetCut("DCUTE", cut); | |
141 | gMC->SetCut("DCUTM", cut); | |
142 | gMC->SetCut("PPCUTM", cut); | |
143 | gMC->SetCut("TOFMAX", tofmax); | |
144 | ||
145 | Double_t yMin = -0.30; | |
146 | Double_t yMax = 0.30; | |
147 | ||
148 | Double_t phiMin = 240; | |
149 | Double_t phiMax = 340; | |
150 | ||
151 | AliGenCocktail *gener = new AliGenCocktail(); | |
152 | ||
153 | TString mesonParamFile = "_2.76TeV_SpectraParam.root"; | |
154 | mesonParamFile.Prepend(beams); | |
155 | ||
156 | TString ptSpectrumName = "pi0Spectrum"; | |
157 | if (mesonPDG == 111) | |
158 | ptSpectrumName = "pi0Spectrum"; | |
159 | else if (mesonPDG == 221) | |
160 | ptSpectrumName = "etaSpectrum"; | |
161 | else if (mesonPDG == 223) | |
162 | ptSpectrumName = "omegaSpectrum"; | |
163 | else if (mesonPDG == 331) | |
164 | ptSpectrumName = "etaprimeSpectrum"; | |
165 | else | |
166 | Fatal("",Form("Unknown meson PDF code to generate: %d",mesonPDG)); | |
167 | ||
168 | TFile* fpp = TFile::Open(mesonParamFile); | |
169 | if (!fpp) | |
170 | Fatal("",Form("Cannot open file %s",mesonParamFile)); | |
171 | ||
172 | TF1* ptSpectrum = (TF1*)fpp->Get(ptSpectrumName); | |
173 | Info("",Form("\n\tGenerator %s is initialized\n",ptSpectrum->GetTitle())); | |
174 | ||
175 | AliGenPHOSlibPlus * myGener = new AliGenPHOSlibPlus(mesonPDG,ptSpectrum) ; | |
176 | AliGenParam *genMeson = new AliGenParam(1,AliGenPHOSlib::kPion, | |
177 | myGener->GetPt(AliGenPHOSlib::kPion, ""), | |
178 | myGener->GetY (AliGenPHOSlib::kPion, ""), | |
179 | myGener->GetIp(1, "")); | |
180 | ||
181 | genMeson->SetPhiRange(phiMin,phiMax); | |
182 | genMeson->SetYRange (yMin,yMax) ; | |
183 | genMeson->SetPtRange (0.5,25.) ; | |
184 | genMeson->SetOrigin (0, 0, 0); | |
185 | genMeson->SetSigma (0., 0., 0.); | |
186 | ||
187 | gener->AddGenerator(genMeson,ptSpectrumName,1) ; | |
188 | gener->Init(); | |
189 | ||
190 | TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG)); | |
191 | ||
192 | Int_t iABSO = 0; | |
193 | Int_t iDIPO = 0; | |
194 | Int_t iFMD = 0; | |
195 | Int_t iFRAME = 1; | |
196 | Int_t iHALL = 0; | |
197 | Int_t iITS = 1; | |
198 | Int_t iMAG = 1; | |
199 | Int_t iMUON = 0; | |
200 | Int_t iPHOS = 1; | |
201 | Int_t iPIPE = 1; | |
202 | Int_t iPMD = 0; | |
203 | Int_t iRICH = 0; | |
204 | Int_t iSHIL = 0; | |
205 | Int_t iSTART = 0; | |
206 | Int_t iTOF = 1; | |
207 | Int_t iTPC = 1; | |
208 | Int_t iTRD = 1; | |
209 | Int_t iZDC = 0; | |
210 | Int_t iEMCAL = 0; | |
211 | Int_t iCRT = 0; | |
212 | Int_t iVZERO = 0; | |
213 | ||
214 | rl->CdGAFile(); | |
215 | //=================== Alice BODY parameters ============================= | |
216 | AliBODY *BODY = new AliBODY("BODY", "Alice envelop"); | |
217 | ||
218 | if (iMAG) | |
219 | { | |
220 | //=================== MAG parameters ============================ | |
221 | // --- Start with Magnet since detector layouts may be depending --- | |
222 | // --- on the selected Magnet dimensions --- | |
223 | AliMAG *MAG = new AliMAG("MAG", "Magnet"); | |
224 | } | |
225 | ||
226 | ||
227 | if (iABSO) | |
228 | { | |
229 | //=================== ABSO parameters ============================ | |
230 | AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber"); | |
231 | } | |
232 | ||
233 | if (iDIPO) | |
234 | { | |
235 | //=================== DIPO parameters ============================ | |
236 | ||
237 | AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2"); | |
238 | } | |
239 | ||
240 | if (iHALL) | |
241 | { | |
242 | //=================== HALL parameters ============================ | |
243 | ||
244 | AliHALL *HALL = new AliHALL("HALL", "Alice Hall"); | |
245 | } | |
246 | ||
247 | ||
248 | if (iFRAME) | |
249 | { | |
250 | //=================== FRAME parameters ============================ | |
251 | ||
252 | AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame"); | |
253 | FRAME->SetHoles(1); | |
254 | } | |
255 | ||
256 | if (iSHIL) | |
257 | { | |
258 | //=================== SHIL parameters ============================ | |
259 | ||
260 | AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2"); | |
261 | } | |
262 | ||
263 | ||
264 | if (iPIPE) | |
265 | { | |
266 | //=================== PIPE parameters ============================ | |
267 | ||
268 | AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe"); | |
269 | } | |
270 | ||
271 | if(iITS) { | |
272 | //=================== ITS parameters ============================ | |
273 | ||
274 | AliITS *ITS = new AliITSv11("ITS","ITS v11"); | |
275 | } | |
276 | ||
277 | if (iTPC) | |
278 | { | |
279 | //============================ TPC parameters ================================ | |
280 | ||
281 | AliTPC *TPC = new AliTPCv2("TPC", "Default"); | |
282 | } | |
283 | ||
284 | ||
285 | if (iTOF) { | |
286 | //=================== TOF parameters ============================ | |
287 | ||
288 | AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF"); | |
289 | } | |
290 | ||
291 | ||
292 | if (iRICH) | |
293 | { | |
294 | //=================== RICH parameters =========================== | |
295 | AliRICH *RICH = new AliRICHv1("RICH", "normal RICH"); | |
296 | ||
297 | } | |
298 | ||
299 | ||
300 | if (iZDC) | |
301 | { | |
302 | //=================== ZDC parameters ============================ | |
303 | ||
304 | AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC"); | |
305 | } | |
306 | ||
307 | if (iTRD) | |
308 | { | |
309 | //=================== TRD parameters ============================ | |
310 | ||
311 | AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator"); | |
312 | ||
313 | AliTRDgeometry *geoTRD = TRD->GetGeometry(); | |
314 | // Partial geometry: modules at 0,1,7,8,9,10,17 | |
315 | // starting at 3h in positive direction | |
316 | ||
317 | geoTRD->SetSMstatus(2,0); | |
318 | geoTRD->SetSMstatus(3,0); | |
319 | geoTRD->SetSMstatus(4,0); | |
320 | geoTRD->SetSMstatus(5,0); | |
321 | geoTRD->SetSMstatus(6,0); | |
322 | ||
323 | geoTRD->SetSMstatus(11,0); | |
324 | geoTRD->SetSMstatus(12,0); | |
325 | geoTRD->SetSMstatus(13,0); | |
326 | geoTRD->SetSMstatus(14,0); | |
327 | geoTRD->SetSMstatus(15,0); | |
328 | geoTRD->SetSMstatus(16,0); | |
329 | } | |
330 | ||
331 | if (iFMD) | |
332 | { | |
333 | //=================== FMD parameters ============================ | |
334 | AliFMD *FMD = new AliFMDv1("FMD", "normal FMD"); | |
335 | } | |
336 | ||
337 | if (iMUON) | |
338 | { | |
339 | //=================== MUON parameters =========================== | |
340 | // New MUONv1 version (geometry defined via builders) | |
341 | AliMUON *MUON = new AliMUONv1("MUON", "default"); | |
342 | ((AliMUONv1*)MUON)->SetStepManagerVersionDE(true); | |
343 | MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilderV2(MUON)); | |
344 | MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilderV2(MUON)); | |
345 | MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON)); | |
346 | MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON)); | |
347 | } | |
348 | //=================== PHOS parameters =========================== | |
349 | ||
350 | if (iPHOS) | |
351 | { | |
352 | AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP"); | |
353 | //AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV"); | |
354 | } | |
355 | ||
356 | ||
357 | if (iPMD) | |
358 | { | |
359 | //=================== PMD parameters ============================ | |
360 | AliPMD *PMD = new AliPMDv1("PMD", "normal PMD"); | |
361 | } | |
362 | ||
363 | if (iSTART) | |
364 | { | |
365 | //=================== START parameters ============================ | |
366 | AliSTART *START = new AliSTARTv1("START", "START Detector"); | |
367 | } | |
368 | ||
369 | if (iEMCAL) | |
370 | { | |
371 | //=================== EMCAL parameters ============================ | |
372 | AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH"); | |
373 | } | |
374 | ||
375 | if (iCRT) | |
376 | { | |
377 | //=================== CRT parameters ============================ | |
378 | AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE"); | |
379 | } | |
380 | ||
381 | if (iVZERO) | |
382 | { | |
383 | //=================== CRT parameters ============================ | |
384 | AliVZERO *VZERO = new AliVZEROv5("VZERO", "normal VZERO"); | |
385 | } | |
386 | ||
387 | AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__); | |
388 | ||
389 | } | |
390 | ||
391 | Float_t EtaToTheta(Float_t arg){ | |
392 | return (180./TMath::Pi())*2.*atan(exp(-arg)); | |
393 | } | |
394 | ||
395 | void ProcessEnvironmentVars() | |
396 | { | |
397 | // Colliding system | |
398 | if (gSystem->Getenv("CONFIG_BEAMS")) { | |
399 | beams = gSystem->Getenv("CONFIG_BEAMS"); | |
400 | } | |
401 | ||
402 | // PDG code of neutral meson | |
403 | if (gSystem->Getenv("CONFIG_MESON_PDG")) { | |
404 | mesonPDG = atoi(gSystem->Getenv("CONFIG_MESON_PDG")); | |
405 | } | |
406 | ||
407 | // Random Number seed | |
408 | if (gSystem->Getenv("CONFIG_SEED")) { | |
409 | sseed = atoi(gSystem->Getenv("CONFIG_SEED")); | |
410 | } | |
411 | ||
412 | ||
413 | } |