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