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