config-file to generate the geometry setup for 2012
[u/mrichter/AliRoot.git] / macros / g4ConfigCommon.C
CommitLineData
1fccbbe0 1// $Id$
2//
3// AliRoot Configuration for running aliroot with Monte Carlo.
4// Called from g4Config.C
e14b4d5a 5//
6// By I. Hrivnacova, IPN Orsay
7
8enum PprGeo_t
9 {
10 kHoles, kNoHoles
11 };
12static PprGeo_t geo = kHoles;
1fccbbe0 13
913c1adf 14Float_t EtaToTheta(Float_t arg);
e14b4d5a 15void LoadPythia();
9ac91a91 16static Int_t eventsPerRun = 50;
1fccbbe0 17
e14b4d5a 18void ConfigCommon(Bool_t setRootGeometry = kTRUE)
1fccbbe0 19{
e14b4d5a 20 cout << "Running ConfigCommon.C ... " << endl;
21
22 // Load Pythia libraries
23 LoadPythia();
1fccbbe0 24
25 // Create the output file
913c1adf 26 AliRunLoader* rl = 0;
27 rl = AliRunLoader::Open("galice.root",
f5a857b2 28 AliConfig::GetDefaultEventFolderName(),
913c1adf 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);
e14b4d5a 37
38 // Set Root geometry file
39 //
40 if ( setRootGeometry ) {
41 gAlice->SetRootGeometry();
42 gAlice->SetGeometryFromFile("geometry.root");
43 }
9ac91a91 44
45 // Set the trigger configuration
28da60d3 46 AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
9ac91a91 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__);
e14b4d5a 52 int nParticles = 100;
9ac91a91 53 if (gSystem->Getenv("CONFIG_NPARTICLES"))
54 {
55 nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
56 }
1fccbbe0 57
9ac91a91 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);
1fccbbe0 77
78 // =============================
79 // Magnetic field
80 // =============================
81
9ac91a91 82 // Field (L3 0.4 T)
4642ac4b 83 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
9ac91a91 84
85 Int_t iABSO = 1;
86 Int_t iDIPO = 1;
87 Int_t iFMD = 1;
88 Int_t iFRAME = 1;
89 Int_t iHALL = 1;
90 Int_t iITS = 1;
91 Int_t iMAG = 1;
92 Int_t iMUON = 1;
93 Int_t iPHOS = 1;
94 Int_t iPIPE = 1;
95 Int_t iPMD = 1;
96 Int_t iHMPID = 1;
97 Int_t iSHIL = 1;
98 Int_t iT0 = 1;
99 Int_t iTOF = 1;
100 Int_t iTPC = 1;
101 Int_t iTRD = 1;
102 Int_t iZDC = 1;
103 Int_t iEMCAL = 1;
104 Int_t iACORDE = 0;
105 Int_t iVZERO = 1;
e14b4d5a 106/*
107 Int_t iABSO = 0;
108 Int_t iDIPO = 0;
109 Int_t iFMD = 0;
110 Int_t iFRAME = 0;
111 Int_t iHALL = 0;
112 Int_t iITS = 0;
113 Int_t iMAG = 0;
114 Int_t iMUON = 0;
115 Int_t iPHOS = 0;
116 Int_t iPIPE = 0;
117 Int_t iPMD = 0;
118 Int_t iHMPID = 0;
119 Int_t iSHIL = 0;
120 Int_t iT0 = 0;
121 Int_t iTOF = 0;
122 Int_t iTPC = 1;
123 Int_t iTRD = 0;
124 Int_t iZDC = 0;
125 Int_t iEMCAL = 0;
126 Int_t iACORDE = 0;
127 Int_t iVZERO = 0;
128*/
129// Exluded for problems
9ac91a91 130
131 rl->CdGAFile();
1fccbbe0 132 //=================== Alice BODY parameters =============================
133 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
134
1fccbbe0 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 ============================
9ac91a91 147 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
1fccbbe0 148 }
149
150 if (iDIPO)
151 {
152 //=================== DIPO parameters ============================
153
9ac91a91 154 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
1fccbbe0 155 }
156
157 if (iHALL)
158 {
159 //=================== HALL parameters ============================
160
9ac91a91 161 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
1fccbbe0 162 }
163
164
165 if (iFRAME)
166 {
167 //=================== FRAME parameters ============================
168
169 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
e14b4d5a 170 if (geo == kHoles) {
171 FRAME->SetHoles(1);
172 } else {
173 FRAME->SetHoles(0);
174 }
1fccbbe0 175 }
176
177 if (iSHIL)
178 {
179 //=================== SHIL parameters ============================
180
9ac91a91 181 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
1fccbbe0 182 }
183
184
185 if (iPIPE)
186 {
187 //=================== PIPE parameters ============================
188
9ac91a91 189 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
1fccbbe0 190 }
191
e14b4d5a 192 if (iITS)
193 {
194 //=================== ITS parameters ============================
9ac91a91 195
3a5fcc75 196 AliITS *ITS = new AliITSv11("ITS","ITS v11");
9ac91a91 197 }
1fccbbe0 198
199 if (iTPC)
200 {
26ca4b4a 201 //============================ TPC parameters ===================
1fccbbe0 202 AliTPC *TPC = new AliTPCv2("TPC", "Default");
1fccbbe0 203 }
204
9ac91a91 205
206 if (iTOF) {
1fccbbe0 207 //=================== TOF parameters ============================
0d7ef405 208 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
1fccbbe0 209 }
210
9ac91a91 211
de1857bb 212 if (iHMPID)
1fccbbe0 213 {
de1857bb 214 //=================== HMPID parameters ===========================
e14b4d5a 215 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
9ac91a91 216
1fccbbe0 217 }
218
219
220 if (iZDC)
221 {
222 //=================== ZDC parameters ============================
223
9d07603a 224 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
1fccbbe0 225 }
226
227 if (iTRD)
228 {
229 //=================== TRD parameters ============================
230
231 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
1fccbbe0 232 }
233
234 if (iFMD)
235 {
236 //=================== FMD parameters ============================
9ac91a91 237 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
238 }
1fccbbe0 239
240 if (iMUON)
241 {
242 //=================== MUON parameters ===========================
9ac91a91 243 // New MUONv1 version (geometry defined via builders)
1fccbbe0 244 AliMUON *MUON = new AliMUONv1("MUON", "default");
245 }
246 //=================== PHOS parameters ===========================
247
248 if (iPHOS)
249 {
9cc36300 250 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
1fccbbe0 251 }
252
253
254 if (iPMD)
255 {
256 //=================== PMD parameters ============================
257 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
258 }
259
ababa197 260 if (iT0)
1fccbbe0 261 {
ababa197 262 //=================== T0 parameters ============================
263 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
1fccbbe0 264 }
265
266 if (iEMCAL)
267 {
268 //=================== EMCAL parameters ============================
e14b4d5a 269 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
1fccbbe0 270 }
271
9ac91a91 272 if (iACORDE)
1fccbbe0 273 {
b384f8a4 274 //=================== ACORDE parameters ============================
f7882672 275 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
1fccbbe0 276 }
277
9ac91a91 278 if (iVZERO)
1fccbbe0 279 {
b384f8a4 280 //=================== ACORDE parameters ============================
4a2f6442 281 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
1fccbbe0 282 }
283
9ac91a91 284 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
67d736ee 285
e14b4d5a 286 cout << "Running ConfigCommon.C finished ... " << endl;
287
1fccbbe0 288}
289
290Float_t EtaToTheta(Float_t arg){
291 return (180./TMath::Pi())*2.*atan(exp(-arg));
292}
e14b4d5a 293
294void LoadPythia()
295{
296 // Load Pythia related libraries
297 gSystem->Load("liblhapdf.so"); // Parton density functions
298 gSystem->Load("libEGPythia6.so"); // TGenerator interface
299 gSystem->Load("libpythia6.so"); // Pythia
300 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations
301}