]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/CALO/macros/ConfigSingle.C
- adding a macro with the full CALO chain + tracking from TPC
[u/mrichter/AliRoot.git] / HLT / CALO / macros / ConfigSingle.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 "EVGEN/AliGenFixed.h"
21 #include "EVGEN/AliGenBox.h"
22 #include "STEER/AliMagF.h"
23 #include "STRUCT/AliBODY.h"
24 #include "STRUCT/AliMAG.h"
25 #include "STRUCT/AliABSOv3.h"
26 #include "STRUCT/AliDIPOv3.h"
27 #include "STRUCT/AliHALLv3.h"
28 #include "STRUCT/AliFRAMEv2.h"
29 #include "STRUCT/AliSHILv3.h"
30 #include "STRUCT/AliPIPEv3.h"
31 #include "ITS/AliITSv11Hybrid.h"
32 #include "TPC/AliTPCv2.h"
33 #include "TOF/AliTOFv6T0.h"
34 #include "HMPID/AliHMPIDv3.h"
35 #include "ZDC/AliZDCv3.h"
36 #include "TRD/AliTRDv1.h"
37 #include "TRD/AliTRDgeometry.h"
38 #include "FMD/AliFMDv1.h"
39 #include "MUON/AliMUONv1.h"
40 #include "PHOS/AliPHOSv1.h"
41 #include "PMD/AliPMDv1.h"
42 #include "T0/AliT0v1.h"
43 #include "EMCAL/AliEMCALv2.h"
44 #include "ACORDE/AliACORDEv1.h"
45 #include "VZERO/AliVZEROv7.h"
46 #endif
47
48 enum PprTrigConf_t
49 {
50     kDefaultPPTrig, kDefaultPbPbTrig
51 };
52
53 const char * pprTrigConfName[] = {
54     "p-p","Pb-Pb"
55 };
56
57 Float_t EtaToTheta(Float_t arg);
58
59 static PprTrigConf_t strig = kDefaultPPTrig;// default PP trigger configuration
60
61 void Config()
62 {
63     // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
64     // Theta range given through pseudorapidity limits 22/6/2001
65
66     // Set Random Number seed
67   gRandom->SetSeed(123456); // Set 0 to use the currecnt time
68
69
70    // libraries required by geant321
71 #if defined(__CINT__)
72     gSystem->Load("liblhapdf");
73     gSystem->Load("libEGPythia6");
74     gSystem->Load("libpythia6");
75     gSystem->Load("libAliPythia6");
76     gSystem->Load("libgeant321");
77 #endif
78
79     new     TGeant3TGeo("C++ Interface to Geant3");
80
81     AliRunLoader* rl=0x0;
82
83
84     rl = AliRunLoader::Open("galice.root",
85                             AliConfig::GetDefaultEventFolderName(),
86                             "recreate");
87     if (rl == 0x0)
88       {
89         gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
90         return;
91       }
92     rl->SetCompressionLevel(2);
93     rl->SetNumberOfEventsPerFile(3);
94     gAlice->SetRunLoader(rl);
95
96     // Set the trigger configuration
97     AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
98     cout<<"Trigger configuration is set to  "<<pprTrigConfName[strig]<<endl;
99
100     //
101     // Set External decayer
102     TVirtualMCDecayer *decayer = new AliDecayerPythia();
103
104     decayer->SetForceDecay(kAll);
105     decayer->Init();
106     gMC->SetExternalDecayer(decayer);
107     //=======================================================================
108     // ************* STEERING parameters FOR ALICE SIMULATION **************
109     // --- Specify event type to be tracked through the ALICE setup
110     // --- All positions are in cm, angles in degrees, and P and E in GeV
111
112
113     gMC->SetProcess("DCAY",1);
114     gMC->SetProcess("PAIR",1);
115     gMC->SetProcess("COMP",1);
116     gMC->SetProcess("PHOT",1);
117     gMC->SetProcess("PFIS",0);
118     gMC->SetProcess("DRAY",0);
119     gMC->SetProcess("ANNI",1);
120     gMC->SetProcess("BREM",1);
121     gMC->SetProcess("MUNU",1);
122     gMC->SetProcess("CKOV",1);
123     gMC->SetProcess("HADR",1);
124     gMC->SetProcess("LOSS",2);
125     gMC->SetProcess("MULS",1);
126     gMC->SetProcess("RAYL",1);
127
128     Float_t cut = 1.e-3;        // 1MeV cut by default
129     Float_t tofmax = 1.e10;
130
131     gMC->SetCut("CUTGAM", cut);
132     gMC->SetCut("CUTELE", cut);
133     gMC->SetCut("CUTNEU", cut);
134     gMC->SetCut("CUTHAD", cut);
135     gMC->SetCut("CUTMUO", cut);
136     gMC->SetCut("BCUTE",  cut); 
137     gMC->SetCut("BCUTM",  cut); 
138     gMC->SetCut("DCUTE",  cut); 
139     gMC->SetCut("DCUTM",  cut); 
140     gMC->SetCut("PPCUTM", cut);
141     gMC->SetCut("TOFMAX", tofmax); 
142
143     // Special generation for Valgrind tests
144     // Each detector is fired by few particles selected 
145     // to cover specific cases
146
147
148     // The cocktail iitself
149
150     AliGenCocktail *gener = new AliGenCocktail();
151     gener->SetPhiRange(0, 360);
152     // Set pseudorapidity range from -8 to 8.
153     Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
154     Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
155     gener->SetThetaRange(thmin,thmax);
156     gener->SetOrigin(0, 0, 0);  //vertex position
157     gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
158
159
160     // Particle guns for the barrel part (taken from RichConfig)
161
162     // PHOS
163
164     AliGenBox *gphos = new AliGenBox(1);
165     gphos->SetMomentumRange(10.,10.);
166     gphos->SetPhiRange(265.,275.);
167     gphos->SetThetaRange(EtaToTheta(-0.1),EtaToTheta(0.1));
168     gphos->SetPart(kElectron);
169     gener->AddGenerator(gphos,"GENBOX GAMMA for PHOS",1);
170
171     // EMCAL
172
173     AliGenBox *gemcal = new AliGenBox(1);
174     gemcal->SetMomentumRange(10.,10.);
175     gemcal->SetPhiRange(95.,100.);
176     gemcal->SetThetaRange(EtaToTheta(0.10),EtaToTheta(0.20));
177     gemcal->SetPart(kElectron);
178     gener->AddGenerator(gemcal,"GENBOX GAMMA for EMCAL",1);
179     
180     gener->Init();
181
182
183     // 
184     // Activate this line if you want the vertex smearing to happen
185     // track by track
186     //
187     //gener->SetVertexSmear(perTrack); 
188     // Field (L3 0.5 T)
189     TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
190
191     Int_t   iABSO  =  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  =  1;
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   =  1;
207     Int_t   iTRD   =  0;
208     Int_t   iZDC   =  0;
209     Int_t   iEMCAL =  1;
210     Int_t   iACORDE   =  0;
211     Int_t   iVZERO =  0;
212     rl->CdGAFile();
213     //=================== Alice BODY parameters =============================
214     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
215
216     if (iMAG)
217     {
218         //=================== MAG parameters ============================
219         // --- Start with Magnet since detector layouts may be depending ---
220         // --- on the selected Magnet dimensions ---
221         AliMAG *MAG = new AliMAG("MAG", "Magnet");
222     }
223
224
225     if (iABSO)
226     {
227         //=================== ABSO parameters ============================
228         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
229     }
230
231     if (iDIPO)
232     {
233         //=================== DIPO parameters ============================
234
235         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
236     }
237
238     if (iHALL)
239     {
240         //=================== HALL parameters ============================
241
242         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
243     }
244
245
246     if (iFRAME)
247     {
248         //=================== FRAME parameters ============================
249
250         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
251         FRAME->SetHoles(1);
252     }
253
254     if (iSHIL)
255     {
256         //=================== SHIL parameters ============================
257
258         AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
259     }
260
261
262     if (iPIPE)
263     {
264         //=================== PIPE parameters ============================
265
266         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
267     }
268  
269     if (iITS)
270     {
271         //=================== ITS parameters ============================
272
273         AliITS *ITS  = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
274     }
275
276     if (iTPC)
277     {
278         //============================ TPC parameters ===================
279         AliTPC *TPC = new AliTPCv2("TPC", "Default");
280     }
281
282
283     if (iTOF) {
284         //=================== TOF parameters ============================
285         AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
286      }
287
288
289     if (iHMPID)
290     {
291         //=================== HMPID parameters ===========================
292         AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
293
294     }
295
296
297     if (iZDC)
298     {
299         //=================== ZDC parameters ============================
300
301         AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
302     }
303
304     if (iTRD)
305     {
306         //=================== TRD parameters ============================
307
308         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
309         AliTRDgeometry *geoTRD = TRD->GetGeometry();
310         // Partial geometry: modules at 0,1,7,8,9,10,17
311         // starting at 3h in positive direction
312         geoTRD->SetSMstatus(2,0);
313         geoTRD->SetSMstatus(3,0);
314         geoTRD->SetSMstatus(4,0);
315         geoTRD->SetSMstatus(5,0);
316         geoTRD->SetSMstatus(6,0);
317         geoTRD->SetSMstatus(11,0);
318         geoTRD->SetSMstatus(12,0);
319         geoTRD->SetSMstatus(13,0);
320         geoTRD->SetSMstatus(14,0);
321         geoTRD->SetSMstatus(15,0);
322         geoTRD->SetSMstatus(16,0);
323     }
324
325     if (iFMD)
326     {
327         //=================== FMD parameters ============================
328         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
329    }
330
331     if (iMUON)
332     {
333         //=================== MUON parameters ===========================
334         // New MUONv1 version (geometry defined via builders)
335         AliMUON *MUON = new AliMUONv1("MUON","default");
336     }
337     //=================== PHOS parameters ===========================
338
339     if (iPHOS)
340     {
341         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
342     }
343
344
345     if (iPMD)
346     {
347         //=================== PMD parameters ============================
348         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
349     }
350
351     if (iT0)
352     {
353         //=================== T0 parameters ============================
354         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
355     }
356
357     if (iEMCAL)
358     {
359         //=================== EMCAL parameters ============================
360         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
361     }
362
363      if (iACORDE)
364     {
365         //=================== ACORDE parameters ============================
366         AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
367     }
368
369      if (iVZERO)
370     {
371         //=================== VZERO parameters ============================
372         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
373     }
374
375
376 }
377
378 Float_t EtaToTheta(Float_t arg){
379   return (180./TMath::Pi())*2.*atan(exp(-arg));
380 }