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