]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/ConfigHBT.C
Updated version of ITS geometry (M/Masera)
[u/mrichter/AliRoot.git] / macros / ConfigHBT.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,"ConfigHBT.C++")
6
7 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include <Riostream.h>
9 #include <TRandom.h>
10 #include <TSystem.h>
11 #include <TVirtualMC.h>
12 #include <TGeant3.h>
13 #include "STEER/AliRunLoader.h"
14 #include "STEER/AliRun.h"
15 #include "STEER/AliConfig.h"
16 #include "PYTHIA6/AliDecayerPythia.h"
17 #include "EVGEN/AliGenCocktailAfterBurner.h"
18 #include "TMEVSIM/AliMevSimConfig.h"
19 #include "TMEVSIM/AliMevSimParticle.h"
20 #include "TMEVSIM/AliGenMevSim.h"
21 #include "THbtp/AliGenHBTprocessor.h"
22 #include "STRUCT/AliBODY.h"
23 #include "STRUCT/AliMAG.h"
24 #include "STRUCT/AliABSOv0.h"
25 #include "STRUCT/AliDIPOv2.h"
26 #include "STRUCT/AliHALL.h"
27 #include "STRUCT/AliFRAMEv2.h"
28 #include "STRUCT/AliSHILv2.h"
29 #include "STRUCT/AliPIPEv0.h"
30 #include "ITS/AliITSvPPRasymmFMD.h"
31 #include "TPC/AliTPCv2.h"
32 #include "TOF/AliTOFv2.h"
33 #include "RICH/AliRICHv1.h"
34 #include "ZDC/AliZDCv1.h"
35 #include "TRD/AliTRDv1.h"
36 #include "FMD/AliFMDv1.h"
37 #include "MUON/AliMUONv1.h"
38 #include "PHOS/AliPHOSv1.h"
39 #include "PMD/AliPMDv1.h"
40 #include "START/AliSTARTv1.h"
41 #include "EMCAL/AliEMCALv1.h"
42 #include "CRT/AliCRTv1.h"
43 #include "VZERO/AliVZEROv2.h"
44 #endif
45
46 void Config()
47 {
48     // Set Random Number seed
49     // gRandom->SetSeed(12345);
50
51    // libraries required by geant321
52 #if defined(__CINT__)
53     gSystem->Load("libgeant321");
54 #endif
55
56     new     TGeant3("C++ Interface to Geant3");
57
58     cout<<"Config.C: Creating Run Loader ..."<<endl;
59     AliRunLoader* rl = AliRunLoader::Open("galice.root",AliConfig::fgkDefaultEventFolderName,
60                                               "recreate");
61     if (rl == 0x0)
62       {
63         gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
64         return;
65       }
66     rl->SetCompressionLevel(2);
67     rl->SetNumberOfEventsPerFile(6);        
68     gAlice->SetRunLoader(rl);
69
70     //
71     // Set External decayer
72     AliDecayer *decayer = new AliDecayerPythia();
73
74     decayer->SetForceDecay(kAll);
75     decayer->Init();
76     gMC->SetExternalDecayer(decayer);
77     //
78     //=======================================================================
79     // ************* STEERING parameters FOR ALICE SIMULATION **************
80     // --- Specify event type to be tracked through the ALICE setup
81     // --- All positions are in cm, angles in degrees, and P and E in GeV
82
83
84
85     gMC->SetProcess("DCAY",1);
86     gMC->SetProcess("PAIR",1);
87     gMC->SetProcess("COMP",1);
88     gMC->SetProcess("PHOT",1);
89     gMC->SetProcess("PFIS",0);
90     gMC->SetProcess("DRAY",0);
91     gMC->SetProcess("ANNI",1);
92     gMC->SetProcess("BREM",1);
93     gMC->SetProcess("MUNU",1);
94     gMC->SetProcess("CKOV",1);
95     gMC->SetProcess("HADR",1);
96     gMC->SetProcess("LOSS",2);
97     gMC->SetProcess("MULS",1);
98     gMC->SetProcess("RAYL",1);
99
100     Float_t cut = 1.e-3;        // 1MeV cut by default
101     Float_t tofmax = 1.e10;
102
103     gMC->SetCut("CUTGAM", cut);
104     gMC->SetCut("CUTELE", cut);
105     gMC->SetCut("CUTNEU", cut);
106     gMC->SetCut("CUTHAD", cut);
107     gMC->SetCut("CUTMUO", cut);
108     gMC->SetCut("BCUTE",  cut); 
109     gMC->SetCut("BCUTM",  cut); 
110     gMC->SetCut("DCUTE",  cut); 
111     gMC->SetCut("DCUTM",  cut); 
112     gMC->SetCut("PPCUTM", cut);
113     gMC->SetCut("TOFMAX", tofmax); 
114
115
116     if (gSystem->Getenv("CONFIG_NPARTICLES"))
117     {
118         int     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
119     } else
120     {
121         int     nParticles = 10000;
122     }
123     
124     /*********************************************************************************/
125     /*********************************************************************************/
126     /*****************     G E N E R A T O R S       *********************************/    
127
128     /**  C O C K T A I L   W I T H   A F T E R B U R N E R S   A F T E R W A R D S  **/    
129     /*****************        (WRAPPER GENERATOR)    *********************************/    
130
131
132     
133     AliGenCocktailAfterBurner* gener = new AliGenCocktailAfterBurner();
134     gener->SetPhiRange(0, 360);
135     gener->SetThetaRange(40., 140.);
136     gener->SetOrigin(0, 0, 0);  //vertex position
137     gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
138     
139     /*****************     HIJING PARAMETRIZATION    ********************************/    
140     
141     //AliGenHIJINGpara *g2 = new AliGenHIJINGpara(5);
142     //g2->SetMomentumRange(0, 999);
143     
144     /*****************        G E N   B O X       ***********************************/    
145     
146    // AliGenBox *g1 = new AliGenBox(5);
147    // g1->SetMomentumRange(0, 3);
148    // g1->SetOrigin(0,0,0);        //vertex position
149    // g1->SetSigma(0,0,0);         //Sigma in (X,Y,Z) (cm) on IP position
150    // g1->SetPart(310);        //K0short(310), Lambda(3122)
151    
152
153     /*****************     M E V S I M    ********************************/    
154     
155     AliMevSimConfig *c = new AliMevSimConfig(1);
156     c->SetRectPlane(1);                                 // reaction plane control, model 4
157     c->SetGrid(80,80);
158     
159     AliGenMevSim *g3 = new AliGenMevSim(c);
160     g3->SetPtRange(0.001, 3); 
161     g3->SetMomentumRange(0.1, 3); 
162     
163     g3->SetTrackingFlag(1);
164     g3->SetOrigin(0.0, 0.0, 0.0);
165     g3->SetSigma(0.0, 0.0, 0.0);
166     //g3->SetEtaCutRange(-4,4);       
167  
168     AliMevSimParticle *piPlus = new AliMevSimParticle(kPiPlus, 100, 3, 0.2, 0.01, 3, 0.1, 0.0, 0.0);
169     AliMevSimParticle *piMinus = new AliMevSimParticle(kPiMinus, 100, 3, 0.2, 0.01, 3, 0.1, 0.0, 0.0);
170     //AliMevSimParticle *KPlus = new AliMevSimParticle(kKPlus, 10, 0, 0.25, 0.0, 2, 0.15, 0.0, 0.0 );
171     //AliMevSimParticle *KMinus = new AliMevSimParticle(kKMinus, 10, 0, 0.25, 0.0, 2, 0.15, 0.0, 0.0 );
172     //AliMevSimParticle *protonPlus = new AliMevSimParticle(kProton, 3, 0,  0.4, 0.0, 2, 0.15, 0.0, 0.0);
173     //AliMevSimParticle *protonMinus = new AliMevSimParticle(kProtonBar, 2, 0, 0.4, 0.0, 2, 0.15, 0.0, 0.0);
174  
175     g3->AddParticleType(piPlus);
176     g3->AddParticleType(piMinus);
177     //g3->AddParticleType(KPlus);
178     //g3->AddParticleType(KMinus);
179     //g3->AddParticleType(protonPlus);
180     //g3->AddParticleType(protonMinus);
181     
182     
183     /*****************     H B T   P R O C E S S O R    ********************************/    
184     
185     AliGenHBTprocessor *hbtp = new AliGenHBTprocessor();
186     hbtp->SetRefControl(2);
187     hbtp->SetSwitch1D(1);
188     hbtp->SetSwitch3D(1);
189     hbtp->SetSwitchCoulomb(1);
190     hbtp->SetSwitchCoherence(0);
191     hbtp->SetSwitchFermiBose(-1);
192     hbtp->SetDeltap(0.1);
193     hbtp->SetDelChi(0.1);
194     hbtp->SetLambda(0.5);
195     hbtp->SetQ0(8.0);
196     hbtp->SetR0(8.0);
197     hbtp->SetRParallel(8.0);
198     hbtp->SetR1d(8.0);
199     hbtp->SetRSide(8.0);
200     hbtp->SetRLong(8.0);
201     hbtp->SetROut(8.0);
202     hbtp->SetPtRange(0.1,0.98);
203     hbtp->SetPIDs(211,-211); //pi+ pi-
204     hbtp->SetSwitchType(3);  // fit both the like and unlike pair correl
205     hbtp->SetMaxIterations(300);
206     /***********************************************************************************/
207     
208    // gener->AddGenerator(g2,"HIJING PARAMETRIZATION",1);
209    // gener->AddGenerator(g1,"BOX (K0short)",1);
210     gener->AddGenerator(g3,"MEVSIM",1);
211     
212     gener->AddAfterBurner(hbtp,"HBT PROCESSOR",1);
213     
214     gener->Init();
215     // 
216     // Activate this line if you want the vertex smearing to happen
217     // track by track
218     //
219     //gener->SetVertexSmear(perTrack); 
220
221     gAlice->SetField(-999, 2);  //Specify maximum magnetic field in Tesla (neg. ==> default field)
222 //    gAlice->SetField(-999, 2, 2.);  //Specify maximum magnetic field in Tesla (neg. ==> default field)
223      //Last number indicates the scale factor 
224
225     Int_t   iABSO = 1;
226     Int_t   iCRT = 0;
227     Int_t   iDIPO = 1;
228     Int_t   iFMD = 0;
229     Int_t   iFRAME = 1;
230     Int_t   iHALL = 1;
231     Int_t   iITS = 1;
232     Int_t   iMAG = 1;
233     Int_t   iMUON = 0;
234     Int_t   iPHOS = 0;
235     Int_t   iPIPE = 1;
236     Int_t   iPMD = 0;
237     Int_t   iRICH = 0;
238     Int_t   iSHIL = 1;
239     Int_t   iSTART = 0;
240     Int_t   iTOF = 0;
241     Int_t   iTPC = 1;
242     Int_t   iTRD = 0;
243     Int_t   iZDC = 0;
244     Int_t   iEMCAL = 0;
245
246     //=================== Alice BODY parameters =============================
247     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
248
249
250     if (iMAG)
251     {
252         //=================== MAG parameters ============================
253         // --- Start with Magnet since detector layouts may be depending ---
254         // --- on the selected Magnet dimensions ---
255         AliMAG *MAG = new AliMAG("MAG", "Magnet");
256     }
257
258
259     if (iABSO)
260     {
261         //=================== ABSO parameters ============================
262         AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
263     }
264
265     if (iDIPO)
266     {
267         //=================== DIPO parameters ============================
268
269         AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
270     }
271
272     if (iHALL)
273     {
274         //=================== HALL parameters ============================
275
276         AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
277     }
278
279
280     if (iFRAME)
281     {
282         //=================== FRAME parameters ============================
283
284         AliFRAME *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
285
286     }
287
288     if (iSHIL)
289     {
290         //=================== SHIL parameters ============================
291
292         AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding");
293     }
294
295
296     if (iPIPE)
297     {
298         //=================== PIPE parameters ============================
299
300         AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
301     }
302  
303   if(iITS) {
304
305 //=================== ITS parameters ============================
306     //
307     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
308     // almost all other detectors. This involves the fact that the ITS geometry
309     // still has several options to be followed in parallel in order to determine
310     // the best set-up which minimizes the induced background. All the geometries
311     // available to date are described in the following. Read carefully the comments
312     // and use the default version (the only one uncommented) unless you are making
313     // comparisons and you know what you are doing. In this case just uncomment the
314     // ITS geometry you want to use and run Aliroot.
315     //
316     // Detailed geometries:         
317     //
318     //
319     //AliITS *ITS  = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
320     //
321     //AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
322     //
323     AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
324     ITS->SetMinorVersion(2); // don't touch this parameter if you're not an ITS developer
325     ITS->SetReadDet(kTRUE);  // don't touch this parameter if you're not an ITS developer
326     //    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
327     ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
328     ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
329     ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [150,300]
330     ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [150,300]
331     ITS->SetRails(1);              // 1 --> rails in ; 0 --> rails out
332     ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
333     //
334     //AliITSvPPRsymm *ITS  = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric services");
335     //ITS->SetMinorVersion(2);                                       // don't touch this parameter if you're not an ITS developer
336     //ITS->SetReadDet(kFALSE);                                       // don't touch this parameter if you're not an ITS developer
337     //ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRsymm2.det"); // don't touch this parameter if you're not an ITS developer
338     //ITS->SetThicknessDet1(300.);   // detector thickness on layer 1 must be in the range [100,300]
339     //ITS->SetThicknessDet2(300.);   // detector thickness on layer 2 must be in the range [100,300]
340     //ITS->SetThicknessChip1(300.);  // chip thickness on layer 1 must be in the range [150,300]
341     //ITS->SetThicknessChip2(300.);  // chip thickness on layer 2 must be in the range [150,300]
342     //ITS->SetRails(1);              // 1 --> rails in ; 0 --> rails out
343     //ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
344     //
345     //
346     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
347     // for reconstruction !):
348     //                                                     
349     //
350     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
351     //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
352     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
353     //
354     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
355     //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
356     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
357     //                      
358     //
359     //
360     // Geant3 <-> EUCLID conversion
361     // ============================
362     //
363     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
364     // media to two ASCII files (called by default ITSgeometry.euc and
365     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
366     // The default (=0) means that you dont want to use this facility.
367     //
368     ITS->SetEUCLID(0);  
369   }
370   
371
372     if (iTPC)
373     {
374         //============================ TPC parameters ================================
375         // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
376         // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
377         // --- sectors are specified, any value other than that requires at least one 
378         // --- sector (lower or upper)to be specified!
379         // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
380         // ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
381         // --- SecLows - number of lower sectors specified (up to 6)
382         // --- SecUps - number of upper sectors specified (up to 12)
383         // --- Sens - sensitive strips for the Slow Simulator !!!
384         // --- This does NOT work if all S or L-sectors are specified, i.e.
385         // --- if SecAL or SecAU < 0
386         //
387         //
388         //-----------------------------------------------------------------------------
389
390         //  gROOT->LoadMacro("SetTPCParam.C");
391         //  AliTPCParam *param = SetTPCParam();
392         AliTPC *TPC = new AliTPCv2("TPC", "Default");
393
394         // All sectors included 
395         TPC->SetSecAL(-1);
396         TPC->SetSecAU(-1);
397
398     }
399
400     if (iTOF)
401     {
402         //=================== TOF parameters ============================
403         AliTOF *TOF = new AliTOFv2("TOF", "normal TOF");
404     }
405
406     if (iRICH)
407     {
408         //=================== RICH parameters ===========================
409         AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
410
411     }
412
413
414     if (iZDC)
415     {
416         //=================== ZDC parameters ============================
417
418         AliZDC *ZDC = new AliZDCv1("ZDC", "normal ZDC");
419     }
420
421     if (iCRT)
422     {
423         //=================== CRT parameters ============================
424
425         AliCRT *CRT = new AliCRTv1("CRT", "normal CRT");
426     }
427
428     if (iTRD)
429     {
430         //=================== TRD parameters ============================
431
432         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
433
434         // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
435         TRD->SetGasMix(1);
436
437         // With hole in front of PHOS
438         TRD->SetPHOShole();
439         // With hole in front of RICH
440         TRD->SetRICHhole();
441         // Switch on TR
442         AliTRDsim *TRDsim = TRD->CreateTR();
443     }
444
445     if (iFMD)
446     {
447         //=================== FMD parameters ============================
448
449         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
450     }
451
452     if (iMUON)
453     {
454         //=================== MUON parameters ===========================
455
456         AliMUON *MUON = new AliMUONv1("MUON", "default");
457     }
458     //=================== PHOS parameters ===========================
459
460     if (iPHOS)
461     {
462         AliPHOS *PHOS = new AliPHOSv1("PHOS", "GPS2");
463     }
464
465
466     if (iPMD)
467     {
468         //=================== PMD parameters ============================
469
470         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
471
472         PMD->SetPAR(1., 1., 0.8, 0.02);
473         PMD->SetIN(6., 18., -580., 27., 27.);
474         PMD->SetGEO(0.0, 0.2, 4.);
475         PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
476
477     }
478     if (iEMCAL && !iRICH)
479     {
480         //=================== EMCAL parameters ============================
481         AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCALArch1a");
482     }
483
484     if (iSTART)
485     {
486         //=================== START parameters ============================
487         AliSTART *START = new AliSTARTv1("START", "START Detector");
488     }
489
490
491 }