]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/Config.C
Complete rewrite of the FMD code.
[u/mrichter/AliRoot.git] / FMD / 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 <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/AliGenCocktail.h"
18 #include "EVGEN/AliGenHIJINGpara.h"
19 #include "STEER/AliMagFMaps.h"
20 #include "STRUCT/AliBODY.h"
21 #include "STRUCT/AliMAG.h"
22 #include "STRUCT/AliABSOv0.h"
23 #include "STRUCT/AliDIPOv2.h"
24 #include "STRUCT/AliHALL.h"
25 #include "STRUCT/AliFRAMEv2.h"
26 #include "STRUCT/AliSHILv2.h"
27 #include "STRUCT/AliPIPEv0.h"
28 #include "ITS/AliITSvPPRasymmFMD.h"
29 #include "TPC/AliTPCv2.h"
30 #include "TOF/AliTOFv4T0.h"
31 #include "RICH/AliRICHv1.h"
32 #include "ZDC/AliZDCv2.h"
33 #include "TRD/AliTRDv1.h"
34 #include "FMD/AliFMDv1.h"
35 #include "MUON/AliMUONv1.h"
36 #include "MUON/AliMUONSt1GeometryBuilder.h"
37 #include "MUON/AliMUONSt2GeometryBuilder.h"
38 #include "MUON/AliMUONSlatGeometryBuilder.h"
39 #include "MUON/AliMUONTriggerGeometryBuilder.h"
40 #include "PHOS/AliPHOSv1.h"
41 #include "PMD/AliPMDv1.h"
42 #include "START/AliSTARTv1.h"
43 #include "EMCAL/AliEMCALv1.h"
44 #include "CRT/AliCRTv0.h"
45 #include "VZERO/AliVZEROv3.h"
46 #endif
47
48 Float_t EtaToTheta(Float_t arg);
49 static Int_t    eventsPerRun = 100;
50 enum PprGeo_t 
51 {
52     kHoles, kNoHoles
53 };
54 static PprGeo_t geo = kHoles;
55
56 void Config()
57 {
58   // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
59   // Theta range given through pseudorapidity limits 22/6/2001
60   
61   // Set Random Number seed
62   gRandom->SetSeed(123456); // Set 0 to use the currecnt time
63   cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl; 
64   
65   
66   // libraries required by geant321
67 #if defined(__CINT__)
68   gSystem->Load("libgeant321");
69 #endif
70   
71   new TGeant3("C++ Interface to Geant3");
72   
73   AliRunLoader* rl = 0;
74   cout<<"Config.C: Creating Run Loader ..."<<endl;
75   rl = AliRunLoader::Open("galice.root", 
76                           AliConfig::GetDefaultEventFolderName(),
77                           "recreate");
78   if (!rl) {
79     gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
80     return;
81   }
82   rl->SetCompressionLevel(2);
83   rl->SetNumberOfEventsPerFile(3);
84   gAlice->SetRunLoader(rl);
85
86     //
87     // Set External decayer
88   TVirtualMCDecayer *decayer = new AliDecayerPythia();
89   decayer->SetForceDecay(kAll);
90   decayer->Init();
91   gMC->SetExternalDecayer(decayer);
92
93   //=======================================================================
94   // ************* STEERING parameters FOR ALICE SIMULATION **************
95   // --- Specify event type to be tracked through the ALICE setup
96   // --- All positions are in cm, angles in degrees, and P and E in GeV
97   gMC->SetProcess("DCAY",1);
98   gMC->SetProcess("PAIR",1);
99   gMC->SetProcess("COMP",1);
100   gMC->SetProcess("PHOT",1);
101   gMC->SetProcess("PFIS",0);
102   gMC->SetProcess("DRAY",0);
103   gMC->SetProcess("ANNI",1);
104   gMC->SetProcess("BREM",1);
105   gMC->SetProcess("MUNU",1);
106   gMC->SetProcess("CKOV",1);
107   gMC->SetProcess("HADR",1);
108   gMC->SetProcess("LOSS",2);
109   gMC->SetProcess("MULS",1);
110   gMC->SetProcess("RAYL",1);
111
112   Float_t cut = 1.e-3;        // 1MeV cut by default
113   Float_t tofmax = 1.e10;
114
115   gMC->SetCut("CUTGAM", cut);
116   gMC->SetCut("CUTELE", cut);
117   gMC->SetCut("CUTNEU", cut);
118   gMC->SetCut("CUTHAD", cut);
119   gMC->SetCut("CUTMUO", cut);
120   gMC->SetCut("BCUTE",  cut); 
121   gMC->SetCut("BCUTM",  cut); 
122   gMC->SetCut("DCUTE",  cut); 
123   gMC->SetCut("DCUTM",  cut); 
124   gMC->SetCut("PPCUTM", cut);
125   gMC->SetCut("TOFMAX", tofmax); 
126
127   int     nParticles = 100;
128   if (gSystem->Getenv("CONFIG_NPARTICLES"))
129     nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
130
131   AliGenCocktail *gener = new AliGenCocktail();
132   gener->SetPhiRange(0, 360);
133   // Set pseudorapidity range from -8 to 8.
134   Float_t thmin = EtaToTheta(8);   // theta min. <---> eta max
135   Float_t thmax = EtaToTheta(-8);  // theta max. <---> eta min 
136   gener->SetThetaRange(thmin,thmax);
137   gener->SetOrigin(0, 0, 0);  //vertex position
138   gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
139   
140   AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
141   hijingparam->SetMomentumRange(0.2, 999);
142   gener->AddGenerator(hijingparam,"HIJING PARAM",1);
143   
144   //    AliGenBox *genbox = new AliGenBox(nParticles);
145   //    genbox->SetPart(22);
146   //    genbox->SetPtRange(0.3, 10.00);
147   //    gener->AddGenerator(genbox,"GENBOX GAMMA for PHOS",1);
148   gener->Init();
149   
150   // Activate this line if you want the vertex smearing to happen
151   // track by track
152   //
153   //gener->SetVertexSmear(perTrack); 
154   // Field (L3 0.4 T)
155   AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
156   gAlice->SetField(field);    
157
158
159   Bool_t useABSO  = kFALSE;
160   Bool_t useDIPO  = kFALSE;
161   Bool_t useFMD   = kTRUE;
162   Bool_t useFRAME = kFALSE;
163   Bool_t useHALL  = kFALSE;
164   Bool_t useITS   = kFALSE;
165   Bool_t useMAG   = kFALSE;
166   Bool_t useMUON  = kFALSE;
167   Bool_t usePHOS  = kFALSE;
168   Bool_t usePIPE  = kFALSE;
169   Bool_t usePMD   = kFALSE;
170   Bool_t useRICH  = kFALSE;
171   Bool_t useSHIL  = kFALSE;
172   Bool_t useSTART = kFALSE;
173   Bool_t useTOF   = kFALSE;
174   Bool_t useTPC   = kFALSE;
175   Bool_t useTRD   = kFALSE;
176   Bool_t useZDC   = kFALSE;
177   Bool_t useEMCAL = kFALSE;
178   Bool_t useCRT   = kFALSE;
179   Bool_t useVZERO = kFALSE;
180   rl->CdGAFile();
181
182   //=================== Alice BODY parameters =============================
183   AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
184   
185   if (useMAG) {
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   if (useABSO) {
193     //=================== ABSO parameters ============================
194     AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
195   }
196
197   if (useDIPO) {
198     //=================== DIPO parameters ============================
199     AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
200   }
201
202   if (useHALL) {
203     //=================== HALL parameters ============================
204     AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
205   }
206
207
208   if (useFRAME) {
209     //=================== FRAME parameters ============================
210     AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
211     if (geo == kHoles) {
212       FRAME->SetHoles(1);
213     } else {
214       FRAME->SetHoles(0);
215     }
216   }
217
218   if (useSHIL) {
219     //=================== SHIL parameters ============================
220     AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
221   }
222
223
224   if (usePIPE) {
225     //=================== PIPE parameters ============================
226     AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
227   }
228  
229   if(useITS) {
230     //=================== ITS parameters ============================
231     //
232     // As the innermost detector in ALICE, the Inner Tracking System
233     // "impacts" on almost all other detectors. This involves the fact
234     // that the ITS geometry still has several options to be followed
235     // in parallel in order to determine the best set-up which
236     // minimizes the induced background. All the geometries available
237     // to date are described in the following. Read carefully the
238     // comments and use the default version (the only one uncommented)
239     // unless you are making comparisons and you know what you are
240     // doing. In this case just uncomment the ITS geometry you want to
241     // use and run Aliroot.
242     //
243     // Detailed geometries:         
244     //
245     //
246     //
247     AliITSvPPRasymmFMD *ITS  
248       = new AliITSvPPRasymmFMD("ITS", "ITS PPR detailed version "
249                                "with asymmetric services");
250     // don't touch this parameter if you're not an ITS developer
251     ITS->SetMinorVersion(2);  
252     // don't touch this parameter if you're not an ITS developer
253     ITS->SetReadDet(kTRUE);       
254     // don't touch this parameter if you're not an ITS developer
255     //  ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  
256     // detector thickness on layer 1 must be in the range [100,300]
257     ITS->SetThicknessDet1(200.);   
258     // detector thickness on layer 2 must be in the range [100,300]
259     ITS->SetThicknessDet2(200.);   
260     // chip thickness on layer 1 must be in the range [150,300]
261     ITS->SetThicknessChip1(200.);  
262     // chip thickness on layer 2 must be in the range [150,300]
263     ITS->SetThicknessChip2(200.);  
264     // 1 --> rails in ; 0 --> rails out
265     ITS->SetRails(0);          
266     // 1 --> water ; 0 --> freon
267     ITS->SetCoolingFluid(1);       
268
269  
270     //
271     // Coarse geometries (warning: no hits are produced with these
272     // coarse geometries and they unuseful for reconstruction !):
273     //                                                     
274     //
275     // AliITSvPPRcoarseasymm *ITS  =
276     //   new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version "
277     //                                  "with asymmetric services");
278     // 1 --> rails in ; 0 --> rails out
279     // ITS->SetRails(0);               
280     // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
281     // ITS->SetSupportMaterial(0);      
282     //
283     // AliITS *ITS  = 
284     //   new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version "
285     //                            "with symmetric services");
286     // 1 --> rails in ; 0 --> rails out
287     // ITS->SetRails(0);                
288     // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
289     // ITS->SetSupportMaterial(0);      
290     //                      
291     //
292     //
293     // Geant3 <-> EUCLID conversion
294     // ============================
295     //
296     // SetEUCLID is a flag to output (=1) or not to output (=0) both
297     // geometry and media to two ASCII files (called by default
298     // ITSgeometry.euc and ITSgeometry.tme) in a format understandable
299     // to the CAD system EUCLID.  The default (=0) means that you dont
300     // want to use this facility.
301     //
302     ITS->SetEUCLID(0);  
303   }
304
305   if (useTPC) {
306     //============================ TPC parameters ====================
307     //
308     // This allows the user to specify sectors for the SLOW (TPC
309     // geometry 2) Simulator. SecAL (SecAU) <0 means that ALL lower
310     // (upper) sectors are specified, any value other than that
311     // requires at least one sector (lower or upper)to be specified!
312     // 
313     // Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
314     //           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
315     //   SecLows - number of lower sectors specified (up to 6)
316     //   SecUps  - number of upper sectors specified (up to 12)
317     //   Sens    - sensitive strips for the Slow Simulator !!!
318     //
319     // This does NOT work if all S or L-sectors are specified, i.e.
320     // if SecAL or SecAU < 0
321     //
322     //
323     //----------------------------------------------------------------
324     //  gROOT->LoadMacro("SetTPCParam.C");
325     //  AliTPCParam *param = SetTPCParam();
326     AliTPC *TPC = new AliTPCv2("TPC", "Default");
327     
328     // All sectors included 
329     TPC->SetSecAU(-1);
330     TPC->SetSecAL(-1);
331   }
332   
333   if (useTOF) {
334     //=================== TOF parameters ============================
335     AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF");
336   }
337
338   if (useRICH) {
339     //=================== RICH parameters ===========================
340     AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
341     
342   }
343
344   if (useZDC) {
345     //=================== ZDC parameters ============================
346     AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
347   }
348
349   if (useTRD) {
350     //=================== TRD parameters ============================
351     AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
352     
353     // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe +
354     // 10% CO2) 
355     TRD->SetGasMix(1);
356     if (geo == kHoles) {
357       // With hole in front of PHOS
358       TRD->SetPHOShole();
359       // With hole in front of RICH
360       TRD->SetRICHhole();
361     }
362     // Switch on TR
363     AliTRDsim *TRDsim = TRD->CreateTR();
364   }
365
366   if (useFMD) {
367     //=================== FMD parameters ============================
368     AliFMD *FMD = new AliFMDv1("FMD", "Detailed FMD");
369   }
370
371   if (useMUON) {
372     //=================== MUON parameters ===========================
373     AliMUON *MUON = new AliMUONv1("MUON", "default");
374     MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilder(MUON));
375     MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilder(MUON));
376     MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
377     MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
378   }
379   
380   //=================== PHOS parameters ===========================
381   if (usePHOS) {
382     AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
383   }
384
385   if (usePMD) {
386     //=================== PMD parameters ============================
387     AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
388   }
389
390   if (useSTART) {
391     //=================== START parameters ============================
392     AliSTART *START = new AliSTARTv1("START", "START Detector");
393   }
394
395   if (useEMCAL) {
396     //=================== EMCAL parameters ============================
397     AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "EMCAL_55_25");
398   }
399
400   if (useCRT) {
401     //=================== CRT parameters ============================
402     AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
403   }
404
405   if (useVZERO) {
406     //=================== CRT parameters ============================
407     AliVZERO *VZERO = new AliVZEROv3("VZERO", "normal VZERO");
408   }
409   
410   cout << "End of FMD/Config.C" << endl;
411 }
412
413 Float_t EtaToTheta(Float_t arg){
414   return (180./TMath::Pi())*2.*atan(exp(-arg));
415 }