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