]> git.uio.no Git - u/mrichter/AliRoot.git/blob - TFluka/macro/FlukaConfig.C
Detector updates.
[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 enum PprMag_t
13 {
14     k2kG, k4kG, k5kG
15 };
16                                                                                 
17                                                                                 
18 // This part for configuration
19 static PprGeo_t sgeo = kHoles;
20 static PprRad_t srad = kGluonRadiation;
21 static PprMag_t smag = k5kG;
22                                                                                 
23 // Comment line
24 static TString  comment;
25                                                                                 
26 // Functions
27 Float_t EtaToTheta(Float_t arg);
28
29
30 void Config()
31 {
32   cout << "==> Config.C..." << endl;
33   
34   // Set Random Number seed
35   gRandom->SetSeed(12345);
36   cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
37
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
42   
43   
44
45   Bool_t isFluka = kTRUE;
46   if (isFluka) {
47     gSystem->Load("libGeom");
48     cout << "\t* Loading TFluka..." << endl;  
49     gSystem->Load("libfluka");    
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");
57     
58     cout << "\t* Instantiating Geant3TGeo..." << endl;
59     new     TGeant3TGeo("C++ Interface to Geant3");
60   }
61   
62   if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
63       AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
64       AliCDBManager::Instance()->SetRun(0);
65   }
66
67   
68   AliRunLoader* rl=0x0;
69                                                                                 
70   cout<<"Config.C: Creating Run Loader ..."<<endl;
71   rl = AliRunLoader::Open("galice.root",
72                             AliConfig::GetDefaultEventFolderName(),
73                             "recreate");
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                                                                                 
83   //
84   // Set External decayer
85   AliDecayer *decayer = new AliDecayerPythia();
86                                                                                
87   decayer->SetForceDecay(kAll);
88   decayer->Init();
89   gMC->SetExternalDecayer(decayer);
90
91   //
92   //
93   //
94   // Physics process control
95
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);
101   gMC->SetProcess("DRAY",1);
102   gMC->SetProcess("ANNI",1);
103   gMC->SetProcess("BREM",1);
104   gMC->SetProcess("MUNU",1);
105   gMC->SetProcess("CKOV",1); 
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);
125
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"))
132       int     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
133   else
134       int     nParticles = 1000;
135   
136   cout << "\t* Creating and configuring generator for " << nParticles 
137        << " particles..." << endl;
138   
139   AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
140   
141   gener->SetMomentumRange(0., 999);
142   gener->SetPhiRange(0, 360);
143   // Set pseudorapidity range from -3 to 3.
144   Float_t thmin = EtaToTheta( 3.);   // theta min. <---> eta max
145   Float_t thmax = EtaToTheta(-3.);   // theta max. <---> eta min 
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   //
154
155
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     {
175         comment = comment.Append(" | Holes for PHOS/HMPID");
176                                                                                 
177     } else {
178         comment = comment.Append(" | No holes for PHOS/HMPID");
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  
190   Int_t   iABSO    = 0; 
191   Int_t   iACORDE  = 0; 
192   Int_t   iDIPO    = 0; 
193   Int_t   iFMD     = 0; 
194   Int_t   iFRAME   = 0; 
195   Int_t   iHALL    = 0; 
196   Int_t   iITS     = 0; 
197   Int_t   iMAG     = 0; 
198   Int_t   iMUON    = 0; 
199   Int_t   iPHOS    = 0; 
200   Int_t   iPIPE    = 0; 
201   Int_t   iPMD     = 0; 
202   Int_t   iHMPID   = 0; 
203   Int_t   iSHIL    = 0; 
204   Int_t   iT0      = 0; 
205   Int_t   iTOF     = 0; 
206   Int_t   iTPC     = 0;
207   Int_t   iTRD     = 0; 
208   Int_t   iZDC     = 0; 
209   Int_t   iEMCAL   = 0; 
210   Int_t   iVZERO   = 0;
211  
212   cout << "\t* Creating the detectors ..." << endl;
213   //=================== Alice BODY parameters =============================
214     //=================== Alice BODY parameters =============================
215     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
216                                                                                 
217
218     if (iMAG)
219     {
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");
224     }
225
226
227     if (iABSO)
228     {
229         //=================== ABSO parameters ============================
230         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
231     }
232
233     if (iDIPO)
234     {
235         //=================== DIPO parameters ============================
236
237         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 2");
238     }
239
240     if (iHALL)
241     {
242         //=================== HALL parameters ============================
243
244         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
245     }
246
247
248     if (iFRAME)
249     {
250         //=================== FRAME parameters ============================
251
252         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
253     }
254
255     if (iSHIL)
256     {
257         //=================== SHIL parameters ============================
258
259         AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
260     }
261
262
263     if (iPIPE)
264     {
265         //=================== PIPE parameters ============================
266
267         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
268     }
269  
270     if (iITS)
271     {
272         //=================== ITS parameters ============================
273
274         AliITS *ITS  = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
275     }
276
277
278     if (iTPC)
279     {
280       //============================ TPC parameters =====================
281         AliTPC *TPC = new AliTPCv2("TPC", "Default");
282     }
283
284
285     if (iTOF) {
286         //=================== TOF parameters ============================
287         AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
288     }
289
290
291     if (iHMPID)
292     {
293         //=================== HMPID parameters ===========================
294         AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
295
296     }
297
298
299     if (iZDC)
300     {
301         //=================== ZDC parameters ============================
302
303         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
304     }
305
306     if (iTRD)
307     {
308         //=================== TRD parameters ============================
309
310         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
311         AliTRDgeometry *geoTRD = TRD->GetGeometry();
312         // Partial geometry: modules at 2,3,4,6,11,12,14,15
313         // starting at 6h in positive direction
314         geoTRD->SetSMstatus(0,0);
315         geoTRD->SetSMstatus(1,0);
316         geoTRD->SetSMstatus(5,0);
317         geoTRD->SetSMstatus(7,0);
318         geoTRD->SetSMstatus(8,0);
319         geoTRD->SetSMstatus(9,0);
320         geoTRD->SetSMstatus(10,0);
321         geoTRD->SetSMstatus(13,0);
322         geoTRD->SetSMstatus(16,0);
323         geoTRD->SetSMstatus(17,0);
324     }
325
326     if (iFMD)
327     {
328         //=================== FMD parameters ============================
329         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
330    }
331
332     if (iMUON)
333     {
334         //=================== MUON parameters ===========================
335         // New MUONv1 version (geometry defined via builders)
336         AliMUON *MUON = new AliMUONv1("MUON", "default");
337     }
338     //=================== PHOS parameters ===========================
339
340     if (iPHOS)
341     {
342         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
343         //Set simulation parameters different from the default ones.
344         AliPHOSSimParam* simEmc = AliPHOSSimParam::GetInstance() ;
345   
346         // APD noise of warm (+20C) PHOS:
347         // a2 = a1*(Y1/Y2)*(M1/M2), where a1 = 0.012 is APD noise at -25C,
348         // Y1 = 4.3 photo-electrons/MeV, Y2 = 1.7 p.e/MeV - light yields at -25C and +20C,
349         // M1 = 50, M2 = 50 - APD gain factors chosen for t1 = -25C and t2 = +20C,
350         // Y = MeanLightYield*APDEfficiency.
351
352         Float_t apdNoise = 0.012*2.5; 
353         simEmc->SetAPDNoise(apdNoise);
354
355         //Raw Light Yield at +20C
356         simEmc->SetMeanLightYield(18800);
357
358         //ADC channel width at +18C.
359         simEmc->SetADCchannelW(0.0125);
360     }
361
362
363     if (iPMD)
364     {
365         //=================== PMD parameters ============================
366         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
367     }
368
369     if (iT0)
370     {
371         //=================== T0 parameters ============================
372         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
373     }
374
375     if (iEMCAL)
376     {
377         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
378     }
379
380      if (iACORDE)
381     {
382         //=================== ACORDE parameters ============================
383         AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
384     }
385
386      if (iVZERO)
387     {
388         //=================== ACORDE parameters ============================
389         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
390     }                                                                                
391 }
392                                                                                 
393 Float_t EtaToTheta(Float_t arg){
394   return (180./TMath::Pi())*2.*atan(exp(-arg));
395 }
396