nano config for LHC10hx
[u/mrichter/AliRoot.git] / ZDC / ConfigGenZDC.C
CommitLineData
8bca48db 1enum PprMag_t
2{k2kG, k4kG, k5kG};
3
4static 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
a5abc835 7
8Float_t EtaToTheta(Float_t arg);
9static Int_t eventsPerRun = 100;
8bca48db 10
a5abc835 11enum PprGeo_t
8bca48db 12{kHoles, kNoHoles};
13static PprGeo_t sgeo = kHoles;
a5abc835 14
15void 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
8bca48db 21 gRandom->SetSeed(9956646); // Set 0 to use the current time
a5abc835 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",
f5a857b2 36 AliConfig::GetDefaultEventFolderName(),
a5abc835 37 "recreate");
8bca48db 38 if (rl == 0x0){
a5abc835 39 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
40 return;
8bca48db 41 }
a5abc835 42 rl->SetCompressionLevel(2);
43 rl->SetNumberOfEventsPerFile(3);
44 gAlice->SetRunLoader(rl);
8bca48db 45 //gAlice->SetDebug(1);
a5abc835 46
47 //
48 // Set External decayer
8bca48db 49 AliDecayer *decayer = new AliDecayerPythia();
a5abc835 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
8bca48db 58 //
59 ((TGeant3*)gMC)->SetDEBU(1, 2, 1);
a5abc835 60 ((TGeant3*)gMC)->SetSWIT(4,10);
61 ((TGeant3*)gMC)->SetSWIT(2,2);
8bca48db 62 ((TGeant3*)gMC)->SetSWIT(2,1); // to draw tracks
a5abc835 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);
8bca48db 75 gMC->SetProcess("HADR",0); // If option NoShower() is switched on
a5abc835 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();
8bca48db 103 gener->SetOrigin(0, 0, 0); // vertex position
a5abc835 104 //gener->SetParticle(kNeutron);
105 gener->SetParticle(kProton);
106 gener->SetMomentum(2760.);
107 gener->SetDirection(0.,0.,0.,-1.);
8bca48db 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);
a5abc835 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);
8bca48db 121 // Magnetic field
4642ac4b 122 AliMagF* field = new AliMagF("Maps","Maps", 1., 1., smag);
8bca48db 123 field->SetL3ConstField(0); //Using const. field in the barrel
f7a1cc68 124 TGeoGlobalMagField::Instance()->SetField(field);
125
8bca48db 126 rl->CdGAFile();
a5abc835 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;
8bca48db 134 Int_t iMAG = 1;
a5abc835 135 Int_t iMUON = 0;
136 Int_t iPHOS = 0;
137 Int_t iPIPE = 1;
138 Int_t iPMD = 0;
f4b3bbb7 139 Int_t iHMPID = 0;
a5abc835 140 Int_t iSHIL = 1;
ababa197 141 Int_t iT0 = 0;
a5abc835 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;
b384f8a4 147 Int_t iACORDE = 0;
a5abc835 148 Int_t iVZERO = 0;
8bca48db 149
a5abc835 150 //=================== Alice BODY parameters =============================
151 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
152
8bca48db 153
a5abc835 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");
8bca48db 189 if (sgeo == kHoles) {
a5abc835 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 //
8bca48db 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");
a5abc835 230 //
8bca48db 231 AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","New ITS PPR detailed version with asymmetric services");
a5abc835 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
8bca48db 234 // ITS->SetWriteDet("$ALICE_ROOT/ITS/ITSgeometry_vPPRasymm2.det"); // don't touch this parameter if you're not an ITS developer
a5abc835 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]
8bca48db 239 ITS->SetRails(0); // 1 --> rails in ; 0 --> rails out
240 ITS->SetCoolingFluid(1); // 1 --> water ; 0 --> freon
a5abc835 241
a5abc835 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 //
8bca48db 264 ITS->SetEUCLID(0);
a5abc835 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
a5abc835 290 TPC->SetSecAL(-1);
8bca48db 291 TPC->SetSecAU(-1);
292
a5abc835 293 }
294
295
296 if (iTOF) {
a5abc835 297 //=================== TOF parameters ============================
8bca48db 298 AliTOF *TOF = new AliTOFv4T0("TOF", "normal TOF");
a5abc835 299 }
300
301
f4b3bbb7 302 if (iHMPID)
a5abc835 303 {
f4b3bbb7 304 //=================== HMPID parameters ===========================
305 AliHMPID *HMPID = new AliHMPIDv1("HMPID", "normal HMPID");
a5abc835 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);
8bca48db 326 if (sgeo == kHoles) {
a5abc835 327 // With hole in front of PHOS
328 TRD->SetPHOShole();
f4b3bbb7 329 // With hole in front of HMPID
330 TRD->SetHMPIDhole();
a5abc835 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");
8bca48db 347 MUON->AddGeometryBuilder(new AliMUONSt1GeometryBuilderV2(MUON));
348 MUON->AddGeometryBuilder(new AliMUONSt2GeometryBuilder(MUON));
349 MUON->AddGeometryBuilder(new AliMUONSlatGeometryBuilder(MUON));
350 MUON->AddGeometryBuilder(new AliMUONTriggerGeometryBuilder(MUON));
a5abc835 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
ababa197 366 if (iT0)
a5abc835 367 {
ababa197 368 //=================== T0 parameters ============================
369 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
a5abc835 370 }
371
372 if (iEMCAL)
373 {
374 //=================== EMCAL parameters ============================
8224b11d 375 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
a5abc835 376 }
377
b384f8a4 378 if (iACORDE)
a5abc835 379 {
b384f8a4 380 //=================== ACORDE parameters ============================
f7882672 381 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
a5abc835 382 }
383
384 if (iVZERO)
385 {
b384f8a4 386 //=================== ACORDE parameters ============================
a5abc835 387 AliVZERO *VZERO = new AliVZEROv2("VZERO", "normal VZERO");
388 }
389
390 cout << "End of Config.C" << endl;
391
392}
393
394Float_t EtaToTheta(Float_t arg){
395 return (180./TMath::Pi())*2.*atan(exp(-arg));
396}