Merge branch 'master' of https://git.cern.ch/reps/AliRoot
[u/mrichter/AliRoot.git] / EVGEN / AliGenITSULib.cxx
CommitLineData
a65a7e70 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
16
17// Library class for particle pt and y distributions used for
18// ITS Upgrade related signal simulations.
19//
20// Author: Annalisa Mastroserio <Annalisa.Mastroserio@cern.ch>
21//
22
23#include <TPDGCode.h>
24#include <TMath.h>
25#include <TRandom.h>
26#include <TString.h>
27
28#include "AliGenITSULib.h"
29#include "AliLog.h"
30
31ClassImp(AliGenITSULib)
32
33 typedef Double_t (*GenFunc) (const Double_t*, const Double_t*);
34 typedef Int_t (*GenFuncIp) (TRandom *);
35
36
37Double_t AliGenITSULib::PtLcDist( const Double_t *x, const Double_t *)
38{
39 // pt-distribution
40 // same shape as the Lb pt distribution for high pt were overestimated. The Lb fitting funcion has been
41 // used from 3.5 GeV/c on. At smaller Pt, the shape is likely as sqrt(x)*exp(-x)
42 Double_t par[6]={2.781336,1.353902,4.634330,(145479448.743187/202262270.892062),1.789479,-1.329143};
43 Double_t y=0;
44 if(x[0]<3.5) y= par[3]*(TMath::Power(x[0],par[4]))*TMath::Exp(x[0]*par[5]);
45 else y= x[0]/TMath::Power((1+TMath::Power(x[0]/par[0],par[1])),par[2]);
46 return y;
47}
48
49
50Double_t AliGenITSULib::PtLbDist( const Double_t *x, const Double_t *)
51{
52 // pt-distribution (fitted in 0-30 GeV/c)
53 Double_t par[4]={3.42500e-03,6.18902,1.76908,3.24823};
54 return par[0]*x[0]/TMath::Power((1+TMath::Power(x[0]/par[1],par[2])),par[3]);
55}
56
57GenFunc AliGenITSULib::GetPt(Int_t iPID, const char * sForm) const
58{
59 // Return pointer to Pt parameterisation
60 AliDebug(1,Form("PID: %i, form: %s \n",iPID,sForm));
61 TString type(sForm);
62 GenFunc func;
63
64 if(type=="FLAT") {
65 func=PtFlat;
66 } else if(type=="DIST") {
67
68 switch(TMath::Abs(iPID)) {
69
70 case kLb : func=PtLbDist; break;
71 case kLc : func=PtLcDist; break;
72 case kXi_c : func=PtLcDist; break;
73 case kBplus : func=PtLbDist; break;
74 case kBzero : func=PtLbDist; break;
75 case kDs : func=PtLcDist; break;
76 case kDplus : func=PtLcDist; break;
77 default : AliError(Form("Unknown particle type: %i, Pt dist is 0",iPID)); func=0;
78 }
79 }else {
80 AliError(Form("Unknown Pt distribution %s. Pt distribution is set to 0 ",sForm));
81 func=0;
82 }
83
84 return func;
85}
86
87GenFunc AliGenITSULib::GetY(Int_t iPID, const char *sForm) const
88{
89 GenFunc func;
90
91 if(TMath::Abs(iPID) != kLc && TMath::Abs(iPID) != kLb && TMath::Abs(iPID) != kXi_c && TMath::Abs(iPID) != kBplus && TMath::Abs(iPID) != kBzero && TMath::Abs(iPID)!=kDplus && TMath::Abs(iPID)!=kDs) {
92 AliError(Form("Unknown PID: %i, form: %s, returning 0",iPID,sForm)); //////////
93 func=0;
94 } else {
95 func = YFlat;
96 }
97 return func;
98}
99
100GenFuncIp AliGenITSULib::GetIp(Int_t iPID, const char *sForm) const
101{
102 AliDebug(1,Form(" %i - %s",iPID,sForm));
103 // Return pointer to particle type parameterisation
104 GenFuncIp id;
105
106 if(TMath::Abs(iPID) != kLc && TMath::Abs(iPID) != kLb && TMath::Abs(iPID) != kXi_c && TMath::Abs(iPID) != kBplus && TMath::Abs(iPID) != kBzero && TMath::Abs(iPID)!=kDplus && TMath::Abs(iPID)!=kDs) {
107 AliError(Form("Unknown PID: %i, form: %s, return 0",iPID,sForm)); //////////
108 id = 0;
109 } else {
110 switch (iPID){
111 case kLc : return id=IpLcPlus;
112 case -kLc : return id=IpLcMinus;
113 case kLb : return id=IpLb;
114 case -kLb : return id=IpLbBar;
115 case kXi_c : return id=IpXic;
116 case -kXi_c : return id=IpXicBar;
117 case kBplus : return id=IpBPlus;
118 case kBzero : return id=IpB0;
119 case -kBzero: return id=IpB0Bar;
120 case -kBplus: return id=IpBMinus;
121 case kDs : return id=IpDsPlus;
122 case -kDs : return id=IpDsMinus;
123 case kDplus : return id=IpDPlus;
124 case -kDplus: return id=IpDMinus;
125 default : AliFatal(Form("Unknown particle type: %i",iPID)); id=0;
126 }
127
128 }
129
130 return id;
131}