In vmctest/*/commonConfig.C:
[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
e56208c2 19enum ConfigVersion_t {
20 kConfigV0, // default configuration
21 kConfigV1 // configuration for LHC production
22};
23
267e5cd8 24// Options
25static AliMagF::BMap_t smag = AliMagF::k5kG;
26static PprTrigConf_t strig = kDefaultPPTrig; // default PP trigger configuration
27static TString comment;
28
29// Functions
30void LoadPythia();
31
e56208c2 32void commonConfig(Bool_t setRootGeometry = kFALSE,
33 ConfigVersion_t configVersion = kConfigV1)
267e5cd8 34{
35 cout << "Running commonConfig.C ... " << endl;
36
37 // Set Random Number seed
38 gRandom->SetSeed(123456); // Set 0 to use the currecnt time
39 AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
40
41
42 //=======================================================================
43 // Load Pythia libraries
44 //=======================================================================
45
46 LoadPythia();
47
48 //=======================================================================
49 // ALICE steering object (AliRunLoader)
50 //=======================================================================
51
52 // Set Root geometry file
53 if ( setRootGeometry ) {
878f3d54 54 AliSimulation::Instance()->SetGeometryFile("geometry.root");
267e5cd8 55 }
56
57 AliRunLoader* rl
58 = AliRunLoader::Open("galice.root",
59 AliConfig::GetDefaultEventFolderName(),
60 "recreate");
61 if ( ! rl ) {
62 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
63 return;
64 }
65 rl->SetCompressionLevel(2);
66 rl->SetNumberOfEventsPerFile(3);
67 gAlice->SetRunLoader(rl);
68
69 //======================================================================
70 // Trigger configuration
71 //=======================================================================
72
28da60d3 73 AliSimulation::Instance()->SetTriggerConfig(pprTrigConfName[strig]);
267e5cd8 74 cout << "Trigger configuration is set to " << pprTrigConfName[strig] << endl;
75
76 // =============================
77 // Magnetic field
78 // =============================
79
80 // Field (L3 0.5 T)
81 AliMagF* field = new AliMagF("Maps","Maps", -1., -1., AliMagF::k5kG);
82 TGeoGlobalMagField::Instance()->SetField(field);
83
84 printf("\n \n Comment: %s \n \n", comment.Data());
85
86 // =============================
87 // Modules
88 // =============================
89
90 rl->CdGAFile();
91
92 Int_t iABSO = 1;
93 Int_t iDIPO = 1;
94 Int_t iFMD = 1;
95 Int_t iFRAME = 1;
96 Int_t iHALL = 1;
97 Int_t iITS = 1;
98 Int_t iMAG = 1;
99 Int_t iMUON = 1;
100 Int_t iPHOS = 1;
101 Int_t iPIPE = 1;
102 Int_t iPMD = 1;
103 Int_t iHMPID = 1;
104 Int_t iSHIL = 1;
105 Int_t iT0 = 1;
106 Int_t iTOF = 1;
107 Int_t iTPC = 1;
108 Int_t iTRD = 1;
109 Int_t iZDC = 1;
110 Int_t iEMCAL = 1;
111 Int_t iACORDE = 0;
112 Int_t iVZERO = 1;
113/*
114 Int_t iABSO = 0;
115 Int_t iDIPO = 0;
116 Int_t iFMD = 0;
117 Int_t iFRAME = 0;
118 Int_t iHALL = 0;
119 Int_t iITS = 0;
120 Int_t iMAG = 0;
121 Int_t iMUON = 0;
122 Int_t iPHOS = 0;
123 Int_t iPIPE = 0;
124 Int_t iPMD = 0;
125 Int_t iHMPID = 0;
126 Int_t iSHIL = 0;
127 Int_t iT0 = 0;
128 Int_t iTOF = 0;
129 Int_t iTPC = 1;
130 Int_t iTRD = 0;
131 Int_t iZDC = 0;
132 Int_t iEMCAL = 0;
133 Int_t iACORDE = 0;
134 Int_t iVZERO = 0;
135*/
136 rl->CdGAFile();
137 //=================== Alice BODY parameters =============================
138 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
139
140 if (iMAG)
141 {
142 //=================== MAG parameters ============================
143 // --- Start with Magnet since detector layouts may be depending ---
144 // --- on the selected Magnet dimensions ---
145 AliMAG *MAG = new AliMAG("MAG", "Magnet");
146 }
147
148
149 if (iABSO)
150 {
151 //=================== ABSO parameters ============================
152 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
153 }
154
155 if (iDIPO)
156 {
157 //=================== DIPO parameters ============================
158
159 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
160 }
161
162 if (iHALL)
163 {
164 //=================== HALL parameters ============================
165
166 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
167 }
168
169
170 if (iFRAME)
171 {
172 //=================== FRAME parameters ============================
173
174 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
175 FRAME->SetHoles(1);
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");
e56208c2 233 if ( configVersion == kConfigV1 ) {
234 AliTRDgeometry *geoTRD = TRD->GetGeometry();
235 // Partial geometry: modules at 0,1,7,8,9,16,17
236 // starting at 3h in positive direction
237 geoTRD->SetSMstatus(2,0);
238 geoTRD->SetSMstatus(3,0);
239 geoTRD->SetSMstatus(4,0);
240 geoTRD->SetSMstatus(5,0);
241 geoTRD->SetSMstatus(6,0);
242 geoTRD->SetSMstatus(11,0);
243 geoTRD->SetSMstatus(12,0);
244 geoTRD->SetSMstatus(13,0);
245 geoTRD->SetSMstatus(14,0);
246 geoTRD->SetSMstatus(15,0);
247 geoTRD->SetSMstatus(16,0);
248 }
267e5cd8 249 }
250
251 if (iFMD)
252 {
253 //=================== FMD parameters ============================
254 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
255 }
256
257 if (iMUON)
258 {
259 //=================== MUON parameters ===========================
260 // New MUONv1 version (geometry defined via builders)
261 AliMUON *MUON = new AliMUONv1("MUON", "default");
262 }
263 //=================== PHOS parameters ===========================
264
265 if (iPHOS)
266 {
e56208c2 267 if ( configVersion == kConfigV0 )
268 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
269 else if ( configVersion == kConfigV1 )
270 AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV_Modules123");
267e5cd8 271 }
272
273
274 if (iPMD)
275 {
276 //=================== PMD parameters ============================
277 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
278 }
279
280 if (iT0)
281 {
282 //=================== T0 parameters ============================
283 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
284 }
285
286 if (iEMCAL)
287 {
288 //=================== EMCAL parameters ============================
e56208c2 289 if ( configVersion == kConfigV0 )
267e5cd8 290 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
e56208c2 291 else if ( configVersion == kConfigV1 )
292 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEAR");
267e5cd8 293 }
294
295 if (iACORDE)
296 {
297 //=================== ACORDE parameters ============================
298 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
299 }
300
301 if (iVZERO)
302 {
e56208c2 303 //=================== VZERO parameters ============================
267e5cd8 304 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
305 }
306
307 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
308
309 cout << "Running commonConfig.C finished ... " << endl;
310}
311
312void LoadPythia()
313{
314 // Load Pythia related libraries
315 gSystem->Load("liblhapdf.so"); // Parton density functions
316 gSystem->Load("libEGPythia6.so"); // TGenerator interface
317 gSystem->Load("libpythia6.so"); // Pythia
318 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
319}