]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/macro/FlukaConfig.C
All detectors switched on.
[u/mrichter/AliRoot.git] / TFluka / macro / FlukaConfig.C
1 static Int_t    eventsPerRun = 100;
2 enum PprGeo_t
3 {
4     kHoles, kNoHoles
5 };
6                                                                                 
7 enum PprRad_t
8 {
9     kGluonRadiation, kNoGluonRadiation
10 };
11                                                                                 
12 // This part for configuration
13 static PprGeo_t sgeo = kHoles;
14 static PprRad_t srad = kGluonRadiation;
15 static AliMagF::BMap_t smag = AliMagF::k5kG;
16                                                                                 
17 // Comment line
18 static TString  comment;
19                                                                                 
20 // Functions
21 Float_t EtaToTheta(Float_t arg);
22
23 void Config()
24 {
25   cout << "==> Config.C..." << endl;
26   
27   // Set Random Number seed
28   gRandom->SetSeed(12345);
29   cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
30
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
35   
36   
37
38   Bool_t isFluka = kTRUE;
39   if (isFluka) {
40     gSystem->Load("libGeom");
41     cout << "\t* Loading TFluka..." << endl;  
42     gSystem->Load("libfluka");    
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");
50     
51     cout << "\t* Instantiating Geant3TGeo..." << endl;
52     new     TGeant3TGeo("C++ Interface to Geant3");
53   }
54   
55   if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
56       AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
57       AliCDBManager::Instance()->SetRun(0);
58   }
59
60   
61   AliRunLoader* rl=0x0;
62                                                                                 
63   cout<<"Config.C: Creating Run Loader ..."<<endl;
64   rl = AliRunLoader::Open("galice.root",
65                             AliConfig::GetDefaultEventFolderName(),
66                             "recreate");
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                                                                                 
76   //
77   // Set External decayer
78   AliDecayer *decayer = new AliDecayerPythia();
79                                                                                
80   decayer->SetForceDecay(kAll);
81   decayer->Init();
82   gMC->SetExternalDecayer(decayer);
83
84   //
85   //
86   //
87   // Physics process control
88
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);
94   gMC->SetProcess("DRAY",1);
95   gMC->SetProcess("ANNI",1);
96   gMC->SetProcess("BREM",1);
97   gMC->SetProcess("MUNU",1);
98   gMC->SetProcess("CKOV",1); 
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);
118
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"))
125       int     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
126   else
127       int     nParticles = 1000;
128   
129   cout << "\t* Creating and configuring generator for " << nParticles 
130        << " particles..." << endl;
131   
132   AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
133   
134   gener->SetMomentumRange(0., 999);
135   gener->SetPhiRange(0, 360);
136   // Set pseudorapidity range from -3 to 3.
137   Float_t thmin = EtaToTheta( 3.);   // theta min. <---> eta max
138   Float_t thmax = EtaToTheta(-3.);   // theta max. <---> eta min 
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   //
147
148
149     if (smag == AliMagF::k2kG) {
150         comment = comment.Append(" | L3 field 0.2 T");
151     } else if (smag == AliMagF::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     {
166         comment = comment.Append(" | Holes for PHOS/HMPID");
167                                                                                 
168     } else {
169         comment = comment.Append(" | No holes for PHOS/HMPID");
170     }
171                                                                                 
172     printf("\n \n Comment: %s \n \n", comment.Data());
173                                                                                 
174                                                                                 
175 // Field (L3 0.4 T)
176     TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 2, 1., 1., 10., AliMagF::k5kG));
177     rl->CdGAFile();
178
179  
180   Int_t   iABSO    = 1; 
181   Int_t   iACORDE  = 1; 
182   Int_t   iDIPO    = 1; 
183   Int_t   iFMD     = 1; 
184   Int_t   iFRAME   = 1; 
185   Int_t   iHALL    = 1; 
186   Int_t   iITS     = 1; 
187   Int_t   iMAG     = 1; 
188   Int_t   iMUON    = 1; 
189   Int_t   iPHOS    = 1; 
190   Int_t   iPIPE    = 1; 
191   Int_t   iPMD     = 1; 
192   Int_t   iHMPID   = 1; 
193   Int_t   iSHIL    = 1; 
194   Int_t   iT1      = 1; 
195   Int_t   iTOF     = 1; 
196   Int_t   iTPC     = 1;
197   Int_t   iTRD     = 1; 
198   Int_t   iZDC     = 1; 
199   Int_t   iEMCAL   = 1; 
200   Int_t   iVZERO   = 1;
201  
202   cout << "\t* Creating the detectors ..." << endl;
203   //=================== Alice BODY parameters =============================
204     //=================== Alice BODY parameters =============================
205     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
206                                                                                 
207
208     if (iMAG)
209     {
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");
214     }
215
216
217     if (iABSO)
218     {
219         //=================== ABSO parameters ============================
220         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
221     }
222
223     if (iDIPO)
224     {
225         //=================== DIPO parameters ============================
226
227         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 2");
228     }
229
230     if (iHALL)
231     {
232         //=================== HALL parameters ============================
233
234         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
235     }
236
237
238     if (iFRAME)
239     {
240         //=================== FRAME parameters ============================
241
242         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
243     }
244
245     if (iSHIL)
246     {
247         //=================== SHIL parameters ============================
248
249         AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 2");
250     }
251
252
253     if (iPIPE)
254     {
255         //=================== PIPE parameters ============================
256
257         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
258     }
259  
260     if (iITS)
261     {
262         //=================== ITS parameters ============================
263
264         AliITS *ITS  = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
265     }
266
267
268     if (iTPC)
269     {
270       //============================ TPC parameters =====================
271         AliTPC *TPC = new AliTPCv2("TPC", "Default");
272     }
273
274
275     if (iTOF) {
276         //=================== TOF parameters ============================
277         AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
278     }
279
280
281     if (iHMPID)
282     {
283         //=================== HMPID parameters ===========================
284         AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
285
286     }
287
288
289     if (iZDC)
290     {
291         //=================== ZDC parameters ============================
292
293         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
294     }
295
296     if (iTRD)
297     {
298         //=================== TRD parameters ============================
299
300         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
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);
314     }
315
316     if (iFMD)
317     {
318         //=================== FMD parameters ============================
319         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
320    }
321
322     if (iMUON)
323     {
324         //=================== MUON parameters ===========================
325         // New MUONv1 version (geometry defined via builders)
326         AliMUON *MUON = new AliMUONv1("MUON", "default");
327     }
328     //=================== PHOS parameters ===========================
329
330     if (iPHOS)
331     {
332         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
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);
350     }
351
352
353     if (iPMD)
354     {
355         //=================== PMD parameters ============================
356         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
357     }
358
359     if (iT0)
360     {
361         //=================== T0 parameters ============================
362         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
363     }
364
365     if (iEMCAL)
366     {
367         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
368     }
369
370      if (iACORDE)
371     {
372         //=================== ACORDE parameters ============================
373         AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
374     }
375
376      if (iVZERO)
377     {
378         //=================== ACORDE parameters ============================
379         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
380     }                                                                                
381 }
382                                                                                 
383 Float_t EtaToTheta(Float_t arg){
384   return (180./TMath::Pi())*2.*atan(exp(-arg));
385 }
386