]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added constructors
authorjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Dec 2006 17:47:21 +0000 (17:47 +0000)
committerjgrosseo <jgrosseo@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 5 Dec 2006 17:47:21 +0000 (17:47 +0000)
PWG0/AliCorrection.cxx
PWG0/AliCorrectionMatrix2D.h
PWG0/AliCorrectionMatrix3D.cxx
PWG0/AliCorrectionMatrix3D.h

index d19eca3e28e99cc658a4381574a3791b7512c4e5..f7c2605c464543230c41326a37053705d73feede 100644 (file)
@@ -38,10 +38,11 @@ AliCorrection::AliCorrection(const Char_t* name, const Char_t* title) : TNamed(n
   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]");
index 5fb445d91c3b5d4cf9b9c2af9598fa19585f155e..6ffbace52c6bc68bf85ea4ddf6fc73a4041aa72b 100644 (file)
@@ -20,11 +20,12 @@ public:
   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();
 
index a34f1a266d9a8e10085bf2db16623fae99b30075..56ee055ad1d736aed231286a691532be0c95c728 100644 (file)
@@ -55,19 +55,23 @@ AliCorrectionMatrix3D::AliCorrectionMatrix3D(const Char_t* name, const Char_t* t
   // 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,
@@ -86,24 +90,52 @@ AliCorrectionMatrix3D::AliCorrectionMatrix3D(const Char_t* name, const Char_t* t
   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()
 {
index 16fb80a52665514feaa3bb725cdee3060ca9444a..c8a1a5c1e1d9cfda18f278855faa66b7f6a8aa7a 100644 (file)
@@ -20,15 +20,29 @@ public:
   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);