]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FEMTOSCOPY/AliFemto/AliFemtoModelWeightGeneratorLednicky.cxx
Port changes from v4-06-Release to the HEAD
[u/mrichter/AliRoot.git] / PWG2 / FEMTOSCOPY / AliFemto / AliFemtoModelWeightGeneratorLednicky.cxx
1 ///////////////////////////////////////////////////////////////////////////
2 //                                                                       //
3 // AliFemtoModelWeightGeneratorLednicky : the most advanced weight       //
4 // generator available. Supports a large number of different pair types  //
5 // and interaction types. Can calculate pair weights coming from         //
6 // quantum statistics, coulomb interation and strong interaction ot any  //
7 // combination of the three, as applicable.                              //
8 // This class is a wrapper for the fortran code provided by Richard      //
9 // Lednicky.                                                             //
10 //                                                                       //
11 ///////////////////////////////////////////////////////////////////////////
12
13 //#include "StHbtMaker/ThCorrFctn/AliFemtoModelWeightGeneratorLednicky.h"
14 #include "AliFemtoModelWeightGeneratorLednicky.h"
15 #include "AliFemtoModelHiddenInfo.h"
16 #include "AliFemtoPair.h"
17 //#include "StarCallf77.h"
18 //#include <strstream.h>
19 //#include <iomanip.h>
20 //#include <stream>
21 //#include <iomanip>
22 #include <sstream>
23
24 #ifdef SOLARIS
25 # ifndef false
26 typedef int bool;
27 #define false 0
28 #define true 1
29 # endif
30 #endif
31
32 #ifdef WIN32
33 # ifdef CERNLIB_MSSTDCALL
34 #  define F77_UCASE
35 #  define type_of_call _stdcall
36 #  ifndef CERNLIB_QXCAPT
37 #    define CERNLIB_QXCAPT
38 #  endif
39 # else
40 #  define F77_LCASE
41 #  ifndef CERNLIB_QXNO_SC
42 #    define CERNLIB_QXNO_SC
43 #  endif
44 # endif
45 # define type_of_call  _stdcall
46 # define DEFCHARD   const char* , const int        
47 # define DEFCHARL          
48 # define PASSCHARD(string) string, strlen(string) 
49 # define PASSCHARL(string) 
50 #else
51 # define DEFCHARD     const char* 
52 # define DEFCHARL   , const int 
53 # define PASSCHARD(string) string 
54 # define PASSCHARL(string) , strlen(string) 
55 #endif
56 #ifdef CERNLIB_QXCAPT
57 #  define F77_NAME(name,NAME) NAME
58 #else
59 #  if defined(CERNLIB_QXNO_SC)
60 #    define F77_NAME(name,NAME) name
61 #  else
62 #    define F77_NAME(name,NAME) name##_
63 #  endif
64 #endif
65 #ifndef type_of_call
66 # define type_of_call
67 #endif
68
69 // --- Prototype of the function used in the weight calculator 
70 //     (in FsiWeightLedinicky.F)
71 #define fsiin F77_NAME(fsiin,FSIIN)
72 extern "C" {void type_of_call F77_NAME(fsiin,FSIIN)(const int &itest,const int &ich, const int &iqs, const int &isi,const int &i3c);}
73 #define llini F77_NAME(llini,LLINI)
74 extern "C" {void type_of_call F77_NAME(llini,LLINI)(const int &lll,const int &ns, const int &itest);}
75
76 #define fsinucl F77_NAME(fsinucl,FSINUCL)
77 extern "C" {void type_of_call  F77_NAME(fsinucl,FSINUCL)(const double &mn,const double &cn);}
78 #define fsimomentum F77_NAME(fsimomentum,FSIMOMENTUM)
79 extern "C" {void type_of_call F77_NAME(fsimomentum,FSIMOMENTUM)(double &p1,double &p2);}
80 #define fsiposition F77_NAME(fsiposition,FSIPOSITION)
81 extern "C" {void type_of_call F77_NAME(fsiposition,FSIPOSITION)(double &x1,double &x2);}
82 #define fsiw F77_NAME(fsiw,FSIW)
83 extern "C" {void type_of_call F77_NAME(fsiw,FSIW)(const int &i,double &weif,
84                                                   double &wei,double &wein);}
85 #define ltran12 F77_NAME(ltran12,LTRAN12)
86 extern "C" {void type_of_call ltran12_();}
87
88 // Test function for Lambda potential
89 //#define printlam F77_NAME(printlam,PRINTLAM)
90 //extern "C" {void type_of_call printlam_();}
91 //there is not PRINTLAM in *.F file
92
93 // --- Additional prototyping of some CERN functions (in FsiTool.F)
94 typedef float   REAL;
95 typedef struct { REAL re; REAL im; } COMPLEX;
96 #define cgamma F77_NAME(cgamma,CGAMMA)
97 extern "C" {COMPLEX type_of_call cgamma_(COMPLEX*);}
98
99 #ifdef __ROOT__
100 ClassImp(AliFemtoModelWeightGeneratorLednicky)
101 #endif
102
103 AliFemtoModelWeightGeneratorLednicky::AliFemtoModelWeightGeneratorLednicky() : 
104   AliFemtoModelWeightGenerator(),
105   fWei(0), fWein(0), fWeif(0), fWeightDen(0), 
106   fItest(0),fIch(1),fIqs(1),fIsi(1),fI3c(0),
107   fNuclMass(1.),fNuclCharge(0.),
108   fSphereApp(false),fT0App(false) ,
109   fLL(0), fNuclChargeSign(1), fSwap(0), fLLMax(30), fLLName(0), 
110   fNumProcessPair(0), fNumbNonId(0)
111 {
112   // default constructor
113   fLLName=new char*[fLLMax+1];
114   fNumProcessPair=new int[fLLMax+1];
115   int i;
116   for (i=1;i<=fLLMax;i++) {fLLName[i]=new char[40];fNumProcessPair[i]=0;}
117   strcpy( fLLName[1],"neutron neutron");
118   strcpy( fLLName[2],"proton proton");
119   strcpy( fLLName[3],"neutron proton");
120   strcpy( fLLName[4],"alpha alpha");
121   strcpy( fLLName[5],"pi+ pi-");
122   strcpy( fLLName[6],"pi0 pi0");
123   strcpy( fLLName[7],"pi+ pi+");
124   strcpy( fLLName[8],"neutron deuteron");
125   strcpy( fLLName[9],"proton deuteron");
126   strcpy( fLLName[10],"pi+ K-");
127   strcpy( fLLName[11],"pi+ K+");
128   strcpy( fLLName[12],"pi+ proton");
129   strcpy( fLLName[13],"pi- proton");
130   strcpy( fLLName[14],"K+ K-");
131   strcpy( fLLName[15],"K+ K+");
132   strcpy( fLLName[16],"K+ proton");
133   strcpy( fLLName[17],"K- proton");
134   strcpy( fLLName[18],"deuteron deuteron");
135   strcpy( fLLName[19],"deuton alpha");
136   strcpy( fLLName[20],"triton triton");
137   strcpy( fLLName[21],"triton alpha");
138   strcpy( fLLName[22],"K0 K0");
139   strcpy( fLLName[23],"K0 K0b");
140   strcpy( fLLName[24],"deuteron triton");
141   strcpy( fLLName[25],"proton triton");
142   strcpy( fLLName[26],"proton alpha");
143   strcpy( fLLName[27],"proton lambda");
144   strcpy( fLLName[28],"neutron lambda");
145   strcpy( fLLName[29],"Lambda lambda");// gael 21May02
146   strcpy( fLLName[30],"Proton Anti-proton");// gael 21May02
147   FsiInit();
148   FsiNucl();
149 }
150 //______________________
151 AliFemtoModelWeightGeneratorLednicky::AliFemtoModelWeightGeneratorLednicky(const AliFemtoModelWeightGeneratorLednicky &aWeight):
152   AliFemtoModelWeightGenerator(),
153   fWei(0), fWein(0), fWeif(0), fWeightDen(0), 
154   fItest(0),fIch(1),fIqs(1),fIsi(1),fI3c(0),
155   fNuclMass(1.),fNuclCharge(0.),
156   fSphereApp(false),fT0App(false) ,
157   fLL(0), fNuclChargeSign(1), fSwap(0), fLLMax(30), fLLName(0), 
158   fNumProcessPair(0), fNumbNonId(0)
159 {
160   // copy constructor
161   fWei = aWeight.fWei; 
162   fWein = aWeight.  fWein;
163   fWeif = aWeight. fWeif;
164   fWeightDen = aWeight.fWeightDen;
165   
166   fItest = aWeight.fItest;
167   fIch = aWeight.fIch;
168   fIqs = aWeight.fIqs;
169   fIsi = aWeight.fIsi;
170   fI3c = aWeight.fI3c;
171   fNuclMass = aWeight.fNuclMass;
172   fNuclCharge = aWeight.fNuclCharge;
173   fSphereApp = aWeight.fSphereApp;
174   fT0App = aWeight.fT0App; 
175   fLL = aWeight.fLL;
176   fNuclChargeSign = aWeight.fNuclChargeSign;
177   fSwap = aWeight.fSwap;
178   fLLName = aWeight.fLLName; 
179   fNumProcessPair = aWeight.fNumProcessPair;
180   fNumbNonId = aWeight.fNumbNonId;
181   fLLName=new char*[fLLMax+1];
182   fNumProcessPair=new int[fLLMax+1];
183   int i;
184   for (i=1;i<=fLLMax;i++) {fLLName[i]=new char[40];fNumProcessPair[i]=0;}
185   strcpy( fLLName[1],"neutron neutron");
186   strcpy( fLLName[2],"proton proton");
187   strcpy( fLLName[3],"neutron proton");
188   strcpy( fLLName[4],"alpha alpha");
189   strcpy( fLLName[5],"pi+ pi-");
190   strcpy( fLLName[6],"pi0 pi0");
191   strcpy( fLLName[7],"pi+ pi+");
192   strcpy( fLLName[8],"neutron deuteron");
193   strcpy( fLLName[9],"proton deuteron");
194   strcpy( fLLName[10],"pi+ K-");
195   strcpy( fLLName[11],"pi+ K+");
196   strcpy( fLLName[12],"pi+ proton");
197   strcpy( fLLName[13],"pi- proton");
198   strcpy( fLLName[14],"K+ K-");
199   strcpy( fLLName[15],"K+ K+");
200   strcpy( fLLName[16],"K+ proton");
201   strcpy( fLLName[17],"K- proton");
202   strcpy( fLLName[18],"deuteron deuteron");
203   strcpy( fLLName[19],"deuton alpha");
204   strcpy( fLLName[20],"triton triton");
205   strcpy( fLLName[21],"triton alpha");
206   strcpy( fLLName[22],"K0 K0");
207   strcpy( fLLName[23],"K0 K0b");
208   strcpy( fLLName[24],"deuteron triton");
209   strcpy( fLLName[25],"proton triton");
210   strcpy( fLLName[26],"proton alpha");
211   strcpy( fLLName[27],"proton lambda");
212   strcpy( fLLName[28],"neutron lambda");
213   strcpy( fLLName[29],"Lambda lambda");// gael 21May02
214   strcpy( fLLName[30],"Proton Anti-proton");// gael 21May02
215   FsiInit();
216   FsiNucl();
217 }
218
219 AliFemtoModelWeightGeneratorLednicky& AliFemtoModelWeightGeneratorLednicky::operator=(const AliFemtoModelWeightGeneratorLednicky& aWeight)
220 {
221   // assignment operator
222   if (this == &aWeight)
223     return *this;
224
225   fWei = aWeight.fWei; 
226   fWein = aWeight.  fWein;
227   fWeif = aWeight. fWeif;
228   fWeightDen = aWeight.fWeightDen;
229   
230   fItest = aWeight.fItest;
231   fIch = aWeight.fIch;
232   fIqs = aWeight.fIqs;
233   fIsi = aWeight.fIsi;
234   fI3c = aWeight.fI3c;
235   fNuclMass = aWeight.fNuclMass;
236   fNuclCharge = aWeight.fNuclCharge;
237   fSphereApp = aWeight.fSphereApp;
238   fT0App = aWeight.fT0App; 
239   fLL = aWeight.fLL;
240   fNuclChargeSign = aWeight.fNuclChargeSign;
241   fSwap = aWeight.fSwap;
242   fLLName = aWeight.fLLName; 
243   fNumProcessPair = aWeight.fNumProcessPair;
244   fNumbNonId = aWeight.fNumbNonId;
245   fLLName=new char*[fLLMax+1];
246   fNumProcessPair=new int[fLLMax+1];
247   int i;
248   for (i=1;i<=fLLMax;i++) {fLLName[i]=new char[40];fNumProcessPair[i]=0;}
249   strcpy( fLLName[1],"neutron neutron");
250   strcpy( fLLName[2],"proton proton");
251   strcpy( fLLName[3],"neutron proton");
252   strcpy( fLLName[4],"alpha alpha");
253   strcpy( fLLName[5],"pi+ pi-");
254   strcpy( fLLName[6],"pi0 pi0");
255   strcpy( fLLName[7],"pi+ pi+");
256   strcpy( fLLName[8],"neutron deuteron");
257   strcpy( fLLName[9],"proton deuteron");
258   strcpy( fLLName[10],"pi+ K-");
259   strcpy( fLLName[11],"pi+ K+");
260   strcpy( fLLName[12],"pi+ proton");
261   strcpy( fLLName[13],"pi- proton");
262   strcpy( fLLName[14],"K+ K-");
263   strcpy( fLLName[15],"K+ K+");
264   strcpy( fLLName[16],"K+ proton");
265   strcpy( fLLName[17],"K- proton");
266   strcpy( fLLName[18],"deuteron deuteron");
267   strcpy( fLLName[19],"deuton alpha");
268   strcpy( fLLName[20],"triton triton");
269   strcpy( fLLName[21],"triton alpha");
270   strcpy( fLLName[22],"K0 K0");
271   strcpy( fLLName[23],"K0 K0b");
272   strcpy( fLLName[24],"deuteron triton");
273   strcpy( fLLName[25],"proton triton");
274   strcpy( fLLName[26],"proton alpha");
275   strcpy( fLLName[27],"proton lambda");
276   strcpy( fLLName[28],"neutron lambda");
277   strcpy( fLLName[29],"Lambda lambda");// gael 21May02
278   strcpy( fLLName[30],"Proton Anti-proton");// gael 21May02
279   FsiInit();
280   FsiNucl();
281   
282   return *this;
283 }
284
285
286 double AliFemtoModelWeightGeneratorLednicky::GenerateWeight(AliFemtoPair* aPair)
287 {
288   // Get hidden information pointers
289   AliFemtoModelHiddenInfo *inf1 = (AliFemtoModelHiddenInfo *) aPair->Track1()->HiddenInfo();
290   AliFemtoModelHiddenInfo *inf2 = (AliFemtoModelHiddenInfo *) aPair->Track2()->HiddenInfo();
291
292   // Calculate pair variables
293   Double_t tPx = inf1->GetTrueMomentum()->x()+inf2->GetTrueMomentum()->x();
294   Double_t tPy = inf1->GetTrueMomentum()->y()+inf2->GetTrueMomentum()->y();
295   Double_t tPz = inf1->GetTrueMomentum()->z()+inf2->GetTrueMomentum()->z();
296   Double_t tM1 = inf1->GetMass();
297   Double_t tM2 = inf2->GetMass();
298   Double_t tE1 = sqrt(tM1*tM1 + inf1->GetTrueMomentum()->mag2());
299   Double_t tE2 = sqrt(tM2*tM2 + inf2->GetTrueMomentum()->mag2());
300   Double_t tE  = tE1 + tE2;
301   Double_t tPt = tPx*tPx + tPy*tPy;
302   Double_t tMt = tE*tE - tPz*tPz;//mCVK;
303   Double_t tM  = sqrt(tMt - tPt);
304   tMt = sqrt(tMt);
305   tPt = sqrt(tPt);
306   Double_t tBetat = tPt/tMt;
307
308   // Boost to LCMS
309   Double_t tBeta = tPz/tE;
310   Double_t tGamma = tE/tMt;         
311   fKStarLong = tGamma * (inf1->GetTrueMomentum()->z() - tBeta * tE1);
312   Double_t tE1L = tGamma * (tE1  - tBeta * inf1->GetTrueMomentum()->z());
313     
314   // Rotate in transverse plane
315   fKStarOut  = ( inf1->GetTrueMomentum()->x()*tPx + inf1->GetTrueMomentum()->y()*tPy)/tPt;
316   fKStarSide = (-inf1->GetTrueMomentum()->x()*tPy + inf1->GetTrueMomentum()->y()*tPx)/tPt;
317       
318   // Boost to pair cms
319   fKStarOut = tMt/tM * (fKStarOut - tPt/tMt * tE1L);
320   
321   tBetat = tPt/tMt;
322   
323   Double_t tDX = inf1->GetEmissionPoint()->x()-inf2->GetEmissionPoint()->x();
324   Double_t tDY = inf1->GetEmissionPoint()->y()-inf2->GetEmissionPoint()->y();
325   Double_t tRLong = inf1->GetEmissionPoint()->z()-inf2->GetEmissionPoint()->z();
326   Double_t tDTime = inf1->GetEmissionPoint()->t()-inf2->GetEmissionPoint()->t();
327
328   Double_t tROut = (tDX*tPx + tDY*tPy)/tPt;
329   Double_t tRSide = (-tDX*tPy + tDY*tPx)/tPt;
330
331   fRStarSide = tRSide;
332
333   fRStarLong = tGamma*(tRLong - tBeta* tDTime);
334   Double_t tDTimePairLCMS = tGamma*(tDTime - tBeta* tRLong);
335
336   tBeta = tPt/tMt;
337   tGamma = tMt/tM;
338
339   fRStarOut = tGamma*(tROut - tBeta* tDTimePairLCMS);
340   fRStar = ::sqrt(fRStarOut*fRStarOut + fRStarSide*fRStarSide +
341                            fRStarLong*fRStarLong);
342   fKStar = ::sqrt(fKStarOut*fKStarOut + fKStarSide*fKStarSide + fKStarLong*fKStarLong);
343
344   if (!SetPid(inf1->GetPDGPid(),inf2->GetPDGPid())) {
345     fWeightDen=1.;
346     return 1;    
347   } 
348   else { // Good Pid
349     AliFemtoThreeVector*  p;
350     p=(inf1->GetTrueMomentum());
351     double p1[]={p->x(),p->y(),p->z()};
352     p=(inf2->GetTrueMomentum());
353     double p2[]={p->x(),p->y(),p->z()};
354     if ((p1[0]==p2[0])&&(p1[1]==p2[1])&&(p1[2]==p2[2])) {
355       fWeightDen=0.;
356       return 0;  
357     } 
358     if (fSwap) {
359       fsimomentum(*p2,*p1);
360     } else {
361       fsimomentum(*p1,*p2);
362     }
363     AliFemtoLorentzVector* tPoint;
364     tPoint=(inf1->GetEmissionPoint());
365 //     cout << "Pid1:dans GetWeight = " << aThPair->GetPid1() << endl;
366 //     cout << "Pid2:dans GetWeight = " << aThPair->GetPid2() << endl;
367 //     cout << "LL:in GetWeight = " << mLL << endl;
368
369     double x1[]={tPoint->x(),tPoint->y(),tPoint->z(),tPoint->t()};
370     tPoint=(inf2->GetEmissionPoint());
371     double x2[]={tPoint->x(),tPoint->y(),tPoint->z(),tPoint->t()};
372     if ((x1[0]==x2[0])&&(x1[1]==x2[1])&&(x1[2]==x2[2])&&(x1[3]==x2[3])) {
373       fWeightDen=0.;
374       return 0;  
375     } 
376     if (fSwap) {
377       fsiposition(*x2,*x1);
378     } else {
379       fsiposition(*x1,*x2);
380     }
381     FsiSetLL();
382     ltran12();
383     fsiw(1,fWeif,fWei,fWein);
384     if (fI3c==0) return fWein;
385     fWeightDen=fWeif;
386     return fWei;
387   }
388 }
389
390 AliFemtoString AliFemtoModelWeightGeneratorLednicky::Report() {
391   // create report
392   ostringstream tStr; 
393   tStr << "Lednicky afterburner calculation for  Correlation -  Report" << endl;
394   tStr << "    Setting : Quantum : " << ((fIqs) ? "On" : "Off"); 
395   tStr << " - Coulbomb : " << ((fIch) ? "On" : "Off") ;
396   tStr << " - Strong : " << ((fIsi) ? "On" : "Off");
397   tStr << endl;
398   tStr << "              3-Body : " << ((fI3c) ? "On"  : "Off") ;
399   if (fI3c) tStr << " Mass=" <<  fNuclMass << " - Charge= " << fNuclCharge ;
400   tStr << endl;
401   tStr << "    " << fNumProcessPair[0] << " Pairs have been Processed :" << endl;
402   int i;
403   for(i=1;i<=fLLMax;i++) { 
404     if (fNumProcessPair[i])
405       tStr << "         " << fNumProcessPair[i] << " " << fLLName[i] << endl;
406   }
407   if (fNumbNonId)
408     tStr << "         "<< fNumbNonId << " Non Identified" << endl;
409   AliFemtoString returnThis = tStr.str();
410   return returnThis;
411 }
412
413 void AliFemtoModelWeightGeneratorLednicky::FsiInit(){
414   // Initialize weight generation module
415   cout << "*******************AliFemtoModelWeightGeneratorLednicky check FsiInit ************" << endl;
416   cout <<"mItest dans FsiInit() = " << fItest << endl;
417   cout <<"mIch dans FsiInit() = " << fIch << endl;
418   cout <<"mIqs dans FsiInit() = " << fIqs << endl;
419   cout <<"mIsi dans FsiInit() = " << fIsi << endl;
420   cout <<"mI3c dans FsiInit() = " << fI3c << endl;
421   fsiin(fItest,fIch,fIqs,fIsi,fI3c);
422 }
423
424 void AliFemtoModelWeightGeneratorLednicky::FsiNucl(){
425   // initialize weight generation taking into account the residual charge
426   cout << "*******************AliFemtoModelWeightGeneratorLednicky check FsiNucl ************" << endl;
427   cout <<"fNuclMass dans FsiNucl() = " << fNuclMass << endl;
428   cout <<"fNuclCharge dans FsiNucl() = " << fNuclCharge << endl;
429   cout <<"fNuclChargeSign dans FsiNucl() = " << fNuclChargeSign << endl;
430   fsinucl(fNuclMass,fNuclCharge*fNuclChargeSign);
431 }
432
433 void AliFemtoModelWeightGeneratorLednicky::FsiSetLL(){
434   // set internal pair type for the module
435   int tNS;
436   if (fSphereApp||(fLL>5)) {
437     if (fT0App) { tNS=4;} 
438     else {tNS=2;}
439   } else { tNS=1;}
440    //cout <<"fLL dans FsiSetLL() = "<< fLL << endl;
441    //cout <<"tNS dans FsiSetLL() = "<< tNS << endl;
442    //cout <<"fItest dans FsiSetLL() = "<< fItest << endl;
443   llini(fLL,tNS,fItest);
444   //cout<<" end of FsiSetLL"<<endl;
445 }
446          
447 bool AliFemtoModelWeightGeneratorLednicky::SetPid(const int aPid1,const int aPid2) {
448   // set calculated system for basing on particles' pids
449   static const int ksPi0Pid=111;
450   static const int ksPionPid=211; 
451   static const int ksK0Pid=311;
452   static const int ksKPid=321;
453   static const int ksNeutPid=2112;
454   static const int ksProtPid=2212;
455   static const int ksLamPid=3122;
456   //  static const int sLamLamPid=3122;
457
458    // cout << "Setting PID to " << aPid1 << " " << aPid2 << endl;
459
460   int tPidl,tPidh;
461   int tChargeFactor=1;
462   
463   if (abs(aPid1)<abs(aPid2)) {
464     if (aPid1<0) tChargeFactor=-1;
465     tPidl=aPid1*tChargeFactor;
466     tPidh=aPid2*tChargeFactor;
467     fSwap=false;
468   } else {
469     if (aPid2<0) tChargeFactor=-1;
470     tPidl=aPid2*tChargeFactor;
471     tPidh=aPid1*tChargeFactor;
472     fSwap=true;
473   }
474   switch (tPidl) {
475   case ksPionPid:
476     switch (tPidh) {
477     case -ksPionPid:   fLL=5; tChargeFactor*=1 ;break;
478     case ksPionPid:    fLL=7; tChargeFactor*=1 ;break;
479     case -ksKPid:      fLL=10;tChargeFactor*=1 ;break;  
480     case ksKPid:       fLL=11;tChargeFactor*=1 ;break;  
481     case ksProtPid:    fLL=12;tChargeFactor*=1 ;break;
482     case -ksProtPid:   fLL=13;tChargeFactor*=-1;break;
483     default: fLL=0;
484     }
485     break;
486   case ksProtPid:
487     switch (tPidh) {
488     case ksProtPid:    fLL=2; tChargeFactor*=1 ;break;
489     case ksLamPid:     fLL=27;tChargeFactor*=1 ;break;
490     case -ksProtPid:   fLL=30;tChargeFactor*=1 ;break;
491     default: fLL=0;
492     }
493     break;
494   case ksKPid:
495     switch (tPidh) {
496     case -ksKPid:      fLL=14;tChargeFactor*=1 ;break;
497     case ksKPid:       fLL=15;tChargeFactor*=1 ;break;
498     case ksProtPid:    fLL=16;tChargeFactor*=1 ;break;
499     case -ksProtPid:   fLL=17;tChargeFactor*=-1 ;break;
500     default: fLL=0;
501     }
502     break;    
503   case ksK0Pid:
504     switch (tPidh) {
505     case ksK0Pid:         fLL=22;tChargeFactor*=1 ;break;
506     case -ksK0Pid:        fLL=23;tChargeFactor*=1 ;break;
507     default: fLL=0;
508     }
509     break;   
510   case ksPi0Pid:
511     switch (tPidh) {
512     case ksPi0Pid:        fLL=6; tChargeFactor*=1 ;break;
513     default: fLL=0;
514     }
515     break;
516   case ksNeutPid:
517     switch (tPidh) {
518     case ksNeutPid:      fLL=1; tChargeFactor*=1 ;break;
519     case ksProtPid:      fLL=3; tChargeFactor*=1 ;break;
520     case ksLamPid:       fLL=28;tChargeFactor*=1 ;break;
521     default: fLL=0;
522     }
523     break;                                             //Gael 21May02 
524   case ksLamPid:                                        //Gael 21May02 
525     switch (tPidh) {                                   //Gael 21May02 
526     case ksLamPid:       fLL=29;tChargeFactor*=1 ;break;//Gael 21May02  
527     default: fLL=0;                                    //Gael 21May02 
528     }                                                 //Gael 21May02 
529     break;                                             //Gael 21May02 
530   default: fLL=0;
531   }
532   if (tChargeFactor!=fNuclChargeSign) {
533     fNuclChargeSign=tChargeFactor;
534     FsiNucl();
535   }
536   (fNumProcessPair[0])++;
537   if (fLL) {
538     (fNumProcessPair[fLL])++;
539     return true;
540   } else {
541     fNumbNonId++;
542     return false;
543   }
544   cout << "*******************AliFemtoModelWeightGeneratorLednicky check SetPid ************" << endl;
545   cout << "fLL=="<< fLL << endl;
546   cout << "fNuclCharge=="<< fNuclCharge << endl;
547
548 }    
549 AliFemtoModelWeightGeneratorLednicky::~AliFemtoModelWeightGeneratorLednicky() 
550 { /* no-op */ }
551
552 //_____________________________________________
553 void     AliFemtoModelWeightGeneratorLednicky::SetPairType(Int_t aPairType)
554 {
555   // set calculated system basing on the pair type
556   fPairType = aPairType;
557   if (fPairType == fgkPionPlusPionPlus) SetPid(211,211);
558   if (fPairType == fgkPionPlusPionMinus ) SetPid(211, -211);
559   if (fPairType == fgkKaonPlusKaonPlus ) SetPid(321, 321);
560   if (fPairType == fgkKaonPlusKaonMinus ) SetPid(321, -321);
561   if (fPairType == fgkProtonProton ) SetPid(2212, 2212);
562   if (fPairType == fgkProtonAntiproton ) SetPid(2212, -2212);
563   if (fPairType == fgkPionPlusKaonPlus ) SetPid(211, 321);
564   if (fPairType == fgkPionPlusKaonMinus ) SetPid(211, -321);
565   if (fPairType == fgkPionPlusProton ) SetPid(211, 2212);
566   if (fPairType == fgkPionPlusAntiproton ) SetPid(211, -2212);
567   if (fPairType == fgkKaonPlusProton ) SetPid(321, 2212);
568   if (fPairType == fgkKaonPlusAntiproton ) SetPid(321, -2212);
569 }
570
571 //_____________________________________________
572 Int_t    AliFemtoModelWeightGeneratorLednicky::GetPairType() const
573 {
574   // return pair type
575   return fPairType;
576 }
577
578 //_____________________________________________
579 void     AliFemtoModelWeightGeneratorLednicky::SetPairTypeFromPair(AliFemtoPair *aPair)
580 {
581   // set calculated system based on the hidden info in the pair
582   AliFemtoModelHiddenInfo *inf1 = ( AliFemtoModelHiddenInfo *) aPair->Track1()->HiddenInfo();
583   AliFemtoModelHiddenInfo *inf2 = ( AliFemtoModelHiddenInfo *) aPair->Track2()->HiddenInfo();
584
585   const Int_t ktPid1 = inf1->GetPDGPid();
586   const Int_t ktPid2 = inf2->GetPDGPid();
587
588   if      (((ktPid1 ==   211) && (ktPid2 ==   211)) ||
589            ((ktPid1 ==  -211) && (ktPid2 ==  -211)))
590     fPairType = fgkPionPlusPionPlus;
591   else if (((ktPid1 ==  -211) && (ktPid2 ==   211)) ||
592            ((ktPid1 ==   211) && (ktPid2 ==  -211)))
593     fPairType = fgkPionPlusPionMinus;
594   else if (((ktPid1 ==   321) && (ktPid2 ==   321)) ||
595            ((ktPid1 ==  -321) && (ktPid2 ==  -321)))
596     fPairType = fgkKaonPlusKaonPlus;
597   else if (((ktPid1 ==  -321) && (ktPid2 ==   321)) ||
598            ((ktPid1 ==   321) && (ktPid2 ==  -321)))
599     fPairType = fgkKaonPlusKaonMinus;
600   else if (((ktPid1 ==  2212) && (ktPid2 ==  2212)) ||
601            ((ktPid1 == -2212) && (ktPid2 == -2212)))
602     fPairType = fgkProtonProton;
603   else if (((ktPid1 == -2212) && (ktPid2 ==  2212)) ||
604            ((ktPid1 ==  2212) && (ktPid2 == -2212)))
605     fPairType = fgkProtonAntiproton;
606   else if (((ktPid1 ==   211) && (ktPid2 ==   321)) ||
607            ((ktPid1 ==  -211) && (ktPid2 ==  -321)))
608     fPairType = fgkPionPlusKaonPlus;
609   else if (((ktPid1 ==  -211) && (ktPid2 ==   321)) ||
610            ((ktPid1 ==   211) && (ktPid2 ==  -321)))
611     fPairType = fgkPionPlusKaonMinus;
612   else if (((ktPid1 ==   211) && (ktPid2 ==  2212)) ||
613            ((ktPid1 ==  -211) && (ktPid2 == -2212)))
614     fPairType = fgkPionPlusProton;
615   else if (((ktPid1 ==  -211) && (ktPid2 ==  2212)) ||
616            ((ktPid1 ==   211) && (ktPid2 == -2212)))
617     fPairType = fgkPionPlusAntiproton;
618   else if (((ktPid1 ==   321) && (ktPid2 ==  2212)) ||
619            ((ktPid1 ==  -321) && (ktPid2 == -2212)))
620     fPairType = fgkKaonPlusProton;
621   else if (((ktPid1 ==  -321) && (ktPid2 ==  2212)) ||
622            ((ktPid1 ==   321) && (ktPid2 == -2212)))
623     fPairType = fgkKaonPlusAntiproton;
624   SetPid(ktPid1, ktPid2);
625 }
626
627 void AliFemtoModelWeightGeneratorLednicky::SetNuclCharge(const double aNuclCharge) {fNuclCharge=aNuclCharge;FsiNucl();}
628 void AliFemtoModelWeightGeneratorLednicky::SetNuclMass(const double aNuclMass){fNuclMass=aNuclMass;FsiNucl();}
629
630 void AliFemtoModelWeightGeneratorLednicky::SetSphere(){fSphereApp=true;}
631 void AliFemtoModelWeightGeneratorLednicky::SetSquare(){fSphereApp=false;}
632 void AliFemtoModelWeightGeneratorLednicky::SetT0ApproxOn(){ fT0App=true;}
633 void AliFemtoModelWeightGeneratorLednicky::SetT0ApproxOff(){ fT0App=false;}
634 void AliFemtoModelWeightGeneratorLednicky::SetDefaultCalcPar(){
635   fItest=1;fIqs=1;fIsi=1;fI3c=0;fIch=1;FsiInit();
636   fSphereApp=false;fT0App=false;}
637
638 void AliFemtoModelWeightGeneratorLednicky::SetCoulOn()    {fItest=1;fIch=1;FsiInit();}
639 void AliFemtoModelWeightGeneratorLednicky::SetCoulOff()   {fItest=1;fIch=0;FsiInit();}
640 void AliFemtoModelWeightGeneratorLednicky::SetQuantumOn() {fItest=1;fIqs=1;FsiInit();}
641 void AliFemtoModelWeightGeneratorLednicky::SetQuantumOff(){fItest=1;fIqs=0;FsiInit();}
642 void AliFemtoModelWeightGeneratorLednicky::SetStrongOn()  {fItest=1;fIsi=1;FsiInit();}
643 void AliFemtoModelWeightGeneratorLednicky::SetStrongOff() {fItest=1;fIsi=0;FsiInit();}
644 void AliFemtoModelWeightGeneratorLednicky::Set3BodyOn()   {fItest=1;fI3c=1;FsiInit();FsiNucl();}
645 void AliFemtoModelWeightGeneratorLednicky::Set3BodyOff()  {fItest=1;fI3c=0;FsiInit();fWeightDen=1.;FsiNucl();}
646
647 Double_t AliFemtoModelWeightGeneratorLednicky::GetKStar() const {return AliFemtoModelWeightGenerator::GetKStar();}
648 Double_t AliFemtoModelWeightGeneratorLednicky::GetKStarOut() const { return AliFemtoModelWeightGenerator::GetKStarOut(); }
649 Double_t AliFemtoModelWeightGeneratorLednicky::GetKStarSide() const { return AliFemtoModelWeightGenerator::GetKStarSide(); }
650 Double_t AliFemtoModelWeightGeneratorLednicky::GetKStarLong() const { return AliFemtoModelWeightGenerator::GetKStarLong(); }
651 Double_t AliFemtoModelWeightGeneratorLednicky::GetRStar() const { return AliFemtoModelWeightGenerator::GetRStar(); }
652 Double_t AliFemtoModelWeightGeneratorLednicky::GetRStarOut() const { return AliFemtoModelWeightGenerator::GetRStarOut(); }
653 Double_t AliFemtoModelWeightGeneratorLednicky::GetRStarSide() const { return AliFemtoModelWeightGenerator::GetRStarSide(); }
654 Double_t AliFemtoModelWeightGeneratorLednicky::GetRStarLong() const { return AliFemtoModelWeightGenerator::GetRStarLong(); }
655
656 AliFemtoModelWeightGenerator* AliFemtoModelWeightGeneratorLednicky::Clone() const {
657   AliFemtoModelWeightGenerator* tmp = new AliFemtoModelWeightGeneratorLednicky(*this);
658   return tmp;
659 }