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