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