]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PHOS/macros/Embed/Config.C
Using symbolic particle types everywhere
[u/mrichter/AliRoot.git] / PHOS / macros / Embed / Config.C
1 #include <TPDGCode.h>
2
3 static Int_t    eventsPerRun = 100;
4 enum PprGeo_t
5 {
6     kHoles, kNoHoles
7 };
8                                                                                 
9 enum PprRad_t
10 {
11     kGluonRadiation, kNoGluonRadiation
12 };
13                                                                                 
14 enum PprMag_t
15 {
16     k2kG, k4kG, k5kG
17 };
18                                                                                 
19                                                                                 
20 // This part for configuration
21 static PprGeo_t sgeo = kNoHoles;
22 static PprRad_t srad = kGluonRadiation;
23 static PprMag_t smag = k5kG;
24                                                                                 
25 // Comment line
26 static TString  comment;
27                                                                                 
28 // Functions
29 Float_t EtaToTheta(Float_t arg);
30
31
32 void Config()
33 {
34
35   cout << "==> Config.C..." << endl;
36   
37   // Set Random Number seed
38   UInt_t at = (UInt_t) gSystem->Now() ;
39   UInt_t seed = ((gSystem->GetPid()*111)%at)*137 ;
40 //  gRandom->SetSeed(seed);
41   gRandom->SetSeed(12345);
42   printf("MySeed: %d\n",seed) ;
43   cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl;
44
45   
46   
47   // libraries required by fluka21
48
49   Bool_t isFluka = kFALSE;
50   if (isFluka) {
51     gSystem->Load("libGeom");
52     cout << "\t* Loading TFluka..." << endl;  
53     gSystem->Load("libTFluka");    
54     
55     cout << "\t* Instantiating TFluka..." << endl;
56     new  TFluka("C++ Interface to Fluka", 0/*verbositylevel*/);
57   }
58   else {
59     cout << "\t* Loading Geant3..." << endl;  
60     gSystem->Load("libgeant321");
61     
62     cout << "\t* Instantiating Geant3TGeo..." << endl;
63     new     TGeant3TGeo("C++ Interface to Geant3");
64   }
65   
66   AliRunLoader* rl=0x0;
67                                                                                 
68   cout<<"Config.C: Creating Run Loader ..."<<endl;
69   rl = AliRunLoader::Open("galice.root",
70                             AliConfig::GetDefaultEventFolderName(),
71                             "recreate");
72   if (rl == 0x0)
73     {
74       gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
75       return;
76     }
77   rl->SetCompressionLevel(2);
78   rl->SetNumberOfEventsPerFile(1000);
79   gAlice->SetRunLoader(rl);
80                                                                                 
81   //
82   // Set External decayer
83   AliDecayer *decayer = new AliDecayerPythia();
84                                                                                
85   decayer->SetForceDecay(kAll);
86   decayer->Init();
87   gMC->SetExternalDecayer(decayer);
88
89   //
90   //
91   //
92   // Physics process control
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); //AZ 1);
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   ((AliMC*)gMC)->SetTransPar("./galice.cuts") ;
125   //
126   //=======================================================================
127   // ************* STEERING parameters FOR ALICE SIMULATION **************
128   // --- Specify event type to be tracked through the ALICE setup
129   // --- All positions are in cm, angles in degrees, and P and E in GeV
130  
131     AliGenBox *gener = new AliGenBox(5);
132     gener->SetMomentumRange(0.5, 5.);
133     gener->SetPhiRange(260., 280.);
134     gener->SetThetaRange(82.,98.);
135     gener->SetPart(kGamma);
136
137     gener->SetOrigin(0, 0, 0);  //vertex position
138     gener->SetSigma(0, 0, 0);   //Sigma in (X,Y,Z) (cm) on IP position
139     gener->Init() ;
140  
141   // 
142   // Activate this line if you want the vertex smearing to happen
143   // track by track
144   //
145   //  gener->SetVertexSmear(kPerEvent) ;
146  
147
148
149      if (smag == k2kG) {
150         comment = comment.Append(" | L3 field 0.2 T");
151     } else if (smag == k4kG) {
152         comment = comment.Append(" | L3 field 0.4 T");
153     } else if (smag == k5kG) {
154         comment = comment.Append(" | L3 field 0.5 T");
155     }
156                                                                                 
157                                                                                 
158     if (srad == kGluonRadiation)
159     {
160         comment = comment.Append(" | Gluon Radiation On");
161                                                                                 
162     } else {
163         comment = comment.Append(" | Gluon Radiation Off");
164     }
165                                                                                 
166     if (sgeo == kHoles)
167     {
168         comment = comment.Append(" | Holes for PHOS/RICH");
169                                                                                 
170     } else {
171         comment = comment.Append(" | No holes for PHOS/RICH");
172     }
173                                                                                 
174     printf("\n \n Comment: %s \n \n", comment.Data());
175                                                                                 
176                                                                                 
177 // Field (L3 0.4 T)
178 //    AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., smag);
179     //Zero magnetic field
180     AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 0., 10., smag);
181     field->SetL3ConstField(0); //Using const. field in the barrel
182     rl->CdGAFile();
183     gAlice->SetField(field);
184  
185   Int_t   iABSO  = 0; 
186   Int_t   iCRT   = 0; 
187   Int_t   iDIPO  = 0; 
188   Int_t   iFMD   = 0; 
189   Int_t   iFRAME = 0; 
190   Int_t   iHALL  = 0; 
191   Int_t   iITS   = 0; 
192   Int_t   iMAG   = 0; 
193   Int_t   iMUON  = 0; 
194   Int_t   iPHOS  = 1; 
195   Int_t   iPIPE  = 0; 
196   Int_t   iPMD   = 0; 
197   Int_t   iRICH  = 0; 
198   Int_t   iSHIL  = 0; 
199   Int_t   iSTART = 0; 
200   Int_t   iTOF   = 0; 
201   Int_t   iTPC   = 0;
202   Int_t   iTRD   = 0; 
203   Int_t   iZDC   = 0; 
204   Int_t   iEMCAL = 0; 
205   Int_t   iVZERO = 0;
206  
207   cout << "\t* Creating the detectors ..." << endl;
208   //=================== Alice BODY parameters =============================
209     //=================== Alice BODY parameters =============================
210     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
211                                                                                 
212                                                                                 
213     if (iMAG)
214     {
215         //=================== MAG parameters ============================
216         // --- Start with Magnet since detector layouts may be depending ---
217         // --- on the selected Magnet dimensions ---
218         AliMAG *MAG = new AliMAG("MAG", "Magnet");
219     }
220                                                                                 
221                                                                                 
222     if (iABSO)
223     {
224         //=================== ABSO parameters ============================
225         AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
226     }
227                                                                                 
228     if (iDIPO)
229     {
230         //=================== DIPO parameters ============================
231                                                                                 
232         AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
233     }
234                                                                                 
235     if (iHALL)
236     {
237         //=================== HALL parameters ============================
238                                                                                 
239         AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
240     }
241                                                                                 
242                                                                                 
243     if (iFRAME)
244     {
245         //=================== FRAME parameters ============================
246                                                                                 
247         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
248         if (sgeo == kHoles) {
249             FRAME->SetHoles(1);
250         } else {
251             FRAME->SetHoles(0);
252         }
253     }
254                                                                                 
255     if (iSHIL)
256     {
257         //=================== SHIL parameters ============================
258                                                                                 
259         AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
260     }
261                                                                                 
262                                                                                 
263     if (iPIPE)
264     {
265         //=================== PIPE parameters ============================
266                                                                                 
267         AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
268     }
269                                                                                 
270     if(iITS) {
271                                                                                 
272     //=================== ITS parameters ============================
273     //
274     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
275     // almost all other detectors. This involves the fact that the ITS geometry
276     // still has several options to be followed in parallel in order to determine
277     // the best set-up which minimizes the induced background. All the geometries
278     // available to date are described in the following. Read carefully the comments
279     // and use the default version (the only one uncommented) unless you are making
280     // comparisons and you know what you are doing. In this case just uncomment the
281     // ITS geometry you want to use and run Aliroot.
282     //
283     // Detailed geometries:
284     //
285     //
286     //AliITS *ITS  = new AliITSv5symm("ITS","Updated ITS TDR detailed version with symmetric services");
287     //
288     //AliITS *ITS  = new AliITSv5asymm("ITS","Updates ITS TDR detailed version with asymmetric services");
289     //
290         AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
291         ITS->SetMinorVersion(2);  // don't touch this parameter if you're not an ITS developer
292         ITS->SetReadDet(kTRUE);   // don't touch this parameter if you're not an ITS developer
293     //    ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det");  // don't touch this parameter if you're not an ITS developer
294         ITS->SetThicknessDet1(200.);   // detector thickness on layer 1 must be in the range [100,300]
295         ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
296         ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [150,300]
297         ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [150,300]
298         ITS->SetRails(0);            // 1 --> rails in ; 0 --> rails out
299         ITS->SetCoolingFluid(1);   // 1 --> water ; 0 --> freon
300                                                                                 
301     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful
302     // for reconstruction !):
303     //
304     //
305     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
306     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
307     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
308     //
309     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
310     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
311     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
312     //
313     //
314     //
315     // Geant3 <-> EUCLID conversion
316     // ============================
317     //
318     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
319     // media to two ASCII files (called by default ITSgeometry.euc and
320     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
321     // The default (=0) means that you dont want to use this facility.
322     //
323         ITS->SetEUCLID(0);
324     }
325                                                                                 
326     if (iTPC)
327     {
328         //============================ TPC parameters ================================
329 //        AliTPC *TPC = new AliTPCv0("TPC", "Default");
330         AliTPC *TPC = new AliTPCv2("TPC", "Default");
331     }
332                                                                                 
333                                                                                 
334     if (iTOF) {
335         //=================== TOF parameters ============================
336         AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF");
337     }
338                                                                                 
339                                                                                 
340     if (iRICH)
341     {
342         //=================== RICH parameters ===========================
343         AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
344                                                                                 
345     }
346                                                                                 
347                                                                                 
348     if (iZDC)
349     {
350         //=================== ZDC parameters ============================
351                                                                                 
352         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
353     }
354                                                                                 
355     if (iTRD)
356     {
357         //=================== TRD parameters ============================
358                                                                                 
359         AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
360                                                                                 
361         // Select the gas mixture (0: 97% Xe + 3% isobutane, 1: 90% Xe + 10% CO2)
362         TRD->SetGasMix(1);
363         if (sgeo == kHoles) {
364             // With hole in front of PHOS
365             TRD->SetPHOShole();
366             // With hole in front of RICH
367             TRD->SetRICHhole();
368         }
369             // Switch on TR
370             AliTRDsim *TRDsim = TRD->CreateTR();
371     }
372                                                                                 
373     if (iFMD)
374     {
375         //=================== FMD parameters ============================
376         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
377    }
378                                                                                 
379     if (iMUON)
380     {
381         //=================== MUON parameters ===========================
382                                                                                 
383         AliMUON *MUON = new AliMUONv1("MUON", "default");
384     }
385     //=================== PHOS parameters ===========================
386                                                                                 
387     if (iPHOS)
388     {
389        AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
390 //         AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV");
391     }
392                                                                                 
393                                                                                 
394     if (iPMD)
395     {
396         //=================== PMD parameters ============================
397         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
398     }
399                                                                                 
400     if (iSTART)
401     {
402         //=================== START parameters ============================
403         AliSTART *START = new AliSTARTv1("START", "START Detector");
404     }
405                                                                                 
406     if (iEMCAL)
407     {
408         //=================== EMCAL parameters ============================
409         AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH");
410     }
411                                                                                 
412      if (iCRT)
413     {
414         //=================== CRT parameters ============================
415         AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
416     }
417                                                                                 
418      if (iVZERO)
419     {
420         //=================== CRT parameters ============================
421         AliVZERO *VZERO = new AliVZEROv3("VZERO", "normal VZERO");
422     }
423                                                                                 
424                                                                                 
425 }
426                                                                                 
427 Float_t EtaToTheta(Float_t arg){
428   return (180./TMath::Pi())*2.*atan(exp(-arg));
429 }
430