Changes for #89427: Porting modification for material budget issues to the Release...
[u/mrichter/AliRoot.git] / TFluka / macro / FlukaConfig.C
CommitLineData
9a932fe9 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,"Config.C++")
6
7#if !defined(__CINT__) || defined(__MAKECINT__)
8#include <Riostream.h>
9#include <TPDGCode.h>
10#include <TRandom.h>
11#include <TSystem.h>
12#include <TVirtualMC.h>
13#include <TGeant3TGeo.h>
14#include "STEER/AliRunLoader.h"
15#include "STEER/AliRun.h"
16#include "STEER/AliConfig.h"
17#include "PYTHIA6/AliDecayerPythia.h"
18#include "EVGEN/AliGenCocktail.h"
19#include "EVGEN/AliGenHIJINGpara.h"
20#include "STEER/AliMagF.h"
21#include "STRUCT/AliBODY.h"
22#include "STRUCT/AliMAG.h"
23#include "STRUCT/AliABSOv3.h"
24#include "STRUCT/AliDIPOv3.h"
25#include "STRUCT/AliHALLv3.h"
26#include "STRUCT/AliFRAMEv2.h"
27#include "STRUCT/AliSHILv3.h"
28#include "STRUCT/AliPIPEv3.h"
3a5fcc75 29#include "ITS/AliITSv11.h"
9a932fe9 30#include "TPC/AliTPCv2.h"
31#include "TOF/AliTOFv6T0.h"
32#include "HMPID/AliHMPIDv3.h"
33#include "ZDC/AliZDCv3.h"
34#include "TRD/AliTRDv1.h"
35#include "FMD/AliFMDv1.h"
36#include "MUON/AliMUONv1.h"
37#include "PHOS/AliPHOSv1.h"
38#include "PMD/AliPMDv1.h"
39#include "T0/AliT0v1.h"
40#include "EMCAL/AliEMCALv2.h"
41#include "ACORDE/AliACORDEv1.h"
42#include "VZERO/AliVZEROv7.h"
43#endif
44
69b7ed25 45Float_t EtaToTheta(Float_t arg);
9a932fe9 46void LoadPythia();
47
4e186fa5 48
b9d0a01d 49void Config()
50{
9a932fe9 51 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
52 // Theta range given through pseudorapidity limits 22/6/2001
53
54 // Set Random Number seed
55 //gRandom->SetSeed(123456); // Set 0 to use the current time
b9d0a01d 56
9a932fe9 57 AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
241a2f65 58
9a932fe9 59 // Load Pythia libraries
60 LoadPythia();
61 // Libraries required by geant321
645377df 62 Bool_t isFluka = kTRUE;
9a932fe9 63 if (isFluka) {
64 gSystem->Load("libGeom");
65 cout << "\t* Loading TFluka..." << endl;
66 gSystem->Load("libfluka");
67
68 cout << "\t* Instantiating TFluka..." << endl;
69 new TFluka("C++ Interface to Fluka", 0/*verbositylevel*/);
70 }
71 else {
72 cout << "\t* Loading Geant3..." << endl;
73 gSystem->Load("libgeant321");
74
75 cout << "\t* Instantiating Geant3TGeo..." << endl;
76 new TGeant3TGeo("C++ Interface to Geant3");
77 }
78 AliRunLoader* rl=0x0;
9fa0308d 79
9a932fe9 80 AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
81
82 rl = AliRunLoader::Open("galice.root",
5425167f 83 AliConfig::GetDefaultEventFolderName(),
84 "recreate");
9a932fe9 85 if (rl == 0x0)
86 {
87 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
88 return;
89 }
90 rl->SetCompressionLevel(2);
91 rl->SetNumberOfEventsPerFile(3);
92 gAlice->SetRunLoader(rl);
93
94 // gAlice->SetGeometryFromFile("geometry.root");
95
96 // Uncomment if you want to load geometry from OCDB! >>>>
97/*
98 if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
99 cout << "#####################################################" << endl;
100 cout << "# #" << endl;
101 cout << "# WARNING: CDB DEFAULT STORAGE NOT SET !!! #" << endl;
102 cout << "# SETTING IT TO local://$ALICE_ROOT/OCDB !!! #" << endl;
103 cout << "# #" << endl;
104 cout << "#####################################################" << endl;
105
106 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
69b7ed25 107 }
9a932fe9 108
109 if(AliCDBManager::Instance()->GetRun() < 0){
110 cout << "#####################################################" << endl;
111 cout << "# #" << endl;
112 cout << "# WARNING: RUN NUMBER NOT SET !!! #" << endl;
113 cout << "# SETTING IT TO 0 !!! #" << endl;
114 cout << "# #" << endl;
115 cout << "#####################################################" << endl;
116
117 AliCDBManager::Instance()->SetRun(0);
69b7ed25 118 }
9a932fe9 119 gAlice->SetGeometryFromCDB();
120*/
121 // Uncomment if you want to load geometry from OCDB! <<<<
122
123 // Set the trigger configuration
28da60d3 124 AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
9a932fe9 125 cout<<"Trigger configuration is set to Pb-Pb"<<endl;
126
127 //
128 // Set External decayer
129 TVirtualMCDecayer *decayer = new AliDecayerPythia();
130
131 decayer->SetForceDecay(kAll);
132 decayer->Init();
133 gMC->SetExternalDecayer(decayer);
134 //=======================================================================
135 // ************* STEERING parameters FOR ALICE SIMULATION **************
136 // --- Specify event type to be tracked through the ALICE setup
137 // --- All positions are in cm, angles in degrees, and P and E in GeV
138
139
140 gMC->SetProcess("DCAY",1);
141 gMC->SetProcess("PAIR",1);
142 gMC->SetProcess("COMP",1);
143 gMC->SetProcess("PHOT",1);
144 gMC->SetProcess("PFIS",0);
145 gMC->SetProcess("DRAY",0);
146 gMC->SetProcess("ANNI",1);
147 gMC->SetProcess("BREM",1);
148 gMC->SetProcess("MUNU",1);
149 gMC->SetProcess("CKOV",1);
150 gMC->SetProcess("HADR",1);
151 gMC->SetProcess("LOSS",2);
152 gMC->SetProcess("MULS",1);
153 gMC->SetProcess("RAYL",1);
154
155 Float_t cut = 1.e-3; // 1MeV cut by default
156 Float_t tofmax = 1.e10;
157
158 gMC->SetCut("CUTGAM", cut);
159 gMC->SetCut("CUTELE", cut);
160 gMC->SetCut("CUTNEU", cut);
161 gMC->SetCut("CUTHAD", cut);
162 gMC->SetCut("CUTMUO", cut);
163 gMC->SetCut("BCUTE", cut);
164 gMC->SetCut("BCUTM", cut);
165 gMC->SetCut("DCUTE", cut);
166 gMC->SetCut("DCUTM", cut);
167 gMC->SetCut("PPCUTM", cut);
168 gMC->SetCut("TOFMAX", tofmax);
169
170
171 int nParticles = 100;
172 if (gSystem->Getenv("CONFIG_NPARTICLES"))
69b7ed25 173 {
9a932fe9 174 nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
69b7ed25 175 }
ad57c27f 176
9a932fe9 177 AliGenCocktail *gener = new AliGenCocktail();
178 gener->SetPhiRange(0, 360);
179 // Set pseudorapidity range from -8 to 8.
180 Float_t thmin = EtaToTheta(8); // theta min. <---> eta max
181 Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min
182 gener->SetThetaRange(thmin,thmax);
183 gener->SetOrigin(0, 0, 0); //vertex position
184 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
185
186 AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
187 hijingparam->SetMomentumRange(0.2, 999);
188 gener->AddGenerator(hijingparam,"HIJING PARAM",1);
189
190// AliGenBox *genbox = new AliGenBox(nParticles);
191// genbox->SetPart(kGamma);
192// genbox->SetPtRange(0.3, 10.00);
193// gener->AddGenerator(genbox,"GENBOX GAMMA for PHOS",1);
194 gener->Init();
195
196
197 //
198 // Activate this line if you want the vertex smearing to happen
199 // track by track
200 //
201 //gener->SetVertexSmear(perTrack);
202 // Field (L3 0.4 T)
4642ac4b 203 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
9a932fe9 204
205 Int_t iABSO = 1;
206 Int_t iDIPO = 1;
207 Int_t iFMD = 1;
208 Int_t iFRAME = 1;
209 Int_t iHALL = 1;
210 Int_t iITS = 1;
211 Int_t iMAG = 1;
212 Int_t iMUON = 1;
213 Int_t iPHOS = 1;
214 Int_t iPIPE = 1;
215 Int_t iPMD = 1;
216 Int_t iHMPID = 1;
217 Int_t iSHIL = 1;
218 Int_t iT0 = 1;
219 Int_t iTOF = 1;
220 Int_t iTPC = 1;
221 Int_t iTRD = 1;
222 Int_t iZDC = 1;
223 Int_t iEMCAL = 1;
224 Int_t iACORDE = 1;
225 Int_t iVZERO = 1;
226 rl->CdGAFile();
69b7ed25 227 //=================== Alice BODY parameters =============================
228 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
b3261b4c 229
69b7ed25 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 }
b3261b4c 237
238
69b7ed25 239 if (iABSO)
b9d0a01d 240 {
69b7ed25 241 //=================== ABSO parameters ============================
e3c0a95f 242 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
b9d0a01d 243 }
b3261b4c 244
69b7ed25 245 if (iDIPO)
b9d0a01d 246 {
69b7ed25 247 //=================== DIPO parameters ============================
b3261b4c 248
9a932fe9 249 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
b9d0a01d 250 }
b3261b4c 251
69b7ed25 252 if (iHALL)
b9d0a01d 253 {
69b7ed25 254 //=================== HALL parameters ============================
b3261b4c 255
e3c0a95f 256 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
b9d0a01d 257 }
b3261b4c 258
259
69b7ed25 260 if (iFRAME)
b9d0a01d 261 {
69b7ed25 262 //=================== FRAME parameters ============================
b3261b4c 263
69b7ed25 264 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
9a932fe9 265 FRAME->SetHoles(1);
b9d0a01d 266 }
b3261b4c 267
69b7ed25 268 if (iSHIL)
b9d0a01d 269 {
69b7ed25 270 //=================== SHIL parameters ============================
b3261b4c 271
9a932fe9 272 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
b9d0a01d 273 }
b3261b4c 274
275
69b7ed25 276 if (iPIPE)
b9d0a01d 277 {
69b7ed25 278 //=================== PIPE parameters ============================
b3261b4c 279
e3c0a95f 280 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
b9d0a01d 281 }
b3261b4c 282
e3c0a95f 283 if (iITS)
284 {
285 //=================== ITS parameters ============================
286
3a5fcc75 287 AliITS *ITS = new AliITSv11("ITS","ITS v11");
b9d0a01d 288 }
b3261b4c 289
69b7ed25 290 if (iTPC)
b9d0a01d 291 {
9a932fe9 292 //============================ TPC parameters ===================
69b7ed25 293 AliTPC *TPC = new AliTPCv2("TPC", "Default");
02a14c26 294 TPC->SetPrimaryIonisation();
b9d0a01d 295 }
b3261b4c 296
297
69b7ed25 298 if (iTOF) {
299 //=================== TOF parameters ============================
e3c0a95f 300 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
69b7ed25 301 }
b3261b4c 302
303
f4b3bbb7 304 if (iHMPID)
b9d0a01d 305 {
f4b3bbb7 306 //=================== HMPID parameters ===========================
e3c0a95f 307 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
b3261b4c 308
b9d0a01d 309 }
b3261b4c 310
311
69b7ed25 312 if (iZDC)
b9d0a01d 313 {
69b7ed25 314 //=================== ZDC parameters ============================
b3261b4c 315
9a932fe9 316 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
b9d0a01d 317 }
b3261b4c 318
69b7ed25 319 if (iTRD)
b9d0a01d 320 {
69b7ed25 321 //=================== TRD parameters ============================
b3261b4c 322
69b7ed25 323 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
b9d0a01d 324 }
b3261b4c 325
69b7ed25 326 if (iFMD)
b9d0a01d 327 {
69b7ed25 328 //=================== FMD parameters ============================
b3261b4c 329 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
69b7ed25 330 }
b3261b4c 331
69b7ed25 332 if (iMUON)
b9d0a01d 333 {
69b7ed25 334 //=================== MUON parameters ===========================
b3261b4c 335 // New MUONv1 version (geometry defined via builders)
69b7ed25 336 AliMUON *MUON = new AliMUONv1("MUON", "default");
e98b7803 337 }
69b7ed25 338 //=================== PHOS parameters ===========================
b3261b4c 339
69b7ed25 340 if (iPHOS)
b9d0a01d 341 {
69b7ed25 342 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
b9d0a01d 343 }
b3261b4c 344
345
69b7ed25 346 if (iPMD)
b9d0a01d 347 {
69b7ed25 348 //=================== PMD parameters ============================
349 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
b9d0a01d 350 }
b3261b4c 351
ababa197 352 if (iT0)
b9d0a01d 353 {
ababa197 354 //=================== T0 parameters ============================
355 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
b9d0a01d 356 }
b3261b4c 357
69b7ed25 358 if (iEMCAL)
b9d0a01d 359 {
9a932fe9 360 //=================== EMCAL parameters ============================
361 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
b9d0a01d 362 }
b3261b4c 363
b384f8a4 364 if (iACORDE)
b9d0a01d 365 {
b384f8a4 366 //=================== ACORDE parameters ============================
f7882672 367 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
b9d0a01d 368 }
b3261b4c 369
69b7ed25 370 if (iVZERO)
cdb67f97 371 {
9a932fe9 372 //=================== VZERO parameters ============================
b3261b4c 373 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
9a932fe9 374 }
375
376 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
377
b9d0a01d 378}
9a932fe9 379
b9d0a01d 380Float_t EtaToTheta(Float_t arg){
381 return (180./TMath::Pi())*2.*atan(exp(-arg));
382}
69b7ed25 383
9a932fe9 384
385void LoadPythia()
386{
387 // Load Pythia related libraries
388 gSystem->Load("liblhapdf.so"); // Parton density functions
389 gSystem->Load("libEGPythia6.so"); // TGenerator interface
390 gSystem->Load("libpythia6.so"); // Pythia
391 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
392}