]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/testITSU/Config.C
Fixed alternative version, allows to access low pt's in the TPC
[u/mrichter/AliRoot.git] / ITS / UPGRADE / testITSU / 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 "EVGEN/AliGenFixed.h"
21 #include "EVGEN/AliGenBox.h"
22 #include "STEER/AliMagWrapCheb.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 "STRUCT/AliPIPEupgrade.h"
32 #include "ITS/AliITSv11.h"
33 #include "ITS/UPGRADE/AliITSUv0.h"
34 #include "TPC/AliTPCv2.h"
35 #include "TOF/AliTOFv6T0.h"
36 #include "HMPID/AliHMPIDv3.h"
37 #include "ZDC/AliZDCv3.h"
38 #include "TRD/AliTRDv1.h"
39 #include "TRD/AliTRDgeometry.h"
40 #include "FMD/AliFMDv1.h"
41 #include "MUON/AliMUONv1.h"
42 #include "PHOS/AliPHOSv1.h"
43 #include "PMD/AliPMDv1.h"
44 #include "T0/AliT0v1.h"
45 #include "EMCAL/AliEMCALv2.h"
46 #include "ACORDE/AliACORDEv1.h"
47 #include "VZERO/AliVZEROv7.h"
48 #include <TVirtualMagField.h>
49 #endif
50
51 Int_t generatorFlag = 0;
52
53 /* $Id: Config.C 47147 2011-02-07 11:46:44Z amastros $ */
54 enum PprTrigConf_t
55 {
56   kDefaultPPTrig, kDefaultPbPbTrig
57 };
58
59 const char * pprTrigConfName[] = {
60   "p-p","Pb-Pb"
61 };
62
63
64 Float_t EtaToTheta(Float_t arg);
65
66 static PprTrigConf_t strig = kDefaultPPTrig;// default PP trigger configuration
67
68 void Config()
69 {
70   // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
71   // Theta range given through pseudorapidity limits 22/6/2001
72
73   // Set Random Number seed
74   gRandom->SetSeed(1); // Set 0 to use the currecnt time
75
76
77   // libraries required by geant321
78 #if defined(__CINT__)
79   gSystem->Load("liblhapdf");
80   gSystem->Load("libEGPythia6");
81   gSystem->Load("libpythia6");
82   gSystem->Load("libAliPythia6");
83   gSystem->Load("libgeant321");
84   gSystem->Load("libhijing");   
85   gSystem->Load("libTHijing");
86 #endif
87   gSystem->Load("libITSUpgradeBase.so");
88   gSystem->Load("libITSUpgradeSim.so");
89
90
91   new     TGeant3TGeo("C++ Interface to Geant3");
92
93   AliRunLoader* rl=0x0;
94
95
96   rl = AliRunLoader::Open("galice.root",
97                           AliConfig::GetDefaultEventFolderName(),
98                           "recreate");
99   if (rl == 0x0)
100     {
101       gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
102       return;
103     }
104   rl->SetCompressionLevel(2);
105   rl->SetNumberOfEventsPerFile(2000);
106   gAlice->SetRunLoader(rl);
107
108   // Set the trigger configuration
109   // gAlice->SetTriggerDescriptor(pprTrigConfName[strig]);
110   //cout<<"Trigger configuration is set to  "<<pprTrigConfName[strig]<<endl;
111   AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
112   cout<<"Trigger configuration is set to  pprTrigConfName[strig] "<<endl;
113
114   //
115   // Set External decayer
116   TVirtualMCDecayer *decayer = new AliDecayerPythia();
117
118   decayer->SetForceDecay(kAll);
119   decayer->Init();
120   gMC->SetExternalDecayer(decayer);
121   //=======================================================================
122   // ************* STEERING parameters FOR ALICE SIMULATION **************
123   // --- Specify event type to be tracked through the ALICE setup
124   // --- All positions are in cm, angles in degrees, and P and E in GeV
125
126
127   gMC->SetProcess("DCAY",1);
128   gMC->SetProcess("PAIR",1);
129   gMC->SetProcess("COMP",1);
130   gMC->SetProcess("PHOT",1);
131   gMC->SetProcess("PFIS",0);
132   gMC->SetProcess("DRAY",0);
133   gMC->SetProcess("ANNI",1);
134   gMC->SetProcess("BREM",1);
135   gMC->SetProcess("MUNU",1);
136   gMC->SetProcess("CKOV",1);
137   gMC->SetProcess("HADR",0);
138   gMC->SetProcess("LOSS",2);
139   gMC->SetProcess("MULS",1);
140   gMC->SetProcess("RAYL",1);
141
142   Float_t cut = 1.e-3;        // 1MeV cut by default
143   Float_t tofmax = 1.e10;
144
145   gMC->SetCut("CUTGAM", cut);
146   gMC->SetCut("CUTELE", cut);
147   gMC->SetCut("CUTNEU", cut);
148   gMC->SetCut("CUTHAD", cut);
149   gMC->SetCut("CUTMUO", cut);
150   gMC->SetCut("BCUTE",  cut); 
151   gMC->SetCut("BCUTM",  cut); 
152   gMC->SetCut("DCUTE",  cut); 
153   gMC->SetCut("DCUTM",  cut); 
154   gMC->SetCut("PPCUTM", cut);
155   gMC->SetCut("TOFMAX", tofmax); 
156
157   // Special generation for Valgrind tests
158   // Each detector is fired by few particles selected 
159   // to cover specific cases
160
161
162   // The cocktail itself
163   if (generatorFlag==0) {
164     // Fast generator with parametrized pi,kaon,proton distributions
165     
166     int  nParticles = 100;//14022;
167     AliGenHIJINGpara *gener = new AliGenHIJINGpara(nParticles);
168     gener->SetMomentumRange(0.1, 10.);
169     gener->SetPhiRange(0., 360.);
170     Float_t thmin = EtaToTheta(2.5);   // theta min. <---> eta max
171     Float_t thmax = EtaToTheta(-2.5);  // theta max. <---> eta min
172     gener->SetThetaRange(thmin,thmax);
173     gener->SetOrigin(0, 0, 0);  //vertex position
174     gener->SetSigma(50e-4, 50e-4, 5.0);   //Sigma in (X,Y,Z) (cm) on IP position
175     gener->SetVertexSmear(kPerEvent);
176     gener->Init();
177     
178   }
179   else if (generatorFlag==1) {
180     int  nParticlesHP = 12000;
181     int  nPiPFlat=200;
182     int  nPiMFlat=200;
183
184     AliGenCocktail *cocktail = new AliGenCocktail();
185     cocktail->SetProjectile("A", 208, 82);
186     cocktail->SetTarget    ("A", 208, 82);
187     Float_t thmin = EtaToTheta( 2.5);   // theta min. <---> eta max
188     Float_t thmax = EtaToTheta(-2.5);  // theta max. <---> eta min 
189     cocktail->SetThetaRange(thmin,thmax);
190     cocktail->SetEnergyCMS(5500);
191     cocktail->SetOrigin(0, 0, 0);  //vertex position
192     cocktail->SetSigma(50e-4, 50e-4, 5.0);   //Sigma in (X,Y,Z) (cm) on IP position
193     cocktail->SetVertexSmear(kPerEvent);
194     cocktail->Init();  
195
196     // HijingParam + flat pion spectrum
197     
198     AliGenHIJINGpara *generH = new AliGenHIJINGpara(nParticlesHP);
199     generH->SetMomentumRange(0.1, 10.);
200     generH->SetPhiRange(0., 360.);
201     generH->SetThetaRange(thmin,thmax);
202     generH->SetOrigin(0, 0, 0);  //vertex position
203     generH->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
204     //    generH->Init();
205     //
206     cocktail->AddGenerator(generH,"hijingParam",1);
207     //
208     AliGenBox *gpipflat = new AliGenBox(nPiPFlat);
209     gpipflat->SetMomentumRange(0,10.);
210     gpipflat->SetPhiRange(0., 360.);
211     gpipflat->SetThetaRange(thmin,thmax);
212     gpipflat->SetPart(kPiPlus);
213     cocktail->AddGenerator(gpipflat,"genPiPlus",1);
214     //
215     //
216     AliGenBox *gpimflat = new AliGenBox(nPiMFlat);
217     gpimflat->SetMomentumRange(0,10.);
218     gpimflat->SetPhiRange(0., 360.);
219     gpimflat->SetThetaRange(thmin,thmax);
220     gpimflat->SetPart(kPiMinus);
221     cocktail->AddGenerator(gpimflat,"genPimus",1);
222     //
223     cocktail->Init();
224   }
225   else if (generatorFlag==2) {
226     
227     // Pure HiJing generator adapted to ~2000dNdy at highest energy
228     
229     AliGenHijing *generHijing = new AliGenHijing(-1);
230     generHijing->SetEnergyCMS(5500.); // GeV
231     generHijing->SetImpactParameterRange(0,2);
232     generHijing->SetReferenceFrame("CMS");
233     generHijing->SetProjectile("A", 208, 82);
234     generHijing->SetTarget    ("A", 208, 82);
235     generHijing->KeepFullEvent();
236     generHijing->SetJetQuenching(1);
237     generHijing->SetShadowing(1);
238     generHijing->SetSpectators(0);
239     generHijing->SetSelectAll(0);
240     generHijing->SetPtHardMin(4.5);
241     
242     AliGenerator*  gener = generHijing;
243     gener->SetSigma(50e-4, 50e-4, 5.0);   //Sigma in (X,Y,Z) (cm) on IP position
244     gener->SetVertexSmear(kPerEvent);
245     gener->Init();
246       
247   }
248   // 
249   
250
251   // 
252   // Activate this line if you want the vertex smearing to happen
253   // track by track
254   //
255   //VertexSmear_t perTrack;
256   //gener->SetVertexSmear(perTrack); 
257   // Field (L3 0.5 T)
258   //AliMagF* field = new AliMagF("map","map",2, -1.,1., 15, AliMagF::k5kGUniform);
259   //TGeoGlobalMagField::Instance()->SetField(field);
260   TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
261
262   Int_t   iABSO  =  0;
263   Int_t   iDIPO  =  0;
264   Int_t   iFMD   =  0;
265   Int_t   iFRAME =  0;
266   Int_t   iHALL  =  0;
267   Int_t   iITS   =  1;
268   Int_t   iMAG   =  0;
269   Int_t   iMUON  =  0;
270   Int_t   iPHOS  =  0;
271   Int_t   iPIPE  =  1;
272   Int_t   iPMD   =  0;
273   Int_t   iHMPID =  0;
274   Int_t   iSHIL  =  0;
275   Int_t   iT0    =  0;
276   Int_t   iTOF   =  0;
277   Int_t   iTPC   =  1;
278   Int_t   iTRD   =  0;
279   Int_t   iZDC   =  0;
280   Int_t   iEMCAL =  0;
281   Int_t   iACORDE=  0;
282   Int_t   iVZERO =  0;
283   rl->CdGAFile();
284   //=================== Alice BODY parameters =============================
285   AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
286
287   if (iMAG)
288     {
289       //=================== MAG parameters ============================
290       // --- Start with Magnet since detector layouts may be depending ---
291       // --- on the selected Magnet dimensions ---
292       AliMAG *MAG = new AliMAG("MAG", "Magnet");
293     }
294
295
296   if (iABSO)
297     {
298       //=================== ABSO parameters ============================
299       AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
300     }
301
302   if (iDIPO)
303     {
304       //=================== DIPO parameters ============================
305
306       AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
307     }
308
309   if (iHALL)
310     {
311       //=================== HALL parameters ============================
312
313       AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
314     }
315
316
317   if (iFRAME)
318     {
319       //=================== FRAME parameters ============================
320
321       AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
322       FRAME->SetHoles(1);
323     }
324
325   if (iSHIL)
326     {
327       //=================== SHIL parameters ============================
328
329       AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
330     }
331
332
333   if (iPIPE)
334     {
335       //=================== PIPE parameters ============================
336
337       AliPIPE *PIPE = new AliPIPEupgrade("PIPE", "Beam Pipe",0,1.8,0.08,40.0);
338       //AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
339     }
340  
341   if (iITS)
342     {
343       //=================== ITS parameters ============================
344       gROOT->ProcessLine(".x CreateITSU.C");
345       //    CreateITSU();
346
347     }
348  
349   if (iTPC)
350     {
351       //============================ TPC parameters ===================
352       AliTPC *TPC = new AliTPCv2("TPC", "Default");
353     }
354
355
356   if (iTOF) {
357     //=================== TOF parameters ============================
358     AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
359   }
360
361
362   if (iHMPID)
363     {
364       //=================== HMPID parameters ===========================
365       AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
366
367     }
368
369
370   if (iZDC)
371     {
372       //=================== ZDC parameters ============================
373
374       AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
375     }
376
377   if (iTRD)
378     {
379       //=================== TRD parameters ============================
380
381       AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
382       AliTRDgeometry *geoTRD = TRD->GetGeometry();
383       // Partial geometry: modules at 2,3,4,6,11,12,14,15
384       // starting at 6h in positive direction
385       geoTRD->SetSMstatus(0,0);
386       geoTRD->SetSMstatus(1,0);
387       geoTRD->SetSMstatus(5,0);
388       geoTRD->SetSMstatus(7,0);
389       geoTRD->SetSMstatus(8,0);
390       geoTRD->SetSMstatus(9,0);
391       geoTRD->SetSMstatus(10,0);
392       geoTRD->SetSMstatus(13,0);
393       geoTRD->SetSMstatus(16,0);
394       geoTRD->SetSMstatus(17,0);
395     }
396
397   if (iFMD)
398     {
399       //=================== FMD parameters ============================
400       AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
401     }
402
403   if (iMUON)
404     {
405       //=================== MUON parameters ===========================
406       // New MUONv1 version (geometry defined via builders)
407       AliMUON *MUON = new AliMUONv1("MUON","default");
408     }
409   //=================== PHOS parameters ===========================
410
411   if (iPHOS)
412     {
413       AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
414     }
415
416
417   if (iPMD)
418     {
419       //=================== PMD parameters ============================
420       AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
421     }
422
423   if (iT0)
424     {
425       //=================== T0 parameters ============================
426       AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
427     }
428
429   if (iEMCAL)
430     {
431       //=================== EMCAL parameters ============================
432       AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1");
433     }
434
435   if (iACORDE)
436     {
437       //=================== ACORDE parameters ============================
438       AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
439     }
440
441   if (iVZERO)
442     {
443       //=================== VZERO parameters ============================
444       AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
445     }
446
447
448 }
449
450 Float_t EtaToTheta(Float_t arg){
451   return (180./TMath::Pi())*2.*atan(exp(-arg));
452 }
453