]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/macro/FlukaConfig.C
Fixing the decoding of regional header bits.
[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
69b7ed25 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
0a7556af 190 Int_t iABSO = 1;
191 Int_t iACORDE = 0;
192 Int_t iDIPO = 1;
193 Int_t iFMD = 1;
194 Int_t iFRAME = 1;
195 Int_t iHALL = 1;
196 Int_t iITS = 1;
197 Int_t iMAG = 1;
198 Int_t iMUON = 1;
199 Int_t iPHOS = 1;
200 Int_t iPIPE = 1;
201 Int_t iPMD = 1;
202 Int_t iHMPID = 1;
203 Int_t iSHIL = 1;
204 Int_t iT0 = 1;
205 Int_t iTOF = 1;
206 Int_t iTPC = 1;
207 Int_t iTRD = 1;
208 Int_t iZDC = 1;
209 Int_t iEMCAL = 0;
210 Int_t iVZERO = 1;
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 ============================
230 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
b9d0a01d 231 }
b3261b4c 232
69b7ed25 233 if (iDIPO)
b9d0a01d 234 {
69b7ed25 235 //=================== DIPO parameters ============================
b3261b4c 236
69b7ed25 237 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
b9d0a01d 238 }
b3261b4c 239
69b7ed25 240 if (iHALL)
b9d0a01d 241 {
69b7ed25 242 //=================== HALL parameters ============================
b3261b4c 243
69b7ed25 244 AliHALL *HALL = new AliHALL("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
69b7ed25 267 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
b9d0a01d 268 }
b3261b4c 269
69b7ed25 270 if(iITS) {
b3261b4c 271
e98b7803 272 //=================== ITS parameters ============================
b9d0a01d 273 //
274 // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
275 // almost all other detectors. This involves the fact that the ITS geometry
276 // still has several options to be followed in parallel in order to determine
277 // the best set-up which minimizes the induced background. All the geometries
278 // available to date are described in the following. Read carefully the comments
279 // and use the default version (the only one uncommented) unless you are making
280 // comparisons and you know what you are doing. In this case just uncomment the
281 // ITS geometry you want to use and run Aliroot.
282 //
b3261b4c 283 // Detailed geometries:
b9d0a01d 284 //
285 //
286 //AliITS *ITS = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
287 //
288 //AliITS *ITS = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
289 //
b3261b4c 290 AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
291 ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
292 ITS->SetReadDet(kFALSE); // don't touch this parameter if you're not an ITS developer
b9d0a01d 293 // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
b3261b4c 294 ITS->SetThicknessDet1(200.); // detector thickness on layer 1 must be in the range [100,300]
295 ITS->SetThicknessDet2(200.); // detector thickness on layer 2 must be in the range [100,300]
296 ITS->SetThicknessChip1(150.); // chip thickness on layer 1 must be in the range [150,300]
297 ITS->SetThicknessChip2(150.); // chip thickness on layer 2 must be in the range [150,300]
298 ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
299 ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
300
301 // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
b9d0a01d 302 // for reconstruction !):
b3261b4c 303 //
b9d0a01d 304 //
305 //AliITSvPPRcoarseasymm *ITS = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
69b7ed25 306 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
b9d0a01d 307 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
308 //
309 //AliITS *ITS = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
69b7ed25 310 //ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
b9d0a01d 311 //ITS->SetSupportMaterial(0); // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
b3261b4c 312 //
b9d0a01d 313 //
314 //
315 // Geant3 <-> EUCLID conversion
316 // ============================
317 //
318 // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
319 // media to two ASCII files (called by default ITSgeometry.euc and
320 // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
321 // The default (=0) means that you dont want to use this facility.
322 //
b3261b4c 323 ITS->SetEUCLID(0);
b9d0a01d 324 }
b3261b4c 325
69b7ed25 326 if (iTPC)
b9d0a01d 327 {
b3261b4c 328 //============================ TPC parameters =====================
69b7ed25 329 AliTPC *TPC = new AliTPCv2("TPC", "Default");
b9d0a01d 330 }
b3261b4c 331
332
69b7ed25 333 if (iTOF) {
334 //=================== TOF parameters ============================
b3261b4c 335 AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
336 // Partial geometry: modules at 2,3,4,6,7,11,12,14,15,16
337 // starting at 6h in positive direction
338 // Int_t TOFSectors[18]={-1,-1,0,0,0,-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0};
339 // Partial geometry: modules at 1,2,6,7,9,10,11,12,15,16,17
340 // (ALICE numbering convention)
341 Int_t TOFSectors[18]={-1,0,0,-1,-1,-1,0,0,-1,0,0,0,0,-1,-1,0,0,0};
342 TOF->SetTOFSectors(TOFSectors);
69b7ed25 343 }
b3261b4c 344
345
f4b3bbb7 346 if (iHMPID)
b9d0a01d 347 {
f4b3bbb7 348 //=================== HMPID parameters ===========================
349 AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");
b3261b4c 350
b9d0a01d 351 }
b3261b4c 352
353
69b7ed25 354 if (iZDC)
b9d0a01d 355 {
69b7ed25 356 //=================== ZDC parameters ============================
b3261b4c 357
69b7ed25 358 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
b9d0a01d 359 }
b3261b4c 360
69b7ed25 361 if (iTRD)
b9d0a01d 362 {
69b7ed25 363 //=================== TRD parameters ============================
b3261b4c 364
69b7ed25 365 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
b3261b4c 366 AliTRDgeometry *geoTRD = TRD->GetGeometry();
367 // Partial geometry: modules at 2,3,4,6,11,12,14,15
368 // starting at 6h in positive direction
369 geoTRD->SetSMstatus(0,0);
370 geoTRD->SetSMstatus(1,0);
371 geoTRD->SetSMstatus(5,0);
372 geoTRD->SetSMstatus(7,0);
373 geoTRD->SetSMstatus(8,0);
374 geoTRD->SetSMstatus(9,0);
375 geoTRD->SetSMstatus(10,0);
376 geoTRD->SetSMstatus(13,0);
377 geoTRD->SetSMstatus(16,0);
378 geoTRD->SetSMstatus(17,0);
b9d0a01d 379 }
b3261b4c 380
69b7ed25 381 if (iFMD)
b9d0a01d 382 {
69b7ed25 383 //=================== FMD parameters ============================
b3261b4c 384 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
69b7ed25 385 }
b3261b4c 386
69b7ed25 387 if (iMUON)
b9d0a01d 388 {
69b7ed25 389 //=================== MUON parameters ===========================
b3261b4c 390 // New MUONv1 version (geometry defined via builders)
69b7ed25 391 AliMUON *MUON = new AliMUONv1("MUON", "default");
e98b7803 392 }
69b7ed25 393 //=================== PHOS parameters ===========================
b3261b4c 394
69b7ed25 395 if (iPHOS)
b9d0a01d 396 {
69b7ed25 397 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
b9d0a01d 398 }
b3261b4c 399
400
69b7ed25 401 if (iPMD)
b9d0a01d 402 {
69b7ed25 403 //=================== PMD parameters ============================
404 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
b9d0a01d 405 }
b3261b4c 406
ababa197 407 if (iT0)
b9d0a01d 408 {
ababa197 409 //=================== T0 parameters ============================
410 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
b9d0a01d 411 }
b3261b4c 412
69b7ed25 413 if (iEMCAL)
b9d0a01d 414 {
69b7ed25 415 //=================== EMCAL parameters ============================
b3261b4c 416 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
b9d0a01d 417 }
b3261b4c 418
b384f8a4 419 if (iACORDE)
b9d0a01d 420 {
b384f8a4 421 //=================== ACORDE parameters ============================
422 AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
b9d0a01d 423 }
b3261b4c 424
69b7ed25 425 if (iVZERO)
cdb67f97 426 {
b384f8a4 427 //=================== ACORDE parameters ============================
b3261b4c 428 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
429 }
b9d0a01d 430}
69b7ed25 431
b9d0a01d 432Float_t EtaToTheta(Float_t arg){
433 return (180./TMath::Pi())*2.*atan(exp(-arg));
434}
69b7ed25 435