Float_t binLimitsPt[] = {0.0, 0.05, 0.1, 0.125, 0.15, 0.175, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375, 0.4, 0.425, 0.45, 0.475, 0.5, 0.6, 0.7, 0.8, 0.9, 1.0, 1.5, 2.0, 5.0, 10.0, 100.0};
Float_t binLimitsN[] = {-0.5, 0.5, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 12.5, 14.5, 16.5, 18.5, 20.5, 25.5, 30.5, 40.5, 50.5, 100.5, 300.5};
//Float_t binLimitsVtx[] = {-20,-15,-10,-6,-3,0,3,6,10,15,20};
- Float_t binLimitsVtx[] = {-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
+ //Float_t binLimitsVtx[] = {-20,-19,-18,-17,-16,-15,-14,-13,-12,-11,-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};
+ Float_t binLimitsVtx[] = {-20,-15,-10,-8,-6,-4,-2,0,2,4,6,8,10,15,20};
- fEventCorr = new AliCorrectionMatrix2D("EventCorrection", Form("%s EventCorrection", title), 40, binLimitsVtx, 22, binLimitsN);
- fTrackCorr = new AliCorrectionMatrix3D("TrackCorrection", Form("%s TrackCorrection", title), 40, -20, 20, 20, -2, 2, 28, binLimitsPt);
+ fEventCorr = new AliCorrectionMatrix2D("EventCorrection", Form("%s EventCorrection", title), 14, binLimitsVtx, 22, binLimitsN);
+ fTrackCorr = new AliCorrectionMatrix3D("TrackCorrection", Form("%s TrackCorrection", title), 14, binLimitsVtx, 40, -2, 2, 28, binLimitsPt);
fEventCorr->SetAxisTitles("vtx z [cm]", "Ntracks");
fTrackCorr->SetAxisTitles("vtx z [cm]", "#eta", "p_{T} [GeV/c]");
AliCorrectionMatrix2D();
AliCorrectionMatrix2D(const AliCorrectionMatrix2D& c);
AliCorrectionMatrix2D(const Char_t* name, const Char_t* title,
- Int_t nBinX=10, Float_t Xmin=0., Float_t Xmax=10.,
- Int_t nBinY=10, Float_t Ymin=0., Float_t Ymax=10.);
+ Int_t nBinX, Float_t Xmin, Float_t Xmax,
+ Int_t nBinY, Float_t Ymin, Float_t Ymax);
AliCorrectionMatrix2D(const Char_t* name, const Char_t* title,
- Int_t nBinX, Float_t *X, Int_t nBinY, Float_t *Y);
+ Int_t nBinX, Float_t *X,
+ Int_t nBinY, Float_t *Y);
virtual ~AliCorrectionMatrix2D();
// constructor
//
- // do not add this hists to the directory
- Bool_t oldStatus = TH1::AddDirectoryStatus();
- TH1::AddDirectory(kFALSE);
+ Float_t* binLimitsX = new Float_t[nBinX+1];
+ for (Int_t i=0; i<=nBinX; ++i)
+ binLimitsX[i] = Xmin + (Xmax - Xmin) / nBinX * i;
- fhMeas = new TH3F("measured", Form("%s measured",title), nBinX, Xmin, Xmax, nBinY, Ymin, Ymax, nBinZ, Zmin, Zmax);
- fhGene = new TH3F("generated", Form("%s generated",title), nBinX, Xmin, Xmax, nBinY, Ymin, Ymax, nBinZ, Zmin, Zmax);
- fhCorr = new TH3F("correction", Form("%s correction",title), nBinX, Xmin, Xmax, nBinY, Ymin, Ymax, nBinZ, Zmin, Zmax);
+ Float_t* binLimitsY = new Float_t[nBinY+1];
+ for (Int_t i=0; i<=nBinY; ++i)
+ binLimitsY[i] = Ymin + (Ymax - Ymin) / nBinY * i;
- TH1::AddDirectory(oldStatus);
+ Float_t* binLimitsZ = new Float_t[nBinZ+1];
+ for (Int_t i=0; i<=nBinZ; ++i)
+ binLimitsZ[i] = Zmin + (Zmax - Zmin) / nBinZ * i;
- fhMeas->Sumw2();
- fhGene->Sumw2();
- fhCorr->Sumw2();
+ CreateHists(nBinX, binLimitsX, nBinY, binLimitsY, nBinZ, binLimitsZ);
+
+ delete[] binLimitsX;
+ delete[] binLimitsY;
+ delete[] binLimitsZ;
}
AliCorrectionMatrix3D::AliCorrectionMatrix3D(const Char_t* name, const Char_t* title,
for (Int_t i=0; i<=nBinY; ++i)
binLimitsY[i] = Ymin + (Ymax - Ymin) / nBinY * i;
- // do not add this hists to the directory
- Bool_t oldStatus = TH1::AddDirectoryStatus();
- TH1::AddDirectory(kFALSE);
+ CreateHists(nBinX, binLimitsX, nBinY, binLimitsY, nBinZ, zbins);
- fhMeas = new TH3F("measured", Form("%s measured",title), nBinX, binLimitsX, nBinY, binLimitsY, nBinZ, zbins);
- fhGene = new TH3F("generated", Form("%s generated",title), nBinX, binLimitsX, nBinY, binLimitsY, nBinZ, zbins);
- fhCorr = new TH3F("correction", Form("%s correction",title), nBinX, binLimitsX, nBinY, binLimitsY, nBinZ, zbins);
+ delete[] binLimitsX;
+ delete[] binLimitsY;
+}
- TH1::AddDirectory(oldStatus);
+AliCorrectionMatrix3D::AliCorrectionMatrix3D(const Char_t* name, const Char_t* title,
+ Int_t nBinX, const Float_t* xbins,
+ Int_t nBinY, Float_t Ymin, Float_t Ymax,
+ Int_t nBinZ, const Float_t* zbins)
+ : AliCorrectionMatrix(name, title)
+{
+ // constructor with variable bin sizes
+
+ Float_t* binLimitsY = new Float_t[nBinY+1];
+ for (Int_t i=0; i<=nBinY; ++i)
+ binLimitsY[i] = Ymin + (Ymax - Ymin) / nBinY * i;
+
+ CreateHists(nBinX, xbins, nBinY, binLimitsY, nBinZ, zbins);
- delete[] binLimitsX;
delete[] binLimitsY;
+}
+
+//____________________________________________________________________
+void AliCorrectionMatrix3D::CreateHists(Int_t nBinX, const Float_t* binLimitsX,
+ Int_t nBinY, const Float_t* binLimitsY,
+ Int_t nBinZ, const Float_t* binLimitsZ)
+{
+ // create the histograms
+
+ // do not add this hists to the directory
+ Bool_t oldStatus = TH1::AddDirectoryStatus();
+ TH1::AddDirectory(kFALSE);
+
+ fhMeas = new TH3F("measured", Form("%s measured",GetTitle()), nBinX, binLimitsX, nBinY, binLimitsY, nBinZ, binLimitsZ);
+ fhGene = new TH3F("generated", Form("%s generated",GetTitle()), nBinX, binLimitsX, nBinY, binLimitsY, nBinZ, binLimitsZ);
+ fhCorr = new TH3F("correction", Form("%s correction",GetTitle()), nBinX, binLimitsX, nBinY, binLimitsY, nBinZ, binLimitsZ);
fhMeas->Sumw2();
fhGene->Sumw2();
fhCorr->Sumw2();
+
+ TH1::AddDirectory(oldStatus);
}
+
//____________________________________________________________________
AliCorrectionMatrix3D::~AliCorrectionMatrix3D()
{
AliCorrectionMatrix3D();
AliCorrectionMatrix3D(const AliCorrectionMatrix3D& c);
AliCorrectionMatrix3D(const Char_t* name, const Char_t* title,
- Int_t nBinX=10, Float_t Xmin=0., Float_t Xmax=10.,
- Int_t nBinY=10, Float_t Ymin=0., Float_t Ymax=10.,
- Int_t nBinZ=10, Float_t Zmin=0., Float_t Zmax=10.);
+ Int_t nBinX, Float_t Xmin, Float_t Xmax,
+ Int_t nBinY, Float_t Ymin, Float_t Ymax,
+ Int_t nBinZ, Float_t Zmin, Float_t Zmax);
AliCorrectionMatrix3D(const Char_t* name, const Char_t* title,
Int_t nBinX, Float_t Xmin, Float_t Xmax,
Int_t nBinY, Float_t Ymin, Float_t Ymax,
Int_t nBinZ, const Float_t* zbins);
+ AliCorrectionMatrix3D(const Char_t* name, const Char_t* title,
+ Int_t nBinX, const Float_t* xbins,
+ Int_t nBinY, Float_t Ymin, Float_t Ymax,
+ Int_t nBinZ, const Float_t* zbins);
+
+ AliCorrectionMatrix3D(const Char_t* name, const Char_t* title,
+ Int_t nBinX, const Float_t* xbins,
+ Int_t nBinY, const Float_t* ybins,
+ Int_t nBinZ, const Float_t* zbins);
+
+ void CreateHists(Int_t nBinX, const Float_t* binLimitsX,
+ Int_t nBinY, const Float_t* binLimitsY,
+ Int_t nBinZ, const Float_t* binLimitsZ);
+
virtual ~AliCorrectionMatrix3D();
AliCorrectionMatrix3D& operator= (const AliCorrectionMatrix3D& c);