]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - macros/g4ConfigCommon.C
From Boris - pos/neg momentums were swapped, missing initialization of covariance...
[u/mrichter/AliRoot.git] / macros / g4ConfigCommon.C
... / ...
CommitLineData
1// $Id$
2//
3// AliRoot Configuration for running aliroot with Monte Carlo.
4// Called from g4Config.C
5//
6// By I. Hrivnacova, IPN Orsay
7
8enum PprGeo_t
9 {
10 kHoles, kNoHoles
11 };
12static PprGeo_t geo = kHoles;
13
14Float_t EtaToTheta(Float_t arg);
15void LoadPythia();
16static Int_t eventsPerRun = 50;
17
18void ConfigCommon(Bool_t setRootGeometry = kTRUE)
19{
20 cout << "Running ConfigCommon.C ... " << endl;
21
22 // Load Pythia libraries
23 LoadPythia();
24
25 // Create the output file
26 AliRunLoader* rl = 0;
27 rl = AliRunLoader::Open("galice.root",
28 AliConfig::GetDefaultEventFolderName(),
29 "recreate");
30 if (!rl) {
31 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
32 return;
33 }
34 rl->SetCompressionLevel(2);
35 rl->SetNumberOfEventsPerFile(3);
36 gAlice->SetRunLoader(rl);
37
38 // Set Root geometry file
39 //
40 if ( setRootGeometry ) {
41 gAlice->SetRootGeometry();
42 gAlice->SetGeometryFromFile("geometry.root");
43 }
44
45 // Set the trigger configuration
46 gAlice->SetTriggerDescriptor("Pb-Pb");
47 cout<<"Trigger configuration is set to Pb-Pb"<<endl;
48
49 // Set Random Number seed
50 gRandom->SetSeed(123456); // Set 0 to use the currecnt time
51 AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
52 int nParticles = 100;
53 if (gSystem->Getenv("CONFIG_NPARTICLES"))
54 {
55 nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
56 }
57
58 AliGenCocktail *gener = new AliGenCocktail();
59 gener->SetPhiRange(0, 360);
60 // Set pseudorapidity range from -8 to 8.
61 Float_t thmin = EtaToTheta(8); // theta min. <---> eta max
62 Float_t thmax = EtaToTheta(-8); // theta max. <---> eta min
63 gener->SetThetaRange(thmin,thmax);
64 gener->SetOrigin(0, 0, 0); //vertex position
65 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
66
67 AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
68 hijingparam->SetMomentumRange(0.2, 999);
69 gener->AddGenerator(hijingparam,"HIJING PARAM",1);
70 gener->Init();
71
72 //
73 // Activate this line if you want the vertex smearing to happen
74 // track by track
75 //
76 //gener->SetVertexSmear(perTrack);
77
78 // =============================
79 // Magnetic field
80 // =============================
81
82 // Field (L3 0.4 T)
83 AliMagFMaps* field = new AliMagFMaps("Maps","Maps", 2, 1., 10., 1);
84 gAlice->SetField(field);
85
86 Int_t iABSO = 1;
87 Int_t iDIPO = 1;
88 Int_t iFMD = 1;
89 Int_t iFRAME = 1;
90 Int_t iHALL = 1;
91 Int_t iITS = 1;
92 Int_t iMAG = 1;
93 Int_t iMUON = 1;
94 Int_t iPHOS = 1;
95 Int_t iPIPE = 1;
96 Int_t iPMD = 1;
97 Int_t iHMPID = 1;
98 Int_t iSHIL = 1;
99 Int_t iT0 = 1;
100 Int_t iTOF = 1;
101 Int_t iTPC = 1;
102 Int_t iTRD = 1;
103 Int_t iZDC = 1;
104 Int_t iEMCAL = 1;
105 Int_t iACORDE = 0;
106 Int_t iVZERO = 1;
107/*
108 Int_t iABSO = 0;
109 Int_t iDIPO = 0;
110 Int_t iFMD = 0;
111 Int_t iFRAME = 0;
112 Int_t iHALL = 0;
113 Int_t iITS = 0;
114 Int_t iMAG = 0;
115 Int_t iMUON = 0;
116 Int_t iPHOS = 0;
117 Int_t iPIPE = 0;
118 Int_t iPMD = 0;
119 Int_t iHMPID = 0;
120 Int_t iSHIL = 0;
121 Int_t iT0 = 0;
122 Int_t iTOF = 0;
123 Int_t iTPC = 1;
124 Int_t iTRD = 0;
125 Int_t iZDC = 0;
126 Int_t iEMCAL = 0;
127 Int_t iACORDE = 0;
128 Int_t iVZERO = 0;
129*/
130// Exluded for problems
131
132 rl->CdGAFile();
133 //=================== Alice BODY parameters =============================
134 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
135
136 if (iMAG)
137 {
138 //=================== MAG parameters ============================
139 // --- Start with Magnet since detector layouts may be depending ---
140 // --- on the selected Magnet dimensions ---
141 AliMAG *MAG = new AliMAG("MAG", "Magnet");
142 }
143
144
145 if (iABSO)
146 {
147 //=================== ABSO parameters ============================
148 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
149 }
150
151 if (iDIPO)
152 {
153 //=================== DIPO parameters ============================
154
155 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
156 }
157
158 if (iHALL)
159 {
160 //=================== HALL parameters ============================
161
162 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
163 }
164
165
166 if (iFRAME)
167 {
168 //=================== FRAME parameters ============================
169
170 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
171 if (geo == kHoles) {
172 FRAME->SetHoles(1);
173 } else {
174 FRAME->SetHoles(0);
175 }
176 }
177
178 if (iSHIL)
179 {
180 //=================== SHIL parameters ============================
181
182 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
183 }
184
185
186 if (iPIPE)
187 {
188 //=================== PIPE parameters ============================
189
190 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
191 }
192
193 if (iITS)
194 {
195 //=================== ITS parameters ============================
196
197 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
198 }
199
200 if (iTPC)
201 {
202 //============================ TPC parameters ===================
203 AliTPC *TPC = new AliTPCv2("TPC", "Default");
204 }
205
206
207 if (iTOF) {
208 //=================== TOF parameters ============================
209 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
210 }
211
212
213 if (iHMPID)
214 {
215 //=================== HMPID parameters ===========================
216 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
217
218 }
219
220
221 if (iZDC)
222 {
223 //=================== ZDC parameters ============================
224
225 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
226 }
227
228 if (iTRD)
229 {
230 //=================== TRD parameters ============================
231
232 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
233 }
234
235 if (iFMD)
236 {
237 //=================== FMD parameters ============================
238 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
239 }
240
241 if (iMUON)
242 {
243 //=================== MUON parameters ===========================
244 // New MUONv1 version (geometry defined via builders)
245 AliMUON *MUON = new AliMUONv1("MUON", "default");
246 }
247 //=================== PHOS parameters ===========================
248
249 if (iPHOS)
250 {
251 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
252 }
253
254
255 if (iPMD)
256 {
257 //=================== PMD parameters ============================
258 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
259 }
260
261 if (iT0)
262 {
263 //=================== T0 parameters ============================
264 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
265 }
266
267 if (iEMCAL)
268 {
269 //=================== EMCAL parameters ============================
270 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
271 }
272
273 if (iACORDE)
274 {
275 //=================== ACORDE parameters ============================
276 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
277 }
278
279 if (iVZERO)
280 {
281 //=================== ACORDE parameters ============================
282 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
283 }
284
285 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
286
287 cout << "Running ConfigCommon.C finished ... " << endl;
288
289}
290
291Float_t EtaToTheta(Float_t arg){
292 return (180./TMath::Pi())*2.*atan(exp(-arg));
293}
294
295void LoadPythia()
296{
297 // Load Pythia related libraries
298 gSystem->Load("liblhapdf.so"); // Parton density functions
299 gSystem->Load("libEGPythia6.so"); // TGenerator interface
300 gSystem->Load("libpythia6.so"); // Pythia
301 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
302}