Cerenkov production switched off.
[u/mrichter/AliRoot.git] / TFluka / macro / FlukaConfig.C
CommitLineData
b9d0a01d 1static Int_t eventsPerRun = 100;
69b7ed25 2enum PprRun_t
3{
4 test50,
5 kParam_8000, kParam_4000, kParam_2000,
6 kHijing_cent1, kHijing_cent2,
7 kHijing_per1, kHijing_per2, kHijing_per3, kHijing_per4, kHijing_per5,
8 kHijing_jj25, kHijing_jj50, kHijing_jj75, kHijing_jj100, kHijing_jj200,
9 kHijing_gj25, kHijing_gj50, kHijing_gj75, kHijing_gj100, kHijing_gj200,
10 kHijing_pA, kPythia6, kPythia6Jets, kD0PbPb5500, kD_TRD, kB_TRD, kJpsi_TRD,
11 kU_TRD, kPyJJ, kPyGJ
12};
13
14enum PprGeo_t
15{
16 kHoles, kNoHoles
17};
18
19enum PprRad_t
20{
21 kGluonRadiation, kNoGluonRadiation
22};
23
24enum PprMag_t
25{
26 k2kG, k4kG, k5kG
27};
28
29
30// This part for configuration
31//static PprRun_t srun = test50;
32static PprRun_t srun = kPythia6;
33static PprGeo_t sgeo = kHoles;
34static PprRad_t srad = kGluonRadiation;
35static PprMag_t smag = k5kG;
36
37// Comment line
38static TString comment;
39
40// Functions
41Float_t EtaToTheta(Float_t arg);
42//AliGenerator* GeneratorFactory(PprRun_t srun);
43//AliGenHijing* HijingStandard();
44
b9d0a01d 45void Config()
46{
47 cout << "==> Config.C..." << endl;
48
49 // Set Random Number seed
69b7ed25 50 gRandom->SetSeed(12345);
51 cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
52
b9d0a01d 53
54
55 // libraries required by fluka21
241a2f65 56
a3fd5381 57 if (!gSystem->Getenv("WITH_ROOT")) {
58 cout << "=== RUNNING TFluka with FLUGG ===\n";
59 char * gvmc = gSystem->ExpandPathName("$(G4VMC)/examples/macro/g4libs.C");
60 gROOT->LoadMacro(gvmc);
61 g4libs();
241a2f65 62
a3fd5381 63 cout << "\t* Loading Flugg..." << endl;
64 gSystem->Load("libFlugg");
65 } else {
66 cout << "=== RUNNING TFluka with TGeo ===\n";
67 gSystem->Load("libGeom");
68 }
69b7ed25 69
241a2f65 70 cout << "\t* Loading TFluka..." << endl;
71 gSystem->Load("libTFluka");
72
b9d0a01d 73 cout << "\t* Instantiating TFluka..." << endl;
74 new TFluka("C++ Interface to Fluka", 3/*verbositylevel*/);
75
69b7ed25 76 AliRunLoader* rl=0x0;
77
78 cout<<"Config.C: Creating Run Loader ..."<<endl;
79 rl = AliRunLoader::Open("galice.root",
80 AliConfig::fgkDefaultEventFolderName,
81 "recreate");
82 if (rl == 0x0)
83 {
84 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
85 return;
86 }
87 rl->SetCompressionLevel(2);
88 rl->SetNumberOfEventsPerFile(3);
89 gAlice->SetRunLoader(rl);
90
b9d0a01d 91 //
92 // Set External decayer
69b7ed25 93 AliDecayer *decayer = new AliDecayerPythia();
94
b9d0a01d 95 decayer->SetForceDecay(kAll);
96 decayer->Init();
97 gMC->SetExternalDecayer(decayer);
69b7ed25 98
99 TFluka *fluka = (TFluka *) gMC;
100 fluka->SetCoreInputFileName("corealice.inp");
101 fluka->SetInputFileName("alice.inp");
102 //
b9d0a01d 103 //
104 //
105 // Physics process control
b9d0a01d 106
69b7ed25 107 gMC->SetProcess("DCAY",1);
108 gMC->SetProcess("PAIR",1);
109 gMC->SetProcess("COMP",1);
110 gMC->SetProcess("PHOT",1);
111 gMC->SetProcess("PFIS",0);
112 gMC->SetProcess("DRAY",0);
113 gMC->SetProcess("ANNI",1);
114 gMC->SetProcess("BREM",1);
115 gMC->SetProcess("MUNU",1);
6f323b2c 116 gMC->SetProcess("CKOV",0); // 1
69b7ed25 117 gMC->SetProcess("HADR",1);
118 gMC->SetProcess("LOSS",2);
119 gMC->SetProcess("MULS",1);
120 gMC->SetProcess("RAYL",1);
121
122 Float_t cut = 1.e-3; // 1MeV cut by default
123 Float_t tofmax = 1.e10;
124
125 gMC->SetCut("CUTGAM", cut);
126 gMC->SetCut("CUTELE", cut);
127 gMC->SetCut("CUTNEU", cut);
128 gMC->SetCut("CUTHAD", cut);
129 gMC->SetCut("CUTMUO", cut);
130 gMC->SetCut("BCUTE", cut);
131 gMC->SetCut("BCUTM", cut);
132 gMC->SetCut("DCUTE", cut);
133 gMC->SetCut("DCUTM", cut);
134 gMC->SetCut("PPCUTM", cut);
135 gMC->SetCut("TOFMAX", tofmax);
b9d0a01d 136
e98b7803 137 //
138 //=======================================================================
139 // ************* STEERING parameters FOR ALICE SIMULATION **************
140 // --- Specify event type to be tracked through the ALICE setup
141 // --- All positions are in cm, angles in degrees, and P and E in GeV
142 if (gSystem->Getenv("CONFIG_NPARTICLES"))
241a2f65 143 int nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
e98b7803 144 else
241a2f65 145 int nParticles = 10;
146
e98b7803 147 cout << "\t* Creating and configuring generator for " << nParticles
148 << " particles..." << endl;
149
150 AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
151
152 gener->SetMomentumRange(0, 999);
153 gener->SetPhiRange(0, 360);
154 // Set pseudorapidity range from -8 to 8.
241a2f65 155 Float_t thmin = EtaToTheta( 0.1); // theta min. <---> eta max
156 Float_t thmax = EtaToTheta(-0.1); // theta max. <---> eta min
e98b7803 157 gener->SetThetaRange(thmin,thmax);
158 gener->SetOrigin(0, 0, 0); //vertex position
159 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
160 gener->Init();
161 //
162 // Activate this line if you want the vertex smearing to happen
163 // track by track
164 //
b9d0a01d 165
69b7ed25 166
241a2f65 167 gAlice->SetDebug(10);
69b7ed25 168 if (smag == k2kG) {
169 comment = comment.Append(" | L3 field 0.2 T");
170 } else if (smag == k4kG) {
171 comment = comment.Append(" | L3 field 0.4 T");
172 } else if (smag == k5kG) {
173 comment = comment.Append(" | L3 field 0.5 T");
174 }
175
176
177 if (srad == kGluonRadiation)
178 {
179 comment = comment.Append(" | Gluon Radiation On");
180
181 } else {
182 comment = comment.Append(" | Gluon Radiation Off");
183 }
184
185 if (sgeo == kHoles)
186 {
187 comment = comment.Append(" | Holes for PHOS/RICH");
188
189 } else {
190 comment = comment.Append(" | No holes for PHOS/RICH");
191 }
192
193 printf("\n \n Comment: %s \n \n", comment.Data());
194
195
196// Field (L3 0.4 T)
197 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., smag);
198 field->SetL3ConstField(0); //Using const. field in the barrel
199 rl->CdGAFile();
200 gAlice->SetField(field);
201
2c053554 202 Int_t iABSO = 0; //1
cdb67f97 203 Int_t iCRT = 0; //Not good ?
2c053554 204 Int_t iDIPO = 0; //1
205 Int_t iFMD = 0; //1
206 Int_t iFRAME = 0; //1
207 Int_t iHALL = 0; //1
208 Int_t iITS = 0; //1
209 Int_t iMAG = 0; //1
210 Int_t iMUON = 0; //1. Not good (newFlagLttc=10000 is outside array bounds)
211 Int_t iPHOS = 0; //1
212 Int_t iPIPE = 0; //1
cdb67f97 213 Int_t iPMD = 0; //Not good (too many regions)
241a2f65 214 Int_t iRICH = 1; //1. Not good (no tracking with FRAME)
2c053554 215 Int_t iSHIL = 0; //1. Not good (no tracking) (it works alone)
216 Int_t iSTART = 0; //1. Not good (no tracking) (it works alone)
217 Int_t iTOF = 0; //1. Not good (no tracking) (newFlagLttc=10000 is outside array bounds if alone)
cdb67f97 218 Int_t iTPC = 1;
2c053554 219 Int_t iTRD = 0; //1. Not good (no tracking) (Crash alone with FRAME)
220 Int_t iZDC = 0; //1. Needs SHIL and others
247ce658 221 Int_t iEMCAL = 0; //Not good (Crash)
2c053554 222 Int_t iVZERO = 0;
cdb67f97 223
e98b7803 224 cout << "\t* Creating the detectors ..." << endl;
225 //=================== Alice BODY parameters =============================
69b7ed25 226 //=================== Alice BODY parameters =============================
227 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
228
229
230 if (iMAG)
b9d0a01d 231 {
69b7ed25 232 //=================== MAG parameters ============================
233 // --- Start with Magnet since detector layouts may be depending ---
234 // --- on the selected Magnet dimensions ---
235 AliMAG *MAG = new AliMAG("MAG", "Magnet");
b9d0a01d 236 }
69b7ed25 237
238
239 if (iABSO)
b9d0a01d 240 {
69b7ed25 241 //=================== ABSO parameters ============================
242 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
b9d0a01d 243 }
69b7ed25 244
245 if (iDIPO)
b9d0a01d 246 {
69b7ed25 247 //=================== DIPO parameters ============================
248
249 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
b9d0a01d 250 }
69b7ed25 251
252 if (iHALL)
b9d0a01d 253 {
69b7ed25 254 //=================== HALL parameters ============================
255
256 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
b9d0a01d 257 }
69b7ed25 258
259
260 if (iFRAME)
b9d0a01d 261 {
69b7ed25 262 //=================== FRAME parameters ============================
263
264 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
265 if (sgeo == kHoles) {
266 FRAME->SetHoles(1);
267 } else {
268 FRAME->SetHoles(0);
269 }
b9d0a01d 270 }
69b7ed25 271
272 if (iSHIL)
b9d0a01d 273 {
69b7ed25 274 //=================== SHIL parameters ============================
275
276 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
b9d0a01d 277 }
69b7ed25 278
279
280 if (iPIPE)
b9d0a01d 281 {
69b7ed25 282 //=================== PIPE parameters ============================
283
284 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
b9d0a01d 285 }
69b7ed25 286
287 if(iITS) {
288
e98b7803 289 //=================== ITS parameters ============================
b9d0a01d 290 //
291 // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
292 // almost all other detectors. This involves the fact that the ITS geometry
293 // still has several options to be followed in parallel in order to determine
294 // the best set-up which minimizes the induced background. All the geometries
295 // available to date are described in the following. Read carefully the comments
296 // and use the default version (the only one uncommented) unless you are making
297 // comparisons and you know what you are doing. In this case just uncomment the
298 // ITS geometry you want to use and run Aliroot.
299 //
69b7ed25 300 // Detailed geometries:
b9d0a01d 301 //
302 //
303 //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
304 //
305 //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
306 //
69b7ed25 307 AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
308 ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
309 ITS->SetReadDet(kTRUE); // don't touch this parameter if you're not an ITS developer
b9d0a01d 310 // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
69b7ed25 311 ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
312 ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
313 ITS->SetThicknessChip1(200.); // chip thickness on layer 1 must be in the range [150,300]
314 ITS->SetThicknessChip2(200.); // chip thickness on layer 2 must be in the range [150,300]
315 ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
316 ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
317
318 // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
b9d0a01d 319 // for reconstruction !):
69b7ed25 320 //
b9d0a01d 321 //
322 //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
69b7ed25 323 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
b9d0a01d 324 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
325 //
326 //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
69b7ed25 327 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
b9d0a01d 328 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
69b7ed25 329 //
b9d0a01d 330 //
331 //
332 // Geant3 <-> EUCLID conversion
333 // ============================
334 //
335 // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
336 // media to two ASCII files (called by default ITSgeometry.euc and
337 // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
338 // The default (=0) means that you dont want to use this facility.
339 //
69b7ed25 340 ITS->SetEUCLID(0);
b9d0a01d 341 }
69b7ed25 342
343 if (iTPC)
b9d0a01d 344 {
69b7ed25 345 //============================ TPC parameters ================================
346 // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
347 // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
348 // --- sectors are specified, any value other than that requires at least one
349 // --- sector (lower or upper)to be specified!
350 // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
351 // --- sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
352 // --- SecLows - number of lower sectors specified (up to 6)
353 // --- SecUps - number of upper sectors specified (up to 12)
354 // --- Sens - sensitive strips for the Slow Simulator !!!
355 // --- This does NOT work if all S or L-sectors are specified, i.e.
356 // --- if SecAL or SecAU < 0
357 //
358 //
359 //-----------------------------------------------------------------------------
360
361 // gROOT->LoadMacro("SetTPCParam.C");
362 // AliTPCParam *param = SetTPCParam();
363 AliTPC *TPC = new AliTPCv2("TPC", "Default");
364
365 // All sectors included
366 TPC->SetSecAL(-1);
367 TPC->SetSecAU(-1);
368
b9d0a01d 369 }
69b7ed25 370
371
372 if (iTOF) {
373 //=================== TOF parameters ============================
374 AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF");
375 }
376
377
378 if (iRICH)
b9d0a01d 379 {
69b7ed25 380 //=================== RICH parameters ===========================
b9d0a01d 381 AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
69b7ed25 382
b9d0a01d 383 }
69b7ed25 384
385
386 if (iZDC)
b9d0a01d 387 {
69b7ed25 388 //=================== ZDC parameters ============================
389
390 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
b9d0a01d 391 }
69b7ed25 392
393 if (iTRD)
b9d0a01d 394 {
69b7ed25 395 //=================== TRD parameters ============================
396
397 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
398
399 // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
400 TRD->SetGasMix(1);
401 if (sgeo == kHoles) {
402 // With hole in front of PHOS
403 TRD->SetPHOShole();
404 // With hole in front of RICH
405 TRD->SetRICHhole();
406 }
407 // Switch on TR
408 AliTRDsim *TRDsim = TRD->CreateTR();
b9d0a01d 409 }
69b7ed25 410
411 if (iFMD)
b9d0a01d 412 {
69b7ed25 413 //=================== FMD parameters ============================
414 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
415 }
416
417 if (iMUON)
b9d0a01d 418 {
69b7ed25 419 //=================== MUON parameters ===========================
420
421 AliMUON *MUON = new AliMUONv1("MUON", "default");
422 MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilder(MUON));
423 MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilder(MUON));
424 MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
425 MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
e98b7803 426 }
69b7ed25 427 //=================== PHOS parameters ===========================
428
429 if (iPHOS)
b9d0a01d 430 {
69b7ed25 431 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
b9d0a01d 432 }
69b7ed25 433
434
435 if (iPMD)
b9d0a01d 436 {
69b7ed25 437 //=================== PMD parameters ============================
438 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
b9d0a01d 439 }
69b7ed25 440
441 if (iSTART)
b9d0a01d 442 {
69b7ed25 443 //=================== START parameters ============================
444 AliSTART *START = new AliSTARTv1("START", "START Detector");
b9d0a01d 445 }
69b7ed25 446
447 if (iEMCAL)
b9d0a01d 448 {
69b7ed25 449 //=================== EMCAL parameters ============================
450 AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCAL_55_25");
b9d0a01d 451 }
69b7ed25 452
453 if (iCRT)
b9d0a01d 454 {
69b7ed25 455 //=================== CRT parameters ============================
456 AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
b9d0a01d 457 }
69b7ed25 458
459 if (iVZERO)
cdb67f97 460 {
69b7ed25 461 //=================== CRT parameters ============================
462 AliVZERO *VZERO = new AliVZEROv3("VZERO", "normal VZERO");
cdb67f97 463 }
69b7ed25 464
465
b9d0a01d 466}
69b7ed25 467
b9d0a01d 468Float_t EtaToTheta(Float_t arg){
469 return (180./TMath::Pi())*2.*atan(exp(-arg));
470}
69b7ed25 471