]> git.uio.no Git - u/mrichter/AliRoot.git/blame - STARLIGHT/test/Config.C
Fixed a memory leak (TObjArray::Clear was missing)
[u/mrichter/AliRoot.git] / STARLIGHT / test / Config.C
CommitLineData
da32329d
AM
1//
2// Configuration for p-p Diffraction studies
3// STARLIGHT pp 7000
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 kStarlight, kRunMax,
55};
56
57const char * pprRunName[] = {
58 "kStarlight"
59};
60
61enum Mag_t
62{
63 kNoField, k5kG, kFieldMax
64};
65
66const char * pprField[] = {
67 "kNoField", "k5kG"
68};
69
70//--- Functions ---
71void ProcessEnvironmentVars();
72
73// Generator, field, beam energy
74static PDC06Proc_t proc = kStarlight;
75static Mag_t mag = k5kG;
76static Float_t energy = 7000; // energy in CMS
77static Float_t pBeamEnergy = 3500.; // energy p-Beam
78static Int_t runNumber = 0;
79static Int_t eventOffset = 0;
80
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 // Get settings from environment variables
93 ProcessEnvironmentVars();
94
95 gRandom->SetSeed(seed);
96 cerr<<"Seed for random number generation= "<<seed<<endl;
97
98 // Libraries required by geant321
99#if defined(__CINT__)
100 gSystem->Load("liblhapdf"); // Parton density functions
101 gSystem->Load("libEGPythia6"); // TGenerator interface
102// if (proc == kPythia6 || proc == kPhojet) {
103// gSystem->Load("libpythia6"); // Pythia 6.2
104// } else {
105 gSystem->Load("libpythia6.4.21"); // Pythia 6.4
106// }
107 gSystem->Load("libAliPythia6"); // ALICE specific implementations
108 gSystem->Load("libgeant321");
109#endif
110
111 new TGeant3TGeo("C++ Interface to Geant3");
112
113 //=======================================================================
114 // Create the output file
115
116
117 AliRunLoader* rl=0x0;
118
119 cout<<"Config.C: Creating Run Loader ..."<<endl;
120 rl = AliRunLoader::Open("galice.root",
121 AliConfig::GetDefaultEventFolderName(),
122 "recreate");
123 if (rl == 0x0)
124 {
125 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
126 return;
127 }
128 rl->SetCompressionLevel(2);
129 rl->SetNumberOfEventsPerFile(1000);
a2de4243 130// rl->MakeHeader();
131// rl->MakeStack();
da32329d
AM
132 gAlice->SetRunLoader(rl);
133 // gAlice->SetGeometryFromFile("geometry.root");
134 // gAlice->SetGeometryFromCDB();
135
136 // Set the trigger configuration: proton-proton
137 AliSimulation::Instance()->SetTriggerConfig("p-p");
138
139 //
140 //=======================================================================
141 // ************* STEERING parameters FOR ALICE SIMULATION **************
142 // --- Specify event type to be tracked through the ALICE setup
143 // --- All positions are in cm, angles in degrees, and P and E in GeV
144
145 gMC->SetProcess("DCAY",1);
146 gMC->SetProcess("PAIR",1);
147 gMC->SetProcess("COMP",1);
148 gMC->SetProcess("PHOT",1);
149 gMC->SetProcess("PFIS",0);
150 gMC->SetProcess("DRAY",0);
151 gMC->SetProcess("ANNI",1);
152 gMC->SetProcess("BREM",1);
153 gMC->SetProcess("MUNU",1);
154 gMC->SetProcess("CKOV",1);
155 gMC->SetProcess("HADR",1);
156 gMC->SetProcess("LOSS",2);
157 gMC->SetProcess("MULS",1);
158 gMC->SetProcess("RAYL",1);
159
160 Float_t cut = 1.e-3; // 1MeV cut by default
161 Float_t tofmax = 1.e10;
162
163 gMC->SetCut("CUTGAM", cut);
164 gMC->SetCut("CUTELE", cut);
165 gMC->SetCut("CUTNEU", cut);
166 gMC->SetCut("CUTHAD", cut);
167 gMC->SetCut("CUTMUO", cut);
168 gMC->SetCut("BCUTE", cut);
169 gMC->SetCut("BCUTM", cut);
170 gMC->SetCut("DCUTE", cut);
171 gMC->SetCut("DCUTM", cut);
172 gMC->SetCut("PPCUTM", cut);
173 gMC->SetCut("TOFMAX", tofmax);
174
175 //======================//
176 // Set External decayer //
177 //======================//
178 TVirtualMCDecayer* decayer = new AliDecayerPythia();
179 decayer->SetForceDecay(kAll);
180
181 decayer->Init();
182 gMC->SetExternalDecayer(decayer);
183
184 //=========================//
185 // Generator Configuration //
186 //=========================//
187 AliGenerator* gener = 0x0;
188
189 if (proc == kStarlight) {
da32329d
AM
190 gSystem->Load("libStarLight");
191 gSystem->Load("libAliStarLight.so");
192
193 AliGenStarLight* sl = new AliGenStarLight(1000*1000);
194
a2de4243 195 sl->SetParameter("BEAM_1_Z = 1 #Z of projectile");
196 sl->SetParameter("BEAM_1_A = 1 #A of projectile");
da32329d
AM
197 sl->SetParameter("BEAM_2_Z = 82 #Z of target");
198 sl->SetParameter("BEAM_2_A = 208 #A of target");
a2de4243 199 sl->SetParameter("BEAM_1_GAMMA = 4264.4 #Gamma of the colliding ions");
200 sl->SetParameter("BEAM_2_GAMMA = 1682.4 #Gamma of the colliding ions");
201 sl->SetParameter("W_MAX = 15 #Max value of w");
202 sl->SetParameter("W_MIN = -1 #Min value of w");
da32329d
AM
203 sl->SetParameter("W_N_BINS = 40 #Bins i w");
204 sl->SetParameter("RAP_MAX = 8. #max y");
205 sl->SetParameter("RAP_N_BINS = 80 #Bins i y");
206 sl->SetParameter("CUT_PT = 0 #Cut in pT? 0 = (no, 1 = yes)");
207 sl->SetParameter("PT_MIN = 1.0 #Minimum pT in GeV");
208 sl->SetParameter("PT_MAX = 3.0 #Maximum pT in GeV");
209 sl->SetParameter("CUT_ETA = 0 #Cut in pseudorapidity? (0 = no, 1 = yes)");
210 sl->SetParameter("ETA_MIN = -10 #Minimum pseudorapidity");
211 sl->SetParameter("ETA_MAX = 10 #Maximum pseudorapidity");
212 sl->SetParameter("PROD_MODE = 2 #gg or gP switch (1 = 2-photon, 2 = coherent vector meson (narrow), 3 = coherent vector meson (wide), # 4 = incoherent vector meson, 5 = A+A DPMJet single, 6 = A+A DPMJet double, 7 = p+A DPMJet single, 8 = p+A Pythia single )");
da32329d 213 sl->SetParameter("PROD_PID = 113 #Channel of interest (not relevant for photonuclear processes)");
a2de4243 214 sl->SetParameter("RND_SEED = 34533 #Random number seed");
da32329d
AM
215 sl->SetParameter("BREAKUP_MODE = 5 #Controls the nuclear breakup");
216 sl->SetParameter("INTERFERENCE = 0 #Interference (0 = off, 1 = on)");
217 sl->SetParameter("IF_STRENGTH = 1. #% of intefernce (0.0 - 0.1)");
218 sl->SetParameter("COHERENT = 1 #Coherent=1,Incoherent=0");
219 sl->SetParameter("INCO_FACTOR = 1. #percentage of incoherence");
da32329d
AM
220 sl->SetParameter("INT_PT_MAX = 0.24 #Maximum pt considered, when interference is turned on");
221 sl->SetParameter("INT_PT_N_BINS = 120 #Number of pt bins when interference is turned on");
222
223 sl->Init();
224 sl->GetTStarLight()->PrintInputs(std::cout);
225
226 AliGenerator* gener = sl;
227 gener->SetOrigin(0, 0, 0); // vertex position
228 gener->SetSigma(0, 0, 5.3); // Sigma in (X,Y,Z) (cm) on IP position
229 gener->SetCutVertexZ(1.); // Truncate at 1 sigma
230 gener->SetVertexSmear(kPerEvent);
231 gener->SetTrackingFlag(1);
52284ebd 232 gener->SetYRange(-0.9, 0.9);
da32329d
AM
233 gener->Init();
234 }
235
236 //
237 //
238 // Size of the interaction diamond
239 // Longitudinal
240 Float_t sigmaz = 5.4 / TMath::Sqrt(2.); // [cm]
241 // if (energy == 900)
242 //sigmaz = 10.5 / TMath::Sqrt(2.); // [cm]
243 //sigmaz = 3.7;
244 if (energy == 7000)
245 sigmaz = 6.3 / TMath::Sqrt(2.); // [cm]
246
247 //
248 // Transverse
249 Float_t betast = 10; // beta* [m]
250 if (runNumber >= 117048) betast = 2.;
251 if (runNumber > 122375) betast = 3.5; // starting with fill 1179
252
253 Float_t eps = 5.e-6; // emittance [m]
254 Float_t gamma = energy / 2.0 / 0.938272; // relativistic gamma [1]
255 Float_t sigmaxy = TMath::Sqrt(eps * betast / gamma) / TMath::Sqrt(2.) * 100.; // [cm]
256 printf("\n \n Diamond size x-y: %10.3e z: %10.3e\n \n", sigmaxy, sigmaz);
257
258 gener->SetSigma(sigmaxy, sigmaxy, sigmaz); // Sigma in (X,Y,Z) (cm) on IP position
259 gener->SetVertexSmear(kPerEvent);
260 gener->Init();
261
262 printf("\n \n Comment: %s \n \n", comment.Data());
263
264 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
265 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG,
266 AliMagF::kBeamTypepp, pBeamEnergy));
267
268 rl->CdGAFile();
269
270 Int_t iABSO = 1;
271 Int_t iACORDE= 0;
272 Int_t iDIPO = 1;
273 Int_t iEMCAL = 1;
274 Int_t iFMD = 1;
275 Int_t iFRAME = 1;
276 Int_t iHALL = 1;
277 Int_t iITS = 1;
278 Int_t iMAG = 1;
279 Int_t iMUON = 1;
280 Int_t iPHOS = 1;
281 Int_t iPIPE = 1;
282 Int_t iPMD = 1;
283 Int_t iHMPID = 1;
284 Int_t iSHIL = 1;
285 Int_t iT0 = 1;
286 Int_t iTOF = 1;
287 Int_t iTPC = 1;
288 Int_t iTRD = 1;
289 Int_t iVZERO = 1;
290 Int_t iZDC = 1;
291
292
293 //=================== Alice BODY parameters =============================
294 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
295
296
297 if (iMAG)
298 {
299 //=================== MAG parameters ============================
300 // --- Start with Magnet since detector layouts may be depending ---
301 // --- on the selected Magnet dimensions ---
302 AliMAG *MAG = new AliMAG("MAG", "Magnet");
303 }
304
305
306 if (iABSO)
307 {
308 //=================== ABSO parameters ============================
309 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
310 }
311
312 if (iDIPO)
313 {
314 //=================== DIPO parameters ============================
315
316 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
317 }
318
319 if (iHALL)
320 {
321 //=================== HALL parameters ============================
322
323 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
324 }
325
326
327 if (iFRAME)
328 {
329 //=================== FRAME parameters ============================
330
331 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
332 FRAME->SetHoles(1);
333 }
334
335 if (iSHIL)
336 {
337 //=================== SHIL parameters ============================
338
339 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
340 }
341
342
343 if (iPIPE)
344 {
345 //=================== PIPE parameters ============================
346
347 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
348 }
349
350 if (iITS)
351 {
352 //=================== ITS parameters ============================
353
354 AliITS *ITS = new AliITSv11("ITS","ITS v11");
355 }
356
357 if (iTPC)
358 {
359 //============================ TPC parameters =====================
360
361 AliTPC *TPC = new AliTPCv2("TPC", "Default");
362 }
363
364
365 if (iTOF) {
366 //=================== TOF parameters ============================
367
368 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
369 }
370
371
372 if (iHMPID)
373 {
374 //=================== HMPID parameters ===========================
375
376 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
377
378 }
379
380
381 if (iZDC)
382 {
383 //=================== ZDC parameters ============================
384
385 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
386 }
387
388 if (iTRD)
389 {
390 //=================== TRD parameters ============================
391
392 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
393 AliTRDgeometry *geoTRD = TRD->GetGeometry();
394 // Partial geometry: modules at 0,1,7,8,9,16,17
395 // starting at 3h in positive direction
396 geoTRD->SetSMstatus(2,0);
397 geoTRD->SetSMstatus(3,0);
398 geoTRD->SetSMstatus(4,0);
399 geoTRD->SetSMstatus(5,0);
400 geoTRD->SetSMstatus(6,0);
401 geoTRD->SetSMstatus(11,0);
402 geoTRD->SetSMstatus(12,0);
403 geoTRD->SetSMstatus(13,0);
404 geoTRD->SetSMstatus(14,0);
405 geoTRD->SetSMstatus(15,0);
406 geoTRD->SetSMstatus(16,0);
407 }
408
409 if (iFMD)
410 {
411 //=================== FMD parameters ============================
412
413 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
414 }
415
416 if (iMUON)
417 {
418 //=================== MUON parameters ===========================
419 // New MUONv1 version (geometry defined via builders)
420
421 AliMUON *MUON = new AliMUONv1("MUON", "default");
422 }
423
424 if (iPHOS)
425 {
426 //=================== PHOS parameters ===========================
427
428 AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV_Modules123");
429
430 }
431
432
433 if (iPMD)
434 {
435 //=================== PMD parameters ============================
436
437 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
438 }
439
440 if (iT0)
441 {
442 //=================== T0 parameters ============================
443 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
444 }
445
446 if (iEMCAL)
447 {
448 //=================== EMCAL parameters ============================
449
450 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEAR");
451 }
452
453 if (iACORDE)
454 {
455 //=================== ACORDE parameters ============================
456
457 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
458 }
459
460 if (iVZERO)
461 {
462 //=================== ACORDE parameters ============================
463
464 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
465 }
466}
467
468void ProcessEnvironmentVars()
469{
470 // Run type
471 if (gSystem->Getenv("CONFIG_RUN_TYPE")) {
472 for (Int_t iRun = 0; iRun < kRunMax; iRun++) {
473 if (strcmp(gSystem->Getenv("CONFIG_RUN_TYPE"), pprRunName[iRun])==0) {
474 proc = (PDC06Proc_t)iRun;
475 cout<<"Run type set to "<<pprRunName[iRun]<<endl;
476 }
477 }
478 }
479 // Field
480 if (gSystem->Getenv("CONFIG_FIELD")) {
481 for (Int_t iField = 0; iField < kFieldMax; iField++) {
482 if (strcmp(gSystem->Getenv("CONFIG_FIELD"), pprField[iField])==0) {
483 mag = (Mag_t)iField;
484 cout<<"Field set to "<<pprField[iField]<<endl;
485 }
486 }
487 }
488 // Energy
489 if (gSystem->Getenv("CONFIG_ENERGY")) {
490 energy = atoi(gSystem->Getenv("CONFIG_ENERGY"));
491 cout<<"Energy set to "<<energy<<" GeV"<<endl;
492 }
493 // Random Number seed
494 if (gSystem->Getenv("CONFIG_SEED")) {
495 seed = atoi(gSystem->Getenv("CONFIG_SEED"));
496 }
497 // Run number
498 if (gSystem->Getenv("DC_RUN")) {
499 runNumber = atoi(gSystem->Getenv("DC_RUN"));
500 }
501 // Event offset
502 if (gSystem->Getenv("DC_EVENT")) {
503 eventOffset = 400*(atoi(gSystem->Getenv("DC_EVENT")) - 1); // 400 events per job (->sim.C)
504 std::cout << "eventOffset= " << eventOffset << std::endl;
505 }
506}
507