]> git.uio.no Git - u/mrichter/AliRoot.git/blame - test/genkine/sim/Config.C
Initialization of the quality assurance data-makers
[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"
3928b038 46#include "HMPID/AliHMPIDv1.h"
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
312 if(iITS) {
313
314 //=================== ITS parameters ============================
315 //
316 // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
317 // almost all other detectors. This involves the fact that the ITS geometry
318 // still has several options to be followed in parallel in order to determine
319 // the best set-up which minimizes the induced background. All the geometries
320 // available to date are described in the following. Read carefully the comments
321 // and use the default version (the only one uncommented) unless you are making
322 // comparisons and you know what you are doing. In this case just uncomment the
323 // ITS geometry you want to use and run Aliroot.
324 //
325 // Detailed geometries:
326 //
327 //
328 //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
329 //
330 //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
331 //
332 AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
333 ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
334 ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
335 // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
336 ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
337 ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
338 ITS->SetThicknessChip1(150.); // chip thickness on layer 1 must be in the range [150,300]
339 ITS->SetThicknessChip2(150.); // chip thickness on layer 2 must be in the range [150,300]
340 ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
341 ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
342
343 // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
344 // for reconstruction !):
345 //
346 //
347 //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
348 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
349 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
350 //
351 //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
352 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
353 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
354 //
355 //
356 //
357 // Geant3 <-> EUCLID conversion
358 // ============================
359 //
360 // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
361 // media to two ASCII files (called by default ITSgeometry.euc and
362 // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
363 // The default (=0) means that you dont want to use this facility.
364 //
365 ITS->SetEUCLID(0);
366 }
367
368 if (iTPC)
369 {
370 //============================ TPC parameters =====================
371 AliTPC *TPC = new AliTPCv2("TPC", "Default");
372 }
373
374
375 if (iTOF) {
376 //=================== TOF parameters ============================
0d7ef405 377 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
3928b038 378 }
379
380
381 if (iHMPID)
382 {
383 //=================== HMPID parameters ===========================
384 AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");
385
386 }
387
388
389 if (iZDC)
390 {
391 //=================== ZDC parameters ============================
392
393 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
394 }
395
396 if (iTRD)
397 {
398 //=================== TRD parameters ============================
399
400 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
401 }
402
403 if (iFMD)
404 {
405 //=================== FMD parameters ============================
406 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
407 }
408
409 if (iMUON)
410 {
411 //=================== MUON parameters ===========================
412 // New MUONv1 version (geometry defined via builders)
413 AliMUON *MUON = new AliMUONv1("MUON", "default");
414 }
415 //=================== PHOS parameters ===========================
416
417 if (iPHOS)
418 {
419 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
420 }
421
422
423 if (iPMD)
424 {
425 //=================== PMD parameters ============================
426 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
427 }
428
429 if (iT0)
430 {
431 //=================== T0 parameters ============================
432 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
433 }
434
435 if (iEMCAL)
436 {
437 //=================== EMCAL parameters ============================
438 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
439 }
440
441 if (iACORDE)
442 {
443 //=================== ACORDE parameters ============================
444 AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
445 }
446
447 if (iVZERO)
448 {
449 //=================== VZERO parameters ============================
450 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
451 }
452
453
454}
455
456Float_t EtaToTheta(Float_t arg){
457 return (180./TMath::Pi())*2.*atan(exp(-arg));
458}
459
460
461
462AliGenerator* GeneratorFactory() {
463
464 AliGenExtFile *gener = new AliGenExtFile(-1);
465 AliGenReaderTreeK * reader = new AliGenReaderTreeK();
466
467 reader->SetFileName("galice.root");
468 reader->AddDir("../gen");
469 gener->SetReader(reader);
470
471 return gener;
472
473
474}
475