Using AliMagWrapCheb
[u/mrichter/AliRoot.git] / test / genkine / sim / Config.C
CommitLineData
3928b038 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,"ConfigPPR.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 <TPDGCode.h>
14#include <TF1.h>
15#include "STEER/AliRunLoader.h"
16#include "STEER/AliRun.h"
17#include "STEER/AliConfig.h"
18#include "STEER/AliGenerator.h"
19#include "STEER/AliLog.h"
20#include "PYTHIA6/AliDecayerPythia.h"
21#include "EVGEN/AliGenHIJINGpara.h"
22#include "THijing/AliGenHijing.h"
23#include "EVGEN/AliGenCocktail.h"
24#include "EVGEN/AliGenSlowNucleons.h"
25#include "EVGEN/AliSlowNucleonModelExp.h"
26#include "EVGEN/AliGenParam.h"
27#include "EVGEN/AliGenMUONlib.h"
28#include "EVGEN/AliGenSTRANGElib.h"
29#include "EVGEN/AliGenMUONCocktail.h"
30#include "EVGEN/AliGenCocktail.h"
31#include "EVGEN/AliGenGeVSim.h"
32#include "EVGEN/AliGeVSimParticle.h"
33#include "PYTHIA6/AliGenPythia.h"
cd33bb3e 34#include "STEER/AliMagWrapCheb.h"
3928b038 35#include "STRUCT/AliBODY.h"
36#include "STRUCT/AliMAG.h"
96fb3353 37#include "STRUCT/AliABSOv3.h"
38#include "STRUCT/AliDIPOv3.h"
39#include "STRUCT/AliHALLv3.h"
3928b038 40#include "STRUCT/AliFRAMEv2.h"
96fb3353 41#include "STRUCT/AliSHILv3.h"
42#include "STRUCT/AliPIPEv3.h"
99887042 43#include "ITS/AliITSv11Hybrid.h"
3928b038 44#include "TPC/AliTPCv2.h"
0d7ef405 45#include "TOF/AliTOFv6T0.h"
99887042 46#include "HMPID/AliHMPIDv3.h"
cb14d625 47#include "ZDC/AliZDCv3.h"
3928b038 48#include "TRD/AliTRDv1.h"
49#include "FMD/AliFMDv1.h"
50#include "MUON/AliMUONv1.h"
51#include "EMCAL/AliEMCALv2.h"
52#include "PHOS/AliPHOSv1.h"
53#include "PMD/AliPMDv1.h"
54#include "T0/AliT0v1.h"
55#include "EMCAL/AliEMCALv2.h"
f7882672 56#include "ACORDE/AliACORDEv1.h"
3928b038 57#include "VZERO/AliVZEROv7.h"
58#include "EVGEN/AliGenExtFile.h"
59#include "EVGEN/AliGenReaderTreeK.h"
60#endif
61
62enum PprRad_t
63{
64 kGluonRadiation, kNoGluonRadiation
65};
66
67enum PprMag_t
68{
69 k2kG, k4kG, k5kG
70};
71
72enum PprTrigConf_t
73{
74 kDefaultPPTrig, kDefaultPbPbTrig
75};
76
77const char * pprTrigConfName[] = {
78 "p-p","Pb-Pb"
79};
80
3b90f080 81
3928b038 82// This part for configuration
83
84static PprRad_t srad = kGluonRadiation;
85static PprMag_t smag = k5kG;
86static Int_t sseed = 12345; //Set 0 to use the current time
87
88static PprTrigConf_t strig = kDefaultPPTrig; // default PbPb trigger configuration
89// Comment line
90static TString comment;
91
92// Functions
93Float_t EtaToTheta(Float_t arg);
94AliGenerator* GeneratorFactory();
95
96void Config()
97{
98 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
99 // Theta range given through pseudorapidity limits 22/6/2001
100
101 // Set Random Number seed
102 gRandom->SetSeed(sseed);
103 cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
104
105
106
d7b8d4b5 107 // libraries required by geant321 and Pythia6
3928b038 108#if defined(__CINT__)
d7b8d4b5 109 gSystem->Load("liblhapdf.so"); // Parton density functions
110 gSystem->Load("libEGPythia6.so"); // TGenerator interface
111 gSystem->Load("libpythia6.so"); // Pythia
112 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
3fc6785c 113 gSystem->Load("libgeant321");
3928b038 114#endif
115
116 new TGeant3TGeo("C++ Interface to Geant3");
117
118 AliRunLoader* rl=0x0;
119
120 cout<<"Config.C: Creating Run Loader ..."<<endl;
121 rl = AliRunLoader::Open("galice.root",
122 AliConfig::GetDefaultEventFolderName(),
123 "recreate");
124 if (rl == 0x0)
125 {
126 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
127 return;
128 }
129 rl->SetCompressionLevel(2);
130 rl->SetNumberOfEventsPerFile(100);
131 gAlice->SetRunLoader(rl);
132
133 // Set the trigger configuration
134 gAlice->SetTriggerDescriptor(pprTrigConfName[strig]);
135 cout<<"Trigger configuration is set to "<<pprTrigConfName[strig]<<endl;
136
137
138 //
139 // Set External decayer
140 AliDecayer *decayer = new AliDecayerPythia();
141 decayer->SetForceDecay(kAll);
142 decayer->Init();
143
144 //forbid some decays
145 AliPythia * py= AliPythia::Instance();
f1047fdc 146 py->SetMDME(737,1,0); //forbid D*+->D+ + pi0
147 py->SetMDME(738,1,0);//forbid D*+->D+ + gamma
3928b038 148
f1047fdc 149 for(Int_t d=747; d<=762; d++){
3928b038 150 py->SetMDME(d,1,0);
151 }
152
f1047fdc 153 for(Int_t d=764; d<=807; d++){
3928b038 154 py->SetMDME(d,1,0);
155 }
156
157
158
159 gMC->SetExternalDecayer(decayer);
160 //
161 //
162 //=======================================================================
163 //
164 //=======================================================================
165 // ************* STEERING parameters FOR ALICE SIMULATION **************
166 // --- Specify event type to be tracked through the ALICE setup
167 // --- All positions are in cm, angles in degrees, and P and E in GeV
168
169 gMC->SetProcess("DCAY",1);
170 gMC->SetProcess("PAIR",1);
171 gMC->SetProcess("COMP",1);
172 gMC->SetProcess("PHOT",1);
173 gMC->SetProcess("PFIS",0);
174 gMC->SetProcess("DRAY",0);
175 gMC->SetProcess("ANNI",1);
176 gMC->SetProcess("BREM",1);
177 gMC->SetProcess("MUNU",1);
178 gMC->SetProcess("CKOV",1);
179 gMC->SetProcess("HADR",1);
180 gMC->SetProcess("LOSS",2);
181 gMC->SetProcess("MULS",1);
182 gMC->SetProcess("RAYL",1);
183
184 Float_t cut = 1.e-3; // 1MeV cut by default
185 Float_t tofmax = 1.e10;
186
187 gMC->SetCut("CUTGAM", cut);
188 gMC->SetCut("CUTELE", cut);
189 gMC->SetCut("CUTNEU", cut);
190 gMC->SetCut("CUTHAD", cut);
191 gMC->SetCut("CUTMUO", cut);
192 gMC->SetCut("BCUTE", cut);
193 gMC->SetCut("BCUTM", cut);
194 gMC->SetCut("DCUTE", cut);
195 gMC->SetCut("DCUTM", cut);
196 gMC->SetCut("PPCUTM", cut);
197 gMC->SetCut("TOFMAX", tofmax);
198
199 // Debug and log level
200 // AliLog::SetGlobalDebugLevel(0);
201 // AliLog::SetGlobalLogLevel(AliLog::kError);
202
203 // Generator Configuration
204 AliGenerator* gener = GeneratorFactory();
205 gener->SetOrigin(0, 0, 0); // vertex position
206 gener->SetSigma(0, 0, 5.3); // Sigma in (X,Y,Z) (cm) on IP position
207 gener->SetCutVertexZ(1.); // Truncate at 1 sigma
208 gener->SetVertexSmear(kPerEvent);
209 gener->SetTrackingFlag(1);
210 gener->Init();
211
212 if (smag == k2kG) {
213 comment = comment.Append(" | L3 field 0.2 T");
214 } else if (smag == k4kG) {
215 comment = comment.Append(" | L3 field 0.4 T");
216 } else if (smag == k5kG) {
217 comment = comment.Append(" | L3 field 0.5 T");
218 }
219
220
221 if (srad == kGluonRadiation)
222 {
223 comment = comment.Append(" | Gluon Radiation On");
224
225 } else {
226 comment = comment.Append(" | Gluon Radiation Off");
227 }
228
229
230 printf("\n \n Comment: %s \n \n", comment.Data());
231
232
233// Field (L3 0.4 T)
cd33bb3e 234 AliMagWrapCheb* field = new AliMagWrapCheb("Maps","Maps", 2, 1., 10., smag);
3928b038 235 rl->CdGAFile();
236 gAlice->SetField(field);
237//
238 Int_t iABSO = 1;
239 Int_t iDIPO = 1;
240 Int_t iFMD = 1;
241 Int_t iFRAME = 1;
242 Int_t iHALL = 1;
243 Int_t iITS = 1;
244 Int_t iMAG = 1;
245 Int_t iMUON = 1;
246 Int_t iPHOS = 1;
247 Int_t iPIPE = 1;
248 Int_t iPMD = 1;
249 Int_t iHMPID = 1;
250 Int_t iSHIL = 1;
251 Int_t iT0 = 1;
252 Int_t iTOF = 1;
253 Int_t iTPC = 1;
254 Int_t iTRD = 1;
255 Int_t iZDC = 1;
256 Int_t iEMCAL = 1;
257 Int_t iVZERO = 1;
258 Int_t iACORDE = 0;
259
260 //=================== Alice BODY parameters =============================
261 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
262
263
264 if (iMAG)
265 {
266 //=================== MAG parameters ============================
267 // --- Start with Magnet since detector layouts may be depending ---
268 // --- on the selected Magnet dimensions ---
269 AliMAG *MAG = new AliMAG("MAG", "Magnet");
270 }
271
272
273 if (iABSO)
274 {
275 //=================== ABSO parameters ============================
96fb3353 276 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
3928b038 277 }
278
279 if (iDIPO)
280 {
281 //=================== DIPO parameters ============================
282
96fb3353 283 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
3928b038 284 }
285
286 if (iHALL)
287 {
288 //=================== HALL parameters ============================
289
96fb3353 290 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
3928b038 291 }
292
293
294 if (iFRAME)
295 {
296 //=================== FRAME parameters ============================
297
298 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
bab433b3 299 FRAME->SetHoles(1);
3928b038 300 }
301
302 if (iSHIL)
303 {
304 //=================== SHIL parameters ============================
305
96fb3353 306 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
3928b038 307 }
308
309
310 if (iPIPE)
311 {
312 //=================== PIPE parameters ============================
313
96fb3353 314 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
3928b038 315 }
316
e89fa83b 317 if (iITS)
318 {
319 //=================== ITS parameters ============================
3928b038 320
99887042 321 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
3928b038 322 }
323
324 if (iTPC)
325 {
326 //============================ TPC parameters =====================
327 AliTPC *TPC = new AliTPCv2("TPC", "Default");
328 }
329
330
331 if (iTOF) {
332 //=================== TOF parameters ============================
0d7ef405 333 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
3928b038 334 }
335
336
337 if (iHMPID)
338 {
339 //=================== HMPID parameters ===========================
99887042 340 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
3928b038 341
342 }
343
344
345 if (iZDC)
346 {
347 //=================== ZDC parameters ============================
348
cb14d625 349 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
3928b038 350 }
351
352 if (iTRD)
353 {
354 //=================== TRD parameters ============================
355
356 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
357 }
358
359 if (iFMD)
360 {
361 //=================== FMD parameters ============================
362 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
363 }
364
365 if (iMUON)
366 {
367 //=================== MUON parameters ===========================
368 // New MUONv1 version (geometry defined via builders)
369 AliMUON *MUON = new AliMUONv1("MUON", "default");
370 }
371 //=================== PHOS parameters ===========================
372
373 if (iPHOS)
374 {
375 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
376 }
377
378
379 if (iPMD)
380 {
381 //=================== PMD parameters ============================
382 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
383 }
384
385 if (iT0)
386 {
387 //=================== T0 parameters ============================
388 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
389 }
390
391 if (iEMCAL)
392 {
393 //=================== EMCAL parameters ============================
8224b11d 394 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
3928b038 395 }
396
397 if (iACORDE)
398 {
399 //=================== ACORDE parameters ============================
f7882672 400 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
3928b038 401 }
402
403 if (iVZERO)
404 {
405 //=================== VZERO parameters ============================
406 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
407 }
408
409
410}
411
412Float_t EtaToTheta(Float_t arg){
413 return (180./TMath::Pi())*2.*atan(exp(-arg));
414}
415
416
417
418AliGenerator* GeneratorFactory() {
419
420 AliGenExtFile *gener = new AliGenExtFile(-1);
421 AliGenReaderTreeK * reader = new AliGenReaderTreeK();
422
423 reader->SetFileName("galice.root");
424 reader->AddDir("../gen");
425 gener->SetReader(reader);
426
427 return gener;
428
429
430}
431