Removing obsolete macros
[u/mrichter/AliRoot.git] / test / vmctest / lego / commonConfig.C
CommitLineData
e2251cfe 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
19enum ConfigVersion_t {
20 kConfigV0, // default configuration
21 kConfigV1 // configuration for LHC 2010 production
22};
23
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
32void commonConfig(const TString& det,
33 ConfigVersion_t configVersion = kConfigV0)
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 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 AliSimulation::Instance()->SetTriggerConfig(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 = 0;
88 Int_t iDIPO = 0;
89 Int_t iFMD = 0;
90 Int_t iFRAME = 0;
91 Int_t iHALL = 0;
92 Int_t iITS = 0;
93 Int_t iMAG = 0;
94 Int_t iMUON = 0;
95 Int_t iPHOS = 0;
96 Int_t iPIPE = 0;
97 Int_t iPMD = 0;
98 Int_t iHMPID = 0;
99 Int_t iSHIL = 0;
100 Int_t iT0 = 0;
101 Int_t iTOF = 0;
102 Int_t iTPC = 0;
103 Int_t iTRD = 0;
104 Int_t iZDC = 0;
105 Int_t iEMCAL = 0;
106 Int_t iACORDE = 0;
107 Int_t iVZERO = 0;
108
109 if ( det == "ABSO" ) iABSO = 1;
110 if ( det == "DIPO" ) iDIPO = 1;
111 if ( det == "FMD" ) iFMD = 1;
112 if ( det == "FRAME" ) iFRAME = 1;
113 if ( det == "HALL" ) iHALL = 1;
114 if ( det == "ITS" ) iITS = 1;
115 if ( det == "MAG" ) iMAG = 1;
116 if ( det == "MUON" ) iMUON = 1;
117 if ( det == "PHOS" ) iPHOS = 1;
118 if ( det == "PIPE" ) iPIPE = 1;
119 if ( det == "PMD" ) iPMD = 1;
120 if ( det == "HMPID" ) iHMPID = 1;
121 if ( det == "SHIL" ) iSHIL = 1;
122 if ( det == "T0" ) iT0 = 1;
123 if ( det == "TOF" ) iTOF = 1;
124 if ( det == "TPC" ) iTPC = 1;
125 if ( det == "TRD" ) iTRD = 1;
126 if ( det == "ZDC" ) iZDC = 1;
127 if ( det == "EMCAL" ) iEMCAL = 1;
128 if ( det == "ACORDE" ) iACORDE = 1;
129 if ( det == "VZERO" ) iVZERO = 1;
130
131 if ( det == "ALL" ) {
132 iABSO = 1;
133 iDIPO = 1;
134 iFMD = 1;
135 iFRAME = 1;
136 iHALL = 1;
137 iITS = 1;
138 iMAG = 1;
139 iMUON = 1;
140 iPHOS = 1;
141 iPIPE = 1;
142 iPMD = 1;
143 iHMPID = 1;
144 iSHIL = 1;
145 iT0 = 1;
146 iTOF = 1;
147 iTPC = 1;
148 iTRD = 1;
149 iZDC = 1;
150 iEMCAL = 1;
151 iACORDE = 1;
152 iVZERO = 1;
153 }
154
155 rl->CdGAFile();
156 //=================== Alice BODY parameters =============================
157 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
158
159 if (iMAG)
160 {
161 //=================== MAG parameters ============================
162 // --- Start with Magnet since detector layouts may be depending ---
163 // --- on the selected Magnet dimensions ---
164 AliMAG *MAG = new AliMAG("MAG", "Magnet");
165 }
166
167
168 if (iABSO)
169 {
170 //=================== ABSO parameters ============================
171 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
172 }
173
174 if (iDIPO)
175 {
176 //=================== DIPO parameters ============================
177
178 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
179 }
180
181 if (iHALL)
182 {
183 //=================== HALL parameters ============================
184
185 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
186 }
187
188
189 if (iFRAME)
190 {
191 //=================== FRAME parameters ============================
192
193 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
194 FRAME->SetHoles(1);
195 }
196
197 if (iSHIL)
198 {
199 //=================== SHIL parameters ============================
200
201 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
202 }
203
204
205 if (iPIPE)
206 {
207 //=================== PIPE parameters ============================
208
209 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
210 }
211
212 if (iITS)
213 {
214 //=================== ITS parameters ============================
215
216 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
217 }
218
219 if (iTPC)
220 {
221 //============================ TPC parameters ===================
222 AliTPC *TPC = new AliTPCv2("TPC", "Default");
223 }
224
225
226 if (iTOF) {
227 //=================== TOF parameters ============================
228 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
229 }
230
231
232 if (iHMPID)
233 {
234 //=================== HMPID parameters ===========================
235 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
236
237 }
238
239
240 if (iZDC)
241 {
242 //=================== ZDC parameters ============================
243
244 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
245 }
246
247 if (iTRD)
248 {
249 //=================== TRD parameters ============================
250
251 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
252 if ( configVersion == kConfigV1 ) {
253 AliTRDgeometry *geoTRD = TRD->GetGeometry();
254 // Partial geometry: modules at 0,1,7,8,9,16,17
255 // starting at 3h in positive direction
256 geoTRD->SetSMstatus(2,0);
257 geoTRD->SetSMstatus(3,0);
258 geoTRD->SetSMstatus(4,0);
259 geoTRD->SetSMstatus(5,0);
260 geoTRD->SetSMstatus(6,0);
261 geoTRD->SetSMstatus(11,0);
262 geoTRD->SetSMstatus(12,0);
263 geoTRD->SetSMstatus(13,0);
264 geoTRD->SetSMstatus(14,0);
265 geoTRD->SetSMstatus(15,0);
266 geoTRD->SetSMstatus(16,0);
267 }
268 }
269
270 if (iFMD)
271 {
272 //=================== FMD parameters ============================
273 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
274 }
275
276 if (iMUON)
277 {
278 //=================== MUON parameters ===========================
279 // New MUONv1 version (geometry defined via builders)
280 AliMUON *MUON = new AliMUONv1("MUON", "default");
281 }
282 //=================== PHOS parameters ===========================
283
284 if (iPHOS)
285 {
286 if ( configVersion == kConfigV0 )
287 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
288 else if ( configVersion == kConfigV1 )
289 AliPHOS *PHOS = new AliPHOSv1("PHOS", "noCPV_Modules123");
290 }
291
292
293 if (iPMD)
294 {
295 //=================== PMD parameters ============================
296 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
297 }
298
299 if (iT0)
300 {
301 //=================== T0 parameters ============================
302 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
303 }
304
305 if (iEMCAL)
306 {
307 //=================== EMCAL parameters ============================
308 if ( configVersion == kConfigV0 )
309 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETEV1");
310 else if ( configVersion == kConfigV1 )
311 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_FIRSTYEARV1");
312 }
313
314 if (iACORDE)
315 {
316 //=================== ACORDE parameters ============================
317 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
318 }
319
320 if (iVZERO)
321 {
322 //=================== VZERO parameters ============================
323 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
324 }
325
326 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
327
328 cout << "Running commonConfig.C finished ... " << endl;
329}
330
331void LoadPythia()
332{
333 // Load Pythia related libraries
334 gSystem->Load("liblhapdf.so"); // Parton density functions
335 gSystem->Load("libEGPythia6.so"); // TGenerator interface
336 gSystem->Load("libpythia6.so"); // Pythia
337 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
338}