#include "AliRsnDaughter.h"
#include "AliRsnEvent.h"
#include "AliRsnPairDef.h"
-#include "AliRsnPairParticle.h"
-#include "AliRsnFunctionAxis.h"
+#include "AliRsnMother.h"
+#include "AliRsnValue.h"
#include "AliRsnFunction.h"
//________________________________________________________________________________________
AliRsnFunction::AliRsnFunction(Bool_t useTH1) :
- TNamed(),
+ TObject(),
fPairDef(0x0),
- fAxisList("AliRsnFunctionAxis", 0),
- fTrack(0x0),
+ fAxisList("AliRsnValue", 0),
fPair(0x0),
fEvent(0x0),
fUseTH1(useTH1),
//________________________________________________________________________________________
AliRsnFunction::AliRsnFunction(const AliRsnFunction ©) :
- TNamed(copy),
+ TObject(copy),
fPairDef(copy.fPairDef),
fAxisList(copy.fAxisList),
- fTrack(copy.fTrack),
fPair(copy.fPair),
fEvent(copy.fEvent),
fUseTH1(copy.fUseTH1),
// Assignment operator.
//
- SetName(copy.GetName());
- SetTitle(copy.GetTitle());
+ //SetName(copy.GetName());
+ //SetTitle(copy.GetTitle());
fPairDef = copy.fPairDef;
- fTrack = copy.fTrack;
fPair = copy.fPair;
fEvent = copy.fEvent;
fUseTH1 = copy.fUseTH1;
TString name("");
TObjArrayIter next(&fAxisList);
- AliRsnFunctionAxis *axis = 0;
+ AliRsnValue *axis = 0;
- while ((axis = (AliRsnFunctionAxis*)next())) {
+ while ((axis = (AliRsnValue*)next())) {
if (name.Length() > 1) name += '_';
name += axis->GetName();
}
}
//________________________________________________________________________________________
-void AliRsnFunction::AddAxis(AliRsnFunctionAxis *const axis)
+void AliRsnFunction::AddAxis(AliRsnValue *const axis)
{
+ AliDebug(AliLog::kDebug+2,"<-");
Int_t size = fAxisList.GetEntries();
- if (size >= 3 && fUseTH1)
+ new(fAxisList[size]) AliRsnValue(*axis);
+ AliDebug(AliLog::kDebug+2,"->");
+
+ if (fAxisList.GetEntries() > 3)
{
AliWarning("A TH1-type output cannot add more than 3 axes: switching to THnSparse -- THIS COULD CAUSE VERY LARGE FILES!!!");
fUseTH1 = kFALSE;
}
- new(fAxisList[size]) AliRsnFunctionAxis(*axis);
}
//________________________________________________________________________________________
// even if the bins are equal, since they are defined in this class.
// Eventually present histoDef's in other slots of array (1, 2) are ignored.
//
-// This version produces a THnSparseD.
+// This version produces a THnSparseF.
//
fSize = fAxisList.GetEntries();
Double_t *max = new Double_t[fSize];
// retrieve binnings for main and secondary axes
- AliRsnFunctionAxis *fcnAxis = 0;
+ AliRsnValue *fcnAxis = 0;
for (Int_t i = 0; i < fSize; i++) {
- fcnAxis = (AliRsnFunctionAxis*)fAxisList.At(i);
+ fcnAxis = (AliRsnValue*)fAxisList.At(i);
if (!fcnAxis) {
nbins[i] = 0;
min[i] = 0.0;
switch (fSize)
{
case 1:
- fH1 = new TH1D(histoName, histoTitle, nbins[0], min[0], max[0]);
+ fH1 = new TH1F(histoName, histoTitle, nbins[0], min[0], max[0]);
break;
case 2:
- fH1 = new TH2D(histoName, histoTitle, nbins[0], min[0], max[0], nbins[1], min[1], max[1]);
+ fH1 = new TH2F(histoName, histoTitle, nbins[0], min[0], max[0], nbins[1], min[1], max[1]);
break;
case 3:
- fH1 = new TH3D(histoName, histoTitle, nbins[0], min[0], max[0], nbins[1], min[1], max[1], nbins[2], min[2], max[2]);
+ fH1 = new TH3F(histoName, histoTitle, nbins[0], min[0], max[0], nbins[1], min[1], max[1], nbins[2], min[2], max[2]);
break;
}
fH1->Sumw2();
}
//________________________________________________________________________________________
-THnSparseD* AliRsnFunction::CreateHistogramSparse(const char *histoName, const char *histoTitle)
+THnSparseF* AliRsnFunction::CreateHistogramSparse(const char *histoName, const char *histoTitle)
{
//
// Creates and returns the histogram defined using
// even if the bins are equal, since they are defined in this class.
// Eventually present histoDef's in other slots of array (1, 2) are ignored.
//
-// This version produces a THnSparseD.
+// This version produces a THnSparseF.
//
fSize = fAxisList.GetEntries();
Double_t *max = new Double_t[fSize];
// retrieve binnings for main and secondary axes
- AliRsnFunctionAxis *fcnAxis = 0;
+ AliRsnValue *fcnAxis = 0;
for (Int_t i = 0; i < fSize; i++) {
- fcnAxis = (AliRsnFunctionAxis*)fAxisList.At(i);
+ fcnAxis = (AliRsnValue*)fAxisList.At(i);
if (!fcnAxis) {
nbins[i] = 0;
min[i] = 0.0;
}
// create histogram
- fHSparse = new THnSparseD(histoName, histoTitle, size, nbins, min, max);
+ fHSparse = new THnSparseF(histoName, histoTitle, size, nbins, min, max);
fHSparse->Sumw2();
// clean heap
Int_t i;
Double_t *values = new Double_t[fSize];
- AliRsnFunctionAxis *fcnAxis = 0;
+ AliRsnValue *fcnAxis = 0;
for (i = 0; i < fSize; i++) {
- fcnAxis = (AliRsnFunctionAxis*)fAxisList.At(i);
+ fcnAxis = (AliRsnValue*)fAxisList.At(i);
if (!fcnAxis) {
values[i] = 0.0;
continue;
}
- switch (fcnAxis->GetAxisObject()) {
- case AliRsnFunctionAxis::kParticle:
- values[i] = fcnAxis->Eval(fTrack);
- break;
- case AliRsnFunctionAxis::kPair:
- values[i] = fcnAxis->Eval(fPair, fPairDef);
- break;
- case AliRsnFunctionAxis::kEvent:
- values[i] = fcnAxis->Eval(fEvent);
- break;
- default:
- values[i] = 0.0;
- }
+ if (fcnAxis->Eval(fPair, fPairDef, fEvent)) values[i] = fcnAxis->GetValue();
}
// fill histogram
{
case 1:
{
- TH1D *h1 = (TH1D*)fH1;
+ TH1F *h1 = (TH1F*)fH1;
h1->Fill(values[0]);
}
break;
case 2:
{
- TH2D *h2 = (TH2D*)fH1;
+ TH2F *h2 = (TH2F*)fH1;
h2->Fill(values[0], values[1]);
}
break;
case 3:
{
- TH3D *h3 = (TH3D*)fH1;
+ TH3F *h3 = (TH3F*)fH1;
h3->Fill(values[0], values[1], values[2]);
}
break;
{
// check presence of output histogram
if (!fHSparse) {
- AliError("Required a THnSparseD whish is not initialized");
+ AliError("Required a THnSparseF which is not initialized");
return kFALSE;
}