3 // ------------------------------------------------------
5 // Class to handle 3d-corrections.
7 // ------------------------------------------------------
14 #include "AliCorrectionMatrix3D.h"
16 //____________________________________________________________________
17 ClassImp(AliCorrectionMatrix3D)
19 //____________________________________________________________________
20 AliCorrectionMatrix3D::AliCorrectionMatrix3D() :
23 // default constructor
26 //____________________________________________________________________
27 AliCorrectionMatrix3D::AliCorrectionMatrix3D(const AliCorrectionMatrix3D& c)
28 : AliCorrectionMatrix(c)
31 ((AliCorrectionMatrix3D &)c).Copy(*this);
34 //____________________________________________________________________
35 AliCorrectionMatrix3D::AliCorrectionMatrix3D(const Char_t* name, const Char_t* title,
36 Int_t nBinX, Float_t Xmin, Float_t Xmax,
37 Int_t nBinY, Float_t Ymin, Float_t Ymax,
38 Int_t nBinZ, Float_t Zmin, Float_t Zmax)
39 : AliCorrectionMatrix(name, title)
45 fhMeas = new TH3F(Form("meas_%s",name), Form("meas_%s",title), nBinX, Xmin, Xmax, nBinY, Ymin, Ymax, nBinZ, Zmin, Zmax);
46 fhGene = new TH3F(Form("gene_%s",name), Form("gene_%s",title), nBinX, Xmin, Xmax, nBinY, Ymin, Ymax, nBinZ, Zmin, Zmax);
47 fhCorr = new TH3F(Form("corr_%s",name), Form("corr_%s",title), nBinX, Xmin, Xmax, nBinY, Ymin, Ymax, nBinZ, Zmin, Zmax);
54 //____________________________________________________________________
55 AliCorrectionMatrix3D::~AliCorrectionMatrix3D()
61 // histograms already deleted in base class
64 //____________________________________________________________________
65 TH3F* AliCorrectionMatrix3D::GetGeneratedHistogram()
67 // return generated histogram casted to correct type
68 return dynamic_cast<TH3F*> (fhGene);
71 //____________________________________________________________________
72 TH3F* AliCorrectionMatrix3D::GetMeasuredHistogram()
74 // return measured histogram casted to correct type
75 return dynamic_cast<TH3F*> (fhMeas);
78 //____________________________________________________________________
79 TH3F* AliCorrectionMatrix3D::GetCorrectionHistogram()
81 // return correction histogram casted to correct type
82 return dynamic_cast<TH3F*> (fhCorr);
85 //____________________________________________________________________
86 void AliCorrectionMatrix3D::FillMeas(Float_t ax, Float_t ay, Float_t az)
88 // add value to measured histogram
89 GetMeasuredHistogram()->Fill(ax, ay, az);
92 //____________________________________________________________________
93 void AliCorrectionMatrix3D::FillGene(Float_t ax, Float_t ay, Float_t az)
95 // add value to generated histogram
96 GetGeneratedHistogram()->Fill(ax, ay, az);
99 //____________________________________________________________________
100 Float_t AliCorrectionMatrix3D::GetCorrection(Float_t ax, Float_t ay, Float_t az) const
102 // returns a value of the correction map
103 return fhCorr->GetBinContent(fhCorr->FindBin(ax, ay, az));
106 //____________________________________________________________________
107 //void AliCorrectionMatrix3D::RemoveEdges(Float_t cut, Int_t nBinsXedge, Int_t nBinsYedge, Int_t nBinsZedge)
108 void AliCorrectionMatrix3D::RemoveEdges(Float_t, Int_t, Int_t, Int_t)
110 // so what do we do here...
113 //____________________________________________________________________
114 void AliCorrectionMatrix3D::SaveHistograms()
117 // saves the histograms
120 AliCorrectionMatrix::SaveHistograms();
122 WriteProjections(GetMeasuredHistogram());
123 WriteProjections(GetGeneratedHistogram());
125 if (GetCorrectionHistogram())
126 WriteProjections(GetCorrectionHistogram());
129 //____________________________________________________________________
130 void AliCorrectionMatrix3D::WriteProjections(TH3F* hist)
132 // write some projections to disk
134 TH1* proj = hist->Project3D("yx");
135 proj->SetXTitle(hist->GetXaxis()->GetTitle());
136 proj->SetYTitle(hist->GetYaxis()->GetTitle());
138 proj = hist->Project3D("zx");
139 proj->SetXTitle(hist->GetXaxis()->GetTitle());
140 proj->SetYTitle(hist->GetZaxis()->GetTitle());
142 proj = hist->Project3D("zy");
143 proj->SetXTitle(hist->GetYaxis()->GetTitle());
144 proj->SetYTitle(hist->GetZaxis()->GetTitle());