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