#ifndef STFEMTODSTPYTHIA6MAKER_HH
#define STFEMTODSTPYTHIA6MAKER_HH

#include "StMaker.h"

#include "TFile.h"
#include "TTree.h"
#include "TPythia6.h"
#include "TMCParticle.h"
#include "TRandom3.h"

#include "StFemtoEvent.h"
#include "StFemtoTrack.h"

#include <iostream>

#ifndef St_NO_NAMESPACES
using namespace std;
#endif

//Predefinisions
class StFemtoEvent;
class StFemtoTrack;

//_________________
class StFemtoDstPythia6Maker : public StMaker {

 public:
  StFemtoDstPythia6Maker(TPythia6 *pythiaDst,
			 const Char_t *oFileName);
  ~StFemtoDstPythia6Maker();

  //StMaker requirement
  void Clear(Option_t *option = "");
  Int_t Init();
  Int_t Make();
  Int_t Finish();

  void CleanVariables();

  //Event
  void SetTriggerId(const UInt_t& id)      { mTriggerId = id;}
  void SetIsFullField(const Bool_t& field) { mIsFullField = field;}

  //Track
  void SetParticleMomentum(const Float_t& lo, const Float_t& hi) { mTrackMomentum[0]=lo; mTrackMomentum[1]=hi; }
  void SetTrackDca(const Float_t& lo, const Float_t& hi)  { mTrackDca[0]=lo; mTrackDca[1]=hi; }
  void SetTrackDcaGlobal(const Float_t& lo, const Float_t& hi) { mTrackDcaGlobal[0]=lo; mTrackDcaGlobal[1]=hi; }
  void SetTrackEta(const Float_t& lo, const Float_t& hi)  { mTrackEta[0]=lo; mTrackEta[1]=hi; }

  //Exclusion cuts
  void SetRemovePions(Bool_t &remove)    { mRemovePions = remove; }
  void SetRemoveKaons(Bool_t &remove)    { mRemoveKaons = remove; }
  void SetRemoveProtons(Bool_t &remove)  { mRemoveProtons = remove; }

 private:

  const Char_t *mOutFileName;
  TFile *mOutFile;
  TTree *mTree;
  Int_t mCompression;
  TPythia6*    mPythiaDst;  //Pointer to the pythia
  TRandom3 *randy;

  Int_t  mNBytes;
  Int_t  mNEventsIn;
  Bool_t mEventIsGood;
  Bool_t mIsGoodTrack;

  //Event information
  UInt_t mTriggerId;
  Bool_t mIsFullField;

  //Single-particle cuts
  Float_t  mTrackMomentum[2];
  Float_t  mTrackDca[2];
  Float_t  mTrackDcaGlobal[2];
  Float_t  mTrackEta[2];

  //Cuts for exclusion
  Bool_t   mRemovePions;
  Bool_t   mRemoveKaons;
  Bool_t   mRemoveProtons;

  //Femto event structure
  StFemtoEvent *mFemtoEvent;

 //Main cut
  Bool_t AcceptTrack(TMCParticle *trk, Int_t charge);

  //dEdx calculation
  Double_t dedxMean(Double_t mass, Double_t momentum);

  ClassDef(StFemtoDstPythia6Maker, 2)
};

#endif
