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