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