// name Name of task
}
-//____________________________________________________________________
-AliMCTruthdNdetaTask::AliMCTruthdNdetaTask(const AliMCTruthdNdetaTask& o)
- : AliBasedNdetaTask(o),
- fHasData(o.fHasData)
-{
- //
- // Copy constructor
- //
-}
//____________________________________________________________________
AliBasedNdetaTask::CentralityBin*
//____________________________________________________________________
TH2D*
-AliMCTruthdNdetaTask::GetHistogram(const AliAODEvent* aod, Bool_t mc)
+AliMCTruthdNdetaTask::GetHistogram(const AliAODEvent& aod, Bool_t mc)
{
//
// Retrieve the histogram
//
if (!fHasData) return 0;
if (mc) return 0;
- TObject* obj = aod->FindListObject("primary");
- // We should have a forward object at least
- if (!obj) {
+
+ TH2D* ret = GetPrimary(aod);
+ if (!ret) {
fHasData = false;
return 0;
}
- TH2D* ret = static_cast<TH2D*>(obj);
Int_t nY = ret->GetNbinsY();
// Need to fill under-/overflow bin with 1's
for (Int_t i = 1; i <= ret->GetNbinsX(); i++) {
}
//________________________________________________________________________
-void
-AliMCTruthdNdetaTask::Terminate(Option_t *option)
+Bool_t
+AliMCTruthdNdetaTask::Finalize()
{
//
// Called at end of event processing..
// option Not used
if (!fHasData) {
AliInfo("The MC truth dN/deta task didn't get any data");
- return;
+ return false;
}
- AliBasedNdetaTask::Terminate(option);
+ AliBasedNdetaTask::Finalize();
THStack* truth = new THStack("dndetaTruth", "dN/d#eta MC Truth");
THStack* truthRebin = new THStack(Form("dndetaTruth_rebin%02d", fRebin),
TIter next(fListOfCentralities);
CentralityBin* bin = 0;
while ((bin = static_cast<CentralityBin*>(next()))) {
- if (fCentAxis && bin->IsAllBin()) continue;
+ if (HasCentrality() && bin->IsAllBin()) continue;
TList* results = bin->GetResults();
if (!results) continue;
delete truth;
truth = 0;
}
- if (truth) fOutput->Add(truth);
+ if (truth) fResults->Add(truth);
// If available output rebinned stack
if (!truthRebin->GetHists() ||
delete truthRebin;
truthRebin = 0;
}
- if (truthRebin) fOutput->Add(truthRebin);
+ if (truthRebin) fResults->Add(truthRebin);
+ return true;
}
//========================================================================
Int_t n = (triggerMask == AliAODForwardMult::kNSD ?
Int_t(fTriggers->GetBinContent(AliAODForwardMult::kBinMCNSD)) :
Int_t(fTriggers->GetBinContent(AliAODForwardMult::kBinAll)));
- AliInfo(Form("Normalising MC truth to %d (%d additions)", n, n0));
+ DMSG(fDebug,0,"Normalising MC truth to %d (%d additions)", n, n0);
TH1D* dndetaTruth = fSumTruth->ProjectionX("dndetaTruth",1,
fSumTruth->GetNbinsY(),"e");
fOutput->Add(dndetaTruth);
fOutput->Add(Rebin(dndetaTruth, rebin, cutEdges));
}
- TH1* dndeta = GetResult(0, false, "");
- TH1* dndetaSym = GetResult(0, true, "");
- TH1* dndeta_rebin = GetResult(rebin, false, "");
- TH1* dndetaSym_rebin = GetResult(rebin, true, "");
+ TH1* dndeta = GetResult(0, false, "");
+ TH1* dndetaSym = symmetrice ? GetResult(0, true, "") : 0;
+ TH1* dndeta_rebin = rebin ? GetResult(rebin, false, "") : 0;
+ TH1* dndetaSym_rebin = symmetrice && rebin ? GetResult(rebin, true, "") : 0;
if (dndeta)
dndeta->SetTitle("Monte-Carlo truth (selected)");
if (dndetaSym)