]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EMCAL/macros/Config.C
changes to test config file for new pythia library loading
[u/mrichter/AliRoot.git] / EMCAL / macros / Config.C
1 // One can use the configuration macro in compiled mode by
2 // root [0] gSystem->Load("libgeant321");
3 // root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
4 //                   -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
5 // root [0] .x grun.C(1,"Config.C++")
6
7 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include <Riostream.h>
9 #include <TPDGCode.h>
10 #include <TRandom.h>
11 #include <TSystem.h>
12 #include <TVirtualMC.h>
13 #include <TGeant3TGeo.h>
14 #include "STEER/AliRunLoader.h"
15 #include "STEER/AliRun.h"
16 #include "STEER/AliConfig.h"
17 #include "PYTHIA6/AliDecayerPythia.h"
18 #include "EVGEN/AliGenCocktail.h"
19 #include "EVGEN/AliGenHIJINGpara.h"
20 #include "STEER/AliMagFMaps.h"
21 #include "STRUCT/AliBODY.h"
22 #include "STRUCT/AliMAG.h"
23 #include "STRUCT/AliABSOv3.h"
24 #include "STRUCT/AliDIPOv3.h"
25 #include "STRUCT/AliHALLv3.h"
26 #include "STRUCT/AliFRAMEv2.h"
27 #include "STRUCT/AliSHILv3.h"
28 #include "STRUCT/AliPIPEv3.h"
29 #include "ITS/AliITSvPPRasymmFMD.h"
30 #include "TPC/AliTPCv2.h"
31 #include "TOF/AliTOFv6T0.h"
32 #include "HMPID/AliHMPIDv2.h"
33 #include "ZDC/AliZDCv3.h"
34 #include "TRD/AliTRDv1.h"
35 #include "FMD/AliFMDv1.h"
36 #include "MUON/AliMUONv1.h"
37 #include "PHOS/AliPHOSv1.h"
38 #include "PMD/AliPMDv1.h"
39 #include "T0/AliT0v1.h"
40 #include "EMCAL/AliEMCALv2.h"
41 #include "ACORDE/AliACORDEv0.h"
42 #include "VZERO/AliVZEROv7.h"
43 #endif
44
45 Float_t EtaToTheta(Float_t arg);
46 void    LoadPythia();
47
48 void Config()
49 {
50     // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
51     // Theta range given through pseudorapidity limits 22/6/2001
52
53     // Set Random Number seed
54     //gRandom->SetSeed(123456); // Set 0 to use the currecnt time
55   AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
56
57   // Load Pythia libraries                                        
58   LoadPythia();
59
60    // libraries required by geant321
61 #if defined(__CINT__)
62     gSystem->Load("libgeant321");
63 #endif
64
65     new     TGeant3TGeo("C++ Interface to Geant3");
66
67     AliRunLoader* rl=0x0;
68
69     AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
70
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     // Set the trigger configuration
84     gAlice->SetTriggerDescriptor("Pb-Pb");
85     cout<<"Trigger configuration is set to  Pb-Pb"<<endl;
86
87     //
88     // Set External decayer
89     TVirtualMCDecayer *decayer = new AliDecayerPythia();
90
91     decayer->SetForceDecay(kAll);
92     decayer->Init();
93     gMC->SetExternalDecayer(decayer);
94     //=======================================================================
95     // ************* STEERING parameters FOR ALICE SIMULATION **************
96     // --- Specify event type to be tracked through the ALICE setup
97     // --- All positions are in cm, angles in degrees, and P and E in GeV
98
99
100     gMC->SetProcess("DCAY",1);
101     gMC->SetProcess("PAIR",1);
102     gMC->SetProcess("COMP",1);
103     gMC->SetProcess("PHOT",1);
104     gMC->SetProcess("PFIS",0);
105     gMC->SetProcess("DRAY",0);
106     gMC->SetProcess("ANNI",1);
107     gMC->SetProcess("BREM",1);
108     gMC->SetProcess("MUNU",1);
109     gMC->SetProcess("CKOV",1);
110     gMC->SetProcess("HADR",1);
111     gMC->SetProcess("LOSS",2);
112     gMC->SetProcess("MULS",1);
113     gMC->SetProcess("RAYL",1);
114
115     Float_t cut = 1.e-3;        // 1MeV cut by default
116     Float_t tofmax = 1.e10;
117
118     gMC->SetCut("CUTGAM", cut);
119     gMC->SetCut("CUTELE", cut);
120     gMC->SetCut("CUTNEU", cut);
121     gMC->SetCut("CUTHAD", cut);
122     gMC->SetCut("CUTMUO", cut);
123     gMC->SetCut("BCUTE",  cut); 
124     gMC->SetCut("BCUTM",  cut); 
125     gMC->SetCut("DCUTE",  cut); 
126     gMC->SetCut("DCUTM",  cut); 
127     gMC->SetCut("PPCUTM", cut);
128     gMC->SetCut("TOFMAX", tofmax); 
129
130
131     int     nParticles = 100;
132     if (gSystem->Getenv("CONFIG_NPARTICLES"))
133     {
134         nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
135     }
136
137     AliGenBox *gener = new AliGenBox(5);
138     gener->SetMomentumRange(50.,100.);
139     gener->SetPhiRange(80.0,180.0);
140     gener->SetThetaRange(EtaToTheta(-0.7), EtaToTheta(0.7));
141
142     gener->SetOrigin(0,0,0);        //vertex position
143     gener->SetSigma(0,0,0);         //Sigma in (X,Y,Z) (cm) on IP position
144     gener->SetPart(kGamma);
145     gener->Init();
146
147     // 
148     // Activate this line if you want the vertex smearing to happen
149     // track by track
150     //
151     //gener->SetVertexSmear(perTrack); 
152     // Field (L3 0.4 T)
153     AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
154     gAlice->SetField(field);    
155
156
157     Int_t   iABSO  =  0;
158     Int_t   iDIPO  =  0;
159     Int_t   iFMD   =  0;
160     Int_t   iFRAME =  0;
161     Int_t   iHALL  =  0;
162     Int_t   iITS   =  0;
163     Int_t   iMAG   =  0;
164     Int_t   iMUON  =  0;
165     Int_t   iPHOS  =  0;
166     Int_t   iPIPE  =  0;
167     Int_t   iPMD   =  0;
168     Int_t   iHMPID  =  0;
169     Int_t   iSHIL  =  0;
170     Int_t   iT0 =  0;
171     Int_t   iTOF   =  0;
172     Int_t   iTPC   =  0;
173     Int_t   iTRD   =  0;
174     Int_t   iZDC   =  0;
175     Int_t   iEMCAL =  1;
176     Int_t   iACORDE   =  0;
177     Int_t   iVZERO =  0;
178     rl->CdGAFile();
179     //=================== Alice BODY parameters =============================
180     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
181
182     if (iMAG)
183     {
184         //=================== MAG parameters ============================
185         // --- Start with Magnet since detector layouts may be depending ---
186         // --- on the selected Magnet dimensions ---
187         AliMAG *MAG = new AliMAG("MAG", "Magnet");
188     }
189
190
191     if (iABSO)
192     {
193         //=================== ABSO parameters ============================
194         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
195     }
196
197     if (iDIPO)
198     {
199         //=================== DIPO parameters ============================
200
201         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
202     }
203
204     if (iHALL)
205     {
206         //=================== HALL parameters ============================
207
208         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
209     }
210
211
212     if (iFRAME)
213     {
214         //=================== FRAME parameters ============================
215
216         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
217     }
218
219     if (iSHIL)
220     {
221         //=================== SHIL parameters ============================
222
223         AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
224     }
225
226
227     if (iPIPE)
228     {
229         //=================== PIPE parameters ============================
230
231         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
232     }
233  
234     if(iITS) {
235
236     //=================== ITS parameters ============================
237
238       AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","ITS PPR detailed version with asymmetric services");
239     }
240
241     if (iTPC)
242     {
243         //============================ TPC parameters ===================
244         AliTPC *TPC = new AliTPCv2("TPC", "Default");
245     }
246
247
248     if (iTOF) {
249         //=================== TOF parameters ============================
250         AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
251     }
252
253
254     if (iHMPID)
255     {
256         //=================== HMPID parameters ===========================
257         AliHMPID *HMPID = new AliHMPIDv2("HMPID", "normal HMPID");
258
259     }
260
261
262     if (iZDC)
263     {
264         //=================== ZDC parameters ============================
265
266         AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
267     }
268
269     if (iTRD)
270     {
271         //=================== TRD parameters ============================
272
273         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
274     }
275
276     if (iFMD)
277     {
278         //=================== FMD parameters ============================
279         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
280    }
281
282     if (iMUON)
283     {
284         //=================== MUON parameters ===========================
285         // New MUONv1 version (geometry defined via builders)
286         AliMUON *MUON = new AliMUONv1("MUON", "default");
287     }
288     //=================== PHOS parameters ===========================
289
290     if (iPHOS)
291     {
292         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
293     }
294
295
296     if (iPMD)
297     {
298         //=================== PMD parameters ============================
299         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
300     }
301
302     if (iT0)
303     {
304         //=================== T0 parameters ============================
305         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
306     }
307
308     if (iEMCAL)
309     {
310         //=================== EMCAL parameters ============================
311         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
312     }
313
314      if (iACORDE)
315     {
316         //=================== ACORDE parameters ============================
317         AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
318     }
319
320      if (iVZERO)
321     {
322         //=================== ACORDE parameters ============================
323         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
324     }
325
326      AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
327
328 }
329
330 Float_t EtaToTheta(Float_t arg){
331   return (180./TMath::Pi())*2.*atan(exp(-arg));
332 }
333
334 void LoadPythia()
335 {
336   // Load Pythia related libraries                                                                
337   gSystem->Load("liblhapdf.so");      // Parton density functions                                 
338   gSystem->Load("libEGPythia6.so");   // TGenerator interface                                     
339   gSystem->Load("libpythia6.so");     // Pythia                                                   
340   gSystem->Load("libAliPythia6.so");  // ALICE specific
341                                       // implementations                           
342 }