]> git.uio.no Git - u/mrichter/AliRoot.git/blame - test/generators/TUHKMgen/Config.C
Replace the PHOS version from IHEP to Run1 and fix the compilation, when possibletest...
[u/mrichter/AliRoot.git] / test / generators / TUHKMgen / Config.C
CommitLineData
97bd8e56 1// One can use the configuration macro in compiled mode by
2// root [0] gSystem->Load("libgeant321");
5889a25e 3// root [1] gSystem->Load("libpythia6.4.25.so");
4// root [2] gSystem->Load("libqpythia.so");
5// root [3] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
6// -I$ALICE/geant3/TGeant3");
7// root [4] AliSimulation sim
8// root [5] sim.SetConfigFile("Config.C++")
9// root [6] sim.Run()
97bd8e56 10
11#if !defined(__CINT__) || defined(__MAKECINT__)
12#include <Riostream.h>
13#include <TPDGCode.h>
14#include <TRandom.h>
15#include <TSystem.h>
16#include <TVirtualMC.h>
17#include <TGeant3TGeo.h>
5889a25e 18#include <TGeoGlobalMagField.h>
19#include "AliRunLoader.h"
20#include "AliRun.h"
21#include "AliConfig.h"
22#include "AliDecayerPythia.h"
23#include "AliGenCocktail.h"
24#include "AliGenHIJINGpara.h"
25#include "AliMagF.h"
26#include "AliBODY.h"
27#include "AliMAG.h"
28#include "AliABSOv3.h"
29#include "AliDIPOv3.h"
30#include "AliHALLv3.h"
31#include "AliFRAMEv2.h"
32#include "AliSHILv3.h"
33#include "AliPIPEv3.h"
34#include "AliITSv11.h"
35#include "AliTPCv2.h"
36#include "AliTOFv6T0.h"
37#include "AliHMPIDv3.h"
38#include "AliZDCv4.h"
39#include "AliTRDv1.h"
40#include "AliTRDgeometry.h"
41#include "AliFMDv1.h"
42#include "AliMUONv1.h"
43#include "AliPHOSv1.h"
44#include "AliPMDv1.h"
45#include "AliT0v1.h"
46#include "AliEMCALv2.h"
47#include "AliACORDEv1.h"
48#include "AliVZEROv7.h"
49#include "AliGenUHKM.h"
50#include "AliSimulation.h"
97bd8e56 51#endif
52
53enum PprTrigConf_t
54{
55 kDefaultPPTrig, kDefaultPbPbTrig
56};
57
58const char * pprTrigConfName[] = {
59 "p-p","Pb-Pb"
60};
61
62static PprTrigConf_t strig = kDefaultPbPbTrig;
63Float_t EtaToTheta(Float_t arg);
64void LoadPythia();
65
66
67void Config()
68{
69 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
70 // Theta range given through pseudorapidity limits 22/6/2001
71
72 // Set Random Number seed
73 //gRandom->SetSeed(123456); // Set 0 to use the current time
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 // Load Pythia libraries
78 LoadPythia();
79 // Libraries required by geant321
80#if defined(__CINT__)
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(3);
100 gAlice->SetRunLoader(rl);
101
102
103
104 // gAlice->SetGeometryFromFile("geometry.root");
105
106 // Uncomment if you want to load geometry from OCDB! >>>>
107/*
108 if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
109 cout << "#####################################################" << endl;
110 cout << "# #" << endl;
111 cout << "# WARNING: CDB DEFAULT STORAGE NOT SET !!! #" << endl;
112 cout << "# SETTING IT TO local://$ALICE_ROOT/OCDB !!! #" << endl;
113 cout << "# #" << endl;
114 cout << "#####################################################" << endl;
115
116 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
117 }
118
119 if(AliCDBManager::Instance()->GetRun() < 0){
120 cout << "#####################################################" << endl;
121 cout << "# #" << endl;
122 cout << "# WARNING: RUN NUMBER NOT SET !!! #" << endl;
123 cout << "# SETTING IT TO 0 !!! #" << endl;
124 cout << "# #" << endl;
125 cout << "#####################################################" << endl;
126
127 AliCDBManager::Instance()->SetRun(0);
128 }
129 gAlice->SetGeometryFromCDB();
130*/
131
132
133
134 // Set the trigger configuration
93133609 135 AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
97bd8e56 136 cout<<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
137
138 //
139 // Set External decayer
140 TVirtualMCDecayer *decayer = new AliDecayerPythia();
141
142 decayer->SetForceDecay(kAll);
143 decayer->Init();
144 gMC->SetExternalDecayer(decayer);
145 //=======================================================================
146 // ************* STEERING parameters FOR ALICE SIMULATION **************
147 // --- Specify event type to be tracked through the ALICE setup
148 // --- All positions are in cm, angles in degrees, and P and E in GeV
149
150
151 gMC->SetProcess("DCAY",1);
152 gMC->SetProcess("PAIR",1);
153 gMC->SetProcess("COMP",1);
154 gMC->SetProcess("PHOT",1);
155 gMC->SetProcess("PFIS",0);
156 gMC->SetProcess("DRAY",0);
157 gMC->SetProcess("ANNI",1);
158 gMC->SetProcess("BREM",1);
159 gMC->SetProcess("MUNU",1);
160 gMC->SetProcess("CKOV",1);
161 gMC->SetProcess("HADR",1);
162 gMC->SetProcess("LOSS",2);
163 gMC->SetProcess("MULS",1);
164 gMC->SetProcess("RAYL",1);
165
166 Float_t cut = 1.e-3; // 1MeV cut by default
167 Float_t tofmax = 1.e10;
168
169 gMC->SetCut("CUTGAM", cut);
170 gMC->SetCut("CUTELE", cut);
171 gMC->SetCut("CUTNEU", cut);
172 gMC->SetCut("CUTHAD", cut);
173 gMC->SetCut("CUTMUO", cut);
174 gMC->SetCut("BCUTE", cut);
175 gMC->SetCut("BCUTM", cut);
176 gMC->SetCut("DCUTE", cut);
177 gMC->SetCut("DCUTM", cut);
178 gMC->SetCut("PPCUTM", cut);
179 gMC->SetCut("TOFMAX", tofmax);
180
181 int nParticles = 100;
182 if (gSystem->Getenv("CONFIG_NPARTICLES"))
183 {
184 nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
185 }
186
187 AliGenCocktail *gener = new AliGenCocktail();
188 gener->SetPhiRange(0, 360);
189 // Set pseudorapidity range from -8 to 8.
190 Float_t thmin = EtaToTheta(8); // theta min. <---> eta max
191 Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min
192 gener->SetThetaRange(thmin,thmax);
193 gener->SetOrigin(0, 0, 0); //vertex position
194 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
195
196 gSystem->Load("libTUHKMgen");
197 AliGenUHKM *tuhkMgen = new AliGenUHKM(nParticles);
198 tuhkMgen->SetAllParametersLHC();
199 gener->AddGenerator(tuhkMgen,"TUHKM",1);
200
201 gener->Init();
202
203 //
204 // Activate this line if you want the vertex smearing to happen
205 // track by track
206 //
207 //gener->SetVertexSmear(perTrack);
208 // Field (L3 0.4 T)
209 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
210
211 Int_t iABSO = 1;
212 Int_t iDIPO = 1;
213 Int_t iFMD = 1;
214 Int_t iFRAME = 1;
215 Int_t iHALL = 1;
216 Int_t iITS = 1;
217 Int_t iMAG = 1;
218 Int_t iMUON = 1;
219 Int_t iPHOS = 1;
220 Int_t iPIPE = 1;
221 Int_t iPMD = 1;
222 Int_t iHMPID = 1;
223 Int_t iSHIL = 1;
224 Int_t iT0 = 1;
225 Int_t iTOF = 1;
226 Int_t iTPC = 1;
227 Int_t iTRD = 1;
228 Int_t iZDC = 1;
229 Int_t iEMCAL = 1;
230 Int_t iACORDE = 1;
231 Int_t iVZERO = 1;
232 rl->CdGAFile();
233 //=================== Alice BODY parameters =============================
234 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
235
236 if (iMAG)
237 {
238 //=================== MAG parameters ============================
239 // --- Start with Magnet since detector layouts may be depending ---
240 // --- on the selected Magnet dimensions ---
241 AliMAG *MAG = new AliMAG("MAG", "Magnet");
242 }
243
244
245 if (iABSO)
246 {
247 //=================== ABSO parameters ============================
248 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
249 }
250
251 if (iDIPO)
252 {
253 //=================== DIPO parameters ============================
254
255 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
256 }
257
258 if (iHALL)
259 {
260 //=================== HALL parameters ============================
261
262 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
263 }
264
265
266 if (iFRAME)
267 {
268 //=================== FRAME parameters ============================
269
270 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
93133609 271 FRAME->SetHoles(1);
97bd8e56 272 }
273
274 if (iSHIL)
275 {
276 //=================== SHIL parameters ============================
277
278 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
279 }
280
281
282 if (iPIPE)
283 {
284 //=================== PIPE parameters ============================
285
286 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
287 }
288
289 if (iITS)
290 {
291 //=================== ITS parameters ============================
292
07787d1d 293 AliITS *ITS = new AliITSv11("ITS","ITS v11");
97bd8e56 294 }
295
296 if (iTPC)
297 {
298 //============================ TPC parameters ===================
299 AliTPC *TPC = new AliTPCv2("TPC", "Default");
300 }
301
302
303 if (iTOF) {
304 //=================== TOF parameters ============================
93133609 305 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
306 }
97bd8e56 307
308
309 if (iHMPID)
310 {
311 //=================== HMPID parameters ===========================
312 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
313
314 }
315
316
317 if (iZDC)
318 {
319 //=================== ZDC parameters ============================
320
047922b1 321 AliZDC *ZDC = new AliZDCv4("ZDC", "normal ZDC");
97bd8e56 322 }
323
324 if (iTRD)
325 {
326 //=================== TRD parameters ============================
327
328 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
93133609 329 AliTRDgeometry *geoTRD = TRD->GetGeometry();
330 // Partial geometry: modules at 0,1,7,8,9,10,17
331 // starting at 3h in positive direction
332 geoTRD->SetSMstatus(2,0);
333 geoTRD->SetSMstatus(3,0);
334 geoTRD->SetSMstatus(4,0);
335 geoTRD->SetSMstatus(5,0);
336 geoTRD->SetSMstatus(6,0);
337 geoTRD->SetSMstatus(11,0);
338 geoTRD->SetSMstatus(12,0);
339 geoTRD->SetSMstatus(13,0);
340 geoTRD->SetSMstatus(14,0);
341 geoTRD->SetSMstatus(15,0);
342 geoTRD->SetSMstatus(16,0);
97bd8e56 343 }
344
345 if (iFMD)
346 {
347 //=================== FMD parameters ============================
93133609 348 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
97bd8e56 349 }
350
351 if (iMUON)
352 {
353 //=================== MUON parameters ===========================
354 // New MUONv1 version (geometry defined via builders)
93133609 355 AliMUON *MUON = new AliMUONv1("MUON","default");
97bd8e56 356 }
357 //=================== PHOS parameters ===========================
358
359 if (iPHOS)
360 {
5889a25e 361 AliPHOS *PHOS = new AliPHOSv1("PHOS", "Run1");
97bd8e56 362 }
363
364
365 if (iPMD)
366 {
367 //=================== PMD parameters ============================
368 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
369 }
370
371 if (iT0)
372 {
373 //=================== T0 parameters ============================
374 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
375 }
376
377 if (iEMCAL)
378 {
379 //=================== EMCAL parameters ============================
c76b9217 380 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1");
97bd8e56 381 }
382
383 if (iACORDE)
384 {
385 //=================== ACORDE parameters ============================
386 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
387 }
388
389 if (iVZERO)
390 {
391 //=================== VZERO parameters ============================
392 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
393 }
394
395 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
396
397}
398
399Float_t EtaToTheta(Float_t arg){
400 return (180./TMath::Pi())*2.*atan(exp(-arg));
401}
402
403
404void LoadPythia()
405{
406 // Load Pythia related libraries
b0635849 407 gSystem->Load("liblhapdf"); // Parton density functions
408 gSystem->Load("libEGPythia6"); // TGenerator interface
409 gSystem->Load("libpythia6"); // Pythia
410 gSystem->Load("libAliPythia6"); // ALICE specific implementations
97bd8e56 411}