G3 specific configuration removed.
[u/mrichter/AliRoot.git] / macros / Config_gener.C
1 enum gentype_t {hijing, hijingParam, gun, box, pythia, 
2                 param1, param2, param3, param4, 
3                 cocktail, fluka, halo, ntuple, scan, doublescan};
4
5 gentype_t gentype=param4;
6
7 ntracks=1;
8
9 void Config()
10 {
11
12 new TGeant3("C++ Interface to Geant3");
13
14 //=======================================================================
15 //  Create the output file
16    
17 TFile *rootfile = new TFile("galice.root","recreate");
18 rootfile->SetCompressionLevel(2);
19 //
20 // Set External decayer
21  AliDecayer* decayer = new AliDecayerPythia();
22  decayer->SetForceDecay(kAll);
23  decayer->Init();
24  gMC->SetExternalDecayer(decayer);
25
26
27 //
28 //=======================================================================
29 // ************* STEERING parameters FOR ALICE SIMULATION **************
30 // --- Specify event type to be tracked through the ALICE setup
31 // --- All positions are in cm, angles in degrees, and P and E in GeV
32
33
34     gMC->SetProcess("DCAY",1);
35     gMC->SetProcess("PAIR",1);
36     gMC->SetProcess("COMP",1);
37     gMC->SetProcess("PHOT",1);
38     gMC->SetProcess("PFIS",0);
39     gMC->SetProcess("DRAY",0);
40     gMC->SetProcess("ANNI",1);
41     gMC->SetProcess("BREM",1);
42     gMC->SetProcess("MUNU",1);
43     gMC->SetProcess("CKOV",1);
44     gMC->SetProcess("HADR",1);
45     gMC->SetProcess("LOSS",2);
46     gMC->SetProcess("MULS",1);
47     gMC->SetProcess("RAYL",1);
48
49     Float_t cut = 1.e-3;        // 1MeV cut by default
50     Float_t tofmax = 1.e10;
51
52     gMC->SetCut("CUTGAM", cut);
53     gMC->SetCut("CUTELE", cut);
54     gMC->SetCut("CUTNEU", cut);
55     gMC->SetCut("CUTHAD", cut);
56     gMC->SetCut("CUTMUO", cut);
57     gMC->SetCut("BCUTE",  cut); 
58     gMC->SetCut("BCUTM",  cut); 
59     gMC->SetCut("DCUTE",  cut); 
60     gMC->SetCut("DCUTM",  cut); 
61     gMC->SetCut("PPCUTM", cut);
62     gMC->SetCut("TOFMAX", tofmax); 
63
64
65  switch(gentype)
66  {
67  case gun:
68 //*********************************************
69 // Example for Fixed Particle Gun             
70 //*********************************************
71      AliGenFixed *gener = new AliGenFixed(ntracks);
72      gener->SetMomentum(50);
73      gener->SetPhi(180.);
74      gener->SetTheta(5.);
75      gener->SetOrigin(0,0,0);          //vertex position
76      gener->SetPart(13);                //GEANT particle type
77      break;
78  case box:  
79 //*********************************************
80 // Example for Moving Particle Gun            *
81 //*********************************************
82      AliGenBox *gener = new AliGenBox(ntracks);
83      gener->SetMomentumRange(3,4);
84      gener->SetPhiRange(0,360);
85      gener->SetThetaRange(90, 180. );
86      gener->SetOrigin(0,0,0);   
87      //vertex position
88      gener->SetSigma(0,0,0);           //Sigma in (X,Y,Z) (cm) on IP position
89      gener->SetPart(5);                //GEANT particle type
90      break;
91  case scan:  
92 //*********************************************
93 // Scanning on a grid                         *
94 //*********************************************
95      AliGenScan *gener = new AliGenScan(-1);
96      gener->SetMomentumRange(4,4);
97      gener->SetPhiRange(0,360);
98      gener->SetThetaRange(9,9);
99      //vertex position
100      gener->SetSigma(6,6,0);           //Sigma in (X,Y,Z) (cm) on IP position
101      gener->SetPart(5); 
102      gener->SetRange(20, -100, 100, 20, -100, 100, 1, 500, 500);
103      break;
104      
105  case hijingParam:
106      AliGenHIJINGpara *gener = new AliGenHIJINGpara(ntracks);
107      gener->SetMomentumRange(0,999);
108      gener->SetPhiRange(0,360);
109      gener->SetThetaRange(2,10);
110      gener->SetOrigin(0,0,0);        //vertex position
111      gener->SetSigma(0,0,0);         //Sigma in (X,Y,Z) (cm) on IP position
112      break;
113  case hijing:
114      AliGenHijing *gener = new AliGenHijing(-1);
115 // centre of mass energy 
116      gener->SetEnergyCMS(5500);
117 // reference frame
118      gener->SetReferenceFrame("CMS     ");
119 // projectile
120      gener->SetProjectile("A       ", 208, 82);
121      gener->SetTarget    ("A       ", 208, 82);
122 // impact parameter range
123      gener->SetImpactParameterRange(0, 3.);
124 // evaluate cross section before run
125      gener->SetEvaluate(1);
126 // tell hijing to keep the full parent child chain
127      gener->KeepFullEvent();
128 // enable jet quenching
129      gener->SetJetQuenching(1);
130 // enable shadowing
131      gener->SetShadowing(1);
132 // neutral pion and heavy particle decays switched off
133      gener->SetDecaysOff(1);
134 // trigger
135      gener->SetTrigger(0);
136 // kinematic selection
137      gener->SetSelectAll(0);
138 // momentum range
139      gener->SetMomentumRange(0,999);
140 // phi range
141      gener->SetPhiRange(-180,180);
142 // theta range 
143      gener->SetThetaRange(0,180.);
144 // select flavor (0: no, 4: charm+beauty, 5:beauty)
145      gener->SetFlavor(4);
146 //     
147      gener->SetOrigin(0., 0.0 ,0);
148      gener->SetSigma(0,0,5.3);
149      gener->SetVertexSmear(kPerEvent); 
150 // no tracking
151      gener->SetTrackingFlag(0);
152      break;
153      
154  case pythia:
155 //********************************************
156 // Example for Charm  Production with Pythia *
157 //********************************************
158      AliGenPythia *gener = new AliGenPythia(-1);
159 //   final state kinematic cuts
160      gener->SetMomentumRange(0,999);
161      gener->SetPhiRange(-180,180);
162      gener->SetThetaRange(0., 180.);
163      gener->SetYRange(-10,10);
164      gener->SetPtRange(0,100);
165 //   vertex position and smearing 
166      gener->SetOrigin(0,0,0);         // vertex position
167      gener->SetVertexSmear(kPerEvent);
168      gener->SetSigma(0,0,5.6);        // Sigma in (X,Y,Z) (cm) on IP position
169 //   Structure function
170 // DO_Set_1
171 // GRV_LO
172 // GRV_HO
173 // MRS_D_minus
174 // MRS_D0
175 // MRS_G
176 // CTEQ_2pM
177 // CTEQ_4M
178      gener->SetStrucFunc(kGRV_HO);
179 // Select corection for nuclear structure functions
180 //     gener->SetNuclei(208,208);
181 //
182 //   Process type
183 //   charm, beauty, charm_unforced, beauty_unforced, jpsi, jpsi_chi, mb
184      gener->SetProcess(kPyBeauty);
185 //   
186 //   Pt transfer of the hard scattering
187      gener->SetPtHard(0.,5.);
188 //   Decay type (semielectronic, semimuonic, nodecay)
189      gener->SetForceDecay(kSemiElectronic);
190 //   Centre of mass energy 
191      gener->SetEnergyCMS(5500.);
192 //   No Tracking 
193      gener->SetTrackingFlag(0);
194      break;              
195
196  case param1:
197 //*******************************************************
198 // Example for J/psi  Production from  Parameterisation 
199 // using default library (AliMUONlib)                                       
200 //*******************************************************
201      AliGenParam *gener =
202          new AliGenParam(ntracks, AliGenMUONlib::kUpsilon);
203      gener->SetMomentumRange(0,999);
204      gener->SetPtRange(0,999);     
205      gener->SetPhiRange(-180, 180);
206      gener->SetYRange(2.5,4);
207      gener->SetCutOnChild(1);
208      gener->SetChildThetaRange(2,9);
209      gener->SetOrigin(0,0,0);          //vertex position
210      gener->SetSigma(0,0,5.3);         //Sigma in (X,Y,Z) (cm) on IP position
211      gener->SetForceDecay(kDiMuon);
212      gener->SetTrackingFlag(0);
213      break;
214
215  case param2:
216 //*******************************************************
217 // Example for Omega  Production from  Parameterisation 
218 // specifying library.                                       
219 //*******************************************************
220      AliGenParam *gener = new AliGenParam(1000,new AliGenPHOSlib(), 
221                                           AliGenPHOSlib::kOmega);
222      gener->SetWeighting(kNonAnalog);
223      gener->SetForceDecay(kNoDecay);
224      gener->SetPtRange(0,100);
225      gener->SetThetaRange(45,135);
226      gener->SetTrackingFlag(0);
227      break;
228
229  case param3:
230 //*******************************************************
231 // Example for Upsilon  Production from  Parameterisation 
232 // specifying library.                                       
233 // GSI style
234 //*******************************************************
235      AliGenParam *gener = new AliGenParam(1000,new AliGenGSIlib(), 
236                                           AliGenGSIlib::kUpsilon, "MUON");
237      gener->SetMomentumRange(0,999);
238      gener->SetPtRange(0,999);     
239      gener->SetPhiRange(-180, 180);
240      gener->SetYRange(2.5,4);
241      gener->SetCutOnChild(1);
242      gener->SetChildThetaRange(2,9);
243      gener->SetOrigin(0,0,0);          //vertex position
244      gener->SetSigma(0,0,5.3);         //Sigma in (X,Y,Z) (cm) on IP position
245      gener->SetForceDecay(kDiMuon);
246      gener->SetTrackingFlag(0);
247      break;
248      
249  case param4:
250 //*******************************************************
251 // Example for Omega  Production from  Parameterisation 
252 // specifying library.
253 // The alternative way.                                       
254 //*******************************************************
255      AliGenLib* Lib=new AliGenPHOSlib();
256      Int_t iOmega = AliGenPHOSlib::kOmega;
257      AliGenParam *gener = new AliGenParam(50, iOmega,            
258                                           Lib->GetPt(iOmega, ""),
259                                           Lib->GetY (iOmega, ""),
260                                           Lib->GetIp(iOmega, ""));
261      gener->SetWeighting(kNonAnalog);
262      gener->SetForceDecay(kNoDecay);
263      gener->SetTrackingFlag(0);
264      break;
265      
266  case fluka:
267 //*******************************************************
268 // Example for a FLUKA Boundary Source                  *
269 //*******************************************************
270      AliGenFLUKAsource *gener = new AliGenFLUKAsource(-1);
271      gener->SetFileName("$(ALICE_ROOT)/data/all32.root"); 
272      gener->SetPartFlag(9);
273      gener->SetAgeMax(1.e-5);
274 //  31.7 events     
275      gener->SetFraction(0.0315);     
276 //     gener->SetFraction(0.75*0.0315);     
277      rootfile->cd();
278 //     gener->SetPartFlag(10);
279      gener->SetMomentumRange(0,999);
280      gener->SetPhiRange(0,360);
281      gener->SetThetaRange(0., 180.); 
282      gener->SetAgeMax(1.e-5);
283      
284 //  31.7 events     
285 //     gener->SetFraction(0.0315);     
286      break;
287
288  case ntuple:
289 //*******************************************************
290 // Example for reading from a external file                  *
291 //*******************************************************
292      AliGenExtFile *gener = new AliGenExtFile(-1); 
293      gener->SetFileName("$(ALICE_ROOT)/data/dtujet93.root");
294      gener->SetVertexSmear(kPerEvent); 
295      gener->SetTrackingFlag(1);
296      break;
297
298  case halo:
299 //*******************************************************
300 // Example for Tunnel Halo Source                       *
301 //*******************************************************
302      AliGenHalo *gener = new AliGenHalo(ntracks); 
303      gener->SetFileName("/h1/morsch/marsip/marsip5.mu");
304      break;
305      
306  case cocktail:
307 //*******************************************************
308 // Example for a Cocktail                               *
309 //*******************************************************
310      
311      AliGenCocktail *gener = new AliGenCocktail(); 
312
313      gener->SetPhiRange(0,360);
314      gener->SetYRange(2.5,4);
315      gener->SetThetaRange(2,9);
316      gener->SetPtRange(0,10);
317      gener->SetOrigin(0,0,0);          //vertex position
318      gener->SetSigma(0,0,0);           //Sigma in (X,Y,Z) (cm) on IP position
319      gener->SetMomentumRange(0,999);
320
321      AliGenParam *jpsi = new AliGenParam(1,jpsi_p);
322      jpsi->SetForceDecay(dimuon);
323      jpsi->SetCutOnChild(1);
324
325      
326      AliGenFLUKAsource *bg = new AliGenFLUKAsource(-1);
327      bg->AddFile("$(ALICE_ROOT)/data/all32.root"); 
328      rootfile->cd();
329      bg->SetPartFlag(9);
330      bg->SetAgeMax(1.e-5);
331 //  31.7 events     
332 //     gener->SetFraction(0.0315);     
333      bg->SetFraction(0.01*0.0315);     
334       
335      gener->AddGenerator(jpsi,"J/Psi", 1);
336      gener->AddGenerator(bg,"Background",1);
337
338      break;
339  }
340  
341 // Activate this line if you want the vertex smearing to happen
342 // track by track
343 //
344 // gener->SetVertexSmear(kPerTrack); 
345
346 gener->Init();
347
348 gAlice->SetField(-999,2);    //Specify maximum magnetic field in Tesla (neg. ==> default field)
349
350 Int_t iMAG=1;
351
352 //=================== Alice BODY parameters =============================
353 AliBODY *BODY = new AliBODY("BODY","Alice envelop");
354
355
356 if(iMAG) {
357 //=================== MAG parameters ============================
358 // --- Start with Magnet since detector layouts may be depending ---
359 // --- on the selected Magnet dimensions ---
360 AliMAG *MAG  = new AliMAG("MAG","Magnet");
361 }
362 }