3 //**************************************************************************
4 //* This file is property of and copyright by the ALICE Project *
5 //* ALICE Experiment at CERN, All rights reserved. *
7 //* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
8 //* Sedat Altinpinar <Sedat.Altinpinar@cern.ch> *
9 //* Hege Erdal <hege.erdal@gmail.com> *
11 //* Permission to use, copy, modify and distribute this software and its *
12 //* documentation strictly for non-commercial purposes is hereby granted *
13 //* without fee, provided that the above copyright notice appears in all *
14 //* copies and that both the copyright notice and this permission notice *
15 //* appear in the supporting documentation. The authors make no claims *
16 //* about the suitability of this software for any purpose. It is *
17 //* provided "as is" without express or implied warranty. *
18 //**************************************************************************
20 /// @file AliAnalysisTaskDxHFECorrelation.cxx
21 /// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
23 /// @brief AnalysisTask D0 - HFE correlation
26 #include "AliAnalysisTaskDxHFECorrelation.h"
27 #include "AliDxHFECorrelation.h"
28 #include "AliDxHFEParticleSelectionD0.h"
29 #include "AliDxHFEParticleSelectionEl.h"
30 #include "AliAnalysisManager.h"
32 #include "AliESDInputHandler.h"
38 /// ROOT macro for the implementation of ROOT specific class methods
39 ClassImp(AliAnalysisTaskDxHFECorrelation)
41 AliAnalysisTaskDxHFECorrelation::AliAnalysisTaskDxHFECorrelation(const char* opt)
42 : AliAnalysisTaskSE("AliAnalysisTaskDxHFECorrelation")
56 int AliAnalysisTaskDxHFECorrelation::DefineSlots()
58 // define the data slots
59 DefineInput(0, TChain::Class());
60 DefineOutput(1, TList::Class());
64 AliAnalysisTaskDxHFECorrelation::~AliAnalysisTaskDxHFECorrelation()
70 // histograms are in the output list and deleted when the output
71 // list is deleted by the TSelector dtor
73 if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
77 if (fD0s) delete fD0s;
79 if (fElectrons) delete fElectrons;
81 if (fCorrelation) delete fCorrelation;
85 void AliAnalysisTaskDxHFECorrelation::UserCreateOutputObjects()
87 // create result objects and add to output list
89 std::auto_ptr<TList> Output(new TList);
90 std::auto_ptr<AliDxHFEParticleSelection> D0s(new AliDxHFEParticleSelectionD0);
91 std::auto_ptr<AliDxHFEParticleSelection> Electrons(new AliDxHFEParticleSelectionEl);
92 std::auto_ptr<AliDxHFECorrelation> Correlation(new AliDxHFECorrelation);
98 AliFatal("allocation of worker classes failed");
102 fOutput = Output .release();
103 fD0s = D0s .release();
104 fElectrons = Electrons .release();
105 fCorrelation = Correlation.release();
109 // all tasks must post data once for all outputs
110 PostData(1, fOutput);
113 void AliAnalysisTaskDxHFECorrelation::UserExec(Option_t* /*option*/)
117 // TODO: implement correct input, this is likely not to be the
119 TObject* pInput=InputEvent();
121 AliError("failed to get input");
124 AliVEvent *pEvent = dynamic_cast<AliVEvent*>(pInput);
126 AliError(Form("input of wrong class type %s, expecting AliVEvent", pInput->ClassName()));
130 std::auto_ptr<TObjArray> pSelectedD0s(fD0s->Select(pEvent));
131 std::auto_ptr<TObjArray> pSelectedElectrons(fElectrons->Select(pEvent));
132 int iResult=fCorrelation->Fill(pSelectedD0s.get(), pSelectedElectrons.get());
134 AliError(Form("%s processing failed with error %d", fCorrelation->GetName(), iResult));
137 PostData(1, fOutput);
140 void AliAnalysisTaskDxHFECorrelation::FinishTaskOutput()
142 // end of the processing
145 void AliAnalysisTaskDxHFECorrelation::Terminate(Option_t *)
147 // last action on the client
148 fOutput = dynamic_cast<TList*> (GetOutputData(1));
150 AliFatal("failed to get output container");