Using the default ITS settings in the configuration files (Bjorn)
[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"
3928b038 43#include "ITS/AliITSvPPRasymmFMD.h"
44#include "TPC/AliTPCv2.h"
0d7ef405 45#include "TOF/AliTOFv6T0.h"
55eb2b56 46#include "HMPID/AliHMPIDv2.h"
3928b038 47#include "ZDC/AliZDCv2.h"
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
81// This part for configuration
82
83static PprRad_t srad = kGluonRadiation;
84static PprMag_t smag = k5kG;
85static Int_t sseed = 12345; //Set 0 to use the current time
86
87static PprTrigConf_t strig = kDefaultPPTrig; // default PbPb trigger configuration
88// Comment line
89static TString comment;
90
91// Functions
92Float_t EtaToTheta(Float_t arg);
93AliGenerator* GeneratorFactory();
94
95void Config()
96{
97 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
98 // Theta range given through pseudorapidity limits 22/6/2001
99
100 // Set Random Number seed
101 gRandom->SetSeed(sseed);
102 cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
103
104
105
106 // libraries required by geant321
107#if defined(__CINT__)
108 gSystem->Load("libgeant321");
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
129 gAlice->SetTriggerDescriptor(pprTrigConfName[strig]);
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();
141 py->SetMDME(731,1,0); //forbid D*+->D+ + pi0
142 py->SetMDME(732,1,0);//forbid D*+->D+ + gamma
143
144 for(Int_t d=741; d<=756; d++){
145 py->SetMDME(d,1,0);
146 }
147
148 for(Int_t d=758; d<=801; d++){
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
207 if (smag == k2kG) {
208 comment = comment.Append(" | L3 field 0.2 T");
209 } else if (smag == k4kG) {
210 comment = comment.Append(" | L3 field 0.4 T");
211 } else if (smag == k5kG) {
212 comment = comment.Append(" | L3 field 0.5 T");
213 }
214
215
216 if (srad == kGluonRadiation)
217 {
218 comment = comment.Append(" | Gluon Radiation On");
219
220 } else {
221 comment = comment.Append(" | Gluon Radiation Off");
222 }
223
224
225 printf("\n \n Comment: %s \n \n", comment.Data());
226
227
228// Field (L3 0.4 T)
229 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., smag);
230 field->SetL3ConstField(0); //Using const. field in the barrel
231 rl->CdGAFile();
232 gAlice->SetField(field);
233//
234 Int_t iABSO = 1;
235 Int_t iDIPO = 1;
236 Int_t iFMD = 1;
237 Int_t iFRAME = 1;
238 Int_t iHALL = 1;
239 Int_t iITS = 1;
240 Int_t iMAG = 1;
241 Int_t iMUON = 1;
242 Int_t iPHOS = 1;
243 Int_t iPIPE = 1;
244 Int_t iPMD = 1;
245 Int_t iHMPID = 1;
246 Int_t iSHIL = 1;
247 Int_t iT0 = 1;
248 Int_t iTOF = 1;
249 Int_t iTPC = 1;
250 Int_t iTRD = 1;
251 Int_t iZDC = 1;
252 Int_t iEMCAL = 1;
253 Int_t iVZERO = 1;
254 Int_t iACORDE = 0;
255
256 //=================== Alice BODY parameters =============================
257 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
258
259
260 if (iMAG)
261 {
262 //=================== MAG parameters ============================
263 // --- Start with Magnet since detector layouts may be depending ---
264 // --- on the selected Magnet dimensions ---
265 AliMAG *MAG = new AliMAG("MAG", "Magnet");
266 }
267
268
269 if (iABSO)
270 {
271 //=================== ABSO parameters ============================
96fb3353 272 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
3928b038 273 }
274
275 if (iDIPO)
276 {
277 //=================== DIPO parameters ============================
278
96fb3353 279 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
3928b038 280 }
281
282 if (iHALL)
283 {
284 //=================== HALL parameters ============================
285
96fb3353 286 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
3928b038 287 }
288
289
290 if (iFRAME)
291 {
292 //=================== FRAME parameters ============================
293
294 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
295 }
296
297 if (iSHIL)
298 {
299 //=================== SHIL parameters ============================
300
96fb3353 301 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
3928b038 302 }
303
304
305 if (iPIPE)
306 {
307 //=================== PIPE parameters ============================
308
96fb3353 309 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
3928b038 310 }
311
e89fa83b 312 if (iITS)
313 {
314 //=================== ITS parameters ============================
3928b038 315
3928b038 316 AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
3928b038 317 }
318
319 if (iTPC)
320 {
321 //============================ TPC parameters =====================
322 AliTPC *TPC = new AliTPCv2("TPC", "Default");
323 }
324
325
326 if (iTOF) {
327 //=================== TOF parameters ============================
0d7ef405 328 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
3928b038 329 }
330
331
332 if (iHMPID)
333 {
334 //=================== HMPID parameters ===========================
55eb2b56 335 AliHMPID *HMPID = new AliHMPIDv2("HMPID", "normal HMPID");
3928b038 336
337 }
338
339
340 if (iZDC)
341 {
342 //=================== ZDC parameters ============================
343
344 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
345 }
346
347 if (iTRD)
348 {
349 //=================== TRD parameters ============================
350
351 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
352 }
353
354 if (iFMD)
355 {
356 //=================== FMD parameters ============================
357 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
358 }
359
360 if (iMUON)
361 {
362 //=================== MUON parameters ===========================
363 // New MUONv1 version (geometry defined via builders)
364 AliMUON *MUON = new AliMUONv1("MUON", "default");
365 }
366 //=================== PHOS parameters ===========================
367
368 if (iPHOS)
369 {
370 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
371 }
372
373
374 if (iPMD)
375 {
376 //=================== PMD parameters ============================
377 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
378 }
379
380 if (iT0)
381 {
382 //=================== T0 parameters ============================
383 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
384 }
385
386 if (iEMCAL)
387 {
388 //=================== EMCAL parameters ============================
389 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
390 }
391
392 if (iACORDE)
393 {
394 //=================== ACORDE parameters ============================
395 AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
396 }
397
398 if (iVZERO)
399 {
400 //=================== VZERO parameters ============================
401 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
402 }
403
404
405}
406
407Float_t EtaToTheta(Float_t arg){
408 return (180./TMath::Pi())*2.*atan(exp(-arg));
409}
410
411
412
413AliGenerator* GeneratorFactory() {
414
415 AliGenExtFile *gener = new AliGenExtFile(-1);
416 AliGenReaderTreeK * reader = new AliGenReaderTreeK();
417
418 reader->SetFileName("galice.root");
419 reader->AddDir("../gen");
420 gener->SetReader(reader);
421
422 return gener;
423
424
425}
426