/***

      StPicoDstQA
  VERSION: 1.0
  AUTHOR: Nikita Ermakov
  E-MAIL: coffe92@gmail.com

***/

#ifndef STPICODSTQA

#include "StPicoDst.h"
#include "StPicoDstMaker.h"
#include <stdio.h>
#include "TH2F.h"
#include "TH1F.h"
#include "TProfile.h"
#include "StPicoDstMakerRun11/StPicoEvent.h"
#include "StPicoDstMakerRun11/StPicoTrack.h"
#include "StPicoDstMakerRun11/StPicoBTofPidTraits.h"
#include "StPhysicalHelixD.hh"



const float PION_MASS   = 0.139569; // GeV/c^2
const float PROTON_MASS = 0.938272; // GeV/c^2
const float KAON_MASS   = 0.4936;   // GeV/c^2



class StPicoDst;
class StPicoEvent;
class StPicoTrack;



class StPicoDstQA : public StMaker
{
 public:
  StPicoDstQA(StPicoDstMaker *picoMaker, const char *outFilePath);
  ~StPicoDstQA();

  void SetRunIdParameters(unsigned int nbins, double lo, double hi) { mRunIdBins=nbins; mRunIdVal[0]=lo; mRunIdVal[1]=hi; }
  void SetTriggers(unsigned int trigWord) { mTrigWord = trigWord; }
  //
  // Chain methods
  //
  void  Clear(Option_t *option = "");
  Int_t Init();
  Int_t Make();
  Int_t Finish();
 private:
  const char     *mOutFilePath;
  TFile          *mOutFile;
  TChain         *mChain;
  TTree          *mTree;
  StPicoDstMaker *mPicoMaker;

  unsigned int nEvents;
  unsigned int nEventsProc;
  unsigned int mTrigWord;
  unsigned int mRunIdBins;
  double mRunIdVal[2];

  //
  // Event histograms
  //
  TH1D *hRefMult;
  TH1D *hRefMult2;
  TH1D *hRefMultForward;
  TH1D *hTofMult;
  TH2D *hTofVsRef;
  TH2D *hTofVsRef2;
  TH2D *hRefVsRef2;
  TH1D *hNGlobal;
  TH1D *hNTracks;
  TH1D *hNTracksDiff;
  TH1D *hR;
  TH1D *hVz;
  TH2D *hVxVy;
  TH1D *hVpdVzDiff;

  //
  // Here is the way of how to look on the quantities over the run
  //
  TProfile *hRefMultVsRunNumer;
  TProfile *hPrimTrackNumVsRunNumber;
  TProfile *hGlobTrackNumVsRunNumber;
  TProfile *hTofMultVsRunNumber;

  //
  // Track histograms
  //
  TH2D *hNSigmaPionVsMom;
  TH2D *hNSigmaKaonVsMom;
  TH2D *hNSigmaProtonVsMom;
  TH2D *hNSigmaElectronVsMom;

  TH1D *hP;
  TH1D *hGlobP;
  TH2D *hDedxVsPt;
  TH2D *hMSqrVsPt;
  TH2D *hInvBetaVsP;
  TH2D *hBetaVsP;
  TH1D *hEta;
  TH1D *hPhi;
  TH2D *hEtaVsPhi;
  TH1D *hDca;
  TH1D *hDcaXY;
  TH1D *hDcaZ;
  TH1D *hDcaHelix;

  ClassDef(StPicoDstQA, 1)
};

#endif
