#include "TMHistogrammingClustersPerEqInner.h"
#include "TMControlSPD.h"
#include "AliITSRawStreamSPD.h"
#include <TStyle.h>
#include <TPad.h>
#include <TH1F.h>

//_____________________________________________________________________
TMHistogrammingClustersPerEqInner::TMHistogrammingClustersPerEqInner() :
  TMHistogramming()
{
  fHist = new TH1F("ClustersPerEqInner","Clusters Per Eq Inner",20,-0.5,19.5);
  fHist->SetMinimum(0);
  fHist->SetStats(0);
  fHist->SetFillColor(kYellow);
  fHist->GetXaxis()->SetTitle("Eq");
  fHist->GetYaxis()->SetTitle("Number of Clusters");
  fHist->SetTitleOffset(1.2,"X");
  fHist->SetTitleOffset(1.6,"Y");
}
//_____________________________________________________________________
TMHistogrammingClustersPerEqInner::~TMHistogrammingClustersPerEqInner() {
  delete fHist;
}
//_____________________________________________________________________
void TMHistogrammingClustersPerEqInner::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) {
    if (module<80) {
      UInt_t eq = AliITSRawStreamSPD::GetOnlineEqIdFromOffline(module);
      fHist->Fill(eq);
    }
  }
}
//_____________________________________________________________________
void TMHistogrammingClustersPerEqInner::Draw(TPad *pad) {
  pad->cd();
  pad->SetLeftMargin(0.15);
  pad->SetRightMargin(0.15);
  pad->SetBorderSize(0);
  pad->SetBorderMode(0);

  fHist->Draw();
}
//_____________________________________________________________________
void TMHistogrammingClustersPerEqInner::Reset() {
  fHist->Reset();

  TMHistogramming::Reset();
}
