]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG/muondep/AccEffTemplates/Config.C
Merge branch 'master' into flatdev
[u/mrichter/AliRoot.git] / PWG / muondep / AccEffTemplates / Config.C
1 //
2 // Template for a Config.C file
3 // to be used by AliMuonAccEffSubmitter, which will
4 // replace all instances of VAR_ with something
5 // relevant and useable...
6
7 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include <Riostream.h>
9 #include <TRandom.h>
10 #include <TDatime.h>
11 #include <TSystem.h>
12 #include <TVirtualMC.h>
13 #include <TGeant3TGeo.h>
14 #include "STEER/AliRunLoader.h"
15 #include "STEER/AliRun.h"
16 #include "STEER/AliConfig.h"
17 #include "PYTHIA6/AliDecayerPythia.h"
18 #include "PYTHIA6/AliGenPythia.h"
19 #include "TDPMjet/AliGenDPMjet.h"
20 #include "STEER/AliMagFCheb.h"
21 #include "STRUCT/AliBODY.h"
22 #include "STRUCT/AliMAG.h"
23 #include "STRUCT/AliABSOv3.h"
24 #include "STRUCT/AliDIPOv3.h"
25 #include "STRUCT/AliHALLv3.h"
26 #include "STRUCT/AliFRAMEv2.h"
27 #include "STRUCT/AliSHILv3.h"
28 #include "STRUCT/AliPIPEv3.h"
29 #include "ITS/AliITSv11Hybrid.h"
30 #include "TPC/AliTPCv2.h"
31 #include "TOF/AliTOFv6T0.h"
32 #include "HMPID/AliHMPIDv3.h"
33 #include "ZDC/AliZDCv3.h"
34 #include "TRD/AliTRDv1.h"
35 #include "TRD/AliTRDgeometry.h"
36 #include "FMD/AliFMDv1.h"
37 #include "MUON/AliMUONv1.h"
38 #include "PHOS/AliPHOSv1.h"
39 #include "PHOS/AliPHOSSimParam.h"
40 #include "PMD/AliPMDv1.h"
41 #include "T0/AliT0v1.h"
42 #include "EMCAL/AliEMCALv2.h"
43 #include "ACORDE/AliACORDEv1.h"
44 #include "VZERO/AliVZEROv7.h"
45 #endif
46
47
48 //--- Functions ---
49 class AliGenPythia;
50
51 void Config()
52 {
53   // Libraries required by geant321
54 #if defined(__CINT__)
55   gSystem->Load("liblhapdf");      // Parton density functions
56   gSystem->Load("libEGPythia6");   // TGenerator interface
57   gSystem->Load("libpythia6");     // Pythia 6.2 (for decayer)
58   gSystem->Load("libAliPythia6");  // ALICE specific implementations
59   gSystem->Load("libgeant321");
60
61   if ( TString("VAR_GENERATOR").Contains("pythia8",TString::kIgnoreCase) )
62   {
63     std::cout << "Setting up Pythia8 required libraries and env. variables" << std::endl;
64     gSystem->Load("libpythia8");
65     gSystem->Load("libAliPythia8");
66     VAR_PYTHIA8_INCLUDES
67     VAR_PYTHIA8_SETENV
68   }
69   
70   if ( TString("VAR_GENERATOR").Contains("pythia6",TString::kIgnoreCase) )
71   {
72     std::cout << "Setting up Pythia6 required env. variables" << std::endl;
73     VAR_PYTHIA6_INCLUDES
74     VAR_PYTHIA6_SETENV
75   }
76   
77
78 #endif
79
80   
81   new TGeant3TGeo("C++ Interface to Geant3");
82
83   //=======================================================================
84   //  Create the output file
85
86    
87   AliRunLoader* rl=0x0;
88
89   cout<<"Config.C: Creating Run Loader ..."<<endl;
90   rl = AliRunLoader::Open("galice.root",
91                           AliConfig::GetDefaultEventFolderName(),
92                           "recreate");
93   if (rl == 0x0)
94     {
95       gAlice->Fatal("Config.C","Can not instatiate the Run Loader");
96       return;
97     }
98   rl->SetCompressionLevel(2);
99   rl->SetNumberOfEventsPerFile(5000);
100   gAlice->SetRunLoader(rl);
101   
102   if ( TString("VAR_TRIGGER_CONFIGURATION").Length() > 0 )
103   {
104     AliSimulation::Instance()->SetTriggerConfig("VAR_TRIGGER_CONFIGURATION");
105     cout<<"Trigger configuration is set to VAR_TRIGGER_CONFIGURATION" << std::endl;
106   }
107   
108   //
109   //=======================================================================
110   // ************* STEERING parameters FOR ALICE SIMULATION **************
111   // --- Specify event type to be tracked through the ALICE setup
112   // --- All positions are in cm, angles in degrees, and P and E in GeV
113
114
115     gMC->SetProcess("DCAY",1);
116     gMC->SetProcess("PAIR",1);
117     gMC->SetProcess("COMP",1);
118     gMC->SetProcess("PHOT",1);
119     gMC->SetProcess("PFIS",0);
120     gMC->SetProcess("DRAY",0);
121     gMC->SetProcess("ANNI",1);
122     gMC->SetProcess("BREM",1);
123     gMC->SetProcess("MUNU",1);
124     gMC->SetProcess("CKOV",1);
125     gMC->SetProcess("HADR",1);
126     gMC->SetProcess("LOSS",2);
127     gMC->SetProcess("MULS",1);
128     gMC->SetProcess("RAYL",1);
129
130     Float_t cut = 1.e-3;        // 1MeV cut by default
131     Float_t tofmax = 1.e10;
132
133     gMC->SetCut("CUTGAM", cut);
134     gMC->SetCut("CUTELE", cut);
135     gMC->SetCut("CUTNEU", cut);
136     gMC->SetCut("CUTHAD", cut);
137     gMC->SetCut("CUTMUO", cut);
138     gMC->SetCut("BCUTE",  cut); 
139     gMC->SetCut("BCUTM",  cut); 
140     gMC->SetCut("DCUTE",  cut); 
141     gMC->SetCut("DCUTM",  cut); 
142     gMC->SetCut("PPCUTM", cut);
143     gMC->SetCut("TOFMAX", tofmax); 
144
145   //======================//
146   // Set External decayer //
147   //======================//
148   TVirtualMCDecayer* decayer = new AliDecayerPythia;
149   
150   /* FIXME: put back polarization switch ?
151   if (polar == kNO_pol){
152     decayer = new AliDecayerPythia();
153   } else if (polar == kTH_pol){
154     decayer = new AliDecayerPolarized(1.,AliDecayerPolarized::kHelicity,AliDecayerPolarized::kMuon);
155   } else if (polar == kT_pol){
156     decayer = new AliDecayerPolarized(1.,AliDecayerPolarized::kColSop,AliDecayerPolarized::kMuon);
157   } else if (polar == kLH_pol){
158     decayer = new AliDecayerPolarized(-1.,AliDecayerPolarized::kHelicity,AliDecayerPolarized::kMuon);
159   } else if (polar == kL_pol){
160     decayer = new AliDecayerPolarized(-1.,AliDecayerPolarized::kColSop,AliDecayerPolarized::kMuon);
161   }
162    */
163   
164   decayer->SetForceDecay(kAll);
165   decayer->Init();
166   gMC->SetExternalDecayer(decayer);
167
168   //=========================//
169   // Generator Configuration //
170   //=========================//
171
172   //AliGenerator* gener = CreateGenerator();
173
174   std::cout << "VAR_GENERATOR settings " << std::endl;
175   gSystem->AddIncludePath("-I$ALICE_ROOT/include");
176   gSystem->AddIncludePath("-I$ALICE_ROOT/EVGEN");
177   gSystem->AddIncludePath("-I$ALICE_ROOT/STEER/STEER");
178   gROOT->LoadMacro("VAR_GENERATOR.C+");
179   AliGenerator* gener = VAR_GENERATOR();
180   
181   TString slibs = gSystem->GetLibraries();
182   TObjArray* olibs = slibs.Tokenize(" ");
183   TObjString* s;
184   TIter next(olibs);
185   std::cout << "List of libraries=" << std::endl;
186   while ( ( s = static_cast<TObjString*>(next())) )
187   {
188     std::cout << s->String().Data() << std::endl;
189   }
190   
191
192   gener->SetOrigin(0., 0., 0.); // Taken from OCDB
193
194   Float_t sigmax = 0.0025;
195   Float_t sigmay = 0.0029;
196   
197   gener->SetSigma(sigmax, sigmay, 0.);      // Sigma in (X,Y,Z) (cm) on IP position, sigmaz taken from OCDB
198   gener->SetVertexSmear(kPerEvent);
199   gener->Init();
200   
201   gener->Print();
202     
203   rl->CdGAFile();
204   
205   Int_t iABSO  = 1;
206   Int_t iDIPO  = 1;
207   Int_t iFMD   = 1;
208   Int_t iFRAME = 1;
209   Int_t iHALL  = 1;
210   Int_t iITS   = 1;
211   Int_t iMAG   = 1;
212   Int_t iMUON  = 1;
213   Int_t iPIPE  = 1;
214   Int_t iSHIL  = 1;
215   Int_t iT0    = 1;
216   Int_t iVZERO = 1;
217   Int_t iZDC   = 0;
218
219     //=================== Alice BODY parameters =============================
220     AliBODY *BODY = new AliBODY("BODY", "Alice envelop");
221
222     if (iMAG)
223     {
224         //=================== MAG parameters ============================
225         // --- Start with Magnet since detector layouts may be depending ---
226         // --- on the selected Magnet dimensions ---
227         AliMAG *MAG = new AliMAG("MAG", "Magnet");
228     }
229
230     if (iABSO)
231     {
232         //=================== ABSO parameters ============================
233         AliABSO *ABSO = new AliABSOv3("ABSO", "Muon Absorber");
234     }
235
236     if (iDIPO)
237     {
238         //=================== DIPO parameters ============================
239
240         AliDIPO *DIPO = new AliDIPOv3("DIPO", "Dipole version 3");
241     }
242
243     if (iHALL)
244     {
245         //=================== HALL parameters ============================
246
247         AliHALL *HALL = new AliHALLv3("HALL", "Alice Hall");
248     }
249
250     if (iFRAME)
251     {
252         //=================== FRAME parameters ============================
253
254         AliFRAMEv2 *FRAME = new AliFRAMEv2("FRAME", "Space Frame");
255         FRAME->SetHoles(1);
256     }
257
258     if (iSHIL)
259     {
260         //=================== SHIL parameters ============================
261
262         AliSHIL *SHIL = new AliSHILv3("SHIL", "Shielding Version 3");
263     }
264
265     if (iPIPE)
266     {
267         //=================== PIPE parameters ============================
268
269         AliPIPE *PIPE = new AliPIPEv3("PIPE", "Beam Pipe");
270     }
271  
272     if (iITS)
273     {
274         //=================== ITS parameters ============================
275
276         AliITS *ITS  = new AliITSv11("ITS","ITS v11");
277     }
278
279     if (iZDC)
280     {
281         //=================== ZDC parameters ============================
282         
283       AliZDC *ZDC = new AliZDCv4("ZDC", "normal ZDC");
284       ZDC->SetSpectatorsTrack();
285       ZDC->SetLumiLength(0.);
286     }
287
288     if (iFMD)
289     {
290         //=================== FMD parameters ============================
291
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       MUON->SetTriggerEffCells(1);
301       MUON->SetTriggerResponseV1(2);
302     }
303
304     if (iT0)
305     {
306         //=================== T0 parameters ============================
307         AliT0 *T0 = new AliT0v1("T0", "T0 Detector");
308     }
309
310      if (iVZERO)
311     {
312         //=================== ACORDE parameters ============================
313
314         AliVZERO *VZERO = new AliVZEROv7("VZERO", "normal VZERO");
315     }
316 }