]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TPC/testMC/ConfigHM.C
Update master to aliroot
[u/mrichter/AliRoot.git] / TPC / testMC / ConfigHM.C
CommitLineData
d37e991a 1/// \file ConfigHM.C
2/// One can use the configuration macro in compiled mode by
3/// ~~~
4/// root [0] gSystem->Load("libgeant321");
5/// root [0] gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include\
6/// -I$ALICE_ROOT -I$ALICE/geant3/TGeant3");
7/// root [0] .x grun.C(1,"Config.C++")
8/// ~~~
75c56124 9
10#if !defined(__CINT__) || defined(__MAKECINT__)
11#include <Riostream.h>
12#include <TRandom.h>
13#include <TSystem.h>
14#include <TVirtualMC.h>
15#include <TGeant3TGeo.h>
16#include "STEER/AliRunLoader.h"
17#include "STEER/AliRun.h"
18#include "STEER/AliConfig.h"
19#include "PYTHIA6/AliDecayerPythia.h"
20#include "EVGEN/AliGenCocktail.h"
21#include "EVGEN/AliGenHIJINGpara.h"
f7a1cc68 22#include "STEER/AliMagF.h"
75c56124 23#include "STRUCT/AliBODY.h"
24#include "STRUCT/AliMAG.h"
25#include "STRUCT/AliABSOv3.h"
26#include "STRUCT/AliDIPOv3.h"
27#include "STRUCT/AliHALLv3.h"
28#include "STRUCT/AliFRAMEv2.h"
29#include "STRUCT/AliSHILv3.h"
30#include "STRUCT/AliPIPEv3.h"
31#include "ITS/AliITSvPPRasymmFMD.h"
32#include "TPC/AliTPCv2.h"
33#include "TOF/AliTOFv6T0.h"
34#include "HMPID/AliHMPIDv2.h"
35#include "ZDC/AliZDCv2.h"
36#include "TRD/AliTRDv1.h"
37#include "FMD/AliFMDv1.h"
38#include "MUON/AliMUONv1.h"
39#include "PHOS/AliPHOSv1.h"
40#include "PMD/AliPMDv1.h"
41#include "T0/AliT0v1.h"
42#include "EMCAL/AliEMCALv2.h"
43#include "ACORDE/AliACORDEv0.h"
44#include "VZERO/AliVZEROv7.h"
45#endif
46
47Float_t EtaToTheta(Float_t arg);
48
49void Config()
50{
d37e991a 51 /// ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
52 /// Theta range given through pseudorapidity limits 22/6/2001
75c56124 53
54 // Set Random Number seed
55 gRandom->SetSeed(0); // Set 0 to use the currecnt time
56 AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
57
58
59 // libraries required by geant321
60#if defined(__CINT__)
61 gSystem->Load("libgeant321");
62#endif
63
64 new TGeant3TGeo("C++ Interface to Geant3");
65
66 if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
162637e4 67 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
75c56124 68 AliCDBManager::Instance()->SetRun(0);
69 }
70
71 AliRunLoader* rl=0x0;
72
73 AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
74
75 rl = AliRunLoader::Open("galice.root",
76 AliConfig::GetDefaultEventFolderName(),
77 "recreate");
78 if (rl == 0x0)
79 {
80 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
81 return;
82 }
83 rl->SetCompressionLevel(2);
84 rl->SetNumberOfEventsPerFile(3);
85 gAlice->SetRunLoader(rl);
86 // gAlice->SetGeometryFromFile("geometry.root");
87 // gAlice->SetGeometryFromCDB();
88
89 // Set the trigger configuration
28da60d3 90 AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
75c56124 91 cout<<"Trigger configuration is set to Pb-Pb"<<endl;
92
93 //
94 // Set External decayer
95 TVirtualMCDecayer *decayer = new AliDecayerPythia();
96
97 decayer->SetForceDecay(kAll);
98 decayer->Init();
99 gMC->SetExternalDecayer(decayer);
100 //=======================================================================
101 // ************* STEERING parameters FOR ALICE SIMULATION **************
102 // --- Specify event type to be tracked through the ALICE setup
103 // --- All positions are in cm, angles in degrees, and P and E in GeV
104
105
106 gMC->SetProcess("DCAY",1);
107 gMC->SetProcess("PAIR",1);
108 gMC->SetProcess("COMP",1);
109 gMC->SetProcess("PHOT",1);
110 gMC->SetProcess("PFIS",0);
111 gMC->SetProcess("DRAY",0);
112 gMC->SetProcess("ANNI",1);
113 gMC->SetProcess("BREM",1);
114 gMC->SetProcess("MUNU",1);
115 gMC->SetProcess("CKOV",1);
116 gMC->SetProcess("HADR",1);
117 gMC->SetProcess("LOSS",2);
118 gMC->SetProcess("MULS",1);
119 gMC->SetProcess("RAYL",1);
120
121 Float_t cut = 1.e-3; // 1MeV cut by default
122 Float_t tofmax = 1.e10;
123
124 gMC->SetCut("CUTGAM", cut);
125 gMC->SetCut("CUTELE", cut);
126 gMC->SetCut("CUTNEU", cut);
127 gMC->SetCut("CUTHAD", cut);
128 gMC->SetCut("CUTMUO", cut);
129 gMC->SetCut("BCUTE", cut);
130 gMC->SetCut("BCUTM", cut);
131 gMC->SetCut("DCUTE", cut);
132 gMC->SetCut("DCUTM", cut);
133 gMC->SetCut("PPCUTM", cut);
134 gMC->SetCut("TOFMAX", tofmax);
135
136
137 int nParticles = 20000;
138 if (gSystem->Getenv("CONFIG_NPARTICLES"))
139 {
140 nParticles = atoi(gSystem->Getenv("CONFIG_NPARTICLES"));
141 }
142
143
144 AliGenCocktail *gener = new AliGenCocktail();
145 gener->SetPhiRange(0, 360);
146 // Set pseudorapidity range from -8 to 8.
147 Float_t thmin = EtaToTheta(1.2); // theta min. <---> eta max
148 Float_t thmax = EtaToTheta(-1.2); // theta max. <---> eta min
149 gener->SetThetaRange(thmin,thmax);
150 gener->SetOrigin(0, 0, 0); //vertex position
151 gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
152
153 AliGenHIJINGpara *hijingparam = new AliGenHIJINGpara(nParticles);
154 hijingparam->SetMomentumRange(0.2, 999);
155 gener->AddGenerator(hijingparam,"HIJING PARAM",1);
156 //
157 //
158 //PIONS
159 Int_t nParticles2 =10;
160 AliGenBox *genboxPIP = new AliGenBox(nParticles2);
161 genboxPIP->SetPart(211);
162 genboxPIP->SetPtRange(0.2, 100.00);
163 AliGenBox *genboxPIM = new AliGenBox(nParticles2);
164 genboxPIM->SetPart(-211);
165 genboxPIM->SetPtRange(0.2, 100.00);
166 //Electrons
167 AliGenBox *genboxEP = new AliGenBox(nParticles2);
168 genboxEP->SetPart(11);
169 genboxEP->SetPtRange(0.1, 100.00);
170 AliGenBox *genboxEM = new AliGenBox(nParticles2);
171 genboxEM->SetPart(-11);
172 genboxEM->SetPtRange(0.1, 100.00);
173 //Kaons
174 AliGenBox *genboxKP = new AliGenBox(nParticles2);
175 genboxKP->SetPart(321);
176 genboxKP->SetPtRange(0.2, 100.00);
177 AliGenBox *genboxKM = new AliGenBox(nParticles2);
178 genboxKM->SetPart(-321);
179 genboxKM->SetPtRange(0.2, 100.00);
180 // mu
181 AliGenBox *genboxMP = new AliGenBox(nParticles2);
182 genboxMP->SetPart(13);
183 genboxMP->SetPtRange(0.2, 100.00);
184 AliGenBox *genboxMM = new AliGenBox(nParticles2);
185 genboxMM->SetPart(-13);
186 genboxMM->SetPtRange(0.2, 100.00);
187 // Protons
188 AliGenBox *genboxPP = new AliGenBox(nParticles2);
189 genboxPP->SetPart(2212);
190 genboxPP->SetPtRange(0.2, 100.00);
191 AliGenBox *genboxPM = new AliGenBox(nParticles2);
192 genboxPM->SetPart(-2212);
193 genboxPM->SetPtRange(0.2, 100.00);
194
195
196
197 gener->AddGenerator(genboxPIP,"GENBOX",1);
198 gener->AddGenerator(genboxPIM,"GENBOX",1);
199 gener->AddGenerator(genboxEM,"GENBOX",1);
200 gener->AddGenerator(genboxEP,"GENBOX",1);
201 gener->AddGenerator(genboxKM,"GENBOX",1);
202 gener->AddGenerator(genboxKP,"GENBOX",1);
203 gener->AddGenerator(genboxMM,"GENBOX",1);
204 gener->AddGenerator(genboxMP,"GENBOX",1);
205 gener->AddGenerator(genboxPM,"GENBOX",1);
206 gener->AddGenerator(genboxPP,"GENBOX",1);
207
208 gener->Init();
209
210
211
212 //
213 // Activate this line if you want the vertex smearing to happen
214 // track by track
215 //
216 //gener->SetVertexSmear(perTrack);
217 // Field (L3 0.4 T)
4642ac4b 218 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
75c56124 219
220 Int_t iABSO = 1;
221 Int_t iDIPO = 1;
222 Int_t iFMD = 1;
223 Int_t iFRAME = 1;
224 Int_t iHALL = 1;
225 Int_t iITS = 1;
226 Int_t iMAG = 1;
227 Int_t iMUON = 1;
228 Int_t iPHOS = 1;
229 Int_t iPIPE = 1;
230 Int_t iPMD = 1;
231 Int_t iHMPID = 1;
232 Int_t iSHIL = 1;
233 Int_t iT0 = 1;
234 Int_t iTOF = 1;
235 Int_t iTPC = 1;
236 Int_t iTRD = 1;
237 Int_t iZDC = 1;
238 Int_t iEMCAL = 1;
239 Int_t iACORDE = 0;
240 Int_t iVZERO = 1;
241 rl->CdGAFile();
242 //=================== Alice BODY parameters =============================
243 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
244
245 if (iMAG)
246 {
247 //=================== MAG parameters ============================
248 // --- Start with Magnet since detector layouts may be depending ---
249 // --- on the selected Magnet dimensions ---
250 AliMAG *MAG = new AliMAG("MAG", "Magnet");
251 }
252
253
254 if (iABSO)
255 {
256 //=================== ABSO parameters ============================
257 AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
258 }
259
260 if (iDIPO)
261 {
262 //=================== DIPO parameters ============================
263
264 AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
265 }
266
267 if (iHALL)
268 {
269 //=================== HALL parameters ============================
270
271 AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
272 }
273
274
275 if (iFRAME)
276 {
277 //=================== FRAME parameters ============================
278
279 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
280 }
281
282 if (iSHIL)
283 {
284 //=================== SHIL parameters ============================
285
286 AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
287 }
288
289
290 if (iPIPE)
291 {
292 //=================== PIPE parameters ============================
293
294 AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
295 }
296
297 if (iITS)
298 {
299 //=================== ITS parameters ============================
300 AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS",
301 "ITS PPR detailed version with asymmetric services");
302 }
303
304 if (iTPC)
305 {
306 //============================ TPC parameters ===================
307 AliTPC *TPC = new AliTPCv2("TPC", "Default");
308 }
309
310
311 if (iTOF) {
312 //=================== TOF parameters ============================
313 AliTOF *TOF = new AliTOFv6T0("TOF", "normal TOF");
314 }
315
316
317 if (iHMPID)
318 {
319 //=================== HMPID parameters ===========================
320 AliHMPID *HMPID = new AliHMPIDv2("HMPID", "normal HMPID");
321
322 }
323
324
325 if (iZDC)
326 {
327 //=================== ZDC parameters ============================
328
329 AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
330 }
331
332 if (iTRD)
333 {
334 //=================== TRD parameters ============================
335
336 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
337 }
338
339 if (iFMD)
340 {
341 //=================== FMD parameters ============================
342 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
343 }
344
345 if (iMUON)
346 {
347 //=================== MUON parameters ===========================
348 // New MUONv1 version (geometry defined via builders)
349 AliMUON *MUON = new AliMUONv1("MUON", "default");
350 }
351 //=================== PHOS parameters ===========================
352
353 if (iPHOS)
354 {
355 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
356 }
357
358
359 if (iPMD)
360 {
361 //=================== PMD parameters ============================
362 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
363 }
364
365 if (iT0)
366 {
367 //=================== T0 parameters ============================
368 AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
369 }
370
371 if (iEMCAL)
372 {
373 //=================== EMCAL parameters ============================
374 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
375 }
376
377 if (iACORDE)
378 {
379 //=================== ACORDE parameters ============================
380 AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
381 }
382
383 if (iVZERO)
384 {
385 //=================== ACORDE parameters ============================
386 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
387 }
388
389 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
390
391}
392
393Float_t EtaToTheta(Float_t arg){
394 return (180./TMath::Pi())*2.*atan(exp(-arg));
395}