In vmctest:
[u/mrichter/AliRoot.git] / test / vmctest / gun / commonConfig.C
CommitLineData
267e5cd8 1// $Id$
2//
3// AliRoot Configuration for running aliroot with Monte Carlo.
4// commonConfig() includes the common setting for all MCs
5// which has to be called before MC is instantiated.
6// Called from MC specific configs (g3Config.C, g4Config.C).
7//
8// Extracted from G3 specific Config.C
9// by I. Hrivnacova, IPN Orsay
10
11enum PprTrigConf_t {
12 kDefaultPPTrig, kDefaultPbPbTrig
13};
14
15const char * pprTrigConfName[] = {
16 "p-p","Pb-Pb"
17};
18
19// Options
20static AliMagF::BMap_t smag = AliMagF::k5kG;
21static PprTrigConf_t strig = kDefaultPPTrig; // default PP trigger configuration
22static TString comment;
23
24// Functions
25void LoadPythia();
26
27void commonConfig(Bool_t setRootGeometry = kFALSE)
28{
29 cout << "Running commonConfig.C ... " << endl;
30
31 // Set Random Number seed
32 gRandom->SetSeed(123456); // Set 0 to use the currecnt time
33 AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
34
35
36 //=======================================================================
37 // Load Pythia libraries
38 //=======================================================================
39
40 LoadPythia();
41
42 //=======================================================================
43 // ALICE steering object (AliRunLoader)
44 //=======================================================================
45
46 // Set Root geometry file
47 if ( setRootGeometry ) {
48 gAlice->SetRootGeometry();
49 gAlice->SetGeometryFromFile("geometry.root");
50 }
51
52 AliRunLoader* rl
53 = AliRunLoader::Open("galice.root",
54 AliConfig::GetDefaultEventFolderName(),
55 "recreate");
56 if ( ! rl ) {
57 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
58 return;
59 }
60 rl->SetCompressionLevel(2);
61 rl->SetNumberOfEventsPerFile(3);
62 gAlice->SetRunLoader(rl);
63
64 //======================================================================
65 // Trigger configuration
66 //=======================================================================
67
68 gAlice->SetTriggerDescriptor(pprTrigConfName[strig]);
69 cout << "Trigger configuration is set to " << pprTrigConfName[strig] << endl;
70
71 // =============================
72 // Magnetic field
73 // =============================
74
75 // Field (L3 0.5 T)
76 AliMagF* field = new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG);
77 TGeoGlobalMagField::Instance()->SetField(field);
78
79 printf("\n \n Comment: %s \n \n", comment.Data());
80
81 // =============================
82 // Modules
83 // =============================
84
85 rl->CdGAFile();
86
87 Int_t iABSO = 1;
88 Int_t iDIPO = 1;
89 Int_t iFMD = 1;
90 Int_t iFRAME = 1;
91 Int_t iHALL = 1;
92 Int_t iITS = 1;
93 Int_t iMAG = 1;
94 Int_t iMUON = 1;
95 Int_t iPHOS = 1;
96 Int_t iPIPE = 1;
97 Int_t iPMD = 1;
98 Int_t iHMPID = 1;
99 Int_t iSHIL = 1;
100 Int_t iT0 = 1;
101 Int_t iTOF = 1;
102 Int_t iTPC = 1;
103 Int_t iTRD = 1;
104 Int_t iZDC = 1;
105 Int_t iEMCAL = 1;
106 Int_t iACORDE = 0;
107 Int_t iVZERO = 1;
108/*
109 Int_t iABSO = 0;
110 Int_t iDIPO = 0;
111 Int_t iFMD = 0;
112 Int_t iFRAME = 0;
113 Int_t iHALL = 0;
114 Int_t iITS = 0;
115 Int_t iMAG = 0;
116 Int_t iMUON = 0;
117 Int_t iPHOS = 0;
118 Int_t iPIPE = 0;
119 Int_t iPMD = 0;
120 Int_t iHMPID = 0;
121 Int_t iSHIL = 0;
122 Int_t iT0 = 0;
123 Int_t iTOF = 0;
124 Int_t iTPC = 1;
125 Int_t iTRD = 0;
126 Int_t iZDC = 0;
127 Int_t iEMCAL = 0;
128 Int_t iACORDE = 0;
129 Int_t iVZERO = 0;
130*/
131 rl->CdGAFile();
132 //=================== Alice BODY parameters =============================
133 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
134
135 if (iMAG)
136 {
137 //=================== MAG parameters ============================
138 // --- Start with Magnet since detector layouts may be depending ---
139 // --- on the selected Magnet dimensions ---
140 AliMAG *MAG = new AliMAG("MAG", "Magnet");
141 }
142
143
144 if (iABSO)
145 {
146 //=================== ABSO parameters ============================
147 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
148 }
149
150 if (iDIPO)
151 {
152 //=================== DIPO parameters ============================
153
154 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
155 }
156
157 if (iHALL)
158 {
159 //=================== HALL parameters ============================
160
161 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
162 }
163
164
165 if (iFRAME)
166 {
167 //=================== FRAME parameters ============================
168
169 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
170 FRAME->SetHoles(1);
171 }
172
173 if (iSHIL)
174 {
175 //=================== SHIL parameters ============================
176
177 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
178 }
179
180
181 if (iPIPE)
182 {
183 //=================== PIPE parameters ============================
184
185 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
186 }
187
188 if (iITS)
189 {
190 //=================== ITS parameters ============================
191
192 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
193 }
194
195 if (iTPC)
196 {
197 //============================ TPC parameters ===================
198 AliTPC *TPC = new AliTPCv2("TPC", "Default");
199 }
200
201
202 if (iTOF) {
203 //=================== TOF parameters ============================
204 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
205 }
206
207
208 if (iHMPID)
209 {
210 //=================== HMPID parameters ===========================
211 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
212
213 }
214
215
216 if (iZDC)
217 {
218 //=================== ZDC parameters ============================
219
220 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
221 }
222
223 if (iTRD)
224 {
225 //=================== TRD parameters ============================
226
227 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
228 }
229
230 if (iFMD)
231 {
232 //=================== FMD parameters ============================
233 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
234 }
235
236 if (iMUON)
237 {
238 //=================== MUON parameters ===========================
239 // New MUONv1 version (geometry defined via builders)
240 AliMUON *MUON = new AliMUONv1("MUON", "default");
241 }
242 //=================== PHOS parameters ===========================
243
244 if (iPHOS)
245 {
246 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
247 }
248
249
250 if (iPMD)
251 {
252 //=================== PMD parameters ============================
253 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
254 }
255
256 if (iT0)
257 {
258 //=================== T0 parameters ============================
259 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
260 }
261
262 if (iEMCAL)
263 {
264 //=================== EMCAL parameters ============================
265 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
266 }
267
268 if (iACORDE)
269 {
270 //=================== ACORDE parameters ============================
271 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
272 }
273
274 if (iVZERO)
275 {
276 //=================== ACORDE parameters ============================
277 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
278 }
279
280 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
281
282 cout << "Running commonConfig.C finished ... " << endl;
283}
284
285void LoadPythia()
286{
287 // Load Pythia related libraries
288 gSystem->Load("liblhapdf.so"); // Parton density functions
289 gSystem->Load("libEGPythia6.so"); // TGenerator interface
290 gSystem->Load("libpythia6.so"); // Pythia
291 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
292}