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