]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/Config.C
New default geometry descriptions: HMPIDv2 and ITSv11Hybrid
[u/mrichter/AliRoot.git] / 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/AliITSv11Hybrid.h"
30 #include "TPC/AliTPCv2.h"
31 #include "TOF/AliTOFv6T0.h"
32 #include "HMPID/AliHMPIDv3.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 enum PprGeo_t
46   {
47     kHoles, kNoHoles
48   };
49 static PprGeo_t geo = kHoles;
50
51 Float_t EtaToTheta(Float_t arg);
52 void    LoadPythia();
53
54
55 void Config()
56 {
57     // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
58     // Theta range given through pseudorapidity limits 22/6/2001
59
60     // Set Random Number seed
61   //gRandom->SetSeed(123456); // Set 0 to use the current time
62   
63   AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
64
65   // Load Pythia libraries
66   LoadPythia();
67   // Libraries required by geant321
68 #if defined(__CINT__)
69     gSystem->Load("libgeant321");
70 #endif
71
72     new     TGeant3TGeo("C++ Interface to Geant3");
73
74     AliRunLoader* rl=0x0;
75
76     AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
77
78     rl = AliRunLoader::Open("galice.root",
79                             AliConfig::GetDefaultEventFolderName(),
80                             "recreate");
81     if (rl == 0x0)
82       {
83         gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
84         return;
85       }
86     rl->SetCompressionLevel(2);
87     rl->SetNumberOfEventsPerFile(3);
88     gAlice->SetRunLoader(rl);
89     
90     // gAlice->SetGeometryFromFile("geometry.root");
91
92     // Uncomment if you want to load geometry from OCDB!   >>>>
93 /*    
94     if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
95          cout << "#####################################################" << endl;
96          cout << "#                                                   #" << endl;
97          cout << "#     WARNING: CDB DEFAULT STORAGE NOT SET !!!      #" << endl;
98          cout << "#     SETTING IT TO local://$ALICE_ROOT !!!         #" << endl;
99          cout << "#                                                   #" << endl;
100          cout << "#####################################################" << endl;
101           
102          AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
103     }
104     
105     if(AliCDBManager::Instance()->GetRun() < 0){
106          cout << "#####################################################" << endl;
107          cout << "#                                                   #" << endl;
108          cout << "#     WARNING: RUN NUMBER NOT SET !!!               #" << endl;
109          cout << "#     SETTING IT TO 0 !!!                           #" << endl;
110          cout << "#                                                   #" << endl;
111          cout << "#####################################################" << endl;
112           
113          AliCDBManager::Instance()->SetRun(0);
114     }
115     gAlice->SetGeometryFromCDB();
116 */
117     // Uncomment if you want to load geometry from OCDB!   <<<<
118
119     // Set the trigger configuration
120     gAlice->SetTriggerDescriptor("Pb-Pb");
121     cout<<"Trigger configuration is set to  Pb-Pb"<<endl;
122
123     //
124     // Set External decayer
125     TVirtualMCDecayer *decayer = new AliDecayerPythia();
126
127     decayer->SetForceDecay(kAll);
128     decayer->Init();
129     gMC->SetExternalDecayer(decayer);
130     //=======================================================================
131     // ************* STEERING parameters FOR ALICE SIMULATION **************
132     // --- Specify event type to be tracked through the ALICE setup
133     // --- All positions are in cm, angles in degrees, and P and E in GeV
134
135
136     gMC->SetProcess("DCAY",1);
137     gMC->SetProcess("PAIR",1);
138     gMC->SetProcess("COMP",1);
139     gMC->SetProcess("PHOT",1);
140     gMC->SetProcess("PFIS",0);
141     gMC->SetProcess("DRAY",0);
142     gMC->SetProcess("ANNI",1);
143     gMC->SetProcess("BREM",1);
144     gMC->SetProcess("MUNU",1);
145     gMC->SetProcess("CKOV",1);
146     gMC->SetProcess("HADR",1);
147     gMC->SetProcess("LOSS",2);
148     gMC->SetProcess("MULS",1);
149     gMC->SetProcess("RAYL",1);
150
151     Float_t cut = 1.e-3;        // 1MeV cut by default
152     Float_t tofmax = 1.e10;
153
154     gMC->SetCut("CUTGAM", cut);
155     gMC->SetCut("CUTELE", cut);
156     gMC->SetCut("CUTNEU", cut);
157     gMC->SetCut("CUTHAD", cut);
158     gMC->SetCut("CUTMUO", cut);
159     gMC->SetCut("BCUTE",  cut); 
160     gMC->SetCut("BCUTM",  cut); 
161     gMC->SetCut("DCUTE",  cut); 
162     gMC->SetCut("DCUTM",  cut); 
163     gMC->SetCut("PPCUTM", cut);
164     gMC->SetCut("TOFMAX", tofmax); 
165
166
167     int     nParticles = 100;
168     if (gSystem->Getenv("CONFIG_NPARTICLES"))
169     {
170         nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
171     }
172
173     AliGenCocktail *gener = new AliGenCocktail();
174     gener->SetPhiRange(0, 360);
175     // Set pseudorapidity range from -8 to 8.
176     Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
177     Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
178     gener->SetThetaRange(thmin,thmax);
179     gener->SetOrigin(0, 0, 0);  //vertex position
180     gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
181
182     AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
183     hijingparam->SetMomentumRange(0.2, 999);
184     gener->AddGenerator(hijingparam,"HIJING PARAM",1);
185
186 //    AliGenBox *genbox = new AliGenBox(nParticles);
187 //    genbox->SetPart(kGamma);
188 //    genbox->SetPtRange(0.3, 10.00);
189 //    gener->AddGenerator(genbox,"GENBOX GAMMA for PHOS",1);
190     gener->Init();
191
192
193     // 
194     // Activate this line if you want the vertex smearing to happen
195     // track by track
196     //
197     //gener->SetVertexSmear(perTrack); 
198     // Field (L3 0.4 T)
199     AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
200     gAlice->SetField(field);    
201
202
203     Int_t   iABSO  =  1;
204     Int_t   iDIPO  =  1;
205     Int_t   iFMD   =  1;
206     Int_t   iFRAME =  1;
207     Int_t   iHALL  =  1;
208     Int_t   iITS   =  1;
209     Int_t   iMAG   =  1;
210     Int_t   iMUON  =  1;
211     Int_t   iPHOS  =  1;
212     Int_t   iPIPE  =  1;
213     Int_t   iPMD   =  1;
214     Int_t   iHMPID  =  1;
215     Int_t   iSHIL  =  1;
216     Int_t   iT0 =  1;
217     Int_t   iTOF   =  1;
218     Int_t   iTPC   =  1;
219     Int_t   iTRD   =  1;
220     Int_t   iZDC   =  1;
221     Int_t   iEMCAL =  1;
222     Int_t   iACORDE   =  0;
223     Int_t   iVZERO =  1;
224     rl->CdGAFile();
225     //=================== Alice BODY parameters =============================
226     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
227
228     if (iMAG)
229     {
230         //=================== MAG parameters ============================
231         // --- Start with Magnet since detector layouts may be depending ---
232         // --- on the selected Magnet dimensions ---
233         AliMAG *MAG = new AliMAG("MAG", "Magnet");
234     }
235
236
237     if (iABSO)
238     {
239         //=================== ABSO parameters ============================
240         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
241     }
242
243     if (iDIPO)
244     {
245         //=================== DIPO parameters ============================
246
247         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
248     }
249
250     if (iHALL)
251     {
252         //=================== HALL parameters ============================
253
254         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
255     }
256
257
258     if (iFRAME)
259     {
260         //=================== FRAME parameters ============================
261
262         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
263         if (geo == kHoles) {
264           FRAME->SetHoles(1);
265         } else {
266           FRAME->SetHoles(0);
267         }
268     }
269
270     if (iSHIL)
271     {
272         //=================== SHIL parameters ============================
273
274         AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
275     }
276
277
278     if (iPIPE)
279     {
280         //=================== PIPE parameters ============================
281
282         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
283     }
284  
285     if (iITS)
286     {
287         //=================== ITS parameters ============================
288
289         AliITS *ITS  = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
290     }
291
292     if (iTPC)
293     {
294         //============================ TPC parameters ===================
295         AliTPC *TPC = new AliTPCv2("TPC", "Default");
296     }
297
298
299     if (iTOF) {
300         //=================== TOF parameters ============================
301         AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
302     }
303
304
305     if (iHMPID)
306     {
307         //=================== HMPID parameters ===========================
308         AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
309
310     }
311
312
313     if (iZDC)
314     {
315         //=================== ZDC parameters ============================
316
317         AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
318     }
319
320     if (iTRD)
321     {
322         //=================== TRD parameters ============================
323
324         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
325     }
326
327     if (iFMD)
328     {
329         //=================== FMD parameters ============================
330         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
331    }
332
333     if (iMUON)
334     {
335         //=================== MUON parameters ===========================
336         // New MUONv1 version (geometry defined via builders)
337         AliMUON *MUON = new AliMUONv1("MUON", "default");
338     }
339     //=================== PHOS parameters ===========================
340
341     if (iPHOS)
342     {
343         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
344     }
345
346
347     if (iPMD)
348     {
349         //=================== PMD parameters ============================
350         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
351     }
352
353     if (iT0)
354     {
355         //=================== T0 parameters ============================
356         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
357     }
358
359     if (iEMCAL)
360     {
361         //=================== EMCAL parameters ============================
362         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
363     }
364
365      if (iACORDE)
366     {
367         //=================== ACORDE parameters ============================
368         AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
369     }
370
371      if (iVZERO)
372     {
373         //=================== ACORDE parameters ============================
374         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
375     }
376
377      AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
378
379 }
380
381 Float_t EtaToTheta(Float_t arg){
382   return (180./TMath::Pi())*2.*atan(exp(-arg));
383 }
384
385
386 void LoadPythia()
387 {
388     // Load Pythia related libraries
389     gSystem->Load("liblhapdf.so");      // Parton density functions
390     gSystem->Load("libEGPythia6.so");   // TGenerator interface
391     gSystem->Load("libpythia6.so");     // Pythia
392     gSystem->Load("libAliPythia6.so");  // ALICE specific implementations
393 }