]> git.uio.no Git - u/mrichter/AliRoot.git/blob - EVGEN/AliGenLcLib.cxx
Fix Coverity 24835
[u/mrichter/AliRoot.git] / EVGEN / AliGenLcLib.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 // LambdaC simulations.
19 // To be used with AliGenParam.
20 //
21 // Author: Annalisa Mastroserio <Annalisa.Mastroserio@cern.ch>
22 //
23
24 #include <TPDGCode.h>
25 #include <TMath.h>
26 #include <TRandom.h>
27 #include <TString.h>
28
29 #include "AliGenLcLib.h"
30 #include "AliLog.h"
31
32 ClassImp(AliGenLcLib)
33
34
35 //---------------------------------------------
36 //        LambdaC 
37 //---------------------------------------------
38   Int_t AliGenLcLib::IpLcPlus(TRandom *)
39 {
40   //PDG code
41   return 4122;
42 }
43
44 Int_t AliGenLcLib::IpLcMinus(TRandom *)
45 {
46   //PDG code
47   return -4122;
48 }
49
50 Double_t AliGenLcLib::PtLcFlat( const Double_t *, const Double_t *)
51 {
52   // FLAT pt-distribution
53   return 1; 
54 }
55
56 Double_t AliGenLcLib::PtLcExp( const Double_t *x, const Double_t *)
57 {
58   //     pt-distribution
59   //return x[0]*TMath::Exp(-x[0]/0.16); // distribution used in LHC11f1 for the anchor runs : 139441, 139510, 139511, 130513, 130514, 130517. 
60   return TMath::GammaDist(x[0],2,0,1.7); //distribution as in LHC11a10a of the prompt Lc whose daughters are in |eta|<0.9. Used for Lb as well.
61 }
62
63 Double_t AliGenLcLib::YLcFlat(const Double_t *,const Double_t *)
64 {
65   //LambdaC             y-distribution 
66   return 1;
67 }
68
69
70
71 typedef Double_t (*GenFunc)   (const Double_t*,  const Double_t*);
72 typedef Int_t    (*GenFuncIp) (TRandom *);
73
74 GenFunc AliGenLcLib::GetPt(Int_t iPID, const char * sForm) const
75 {
76   // Return pointer to Pt parameterisation
77   printf("PID: %i, form: %s \n",iPID,sForm);    
78   TString type(sForm);
79   GenFunc func;
80
81   switch(iPID) {
82
83   case kLcPlus:  
84     if     (type=="FLAT")                                         {func=PtLcFlat; break;}
85     else if(type=="EXP")                                          {func=PtLcExp; break;}
86     else {
87       AliFatal(Form("Unknown Pt distribution form: %s",sForm));   func=0;
88     }
89
90   case kLcMinus:  
91     if     (type=="FLAT")                                         {func=PtLcFlat; break;}
92     else if(type=="EXP")                                          {func=PtLcExp; break;}
93     else {
94       AliFatal(Form("Unknown Pt distribution form: %s",sForm));   func=0;
95     }
96
97   default : AliFatal(Form("Unknown particle type: %i",iPID));      func=0;
98   }//switch
99
100   return func;
101 }
102
103 GenFunc AliGenLcLib::GetY(Int_t iPID, const char *sForm) const
104 {
105   AliDebug(1,Form("PID: %i, form: %s",iPID,sForm));     
106   GenFunc func;
107   switch (iPID) {
108
109   case kLcPlus:                                                func=YLcFlat; break;
110   case kLcMinus:                                               func=YLcFlat; break;
111
112   default  : AliFatal(Form("Unknown particle type: %i",iPID));     func=0; break;
113
114   }//switch
115   return func;
116 }
117
118 GenFuncIp AliGenLcLib::GetIp(Int_t iPID, const char *sForm) const
119 {
120   // Return pointer to particle type parameterisation
121   AliDebug(1,Form("PID: %i, form: %s",iPID,sForm));   //////////        
122
123   switch (iPID){
124
125   case kLcPlus:                                                  return IpLcPlus;
126   case kLcMinus:                                                 return IpLcMinus;
127
128   default  : AliFatal(Form("Unknown particle type: %i",iPID));  return 0;
129   }
130 }