]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/UPGRADE/testITSU/Config.C
store also difference in local Y
[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   else if (generatorFlag==3) {
249     
250     // Pure Pythia6 generator
251     AliGenPythia *generPy = new AliGenPythia(-1); 
252     generPy->SetMomentumRange(0,999999);
253     generPy->SetThetaRange(0., 180.);
254     generPy->SetYRange(-2.5,2.5);
255     generPy->SetPtRange(0,1000);
256     generPy->SetProcess(kPyMb);
257     generPy->SetEnergyCMS(14000.);
258     generPy->SetProjectile("p", 1, 1) ; 
259     generPy->SetTarget("p", 1, 1) ; 
260     generPy->SetSigma(50e-4, 50e-4, 5.0);   //Sigma in (X,Y,Z) (cm) on IP position
261     generPy->SetVertexSmear(kPerEvent);
262     generPy->Init();
263     //
264   }
265   // 
266   
267
268   // 
269   // Activate this line if you want the vertex smearing to happen
270   // track by track
271   //
272   //VertexSmear_t perTrack;
273   //gener->SetVertexSmear(perTrack); 
274   // Field (L3 0.5 T)
275   //AliMagF* field = new AliMagF("map","map",2, -1.,1., 15, AliMagF::k5kGUniform);
276   //TGeoGlobalMagField::Instance()->SetField(field);
277   TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG));
278
279   Int_t   iABSO  =  0;
280   Int_t   iDIPO  =  0;
281   Int_t   iFMD   =  0;
282   Int_t   iFRAME =  0;
283   Int_t   iHALL  =  0;
284   Int_t   iITS   =  1;
285   Int_t   iMAG   =  0;
286   Int_t   iMUON  =  0;
287   Int_t   iPHOS  =  0;
288   Int_t   iPIPE  =  1;
289   Int_t   iPMD   =  0;
290   Int_t   iHMPID =  0;
291   Int_t   iSHIL  =  0;
292   Int_t   iT0    =  0;
293   Int_t   iTOF   =  0;
294   Int_t   iTPC   =  1;
295   Int_t   iTRD   =  0;
296   Int_t   iZDC   =  0;
297   Int_t   iEMCAL =  0;
298   Int_t   iACORDE=  0;
299   Int_t   iVZERO =  0;
300   rl->CdGAFile();
301   //=================== Alice BODY parameters =============================
302   AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
303
304   if (iMAG)
305     {
306       //=================== MAG parameters ============================
307       // --- Start with Magnet since detector layouts may be depending ---
308       // --- on the selected Magnet dimensions ---
309       AliMAG *MAG = new AliMAG("MAG", "Magnet");
310     }
311
312
313   if (iABSO)
314     {
315       //=================== ABSO parameters ============================
316       AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
317     }
318
319   if (iDIPO)
320     {
321       //=================== DIPO parameters ============================
322
323       AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
324     }
325
326   if (iHALL)
327     {
328       //=================== HALL parameters ============================
329
330       AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
331     }
332
333
334   if (iFRAME)
335     {
336       //=================== FRAME parameters ============================
337
338       AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
339       FRAME->SetHoles(1);
340     }
341
342   if (iSHIL)
343     {
344       //=================== SHIL parameters ============================
345
346       AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
347     }
348
349
350   if (iPIPE)
351     {
352       //=================== PIPE parameters ============================
353
354       AliPIPE *PIPE = new AliPIPEupgrade("PIPE", "Beam Pipe",0,1.8,0.08,40.0);
355       //AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
356     }
357  
358   if (iITS)
359     {
360       //=================== ITS parameters ============================
361       gROOT->ProcessLine(".x CreateITSU.C");
362       //    CreateITSU();
363
364     }
365  
366   if (iTPC)
367     {
368       //============================ TPC parameters ===================
369       AliTPC *TPC = new AliTPCv2("TPC", "Default");
370     }
371
372
373   if (iTOF) {
374     //=================== TOF parameters ============================
375     AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
376   }
377
378
379   if (iHMPID)
380     {
381       //=================== HMPID parameters ===========================
382       AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
383
384     }
385
386
387   if (iZDC)
388     {
389       //=================== ZDC parameters ============================
390
391       AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
392     }
393
394   if (iTRD)
395     {
396       //=================== TRD parameters ============================
397
398       AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
399       AliTRDgeometry *geoTRD = TRD->GetGeometry();
400       // Partial geometry: modules at 2,3,4,6,11,12,14,15
401       // starting at 6h in positive direction
402       geoTRD->SetSMstatus(0,0);
403       geoTRD->SetSMstatus(1,0);
404       geoTRD->SetSMstatus(5,0);
405       geoTRD->SetSMstatus(7,0);
406       geoTRD->SetSMstatus(8,0);
407       geoTRD->SetSMstatus(9,0);
408       geoTRD->SetSMstatus(10,0);
409       geoTRD->SetSMstatus(13,0);
410       geoTRD->SetSMstatus(16,0);
411       geoTRD->SetSMstatus(17,0);
412     }
413
414   if (iFMD)
415     {
416       //=================== FMD parameters ============================
417       AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
418     }
419
420   if (iMUON)
421     {
422       //=================== MUON parameters ===========================
423       // New MUONv1 version (geometry defined via builders)
424       AliMUON *MUON = new AliMUONv1("MUON","default");
425     }
426   //=================== PHOS parameters ===========================
427
428   if (iPHOS)
429     {
430       AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
431     }
432
433
434   if (iPMD)
435     {
436       //=================== PMD parameters ============================
437       AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
438     }
439
440   if (iT0)
441     {
442       //=================== T0 parameters ============================
443       AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
444     }
445
446   if (iEMCAL)
447     {
448       //=================== EMCAL parameters ============================
449       AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1");
450     }
451
452   if (iACORDE)
453     {
454       //=================== ACORDE parameters ============================
455       AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
456     }
457
458   if (iVZERO)
459     {
460       //=================== VZERO parameters ============================
461       AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
462     }
463
464
465 }
466
467 Float_t EtaToTheta(Float_t arg){
468   return (180./TMath::Pi())*2.*atan(exp(-arg));
469 }
470