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