]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TFluka/macro/FlukaConfig.C
Extacting the OCDB in a separate module. The detectors have write permission in the...
[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
69b7ed25 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)
f7a1cc68 176 AliMagF *field = new AliMagF("Maps","Maps", 2, 1., 1., 10., smag);
69b7ed25 177 field->SetL3ConstField(0); //Using const. field in the barrel
f7a1cc68 178 TGeoGlobalMagField::Instance()->SetField(field);
69b7ed25 179 rl->CdGAFile();
69b7ed25 180
e3c0a95f 181 Int_t iABSO = 0;
0a7556af 182 Int_t iACORDE = 0;
e3c0a95f 183 Int_t iDIPO = 0;
184 Int_t iFMD = 0;
185 Int_t iFRAME = 0;
186 Int_t iHALL = 0;
187 Int_t iITS = 0;
188 Int_t iMAG = 0;
189 Int_t iMUON = 0;
190 Int_t iPHOS = 0;
191 Int_t iPIPE = 0;
192 Int_t iPMD = 0;
193 Int_t iHMPID = 0;
194 Int_t iSHIL = 0;
195 Int_t iT0 = 0;
196 Int_t iTOF = 0;
197 Int_t iTPC = 0;
198 Int_t iTRD = 0;
199 Int_t iZDC = 0;
0a7556af 200 Int_t iEMCAL = 0;
e3c0a95f 201 Int_t iVZERO = 0;
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 ============================
e3c0a95f 221 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
b9d0a01d 222 }
b3261b4c 223
69b7ed25 224 if (iDIPO)
b9d0a01d 225 {
69b7ed25 226 //=================== DIPO parameters ============================
b3261b4c 227
e3c0a95f 228 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 2");
b9d0a01d 229 }
b3261b4c 230
69b7ed25 231 if (iHALL)
b9d0a01d 232 {
69b7ed25 233 //=================== HALL parameters ============================
b3261b4c 234
e3c0a95f 235 AliHALL *HALL = new AliHALLv3("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
e3c0a95f 258 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
b9d0a01d 259 }
b3261b4c 260
e3c0a95f 261 if (iITS)
262 {
263 //=================== ITS parameters ============================
264
265 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
b9d0a01d 266 }
b3261b4c 267
e3c0a95f 268
69b7ed25 269 if (iTPC)
b9d0a01d 270 {
b3261b4c 271 //============================ TPC parameters =====================
69b7ed25 272 AliTPC *TPC = new AliTPCv2("TPC", "Default");
b9d0a01d 273 }
b3261b4c 274
275
69b7ed25 276 if (iTOF) {
277 //=================== TOF parameters ============================
e3c0a95f 278 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
69b7ed25 279 }
b3261b4c 280
281
f4b3bbb7 282 if (iHMPID)
b9d0a01d 283 {
f4b3bbb7 284 //=================== HMPID parameters ===========================
e3c0a95f 285 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
b3261b4c 286
b9d0a01d 287 }
b3261b4c 288
289
69b7ed25 290 if (iZDC)
b9d0a01d 291 {
69b7ed25 292 //=================== ZDC parameters ============================
b3261b4c 293
69b7ed25 294 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
b9d0a01d 295 }
b3261b4c 296
69b7ed25 297 if (iTRD)
b9d0a01d 298 {
69b7ed25 299 //=================== TRD parameters ============================
b3261b4c 300
69b7ed25 301 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
b3261b4c 302 AliTRDgeometry *geoTRD = TRD->GetGeometry();
303 // Partial geometry: modules at 2,3,4,6,11,12,14,15
304 // starting at 6h in positive direction
305 geoTRD->SetSMstatus(0,0);
306 geoTRD->SetSMstatus(1,0);
307 geoTRD->SetSMstatus(5,0);
308 geoTRD->SetSMstatus(7,0);
309 geoTRD->SetSMstatus(8,0);
310 geoTRD->SetSMstatus(9,0);
311 geoTRD->SetSMstatus(10,0);
312 geoTRD->SetSMstatus(13,0);
313 geoTRD->SetSMstatus(16,0);
314 geoTRD->SetSMstatus(17,0);
b9d0a01d 315 }
b3261b4c 316
69b7ed25 317 if (iFMD)
b9d0a01d 318 {
69b7ed25 319 //=================== FMD parameters ============================
b3261b4c 320 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
69b7ed25 321 }
b3261b4c 322
69b7ed25 323 if (iMUON)
b9d0a01d 324 {
69b7ed25 325 //=================== MUON parameters ===========================
b3261b4c 326 // New MUONv1 version (geometry defined via builders)
69b7ed25 327 AliMUON *MUON = new AliMUONv1("MUON", "default");
e98b7803 328 }
69b7ed25 329 //=================== PHOS parameters ===========================
b3261b4c 330
69b7ed25 331 if (iPHOS)
b9d0a01d 332 {
69b7ed25 333 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
e3c0a95f 334 //Set simulation parameters different from the default ones.
335 AliPHOSSimParam* simEmc = AliPHOSSimParam::GetInstance() ;
336
337 // APD noise of warm (+20C) PHOS:
338 // a2 = a1*(Y1/Y2)*(M1/M2), where a1 = 0.012 is APD noise at -25C,
339 // Y1 = 4.3 photo-electrons/MeV, Y2 = 1.7 p.e/MeV - light yields at -25C and +20C,
340 // M1 = 50, M2 = 50 - APD gain factors chosen for t1 = -25C and t2 = +20C,
341 // Y = MeanLightYield*APDEfficiency.
342
343 Float_t apdNoise = 0.012*2.5;
344 simEmc->SetAPDNoise(apdNoise);
345
346 //Raw Light Yield at +20C
347 simEmc->SetMeanLightYield(18800);
348
349 //ADC channel width at +18C.
350 simEmc->SetADCchannelW(0.0125);
b9d0a01d 351 }
b3261b4c 352
353
69b7ed25 354 if (iPMD)
b9d0a01d 355 {
69b7ed25 356 //=================== PMD parameters ============================
357 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
b9d0a01d 358 }
b3261b4c 359
ababa197 360 if (iT0)
b9d0a01d 361 {
ababa197 362 //=================== T0 parameters ============================
363 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
b9d0a01d 364 }
b3261b4c 365
69b7ed25 366 if (iEMCAL)
b9d0a01d 367 {
b3261b4c 368 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
b9d0a01d 369 }
b3261b4c 370
b384f8a4 371 if (iACORDE)
b9d0a01d 372 {
b384f8a4 373 //=================== ACORDE parameters ============================
f7882672 374 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
b9d0a01d 375 }
b3261b4c 376
69b7ed25 377 if (iVZERO)
cdb67f97 378 {
b384f8a4 379 //=================== ACORDE parameters ============================
b3261b4c 380 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
381 }
b9d0a01d 382}
69b7ed25 383
b9d0a01d 384Float_t EtaToTheta(Float_t arg){
385 return (180./TMath::Pi())*2.*atan(exp(-arg));
386}
69b7ed25 387