]> git.uio.no Git - u/mrichter/AliRoot.git/blob - macros/ConfigCharmPPR.C
aa5d01bf1f5cb6842a3f0a5ec8e3b1dfc146cc60
[u/mrichter/AliRoot.git] / macros / ConfigCharmPPR.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <Riostream.h>
3 #include <TRandom.h>
4 #include <TDatime.h>
5 #include <TSystem.h>
6 #include <TVirtualMC.h>
7 #include <TGeant3.h>
8 #include "STEER/AliRunLoader.h"
9 #include "STEER/AliRun.h"
10 #include "STEER/AliConfig.h"
11 #include "PYTHIA6/AliDecayerPythia.h"
12 #include "PYTHIA6/AliGenPythia.h"
13 #include "STEER/AliMagFCM.h"
14 #include "STRUCT/AliBODY.h"
15 #include "STRUCT/AliMAG.h"
16 #include "STRUCT/AliABSOv0.h"
17 #include "STRUCT/AliDIPOv2.h"
18 #include "STRUCT/AliHALL.h"
19 #include "STRUCT/AliFRAMEv2.h"
20 #include "STRUCT/AliSHILv2.h"
21 #include "STRUCT/AliPIPEv0.h"
22 #include "ITS/AliITSvPPRasymm.h"
23 #include "TPC/AliTPCv2.h"
24 #include "TOF/AliTOFv4T0.h"
25 #include "RICH/AliRICHv1.h"
26 #include "ZDC/AliZDCv1.h"
27 #include "TRD/AliTRDv1.h"
28 #include "FMD/AliFMDv0.h"
29 #include "MUON/AliMUONv1.h"
30 #include "MUON/AliMUONSt1GeometryBuilder.h"
31 #include "MUON/AliMUONSt2GeometryBuilder.h"
32 #include "MUON/AliMUONSlatGeometryBuilder.h"
33 #include "MUON/AliMUONTriggerGeometryBuilder.h"
34 #include "PHOS/AliPHOSv1.h"
35 #include "PMD/AliPMDv1.h"
36 #include "START/AliSTARTv1.h"
37 #include "CRT/AliCRTv1.h"
38 #endif
39
40 void Config()
41 {
42  
43   //
44   // Set Random Number seed
45   TDatime dt;
46   UInt_t curtime=dt.Get();
47   UInt_t procid=gSystem->GetPid();
48   UInt_t seed=curtime-procid;
49
50   //  gRandom->SetSeed(seed);
51   gRandom->SetSeed(12345);
52   cerr<<"Seed for random number generation= "<<seed<<endl; 
53
54    // libraries required by geant321
55 #if defined(__CINT__)
56     gSystem->Load("libgeant321");
57 #endif
58
59   new TGeant3("C++ Interface to Geant3");
60
61   //=======================================================================
62   //  Create the output file
63    
64   AliRunLoader* rl=0x0;
65
66   cout<<"Config.C: Creating Run Loader ..."<<endl;
67   rl = AliRunLoader::Open("galice.root",
68                           AliConfig::GetDefaultEventFolderName(),
69                           "recreate");
70   if (rl == 0x0)
71     {
72       gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
73       return;
74     }
75   rl->SetCompressionLevel(2);
76   rl->SetNumberOfEventsPerFile(3);
77   gAlice->SetRunLoader(rl);
78
79  //
80   // Set External decayer
81   AliDecayer* decayer = new AliDecayerPythia();
82   decayer->SetForceDecay(kAll);
83   decayer->Init();
84   gMC->SetExternalDecayer(decayer);
85
86
87   //
88   //=======================================================================
89   // ************* STEERING parameters FOR ALICE SIMULATION **************
90   // --- Specify event type to be tracked through the ALICE setup
91   // --- All positions are in cm, angles in degrees, and P and E in GeV
92
93
94   gMC->SetProcess("DCAY",1);
95   gMC->SetProcess("PAIR",1);
96   gMC->SetProcess("COMP",1);
97   gMC->SetProcess("PHOT",1);
98   gMC->SetProcess("PFIS",0);
99   gMC->SetProcess("DRAY",0);
100   gMC->SetProcess("ANNI",1);
101   gMC->SetProcess("BREM",1);
102   gMC->SetProcess("MUNU",1);
103   gMC->SetProcess("CKOV",1);
104   gMC->SetProcess("HADR",1);
105   gMC->SetProcess("LOSS",2);
106   gMC->SetProcess("MULS",1);
107   gMC->SetProcess("RAYL",1);
108   
109   Float_t cut = 1.e-3;        // 1MeV cut by default
110   Float_t tofmax = 1.e10;
111
112   gMC->SetCut("CUTGAM", cut);
113   gMC->SetCut("CUTELE", cut);
114   gMC->SetCut("CUTNEU", cut);
115   gMC->SetCut("CUTHAD", cut);
116   gMC->SetCut("CUTMUO", cut);
117   gMC->SetCut("BCUTE",  cut); 
118   gMC->SetCut("BCUTM",  cut); 
119   gMC->SetCut("DCUTE",  cut); 
120   gMC->SetCut("DCUTM",  cut); 
121   gMC->SetCut("PPCUTM", cut);
122   gMC->SetCut("TOFMAX", tofmax); 
123   
124
125   // AliGenPythia *gener = new AliGenPythia(ntracks);
126   AliGenPythia *gener = new AliGenPythia(-1);
127
128   gener->SetMomentumRange(0,999);
129   gener->SetPhiRange(0., 360.);
130   gener->SetThetaRange(0,180);
131   gener->SetYRange(-999,999);
132   //gener->SetPtRange(0,100);
133   gener->SetOrigin(0,0,0);          // vertex position
134   //gener->SetVertexSmear(kPerEvent); 
135   gener->SetSigma(0,0,5.3);  // Sigma in (X,Y,Z) (cm) on IP position
136   gener->SetTrackingFlag(0);
137   // gener->SetForceDecay(kHadronicD);
138
139   //
140   // The following settings select the Pythia parameters tuned to agree
141   // with charm NLO calculation for Pb-Pb @ 5.5 TeV with MNR code.
142   //
143   gener->SetProcess(kPyCharmPbPbMNR);
144   gener->SetStrucFunc(kCTEQ4L);
145   gener->SetPtHard(2.1,-1.0);
146   gener->SetEnergyCMS(5500.);
147   gener->SetNuclei(208,208); // Pb-Pb collisions
148
149   gener->Init();
150   // 
151   // Activate this line if you want the vertex smearing to happen
152   // track by track
153   //
154   //gener->SetVertexSmear(perTrack); 
155
156   // Field (L3 0.4 T)
157   AliMagFCM* field = new AliMagFCM(
158                      "Map2","$(ALICE_ROOT)/data/field01.dat", 2, 1., 10.);
159   field->SetSolenoidField(4.);
160   gAlice->SetField(field);    
161
162   Int_t iABSO=0;
163   Int_t iCRT=0;
164   Int_t iDIPO=0;
165   Int_t iFMD=0;
166   Int_t iFRAME=0;
167   Int_t iHALL=0;
168   Int_t iITS=0;
169   Int_t iMAG=0;
170   Int_t iMUON=0;
171   Int_t iPHOS=0;
172   Int_t iPIPE=0;
173   Int_t iPMD=0;
174   Int_t iRICH=0;
175   Int_t iSHIL=0;
176   Int_t iSTART=0;
177   Int_t iTOF=0;
178   Int_t iTPC=0;
179   Int_t iTRD=0;
180   Int_t iZDC=0;
181
182   //=================== Alice BODY parameters =============================
183   AliBODY *BODY = new AliBODY("BODY","Alice envelop");
184
185   if(iMAG) {
186     //=================== MAG parameters ============================
187     // --- Start with Magnet since detector layouts may be depending ---
188     // --- on the selected Magnet dimensions ---
189     AliMAG *MAG  = new AliMAG("MAG","Magnet");
190   }
191
192
193   if(iABSO) {
194     //=================== ABSO parameters ============================
195     AliABSO *ABSO  = new AliABSOv0("ABSO","Muon Absorber");
196   }
197
198   if(iDIPO) {
199     //=================== DIPO parameters ============================
200
201     AliDIPO *DIPO  = new AliDIPOv2("DIPO","Dipole version 2");
202   }
203
204   if(iHALL) {
205     //=================== HALL parameters ============================
206
207     AliHALL *HALL  = new AliHALL("HALL","Alice Hall");
208   }
209
210
211   if(iFRAME) {
212     //=================== FRAME parameters ============================
213
214     AliFRAME *FRAME  = new AliFRAMEv2("FRAME","Space Frame");
215
216   }
217
218   if(iSHIL) {
219     //=================== SHIL parameters ============================
220
221     AliSHIL *SHIL  = new AliSHILv2("SHIL","Shielding");
222   }
223
224
225   if(iPIPE) {
226     //=================== PIPE parameters ============================
227
228     AliPIPE *PIPE  = new AliPIPEv0("PIPE","Beam Pipe");
229   }
230
231
232   if(iITS) {
233
234 //=================== ITS parameters ============================
235     //
236     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
237     // almost all other detectors. This involves the fact that the ITS geometry
238     // still has several options to be followed in parallel in order to determine
239     // the best set-up which minimizes the induced background. All the geometries
240     // available to date are described in the following. Read carefully the comments
241     // and use the default version (the only one uncommented) unless you are making
242     // comparisons and you know what you are doing. In this case just uncomment the
243     // ITS geometry you want to use and run Aliroot.
244     //
245     // Detailed geometries:         
246     //
247     //
248     //AliITS *ITS  = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
249     //
250     //AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
251     //
252     AliITSvPPRasymm *ITS  = new AliITSvPPRasymm("ITS","New ITS PPR detailed version with asymmetric services");
253     ITS->SetMinorVersion(2);                                         // don't touch this parameter if you're not an ITS developer
254     ITS->SetReadDet(kFALSE);                                         // don't touch this parameter if you're not an ITS developer
255     ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
256     ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [150,300]
257     ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [150,300]
258     ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [100,300]
259     ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [100,300]
260     ITS->SetRails(1);              // 1 --> rails in ; 0 --> rails out
261     ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
262     //
263     //AliITSvPPRsymm *ITS  = new AliITSvPPRsymm("ITS","New ITS PPR detailed version with symmetric services");
264     //ITS->SetMinorVersion(2);                                       // don't touch this parameter if you're not an ITS developer
265     //ITS->SetReadDet(kFALSE);                                       // don't touch this parameter if you're not an ITS developer
266     //ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRsymm2.det"); // don't touch this parameter if you're not an ITS developer
267     //ITS->SetThicknessDet1(300.);   // detector thickness on layer 1 must be in the range [150,300]
268     //ITS->SetThicknessDet2(300.);   // detector thickness on layer 2 must be in the range [150,300]
269     //ITS->SetThicknessChip1(300.);  // chip thickness on layer 1 must be in the range [100,300]
270     //ITS->SetThicknessChip2(300.);  // chip thickness on layer 2 must be in the range [100,300]
271     //ITS->SetRails(1);              // 1 --> rails in ; 0 --> rails out
272     //ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
273     //
274     //
275     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
276     // for reconstruction !):
277     //                                                     
278     //
279     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
280     //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
281     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
282     //
283     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
284     //ITS->SetRails(1);                // 1 --> rails in ; 0 --> rails out
285     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
286     //                      
287     //
288     //
289     // Geant3 <-> EUCLID conversion
290     // ============================
291     //
292     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
293     // media to two ASCII files (called by default ITSgeometry.euc and
294     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
295     // The default (=0) means that you dont want to use this facility.
296     //
297     ITS->SetEUCLID(0);  
298   }
299   
300
301   if(iTPC) {
302     //============================ TPC parameters ================================
303     // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
304     // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
305     // --- sectors are specified, any value other than that requires at least one 
306     // --- sector (lower or upper)to be specified!
307     // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
308     // ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
309     // --- SecLows - number of lower sectors specified (up to 6)
310     // --- SecUps - number of upper sectors specified (up to 12)
311     // --- Sens - sensitive strips for the Slow Simulator !!!
312     // --- This does NOT work if all S or L-sectors are specified, i.e.
313     // --- if SecAL or SecAU < 0
314     //
315     //
316     //-----------------------------------------------------------------------------
317
318     //  gROOT->LoadMacro("SetTPCParam.C");
319     //  AliTPCParam *param = SetTPCParam();
320     AliTPC *TPC  = new AliTPCv2("TPC","Default");
321     // All sectors included 
322     TPC->SetSecAL(-1);
323     TPC->SetSecAU(-1);
324
325   }
326
327
328   if(iTOF) {
329     //=================== TOF parameters ============================
330     AliTOF *TOF  = new AliTOFv4T0("TOF","normal TOF");
331   }
332
333   if(iRICH) {
334     //=================== RICH parameters ===========================
335     AliRICH *RICH  = new AliRICHv1("RICH","normal RICH");    
336
337   }
338
339
340   if(iZDC) {
341     //=================== ZDC parameters ============================
342
343     AliZDC *ZDC  = new AliZDCv1("ZDC","normal ZDC");
344   }
345
346   if(iCRT) {
347     //=================== CRT parameters ============================
348
349     AliCRT *CRT  = new AliCRTv1("CRT","normal CRT");
350   }
351
352   if(iTRD) {
353     //=================== TRD parameters ============================
354   
355     AliTRD *TRD  = new AliTRDv1("TRD","TRD slow simulator");
356   
357     // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
358     TRD->SetGasMix(1);
359   
360     // With hole in front of PHOS
361     TRD->SetPHOShole();
362     // With hole in front of RICH
363     TRD->SetRICHhole();
364     // Switch on TR
365     AliTRDsim *TRDsim = TRD->CreateTR();
366   }
367
368   if(iFMD) {
369     //=================== FMD parameters ============================
370
371     AliFMD *FMD  = new AliFMDv0("FMD","normal FMD");
372   }
373
374   if(iMUON) {
375     //=================== MUON parameters ===========================
376     AliMUON *MUON  = new AliMUONv1("MUON","default");
377     MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilder(MUON));
378     MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilder(MUON));
379     MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
380     MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
381   }
382  
383   //=================== PHOS parameters ===========================
384
385   if(iPHOS) {
386     AliPHOS *PHOS  = new AliPHOSv1("PHOS","GPS2");
387   }
388
389
390   //=================== CRT parameters ===========================
391
392   if(iCRT) {
393     AliCRT *CRT  = new AliCRTv1("CRT","Normal CRTGPS2");
394   }
395
396
397   if(iPMD) {
398     //=================== PMD parameters ============================
399
400     AliPMD *PMD  = new AliPMDv1("PMD","normal PMD");
401     PMD->SetPAR(1., 1., 0.8, 0.02);
402     PMD->SetIN(6., 18., -580., 27., 27.);
403     PMD->SetGEO(0.0, 0.2, 4.);
404     PMD->SetPadSize(0.8, 1.0, 1.0, 1.5);
405
406   }
407
408   if(iSTART) {
409     //=================== START parameters ============================
410     AliSTART *START  = new AliSTARTv1("START","START Detector");
411   }
412
413          
414 }