MpdPhotonAnalysisParams.cxx 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #include <iostream> // std::cout
  2. #include <fstream> // std::ifstream
  3. #include <map>
  4. #include "MpdPhotonAnalysisParams.h"
  5. using namespace std ;
  6. ClassImp(MpdPhotonAnalysisParams)
  7. void MpdPhotonAnalysisParams:: ReadFromFile(std::string fname){
  8. //Read from file in format
  9. // varname value
  10. // comments start from #
  11. if(fname.size()==0){
  12. return ;
  13. }
  14. std::ifstream ifs(fname) ;
  15. std::string a,b ;
  16. while (ifs.good()) {
  17. ifs >> a ;
  18. //if comment, skip to the enf of line
  19. if(a.find_first_of('#')==0){
  20. ifs.ignore(999,'\n') ;
  21. continue ;
  22. }
  23. else{
  24. ifs >> b ;
  25. mMap.insert({a,b}) ;
  26. }
  27. }
  28. ifs.close() ;
  29. //Parse prepared map
  30. read("mZvtxCut",mZvtxCut) ;
  31. read("mNhitsCut",mNhitsCut) ;
  32. //V0 cuts
  33. read("mMinR2Cut",mMinR2Cut) ;
  34. read("mMaxR2Cut",mMaxR2Cut) ;
  35. read("mPIDsigM",mPIDsigM) ;
  36. read("mPIDsigE",mPIDsigE) ;
  37. read("mPIDenergy",mPIDenergy) ;
  38. read("mPIDkoeff",mPIDkoeff) ;
  39. read("mPIDgenerator",mPIDgenerator) ;
  40. read("mPIDtracking",mPIDtracking) ;
  41. read("mPIDparticles",mPIDparticles) ;
  42. read("mNofHitsCut",mNofHitsCut) ;
  43. read("mEtaCut",mEtaCut) ;
  44. read("mPtminCut",mPtminCut) ;
  45. read("mProbElCut",mProbElCut) ;
  46. read("mdEdxSigmaCut",mdEdxSigmaCut) ;
  47. read("mBetaSigmaCut",mBetaSigmaCut) ;
  48. read("mMassCut",mMassCut) ;
  49. read("mDistCut",mDistCut) ;
  50. read("mCosPsiCut",mCosPsiCut) ;
  51. read("mAlphaCut",mAlphaCut) ;
  52. read("mChi2Cut",mChi2Cut) ;
  53. read("mCluEmin",mCluEmin) ;
  54. read("mCluMult",mCluMult) ;
  55. read("mCluTof",mCluTof) ;
  56. read("mCluDisp",mCluDisp) ;
  57. read("mCluDispEmin",mCluDispEmin) ;
  58. read("mCluCPV",mCluCPV) ;
  59. }
  60. void MpdPhotonAnalysisParams::Print() const {
  61. cout << "#-------Parameters used for analysis------" << endl ;
  62. cout << "# Event selection: " << endl ;
  63. cout << "mZvtxCut "<< mZvtxCut << " // cut on vertex z coordinate" << endl;
  64. cout << "mNhitsCut "<< mNhitsCut << " // number of hits in TPC tracks used for centrality" << endl;
  65. cout << "# V0 cuts: " << endl ;
  66. cout << "mMinR2Cut "<< mMinR2Cut << " // (cm) Minimal conversion radius (to exclude Dalitz)" << endl;
  67. cout << "mMaxR2Cut "<< mMaxR2Cut << " // (cm) Maximal conversion radius (to exclude poorly reconstructed tracks)" << endl;
  68. cout << "mPIDsigM " << mPIDsigM << " // dEdx PID parameters" << endl;
  69. cout << "mPIDsigE " << mPIDsigE << " // dEdx PID parameters" << endl;
  70. cout << "mPIDenergy " << mPIDenergy << " // dEdx PID parameters" << endl;
  71. cout << "mPIDkoeff " << mPIDkoeff << " // dEdx PID parameters" << endl;
  72. cout << "mPIDgenerator " << mPIDgenerator << " // dEdx PID parameters" << endl;
  73. cout << "mPIDtracking " << mPIDtracking << " // dEdx PID parameters" << endl;
  74. cout << "mPIDparticles " << mPIDparticles << " // dEdx PID parameters" << endl;
  75. cout << "mNofHitsCut " << mNofHitsCut << " // minimal number of hits to accept track" << endl;
  76. cout << "mEtaCut " << mEtaCut << " // maximal pseudorapidity accepted" << endl;
  77. cout << "mPtminCut " << mPtminCut << " // minimal pt used in analysis" << endl;
  78. cout << "mNofHitsCut " << mNofHitsCut << " // minimal number of hits to accept track" << endl;
  79. cout << "mProbElCut " << mProbElCut << " // minimal dEdx probability for electrons" << endl;
  80. cout << "mdEdxSigmaCut " << mdEdxSigmaCut << " // dEdx cut in sigmas" << endl;
  81. cout << "mBetaSigmaCut " << mBetaSigmaCut << " // beta cut" << endl;
  82. cout << "mAlphaCut " << mAlphaCut << " // r vs p angle" << endl;
  83. cout << "mMassCut " << mMassCut << " // e+e- pair mass cut" << endl;
  84. cout << "mDistCut " << mDistCut << " // maximal closest distance between daughters" << endl;
  85. cout << "mCosPsiCut " << mCosPsiCut << " // e+e- pair orientation wrt B-filed" << endl;
  86. cout << "mChi2Cut " << mChi2Cut << " // maximal chi2 in Kalman fit" << endl;
  87. cout << "# Cluster cuts: " << endl ;
  88. cout << "mCluEmin " << mCluEmin << " // (GeV) minimal cluster energy" << endl;
  89. cout << "mCluMult " << mCluMult << " // minimal number of cells in cluster" << endl;
  90. cout << "mCluTof " << mCluTof << " // (s) maximal time wrt photon arrival" << endl;
  91. cout << "mCluDisp " << mCluDisp << " // disp cut" << endl;
  92. cout << "mCluDispEmin " << mCluDispEmin << " // Emin for disp cut" << endl;
  93. cout << "mCluCPV " << mCluCPV << " // (sigma) minimal distance to charged track extrapolation" << endl;
  94. cout << "------------------------------------------" << endl ;
  95. }
  96. void MpdPhotonAnalysisParams::read(std::string name, bool &b){
  97. auto search = mMap.find(name);
  98. if (search != mMap.end()) {
  99. if(search->second.compare("true")==0 || search->second.compare("TRUE")==0){
  100. b=true ;
  101. }
  102. else{
  103. b= false ;
  104. }
  105. }
  106. }
  107. void MpdPhotonAnalysisParams::read(std::string name, int &b){
  108. auto search = mMap.find(name);
  109. if (search != mMap.end()) {
  110. b= atoi(search->second.data()) ;
  111. }
  112. }
  113. void MpdPhotonAnalysisParams::read(std::string name, float &b){
  114. auto search = mMap.find(name);
  115. if (search != mMap.end()) {
  116. b= atof(search->second.data()) ;
  117. }
  118. }
  119. void MpdPhotonAnalysisParams::read(std::string name, std::string &b){
  120. auto search = mMap.find(name);
  121. if (search != mMap.end()) {
  122. b= search->second ;
  123. }
  124. }