Final TOF version: 18 modules with holes for PHOS (Annalisa)
[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"
99887042 29#include "ITS/AliITSv11Hybrid.h"
de78d77f 30#include "TPC/AliTPCv2.h"
0d7ef405 31#include "TOF/AliTOFv6T0.h"
99887042 32#include "HMPID/AliHMPIDv3.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
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;
92 cout << "# SETTING IT TO local://$ALICE_ROOT !!! #" << endl;
93 cout << "# #" << endl;
94 cout << "#####################################################" << endl;
95
96 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
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
933328a7 114 gAlice->SetTriggerDescriptor("Pb-Pb");
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)
193 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
35be7bcf 194 gAlice->SetField(field);
195
196
de78d77f 197 Int_t iABSO = 1;
35be7bcf 198 Int_t iDIPO = 1;
de78d77f 199 Int_t iFMD = 1;
35be7bcf 200 Int_t iFRAME = 1;
201 Int_t iHALL = 1;
202 Int_t iITS = 1;
203 Int_t iMAG = 1;
de78d77f 204 Int_t iMUON = 1;
35be7bcf 205 Int_t iPHOS = 1;
206 Int_t iPIPE = 1;
de78d77f 207 Int_t iPMD = 1;
de1857bb 208 Int_t iHMPID = 1;
35be7bcf 209 Int_t iSHIL = 1;
ababa197 210 Int_t iT0 = 1;
de78d77f 211 Int_t iTOF = 1;
35be7bcf 212 Int_t iTPC = 1;
de78d77f 213 Int_t iTRD = 1;
214 Int_t iZDC = 1;
215 Int_t iEMCAL = 1;
b384f8a4 216 Int_t iACORDE = 0;
de78d77f 217 Int_t iVZERO = 1;
88cb7938 218 rl->CdGAFile();
682a4a95 219 //=================== Alice BODY parameters =============================
220 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
2ab0c725 221
682a4a95 222 if (iMAG)
223 {
224 //=================== MAG parameters ============================
225 // --- Start with Magnet since detector layouts may be depending ---
226 // --- on the selected Magnet dimensions ---
227 AliMAG *MAG = new AliMAG("MAG", "Magnet");
228 }
8de40c27 229
fe4da5cc 230
682a4a95 231 if (iABSO)
232 {
233 //=================== ABSO parameters ============================
96fb3353 234 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
682a4a95 235 }
fe4da5cc 236
682a4a95 237 if (iDIPO)
238 {
239 //=================== DIPO parameters ============================
fe4da5cc 240
96fb3353 241 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
682a4a95 242 }
fe4da5cc 243
682a4a95 244 if (iHALL)
245 {
246 //=================== HALL parameters ============================
2ab0c725 247
96fb3353 248 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
682a4a95 249 }
2ab0c725 250
2ab0c725 251
682a4a95 252 if (iFRAME)
253 {
254 //=================== FRAME parameters ============================
2ab0c725 255
35be7bcf 256 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
bab433b3 257 FRAME->SetHoles(1);
682a4a95 258 }
fe4da5cc 259
682a4a95 260 if (iSHIL)
261 {
262 //=================== SHIL parameters ============================
8dfe31df 263
96fb3353 264 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
682a4a95 265 }
fe4da5cc 266
ecd5c1f7 267
682a4a95 268 if (iPIPE)
269 {
270 //=================== PIPE parameters ============================
b422f318 271
96fb3353 272 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
682a4a95 273 }
d6478a5d 274
e89fa83b 275 if (iITS)
276 {
277 //=================== ITS parameters ============================
2ab0c725 278
99887042 279 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
35be7bcf 280 }
682a4a95 281
282 if (iTPC)
283 {
26ca4b4a 284 //============================ TPC parameters ===================
682a4a95 285 AliTPC *TPC = new AliTPCv2("TPC", "Default");
682a4a95 286 }
287
35be7bcf 288
289 if (iTOF) {
682a4a95 290 //=================== TOF parameters ============================
0d7ef405 291 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
682a4a95 292 }
293
35be7bcf 294
de1857bb 295 if (iHMPID)
682a4a95 296 {
de1857bb 297 //=================== HMPID parameters ===========================
99887042 298 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
682a4a95 299
300 }
301
302
303 if (iZDC)
304 {
305 //=================== ZDC parameters ============================
306
9d07603a 307 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
682a4a95 308 }
309
682a4a95 310 if (iTRD)
311 {
312 //=================== TRD parameters ============================
313
314 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
682a4a95 315 }
316
317 if (iFMD)
318 {
319 //=================== FMD parameters ============================
35be7bcf 320 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
f6d3338b 321 }
682a4a95 322
323 if (iMUON)
324 {
325 //=================== MUON parameters ===========================
d85afa9b 326 // New MUONv1 version (geometry defined via builders)
682a4a95 327 AliMUON *MUON = new AliMUONv1("MUON", "default");
328 }
329 //=================== PHOS parameters ===========================
330
331 if (iPHOS)
332 {
35be7bcf 333 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
682a4a95 334 }
335
336
337 if (iPMD)
338 {
339 //=================== PMD parameters ============================
682a4a95 340 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
35be7bcf 341 }
682a4a95 342
ababa197 343 if (iT0)
35be7bcf 344 {
ababa197 345 //=================== T0 parameters ============================
346 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
682a4a95 347 }
348
35be7bcf 349 if (iEMCAL)
9757d28c 350 {
351 //=================== EMCAL parameters ============================
0588179e 352 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
9757d28c 353 }
354
b384f8a4 355 if (iACORDE)
682a4a95 356 {
b384f8a4 357 //=================== ACORDE parameters ============================
358 AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
682a4a95 359 }
360
35be7bcf 361 if (iVZERO)
362 {
b384f8a4 363 //=================== ACORDE parameters ============================
4a2f6442 364 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
35be7bcf 365 }
682a4a95 366
8e86a720 367 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
de78d77f 368
682a4a95 369}
81bf125a 370
371Float_t EtaToTheta(Float_t arg){
372 return (180./TMath::Pi())*2.*atan(exp(-arg));
373}
ee621efa 374
375
376void LoadPythia()
377{
378 // Load Pythia related libraries
379 gSystem->Load("liblhapdf.so"); // Parton density functions
380 gSystem->Load("libEGPythia6.so"); // TGenerator interface
381 gSystem->Load("libpythia6.so"); // Pythia
382 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
383}