Test suite for beam-beam pileup simulation. The meaning of the settings and some...
[u/mrichter/AliRoot.git] / test / pileup / Config.C
CommitLineData
8498bdf5 1//
2// Configuration for the first physics production 2008
3//
4
5// One can use the configuration macro in compiled mode by
6// root [0] gSystem->Load("libgeant321");
7// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
8// -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
9// root [0] .x grun.C(1,"Config.C++")
10
11#if !defined(__CINT__) || defined(__MAKECINT__)
12#include <Riostream.h>
13#include <TRandom.h>
14#include <TDatime.h>
15#include <TSystem.h>
16#include <TVirtualMC.h>
17#include <TGeant3TGeo.h>
18#include "STEER/AliRunLoader.h"
19#include "STEER/AliRun.h"
20#include "STEER/AliConfig.h"
21#include "PYTHIA6/AliDecayerPythia.h"
22#include "PYTHIA6/AliGenPythia.h"
23#include "TDPMjet/AliGenDPMjet.h"
24#include "STEER/AliMagFCheb.h"
25#include "STRUCT/AliBODY.h"
26#include "STRUCT/AliMAG.h"
27#include "STRUCT/AliABSOv3.h"
28#include "STRUCT/AliDIPOv3.h"
29#include "STRUCT/AliHALLv3.h"
30#include "STRUCT/AliFRAMEv2.h"
31#include "STRUCT/AliSHILv3.h"
32#include "STRUCT/AliPIPEv3.h"
33#include "ITS/AliITSv11Hybrid.h"
34#include "TPC/AliTPCv2.h"
35#include "TOF/AliTOFv6T0.h"
36#include "HMPID/AliHMPIDv3.h"
37#include "ZDC/AliZDCv3.h"
38#include "TRD/AliTRDv1.h"
39#include "TRD/AliTRDgeometry.h"
40#include "FMD/AliFMDv1.h"
41#include "MUON/AliMUONv1.h"
42#include "PHOS/AliPHOSv1.h"
43#include "PHOS/AliPHOSSimParam.h"
44#include "PMD/AliPMDv1.h"
45#include "T0/AliT0v1.h"
46#include "EMCAL/AliEMCALv2.h"
47#include "ACORDE/AliACORDEv1.h"
48#include "VZERO/AliVZEROv7.h"
49#endif
50
51
52enum PDC06Proc_t
53{
54 kPythia6, kPhojet, kRunMax
55};
56
57const char * pprRunName[] = {
58 "kPythia6", "kPhojet"
59};
60
61//--- Magnetic Field ---
62enum Mag_t
63{
64 kNoField, k5kG, kFieldMax
65};
66
67const char * pprField[] = {
68 "kNoField", "k5kG"
69};
70
71//--- Functions ---
72class AliGenPythia;
73AliGenerator *MbPythia();
74AliGenerator *MbPhojet();
75void ProcessEnvironmentVars();
76
77// Geterator, field, beam energy
78static PDC06Proc_t proc = kPhojet;
79static Mag_t mag = k5kG;
80static Float_t energy = 10000; // energy in CMS
81//========================//
82// Set Random Number seed //
83//========================//
84TDatime dt;
85static UInt_t seed = dt.Get();
86
87// Comment line
88static TString comment;
89
90void Config()
91{
92
93
94 // Get settings from environment variables
95 ProcessEnvironmentVars();
96
97 gRandom->SetSeed(seed);
98 cerr<<"Seed for random number generation= "<<seed<<endl;
99
100 // Libraries required by geant321
101#if defined(__CINT__)
102 gSystem->Load("liblhapdf"); // Parton density functions
103 gSystem->Load("libEGPythia6"); // TGenerator interface
104 gSystem->Load("libpythia6"); // Pythia
105 gSystem->Load("libAliPythia6"); // ALICE specific implementations
106 gSystem->Load("libgeant321");
107#endif
108
109 new TGeant3TGeo("C++ Interface to Geant3");
110
111 //=======================================================================
112 // Create the output file
113
114
115 AliRunLoader* rl=0x0;
116
117 cout<<"Config.C: Creating Run Loader ..."<<endl;
118 rl = AliRunLoader::Open("galice.root",
119 AliConfig::GetDefaultEventFolderName(),
120 "recreate");
121 if (rl == 0x0)
122 {
123 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
124 return;
125 }
126 rl->SetCompressionLevel(2);
127 rl->SetNumberOfEventsPerFile(1000);
128 gAlice->SetRunLoader(rl);
129 // gAlice->SetGeometryFromFile("geometry.root");
130 // gAlice->SetGeometryFromCDB();
131
132 // Set the trigger configuration: proton-proton
133 gAlice->SetTriggerDescriptor("p-p");
134
135 //
136 //=======================================================================
137 // ************* STEERING parameters FOR ALICE SIMULATION **************
138 // --- Specify event type to be tracked through the ALICE setup
139 // --- All positions are in cm, angles in degrees, and P and E in GeV
140
141
142 gMC->SetProcess("DCAY",1);
143 gMC->SetProcess("PAIR",1);
144 gMC->SetProcess("COMP",1);
145 gMC->SetProcess("PHOT",1);
146 gMC->SetProcess("PFIS",0);
147 gMC->SetProcess("DRAY",0);
148 gMC->SetProcess("ANNI",1);
149 gMC->SetProcess("BREM",1);
150 gMC->SetProcess("MUNU",1);
151 gMC->SetProcess("CKOV",1);
152 gMC->SetProcess("HADR",1);
153 gMC->SetProcess("LOSS",2);
154 gMC->SetProcess("MULS",1);
155 gMC->SetProcess("RAYL",1);
156
157 Float_t cut = 1.e-3; // 1MeV cut by default
158 Float_t tofmax = 1.e10;
159
160 gMC->SetCut("CUTGAM", cut);
161 gMC->SetCut("CUTELE", cut);
162 gMC->SetCut("CUTNEU", cut);
163 gMC->SetCut("CUTHAD", cut);
164 gMC->SetCut("CUTMUO", cut);
165 gMC->SetCut("BCUTE", cut);
166 gMC->SetCut("BCUTM", cut);
167 gMC->SetCut("DCUTE", cut);
168 gMC->SetCut("DCUTM", cut);
169 gMC->SetCut("PPCUTM", cut);
170 gMC->SetCut("TOFMAX", tofmax);
171
172
173
174
175 //======================//
176 // Set External decayer //
177 //======================//
178 TVirtualMCDecayer* decayer = new AliDecayerPythia();
179 decayer->SetForceDecay(kAll);
180 decayer->Init();
181 gMC->SetExternalDecayer(decayer);
182
183 //=========================//
184 // Generator Configuration //
185 //=========================//
186 // Create pileup generator
187 AliGenPileup *pileup = new AliGenPileup();
188
189 AliGenerator* gener = 0x0;
190
191 if (proc == kPythia6) {
192 gener = MbPythia();
193 } else if (proc == kPhojet) {
194 gener = MbPhojet();
195 }
196
197 // Set the pileup interaction generator
198 // The second argument is the pileup rate
199 // in terms of event rate per bunch crossing
200 pileup->SetGenerator(gener,0.01);
201 // Set the beam time structure
202 // Details on the syntax in STEER/AliTriggerBCMask
203 pileup->SetBCMask("72(1H1L)3420L");
204 // Examples of the pileup rate and beam structure settings
205 // Most of the information is taken from the LHC commissionning page
206 // rate from 0.01 (at 900GeV) to 0.76 (at 14TeV)
207 // 1 bunch/orbit - bc-mask = "1H3563L"
208 // 43 bunches/orbit - bc-mask = "43(1H80L)81L"
209 // 72 bunches/orbit - bc-mask = "72(1H1L)3420L" (50ns mode)
210 // Please note that most of these setting should be cross-checked because
211 // for example the 43 bunches mode is taken at CMS IP and not the ALICE one.
212
213 // Generate the trigger interaction
214 pileup->GenerateTrigInteraction(kTRUE);
215
216 // PRIMARY VERTEX
217 //
218 pileup->SetOrigin(0., 0., 0.); // vertex position
219 //
220 //
221 // Size of the interaction diamond
222 // Longitudinal
223 Float_t sigmaz = 5.4 / TMath::Sqrt(2.); // [cm]
224 if (energy == 900)
225 sigmaz = 10.5 / TMath::Sqrt(2.); // [cm]
226 //
227 // Transverse
228 Float_t betast = 10; // beta* [m]
229 Float_t eps = 3.75e-6; // emittance [m]
230 Float_t gamma = energy / 2.0 / 0.938272; // relativistic gamma [1]
231 Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.; // [cm]
232 printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
233
234 pileup->SetSigma(sigmaxy, sigmaxy, sigmaz); // Sigma in (X,Y,Z) (cm) on IP position
235 pileup->SetCutVertexZ(3.); // Truncate at 3 sigma
236 pileup->SetVertexSmear(kPerEvent);
237
238 pileup->Init();
239
240 // FIELD
241 //
242 AliMagFCheb* field = 0x0;
243 if (mag == kNoField) {
244 comment = comment.Append(" | L3 field 0.0 T");
245 field = new AliMagFCheb("Maps","Maps", 2, 0., 10., AliMagFCheb::k2kG);
246 } else if (mag == k5kG) {
247 comment = comment.Append(" | L3 field 0.5 T");
248 field = new AliMagFCheb("Maps","Maps", 2, 1., 10., AliMagFCheb::k5kG);
249 }
250 printf("\n \n Comment: %s \n \n", comment.Data());
251
252 rl->CdGAFile();
253 gAlice->SetField(field);
254
255
256
257 Int_t iABSO = 1;
258 Int_t iACORDE= 0;
259 Int_t iDIPO = 1;
260 Int_t iEMCAL = 0;
261 Int_t iFMD = 1;
262 Int_t iFRAME = 1;
263 Int_t iHALL = 1;
264 Int_t iITS = 1;
265 Int_t iMAG = 1;
266 Int_t iMUON = 1;
267 Int_t iPHOS = 1;
268 Int_t iPIPE = 1;
269 Int_t iPMD = 0;
270 Int_t iHMPID = 1;
271 Int_t iSHIL = 1;
272 Int_t iT0 = 1;
273 Int_t iTOF = 1;
274 Int_t iTPC = 1;
275 Int_t iTRD = 1;
276 Int_t iVZERO = 1;
277 Int_t iZDC = 1;
278
279
280 //=================== Alice BODY parameters =============================
281 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
282
283
284 if (iMAG)
285 {
286 //=================== MAG parameters ============================
287 // --- Start with Magnet since detector layouts may be depending ---
288 // --- on the selected Magnet dimensions ---
289 AliMAG *MAG = new AliMAG("MAG", "Magnet");
290 }
291
292
293 if (iABSO)
294 {
295 //=================== ABSO parameters ============================
296 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
297 }
298
299 if (iDIPO)
300 {
301 //=================== DIPO parameters ============================
302
303 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
304 }
305
306 if (iHALL)
307 {
308 //=================== HALL parameters ============================
309
310 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
311 }
312
313
314 if (iFRAME)
315 {
316 //=================== FRAME parameters ============================
317
318 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
319 FRAME->SetHoles(1);
320 }
321
322 if (iSHIL)
323 {
324 //=================== SHIL parameters ============================
325
326 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
327 }
328
329
330 if (iPIPE)
331 {
332 //=================== PIPE parameters ============================
333
334 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
335 }
336
337 if (iITS)
338 {
339 //=================== ITS parameters ============================
340
341 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
342 }
343
344 if (iTPC)
345 {
346 //============================ TPC parameters =====================
347
348 AliTPC *TPC = new AliTPCv2("TPC", "Default");
349 }
350
351
352 if (iTOF) {
353 //=================== TOF parameters ============================
354
355 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
356 }
357
358
359 if (iHMPID)
360 {
361 //=================== HMPID parameters ===========================
362
363 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
364
365 }
366
367
368 if (iZDC)
369 {
370 //=================== ZDC parameters ============================
371
372 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
373 }
374
375 if (iTRD)
376 {
377 //=================== TRD parameters ============================
378
379 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
380 AliTRDgeometry *geoTRD = TRD->GetGeometry();
381 // Partial geometry: modules at 0,8,9,17
382 // starting at 3h in positive direction
383 geoTRD->SetSMstatus(1,0);
384 geoTRD->SetSMstatus(2,0);
385 geoTRD->SetSMstatus(3,0);
386 geoTRD->SetSMstatus(4,0);
387 geoTRD->SetSMstatus(5,0);
388 geoTRD->SetSMstatus(6,0);
389 geoTRD->SetSMstatus(7,0);
390 geoTRD->SetSMstatus(10,0);
391 geoTRD->SetSMstatus(11,0);
392 geoTRD->SetSMstatus(12,0);
393 geoTRD->SetSMstatus(13,0);
394 geoTRD->SetSMstatus(14,0);
395 geoTRD->SetSMstatus(15,0);
396 geoTRD->SetSMstatus(16,0);
397 }
398
399 if (iFMD)
400 {
401 //=================== FMD parameters ============================
402
403 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
404 }
405
406 if (iMUON)
407 {
408 //=================== MUON parameters ===========================
409 // New MUONv1 version (geometry defined via builders)
410
411 AliMUON *MUON = new AliMUONv1("MUON", "default");
412 }
413
414 if (iPHOS)
415 {
416 //=================== PHOS parameters ===========================
417
418 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
419 //Set simulation parameters different from the default ones.
420 AliPHOSSimParam* simEmc = AliPHOSSimParam::GetInstance() ;
421
422 // APD noise of warm (+20C) PHOS:
423 // a2 = a1*(Y1/Y2)*(M1/M2), where a1 = 0.012 is APD noise at -25C,
424 // Y1 = 4.3 photo-electrons/MeV, Y2 = 1.7 p.e/MeV - light yields at -25C and +20C,
425 // M1 = 50, M2 = 50 - APD gain factors chosen for t1 = -25C and t2 = +20C,
426 // Y = MeanLightYield*APDEfficiency.
427
428 Float_t apdNoise = 0.012*2.5;
429 simEmc->SetAPDNoise(apdNoise);
430
431 //Raw Light Yield at +20C
432 simEmc->SetMeanLightYield(18800);
433
434 //ADC channel width at +18C.
435 simEmc->SetADCchannelW(0.0125);
436 }
437
438
439 if (iPMD)
440 {
441 //=================== PMD parameters ============================
442
443 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
444 }
445
446 if (iT0)
447 {
448 //=================== T0 parameters ============================
449 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
450 }
451
452 if (iEMCAL)
453 {
454 //=================== EMCAL parameters ============================
455
456 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
457 }
458
459 if (iACORDE)
460 {
461 //=================== ACORDE parameters ============================
462
463 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
464 }
465
466 if (iVZERO)
467 {
468 //=================== ACORDE parameters ============================
469
470 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
471 }
472}
473//
474// PYTHIA
475//
476
477AliGenerator* MbPythia()
478{
479 comment = comment.Append(" pp at 14 TeV: Pythia low-pt");
480//
481// Pythia
482 AliGenPythia* pythia = new AliGenPythia(-1);
483 pythia->SetMomentumRange(0, 999999.);
484 pythia->SetThetaRange(0., 180.);
485 pythia->SetYRange(-12.,12.);
486 pythia->SetPtRange(0,1000.);
487 pythia->SetProcess(kPyMb);
488 pythia->SetEnergyCMS(energy);
489
490 return pythia;
491}
492
493AliGenerator* MbPhojet()
494{
495 comment = comment.Append(" pp at 14 TeV: Pythia low-pt");
496//
497// DPMJET
498#if defined(__CINT__)
499 gSystem->Load("libdpmjet"); // Parton density functions
500 gSystem->Load("libTDPMjet"); // Parton density functions
501#endif
502 AliGenDPMjet* dpmjet = new AliGenDPMjet(-1);
503 dpmjet->SetMomentumRange(0, 999999.);
504 dpmjet->SetThetaRange(0., 180.);
505 dpmjet->SetYRange(-12.,12.);
506 dpmjet->SetPtRange(0,1000.);
507 dpmjet->SetProcess(kDpmMb);
508 dpmjet->SetEnergyCMS(energy);
509
510 return dpmjet;
511}
512
513void ProcessEnvironmentVars()
514{
515 // Run type
516 if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
517 for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
518 if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0) {
519 proc = (PDC06Proc_t)iRun;
520 cout<<"Run type set to "<<pprRunName[iRun]<<endl;
521 }
522 }
523 }
524
525 // Field
526 if (gSystem->Getenv("CONFIG_FIELD")) {
527 for (Int_t iField = 0; iField < kFieldMax; iField++) {
528 if (strcmp(gSystem->Getenv("CONFIG_FIELD"), pprField[iField])==0) {
529 mag = (Mag_t)iField;
530 cout<<"Field set to "<<pprField[iField]<<endl;
531 }
532 }
533 }
534
535 // Energy
536 if (gSystem->Getenv("CONFIG_ENERGY")) {
537 energy = atoi(gSystem->Getenv("CONFIG_ENERGY"));
538 cout<<"Energy set to "<<energy<<" GeV"<<endl;
539 }
540
541 // Random Number seed
542 if (gSystem->Getenv("CONFIG_SEED")) {
543 seed = atoi(gSystem->Getenv("CONFIG_SEED"));
544 }
545}