]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ZDC/ConfigGenZDC.C
Macro to run test particle (spectator nucleons)
[u/mrichter/AliRoot.git] / ZDC / ConfigGenZDC.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/AliTOFv2FHoles.h"
31 #include "TOF/AliTOFv4T0.h"
32 #include "RICH/AliRICHv3.h"
33 #include "ZDC/AliZDCv2.h"
34 #include "TRD/AliTRDv1.h"
35 #include "FMD/AliFMDv1.h"
36 #include "MUON/AliMUONv1.h"
37 #include "PHOS/AliPHOSv1.h"
38 #include "PMD/AliPMDv1.h"
39 #include "START/AliSTARTv1.h"
40 #include "EMCAL/AliEMCALv1.h"
41 #include "CRT/AliCRTv0.h"
42 #include "VZERO/AliVZEROv2.h"
43 #endif
44
45 Float_t EtaToTheta(Float_t arg);
46 static Int_t    eventsPerRun = 100;
47 enum PprGeo_t 
48 {
49     kHoles, kNoHoles
50 };
51 static PprGeo_t geo = kHoles;
52
53 void Config()
54 {
55     // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
56     // Theta range given through pseudorapidity limits 22/6/2001
57
58     // Set Random Number seed
59   gRandom->SetSeed(123456); // Set 0 to use the currecnt time
60     cout<<"Seed for random number generation= "<<gRandom->GetSeed()<<endl; 
61
62
63    // libraries required by geant321
64 #if defined(__CINT__)
65     gSystem->Load("libgeant321");
66 #endif
67
68     new     TGeant3("C++ Interface to Geant3");
69
70     AliRunLoader* rl=0x0;
71
72     cout<<"Config.C: Creating Run Loader ..."<<endl;
73     rl = AliRunLoader::Open("galice.root",
74                             AliConfig::fgkDefaultEventFolderName,
75                             "recreate");
76     if (rl == 0x0)
77       {
78         gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
79         return;
80       }
81     rl->SetCompressionLevel(2);
82     rl->SetNumberOfEventsPerFile(3);
83     gAlice->SetRunLoader(rl);
84
85     //
86     // Set External decayer
87     TVirtualMCDecayer *decayer = new AliDecayerPythia();
88
89     decayer->SetForceDecay(kAll);
90     decayer->Init();
91     gMC->SetExternalDecayer(decayer);
92     //=======================================================================
93     // ************* STEERING parameters FOR ALICE SIMULATION **************
94     // --- Specify event type to be tracked through the ALICE setup
95     // --- All positions are in cm, angles in degrees, and P and E in GeV
96     
97     ((TGeant3*)gMC)->SetSWIT(4,10);
98     ((TGeant3*)gMC)->SetSWIT(2,2);
99     ((TGeant3*)gMC)->SetSWIT(2,3);
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("HADR",0);  // If opt NoShower() for ZDC is selected
113     gMC->SetProcess("LOSS",2);
114     gMC->SetProcess("MULS",1);
115     gMC->SetProcess("RAYL",1);
116
117     Float_t cut = 1.e-3;        // 1MeV cut by default
118     Float_t tofmax = 1.e10;
119
120     gMC->SetCut("CUTGAM", cut);
121     gMC->SetCut("CUTELE", cut);
122     gMC->SetCut("CUTNEU", cut);
123     gMC->SetCut("CUTHAD", cut);
124     gMC->SetCut("CUTMUO", cut);
125     gMC->SetCut("BCUTE",  cut); 
126     gMC->SetCut("BCUTM",  cut); 
127     gMC->SetCut("DCUTE",  cut); 
128     gMC->SetCut("DCUTM",  cut); 
129     gMC->SetCut("PPCUTM", cut);
130     gMC->SetCut("TOFMAX", tofmax); 
131
132
133     int     nParticles = 100;
134     if (gSystem->Getenv("CONFIG_NPARTICLES"))
135         nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
136
137
138     // ####  AliGenZDC generation       ######################################
139     AliGenZDC *gener = new AliGenZDC();
140     //gener->SetParticle(kNeutron);
141     gener->SetParticle(kProton);
142     gener->SetMomentum(2760.);
143     gener->SetDirection(0.,0.,0.,-1.);
144     gener->SetFermi(0);
145     gener->SetDiv(0.000032,0.0001,2);
146     //gener->SetDebug();
147     //
148     gener->SetTrackingFlag(1);
149     gener->Init();
150
151     // 
152     // Activate this line if you want the vertex smearing to happen
153     // track by track
154     //
155     //gener->SetVertexSmear(perTrack); 
156     // Field (L3 0.4 T)
157     AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
158     gAlice->SetField(field);    
159
160     Int_t   iABSO  =  1;
161     Int_t   iDIPO  =  1;
162     Int_t   iFMD   =  0;
163     Int_t   iFRAME =  0;
164     Int_t   iHALL  =  0;
165     Int_t   iITS   =  0;
166     Int_t   iMAG   =  0;
167     Int_t   iMUON  =  0;
168     Int_t   iPHOS  =  0;
169     Int_t   iPIPE  =  1;
170     Int_t   iPMD   =  0;
171     Int_t   iRICH  =  0;
172     Int_t   iSHIL  =  1;
173     Int_t   iSTART =  0;
174     Int_t   iTOF   =  0;
175     Int_t   iTPC   =  0;
176     Int_t   iTRD   =  0;
177     Int_t   iZDC   =  1;
178     Int_t   iEMCAL =  0;
179     Int_t   iCRT   =  0;
180     Int_t   iVZERO =  0;
181     rl->CdGAFile();
182     //=================== Alice BODY parameters =============================
183     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
184
185     if (iMAG)
186     {
187         //=================== MAG parameters ============================
188         // --- Start with Magnet since detector layouts may be depending ---
189         // --- on the selected Magnet dimensions ---
190         AliMAG *MAG = new AliMAG("MAG", "Magnet");
191     }
192
193
194     if (iABSO)
195     {
196         //=================== ABSO parameters ============================
197         AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
198     }
199
200     if (iDIPO)
201     {
202         //=================== DIPO parameters ============================
203
204         AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
205     }
206
207     if (iHALL)
208     {
209         //=================== HALL parameters ============================
210
211         AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
212     }
213
214
215     if (iFRAME)
216     {
217         //=================== FRAME parameters ============================
218
219         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
220         if (geo == kHoles) {
221             FRAME->SetHoles(1);
222         } else {
223             FRAME->SetHoles(0);
224         }
225     }
226
227     if (iSHIL)
228     {
229         //=================== SHIL parameters ============================
230
231         AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
232     }
233
234
235     if (iPIPE)
236     {
237         //=================== PIPE parameters ============================
238
239         AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
240     }
241  
242     if(iITS) {
243
244     //=================== ITS parameters ============================
245     //
246     // As the innermost detector in ALICE, the Inner Tracking System "impacts" on
247     // almost all other detectors. This involves the fact that the ITS geometry
248     // still has several options to be followed in parallel in order to determine
249     // the best set-up which minimizes the induced background. All the geometries
250     // available to date are described in the following. Read carefully the comments
251     // and use the default version (the only one uncommented) unless you are making
252     // comparisons and you know what you are doing. In this case just uncomment the
253     // ITS geometry you want to use and run Aliroot.
254     //
255     // Detailed geometries:         
256     //
257     //
258     //
259         AliITSvPPRasymmFMD *ITS  = new AliITSvPPRasymmFMD("ITS","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(kTRUE);   // 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 [100,300]
264         ITS->SetThicknessDet2(200.);   // detector thickness on layer 2 must be in the range [100,300]
265         ITS->SetThicknessChip1(200.);  // chip thickness on layer 1 must be in the range [150,300]
266         ITS->SetThicknessChip2(200.);  // chip thickness on layer 2 must be in the range [150,300]
267         ITS->SetRails(0);              // 1 --> rails in ; 0 --> rails out
268         ITS->SetCoolingFluid(1);       // 1 --> water ; 0 --> freon
269
270  
271     //
272     // Coarse geometries (warning: no hits are produced with these coarse geometries and they unuseful 
273     // for reconstruction !):
274     //                                                     
275     //
276     //AliITSvPPRcoarseasymm *ITS  = new AliITSvPPRcoarseasymm("ITS","New ITS PPR coarse version with asymmetric services");
277     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
278     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
279     //
280     //AliITS *ITS  = new AliITSvPPRcoarsesymm("ITS","New ITS PPR coarse version with symmetric services");
281     //ITS->SetRails(0);                // 1 --> rails in ; 0 --> rails out
282     //ITS->SetSupportMaterial(0);      // 0 --> Copper ; 1 --> Aluminum ; 2 --> Carbon
283     //                      
284     //
285     //
286     // Geant3 <-> EUCLID conversion
287     // ============================
288     //
289     // SetEUCLID is a flag to output (=1) or not to output (=0) both geometry and
290     // media to two ASCII files (called by default ITSgeometry.euc and
291     // ITSgeometry.tme) in a format understandable to the CAD system EUCLID.
292     // The default (=0) means that you dont want to use this facility.
293     //
294      ITS->SetEUCLID(0);  
295     }
296
297     if (iTPC)
298     {
299         //============================ TPC parameters ================================
300         // --- This allows the user to specify sectors for the SLOW (TPC geometry 2)
301         // --- Simulator. SecAL (SecAU) <0 means that ALL lower (upper)
302         // --- sectors are specified, any value other than that requires at least one 
303         // --- sector (lower or upper)to be specified!
304         // --- Reminder: sectors 1-24 are lower sectors (1-12 -> z>0, 13-24 -> z<0)
305         // ---           sectors 25-72 are the upper ones (25-48 -> z>0, 49-72 -> z<0)
306         // --- SecLows - number of lower sectors specified (up to 6)
307         // --- SecUps - number of upper sectors specified (up to 12)
308         // --- Sens - sensitive strips for the Slow Simulator !!!
309         // --- This does NOT work if all S or L-sectors are specified, i.e.
310         // --- if SecAL or SecAU < 0
311         //
312         //
313         //-----------------------------------------------------------------------------
314
315         //  gROOT->LoadMacro("SetTPCParam.C");
316         //  AliTPCParam *param = SetTPCParam();
317         AliTPC *TPC = new AliTPCv2("TPC", "Default");
318
319         // All sectors included 
320         TPC->SetSecAU(-1);
321         TPC->SetSecAL(-1);
322     }
323
324
325     if (iTOF) {
326         if (geo == kHoles) {
327         //=================== TOF parameters ============================
328             AliTOF *TOF = new AliTOFv2FHoles("TOF", "TOF with Holes");
329         } else {
330             AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF");
331         }
332     }
333
334
335     if (iRICH)
336     {
337         //=================== RICH parameters ===========================
338         AliRICH *RICH = new AliRICHv3("RICH", "normal RICH");
339
340     }
341
342
343     if (iZDC)
344     {
345         //=================== ZDC parameters ============================
346
347         AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
348         ZDC->NoShower();
349     }
350
351     if (iTRD)
352     {
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         if (geo == kHoles) {
360             // With hole in front of PHOS
361             TRD->SetPHOShole();
362             // With hole in front of RICH
363             TRD->SetRICHhole();
364         }
365             // Switch on TR
366             AliTRDsim *TRDsim = TRD->CreateTR();
367     }
368
369     if (iFMD)
370     {
371         //=================== FMD parameters ============================
372         AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
373    }
374
375     if (iMUON)
376     {
377         //=================== MUON parameters ===========================
378
379         AliMUON *MUON = new AliMUONv1("MUON", "default");
380     }
381     //=================== PHOS parameters ===========================
382
383     if (iPHOS)
384     {
385         AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
386     }
387
388
389     if (iPMD)
390     {
391         //=================== PMD parameters ============================
392         AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
393     }
394
395     if (iSTART)
396     {
397         //=================== START parameters ============================
398         AliSTART *START = new AliSTARTv1("START", "START Detector");
399     }
400
401     if (iEMCAL)
402     {
403         //=================== EMCAL parameters ============================
404         AliEMCAL *EMCAL = new AliEMCALv1("EMCAL", "G56_2_55_19_104_14");
405     }
406
407      if (iCRT)
408     {
409         //=================== CRT parameters ============================
410         AliCRT *CRT = new AliCRTv0("CRT", "normal ACORDE");
411     }
412
413      if (iVZERO)
414     {
415         //=================== CRT parameters ============================
416         AliVZERO *VZERO = new AliVZEROv2("VZERO", "normal VZERO");
417     }
418
419      cout << "End of Config.C" << endl;
420
421 }
422
423 Float_t EtaToTheta(Float_t arg){
424   return (180./TMath::Pi())*2.*atan(exp(-arg));
425 }