]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenITSULib.cxx
3e00576e8986b720afdaf59a09f594a59c1da88b
[u/mrichter/AliRoot.git] / EVGEN / AliGenITSULib.cxx
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
31 ClassImp(AliGenITSULib)
32
33  typedef Double_t (*GenFunc)   (const Double_t*,  const Double_t*);
34  typedef Int_t    (*GenFuncIp) (TRandom *);
35
36
37 Double_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
50 Double_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
57 GenFunc 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 kB    :    func=PtLbDist; break;
74    default : AliError(Form("Unknown particle type: %i, Pt dist is 0",iPID));      func=0;
75   } 
76  }else {
77   AliError(Form("Unknown Pt distribution %s. Pt distribution is set to 0 ",sForm));
78   func=0;
79  }
80
81  return func;
82 }
83
84 GenFunc AliGenITSULib::GetY(Int_t iPID, const char *sForm) const
85 {
86  GenFunc func;
87
88  if(TMath::Abs(iPID) != kLc && TMath::Abs(iPID) != kLb && TMath::Abs(iPID) != kXi_c && TMath::Abs(iPID) != kB) {
89   AliError(Form("Unknown PID: %i, form: %s, returning 0",iPID,sForm));   //////////     
90   func=0;
91  } else { 
92   func = YFlat;
93  }
94  return func;
95 }
96
97 GenFuncIp AliGenITSULib::GetIp(Int_t iPID, const char *sForm) const
98 {
99  AliDebug(1,Form(" %i - %s",iPID,sForm));
100  // Return pointer to particle type parameterisation
101  GenFuncIp id;
102
103  if(TMath::Abs(iPID) != kLc && TMath::Abs(iPID) != kLb && TMath::Abs(iPID) != kXi_c && TMath::Abs(iPID) != kB) {
104   AliError(Form("Unknown PID: %i, form: %s, return 0",iPID,sForm));   //////////        
105   id = 0;
106  } else {
107   switch (iPID){
108    case kLc:                                                 return id=IpLcPlus;
109    case -kLc:                                                return id=IpLcMinus;
110    case kLb:                                                 return id=IpLb;
111    case -kLb:                                                return id=IpLbBar;
112    case kXi_c:                                               return id=IpXic;
113    case kB:                                                  return id=IpBPlus;
114    case -kB:                                                 return id=IpBMinus;
115    default  : AliFatal(Form("Unknown particle type: %i",iPID));  id=0;
116   }
117
118  }
119
120  return id;
121 }