This commit was generated by cvs2svn to compensate for changes in r15989,
[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
b9d0a01d 38
39
40 // libraries required by fluka21
241a2f65 41
645377df 42 Bool_t isFluka = kTRUE;
43 if (isFluka) {
44 gSystem->Load("libGeom");
45 cout << "\t* Loading TFluka..." << endl;
46 gSystem->Load("libTFluka");
47
48 cout << "\t* Instantiating TFluka..." << endl;
49 new TFluka("C++ Interface to Fluka", 0/*verbositylevel*/);
50 }
51 else {
52 cout << "\t* Loading Geant3..." << endl;
53 gSystem->Load("libgeant321");
241a2f65 54
645377df 55 cout << "\t* Instantiating Geant3TGeo..." << endl;
56 new TGeant3TGeo("C++ Interface to Geant3");
57 }
b9d0a01d 58
69b7ed25 59 AliRunLoader* rl=0x0;
60
61 cout<<"Config.C: Creating Run Loader ..."<<endl;
62 rl = AliRunLoader::Open("galice.root",
5425167f 63 AliConfig::GetDefaultEventFolderName(),
64 "recreate");
69b7ed25 65 if (rl == 0x0)
66 {
67 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
68 return;
69 }
70 rl->SetCompressionLevel(2);
71 rl->SetNumberOfEventsPerFile(3);
72 gAlice->SetRunLoader(rl);
73
b9d0a01d 74 //
75 // Set External decayer
69b7ed25 76 AliDecayer *decayer = new AliDecayerPythia();
77
b9d0a01d 78 decayer->SetForceDecay(kAll);
79 decayer->Init();
80 gMC->SetExternalDecayer(decayer);
4e186fa5 81
82 //
b9d0a01d 83 //
84 //
85 // Physics process control
b9d0a01d 86
69b7ed25 87 gMC->SetProcess("DCAY",1);
88 gMC->SetProcess("PAIR",1);
89 gMC->SetProcess("COMP",1);
90 gMC->SetProcess("PHOT",1);
91 gMC->SetProcess("PFIS",0);
cc6d9b7f 92 gMC->SetProcess("DRAY",1);
69b7ed25 93 gMC->SetProcess("ANNI",1);
94 gMC->SetProcess("BREM",1);
95 gMC->SetProcess("MUNU",1);
4e186fa5 96 gMC->SetProcess("CKOV",1);
69b7ed25 97 gMC->SetProcess("HADR",1);
98 gMC->SetProcess("LOSS",2);
99 gMC->SetProcess("MULS",1);
100 gMC->SetProcess("RAYL",1);
101
102 Float_t cut = 1.e-3; // 1MeV cut by default
103 Float_t tofmax = 1.e10;
104
105 gMC->SetCut("CUTGAM", cut);
106 gMC->SetCut("CUTELE", cut);
107 gMC->SetCut("CUTNEU", cut);
108 gMC->SetCut("CUTHAD", cut);
109 gMC->SetCut("CUTMUO", cut);
110 gMC->SetCut("BCUTE", cut);
111 gMC->SetCut("BCUTM", cut);
112 gMC->SetCut("DCUTE", cut);
113 gMC->SetCut("DCUTM", cut);
114 gMC->SetCut("PPCUTM", cut);
115 gMC->SetCut("TOFMAX", tofmax);
b9d0a01d 116
e98b7803 117 //
118 //=======================================================================
119 // ************* STEERING parameters FOR ALICE SIMULATION **************
120 // --- Specify event type to be tracked through the ALICE setup
121 // --- All positions are in cm, angles in degrees, and P and E in GeV
122 if (gSystem->Getenv("CONFIG_NPARTICLES"))
241a2f65 123 int nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
e98b7803 124 else
cc6d9b7f 125 int nParticles = 1000;
241a2f65 126
e98b7803 127 cout << "\t* Creating and configuring generator for " << nParticles
128 << " particles..." << endl;
129
130 AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
131
4e186fa5 132 gener->SetMomentumRange(0., 999);
e98b7803 133 gener->SetPhiRange(0, 360);
4e186fa5 134 // Set pseudorapidity range from -3 to 3.
cc6d9b7f 135 Float_t thmin = EtaToTheta( 3.); // theta min. <---> eta max
4e186fa5 136 Float_t thmax = EtaToTheta(-3.); // theta max. <---> eta min
e98b7803 137 gener->SetThetaRange(thmin,thmax);
138 gener->SetOrigin(0, 0, 0); //vertex position
139 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
140 gener->Init();
141 //
142 // Activate this line if you want the vertex smearing to happen
143 // track by track
144 //
b9d0a01d 145
69b7ed25 146
69b7ed25 147 if (smag == k2kG) {
148 comment = comment.Append(" | L3 field 0.2 T");
149 } else if (smag == k4kG) {
150 comment = comment.Append(" | L3 field 0.4 T");
151 } else if (smag == k5kG) {
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)
176 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., smag);
177 field->SetL3ConstField(0); //Using const. field in the barrel
178 rl->CdGAFile();
179 gAlice->SetField(field);
180
645377df 181 Int_t iABSO = 1;
182 Int_t iCRT = 1;
183 Int_t iDIPO = 1;
184 Int_t iFMD = 1;
185 Int_t iFRAME = 1;
186 Int_t iHALL = 1;
187 Int_t iITS = 1;
188 Int_t iMAG = 1;
189 Int_t iMUON = 1;
190 Int_t iPHOS = 1;
191 Int_t iPIPE = 1;
192 Int_t iPMD = 1;
f4b3bbb7 193 Int_t iHMPID = 1;
645377df 194 Int_t iSHIL = 1;
ababa197 195 Int_t iT0 = 1;
645377df 196 Int_t iTOF = 1;
cdb67f97 197 Int_t iTPC = 1;
645377df 198 Int_t iTRD = 1;
199 Int_t iZDC = 1;
4e186fa5 200 Int_t iEMCAL = 0;
645377df 201 Int_t iVZERO = 1;
cdb67f97 202
e98b7803 203 cout << "\t* Creating the detectors ..." << endl;
204 //=================== Alice BODY parameters =============================
69b7ed25 205 //=================== Alice BODY parameters =============================
206 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
207
b3261b4c 208
69b7ed25 209 if (iMAG)
b9d0a01d 210 {
69b7ed25 211 //=================== MAG parameters ============================
212 // --- Start with Magnet since detector layouts may be depending ---
213 // --- on the selected Magnet dimensions ---
214 AliMAG *MAG = new AliMAG("MAG", "Magnet");
b9d0a01d 215 }
b3261b4c 216
217
69b7ed25 218 if (iABSO)
b9d0a01d 219 {
69b7ed25 220 //=================== ABSO parameters ============================
221 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
b9d0a01d 222 }
b3261b4c 223
69b7ed25 224 if (iDIPO)
b9d0a01d 225 {
69b7ed25 226 //=================== DIPO parameters ============================
b3261b4c 227
69b7ed25 228 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
b9d0a01d 229 }
b3261b4c 230
69b7ed25 231 if (iHALL)
b9d0a01d 232 {
69b7ed25 233 //=================== HALL parameters ============================
b3261b4c 234
69b7ed25 235 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
b9d0a01d 236 }
b3261b4c 237
238
69b7ed25 239 if (iFRAME)
b9d0a01d 240 {
69b7ed25 241 //=================== FRAME parameters ============================
b3261b4c 242
69b7ed25 243 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
b9d0a01d 244 }
b3261b4c 245
69b7ed25 246 if (iSHIL)
b9d0a01d 247 {
69b7ed25 248 //=================== SHIL parameters ============================
b3261b4c 249
69b7ed25 250 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
b9d0a01d 251 }
b3261b4c 252
253
69b7ed25 254 if (iPIPE)
b9d0a01d 255 {
69b7ed25 256 //=================== PIPE parameters ============================
b3261b4c 257
69b7ed25 258 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
b9d0a01d 259 }
b3261b4c 260
69b7ed25 261 if(iITS) {
b3261b4c 262
e98b7803 263 //=================== ITS parameters ============================
b9d0a01d 264 //
265 // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
266 // almost all other detectors. This involves the fact that the ITS geometry
267 // still has several options to be followed in parallel in order to determine
268 // the best set-up which minimizes the induced background. All the geometries
269 // available to date are described in the following. Read carefully the comments
270 // and use the default version (the only one uncommented) unless you are making
271 // comparisons and you know what you are doing. In this case just uncomment the
272 // ITS geometry you want to use and run Aliroot.
273 //
b3261b4c 274 // Detailed geometries:
b9d0a01d 275 //
276 //
277 //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
278 //
279 //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
280 //
b3261b4c 281 AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
282 ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
283 ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
b9d0a01d 284 // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
b3261b4c 285 ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
286 ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
287 ITS->SetThicknessChip1(150.); // chip thickness on layer 1 must be in the range [150,300]
288 ITS->SetThicknessChip2(150.); // chip thickness on layer 2 must be in the range [150,300]
289 ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
290 ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
291
292 // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
b9d0a01d 293 // for reconstruction !):
b3261b4c 294 //
b9d0a01d 295 //
296 //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
69b7ed25 297 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
b9d0a01d 298 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
299 //
300 //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
69b7ed25 301 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
b9d0a01d 302 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
b3261b4c 303 //
b9d0a01d 304 //
305 //
306 // Geant3 <-> EUCLID conversion
307 // ============================
308 //
309 // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
310 // media to two ASCII files (called by default ITSgeometry.euc and
311 // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
312 // The default (=0) means that you dont want to use this facility.
313 //
b3261b4c 314 ITS->SetEUCLID(0);
b9d0a01d 315 }
b3261b4c 316
69b7ed25 317 if (iTPC)
b9d0a01d 318 {
b3261b4c 319 //============================ TPC parameters =====================
69b7ed25 320 AliTPC *TPC = new AliTPCv2("TPC", "Default");
b9d0a01d 321 }
b3261b4c 322
323
69b7ed25 324 if (iTOF) {
325 //=================== TOF parameters ============================
b3261b4c 326 AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
327 // Partial geometry: modules at 2,3,4,6,7,11,12,14,15,16
328 // starting at 6h in positive direction
329 // Int_t TOFSectors[18]={-1,-1,0,0,0,-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0};
330 // Partial geometry: modules at 1,2,6,7,9,10,11,12,15,16,17
331 // (ALICE numbering convention)
332 Int_t TOFSectors[18]={-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0,-1,-1,0,0,0};
333 TOF->SetTOFSectors(TOFSectors);
69b7ed25 334 }
b3261b4c 335
336
f4b3bbb7 337 if (iHMPID)
b9d0a01d 338 {
f4b3bbb7 339 //=================== HMPID parameters ===========================
340 AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");
b3261b4c 341
b9d0a01d 342 }
b3261b4c 343
344
69b7ed25 345 if (iZDC)
b9d0a01d 346 {
69b7ed25 347 //=================== ZDC parameters ============================
b3261b4c 348
69b7ed25 349 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
b9d0a01d 350 }
b3261b4c 351
69b7ed25 352 if (iTRD)
b9d0a01d 353 {
69b7ed25 354 //=================== TRD parameters ============================
b3261b4c 355
69b7ed25 356 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
b3261b4c 357 AliTRDgeometry *geoTRD = TRD->GetGeometry();
358 // Partial geometry: modules at 2,3,4,6,11,12,14,15
359 // starting at 6h in positive direction
360 geoTRD->SetSMstatus(0,0);
361 geoTRD->SetSMstatus(1,0);
362 geoTRD->SetSMstatus(5,0);
363 geoTRD->SetSMstatus(7,0);
364 geoTRD->SetSMstatus(8,0);
365 geoTRD->SetSMstatus(9,0);
366 geoTRD->SetSMstatus(10,0);
367 geoTRD->SetSMstatus(13,0);
368 geoTRD->SetSMstatus(16,0);
369 geoTRD->SetSMstatus(17,0);
b9d0a01d 370 }
b3261b4c 371
69b7ed25 372 if (iFMD)
b9d0a01d 373 {
69b7ed25 374 //=================== FMD parameters ============================
b3261b4c 375 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
69b7ed25 376 }
b3261b4c 377
69b7ed25 378 if (iMUON)
b9d0a01d 379 {
69b7ed25 380 //=================== MUON parameters ===========================
b3261b4c 381 // New MUONv1 version (geometry defined via builders)
69b7ed25 382 AliMUON *MUON = new AliMUONv1("MUON", "default");
e98b7803 383 }
69b7ed25 384 //=================== PHOS parameters ===========================
b3261b4c 385
69b7ed25 386 if (iPHOS)
b9d0a01d 387 {
69b7ed25 388 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
b9d0a01d 389 }
b3261b4c 390
391
69b7ed25 392 if (iPMD)
b9d0a01d 393 {
69b7ed25 394 //=================== PMD parameters ============================
395 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
b9d0a01d 396 }
b3261b4c 397
ababa197 398 if (iT0)
b9d0a01d 399 {
ababa197 400 //=================== T0 parameters ============================
401 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
b9d0a01d 402 }
b3261b4c 403
69b7ed25 404 if (iEMCAL)
b9d0a01d 405 {
69b7ed25 406 //=================== EMCAL parameters ============================
b3261b4c 407 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
b9d0a01d 408 }
b3261b4c 409
69b7ed25 410 if (iCRT)
b9d0a01d 411 {
69b7ed25 412 //=================== CRT parameters ============================
413 AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
b9d0a01d 414 }
b3261b4c 415
69b7ed25 416 if (iVZERO)
cdb67f97 417 {
69b7ed25 418 //=================== CRT parameters ============================
b3261b4c 419 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
420 }
b9d0a01d 421}
69b7ed25 422
b9d0a01d 423Float_t EtaToTheta(Float_t arg){
424 return (180./TMath::Pi())*2.*atan(exp(-arg));
425}
69b7ed25 426