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