/*
 * Look at the opposite hemi-sphere.
 * Rotate one particle of the pair as follow (px,py,pz,e)->(-px,-py,-pz,e)
 * 2015/03/18 gnigmat
 */
#ifndef QinvCorrFctnOpposHemisphere_hh
#define QinvCorrFctnOpposHemisphere_hh

#include "StHbtMaker/Base/StHbtCorrFctn.hh"
#include "StHbtMaker/Base/StHbtPairCut.h"
#include <TRandom3.h>
#include <TLorentzVector.h>
#include <time.h>


class QinvCorrFctnOpposHemisphere : public StHbtCorrFctn {
 public:
  QinvCorrFctnOpposHemisphere(char *title, int nbins = 50,
			      float QinvLo=0.,float QinvHi=1.,
                              float mass = 0.0, StHbtPairCut *paircut = 0);
  virtual ~QinvCorrFctnOpposHemisphere();

  virtual StHbtString Report();
  virtual void AddRealPair(const StHbtPair*);
  virtual void AddMixedPair(const StHbtPair*);
  void SetSpecificPairCut(StHbtPairCut *paircut);
  void SetMass(float mass);
  void EventBegin(const StHbtEvent *event);

  virtual void Finish();

  StHbt1DHisto* Numerator();
  StHbt1DHisto* Denominator();
  StHbt1DHisto* Ratio();

 private:
  StHbt1DHisto* mNumerator;
  StHbt1DHisto* mDenominator;
  StHbt1DHisto* mRatio;

  float mMass;
  double mMagField;

  TRandom3 *mRandy;
  TLorentzVector mTrack1;
  TLorentzVector mTrack2;
  TLorentzVector mDiffVect;

#ifdef __ROOT__
  ClassDef(QinvCorrFctnOpposHemisphere, 2)
#endif
};

inline StHbt1DHisto* QinvCorrFctnOpposHemisphere::Numerator(){return mNumerator;}
inline StHbt1DHisto* QinvCorrFctnOpposHemisphere::Denominator(){return mDenominator;}
inline StHbt1DHisto* QinvCorrFctnOpposHemisphere::Ratio(){return mRatio;}
inline void          QinvCorrFctnOpposHemisphere::SetSpecificPairCut(StHbtPairCut *paircut) { mPairCut = paircut; }
inline void          QinvCorrFctnOpposHemisphere::SetMass(float mass) { mMass = mass; }
inline void          QinvCorrFctnOpposHemisphere::EventBegin(const StHbtEvent *event) { mMagField = event->MagneticField(); }

#endif //QinvCorrFctnOpposHemisphere_hh
