LHAPDF veraion 5.9.1
[u/mrichter/AliRoot.git] / macros / Config_AliGenCosmicsParam.C
CommitLineData
1c1b79ed 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 <TRandom.h>
10#include <TSystem.h>
11#include <TVirtualMC.h>
12#include <TGeant3TGeo.h>
13#include "STEER/AliRunLoader.h"
14#include "STEER/AliRun.h"
15#include "STEER/AliConfig.h"
16#include "PYTHIA6/AliDecayerPythia.h"
17#include "EVGEN/AliGenCocktail.h"
18#include "EVGEN/AliGenCosmicsParam.h"
19#include "EVGEN/AliGenHIJINGpara.h"
f7a1cc68 20#include "STEER/AliMagF.h"
1c1b79ed 21#include "STRUCT/AliBODY.h"
22#include "STRUCT/AliMAG.h"
23#include "STRUCT/AliABSOv0.h"
24#include "STRUCT/AliDIPOv2.h"
25#include "STRUCT/AliHALL.h"
26#include "STRUCT/AliFRAMEv2.h"
27#include "STRUCT/AliSHILv2.h"
28#include "STRUCT/AliPIPEv0.h"
3a5fcc75 29#include "ITS/AliITSv11.h"
1c1b79ed 30#include "TPC/AliTPCv2.h"
31#include "TOF/AliTOFv5T0.h"
99887042 32#include "HMPID/AliHMPIDv3.h"
9d07603a 33#include "ZDC/AliZDCv3.h"
1c1b79ed 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 "START/AliSTARTv1.h"
40#include "EMCAL/AliEMCALv2.h"
f7882672 41#include "ACORDE/AliACORDEv1.h"
1c1b79ed 42#include "VZERO/AliVZEROv7.h"
43#endif
44
1c1b79ed 45Float_t EtaToTheta(Float_t arg);
46
f7a1cc68 47static AliMagF::BMap_t mag = AliMagF::k5kG;
1c1b79ed 48
49void Config()
50{
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
53
54 // Set Random Number seed
55 TDatime dt;
56 UInt_t curtime=dt.Get();
57 UInt_t procid=gSystem->GetPid();
58 UInt_t seed=curtime-procid;
59 if (gSystem->Getenv("envevno")) {
60 seed=atoi(gSystem->Getenv("envevno"));
61 seed += 1000; // 0 e' il seed dall'orologio....
62 printf("...taking seed as event number + 1000...\n");
63 }
64 printf("...setting seed as %d...\n",seed);
65 gRandom->SetSeed(seed);
66 printf("Seed for random number generation = %d \n",gRandom->GetSeed());
67
68
69 // AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
70
71
72 // libraries required by geant321
73#if defined(__CINT__)
74 gSystem->Load("libgeant321");
75#endif
76
77 new TGeant3TGeo("C++ Interface to Geant3");
78
458041af 79 if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
162637e4 80 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
458041af 81 AliCDBManager::Instance()->SetRun(0);
82 }
83
1c1b79ed 84 AliRunLoader* rl=0x0;
85
86 AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
87
88 rl = AliRunLoader::Open("galice.root",
89 AliConfig::GetDefaultEventFolderName(),
90 "recreate");
91 if (rl == 0x0)
92 {
93 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
94 return;
95 }
96 rl->SetCompressionLevel(2);
97 rl->SetNumberOfEventsPerFile(1000);
98 gAlice->SetRunLoader(rl);
458041af 99 // gAlice->SetGeometryFromFile("geometry.root");
100 // gAlice->SetGeometryFromCDB();
1c1b79ed 101
102 // Set the trigger configuration
28da60d3 103 // AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
104 AliSimulation::Instance()->SetTriggerConfig("ACORDE");
1c1b79ed 105 cout<<"Trigger configuration is set to ACORDE"<<endl;
106
107 //
108 // Set External decayer
109 TVirtualMCDecayer *decayer = new AliDecayerPythia();
110
111 decayer->SetForceDecay(kAll);
112 decayer->Init();
113 gMC->SetExternalDecayer(decayer);
114 //=======================================================================
115 // ************* STEERING parameters FOR ALICE SIMULATION **************
116 // --- Specify event type to be tracked through the ALICE setup
117 // --- All positions are in cm, angles in degrees, and P and E in GeV
118
119
120 gMC->SetProcess("DCAY",1);
121 gMC->SetProcess("PAIR",1);
122 gMC->SetProcess("COMP",1);
123 gMC->SetProcess("PHOT",1);
124 gMC->SetProcess("PFIS",0);
125 gMC->SetProcess("DRAY",0);
126 gMC->SetProcess("ANNI",1);
127 gMC->SetProcess("BREM",1);
128 gMC->SetProcess("MUNU",1);
129 gMC->SetProcess("CKOV",1);
130 gMC->SetProcess("HADR",1);
131 gMC->SetProcess("LOSS",2);
132 gMC->SetProcess("MULS",1);
133 gMC->SetProcess("RAYL",1);
134
135 Float_t cut = 1.e-3; // 1MeV cut by default
136 Float_t tofmax = 1.e10;
137
138 gMC->SetCut("CUTGAM", cut);
139 gMC->SetCut("CUTELE", cut);
140 gMC->SetCut("CUTNEU", cut);
141 gMC->SetCut("CUTHAD", cut);
142 gMC->SetCut("CUTMUO", cut);
143 gMC->SetCut("BCUTE", cut);
144 gMC->SetCut("BCUTM", cut);
145 gMC->SetCut("DCUTE", cut);
146 gMC->SetCut("DCUTM", cut);
147 gMC->SetCut("PPCUTM", cut);
148 gMC->SetCut("TOFMAX", tofmax);
149
150
151 // AliGenCosmicsParam
152 AliGenCosmicsParam *gener = new AliGenCosmicsParam();
153 gener->SetParamACORDE();
154 gener->SetYOrigin(260.); // warning: just above TPC, no TOF, no ACORDE
155 gener->SetMomentumRange(8.,1000.);
156 gener->SetMaxAngleWRTVertical(3.1415/4.);
157 gener->SetInSPDinner(); // "acceptance trigger"
158 gener->SetBkG(0.); // needed for "acceptance trigger"
159 gener->Init();
160 gGener = gener;
161
162 // MAGNETIC FIELD IN THE BARREL
4642ac4b 163 AliMagF* field = new AliMagF("Maps","Maps",1.,1., mag);
1c1b79ed 164 field->SetL3ConstField(0); //Using const. field in the barrel
f7a1cc68 165 TGeoGlobalMagField::Instance()->SetField(field);
1c1b79ed 166
f7a1cc68 167 rl->CdGAFile();
1c1b79ed 168
169 Int_t iABSO = 1;
170 Int_t iDIPO = 0;
171 Int_t iFMD = 0;
172 Int_t iFRAME = 1;
173 Int_t iHALL = 1;
174 Int_t iITS = 1;
175 Int_t iMAG = 1;
176 Int_t iMUON = 0;
177 Int_t iPHOS = 0;
178 Int_t iPIPE = 1;
179 Int_t iPMD = 0;
8b1c76de 180 Int_t iHMPID = 0;
1c1b79ed 181 Int_t iSHIL = 1;
182 Int_t iSTART = 0;
183 Int_t iTOF = 0;
184 Int_t iTPC = 1;
185 Int_t iTRD = 0;
186 Int_t iZDC = 0;
187 Int_t iEMCAL = 0;
188 Int_t iACORDE = 1;
189 Int_t iVZERO = 0;
190 rl->CdGAFile();
191 //=================== Alice BODY parameters =============================
192 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
193
194 if (iMAG)
195 {
196 //=================== MAG parameters ============================
197 // --- Start with Magnet since detector layouts may be depending ---
198 // --- on the selected Magnet dimensions ---
199 AliMAG *MAG = new AliMAG("MAG", "Magnet");
200 }
201
202
203 if (iABSO)
204 {
205 //=================== ABSO parameters ============================
206 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
207 }
208
209 if (iDIPO)
210 {
211 //=================== DIPO parameters ============================
212
213 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
214 }
215
216 if (iHALL)
217 {
218 //=================== HALL parameters ============================
219
220 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
221 }
222
223
224 if (iFRAME)
225 {
226 //=================== FRAME parameters ============================
227
228 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
bab433b3 229 FRAME->SetHoles(1);
1c1b79ed 230 }
231
232 if (iSHIL)
233 {
234 //=================== SHIL parameters ============================
235
236 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
237 }
238
239
240 if (iPIPE)
241 {
242 //=================== PIPE parameters ============================
243
244 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
245 }
246
e89fa83b 247 if (iITS)
248 {
249 //=================== ITS parameters ============================
1c1b79ed 250
3a5fcc75 251 AliITS *ITS = new AliITSv11("ITS","ITS v11");
1c1b79ed 252 }
253
254 if (iTPC)
255 {
256 //============================ TPC parameters ===================
257 AliTPC *TPC = new AliTPCv2("TPC", "Default");
258 }
259
260
261 if (iTOF) {
262 //=================== TOF parameters ============================
263 AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
264 }
265
266
8b1c76de 267 if (iHMPID)
1c1b79ed 268 {
8b1c76de 269 //=================== HMPID parameters ===========================
99887042 270 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
1c1b79ed 271
272 }
273
274
275 if (iZDC)
276 {
277 //=================== ZDC parameters ============================
278
9d07603a 279 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
1c1b79ed 280 }
281
282 if (iTRD)
283 {
284 //=================== TRD parameters ============================
285
286 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
287 }
288
289 if (iFMD)
290 {
291 //=================== FMD parameters ============================
292 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
293 }
294
295 if (iMUON)
296 {
297 //=================== MUON parameters ===========================
298 // New MUONv1 version (geometry defined via builders)
299 AliMUON *MUON = new AliMUONv1("MUON", "default");
300 }
301 //=================== PHOS parameters ===========================
302
303 if (iPHOS)
304 {
305 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
306 }
307
308
309 if (iPMD)
310 {
311 //=================== PMD parameters ============================
312 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
313 }
314
315 if (iSTART)
316 {
317 //=================== START parameters ============================
318 AliSTART *START = new AliSTARTv1("START", "START Detector");
319 }
320
321 if (iEMCAL)
322 {
323 //=================== EMCAL parameters ============================
8224b11d 324 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "EMCAL_COMPLETE");
1c1b79ed 325 }
326
327 if (iACORDE)
328 {
329 //=================== ACORDE parameters ============================
f7882672 330 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
1c1b79ed 331 }
332
333 if (iVZERO)
334 {
335 //=================== ACORDE parameters ============================
336 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
337 }
338
339 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
340
341}
342
343Float_t EtaToTheta(Float_t arg){
344 return (180./TMath::Pi())*2.*atan(exp(-arg));
345}