#include "TMHistogrammingTEMPLATE.h"
#include "AliITSRawStreamSPD.h"
#include <TStyle.h>
#include <TPad.h>
#include <TH1F.h>

//_____________________________________________________________________
TMHistogrammingTEMPLATE::TMHistogrammingTEMPLATE() :
  TMHistogramming()
{
  // example with a histogram:
  fTheHisto = new TH1F("ThisIsTheNameOfMyHisto", "ThisIsTheTitleOfMyHisto", 20, -0.5, 19.5);  // example with one bin per eq
  fTheHisto->SetMinimum(0);
  fTheHisto->SetStats(0);
  fTheHisto->SetFillColor(kBlue);
  fTheHisto->GetXaxis()->SetTitle("X axis (eq id)");
  fTheHisto->GetYaxis()->SetTitle("Y axis");
  fTheHisto->SetTitleOffset(1.2,"X");
  fTheHisto->SetTitleOffset(1.6,"Y");
}
//_____________________________________________________________________
TMHistogrammingTEMPLATE::~TMHistogrammingTEMPLATE() {
  // example with one histogram:
  delete fTheHisto;
}
//_____________________________________________________________________
void TMHistogrammingTEMPLATE::StartEvent(eventHeaderStruct *event, UInt_t globalEventNumber) {
  TMHistogramming::StartEvent(event,globalEventNumber);
  if (fEventAccept) {
    // Add code here if you want to use this method 
    // (otherwise remove this method completely)
  }
}
//_____________________________________________________________________
void TMHistogrammingTEMPLATE::ProcessPixel(UInt_t eq, UInt_t hs, UInt_t chip, UInt_t col, UInt_t row) {
  if (fEventAccept) {
    // Add code here if you want to use this method 
    // (otherwise remove this method completely)

    // example where the histogram is filled once for each pixel hit:
    fTheHisto->Fill(eq);
  }
}
//_____________________________________________________________________
void TMHistogrammingTEMPLATE::ProcessClusters(HenrikClusterFinderSPD* clFinder) {
  if (fEventAccept) {
    // Add code here if you want to use this method 
    // (otherwise remove this method completely)
  }
}
//_____________________________________________________________________
void TMHistogrammingTEMPLATE::ProcessCluster(Float_t x, Float_t y, Float_t z, UInt_t module, UInt_t size, UInt_t widz, UInt_t widphi, UInt_t type) {
  if (fEventAccept) {
    // Add code here if you want to use this method 
    // (otherwise remove this method completely)
  }
}
//_____________________________________________________________________
void TMHistogrammingTEMPLATE::ProcessEvent(eventHeaderStruct *event) {
  if (fEventAccept) {
    // Add code here if you want to use this method 
    // (otherwise remove this method completely)
  }
}
//_____________________________________________________________________
void TMHistogrammingTEMPLATE::EndEvent(AliITSRawStreamSPD *str, UInt_t globalEventNumber) {
  if (fEventAccept) {
    // Add code here if you want to use this method 
    // (otherwise remove this method completely)
  }
  TMHistogramming::EndEvent(str, globalEventNumber);
}
//_____________________________________________________________________
void TMHistogrammingTEMPLATE::Draw(TPad *pad) {
  // example with one histogram:
  pad->cd();
  pad->SetLeftMargin(0.15);
  pad->SetRightMargin(0.15);
  pad->SetBorderSize(0);
  pad->SetBorderMode(0);

  fTheHisto->Draw();
}
//_____________________________________________________________________
void TMHistogrammingTEMPLATE::Reset() {
  // example with one histogram:
  fTheHisto->Reset();
  TMHistogramming::Reset();
}
