#ifndef STO97DSTQAMAKER_HH
#define STO97DSTQAMAKER_HH


#include <iostream>
#include "StMaker.h"
#include "StChain.h"
#include "TChain.h"
#include "TSystem.h"
#include "TH1.h"
#include "TH2.h"
#include "StO97Event.h"
#include <string>
#include <stdlib.h>
#include "TParticlePDG.h"
#include "TDatabasePDG.h"


//_________________
class StO97DstQAMaker : public StMaker {
 public:
  StO97DstQAMaker(const char *dirName,
		  const char *fileName,
		  const char *filter = ".",
		  int        maxFiles = 1e5);
  int GetNEvents();
  
  Int_t Init();
  Int_t Make();
  Int_t Finish();
  void SetOutFileName(const char *oFileName) { mOutFileName = oFileName; }

 private:
  string mDir;
  string mFileName;
  string mFilter;

  TDatabasePDG *pdgDb;
  unsigned int mEventId;
  unsigned int mNEvents;
  TFile        *mOutFile;
  TChain       *mChain;
  TTree        *mTree;
  StO97Event   *mO97Event;
  const char   *mOutFileName;
  int          mMaxFiles;

  //
  // Event histograms
  //
  TH1F *hRefMultP90;
  TH1F *hRefMultP100;
  TH1F *hRefMultP120;
  TH1F *hRefMultP150;
  TH1F *hImpPar;
  TH2F *hImpParVsRefMNik;
  TH2F *hImpParVsRefMGreg;
  TH1F *hImp;

  //
  // Track histograms
  //
  TH2F *hMSqrVsPt;
  TH1F *hVx;
  TH1F *hVy;
  TH1F *hVz;
  TH1F *hP;
  TH1F *hPt;
  TH1F *hPx;
  TH1F *hPy;
  TH1F *hPz;
  TH1F *hEta;
  TH1F *hEtaInt;
  
  int InitRead(string dir, string fileName,
	       string filter, int maxFiles);
  int FillChain(TChain *chain, const char *fileName, 
		int maxFiles);
  int FillChain(TChain *chain, char *dir,
		const char *filter, int maxFiles);
  void UninitRead();
  
  ClassDef(StO97DstQAMaker, 1)
};

#endif
