Final TOF version: 18 modules with holes for PHOS (Annalisa)
[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"
34#include "STEER/AliMagFMaps.h"
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"
56#include "ACORDE/AliACORDEv0.h"
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)
234 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., smag);
235 field->SetL3ConstField(0); //Using const. field in the barrel
236 rl->CdGAFile();
237 gAlice->SetField(field);
238//
239 Int_t iABSO = 1;
240 Int_t iDIPO = 1;
241 Int_t iFMD = 1;
242 Int_t iFRAME = 1;
243 Int_t iHALL = 1;
244 Int_t iITS = 1;
245 Int_t iMAG = 1;
246 Int_t iMUON = 1;
247 Int_t iPHOS = 1;
248 Int_t iPIPE = 1;
249 Int_t iPMD = 1;
250 Int_t iHMPID = 1;
251 Int_t iSHIL = 1;
252 Int_t iT0 = 1;
253 Int_t iTOF = 1;
254 Int_t iTPC = 1;
255 Int_t iTRD = 1;
256 Int_t iZDC = 1;
257 Int_t iEMCAL = 1;
258 Int_t iVZERO = 1;
259 Int_t iACORDE = 0;
260
261 //=================== Alice BODY parameters =============================
262 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
263
264
265 if (iMAG)
266 {
267 //=================== MAG parameters ============================
268 // --- Start with Magnet since detector layouts may be depending ---
269 // --- on the selected Magnet dimensions ---
270 AliMAG *MAG = new AliMAG("MAG", "Magnet");
271 }
272
273
274 if (iABSO)
275 {
276 //=================== ABSO parameters ============================
96fb3353 277 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
3928b038 278 }
279
280 if (iDIPO)
281 {
282 //=================== DIPO parameters ============================
283
96fb3353 284 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
3928b038 285 }
286
287 if (iHALL)
288 {
289 //=================== HALL parameters ============================
290
96fb3353 291 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
3928b038 292 }
293
294
295 if (iFRAME)
296 {
297 //=================== FRAME parameters ============================
298
299 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
bab433b3 300 FRAME->SetHoles(1);
3928b038 301 }
302
303 if (iSHIL)
304 {
305 //=================== SHIL parameters ============================
306
96fb3353 307 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
3928b038 308 }
309
310
311 if (iPIPE)
312 {
313 //=================== PIPE parameters ============================
314
96fb3353 315 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
3928b038 316 }
317
e89fa83b 318 if (iITS)
319 {
320 //=================== ITS parameters ============================
3928b038 321
99887042 322 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
3928b038 323 }
324
325 if (iTPC)
326 {
327 //============================ TPC parameters =====================
328 AliTPC *TPC = new AliTPCv2("TPC", "Default");
329 }
330
331
332 if (iTOF) {
333 //=================== TOF parameters ============================
0d7ef405 334 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
3928b038 335 }
336
337
338 if (iHMPID)
339 {
340 //=================== HMPID parameters ===========================
99887042 341 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
3928b038 342
343 }
344
345
346 if (iZDC)
347 {
348 //=================== ZDC parameters ============================
349
cb14d625 350 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
3928b038 351 }
352
353 if (iTRD)
354 {
355 //=================== TRD parameters ============================
356
357 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
358 }
359
360 if (iFMD)
361 {
362 //=================== FMD parameters ============================
363 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
364 }
365
366 if (iMUON)
367 {
368 //=================== MUON parameters ===========================
369 // New MUONv1 version (geometry defined via builders)
370 AliMUON *MUON = new AliMUONv1("MUON", "default");
371 }
372 //=================== PHOS parameters ===========================
373
374 if (iPHOS)
375 {
376 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
377 }
378
379
380 if (iPMD)
381 {
382 //=================== PMD parameters ============================
383 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
384 }
385
386 if (iT0)
387 {
388 //=================== T0 parameters ============================
389 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
390 }
391
392 if (iEMCAL)
393 {
394 //=================== EMCAL parameters ============================
395 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
396 }
397
398 if (iACORDE)
399 {
400 //=================== ACORDE parameters ============================
401 AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
402 }
403
404 if (iVZERO)
405 {
406 //=================== VZERO parameters ============================
407 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
408 }
409
410
411}
412
413Float_t EtaToTheta(Float_t arg){
414 return (180./TMath::Pi())*2.*atan(exp(-arg));
415}
416
417
418
419AliGenerator* GeneratorFactory() {
420
421 AliGenExtFile *gener = new AliGenExtFile(-1);
422 AliGenReaderTreeK * reader = new AliGenReaderTreeK();
423
424 reader->SetFileName("galice.root");
425 reader->AddDir("../gen");
426 gener->SetReader(reader);
427
428 return gener;
429
430
431}
432