MpdFemtoBasicTrackCut.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. /**
  2. * \class MpdFemtoBasicTrackCut
  3. * \brief The basic track cut
  4. *
  5. * Cuts on particle identification, transverse momentum, rapidity, distance
  6. * of closest approach to primary vertex and charge. Charge defaults to 1 (positive)
  7. *
  8. * \author Grigory Nigmatkulov (NRNU MEPhI)
  9. * \date May 18, 2019
  10. * \email nigmatkulov@gmail.com
  11. */
  12. #ifndef MpdFemtoBasicTrackCut_h
  13. #define MpdFemtoBasicTrackCut_h
  14. // MpdFemtoMaker headers
  15. // Base
  16. #include "MpdFemtoBaseParticleCut.h"
  17. #include "MpdFemtoBaseTrackCut.h"
  18. // ROOT headers
  19. #include "TLorentzVector.h"
  20. // C++ headers
  21. #include <limits>
  22. //_________________
  23. class MpdFemtoBasicTrackCut : public MpdFemtoBaseTrackCut {
  24. public:
  25. /// Default constructor
  26. MpdFemtoBasicTrackCut();
  27. /// Copy constructor
  28. MpdFemtoBasicTrackCut(const MpdFemtoBasicTrackCut& copy);
  29. /// Assignment operator
  30. MpdFemtoBasicTrackCut& operator=(const MpdFemtoBasicTrackCut& copy);
  31. /// Destructor
  32. virtual ~MpdFemtoBasicTrackCut();
  33. /// Test the particle and return true if it meets all criteria. false otherwise.
  34. virtual bool pass(const MpdFemtoTrack* tr);
  35. /// Prepare report
  36. virtual MpdFemtoString report();
  37. /// Prepare list of settings
  38. virtual TList *listSettings();
  39. /// Enumeration of PID
  40. enum HbtPID {
  41. Electron = 1, Pion, Kaon, Proton
  42. };
  43. /// Select track type
  44. /// \param false(0) global
  45. /// \param true(1) primary
  46. void selectPrimary(const bool& type) {
  47. setType(type);
  48. }
  49. /// Set track type to select
  50. /// \param 0 global
  51. /// \param 1 primary
  52. void setType(const bool& type) {
  53. mType = type;
  54. }
  55. /// Set charge of the track to select
  56. void setCharge(const short& charge);
  57. /// Set min and max range of nhits
  58. void setNHits(const short& lo, const short& hi);
  59. /// Set min and max range of nHitsFit/nHitsPossible
  60. void setNHitsFitOverNHitsPoss(const float& lo) {
  61. mNHitsRat = lo;
  62. }
  63. /// Set min and max range of nHitsFit/nHitsPossible
  64. void setAntiSplit(const float& lo) {
  65. setNHitsFitOverNHitsPoss(lo);
  66. }
  67. /// Set min and max ranges of transverse momentum
  68. void setPt(const float& lo, const float& hi) {
  69. mPt[0] = lo;
  70. mPt[1] = hi;
  71. }
  72. /// Set min and max ranges of total momentum
  73. void setP(const float& lo, const float& hi) {
  74. mP[0] = lo;
  75. mP[1] = hi;
  76. }
  77. /// Set min and max ranges of transverse momentum
  78. void setTranverseMomentum(const float& lo, const float& hi) {
  79. setPt(lo, hi);
  80. }
  81. /// Set min and max ranges of rapidity
  82. void setRapidity(const float& lo, const float& hi) {
  83. mRapidity[0] = lo;
  84. mRapidity[1] = hi;
  85. }
  86. /// Set min and max ranges of pseudorapidity
  87. void setEta(const float& lo, const float& hi) {
  88. mEta[0] = lo;
  89. mEta[1] = hi;
  90. }
  91. /// Set min and max ranges of pseudorapidity
  92. void setPseudoRapidity(const float& lo, const float& hi) {
  93. setEta(lo, hi);
  94. }
  95. /// Set min and max range of DCA
  96. void setDCA(const float& lo, const float& hi) {
  97. mDCA[0] = lo;
  98. mDCA[1] = hi;
  99. }
  100. /// Set type of detector selection:
  101. /// \param 0 TPC
  102. /// \param 1 TOF
  103. /// \param 2 TPC+TOF
  104. /// \param 3 if(TOF){TPC+TOF} else{TPC}
  105. /// \param 4 if(TOF&&p>pthresh){TPC+TOF} else if (p<pthresh){TPC}
  106. void setDetectorSelection(const int& selection) {
  107. if (selection < 0 || selection > 4) {
  108. std::cout << "[WARNING] MpdFemtoBasicTrackCut: wrong detector selection: " << selection
  109. << " reset to TPC (0)" << std::endl;
  110. mDetSelection = 0;
  111. } else {
  112. mDetSelection = (unsigned char) selection;
  113. }
  114. }
  115. /// Set min and max range of electron nSigma to select
  116. void setNSigmaElectron(const float& lo, const float& hi) {
  117. mNSigmaElectron[0] = lo;
  118. mNSigmaElectron[1] = hi;
  119. }
  120. /// Set min and max range of pion nSigma to select
  121. void setNSigmaPion(const float& lo, const float& hi) {
  122. mNSigmaPion[0] = lo;
  123. mNSigmaPion[1] = hi;
  124. }
  125. /// Set min and max range of kaon nSigma to select
  126. void setNSigmaKaon(const float& lo, const float& hi) {
  127. mNSigmaKaon[0] = lo;
  128. mNSigmaKaon[1] = hi;
  129. }
  130. /// Set min and max range of proton nSigma to select
  131. void setNSigmaProton(const float& lo, const float& hi) {
  132. mNSigmaProton[0] = lo;
  133. mNSigmaProton[1] = hi;
  134. }
  135. /// Set low and hight values for the exclusion cut
  136. void setNSigmaOther(const float& lo, const float& hi) {
  137. mNSigmaOther[0] = lo;
  138. mNSigmaOther[1] = hi;
  139. }
  140. /// Set min and max momentum of the track for TPC identification
  141. void setTpcP(const float& lo, const float& hi) {
  142. mTpcMom[0] = lo;
  143. mTpcMom[1] = hi;
  144. }
  145. /// Set min and max momentum of the track for TPC identification
  146. void setTpcMomentum(const float& lo, const float& hi) {
  147. setTpcP(lo, hi);
  148. }
  149. /// Set min and max momentum of the track for TPC identification
  150. void setTpcMom(const float& lo, const float& hi) {
  151. setTpcP(lo, hi);
  152. }
  153. /// Set min and max mass square estimated using TOF
  154. void setMassSqr(const float& lo, const float& hi) {
  155. mTofMassSqr[0] = lo;
  156. mTofMassSqr[1] = hi;
  157. }
  158. /// Set min and max momentum for TOF or TPC+TOF identification
  159. void setTofP(const float& lo, const float& hi) {
  160. mTofMom[0] = lo;
  161. mTofMom[1] = hi;
  162. }
  163. /// Set min and max momentum for TOF or TPC+TOF identification
  164. void setTofMomentum(const float& lo, const float& hi) {
  165. setTofP(lo, hi);
  166. }
  167. /// Set min and max momentum for TOF or TPC+TOF identification
  168. void setTofMom(const float& lo, const float& hi) {
  169. setTofP(lo, hi);
  170. }
  171. /// Set min and max values of electron nSigma for TPC+TOF identification
  172. void setTnTNSigmaElectron(const float& lo, const float& hi) {
  173. mTnTNSigmaElectron[0] = lo;
  174. mTnTNSigmaElectron[1] = hi;
  175. }
  176. /// Set min and max values of pion nSigma for TPC+TOF identification
  177. void setTnTNSigmaPion(const float& lo, const float& hi) {
  178. mTnTNSigmaPion[0] = lo;
  179. mTnTNSigmaPion[1] = hi;
  180. }
  181. /// Set min and max values of kaon nSigma for TPC+TOF identification
  182. void setTnTNSigmaKaon(const float& lo, const float& hi) {
  183. mTnTNSigmaKaon[0] = lo;
  184. mTnTNSigmaKaon[1] = hi;
  185. }
  186. /// Set min and max values of proton nSigma for TPC+TOF identification
  187. void setTnTNSigmaProton(const float& lo, const float& hi) {
  188. mTnTNSigmaProton[0] = lo;
  189. mTnTNSigmaProton[1] = hi;
  190. }
  191. /// Set PID to select: 1-electron, 2-pion, 3-kaon, 4-proton
  192. void setHbtPid(const HbtPID& pid) {
  193. mPidSelection = pid;
  194. }
  195. /// Is theoretical work
  196. void setIsTheory(const bool& isTheory) {
  197. mIsTheory = isTheory;
  198. }
  199. /// Set PDD ID to select (will be checked if IsTheory set to true)
  200. void setPdgId(const int& pdgId) {
  201. mPdgId = pdgId;
  202. }
  203. /// Set min and max 1/beta-1/beta_expected values
  204. void setInvBetaDiff(const float& lo, const float& hi) {
  205. mInvBetaDiff[0] = lo;
  206. mInvBetaDiff[1] = hi;
  207. }
  208. /// Set threshold for detector selection =4
  209. void setPthresh(const float& mom) {
  210. mPthresh = mom;
  211. }
  212. /// Set verbose mode
  213. /// \param true print information for each track
  214. /// \param false do not print (default)
  215. void setVerboseMode(const bool& isVerbose) {
  216. mVerbose = isVerbose;
  217. }
  218. protected:
  219. /// Track type: 0 - global, 1 - primary
  220. bool mType;
  221. /// Charge of the track - if 0 the charge is not checked
  222. char mCharge;
  223. /// Bounds for number of hits
  224. unsigned char mNHits[2];
  225. /// nHitsFit/nHitsPossible
  226. float mNHitsRat;
  227. /// Bounds for transverse momentum
  228. float mPt[2];
  229. /// Bounds for full momentum
  230. float mP[2];
  231. /// Bounds for rapidity
  232. float mRapidity[2];
  233. /// Bounds for pseudorapidity
  234. float mEta[2];
  235. /// Bounds for DCA to primary vertex
  236. float mDCA[2];
  237. /// Type of detector selection:
  238. /// \param 0 TPC
  239. /// \param 1 TOF
  240. /// \param 2 TPC+TOF
  241. /// \param 3 if(TOF){TPC+TOF} else{TPC}
  242. /// \param 4 if(TOF&&p>pthresh){TPC+TOF} else if (p<pthresh){TPC}
  243. unsigned char mDetSelection;
  244. // TPC identification
  245. /// Bounds for nsigma dEdx from electron band
  246. float mNSigmaElectron[2];
  247. /// Bounds for nsigma dEdx from pion band
  248. float mNSigmaPion[2];
  249. /// Bounds for nsigma dEdx from kaon band
  250. float mNSigmaKaon[2];
  251. /// Bounds for nsigma dEdx from proton band
  252. float mNSigmaProton[2];
  253. /// Bounds for exclusion cuts
  254. float mNSigmaOther[2];
  255. /// Momentum of the track for pure TPC identification
  256. float mTpcMom[2];
  257. // TOF identification
  258. /// TOF mass square
  259. float mTofMassSqr[2];
  260. /// Momentum of the track for the pure TOF identification
  261. float mTofMom[2];
  262. // TPC && TOF identification
  263. /// Bounds for nsigma dEdx from pion band
  264. float mTnTNSigmaElectron[2];
  265. /// Bounds for nsigma dEdx from pion band
  266. float mTnTNSigmaPion[2];
  267. /// Bounds for nsigma dEdx from kaon band
  268. float mTnTNSigmaKaon[2];
  269. /// Bounds for nsigma dEdx from proton band
  270. float mTnTNSigmaProton[2];
  271. /// PID selection
  272. /// \param 1 electron
  273. /// \param 2 pion
  274. /// \param 3 kaon
  275. /// \param 4 proton
  276. HbtPID mPidSelection;
  277. /// Passed tracks counter
  278. unsigned int mNTracksPassed;
  279. /// Falied tracks counter
  280. unsigned int mNTracksFailed;
  281. /// If work with theory
  282. bool mIsTheory;
  283. /// PDG pid
  284. int mPdgId;
  285. /// Bounds for 1/beta-1/beta(expected)
  286. float mInvBetaDiff[2];
  287. /// Momentum threshold for (detector) selection type == 4
  288. float mPthresh;
  289. /// Print information for each pair (default is false)
  290. bool mVerbose;
  291. //
  292. // Functions for PID
  293. //
  294. /// Is good clean TPC identification
  295. bool isGoodCleanTpcPid(const MpdFemtoTrack *t, TLorentzVector mom);
  296. /// Is good clean electron identification in TPC
  297. bool isTpcCleanElectron(const MpdFemtoTrack *t, TLorentzVector mom);
  298. /// Is good clean pion identification in TPC
  299. bool isTpcCleanPion(const MpdFemtoTrack *t, TLorentzVector mom);
  300. /// Is good clean kaon identification in TPC
  301. bool isTpcCleanKaon(const MpdFemtoTrack *t, TLorentzVector mom);
  302. /// Is good clean proton identification in TPC
  303. bool isTpcCleanProton(const MpdFemtoTrack *t, TLorentzVector mom);
  304. /// Is good particle identification by TOF
  305. bool isGoodTofPid(const MpdFemtoTrack *t);
  306. /// Is TPC electron by nSigma(electron) only (uses TnT sigma cut values)
  307. bool isTpcElectron(const MpdFemtoTrack *t);
  308. /// Is TPC electron by nSigma(pion) only (uses TnT sigma cut values)
  309. bool isTpcPion(const MpdFemtoTrack *t);
  310. /// Is TPC electron by nSigma(kaon) only (uses TnT sigma cut values)
  311. bool isTpcKaon(const MpdFemtoTrack *t);
  312. /// Is TPC electron by nSigma(proton) only (uses TnT sigma cut values)
  313. bool isTpcProton(const MpdFemtoTrack *t);
  314. /// Check that passes TOF and TPC identification (TnT = TPC && TOF)
  315. bool isGoodTnT(const MpdFemtoTrack *t);
  316. /// Check that passes TPC+TOF identification in case of TOF signal,
  317. /// and clean TPC in the other case
  318. bool isGoodToT(const MpdFemtoTrack *t, TLorentzVector vec);
  319. /// Check that passes TPC+TOF identification in case of TOF signal and
  320. /// momentum greater or equal to threshold, and clean TPC in the other case
  321. bool isGoodToTThresh(const MpdFemtoTrack *t, TLorentzVector vec);
  322. /// Check kinematics
  323. bool isGoodKine(const MpdFemtoTrack *t, TLorentzVector vec);
  324. ClassDef(MpdFemtoBasicTrackCut, 2)
  325. };
  326. #endif // MpdFemtoBasicTrackCut_h