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