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