/////////////////////////////////////////////////////////////////////////// // // // AliFemtoModelWeightGeneratorLednicky : the most advanced weight // // generator available. Supports a large number of different pair types // // and interaction types. Can calculate pair weights coming from // // quantum statistics, coulomb interation and strong interaction ot any // // combination of the three, as applicable. // // This class is a wrapper for the fortran code provided by Richard // // Lednicky. // // // /////////////////////////////////////////////////////////////////////////// //#include "StHbtMaker/ThCorrFctn/AliFemtoModelWeightGeneratorLednicky.h" #include "AliFemtoModelWeightGeneratorLednicky.h" #include "AliFemtoModelHiddenInfo.h" #include "AliFemtoPair.h" //#include "StarCallf77.h" //#include //#include //#include //#include #include #ifdef SOLARIS # ifndef false typedef int bool; #define false 0 #define true 1 # endif #endif #ifdef WIN32 # ifdef CERNLIB_MSSTDCALL # define F77_UCASE # define type_of_call _stdcall # ifndef CERNLIB_QXCAPT # define CERNLIB_QXCAPT # endif # else # define F77_LCASE # ifndef CERNLIB_QXNO_SC # define CERNLIB_QXNO_SC # endif # endif # define type_of_call _stdcall # define DEFCHARD const char* , const int # define DEFCHARL # define PASSCHARD(string) string, strlen(string) # define PASSCHARL(string) #else # define DEFCHARD const char* # define DEFCHARL , const int # define PASSCHARD(string) string # define PASSCHARL(string) , strlen(string) #endif #ifdef CERNLIB_QXCAPT # define F77_NAME(name,NAME) NAME #else # if defined(CERNLIB_QXNO_SC) # define F77_NAME(name,NAME) name # else # define F77_NAME(name,NAME) name##_ # endif #endif #ifndef type_of_call # define type_of_call #endif // --- Prototype of the function used in the weight calculator // (in FsiWeightLedinicky.F) #define fsiin F77_NAME(fsiin,FSIIN) 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);} #define llini F77_NAME(llini,LLINI) extern "C" {void type_of_call F77_NAME(llini,LLINI)(const int &lll,const int &ns, const int &itest);} #define fsinucl F77_NAME(fsinucl,FSINUCL) extern "C" {void type_of_call F77_NAME(fsinucl,FSINUCL)(const double &mn,const double &cn);} #define fsimomentum F77_NAME(fsimomentum,FSIMOMENTUM) extern "C" {void type_of_call F77_NAME(fsimomentum,FSIMOMENTUM)(double &p1,double &p2);} #define fsiposition F77_NAME(fsiposition,FSIPOSITION) extern "C" {void type_of_call F77_NAME(fsiposition,FSIPOSITION)(double &x1,double &x2);} #define fsiw F77_NAME(fsiw,FSIW) extern "C" {void type_of_call F77_NAME(fsiw,FSIW)(const int &i,double &weif, double &wei,double &wein);} #define ltran12 F77_NAME(ltran12,LTRAN12) extern "C" {void type_of_call ltran12_();} // Test function for Lambda potential //#define printlam F77_NAME(printlam,PRINTLAM) //extern "C" {void type_of_call printlam_();} //there is not PRINTLAM in *.F file // --- Additional prototyping of some CERN functions (in FsiTool.F) typedef float REAL; typedef struct { REAL re; REAL im; } COMPLEX; #define cgamma F77_NAME(cgamma,CGAMMA) extern "C" {COMPLEX type_of_call cgamma_(COMPLEX*);} #ifdef __ROOT__ ClassImp(AliFemtoModelWeightGeneratorLednicky) #endif AliFemtoModelWeightGeneratorLednicky::AliFemtoModelWeightGeneratorLednicky() : AliFemtoModelWeightGenerator(), fWei(0), fWein(0), fWeif(0), fWeightDen(0), fItest(0),fIch(1),fIqs(1),fIsi(1),fI3c(0), fNuclMass(1.),fNuclCharge(0.), fSphereApp(false),fT0App(false) , fLL(0), fNuclChargeSign(1), fSwap(0), fLLMax(30), fLLName(0), fNumProcessPair(0), fNumbNonId(0) { // default constructor fLLName=new char*[fLLMax+1]; fNumProcessPair=new int[fLLMax+1]; int i; for (i=1;i<=fLLMax;i++) {fLLName[i]=new char[40];fNumProcessPair[i]=0;} strncpy( fLLName[1],"neutron neutron",40); strncpy( fLLName[2],"proton proton",40); strncpy( fLLName[3],"neutron proton",40); strncpy( fLLName[4],"alpha alpha",40); strncpy( fLLName[5],"pi+ pi-",40); strncpy( fLLName[6],"pi0 pi0",40); strncpy( fLLName[7],"pi+ pi+",40); strncpy( fLLName[8],"neutron deuteron",40); strncpy( fLLName[9],"proton deuteron",40); strncpy( fLLName[10],"pi+ K-",40); strncpy( fLLName[11],"pi+ K+",40); strncpy( fLLName[12],"pi+ proton",40); strncpy( fLLName[13],"pi- proton",40); strncpy( fLLName[14],"K+ K-",40); strncpy( fLLName[15],"K+ K+",40); strncpy( fLLName[16],"K+ proton",40); strncpy( fLLName[17],"K- proton",40); strncpy( fLLName[18],"deuteron deuteron",40); strncpy( fLLName[19],"deuton alpha",40); strncpy( fLLName[20],"triton triton",40); strncpy( fLLName[21],"triton alpha",40); strncpy( fLLName[22],"K0 K0",40); strncpy( fLLName[23],"K0 K0b",40); strncpy( fLLName[24],"deuteron triton",40); strncpy( fLLName[25],"proton triton",40); strncpy( fLLName[26],"proton alpha",40); strncpy( fLLName[27],"proton lambda",40); strncpy( fLLName[28],"neutron lambda",40); strncpy( fLLName[29],"Lambda lambda",40);// gael 21May02 strncpy( fLLName[30],"Proton Anti-proton",40);// gael 21May02 FsiInit(); FsiNucl(); } //______________________ AliFemtoModelWeightGeneratorLednicky::AliFemtoModelWeightGeneratorLednicky(const AliFemtoModelWeightGeneratorLednicky &aWeight): AliFemtoModelWeightGenerator(), fWei(0), fWein(0), fWeif(0), fWeightDen(0), fItest(0),fIch(1),fIqs(1),fIsi(1),fI3c(0), fNuclMass(1.),fNuclCharge(0.), fSphereApp(false),fT0App(false) , fLL(0), fNuclChargeSign(1), fSwap(0), fLLMax(30), fLLName(0), fNumProcessPair(0), fNumbNonId(0) { // copy constructor fWei = aWeight.fWei; fWein = aWeight. fWein; fWeif = aWeight. fWeif; fWeightDen = aWeight.fWeightDen; fItest = aWeight.fItest; fIch = aWeight.fIch; fIqs = aWeight.fIqs; fIsi = aWeight.fIsi; fI3c = aWeight.fI3c; fNuclMass = aWeight.fNuclMass; fNuclCharge = aWeight.fNuclCharge; fSphereApp = aWeight.fSphereApp; fT0App = aWeight.fT0App; fLL = aWeight.fLL; fNuclChargeSign = aWeight.fNuclChargeSign; fSwap = aWeight.fSwap; fLLName = aWeight.fLLName; fNumProcessPair = aWeight.fNumProcessPair; fNumbNonId = aWeight.fNumbNonId; fLLName=new char*[fLLMax+1]; fNumProcessPair=new int[fLLMax+1]; int i; for (i=1;i<=fLLMax;i++) {fLLName[i]=new char[40];fNumProcessPair[i]=0;} strncpy( fLLName[1],"neutron neutron",40); strncpy( fLLName[2],"proton proton",40); strncpy( fLLName[3],"neutron proton",40); strncpy( fLLName[4],"alpha alpha",40); strncpy( fLLName[5],"pi+ pi-",40); strncpy( fLLName[6],"pi0 pi0",40); strncpy( fLLName[7],"pi+ pi+",40); strncpy( fLLName[8],"neutron deuteron",40); strncpy( fLLName[9],"proton deuteron",40); strncpy( fLLName[10],"pi+ K-",40); strncpy( fLLName[11],"pi+ K+",40); strncpy( fLLName[12],"pi+ proton",40); strncpy( fLLName[13],"pi- proton",40); strncpy( fLLName[14],"K+ K-",40); strncpy( fLLName[15],"K+ K+",40); strncpy( fLLName[16],"K+ proton",40); strncpy( fLLName[17],"K- proton",40); strncpy( fLLName[18],"deuteron deuteron",40); strncpy( fLLName[19],"deuton alpha",40); strncpy( fLLName[20],"triton triton",40); strncpy( fLLName[21],"triton alpha",40); strncpy( fLLName[22],"K0 K0",40); strncpy( fLLName[23],"K0 K0b",40); strncpy( fLLName[24],"deuteron triton",40); strncpy( fLLName[25],"proton triton",40); strncpy( fLLName[26],"proton alpha",40); strncpy( fLLName[27],"proton lambda",40); strncpy( fLLName[28],"neutron lambda",40); strncpy( fLLName[29],"Lambda lambda",40);// gael 21May02 strncpy( fLLName[30],"Proton Anti-proton",40);// gael 21May02 FsiInit(); FsiNucl(); } AliFemtoModelWeightGeneratorLednicky& AliFemtoModelWeightGeneratorLednicky::operator=(const AliFemtoModelWeightGeneratorLednicky& aWeight) { // assignment operator if (this == &aWeight) return *this; fWei = aWeight.fWei; fWein = aWeight. fWein; fWeif = aWeight. fWeif; fWeightDen = aWeight.fWeightDen; fItest = aWeight.fItest; fIch = aWeight.fIch; fIqs = aWeight.fIqs; fIsi = aWeight.fIsi; fI3c = aWeight.fI3c; fNuclMass = aWeight.fNuclMass; fNuclCharge = aWeight.fNuclCharge; fSphereApp = aWeight.fSphereApp; fT0App = aWeight.fT0App; fLL = aWeight.fLL; fNuclChargeSign = aWeight.fNuclChargeSign; fSwap = aWeight.fSwap; // fLLName = aWeight.fLLName; fNumProcessPair = aWeight.fNumProcessPair; fNumbNonId = aWeight.fNumbNonId; if (fLLName) free(fLLName); fLLName=new char*[fLLMax+1]; if (fNumProcessPair) free(fNumProcessPair); fNumProcessPair=new int[fLLMax+1]; int i; for (i=1;i<=fLLMax;i++) {fLLName[i]=new char[40];fNumProcessPair[i]=0;} strncpy( fLLName[1],"neutron neutron",40); strncpy( fLLName[2],"proton proton",40); strncpy( fLLName[3],"neutron proton",40); strncpy( fLLName[4],"alpha alpha",40); strncpy( fLLName[5],"pi+ pi-",40); strncpy( fLLName[6],"pi0 pi0",40); strncpy( fLLName[7],"pi+ pi+",40); strncpy( fLLName[8],"neutron deuteron",40); strncpy( fLLName[9],"proton deuteron",40); strncpy( fLLName[10],"pi+ K-",40); strncpy( fLLName[11],"pi+ K+",40); strncpy( fLLName[12],"pi+ proton",40); strncpy( fLLName[13],"pi- proton",40); strncpy( fLLName[14],"K+ K-",40); strncpy( fLLName[15],"K+ K+",40); strncpy( fLLName[16],"K+ proton",40); strncpy( fLLName[17],"K- proton",40); strncpy( fLLName[18],"deuteron deuteron",40); strncpy( fLLName[19],"deuton alpha",40); strncpy( fLLName[20],"triton triton",40); strncpy( fLLName[21],"triton alpha",40); strncpy( fLLName[22],"K0 K0",40); strncpy( fLLName[23],"K0 K0b",40); strncpy( fLLName[24],"deuteron triton",40); strncpy( fLLName[25],"proton triton",40); strncpy( fLLName[26],"proton alpha",40); strncpy( fLLName[27],"proton lambda",40); strncpy( fLLName[28],"neutron lambda",40); strncpy( fLLName[29],"Lambda lambda",40);// gael 21May02 strncpy( fLLName[30],"Proton Anti-proton",40);// gael 21May02 FsiInit(); FsiNucl(); return *this; } double AliFemtoModelWeightGeneratorLednicky::GenerateWeight(AliFemtoPair* aPair) { // Get hidden information pointers //AliFemtoModelHiddenInfo *inf1 = (AliFemtoModelHiddenInfo *) aPair->Track1()->HiddenInfo(); //AliFemtoModelHiddenInfo *inf2 = (AliFemtoModelHiddenInfo *) aPair->Track2()->HiddenInfo(); AliFemtoTrack *inf1 = (AliFemtoTrack *) aPair->Track1()->Track(); AliFemtoTrack *inf2 = (AliFemtoTrack *) aPair->Track2()->Track(); // Calculate pair variables Double_t tPx = inf1->GetTrueMomentum()->x()+inf2->GetTrueMomentum()->x(); Double_t tPy = inf1->GetTrueMomentum()->y()+inf2->GetTrueMomentum()->y(); Double_t tPz = inf1->GetTrueMomentum()->z()+inf2->GetTrueMomentum()->z(); Double_t tM1 = inf1->GetMass(); Double_t tM2 = inf2->GetMass(); Double_t tE1 = sqrt(tM1*tM1 + inf1->GetTrueMomentum()->Mag2()); Double_t tE2 = sqrt(tM2*tM2 + inf2->GetTrueMomentum()->Mag2()); Double_t tE = tE1 + tE2; Double_t tPt = tPx*tPx + tPy*tPy; Double_t tMt = tE*tE - tPz*tPz;//mCVK; Double_t tM = sqrt(tMt - tPt); tMt = sqrt(tMt); tPt = sqrt(tPt); Double_t tBetat = tPt/tMt; // Boost to LCMS Double_t tBeta = tPz/tE; Double_t tGamma = tE/tMt; fKStarLong = tGamma * (inf1->GetTrueMomentum()->z() - tBeta * tE1); Double_t tE1L = tGamma * (tE1 - tBeta * inf1->GetTrueMomentum()->z()); // Rotate in transverse plane fKStarOut = ( inf1->GetTrueMomentum()->x()*tPx + inf1->GetTrueMomentum()->y()*tPy)/tPt; fKStarSide = (-inf1->GetTrueMomentum()->x()*tPy + inf1->GetTrueMomentum()->y()*tPx)/tPt; // Boost to pair cms fKStarOut = tMt/tM * (fKStarOut - tPt/tMt * tE1L); tBetat = tPt/tMt; Double_t tDX = inf1->GetEmissionPoint()->x()-inf2->GetEmissionPoint()->x(); Double_t tDY = inf1->GetEmissionPoint()->y()-inf2->GetEmissionPoint()->y(); Double_t tRLong = inf1->GetEmissionPoint()->z()-inf2->GetEmissionPoint()->z(); Double_t tDTime = inf1->GetEmissionPoint()->t()-inf2->GetEmissionPoint()->t(); Double_t tROut = (tDX*tPx + tDY*tPy)/tPt; Double_t tRSide = (-tDX*tPy + tDY*tPx)/tPt; // cout << "Got points 1 " << inf1->GetEmissionPoint()->x() << " " << inf1->GetEmissionPoint()->y() << " " << inf1->GetEmissionPoint()->z() << " " << inf1->GetEmissionPoint()->t() << endl; // cout << "Got points 2 " << inf2->GetEmissionPoint()->x() << " " << inf2->GetEmissionPoint()->y() << " " << inf2->GetEmissionPoint()->z() << " " << inf2->GetEmissionPoint()->t() << endl; fRStarSide = tRSide; fRStarLong = tGamma*(tRLong - tBeta* tDTime); Double_t tDTimePairLCMS = tGamma*(tDTime - tBeta* tRLong); tBeta = tPt/tMt; tGamma = tMt/tM; fRStarOut = tGamma*(tROut - tBeta* tDTimePairLCMS); fRStar = ::sqrt(fRStarOut*fRStarOut + fRStarSide*fRStarSide + fRStarLong*fRStarLong); fKStar = ::sqrt(fKStarOut*fKStarOut + fKStarSide*fKStarSide + fKStarLong*fKStarLong); // cout << "Got out side " << fRStarOut << " " << fRStarSide << endl; if (!SetPid(inf1->GetPDGPid(),inf2->GetPDGPid())) { fWeightDen=1.; return 1; } else { // Good Pid AliFemtoThreeVector* p; p=(inf1->GetTrueMomentum()); double p1[]={p->x(),p->y(),p->z()}; p=(inf2->GetTrueMomentum()); double p2[]={p->x(),p->y(),p->z()}; if ((p1[0]==p2[0])&&(p1[1]==p2[1])&&(p1[2]==p2[2])) { fWeightDen=0.; return 0; } if (fSwap) { fsimomentum(*p2,*p1); } else { fsimomentum(*p1,*p2); } AliFemtoLorentzVector* tPoint; tPoint=(inf1->GetEmissionPoint()); // cout << "Pid1:dans GetWeight = " << aThPair->GetPid1() << endl; // cout << "Pid2:dans GetWeight = " << aThPair->GetPid2() << endl; // cout << "LL:in GetWeight = " << mLL << endl; double x1[]={tPoint->x(),tPoint->y(),tPoint->z(),tPoint->t()}; tPoint=(inf2->GetEmissionPoint()); double x2[]={tPoint->x(),tPoint->y(),tPoint->z(),tPoint->t()}; if ((x1[0]==x2[0])&&(x1[1]==x2[1])&&(x1[2]==x2[2])&&(x1[3]==x2[3])) { fWeightDen=0.; return 0; } if (fSwap) { fsiposition(*x2,*x1); } else { fsiposition(*x1,*x2); } FsiSetLL(); ltran12(); fsiw(1,fWeif,fWei,fWein); if (fI3c==0) return fWein; fWeightDen=fWeif; return fWei; } } AliFemtoString AliFemtoModelWeightGeneratorLednicky::Report() { // create report ostringstream tStr; tStr << "Lednicky afterburner calculation for Correlation - Report" << endl; tStr << " Setting : Quantum : " << ((fIqs) ? "On" : "Off"); tStr << " - Coulbomb : " << ((fIch) ? "On" : "Off") ; tStr << " - Strong : " << ((fIsi) ? "On" : "Off"); tStr << endl; tStr << " 3-Body : " << ((fI3c) ? "On" : "Off") ; if (fI3c) tStr << " Mass=" << fNuclMass << " - Charge= " << fNuclCharge ; tStr << endl; tStr << " " << fNumProcessPair[0] << " Pairs have been Processed :" << endl; int i; for(i=1;i<=fLLMax;i++) { if (fNumProcessPair[i]) tStr << " " << fNumProcessPair[i] << " " << fLLName[i] << endl; } if (fNumbNonId) tStr << " "<< fNumbNonId << " Non Identified" << endl; AliFemtoString returnThis = tStr.str(); return returnThis; } void AliFemtoModelWeightGeneratorLednicky::FsiInit(){ // Initialize weight generation module // cout << "*******************AliFemtoModelWeightGeneratorLednicky check FsiInit ************" << endl; // cout <<"mItest dans FsiInit() = " << fItest << endl; // cout <<"mIch dans FsiInit() = " << fIch << endl; // cout <<"mIqs dans FsiInit() = " << fIqs << endl; // cout <<"mIsi dans FsiInit() = " << fIsi << endl; // cout <<"mI3c dans FsiInit() = " << fI3c << endl; fsiin(fItest,fIch,fIqs,fIsi,fI3c); } void AliFemtoModelWeightGeneratorLednicky::FsiNucl(){ // initialize weight generation taking into account the residual charge // cout << "*******************AliFemtoModelWeightGeneratorLednicky check FsiNucl ************" << endl; // cout <<"fNuclMass dans FsiNucl() = " << fNuclMass << endl; // cout <<"fNuclCharge dans FsiNucl() = " << fNuclCharge << endl; // cout <<"fNuclChargeSign dans FsiNucl() = " << fNuclChargeSign << endl; fsinucl(fNuclMass,fNuclCharge*fNuclChargeSign); } void AliFemtoModelWeightGeneratorLednicky::FsiSetLL(){ // set internal pair type for the module int tNS; if (fSphereApp||(fLL>5)) { if (fT0App) { tNS=4;} else {tNS=2;} } else { tNS=1;} //cout <<"fLL dans FsiSetLL() = "<< fLL << endl; //cout <<"tNS dans FsiSetLL() = "<< tNS << endl; //cout <<"fItest dans FsiSetLL() = "<< fItest << endl; llini(fLL,tNS,fItest); //cout<<" end of FsiSetLL"<