MpdFemtoModelWeightGeneratorLednicky.cxx 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798
  1. /**
  2. * \class MpdFemtoModelWeightGenerator
  3. * \brief Femtoscopic weight generator that called Richard Lednicky's code
  4. *
  5. * The most advanced weight generator available. Supports a large
  6. * number of different pair types and interaction types. Can calculate
  7. * pair weights coming from quantum statistics, Coulomb and strong interactions
  8. * or any combination of the three, as applicable.
  9. * This class is a wrapper for the fortran code provided by Richard
  10. * Lednicky.
  11. *
  12. * \author Grigory Nigmatkulov (NRNU MEPhI)
  13. * \date May 18, 2019
  14. * \email nigmatkulov@gmail.com
  15. */
  16. // C++ headers
  17. //#include <strstream.h>
  18. //#include <iomanip.h>
  19. //#include <stream>
  20. //#include <iomanip>
  21. #include <sstream>
  22. #include <iostream>
  23. // MpdFemtoMaker headers
  24. #include "MpdFemtoModelWeightGeneratorLednicky.h"
  25. #include "MpdFemtoModelHiddenInfo.h"
  26. #include "MpdFemtoPair.h"
  27. // ROOT headers
  28. #include "TMath.h"
  29. #include "TVector3.h"
  30. #include "TLorentzVector.h"
  31. #ifdef SOLARIS
  32. #ifndef false
  33. typedef int bool;
  34. #define false 0
  35. #define true 1
  36. #endif
  37. #endif
  38. #ifdef WIN32
  39. #ifdef CERNLIB_MSSTDCALL
  40. #define F77_UCASE
  41. #define type_of_call _stdcall
  42. #ifndef CERNLIB_QXCAPT
  43. #define CERNLIB_QXCAPT
  44. #endif
  45. #else
  46. #define F77_LCASE
  47. #ifndef CERNLIB_QXNO_SC
  48. #define CERNLIB_QXNO_SC
  49. #endif
  50. #endif
  51. #define type_of_call _stdcall
  52. #define DEFCHARD const char* , const int
  53. #define DEFCHARL
  54. #define PASSCHARD(string) string, strlen(string)
  55. #define PASSCHARL(string)
  56. #else
  57. #define DEFCHARD const char*
  58. #define DEFCHARL , const int
  59. #define PASSCHARD(string) string
  60. #define PASSCHARL(string) , strlen(string)
  61. #endif
  62. #ifdef CERNLIB_QXCAPT
  63. #define F77_NAME(name,NAME) NAME
  64. #else
  65. #if defined(CERNLIB_QXNO_SC)
  66. #define F77_NAME(name,NAME) name
  67. #else
  68. #define F77_NAME(name,NAME) name##_
  69. #endif
  70. #endif
  71. #ifndef type_of_call
  72. #define type_of_call
  73. #endif
  74. // --- Prototype of the function used in the weight calculator
  75. // (in MpdFemtoFsiWeightLedinicky.F)
  76. #define fsiin F77_NAME(fsiin,FSIIN)
  77. extern "C" {
  78. void type_of_call F77_NAME(fsiin, FSIIN)(const int &itest, const int &ich, const int &iqs, const int &isi, const int &i3c);
  79. }
  80. #define llini F77_NAME(llini,LLINI)
  81. extern "C" {
  82. void type_of_call F77_NAME(llini, LLINI)(const int &lll, const int &ns, const int &itest);
  83. }
  84. #define fsinucl F77_NAME(fsinucl,FSINUCL)
  85. extern "C" {
  86. void type_of_call F77_NAME(fsinucl, FSINUCL)(const double &mn, const double &cn);
  87. }
  88. #define fsimomentum F77_NAME(fsimomentum,FSIMOMENTUM)
  89. extern "C" {
  90. void type_of_call F77_NAME(fsimomentum, FSIMOMENTUM)(double &p1, double &p2);
  91. }
  92. #define fsiposition F77_NAME(fsiposition,FSIPOSITION)
  93. extern "C" {
  94. void type_of_call F77_NAME(fsiposition, FSIPOSITION)(double &x1, double &x2);
  95. }
  96. #define fsiw F77_NAME(fsiw,FSIW)
  97. extern "C" {
  98. void type_of_call F77_NAME(fsiw, FSIW)(const int &i, double &weif,
  99. double &wei, double &wein);
  100. }
  101. #define ltran12 F77_NAME(ltran12,LTRAN12)
  102. extern "C" {
  103. void type_of_call ltran12_();
  104. }
  105. //K+K- model type
  106. #define setkpkmmodel F77_NAME(setkpkmmodel,SETKPKMMODEL)
  107. extern "C" {
  108. void type_of_call F77_NAME(setkpkmmodel, SETKPKMMODEL)(const int &i_model, const int &i_PhiOffOn);
  109. }
  110. // Test function for Lambda potential
  111. //#define printlam F77_NAME(printlam,PRINTLAM)
  112. //extern "C" {void type_of_call printlam_();}
  113. //there is not PRINTLAM in *.F file
  114. // --- Additional prototyping of some CERN functions (in FsiTool.F)
  115. typedef float REAL;
  116. typedef struct {
  117. REAL re;
  118. REAL im;
  119. } COMPLEX;
  120. #define cgamma F77_NAME(cgamma,CGAMMA)
  121. extern "C" {
  122. COMPLEX type_of_call cgamma_(COMPLEX*);
  123. }
  124. ClassImp(MpdFemtoModelWeightGeneratorLednicky);
  125. //_________________
  126. MpdFemtoModelWeightGeneratorLednicky::MpdFemtoModelWeightGeneratorLednicky() :
  127. MpdFemtoBaseModelWeightGenerator(),
  128. mWei(0), mWein(0), mWeif(0), mWeightDen(0),
  129. mItest(0), mIch(1), mIqs(1), mIsi(1), mI3c(0),
  130. mNuclMass(1.), mNuclCharge(0.),
  131. mSphereApp(false), mT0App(false),
  132. mLL(0), mNuclChargeSign(1), mSwap(0), mLLMax(30), mLLName(0),
  133. mNumProcessPair(0), mNumbNonId(0),
  134. mKpKmModel(14), mPhi_OffOn(1) {
  135. // Default constructor
  136. mLLName = new char*[mLLMax + 1];
  137. mNumProcessPair = new int[mLLMax + 1];
  138. int i;
  139. for (i = 1; i <= mLLMax; i++) {
  140. mLLName[i] = new char[40];
  141. mNumProcessPair[i] = 0;
  142. }
  143. strncpy(mLLName[1], "neutron neutron", 40);
  144. strncpy(mLLName[2], "proton proton", 40);
  145. strncpy(mLLName[3], "neutron proton", 40);
  146. strncpy(mLLName[4], "alpha alpha", 40);
  147. strncpy(mLLName[5], "pi+ pi-", 40);
  148. strncpy(mLLName[6], "pi0 pi0", 40);
  149. strncpy(mLLName[7], "pi+ pi+", 40);
  150. strncpy(mLLName[8], "neutron deuteron", 40);
  151. strncpy(mLLName[9], "proton deuteron", 40);
  152. strncpy(mLLName[10], "pi+ K-", 40);
  153. strncpy(mLLName[11], "pi+ K+", 40);
  154. strncpy(mLLName[12], "pi+ proton", 40);
  155. strncpy(mLLName[13], "pi- proton", 40);
  156. strncpy(mLLName[14], "K+ K-", 40);
  157. strncpy(mLLName[15], "K+ K+", 40);
  158. strncpy(mLLName[16], "K+ proton", 40);
  159. strncpy(mLLName[17], "K- proton", 40);
  160. strncpy(mLLName[18], "deuteron deuteron", 40);
  161. strncpy(mLLName[19], "deuton alpha", 40);
  162. strncpy(mLLName[20], "triton triton", 40);
  163. strncpy(mLLName[21], "triton alpha", 40);
  164. strncpy(mLLName[22], "K0 K0", 40);
  165. strncpy(mLLName[23], "K0 K0b", 40);
  166. strncpy(mLLName[24], "deuteron triton", 40);
  167. strncpy(mLLName[25], "proton triton", 40);
  168. strncpy(mLLName[26], "proton alpha", 40);
  169. strncpy(mLLName[27], "proton lambda", 40);
  170. strncpy(mLLName[28], "neutron lambda", 40);
  171. strncpy(mLLName[29], "Lambda lambda", 40);
  172. strncpy(mLLName[30], "Proton Anti-proton", 40);
  173. fsiInit();
  174. fsiNucl();
  175. }
  176. //_________________
  177. MpdFemtoModelWeightGeneratorLednicky::MpdFemtoModelWeightGeneratorLednicky(const MpdFemtoModelWeightGeneratorLednicky &aWeight) :
  178. MpdFemtoBaseModelWeightGenerator(),
  179. mWei(0), mWein(0), mWeif(0), mWeightDen(0),
  180. mItest(0), mIch(1), mIqs(1), mIsi(1), mI3c(0),
  181. mNuclMass(1.), mNuclCharge(0.),
  182. mSphereApp(false), mT0App(false),
  183. mLL(0), mNuclChargeSign(1), mSwap(0), mLLMax(30), mLLName(0),
  184. mNumProcessPair(0), mNumbNonId(0),
  185. mKpKmModel(14), mPhi_OffOn(1) {
  186. // Copy constructor
  187. mWei = aWeight.mWei;
  188. mWein = aWeight. mWein;
  189. mWeif = aWeight. mWeif;
  190. mWeightDen = aWeight.mWeightDen;
  191. mItest = aWeight.mItest;
  192. mIch = aWeight.mIch;
  193. mIqs = aWeight.mIqs;
  194. mIsi = aWeight.mIsi;
  195. mI3c = aWeight.mI3c;
  196. mNuclMass = aWeight.mNuclMass;
  197. mNuclCharge = aWeight.mNuclCharge;
  198. mSphereApp = aWeight.mSphereApp;
  199. mT0App = aWeight.mT0App;
  200. mLL = aWeight.mLL;
  201. mNuclChargeSign = aWeight.mNuclChargeSign;
  202. mSwap = aWeight.mSwap;
  203. mLLName = aWeight.mLLName;
  204. mNumProcessPair = aWeight.mNumProcessPair;
  205. mNumbNonId = aWeight.mNumbNonId;
  206. mLLName = new char*[mLLMax + 1];
  207. mNumProcessPair = new int[mLLMax + 1];
  208. mKpKmModel = aWeight.mKpKmModel;
  209. mPhi_OffOn = aWeight.mPhi_OffOn;
  210. int i;
  211. for (i = 1; i <= mLLMax; i++) {
  212. mLLName[i] = new char[40];
  213. mNumProcessPair[i] = 0;
  214. }
  215. strncpy(mLLName[1], "neutron neutron", 40);
  216. strncpy(mLLName[2], "proton proton", 40);
  217. strncpy(mLLName[3], "neutron proton", 40);
  218. strncpy(mLLName[4], "alpha alpha", 40);
  219. strncpy(mLLName[5], "pi+ pi-", 40);
  220. strncpy(mLLName[6], "pi0 pi0", 40);
  221. strncpy(mLLName[7], "pi+ pi+", 40);
  222. strncpy(mLLName[8], "neutron deuteron", 40);
  223. strncpy(mLLName[9], "proton deuteron", 40);
  224. strncpy(mLLName[10], "pi+ K-", 40);
  225. strncpy(mLLName[11], "pi+ K+", 40);
  226. strncpy(mLLName[12], "pi+ proton", 40);
  227. strncpy(mLLName[13], "pi- proton", 40);
  228. strncpy(mLLName[14], "K+ K-", 40);
  229. strncpy(mLLName[15], "K+ K+", 40);
  230. strncpy(mLLName[16], "K+ proton", 40);
  231. strncpy(mLLName[17], "K- proton", 40);
  232. strncpy(mLLName[18], "deuteron deuteron", 40);
  233. strncpy(mLLName[19], "deuton alpha", 40);
  234. strncpy(mLLName[20], "triton triton", 40);
  235. strncpy(mLLName[21], "triton alpha", 40);
  236. strncpy(mLLName[22], "K0 K0", 40);
  237. strncpy(mLLName[23], "K0 K0b", 40);
  238. strncpy(mLLName[24], "deuteron triton", 40);
  239. strncpy(mLLName[25], "proton triton", 40);
  240. strncpy(mLLName[26], "proton alpha", 40);
  241. strncpy(mLLName[27], "proton lambda", 40);
  242. strncpy(mLLName[28], "neutron lambda", 40);
  243. strncpy(mLLName[29], "Lambda lambda", 40);
  244. strncpy(mLLName[30], "Proton Anti-proton", 40);
  245. fsiInit();
  246. fsiNucl();
  247. }
  248. //_________________
  249. MpdFemtoModelWeightGeneratorLednicky& MpdFemtoModelWeightGeneratorLednicky::operator=(const MpdFemtoModelWeightGeneratorLednicky& aWeight) {
  250. // Assignment operator
  251. if (this != &aWeight) {
  252. mWei = aWeight.mWei;
  253. mWein = aWeight. mWein;
  254. mWeif = aWeight. mWeif;
  255. mWeightDen = aWeight.mWeightDen;
  256. mItest = aWeight.mItest;
  257. mIch = aWeight.mIch;
  258. mIqs = aWeight.mIqs;
  259. mIsi = aWeight.mIsi;
  260. mI3c = aWeight.mI3c;
  261. mNuclMass = aWeight.mNuclMass;
  262. mNuclCharge = aWeight.mNuclCharge;
  263. mSphereApp = aWeight.mSphereApp;
  264. mT0App = aWeight.mT0App;
  265. mLL = aWeight.mLL;
  266. mNuclChargeSign = aWeight.mNuclChargeSign;
  267. mSwap = aWeight.mSwap;
  268. // mLLName = aWeight.mLLName;
  269. mNumProcessPair = aWeight.mNumProcessPair;
  270. mNumbNonId = aWeight.mNumbNonId;
  271. if (mLLName) free(mLLName);
  272. mLLName = new char*[mLLMax + 1];
  273. if (mNumProcessPair) free(mNumProcessPair);
  274. mNumProcessPair = new int[mLLMax + 1];
  275. mKpKmModel = aWeight.mKpKmModel;
  276. mPhi_OffOn = aWeight.mPhi_OffOn;
  277. int i;
  278. for (i = 1; i <= mLLMax; i++) {
  279. mLLName[i] = new char[40];
  280. mNumProcessPair[i] = 0;
  281. }
  282. strncpy(mLLName[1], "neutron neutron", 40);
  283. strncpy(mLLName[2], "proton proton", 40);
  284. strncpy(mLLName[3], "neutron proton", 40);
  285. strncpy(mLLName[4], "alpha alpha", 40);
  286. strncpy(mLLName[5], "pi+ pi-", 40);
  287. strncpy(mLLName[6], "pi0 pi0", 40);
  288. strncpy(mLLName[7], "pi+ pi+", 40);
  289. strncpy(mLLName[8], "neutron deuteron", 40);
  290. strncpy(mLLName[9], "proton deuteron", 40);
  291. strncpy(mLLName[10], "pi+ K-", 40);
  292. strncpy(mLLName[11], "pi+ K+", 40);
  293. strncpy(mLLName[12], "pi+ proton", 40);
  294. strncpy(mLLName[13], "pi- proton", 40);
  295. strncpy(mLLName[14], "K+ K-", 40);
  296. strncpy(mLLName[15], "K+ K+", 40);
  297. strncpy(mLLName[16], "K+ proton", 40);
  298. strncpy(mLLName[17], "K- proton", 40);
  299. strncpy(mLLName[18], "deuteron deuteron", 40);
  300. strncpy(mLLName[19], "deuton alpha", 40);
  301. strncpy(mLLName[20], "triton triton", 40);
  302. strncpy(mLLName[21], "triton alpha", 40);
  303. strncpy(mLLName[22], "K0 K0", 40);
  304. strncpy(mLLName[23], "K0 K0b", 40);
  305. strncpy(mLLName[24], "deuteron triton", 40);
  306. strncpy(mLLName[25], "proton triton", 40);
  307. strncpy(mLLName[26], "proton alpha", 40);
  308. strncpy(mLLName[27], "proton lambda", 40);
  309. strncpy(mLLName[28], "neutron lambda", 40);
  310. strncpy(mLLName[29], "Lambda lambda", 40);
  311. strncpy(mLLName[30], "Proton Anti-proton", 40);
  312. fsiInit();
  313. fsiNucl();
  314. }
  315. return *this;
  316. }
  317. //_________________
  318. double MpdFemtoModelWeightGeneratorLednicky::generateWeight(MpdFemtoPair* aPair) {
  319. // Get hidden information pointers
  320. MpdFemtoTrack *inf1 = (MpdFemtoTrack*) aPair->track1()->track();
  321. MpdFemtoTrack *inf2 = (MpdFemtoTrack*) aPair->track2()->track();
  322. // Calculate pair variables
  323. double tPx = (((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->trueMomentum().X() +
  324. ((MpdFemtoModelHiddenInfo*) inf2->hiddenInfo())->trueMomentum().X());
  325. double tPy = (((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->trueMomentum().Y() +
  326. ((MpdFemtoModelHiddenInfo*) inf2->hiddenInfo())->trueMomentum().Y());
  327. double tPz = (((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->trueMomentum().Z() +
  328. ((MpdFemtoModelHiddenInfo*) inf2->hiddenInfo())->trueMomentum().Z());
  329. double tM1 = ((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->mass();
  330. double tM2 = ((MpdFemtoModelHiddenInfo*) inf2->hiddenInfo())->mass();
  331. double tE1 = TMath::Sqrt(tM1 * tM1 +
  332. ((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->trueMomentum().Mag2());
  333. double tE2 = TMath::Sqrt(tM2 * tM2 +
  334. ((MpdFemtoModelHiddenInfo*) inf2->hiddenInfo())->trueMomentum().Mag2());
  335. double tE = tE1 + tE2;
  336. double tPt = tPx * tPx + tPy*tPy;
  337. double tMt = tE * tE - tPz*tPz; //mCVK;
  338. double tM = TMath::Sqrt(tMt - tPt);
  339. tMt = TMath::Sqrt(tMt);
  340. tPt = TMath::Sqrt(tPt);
  341. if (tMt == 0 || tE == 0 || tM == 0 || tPt == 0) {
  342. std::cout << " weight generator zero tPt || tMt || tM || tPt" << tM1 << " " << tM2 << std::endl;
  343. return 0;
  344. }
  345. //double tBetat = tPt/tMt;
  346. // Boost to LCMS
  347. double tBeta = tPz / tE;
  348. double tGamma = tE / tMt;
  349. double pX = ((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->trueMomentum().X();
  350. double pY = ((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->trueMomentum().Y();
  351. double pZ = ((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->trueMomentum().Z();
  352. mKStarLong = tGamma * (pZ - tBeta * tE1);
  353. double tE1L = tGamma * (tE1 - tBeta * pZ);
  354. // Rotate in transverse plane
  355. mKStarOut = (pX * tPx + pY * tPy) / tPt;
  356. mKStarSide = (-pX * tPy + pY * tPx) / tPt;
  357. // Boost to pair cms
  358. mKStarOut = tMt / tM * (mKStarOut - tPt / tMt * tE1L);
  359. //tBetat = tPt/tMt;
  360. double tDX = inf1->hiddenInfo()->emissionPoint().X() - inf2->hiddenInfo()->emissionPoint().X();
  361. double tDY = inf1->hiddenInfo()->emissionPoint().Y() - inf2->hiddenInfo()->emissionPoint().Y();
  362. double tRLong = inf1->hiddenInfo()->emissionPoint().Z() - inf2->hiddenInfo()->emissionPoint().Z();
  363. double tDTime = inf1->hiddenInfo()->emissionPoint().T() - inf2->hiddenInfo()->emissionPoint().T();
  364. double tROut = (tDX * tPx + tDY * tPy) / tPt;
  365. double tRSide = (-tDX * tPy + tDY * tPx) / tPt;
  366. //std::cout<<"Weight generator"<<" tDX "<<tDX<<" tDY "<<tDY<<"tRLong "<<tRLong<<endl;
  367. /*
  368. std::cout << "Got points 1 " << inf1->GetEmissionPoint()->x()
  369. << " " << inf1->GetEmissionPoint()->y() << " " <<
  370. inf1->GetEmissionPoint()->z()
  371. << " " << inf1->GetEmissionPoint()->t()<< endl;
  372. std::cout << "Got points 2 " << inf2->GetEmissionPoint()->x()
  373. << " " << inf2->GetEmissionPoint()->y() << " " <<
  374. inf2->GetEmissionPoint()->z()
  375. << " " << inf2->GetEmissionPoint()->t()<< endl;
  376. */
  377. mRStarSide = tRSide;
  378. mRStarLong = tGamma * (tRLong - tBeta * tDTime);
  379. double tDTimePairLCMS = tGamma * (tDTime - tBeta * tRLong);
  380. tBeta = tPt / tMt;
  381. tGamma = tMt / tM;
  382. mRStarOut = tGamma * (tROut - tBeta * tDTimePairLCMS);
  383. mRStar = TMath::Sqrt(mRStarOut * mRStarOut + mRStarSide * mRStarSide + mRStarLong * mRStarLong);
  384. mKStar = TMath::Sqrt(mKStarOut * mKStarOut + mKStarSide * mKStarSide + mKStarLong * mKStarLong);
  385. //std::cout << "-- weights generator : Got out side " << mRStarOut << " " << mRStarSide << endl;
  386. if (!setPid(((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->pdgPid(),
  387. ((MpdFemtoModelHiddenInfo*) inf2->hiddenInfo())->pdgPid())) {
  388. mWeightDen = 1.;
  389. // std::cout<<" bad PID weight generator pdg1 "<<((MpdFemtoModelHiddenInfo*)inf1->GetHiddenInfo())->GetPDGPid()<<" pdg2 "<<((MpdFemtoModelHiddenInfo*)inf1->GetHiddenInfo())->GetPDGPid() << std::endl;
  390. return 1; //non-correlated
  391. } else { // Good Pid
  392. // std::cout<<" good PID weight generator pdg1 "<<((MpdFemtoModelHiddenInfo*)inf1->GetHiddenInfo())->GetPDGPid()<<" pdg2 "<<((MpdFemtoModelHiddenInfo*)inf1->GetHiddenInfo())->GetPDGPid() << std::endl;
  393. TVector3 p;
  394. p = ((MpdFemtoModelHiddenInfo*) inf1->hiddenInfo())->trueMomentum();
  395. double p1[] = {p.X(), p.Y(), p.Z()};
  396. p = ((MpdFemtoModelHiddenInfo*) inf2->hiddenInfo())->trueMomentum();
  397. double p2[] = {p.X(), p.Y(), p.Z()};
  398. if ((p1[0] == p2[0]) && (p1[1] == p2[1]) && (p1[2] == p2[2])) {
  399. mWeightDen = 0.;
  400. return 0;
  401. }
  402. if (mSwap) {
  403. fsimomentum(*p2, *p1);
  404. } else {
  405. fsimomentum(*p1, *p2);
  406. }
  407. TLorentzVector tPoint;
  408. // tPoint=((MpdFemtoModelHiddenInfo*)inf1->GetHiddenInfo())->GetEmissionPoint();
  409. tPoint = inf1->hiddenInfo()->emissionPoint();
  410. //int pdg1 = ( (MpdFemtoModelHiddenInfo*)inf1->hiddenInfo())->pdgPid();
  411. //int pdg2 = ( (MpdFemtoModelHiddenInfo*)inf2->hiddenInfo())->pdgPid();
  412. // if(pdg1==!211||pdg2!=211)std::cout << "Weight pdg1 pdg2 = " << pdg1<<" "<<pdg2<< endl;
  413. // std::cout << "LL:in GetWeight = " << mLL << std::endl;
  414. double x1[] = {tPoint.X(), tPoint.Y(), tPoint.Z(), tPoint.T()};
  415. // tPoint=((MpdFemtoModelHiddenInfo*)inf1->GetHiddenInfo())->GetEmissionPoint();
  416. tPoint = inf2->hiddenInfo()->emissionPoint();
  417. double x2[] = {tPoint.X(), tPoint.Y(), tPoint.Z(), tPoint.T()};
  418. if ((x1[0] == x2[0]) && (x1[1] == x2[1]) && (x1[2] == x2[2]) && (x1[3] == x2[3])) {
  419. mWeightDen = 0.;
  420. return 0;
  421. }
  422. if (mSwap) {
  423. fsiposition(*x2, *x1);
  424. } else {
  425. fsiposition(*x1, *x2);
  426. }
  427. fsiSetLL();
  428. ltran12();
  429. fsiw(1, mWeif, mWei, mWein);
  430. // std::cout<<" mWeif "<<mWeif<<" mWei "<<mWei<<" mWein "<<mWein << std::endl;
  431. if (mI3c == 0) return mWein;
  432. mWeightDen = mWeif;
  433. return mWei;
  434. }
  435. }
  436. //_________________
  437. MpdFemtoString MpdFemtoModelWeightGeneratorLednicky::report() {
  438. // Create report
  439. std::ostringstream tStr;
  440. tStr << "Lednicky afterburner calculation for Correlation - Report" << std::endl;
  441. tStr << " Setting : Quantum : " << ((mIqs) ? "On" : "Off");
  442. tStr << " - Coulbomb : " << ((mIch) ? "On" : "Off");
  443. tStr << " - Strong : " << ((mIsi) ? "On" : "Off");
  444. tStr << std::endl;
  445. tStr << " 3-Body : " << ((mI3c) ? "On" : "Off");
  446. if (mI3c) tStr << " Mass=" << mNuclMass << " - Charge= " << mNuclCharge;
  447. tStr << std::endl;
  448. tStr << " " << mNumProcessPair[0] << " Pairs have been Processed :" << std::endl;
  449. int i;
  450. for (i = 1; i <= mLLMax; i++) {
  451. if (mNumProcessPair[i])
  452. tStr << " " << mNumProcessPair[i] << " " << mLLName[i] << std::endl;
  453. }
  454. if (mNumbNonId)
  455. tStr << " " << mNumbNonId << " Non Identified" << std::endl;
  456. MpdFemtoString returnThis = tStr.str();
  457. return returnThis;
  458. }
  459. //_________________
  460. void MpdFemtoModelWeightGeneratorLednicky::fsiInit() {
  461. // Initialize weight generation module
  462. std::cout << "***** MpdFemtoModelWeightGeneratorLednicky check fsiInit *****" << std::endl;
  463. std::cout << "mItest dans FsiInit() = " << mItest << std::endl;
  464. std::cout << "mIch dans FsiInit() = " << mIch << std::endl;
  465. std::cout << "mIqs dans FsiInit() = " << mIqs << std::endl;
  466. std::cout << "mIsi dans FsiInit() = " << mIsi << std::endl;
  467. std::cout << "mI3c dans FsiInit() = " << mI3c << std::endl;
  468. fsiin(mItest, mIch, mIqs, mIsi, mI3c);
  469. }
  470. //_________________
  471. void MpdFemtoModelWeightGeneratorLednicky::fsiSetKpKmModelType() {
  472. // Initialize K+K- model type
  473. std::cout << "***** MpdFemtoModelWeightGeneratorLednicky check fsiInit initialize K+K- model"
  474. << "type with FsiSetKpKmModelType(), type= " << mKpKmModel << " PhiOffON= " << mPhi_OffOn
  475. << " *****" << std::endl;
  476. setkpkmmodel(mKpKmModel, mPhi_OffOn);
  477. std::cout << "-----------------END fsiSetKpKmModelType-------" << std::endl;
  478. }
  479. //_________________
  480. void MpdFemtoModelWeightGeneratorLednicky::fsiNucl() {
  481. // initialize weight generation taking into account the residual charge
  482. // std::cout << "*******************MpdFemtoModelWeightGeneratorLednicky check FsiNucl ************" << std::endl;
  483. // std::cout <<"mNuclMass dans FsiNucl() = " << mNuclMass << std::endl;
  484. // std::cout <<"mNuclCharge dans FsiNucl() = " << mNuclCharge << std::endl;
  485. // std::cout <<"mNuclChargeSign dans FsiNucl() = " << mNuclChargeSign << std::endl;
  486. fsinucl(mNuclMass, mNuclCharge * mNuclChargeSign);
  487. }
  488. //_________________
  489. void MpdFemtoModelWeightGeneratorLednicky::fsiSetLL() {
  490. // Set internal pair type for the module
  491. int tNS;
  492. if (mSphereApp || (mLL > 5)) {
  493. if (mT0App) {
  494. tNS = 4;
  495. } else {
  496. tNS = 2;
  497. }
  498. } else {
  499. tNS = 1;
  500. }
  501. //std::cout<<"*********************** MpdFemtoModelWeightGeneratorLednicky::FsiSetLL() *********************"<<std::endl;
  502. if (mNS_4 == 4) tNS = 4; //K+K- analisys
  503. //std::cout <<"mLL dans FsiSetLL() = "<< mLL << std::endl;
  504. //std::cout <<"tNS dans FsiSetLL() = "<< tNS << std::endl;
  505. //std::cout <<"mItest dans FsiSetLL() = "<< mItest << std::endl;
  506. //std::cout <<"mLL dans FsiSetLL() = "<< mLL << std::endl;
  507. //std::cout <<"tNS dans FsiSetLL() = "<< tNS << std::endl;
  508. // std::cout <<"mItest dans FsiSetLL() = "<< mItest << std::endl;
  509. llini(mLL, tNS, mItest);
  510. // std::cout<<" end of FsiSetLL"<<std::endl;
  511. }
  512. //_________________
  513. bool MpdFemtoModelWeightGeneratorLednicky::setPid(const int& aPid1, const int& aPid2) {
  514. // Set calculated system for basing on particles' pids
  515. static const int ksPi0Pid = 111;
  516. static const int ksPionPid = 211;
  517. static const int ksK0Pid = 311;
  518. static const int ksKPid = 321;
  519. static const int ksNeutPid = 2112;
  520. static const int ksProtPid = 2212;
  521. static const int ksLamPid = 3122;
  522. // std::cout << "in SetPiD Setting PID to " << aPid1 << " " << aPid2 << std::endl;
  523. int tPidl, tPidh;
  524. int tChargeFactor = 1;
  525. if (TMath::Abs(aPid1) < TMath::Abs(aPid2)) {
  526. if (aPid1 < 0) tChargeFactor = -1;
  527. tPidl = aPid1*tChargeFactor;
  528. tPidh = aPid2*tChargeFactor;
  529. mSwap = false;
  530. } else {
  531. if (aPid2 < 0) tChargeFactor = -1;
  532. tPidl = aPid2*tChargeFactor;
  533. tPidh = aPid1*tChargeFactor;
  534. mSwap = true;
  535. }
  536. switch (tPidl) {
  537. case ksPionPid:
  538. switch (tPidh) {
  539. case -ksPionPid: mLL = 5;
  540. tChargeFactor *= 1;
  541. break;
  542. case ksPionPid: mLL = 7;
  543. tChargeFactor *= 1;
  544. break;
  545. case -ksKPid: mLL = 10;
  546. tChargeFactor *= 1;
  547. break;
  548. case ksKPid: mLL = 11;
  549. tChargeFactor *= 1;
  550. break;
  551. case ksProtPid: mLL = 12;
  552. tChargeFactor *= 1;
  553. break;
  554. case -ksProtPid: mLL = 13;
  555. tChargeFactor *= -1;
  556. break;
  557. default: mLL = 0;
  558. }
  559. break;
  560. case ksProtPid:
  561. switch (tPidh) {
  562. case ksProtPid: mLL = 2;
  563. tChargeFactor *= 1;
  564. break;
  565. case ksLamPid: mLL = 27;
  566. tChargeFactor *= 1;
  567. break;
  568. case -ksProtPid: mLL = 30;
  569. tChargeFactor *= 1;
  570. break;
  571. default: mLL = 0;
  572. }
  573. break;
  574. case ksKPid:
  575. switch (tPidh) {
  576. case -ksKPid: mLL = 14;
  577. tChargeFactor *= 1;
  578. break;
  579. case ksKPid: mLL = 15;
  580. tChargeFactor *= 1;
  581. break;
  582. case ksProtPid: mLL = 16;
  583. tChargeFactor *= 1;
  584. break;
  585. case -ksProtPid: mLL = 17;
  586. tChargeFactor *= -1;
  587. break;
  588. default: mLL = 0;
  589. }
  590. break;
  591. case ksK0Pid:
  592. switch (tPidh) {
  593. case ksK0Pid: mLL = 22;
  594. tChargeFactor *= 1;
  595. break;
  596. case -ksK0Pid: mLL = 23;
  597. tChargeFactor *= 1;
  598. break;
  599. default: mLL = 0;
  600. }
  601. break;
  602. case ksPi0Pid:
  603. switch (tPidh) {
  604. case ksPi0Pid: mLL = 6;
  605. tChargeFactor *= 1;
  606. break;
  607. default: mLL = 0;
  608. }
  609. break;
  610. case ksNeutPid:
  611. switch (tPidh) {
  612. case ksNeutPid: mLL = 1;
  613. tChargeFactor *= 1;
  614. break;
  615. case ksProtPid: mLL = 3;
  616. tChargeFactor *= 1;
  617. break;
  618. case ksLamPid: mLL = 28;
  619. tChargeFactor *= 1;
  620. break;
  621. default: mLL = 0;
  622. }
  623. break; //Gael 21May02
  624. case ksLamPid: //Gael 21May02
  625. switch (tPidh) { //Gael 21May02
  626. case ksLamPid: mLL = 29;
  627. tChargeFactor *= 1;
  628. break; //Gael 21May02
  629. default: mLL = 0; //Gael 21May02
  630. } //Gael 21May02
  631. break; //Gael 21May02
  632. default: mLL = 0;
  633. }
  634. if (tChargeFactor != mNuclChargeSign) {
  635. mNuclChargeSign = tChargeFactor;
  636. FsiNucl();
  637. }
  638. (mNumProcessPair[0])++;
  639. if (mLL) {
  640. (mNumProcessPair[mLL])++;
  641. return true;
  642. } else {
  643. mNumbNonId++;
  644. return false;
  645. }
  646. // std::cout << "*******************MpdFemtoModelWeightGeneratorLednicky check SetPid ************" << std::endl;
  647. // std::cout << "mLL=="<< mLL << std::endl;
  648. // std::cout << "mNuclCharge=="<< mNuclCharge << std::endl;
  649. }
  650. //_________________
  651. MpdFemtoModelWeightGeneratorLednicky::~MpdFemtoModelWeightGeneratorLednicky() {
  652. // Destructor
  653. if (mLLName) delete [] mLLName;
  654. if (mNumProcessPair) delete [] mNumProcessPair;
  655. /* empty */
  656. }
  657. //_________________
  658. void MpdFemtoModelWeightGeneratorLednicky::setPairType(const int& aPairType) {
  659. // Set calculated system basing on the pair type
  660. mPairType = aPairType;
  661. if (mPairType == fgkPionPlusPionPlus) setPid(211, 211);
  662. if (mPairType == fgkPionPlusPionMinus) setPid(211, -211);
  663. if (mPairType == fgkKaonPlusKaonPlus) setPid(321, 321);
  664. if (mPairType == fgkKaonPlusKaonMinus) setPid(321, -321);
  665. if (mPairType == fgkProtonProton) setPid(2212, 2212);
  666. if (mPairType == fgkProtonAntiproton) setPid(2212, -2212);
  667. if (mPairType == fgkPionPlusKaonPlus) setPid(211, 321);
  668. if (mPairType == fgkPionPlusKaonMinus) setPid(211, -321);
  669. if (mPairType == fgkPionPlusProton) setPid(211, 2212);
  670. if (mPairType == fgkPionPlusAntiproton) setPid(211, -2212);
  671. if (mPairType == fgkKaonPlusProton) setPid(321, 2212);
  672. if (mPairType == fgkKaonPlusAntiproton) setPid(321, -2212);
  673. }
  674. //_________________
  675. void MpdFemtoModelWeightGeneratorLednicky::setPairTypeFromPair(MpdFemtoPair *aPair) {
  676. // Set calculated system based on the hidden info in the pair
  677. MpdFemtoModelHiddenInfo *inf1 = (MpdFemtoModelHiddenInfo *) aPair->track1()->hiddenInfo();
  678. MpdFemtoModelHiddenInfo *inf2 = (MpdFemtoModelHiddenInfo *) aPair->track2()->hiddenInfo();
  679. const int ktPid1 = inf1->pdgPid();
  680. const int ktPid2 = inf2->pdgPid();
  681. if (((ktPid1 == 211) && (ktPid2 == 211)) ||
  682. ((ktPid1 == -211) && (ktPid2 == -211)))
  683. mPairType = fgkPionPlusPionPlus;
  684. else if (((ktPid1 == -211) && (ktPid2 == 211)) ||
  685. ((ktPid1 == 211) && (ktPid2 == -211)))
  686. mPairType = fgkPionPlusPionMinus;
  687. else if (((ktPid1 == 321) && (ktPid2 == 321)) ||
  688. ((ktPid1 == -321) && (ktPid2 == -321)))
  689. mPairType = fgkKaonPlusKaonPlus;
  690. else if (((ktPid1 == -321) && (ktPid2 == 321)) ||
  691. ((ktPid1 == 321) && (ktPid2 == -321)))
  692. mPairType = fgkKaonPlusKaonMinus;
  693. else if (((ktPid1 == 2212) && (ktPid2 == 2212)) ||
  694. ((ktPid1 == -2212) && (ktPid2 == -2212)))
  695. mPairType = fgkProtonProton;
  696. else if (((ktPid1 == -2212) && (ktPid2 == 2212)) ||
  697. ((ktPid1 == 2212) && (ktPid2 == -2212)))
  698. mPairType = fgkProtonAntiproton;
  699. else if (((ktPid1 == 211) && (ktPid2 == 321)) ||
  700. ((ktPid1 == -211) && (ktPid2 == -321)))
  701. mPairType = fgkPionPlusKaonPlus;
  702. else if (((ktPid1 == -211) && (ktPid2 == 321)) ||
  703. ((ktPid1 == 211) && (ktPid2 == -321)))
  704. mPairType = fgkPionPlusKaonMinus;
  705. else if (((ktPid1 == 211) && (ktPid2 == 2212)) ||
  706. ((ktPid1 == -211) && (ktPid2 == -2212)))
  707. mPairType = fgkPionPlusProton;
  708. else if (((ktPid1 == -211) && (ktPid2 == 2212)) ||
  709. ((ktPid1 == 211) && (ktPid2 == -2212)))
  710. mPairType = fgkPionPlusAntiproton;
  711. else if (((ktPid1 == 321) && (ktPid2 == 2212)) ||
  712. ((ktPid1 == -321) && (ktPid2 == -2212)))
  713. mPairType = fgkKaonPlusProton;
  714. else if (((ktPid1 == -321) && (ktPid2 == 2212)) ||
  715. ((ktPid1 == 321) && (ktPid2 == -2212)))
  716. mPairType = fgkKaonPlusAntiproton;
  717. setPid(ktPid1, ktPid2);
  718. }