#ifndef gregsSimpleTrackCut_h
#define gregsSimpleTrackCut_h

#include "StHbtMaker/Base/StHbtTrackCut.h"

//_________________
class gregsSimpleTrackCut : public StHbtTrackCut {

 public:
  //Constructors and destructors
  gregsSimpleTrackCut();
  gregsSimpleTrackCut(const gregsSimpleTrackCut &copy);
  gregsSimpleTrackCut *Clone();
  ~gregsSimpleTrackCut();

  virtual bool Pass(const StHbtTrack *trk);
  virtual StHbtString Report();

  //Set TPC identification parameters
  void SetNSigmaElectron(const float& lo, const float& hi);
  void SetNSigmaPion(const float& lo, const float& hi);
  void SetNSigmaKaon(const float& lo, const float& hi);
  void SetNSigmaProton(const float& lo, const float& hi);
  void SetTpcMomentum(const float& lo, const float& hi);

  //Set TOF identification parameters
  void SetTofMassSqr(const float& lo, const float& hi);
  void SetTofMomentum(const float &lo, const float &hi);

  //Set TOF && TPC identification parameters
  void SetTnTMomentum(const float &lo, const float &hi);
  void SetTnTNSigmaElectron(const float &lo, const float &hi);
  void SetTnTNSigmaPion(const float &lo, const float &hi);
  void SetTnTNSigmaKaon(const float &lo, const float &hi);
  void SetTnTNSigmaProton(const float &lo, const float &hi);

  //Set TOF&&TPC (P>Pthresh) and TPC (P<Pthresh)
  void SetTTTMomentumThresh(const float &thresh);

  //Track parameters
  void SetNHits(const int& lo, const int& hi);
  void SetNHitsFit(const int& lo, const int& hi);
  void SetNdEdxHits(const int& lo, const int& hi);
  void SetFlag(const short &lo, const short& hi);
  void SetP(const float& lo, const float& hi);
  void SetPt(const float& lo, const float& hi);
  void SetPx(const float& lo, const float& hi);
  void SetPy(const float& lo, const float& hi);
  void SetPz(const float& lo, const float& hi);
  void SetRapidity(const float& lo, const float& hi);   //rapidity
  void SetEta(const float& lo, const float& hi);        //pseudorapidity
  void SetDCA(const float& lo, const float& hi);
  void SetDCAGlobal(const float& lo, const float& hi);
  void SetCharge(const int&);
  void SetType(const short&);                           //0-global, 1-primary
  void SetAntiSplit(const float& lo);

  //Detector selection
  void SetDetectorSelection(const short &type) {mDetSelection=type;} // 0-TPC, 1-ToF, 2-TPC+ToF, 3-ToF||TPC, 4-TPC&&TOF(P>Pthr)||TPC(P<Pthr)

 protected:

  short             mType;               // 0-global, 1-primary
  int               mCharge;
  int               mNHits[2];
  short             mFlag[2];
  int               mNHitsFit[2];
  int               mNdEdxHits[2];
  float             mP[2];
  float             mPt[2];
  float             mPx[2];
  float             mPy[2];
  float             mPz[2];
  float             mRapidity[2];
  float             mEta[2];
  float             mDCA[2];
  float             mDCAGlobal[2];
  float             mAntiSplit;         // nHitsFit/nHitsPossible

  //TPC identification
  float             mTpcMomentum[2];
  float             mNSigmaElectron[2];
  float             mNSigmaPion[2];
  float             mNSigmaKaon[2];
  float             mNSigmaProton[2];

  //TOF identification
  float            mTofMomentum[2];
  float            mTofMassSqr[2];

  //TPC&&TOF
  float            mTnTMomentum[2];
  float            mTnTNSigmaElectron[2];
  float            mTnTNSigmaPion[2];
  float            mTnTNSigmaKaon[2];
  float            mTnTNSigmaProton[2];

  //TPC&&TOF (P>Pthresh) || TPC (P<Pthresh)
  float           mTTTMomentumThresh;

  short             mDetSelection;       // 0-TPC, 1-ToF, 2-TPC+ToF, 3-ToF||TPC, 4-TPC&&TOF(P>Pthr)||TPC(P<Pthr)

  //Counters
  long              mNTracksPassed;
  long              mNTracksFailed;

#ifdef __ROOT__
  ClassDef(gregsSimpleTrackCut, 1)
#endif

};

