#include "TMHistogrammingClusterWidthZvsPhiInner.h"
#include "HenrikClusterFinderSPD.h"
#include <TPad.h>
#include <TH2F.h>
#include <TMath.h>

//_____________________________________________________________________
TMHistogrammingClusterWidthZvsPhiInner::TMHistogrammingClusterWidthZvsPhiInner() :
  TMHistogramming()
{

  fHistInner = new TH2F("ClusterWidthZvsPhiInner","Cluster Width Z vs Phi Inner layer",
			200,-3.15,3.15,160,0.5,160+0.5);
  fHistInner->SetXTitle("Phi [rad]");
  fHistInner->SetYTitle("Cluster Width Z [N Pixels]");
  fHistInner->SetTitleOffset(1.6,"Y");
  fHistInner->SetStats(0);

}
//_____________________________________________________________________
TMHistogrammingClusterWidthZvsPhiInner::~TMHistogrammingClusterWidthZvsPhiInner() {
  delete fHistInner;
}
//_____________________________________________________________________
void TMHistogrammingClusterWidthZvsPhiInner::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) {
      Float_t phi = atan2(y,x);
      fHistInner->Fill(phi, widz);
    }
  }
}
//_____________________________________________________________________
void TMHistogrammingClusterWidthZvsPhiInner::Draw(TPad *pad) {
  pad->cd();
  pad->SetLeftMargin(0.15);
  pad->SetRightMargin(0.15);
  pad->SetBorderSize(0);
  pad->SetBorderMode(0);

  fHistInner->Draw("colz");
}
//_____________________________________________________________________
void TMHistogrammingClusterWidthZvsPhiInner::Reset() {
  fHistInner->Reset();

  TMHistogramming::Reset();
}
