small update
[u/mrichter/AliRoot.git] / EVGEN / AliGenHMPIDlib.cxx
CommitLineData
d1590034 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
926ecde4 16/* $Id$ */
17
d1590034 18// Library class for particle pt and y distributions used for
19// HMPID simulations.
20// To be used with AliGenParam.
21// The following particle typed can be simulated:
22// phi, lambda, k
23//
24// Author: Annalisa Mastroserio <Annalisa.Mastroserio@ba.infn.it>
25//
26//
27
090026bf 28#include <TPDGCode.h>
29#include <TMath.h>
d1590034 30#include <TRandom.h>
31#include <TString.h>
090026bf 32
de1857bb 33#include "AliGenHMPIDlib.h"
090026bf 34#include "AliLog.h"
d1590034 35
de1857bb 36ClassImp(AliGenHMPIDlib)
d1590034 37
926ecde4 38 //---------------------------------------
39 // Pi Plus
40 //---------------------------------------
de1857bb 41Int_t AliGenHMPIDlib::IpPiPlus(TRandom *)
926ecde4 42{
43//PDG code
44 return 211;
45}
46
75e0cc59 47Double_t AliGenHMPIDlib::PtPiPlusFlat( const Double_t *, const Double_t *)
926ecde4 48{
49 //PiPlus FLAT pt-distribution
50 return 1;
51}
52
75e0cc59 53Double_t AliGenHMPIDlib::PtPiPlusExp( const Double_t *x, const Double_t *)
926ecde4 54{
55 //PiPlus EXP pt-distribution
56 return x[0]*TMath::Exp(-x[0]/0.17);
57}
58
75e0cc59 59Double_t AliGenHMPIDlib::YPiPlusFlat(const Double_t *,const Double_t *)
926ecde4 60{
61 //PiPlus y-distribution
62 return 1;
63}
64
65
66//---------------------------------------
67// Pi Minus
68//---------------------------------------
de1857bb 69Int_t AliGenHMPIDlib::IpPiMinus(TRandom *)
926ecde4 70{
71//PDG code
72 return -211;
73}
74
75e0cc59 75Double_t AliGenHMPIDlib::PtPiMinusFlat( const Double_t *, const Double_t *)
926ecde4 76{
77// PiMinus FLAT pt-distribution
78 return 1;
79}
80
75e0cc59 81Double_t AliGenHMPIDlib::PtPiMinusExp( const Double_t *x, const Double_t *)
926ecde4 82{
83//PiMinus EXP pt-distribution
84 return x[0]*TMath::Exp(-x[0]/0.17);
85}
86
75e0cc59 87Double_t AliGenHMPIDlib::YPiMinusFlat(const Double_t *,const Double_t *)
926ecde4 88{
89//PiMinus y-distribution
90 return 1;
91}
92
93
94//--------------------------------------------
95// K Plus
96//--------------------------------------------
de1857bb 97Int_t AliGenHMPIDlib::IpKPlus(TRandom *)
926ecde4 98{
99//PDG code
100 return 321;
101}
102
75e0cc59 103Double_t AliGenHMPIDlib::PtKPlusFlat( const Double_t *, const Double_t *)
926ecde4 104{
105// K+ FLAT pt-distribution
106 return 1;
107}
108
75e0cc59 109Double_t AliGenHMPIDlib::PtKPlusExp( const Double_t *x, const Double_t *)
926ecde4 110{
111// K+ EXP pt-distribution
112 return x[0]*TMath::Exp(-x[0]/0.17);
113}
114
75e0cc59 115Double_t AliGenHMPIDlib::YKPlusFlat(const Double_t *,const Double_t *)
926ecde4 116{
117// K+ y-distribution
118 return 1;
119}
120
121
122//-----------------------------------------------
123// K Minus
124//-----------------------------------------------
de1857bb 125Int_t AliGenHMPIDlib::IpKMinus(TRandom *)
926ecde4 126{
127//PDG code
128 return -321;
129}
130
75e0cc59 131Double_t AliGenHMPIDlib::PtKMinusFlat( const Double_t *, const Double_t *)
926ecde4 132{
133// K- FLAT pt-distribution
134 return 1;
135}
136
75e0cc59 137Double_t AliGenHMPIDlib::PtKMinusExp( const Double_t *x, const Double_t *)
926ecde4 138{
139// K- EXP pt-distribution
140 return x[0]*TMath::Exp(-x[0]/0.17);
141}
142
75e0cc59 143Double_t AliGenHMPIDlib::YKMinusFlat(const Double_t *,const Double_t *)
926ecde4 144{
145// K- y-distribution
146 return 1;
147}
148
149
150//-----------------------------------------------
151// K0 short
152//-----------------------------------------------
de1857bb 153Int_t AliGenHMPIDlib::IpK0s(TRandom *)
926ecde4 154{
155//PDG code
156 return 310;
157}
158
75e0cc59 159Double_t AliGenHMPIDlib::PtK0sFlat( const Double_t *, const Double_t *)
926ecde4 160{
161// K0s FLAT pt-distribution
162 return 1;
163}
164
75e0cc59 165Double_t AliGenHMPIDlib::PtK0sExp( const Double_t *x, const Double_t *)
926ecde4 166{
167// K0s EXP pt-distribution
168 return x[0]*TMath::Exp(-x[0]/0.17);
169}
170
75e0cc59 171Double_t AliGenHMPIDlib::YK0sFlat(const Double_t *,const Double_t *)
926ecde4 172{
173// K0s y-distribution
174 return 1;
175}
176
177
178//---------------------------------------------
179// Phi(1020)
180//---------------------------------------------
de1857bb 181Int_t AliGenHMPIDlib::IpPhi(TRandom *)
d1590034 182{
183//PDG code
184 return 333;
185}
186
75e0cc59 187Double_t AliGenHMPIDlib::PtPhiFlat( const Double_t *, const Double_t *)
d1590034 188{
189// Phi FLAT pt-distribution
190 return 1;
191}
192
75e0cc59 193Double_t AliGenHMPIDlib::PtPhiExp( const Double_t *x, const Double_t *)
d1590034 194{
195//phi EXP pt-distribution
196 return x[0]*TMath::Exp(-x[0]/0.17);
197}
198
75e0cc59 199Double_t AliGenHMPIDlib::YPhiFlat(const Double_t *,const Double_t *)
d1590034 200{
201//phi y-distribution
202 return 1;
203}
204
926ecde4 205
d1590034 206//-------------------------------------------------------
926ecde4 207// PROTON
d1590034 208//-------------------------------------------------------
de1857bb 209Int_t AliGenHMPIDlib::IpProton(TRandom *)
d1590034 210{
211//PDG code
926ecde4 212 return 2122;
d1590034 213}
214
75e0cc59 215Double_t AliGenHMPIDlib::PtProtonFlat( const Double_t *, const Double_t *)
d1590034 216{
926ecde4 217// ProtonFLAT pt-distribution
d1590034 218
219 return 1;
220}
221
75e0cc59 222Double_t AliGenHMPIDlib::PtProtonExp( const Double_t *x, const Double_t *)
d1590034 223{
926ecde4 224//Proton EXP pt-distribution
d1590034 225 return x[0]*TMath::Exp(-x[0]/0.17);
226}
227
75e0cc59 228Double_t AliGenHMPIDlib::YProtonFlat(const Double_t *,const Double_t *)
d1590034 229{
926ecde4 230 //Proton y-distribution
d1590034 231 return 1;
232}
233
234
926ecde4 235//-------------------------------------------------------
236// PROTON-BAR
237//-------------------------------------------------------
de1857bb 238Int_t AliGenHMPIDlib::IpProtonBar(TRandom *)
d1590034 239{
240//PDG code
926ecde4 241 return -2122;
d1590034 242}
243
75e0cc59 244Double_t AliGenHMPIDlib::PtProtonBarFlat( const Double_t *, const Double_t *)
d1590034 245{
926ecde4 246// ProtonBar FLAT pt-distribution
d1590034 247
248 return 1;
249}
250
75e0cc59 251Double_t AliGenHMPIDlib::PtProtonBarExp( const Double_t *x, const Double_t *)
d1590034 252{
926ecde4 253//ProtonBar EXP pt-distribution
d1590034 254 return x[0]*TMath::Exp(-x[0]/0.17);
255}
256
75e0cc59 257Double_t AliGenHMPIDlib::YProtonBarFlat(const Double_t *,const Double_t *)
d1590034 258{
926ecde4 259 //ProtonBar y-distribution
d1590034 260 return 1;
261}
262
263
926ecde4 264//-------------------------------------------------------
265// LAMBDA
266//-------------------------------------------------------
de1857bb 267Int_t AliGenHMPIDlib::IpLambda(TRandom *)
926ecde4 268{
269//PDG code
270 return 3122;
271}
272
75e0cc59 273Double_t AliGenHMPIDlib::PtLambdaFlat( const Double_t *, const Double_t *)
926ecde4 274{
275// Lambda FLAT pt-distribution
d1590034 276
926ecde4 277 return 1;
278}
d1590034 279
75e0cc59 280Double_t AliGenHMPIDlib::PtLambdaExp( const Double_t *x, const Double_t *)
926ecde4 281{
282//Lambda EXP pt-distribution
283 return x[0]*TMath::Exp(-x[0]/0.17);
284}
285
75e0cc59 286Double_t AliGenHMPIDlib::YLambdaFlat(const Double_t *,const Double_t *)
926ecde4 287{
288 //Lambda y-distribution
289 return 1;
290}
291
292
293//-------------------------------------------------------
294// LAMBDA-BAR
295//-------------------------------------------------------
de1857bb 296Int_t AliGenHMPIDlib::IpLambdaBar(TRandom *)
d1590034 297{
298//PDG code
926ecde4 299 return -3122;
d1590034 300}
301
75e0cc59 302Double_t AliGenHMPIDlib::PtLambdaBarFlat( const Double_t *, const Double_t *)
d1590034 303{
926ecde4 304// LambdaBar FLAT pt-distribution
305
d1590034 306 return 1;
307}
308
75e0cc59 309Double_t AliGenHMPIDlib::PtLambdaBarExp( const Double_t *x, const Double_t *)
d1590034 310{
926ecde4 311//LambdaBar EXP pt-distribution
d1590034 312 return x[0]*TMath::Exp(-x[0]/0.17);
313}
314
75e0cc59 315Double_t AliGenHMPIDlib::YLambdaBarFlat(const Double_t *,const Double_t *)
d1590034 316{
926ecde4 317 //LambdaBar y-distribution
d1590034 318 return 1;
319}
320
321
322
323
926ecde4 324
75e0cc59 325typedef Double_t (*GenFunc) (const Double_t*, const Double_t*);
d1590034 326typedef Int_t (*GenFuncIp) (TRandom *);
327
de1857bb 328GenFunc AliGenHMPIDlib::GetPt(Int_t iPID, const char * sForm) const
d1590034 329{
330// Return pointer to Pt parameterisation
331 AliDebug(1,Form("PID: %i, form: %s",iPID,sForm));
332 TString type(sForm);
333
334 switch(iPID) {
926ecde4 335
336 case kPiPlus:
337 if (type=="FLAT") return PtPiPlusFlat;
338 else if(type=="EXP") return PtPiPlusExp;
339 else {
340 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
341 }
342
343 case kPiMinus:
344 if (type=="FLAT") return PtPiMinusFlat;
345 else if(type=="EXP") return PtPiMinusExp;
346 else {
347 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
348 }
349
350 case kKPlus:
351 if (type=="FLAT") return PtKPlusFlat;
352 else if(type=="EXP") return PtKPlusExp;
353 else {
354 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
355 }
356
357 case kKMinus:
358 if (type=="FLAT") return PtKMinusFlat;
359 else if(type=="EXP") return PtKMinusExp;
360 else {
361 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
362 }
363
364
365 case kK0Short:
366 if (type=="FLAT") return PtK0sFlat;
367 else if(type=="EXP") return PtK0sExp;
368 else {
369 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
370 }
371
372
d1590034 373 case kPhi:
374 if (type=="FLAT") return PtPhiFlat;
375 else if(type=="EXP") return PtPhiExp;
376 else {
377 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
378 }
379
926ecde4 380 case kProton:
381 if (type=="FLAT") return PtProtonFlat;
382 else if(type=="EXP") return PtProtonExp;
383 else {
384 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
385 }
386
387 case kProtonBar:
388 if (type=="FLAT") return PtProtonBarFlat;
389 else if(type=="EXP") return PtProtonBarExp;
390 else {
391 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
392 }
393
d1590034 394 case kLambda0:
395 if (type=="FLAT") return PtLambdaFlat;
396 else if(type=="EXP") return PtLambdaExp;
397 else {
398 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
399 }
400
401 case kLambda0Bar:
402 if (type=="FLAT") return PtLambdaBarFlat;
403 else if(type=="EXP") return PtLambdaBarExp;
404 else {
405 AliFatal(Form("Unknown Pt distribution form: %s",sForm)); return 0;
406 }
407
d1590034 408 default : AliFatal(Form("Unknown particle type: %i",iPID)); return 0;
409 }//switch
410}
411
de1857bb 412GenFunc AliGenHMPIDlib::GetY(Int_t iPID, const char *sForm) const
d1590034 413{
414 AliDebug(1,Form("PID: %i, form: %s",iPID,sForm));
415
416 switch (iPID) {
d1590034 417
926ecde4 418 case kPiPlus: return YPiPlusFlat;
419 case kPiMinus: return YPiMinusFlat;
420 case kKPlus: return YKPlusFlat;
421 case kKMinus: return YKMinusFlat;
422 case kK0Short: return YK0sFlat;
423 case kPhi: return YPhiFlat;
424 case kProton: return YProtonFlat;
425 case kProtonBar: return YProtonBarFlat;
426 case kLambda0: return YLambdaFlat;
427 case kLambda0Bar: return YLambdaBarFlat;
428
429 default : AliFatal(Form("Unknown particle type: %i",iPID)); return 0;
d1590034 430
431 }//switch
432}
433
de1857bb 434GenFuncIp AliGenHMPIDlib::GetIp(Int_t iPID, const char *sForm) const
d1590034 435{
436// Return pointer to particle type parameterisation
437 AliDebug(1,Form("PID: %i, form: %s",iPID,sForm)); //////////
926ecde4 438
d1590034 439 switch (iPID){
926ecde4 440
441 case kPiPlus: return IpPiPlus;
442 case kPiMinus: return IpPiMinus;
443 case kKPlus: return IpKPlus;
444 case kKMinus: return IpKMinus;
445 case kK0Short: return IpK0s;
d1590034 446 case kPhi: return IpPhi;
926ecde4 447 case kProton: return IpProton;
448 case kProtonBar: return IpProtonBar;
d1590034 449 case kLambda0: return IpLambda;
450 case kLambda0Bar: return IpLambdaBar;
926ecde4 451
13242232 452 default : AliFatal(Form("Unknown particle type: %i",iPID)); return 0;
d1590034 453 }
454}
455