//TPC identification
inline void gregsSimpleTrackCut::SetNSigmaElectron(const float& lo, const float& hi) {
  mNSigmaElectron[0]=lo; mNSigmaElectron[1]=hi;
}
inline void gregsSimpleTrackCut::SetNSigmaPion(const float& lo, const float& hi) {
  mNSigmaPion[0]=lo; mNSigmaPion[1]=hi;
}
inline void gregsSimpleTrackCut::SetNSigmaKaon(const float& lo, const float& hi) {
  mNSigmaKaon[0]=lo; mNSigmaKaon[1]=hi;
}
inline void gregsSimpleTrackCut::SetNSigmaProton(const float& lo, const float& hi) {
  mNSigmaProton[0]=lo; mNSigmaProton[1]=hi;
}
inline void gregsSimpleTrackCut::SetTpcMomentum(const float& lo, const float& hi) {
  mTpcMomentum[0]=lo; mTpcMomentum[1]=hi;
}

//TOF identification
inline void gregsSimpleTrackCut::SetTofMassSqr(const float& lo, const float& hi) {
  mTofMassSqr[0]=lo; mTofMassSqr[1]=hi;
}
inline void gregsSimpleTrackCut::SetTofMomentum(const float& lo, const float& hi) {
  mTofMomentum[0]=lo; mTofMomentum[1]=hi;
}

//TPC&&TOF identification
inline void gregsSimpleTrackCut::SetTnTMomentum(const float& lo, const float& hi) {
  mTnTMomentum[0]=lo; mTnTMomentum[1]=hi;
}
inline void gregsSimpleTrackCut::SetTnTNSigmaElectron(const float& lo, const float& hi) {
  mTnTNSigmaElectron[0]=lo; mTnTNSigmaElectron[1]=hi;
}
inline void gregsSimpleTrackCut::SetTnTNSigmaPion(const float& lo, const float& hi) {
  mTnTNSigmaPion[0]=lo, mTnTNSigmaPion[1]=hi;
}
inline void gregsSimpleTrackCut::SetTnTNSigmaKaon(const float& lo, const float& hi) {
  mTnTNSigmaKaon[0]=lo; mTnTNSigmaKaon[1]=hi;
}
inline void gregsSimpleTrackCut::SetTnTNSigmaProton(const float& lo, const float& hi) {
  mTnTNSigmaProton[0]=lo; mTnTNSigmaProton[1]=hi;
}

//TPC&&TOF (P>Pthresh) || TPC (P<Pthresh)
inline void gregsSimpleTrackCut::SetTTTMomentumThresh(const float& val) {
  mTTTMomentumThresh = val;
}

//General track parameters
inline void gregsSimpleTrackCut::SetNHits(const int& lo, const int& hi) {
  mNHits[0]=lo; mNHits[1]=hi;
}
inline void gregsSimpleTrackCut::SetNHitsFit(const int& lo, const int& hi) {
  mNHitsFit[0]=lo; mNHitsFit[1]=hi;
}
inline void gregsSimpleTrackCut::SetNdEdxHits(const int& lo, const int& hi) {
  mNdEdxHits[0]=lo; mNdEdxHits[1]=hi;
}
inline void gregsSimpleTrackCut::SetP(const float& lo, const float& hi) {mP[0]=lo; mP[1]=hi;}
inline void gregsSimpleTrackCut::SetPt(const float& lo, const float& hi) {mPt[0]=lo; mPt[1]=hi;}
inline void gregsSimpleTrackCut::SetPx(const float& lo, const float& hi) {mPx[0]=lo; mPx[1]=hi;}
inline void gregsSimpleTrackCut::SetPy(const float& lo, const float& hi) {mPy[0]=lo; mPy[1]=hi;}
inline void gregsSimpleTrackCut::SetPz(const float& lo, const float& hi) {mPz[0]=lo; mPz[1]=hi;}
inline void gregsSimpleTrackCut::SetRapidity(const float& lo,const float& hi) {
  mRapidity[0]=lo; mRapidity[1]=hi;
}
inline void gregsSimpleTrackCut::SetEta(const float& lo,const float& hi) {mEta[0]=lo; mEta[1]=hi;}
inline void gregsSimpleTrackCut::SetDCA(const float& lo,const float& hi) {mDCA[0]=lo; mDCA[1]=hi;}
inline void gregsSimpleTrackCut::SetDCAGlobal(const float& lo,const float& hi) {
  mDCAGlobal[0]=lo; mDCAGlobal[1]=hi;
}
inline void gregsSimpleTrackCut::SetCharge(const int& ch) {mCharge = ch;}
inline void gregsSimpleTrackCut::SetType(const short& type) {mType = type;}
inline void gregsSimpleTrackCut::SetAntiSplit(const float& lo) {mAntiSplit = lo;}
inline void gregsSimpleTrackCut::SetFlag(const short &lo, const short &hi) {
  mFlag[0] = lo; mFlag[1]=hi;
}
inline gregsSimpleTrackCut *gregsSimpleTrackCut::Clone() {
  gregsSimpleTrackCut *c = new gregsSimpleTrackCut(*this); return c;
}

#endif
