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

//_____________________________________________________________________
TMHistogrammingClusterWidthZvsPhiOuter::TMHistogrammingClusterWidthZvsPhiOuter() :
  TMHistogramming()
{

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

}
//_____________________________________________________________________
TMHistogrammingClusterWidthZvsPhiOuter::~TMHistogrammingClusterWidthZvsPhiOuter() {
  delete fHistOuter;
}
//_____________________________________________________________________
void TMHistogrammingClusterWidthZvsPhiOuter::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);
      fHistOuter->Fill(phi, widz);
    }
  }
}
//_____________________________________________________________________
void TMHistogrammingClusterWidthZvsPhiOuter::Draw(TPad *pad) {
  pad->cd();
  pad->SetLeftMargin(0.15);
  pad->SetRightMargin(0.15);
  pad->SetBorderSize(0);
  pad->SetBorderMode(0);

  fHistOuter->Draw("colz");
}
//_____________________________________________________________________
void TMHistogrammingClusterWidthZvsPhiOuter::Reset() {
  fHistOuter->Reset();

  TMHistogramming::Reset();
}
