StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtFsiLednickyPurity.cxx
1 /***************************************************************************
2  *
3  *
4  *
5  * Author: Adam Kisiel, Warsaw University of Technology, Poland
6  ***************************************************************************
7  *
8  * Description : Calculate correlation weight using R.Lednicky's code
9  * Use the fortran files : FsiLednickyWeight.F and FsiTools.F
10  *
11  ***************************************************************************
12  *
13  *
14  *
15  ***************************************************************************/
16 
17 #include "StHbtMaker/ThCorrFctn/StHbtFsiLednickyPurity.h"
18 #include "StarCallf77.h"
19 #include <Stsstream.h>
20 
21 
22 #ifdef SOLARIS
23 # ifndef false
24 typedef int bool;
25 #define false 0
26 #define true 1
27 # endif
28 #endif
29 
30 // --- Prototype of the function used in the weight calculator
31 // (in FsiWeightLedinicky.F)
32 #define fsiin F77_NAME(fsiin,FSIIN)
33 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);}
34 #define llini F77_NAME(llini,LLINI)
35 extern "C" {void type_of_call F77_NAME(llini,LLINI)(const int &lll,const int &ns, const int &itest);}
36 
37 #define fsinucl F77_NAME(fsinucl,FSINUCL)
38 extern "C" {void type_of_call F77_NAME(fsinucl,FSINUCL)(const double &mn,const double &cn);}
39 #define fsimomentum F77_NAME(fsimomentum,FSIMOMENTUM)
40 extern "C" {void type_of_call F77_NAME(fsimomentum,FSIMOMENTUM)(double &p1,double &p2);}
41 #define fsiposition F77_NAME(fsiposition,FSIPOSITION)
42 extern "C" {void type_of_call F77_NAME(fsiposition,FSIPOSITION)(double &x1,double &x2);}
43 #define fsiw F77_NAME(fsiw,FSIW)
44 extern "C" {void type_of_call F77_NAME(fsiw,FSIW)(const int &i,double &weif,
45  double &wei,double &wein);}
46 #define ltran12 F77_NAME(ltran12,LTRAN12)
47 extern "C" {void type_of_call ltran12_();}
48 
49 // --- Additional prototyping of some CERN functions (in FsiTool.F)
50 typedef float REAL;
51 typedef struct { REAL re; REAL im; } COMPLEX;
52 #define cgamma F77_NAME(cgamma,CGAMMA)
53 extern "C" {COMPLEX type_of_call cgamma_(COMPLEX*);}
54 
55 #ifdef __ROOT__
56 ClassImp(StHbtFsiLednickyPurity)
57 #endif
58 
59 StHbtFsiLednickyPurity::StHbtFsiLednickyPurity() : StHbtFsiLednicky(),
60  mPurity1(1.0), mPurity2(1.0)
61 {
62  /* no-op */
63 };
64 
65 
66 double StHbtFsiLednickyPurity::GetWeight(const StHbtThPair* aThPair){
67 
68  if (!SetPid(aThPair->GetPid1(),aThPair->GetPid2())) {
69  mWeightDen=1.;
70  return 1;
71  } else { // Good Pid
72  // Check the purity
73  if (aThPair->GetPid1() == aThPair->GetPid2()) {
74  if (mRandom.Rndm() > mPurity1) {
75  mWeightDen=1.;
76  return 1;
77  }
78  }
79  else if ((mRandom.Rndm() > mPurity1) || (mRandom.Rndm() > mPurity1)) {
80  mWeightDen=1.;
81  return 1;
82  }
83  const StHbtLorentzVector* p;
84  p=(aThPair->GetRealMomentum1());
85  double p1[]={p->px(),p->py(),p->pz()};
86  p=(aThPair->GetRealMomentum2());
87  double p2[]={p->px(),p->py(),p->pz()};
88  if ((p1[0]==p2[0])&&(p1[1]==p2[1])&&(p1[2]==p2[2])) {
89  mWeightDen=0.;
90  return 0;
91  }
92  if (mSwap) {
93  fsimomentum(*p2,*p1);
94  } else {
95  fsimomentum(*p1,*p2);
96  }
97  p=(aThPair->GetEmPoint1());
98  double x1[]={p->x(),p->y(),p->z(),p->t()};
99  p=(aThPair->GetEmPoint2());
100  double x2[]={p->x(),p->y(),p->z(),p->t()};
101  if ((x1[0]==x2[0])&&(x1[1]==x2[1])&&(x1[2]==x2[2])&&(x1[3]==x2[3])) {
102  mWeightDen=0.;
103  return 0;
104  }
105  if (mSwap) {
106  fsiposition(*x1,*x2);
107  } else {
108  fsiposition(*x2,*x1);
109  }
110  FsiSetLL();
111  ltran12();
112  fsiw(1,mWeif,mWei,mWein);
113  if (mI3c==0) return mWein;
114  mWeightDen=mWeif;
115  return mWei;
116  };
117 };
118 
119 StHbtString StHbtFsiLednickyPurity::Report() {
120  std::ostringstream tStr;
121  tStr << "Lednicky afterburner calculation for Correlation - Report" << endl;
122  tStr << " Setting : Quantum : " << ((mIqs) ? "On" : "Off");
123  tStr << " - Coulbomb : " << ((mIch) ? "On" : "Off") ;
124  tStr << " - Strong : " << ((mIsi) ? "On" : "Off");
125  tStr << endl;
126  tStr << " 3-Body : " << ((mI3c) ? "On" : "Off") ;
127  if (mI3c) tStr << " Mass=" << mNuclMass << " - Charge= " << mNuclCharge ;
128  tStr << endl;
129  tStr << "First particle purity : " << mPurity1 << " second : " << mPurity2 << endl;
130  tStr << " " << mNumProcessPair[0] << " Pairs have been Processed :" << endl;
131  int i;
132  for(i=1;i<=mLLMax;i++) {
133  if (mNumProcessPair[i])
134  tStr << " "<< setw(8) << mNumProcessPair[i] << " " << mLLName[i] << endl;
135  }
136  if (mNumbNonId)
137  tStr << " "<< setw(8) << mNumbNonId << " Non Identified" << endl;
138  StHbtString returnThis = tStr.str();
139  return returnThis;
140 }
141 
142 StHbtFsiLednickyPurity::~StHbtFsiLednickyPurity()
143 { /* no-op */ };
144 
145 
146 inline void StHbtFsiLednickyPurity::SetPurity(const double aPurity) { mPurity1=aPurity; mPurity2 = aPurity; }
147 inline void StHbtFsiLednickyPurity::SetPurity(const double aPurity1, const double aPurity2) { mPurity1 = aPurity1; mPurity2 = aPurity2; }
148 
149 
150 
151