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 /*********************************************************************************
8 Config to simulate cosmic muons using the AliGenACORDE class
13 Mario Rodriguez Cahuantzi <mrodrigu@mail.cern.ch>
14 FCFM-BUAP, Puebla, Pue. Mexico
16 Nov. 18th. 2009 @ INFN sez. Torino, Italy
19 **********************************************************************************/
20 #if !defined(__CINT__) || defined(__MAKECINT__)
21 #include <Riostream.h>
24 #include <TVirtualMC.h>
25 #include <TGeant3TGeo.h>
26 #include "STEER/AliRunLoader.h"
27 #include "STEER/AliRun.h"
28 #include "STEER/AliConfig.h"
29 #include "PYTHIA6/AliDecayerPythia.h"
30 #include "EVGEN/AliGenCocktail.h"
31 #include "EVGEN/AliGenCosmicsParam.h"
32 #include "EVGEN/AliGenHIJINGpara.h"
33 #include "STEER/AliMagFMaps.h"
34 #include "STRUCT/AliBODY.h"
35 #include "STRUCT/AliMAG.h"
36 #include "STRUCT/AliABSOv0.h"
37 #include "STRUCT/AliDIPOv2.h"
38 #include "STRUCT/AliHALL.h"
39 #include "STRUCT/AliFRAMEv2.h"
40 #include "STRUCT/AliSHILv2.h"
41 #include "STRUCT/AliPIPEv0.h"
42 #include "ITS/AliITSv11Hybrid.h"
43 #include "TPC/AliTPCv2.h"
44 #include "TOF/AliTOFv5T0.h"
45 #include "HMPID/AliHMPIDv3.h"
46 #include "ZDC/AliZDCv3.h"
47 #include "TRD/AliTRDv1.h"
48 #include "FMD/AliFMDv1.h"
49 #include "MUON/AliMUONv1.h"
50 #include "PHOS/AliPHOSv1.h"
51 #include "PMD/AliPMDv1.h"
52 #include "START/AliSTARTv1.h"
53 #include "EMCAL/AliEMCALv2.h"
54 #include "ACORDE/AliACORDEv1.h"
55 #include "VZERO/AliVZEROv7.h"
58 //--- Magnetic Field ---
64 Float_t EtaToTheta(Float_t arg);
66 static Mag_t mag = k5kG;
70 // ThetaRange is (0., 180.). It was (0.28,179.72) 7/12/00 09:00
71 // Theta range given through pseudorapidity limits 22/6/2001
73 // Set Random Number seed
75 UInt_t curtime=dt.Get();
76 UInt_t procid=gSystem->GetPid();
77 UInt_t seed=curtime-procid;
78 if (gSystem->Getenv("envevno")) {
79 seed=atoi(gSystem->Getenv("envevno"));
80 seed += 1000; // 0 e' il seed dall'orologio....
81 printf("...taking seed as event number + 1000...\n");
83 printf("...setting seed as %d...\n",seed);
84 gRandom->SetSeed(seed);
85 printf("Seed for random number generation = %d \n",gRandom->GetSeed());
88 // AliLog::Message(AliLog::kInfo, Form("Seed for random number generation = %d",gRandom->GetSeed()), "Config.C", "Config.C", "Config()","Config.C", __LINE__);
91 // libraries required by geant321
93 gSystem->Load("libgeant321");
96 new TGeant3TGeo("C++ Interface to Geant3");
98 if(!AliCDBManager::Instance()->IsDefaultStorageSet()){
99 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
100 AliCDBManager::Instance()->SetRun(0);
103 AliRunLoader* rl=0x0;
105 AliLog::Message(AliLog::kInfo, "Creating Run Loader", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
107 rl = AliRunLoader::Open("galice.root",
108 AliConfig::GetDefaultEventFolderName(),
112 gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
115 rl->SetCompressionLevel(2);
116 rl->SetNumberOfEventsPerFile(100000);
117 gAlice->SetRunLoader(rl);
119 // to load an alternative geometry
121 // gAlice->SetGeometryFromFile("geometry.root");
122 // gAlice->SetGeometryFromCDB();
124 // Set the trigger configuration
126 AliSimulation::Instance()->SetTriggerConfig("ACORDE");
127 cout<<"Trigger configuration is set to ACORDE"<<endl;
130 // Set External decayer
132 TVirtualMCDecayer *decayer = new AliDecayerPythia();
134 decayer->SetForceDecay(kAll);
136 gMC->SetExternalDecayer(decayer);
139 //=======================================================================
140 // ************* STEERING parameters FOR ALICE SIMULATION **************
141 // --- Specify event type to be tracked through the ALICE setup
142 // --- All positions are in cm, angles in degrees, and P and E in GeV
145 gMC->SetProcess("DCAY",1);
146 gMC->SetProcess("PAIR",1);
147 gMC->SetProcess("COMP",1);
148 gMC->SetProcess("PHOT",1);
149 gMC->SetProcess("PFIS",0);
150 gMC->SetProcess("DRAY",0);
151 gMC->SetProcess("ANNI",1);
152 gMC->SetProcess("BREM",1);
153 gMC->SetProcess("MUNU",1);
154 gMC->SetProcess("CKOV",1);
155 gMC->SetProcess("HADR",1);
156 gMC->SetProcess("LOSS",2);
157 gMC->SetProcess("MULS",1);
158 gMC->SetProcess("RAYL",1);
160 Float_t cut = 1.e-3; // 1MeV cut by default
161 Float_t tofmax = 1.e10;
163 gMC->SetCut("CUTGAM", cut);
164 gMC->SetCut("CUTELE", cut);
165 gMC->SetCut("CUTNEU", cut);
166 gMC->SetCut("CUTHAD", cut);
167 gMC->SetCut("CUTMUO", cut);
168 gMC->SetCut("BCUTE", cut);
169 gMC->SetCut("BCUTM", cut);
170 gMC->SetCut("DCUTE", cut);
171 gMC->SetCut("DCUTM", cut);
172 gMC->SetCut("PPCUTM", cut);
173 gMC->SetCut("TOFMAX", tofmax);
177 cout << "<<< *** Using the cosmic generator AliGenACORDE *** >>>" << endl;
179 AliGenACORDE *gener = new AliGenACORDE();
180 gener->SetZenithalAngleRange(0.,65.);
181 gener->SetAzimuthalAngleRange(0.,359.);
182 gener->SetMomentumResolution(1.);
183 gener->SetSigma(0,0,0);
184 gener->SetMomentumRange(10.,1000.);
185 gener->SetNumberOfParticles(100);
189 gener->SetPart(kMuonMinus);
194 // kMuonFlux --> not yet
196 gener->SetMode(kSingleMuons);
198 // If you choose kMuonBundle, you should set how many particles do you
199 // want and in wich region should the muons be generated, for instance
200 // if you want to generate n^2 muons, in a square of side 300 cm
201 //gener->SetRange(4, 300., 4, 300.);
203 // gener->SetVertexSmear(kPerEvent); // Set the smearing per Event
206 // Starts the generation
212 // MAGNETIC FIELD IN THE BARREL, by default set to 0.5 Teslas
214 TGeoGlobalMagField::Instance()->SetField(new AliMagF("Maps","Maps", 1., 1., AliMagF::k5kG));
217 // Only with ACORDE and TPC detectors
218 // for cosmic analysis TOF (iFRAME) and ITS could be set to ON
242 //=================== Alice BODY parameters =============================
243 AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
247 //=================== MAG parameters ============================
248 // --- Start with Magnet since detector layouts may be depending ---
249 // --- on the selected Magnet dimensions ---
250 AliMAG *MAG = new AliMAG("MAG", "Magnet");
256 //=================== ABSO parameters ============================
257 AliABSO *ABSO = new AliABSOv0("ABSO", "Muon Absorber");
262 //=================== DIPO parameters ============================
264 AliDIPO *DIPO = new AliDIPOv2("DIPO", "Dipole version 2");
269 //=================== HALL parameters ============================
271 AliHALL *HALL = new AliHALL("HALL", "Alice Hall");
277 //=================== FRAME parameters ============================
279 AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
285 //=================== SHIL parameters ============================
287 AliSHIL *SHIL = new AliSHILv2("SHIL", "Shielding Version 2");
293 //=================== PIPE parameters ============================
295 AliPIPE *PIPE = new AliPIPEv0("PIPE", "Beam Pipe");
300 //=================== ITS parameters ============================
302 AliITS *ITS = new AliITSv11Hybrid("ITS","ITS v11Hybrid");
307 //============================ TPC parameters ===================
308 AliTPC *TPC = new AliTPCv2("TPC", "Default");
313 //=================== TOF parameters ============================
314 AliTOF *TOF = new AliTOFv5T0("TOF", "normal TOF");
320 //=================== HMPID parameters ===========================
321 AliHMPID *HMPID = new AliHMPIDv3("HMPID", "normal HMPID");
328 //=================== ZDC parameters ============================
330 AliZDC *ZDC = new AliZDCv3("ZDC", "normal ZDC");
335 //=================== TRD parameters ============================
337 AliTRD *TRD = new AliTRDv1("TRD", "TRD slow simulator");
342 //=================== FMD parameters ============================
343 AliFMD *FMD = new AliFMDv1("FMD", "normal FMD");
348 //=================== MUON parameters ===========================
349 // New MUONv1 version (geometry defined via builders)
350 AliMUON *MUON = new AliMUONv1("MUON", "default");
352 //=================== PHOS parameters ===========================
356 AliPHOS *PHOS = new AliPHOSv1("PHOS", "IHEP");
362 //=================== PMD parameters ============================
363 AliPMD *PMD = new AliPMDv1("PMD", "normal PMD");
368 //=================== START parameters ============================
369 AliSTART *START = new AliSTARTv1("START", "START Detector");
374 //=================== EMCAL parameters ============================
375 AliEMCAL *EMCAL = new AliEMCALv2("EMCAL", "SHISH_77_TRD1_2X2_FINAL_110DEG");
380 //=================== ACORDE parameters ============================
381 AliACORDE *ACORDE = new AliACORDEv1("ACORDE", "normal ACORDE");
386 //=================== ACORDE parameters ============================
387 AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
390 AliLog::Message(AliLog::kInfo, "End of Config", "Config.C", "Config.C", "Config()"," Config.C", __LINE__);
394 Float_t EtaToTheta(Float_t arg){
395 return (180./TMath::Pi())*2.*atan(exp(-arg));
399 // Load Pythia related libraries
401 gSystem->Load("liblhapdf.so"); // Parton density functions
402 gSystem->Load("libEGPythia6.so"); // TGenerator interface
403 gSystem->Load("libpythia6.so"); // Pythia
404 gSystem->Load("libAliPythia6.so"); // ALICE specific implementations