ACORDEv1 is now the default
[u/mrichter/AliRoot.git] / TFluka / macro / FlukaConfig.C
CommitLineData
b9d0a01d 1static Int_t eventsPerRun = 100;
69b7ed25 2enum PprGeo_t
3{
4 kHoles, kNoHoles
5};
6
7enum PprRad_t
8{
9 kGluonRadiation, kNoGluonRadiation
10};
11
12enum PprMag_t
13{
14 k2kG, k4kG, k5kG
15};
16
17
18// This part for configuration
69b7ed25 19static PprGeo_t sgeo = kHoles;
20static PprRad_t srad = kGluonRadiation;
21static PprMag_t smag = k5kG;
22
23// Comment line
24static TString comment;
25
26// Functions
27Float_t EtaToTheta(Float_t arg);
4e186fa5 28
69b7ed25 29
b9d0a01d 30void Config()
31{
32 cout << "==> Config.C..." << endl;
33
34 // Set Random Number seed
69b7ed25 35 gRandom->SetSeed(12345);
36 cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
37
0a7556af 38 gSystem->Load("liblhapdf.so"); // Parton density functions
39 gSystem->Load("libEGPythia6.so"); // TGenerator interface
40 gSystem->Load("libpythia6.so"); // Pythia
41 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
b9d0a01d 42
43
241a2f65 44
645377df 45 Bool_t isFluka = kTRUE;
46 if (isFluka) {
47 gSystem->Load("libGeom");
48 cout << "\t* Loading TFluka..." << endl;
0a7556af 49 gSystem->Load("libfluka");
645377df 50
51 cout << "\t* Instantiating TFluka..." << endl;
52 new TFluka("C++ Interface to Fluka", 0/*verbositylevel*/);
53 }
54 else {
55 cout << "\t* Loading Geant3..." << endl;
56 gSystem->Load("libgeant321");
241a2f65 57
645377df 58 cout << "\t* Instantiating Geant3TGeo..." << endl;
59 new TGeant3TGeo("C++ Interface to Geant3");
60 }
b9d0a01d 61
9fa0308d 62 if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
63 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
64 AliCDBManager::Instance()->SetRun(0);
65 }
66
67
69b7ed25 68 AliRunLoader* rl=0x0;
69
70 cout<<"Config.C: Creating Run Loader ..."<<endl;
71 rl = AliRunLoader::Open("galice.root",
5425167f 72 AliConfig::GetDefaultEventFolderName(),
73 "recreate");
69b7ed25 74 if (rl == 0x0)
75 {
76 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
77 return;
78 }
79 rl->SetCompressionLevel(2);
80 rl->SetNumberOfEventsPerFile(3);
81 gAlice->SetRunLoader(rl);
82
b9d0a01d 83 //
84 // Set External decayer
69b7ed25 85 AliDecayer *decayer = new AliDecayerPythia();
86
b9d0a01d 87 decayer->SetForceDecay(kAll);
88 decayer->Init();
89 gMC->SetExternalDecayer(decayer);
4e186fa5 90
91 //
b9d0a01d 92 //
93 //
94 // Physics process control
b9d0a01d 95
69b7ed25 96 gMC->SetProcess("DCAY",1);
97 gMC->SetProcess("PAIR",1);
98 gMC->SetProcess("COMP",1);
99 gMC->SetProcess("PHOT",1);
100 gMC->SetProcess("PFIS",0);
cc6d9b7f 101 gMC->SetProcess("DRAY",1);
69b7ed25 102 gMC->SetProcess("ANNI",1);
103 gMC->SetProcess("BREM",1);
104 gMC->SetProcess("MUNU",1);
4e186fa5 105 gMC->SetProcess("CKOV",1);
69b7ed25 106 gMC->SetProcess("HADR",1);
107 gMC->SetProcess("LOSS",2);
108 gMC->SetProcess("MULS",1);
109 gMC->SetProcess("RAYL",1);
110
111 Float_t cut = 1.e-3; // 1MeV cut by default
112 Float_t tofmax = 1.e10;
113
114 gMC->SetCut("CUTGAM", cut);
115 gMC->SetCut("CUTELE", cut);
116 gMC->SetCut("CUTNEU", cut);
117 gMC->SetCut("CUTHAD", cut);
118 gMC->SetCut("CUTMUO", cut);
119 gMC->SetCut("BCUTE", cut);
120 gMC->SetCut("BCUTM", cut);
121 gMC->SetCut("DCUTE", cut);
122 gMC->SetCut("DCUTM", cut);
123 gMC->SetCut("PPCUTM", cut);
124 gMC->SetCut("TOFMAX", tofmax);
b9d0a01d 125
e98b7803 126 //
127 //=======================================================================
128 // ************* STEERING parameters FOR ALICE SIMULATION **************
129 // --- Specify event type to be tracked through the ALICE setup
130 // --- All positions are in cm, angles in degrees, and P and E in GeV
131 if (gSystem->Getenv("CONFIG_NPARTICLES"))
241a2f65 132 int nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
e98b7803 133 else
cc6d9b7f 134 int nParticles = 1000;
241a2f65 135
e98b7803 136 cout << "\t* Creating and configuring generator for " << nParticles
137 << " particles..." << endl;
138
139 AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
140
4e186fa5 141 gener->SetMomentumRange(0., 999);
e98b7803 142 gener->SetPhiRange(0, 360);
4e186fa5 143 // Set pseudorapidity range from -3 to 3.
cc6d9b7f 144 Float_t thmin = EtaToTheta( 3.); // theta min. <---> eta max
4e186fa5 145 Float_t thmax = EtaToTheta(-3.); // theta max. <---> eta min
e98b7803 146 gener->SetThetaRange(thmin,thmax);
147 gener->SetOrigin(0, 0, 0); //vertex position
148 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
149 gener->Init();
150 //
151 // Activate this line if you want the vertex smearing to happen
152 // track by track
153 //
b9d0a01d 154
69b7ed25 155
69b7ed25 156 if (smag == k2kG) {
157 comment = comment.Append(" | L3 field 0.2 T");
158 } else if (smag == k4kG) {
159 comment = comment.Append(" | L3 field 0.4 T");
160 } else if (smag == k5kG) {
161 comment = comment.Append(" | L3 field 0.5 T");
162 }
163
164
165 if (srad == kGluonRadiation)
166 {
167 comment = comment.Append(" | Gluon Radiation On");
168
169 } else {
170 comment = comment.Append(" | Gluon Radiation Off");
171 }
172
173 if (sgeo == kHoles)
174 {
f4b3bbb7 175 comment = comment.Append(" | Holes for PHOS/HMPID");
69b7ed25 176
177 } else {
f4b3bbb7 178 comment = comment.Append(" | No holes for PHOS/HMPID");
69b7ed25 179 }
180
181 printf("\n \n Comment: %s \n \n", comment.Data());
182
183
184// Field (L3 0.4 T)
185 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., smag);
186 field->SetL3ConstField(0); //Using const. field in the barrel
187 rl->CdGAFile();
188 gAlice->SetField(field);
189
e3c0a95f 190 Int_t iABSO = 0;
0a7556af 191 Int_t iACORDE = 0;
e3c0a95f 192 Int_t iDIPO = 0;
193 Int_t iFMD = 0;
194 Int_t iFRAME = 0;
195 Int_t iHALL = 0;
196 Int_t iITS = 0;
197 Int_t iMAG = 0;
198 Int_t iMUON = 0;
199 Int_t iPHOS = 0;
200 Int_t iPIPE = 0;
201 Int_t iPMD = 0;
202 Int_t iHMPID = 0;
203 Int_t iSHIL = 0;
204 Int_t iT0 = 0;
205 Int_t iTOF = 0;
206 Int_t iTPC = 0;
207 Int_t iTRD = 0;
208 Int_t iZDC = 0;
0a7556af 209 Int_t iEMCAL = 0;
e3c0a95f 210 Int_t iVZERO = 0;
cdb67f97 211
e98b7803 212 cout << "\t* Creating the detectors ..." << endl;
213 //=================== Alice BODY parameters =============================
69b7ed25 214 //=================== Alice BODY parameters =============================
215 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
216
b3261b4c 217
69b7ed25 218 if (iMAG)
b9d0a01d 219 {
69b7ed25 220 //=================== MAG parameters ============================
221 // --- Start with Magnet since detector layouts may be depending ---
222 // --- on the selected Magnet dimensions ---
223 AliMAG *MAG = new AliMAG("MAG", "Magnet");
b9d0a01d 224 }
b3261b4c 225
226
69b7ed25 227 if (iABSO)
b9d0a01d 228 {
69b7ed25 229 //=================== ABSO parameters ============================
e3c0a95f 230 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
b9d0a01d 231 }
b3261b4c 232
69b7ed25 233 if (iDIPO)
b9d0a01d 234 {
69b7ed25 235 //=================== DIPO parameters ============================
b3261b4c 236
e3c0a95f 237 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 2");
b9d0a01d 238 }
b3261b4c 239
69b7ed25 240 if (iHALL)
b9d0a01d 241 {
69b7ed25 242 //=================== HALL parameters ============================
b3261b4c 243
e3c0a95f 244 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
b9d0a01d 245 }
b3261b4c 246
247
69b7ed25 248 if (iFRAME)
b9d0a01d 249 {
69b7ed25 250 //=================== FRAME parameters ============================
b3261b4c 251
69b7ed25 252 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
b9d0a01d 253 }
b3261b4c 254
69b7ed25 255 if (iSHIL)
b9d0a01d 256 {
69b7ed25 257 //=================== SHIL parameters ============================
b3261b4c 258
69b7ed25 259 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
b9d0a01d 260 }
b3261b4c 261
262
69b7ed25 263 if (iPIPE)
b9d0a01d 264 {
69b7ed25 265 //=================== PIPE parameters ============================
b3261b4c 266
e3c0a95f 267 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
b9d0a01d 268 }
b3261b4c 269
e3c0a95f 270 if (iITS)
271 {
272 //=================== ITS parameters ============================
273
274 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
b9d0a01d 275 }
b3261b4c 276
e3c0a95f 277
69b7ed25 278 if (iTPC)
b9d0a01d 279 {
b3261b4c 280 //============================ TPC parameters =====================
69b7ed25 281 AliTPC *TPC = new AliTPCv2("TPC", "Default");
b9d0a01d 282 }
b3261b4c 283
284
69b7ed25 285 if (iTOF) {
286 //=================== TOF parameters ============================
e3c0a95f 287 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
69b7ed25 288 }
b3261b4c 289
290
f4b3bbb7 291 if (iHMPID)
b9d0a01d 292 {
f4b3bbb7 293 //=================== HMPID parameters ===========================
e3c0a95f 294 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
b3261b4c 295
b9d0a01d 296 }
b3261b4c 297
298
69b7ed25 299 if (iZDC)
b9d0a01d 300 {
69b7ed25 301 //=================== ZDC parameters ============================
b3261b4c 302
69b7ed25 303 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
b9d0a01d 304 }
b3261b4c 305
69b7ed25 306 if (iTRD)
b9d0a01d 307 {
69b7ed25 308 //=================== TRD parameters ============================
b3261b4c 309
69b7ed25 310 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
b3261b4c 311 AliTRDgeometry *geoTRD = TRD->GetGeometry();
312 // Partial geometry: modules at 2,3,4,6,11,12,14,15
313 // starting at 6h in positive direction
314 geoTRD->SetSMstatus(0,0);
315 geoTRD->SetSMstatus(1,0);
316 geoTRD->SetSMstatus(5,0);
317 geoTRD->SetSMstatus(7,0);
318 geoTRD->SetSMstatus(8,0);
319 geoTRD->SetSMstatus(9,0);
320 geoTRD->SetSMstatus(10,0);
321 geoTRD->SetSMstatus(13,0);
322 geoTRD->SetSMstatus(16,0);
323 geoTRD->SetSMstatus(17,0);
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");
e3c0a95f 343 //Set simulation parameters different from the default ones.
344 AliPHOSSimParam* simEmc = AliPHOSSimParam::GetInstance() ;
345
346 // APD noise of warm (+20C) PHOS:
347 // a2 = a1*(Y1/Y2)*(M1/M2), where a1 = 0.012 is APD noise at -25C,
348 // Y1 = 4.3 photo-electrons/MeV, Y2 = 1.7 p.e/MeV - light yields at -25C and +20C,
349 // M1 = 50, M2 = 50 - APD gain factors chosen for t1 = -25C and t2 = +20C,
350 // Y = MeanLightYield*APDEfficiency.
351
352 Float_t apdNoise = 0.012*2.5;
353 simEmc->SetAPDNoise(apdNoise);
354
355 //Raw Light Yield at +20C
356 simEmc->SetMeanLightYield(18800);
357
358 //ADC channel width at +18C.
359 simEmc->SetADCchannelW(0.0125);
b9d0a01d 360 }
b3261b4c 361
362
69b7ed25 363 if (iPMD)
b9d0a01d 364 {
69b7ed25 365 //=================== PMD parameters ============================
366 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
b9d0a01d 367 }
b3261b4c 368
ababa197 369 if (iT0)
b9d0a01d 370 {
ababa197 371 //=================== T0 parameters ============================
372 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
b9d0a01d 373 }
b3261b4c 374
69b7ed25 375 if (iEMCAL)
b9d0a01d 376 {
b3261b4c 377 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
b9d0a01d 378 }
b3261b4c 379
b384f8a4 380 if (iACORDE)
b9d0a01d 381 {
b384f8a4 382 //=================== ACORDE parameters ============================
f7882672 383 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
b9d0a01d 384 }
b3261b4c 385
69b7ed25 386 if (iVZERO)
cdb67f97 387 {
b384f8a4 388 //=================== ACORDE parameters ============================
b3261b4c 389 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
390 }
b9d0a01d 391}
69b7ed25 392
b9d0a01d 393Float_t EtaToTheta(Float_t arg){
394 return (180./TMath::Pi())*2.*atan(exp(-arg));
395}
69b7ed25 396