AliRoot Core  3abf5b4 (3abf5b4)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Config_AliGenCosmicsParam.C
Go to the documentation of this file.
1 
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/AliGenCosmicsParam.h"
22 #include "EVGEN/AliGenHIJINGpara.h"
23 #include "STEER/AliMagF.h"
24 #include "STRUCT/AliBODY.h"
25 #include "STRUCT/AliMAG.h"
26 #include "STRUCT/AliABSOv0.h"
27 #include "STRUCT/AliDIPOv2.h"
28 #include "STRUCT/AliHALL.h"
29 #include "STRUCT/AliFRAMEv2.h"
30 #include "STRUCT/AliSHILv2.h"
31 #include "STRUCT/AliPIPEv0.h"
32 #include "ITS/AliITSvPPRasymmFMD.h"
33 #include "TPC/AliTPCv2.h"
34 #include "TOF/AliTOFv5T0.h"
35 #include "RICH/AliRICHv1.h"
36 #include "ZDC/AliZDCv2.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 "START/AliSTARTv1.h"
43 #include "EMCAL/AliEMCALv2.h"
44 #include "ACORDE/AliACORDEv0.h"
45 #include "VZERO/AliVZEROv7.h"
46 #endif
47 
48 //--- Magnetic Field ---
49 enum Mag_t
50 {
52 };
53 
54 Float_t EtaToTheta(Float_t arg);
55 
56 static AliMagF::BMap_t mag = AliMagF::k5kG;
57 
58 
59 
60 void Config()
61 {
64 
65  // Set Random Number seed
66  TDatime dt;
67  UInt_t curtime=dt.Get();
68  UInt_t procid=gSystem->GetPid();
69  UInt_t seed=curtime-procid;
70  if (gSystem->Getenv("envevno")) {
71  seed=atoi(gSystem->Getenv("envevno"));
72  seed += 1000; // 0 e' il seed dall'orologio....
73  printf("...taking seed as event number + 1000...\n");
74  }
75  printf("...setting seed as %d...\n",seed);
76  gRandom->SetSeed(seed);
77  printf("Seed for random number generation = %d \n",gRandom->GetSeed());
78 
79 
80  // AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
81 
82 
83  // libraries required by geant321
84 #if defined(__CINT__)
85  gSystem->Load("libgeant321");
86 #endif
87 
88  new TGeant3TGeo("C++ Interface to Geant3");
89 
90  if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
91  AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
92  AliCDBManager::Instance()->SetRun(0);
93  }
94 
95  AliRunLoader* rl=0x0;
96 
97  AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
98 
99  rl = AliRunLoader::Open("galice.root",
100  AliConfig::GetDefaultEventFolderName(),
101  "recreate");
102  if (rl == 0x0)
103  {
104  gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
105  return;
106  }
107  rl->SetCompressionLevel(2);
108  rl->SetNumberOfEventsPerFile(1000);
109  gAlice->SetRunLoader(rl);
110  // gAlice->SetGeometryFromFile("geometry.root");
111  // gAlice->SetGeometryFromCDB();
112 
113  // Set the trigger configuration
114  // AliSimulation::Instance()->SetTriggerConfig("Pb-Pb");
115  AliSimulation::Instance()->SetTriggerConfig("ACORDE");
116  cout<<"Trigger configuration is set to ACORDE"<<endl;
117 
118  //
119  // Set External decayer
120  TVirtualMCDecayer *decayer = new AliDecayerPythia();
121 
122  decayer->SetForceDecay(kAll);
123  decayer->Init();
124  gMC->SetExternalDecayer(decayer);
125  //=======================================================================
126  // ************* STEERING parameters FOR ALICE SIMULATION **************
127  // --- Specify event type to be tracked through the ALICE setup
128  // --- All positions are in cm, angles in degrees, and P and E in GeV
129 
130 
131  gMC->SetProcess("DCAY",1);
132  gMC->SetProcess("PAIR",1);
133  gMC->SetProcess("COMP",1);
134  gMC->SetProcess("PHOT",1);
135  gMC->SetProcess("PFIS",0);
136  gMC->SetProcess("DRAY",0);
137  gMC->SetProcess("ANNI",1);
138  gMC->SetProcess("BREM",1);
139  gMC->SetProcess("MUNU",1);
140  gMC->SetProcess("CKOV",1);
141  gMC->SetProcess("HADR",1);
142  gMC->SetProcess("LOSS",2);
143  gMC->SetProcess("MULS",1);
144  gMC->SetProcess("RAYL",1);
145 
146  Float_t cut = 1.e-3; // 1MeV cut by default
147  Float_t tofmax = 1.e10;
148 
149  gMC->SetCut("CUTGAM", cut);
150  gMC->SetCut("CUTELE", cut);
151  gMC->SetCut("CUTNEU", cut);
152  gMC->SetCut("CUTHAD", cut);
153  gMC->SetCut("CUTMUO", cut);
154  gMC->SetCut("BCUTE", cut);
155  gMC->SetCut("BCUTM", cut);
156  gMC->SetCut("DCUTE", cut);
157  gMC->SetCut("DCUTM", cut);
158  gMC->SetCut("PPCUTM", cut);
159  gMC->SetCut("TOFMAX", tofmax);
160 
161 
162  // AliGenCosmicsParam
163  AliGenCosmicsParam *gener = new AliGenCosmicsParam();
164  gener->SetNumberParticles(100);
165  gener->SetParamACORDE();
166  gener->SetYOrigin(260.); // warning: just above TPC, no TOF, no ACORDE
167  gener->SetMomentumRange(8.,1000.);
168  gener->SetMaxAngleWRTVertical(3.1415/4.);
169  gener->SetInTPC(); // "acceptance trigger"
170  gener->SetBkG(0.); // needed for "acceptance trigger"
171  gener->Init();
172  gGener = gener;
173 
174  // AliGenCocktail *gener = new AliGenCocktail();
175 // gener->SetPhiRange(0, 360);
176 // // Set pseudorapidity range from -8 to 8.
177 // Float_t thmin = EtaToTheta(1.2); // theta min. <---> eta max
178 // Float_t thmax = EtaToTheta(-1.2); // theta max. <---> eta min
179 // gener->SetThetaRange(thmin,thmax);
180 // gener->SetOrigin(0, 0, 0); //vertex position
181 // gener->SetSigma(0, 0, 0); //Sigma in (X,Y,Z) (cm) on IP position
182 // AddCosmicParticles(gener, 300); //
183 // gener->Init();
184 
185 
186  // MAGNETIC FIELD IN THE BARREL
187  TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., mag));
188  // TGeoGlobalMagField::Instance()->GetField()->SetL3ConstField(0); //Using const. field in the barrel
189  rl->CdGAFile();
190 
191 
192  Int_t iABSO = 1;
193  Int_t iDIPO = 0;
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 iRICH = 0;
204  Int_t iSHIL = 1;
205  Int_t iSTART = 0;
206  Int_t iTOF = 0;
207  Int_t iTPC = 1;
208  Int_t iTRD = 0;
209  Int_t iZDC = 0;
210  Int_t iEMCAL = 0;
211  Int_t iACORDE = 1;
212  Int_t iVZERO = 0;
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 AliABSOv0("ABSO", "Muon Absorber");
230  }
231 
232  if (iDIPO)
233  {
234  //=================== DIPO parameters ============================
235 
236  AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
237  }
238 
239  if (iHALL)
240  {
241  //=================== HALL parameters ============================
242 
243  AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
244  }
245 
246 
247  if (iFRAME)
248  {
249  //=================== FRAME parameters ============================
250 
251  AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
252  }
253 
254  if (iSHIL)
255  {
256  //=================== SHIL parameters ============================
257 
258  AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
259  }
260 
261 
262  if (iPIPE)
263  {
264  //=================== PIPE parameters ============================
265 
266  AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
267  }
268 
269  if (iITS)
270  {
271  //=================== ITS parameters ============================
272 
273  AliITSvPPRasymmFMD *ITS = new AliITSvPPRasymmFMD("ITS","ITS PPR detailed version with asymmetric services");
274  }
275 
276  if (iTPC)
277  {
278  //============================ TPC parameters ===================
279  AliTPC *TPC = new AliTPCv2("TPC", "Default");
280  }
281 
282 
283  if (iTOF) {
284  //=================== TOF parameters ============================
285  AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
286  }
287 
288 
289  if (iRICH)
290  {
291  //=================== RICH parameters ===========================
292  AliRICH *RICH = new AliRICHv1("RICH", "normal RICH");
293 
294  }
295 
296 
297  if (iZDC)
298  {
299  //=================== ZDC parameters ============================
300 
301  AliZDC *ZDC = new AliZDCv2("ZDC", "normal ZDC");
302  }
303 
304  if (iTRD)
305  {
306  //=================== TRD parameters ============================
307 
308  AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
309  }
310 
311  if (iFMD)
312  {
313  //=================== FMD parameters ============================
314  AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
315  }
316 
317  if (iMUON)
318  {
319  //=================== MUON parameters ===========================
320  // New MUONv1 version (geometry defined via builders)
321  AliMUON *MUON = new AliMUONv1("MUON", "default");
322  }
323  //=================== PHOS parameters ===========================
324 
325  if (iPHOS)
326  {
327  AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
328  }
329 
330 
331  if (iPMD)
332  {
333  //=================== PMD parameters ============================
334  AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
335  }
336 
337  if (iSTART)
338  {
339  //=================== START parameters ============================
340  AliSTART *START = new AliSTARTv1("START", "START Detector");
341  }
342 
343  if (iEMCAL)
344  {
345  //=================== EMCAL parameters ============================
346  AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
347  }
348 
349  if (iACORDE)
350  {
351  //=================== ACORDE parameters ============================
352  AliACORDE *ACORDE = new AliACORDEv0("ACORDE", "normal ACORDE");
353  }
354 
355  if (iVZERO)
356  {
357  //=================== ACORDE parameters ============================
358  AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
359  }
360 
361  AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
362 
363 }
364 
365 Float_t EtaToTheta(Float_t arg){
366  return (180./TMath::Pi())*2.*atan(exp(-arg));
367 }
368 
369 
370 
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TFile * Open(const char *filename, Long64_t &nevents)
AliDetector class for MUON subsystem providing simulation data management.
Definition: AliMUON.h:37
AliDetector class for MUON subsystem which implements functions for simulation.
Definition: AliMUONv1.h:24
AliRun * gAlice
static AliMagF::BMap_t mag
Float_t EtaToTheta(Float_t arg)
TCut cut
Definition: MakeGlobalFit.C:75
void Config()