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