--- /dev/null
+#-*- Mode: Makefile -*-
+# $Id$
+#--------------------------------------------------------------------------------#
+# Package File for libPWGHFcorrelation #
+# Variables Defined : #
+# #
+# SRCS - C++ source files #
+# HDRS - C++ header files #
+# DHDR - ROOT Dictionary Linkdef header file #
+# CSRCS - C source files #
+# CHDRS - C header files #
+# EINCLUDE - Include directories #
+# EDEFINE - Compiler definitions #
+# ELIBS - Extra libraries to link #
+# ELIBSDIR - Extra library directories #
+# PACKFFLAGS - Fortran compiler flags for package #
+# PACKCXXFLAGS - C++ compiler flags for package #
+# PACKCFLAGS - C compiler flags for package #
+# PACKSOFLAGS - Shared library linking flags #
+# PACKLDFLAGS - Module linker flags #
+# PACKBLIBS - Libraries to link (Executables only) #
+# EXPORT - Header files to be exported #
+# CINTHDRS - Dictionary header files #
+# CINTAUTOLINK - Set automatic dictionary generation #
+# ARLIBS - Archive Libraries and objects for linking (Executables only) #
+# SHLIBS - Shared Libraries and objects for linking (Executables only) #
+#--------------------------------------------------------------------------------#
+
+set ( CLASS_HDRS
+ AliDxHFEParticleSelection.h
+ AliDxHFEParticleSelectionD0.h
+ AliDxHFEParticleSelectionEl.h
+ AliDxHFECorrelation.h
+ AliAnalysisTaskDxHFEParticleSelection.h
+ AliAnalysisTaskDxHFECorrelation.h
+ )
+
+string ( REPLACE ".h" ".cxx" MODULE_SRCS "${CLASS_HDRS}" )
+
+set ( MODULE_HDRS ${CLASS_HDRS})
+
+set ( MODULE_DHDR )
+
+set ( EINCLUDE PWGHF/vertexingHF PWGHF/hfe include)
+
+set ( ELIBS
+# PWGHFhfe # likely to be linked later
+# PWGHFvertexingHF # likely to be linked later
+ ANALYSIS
+ ANALYSISalice
+ )
+
+if (MODULE_SRCS)
+ALICE_Format (SRCS "correlationHF/" "" "${MODULE_SRCS}")
+endif(MODULE_SRCS)
+if (CLASS_HDRS)
+ALICE_Format (CINTHDRS "correlationHF/" "" "${CLASS_HDRS}")
+endif(CLASS_HDRS)
+if (MODULE_HDRS)
+ALICE_Format (HDRS "correlationHF/" "" "${MODULE_HDRS}")
+endif(MODULE_HDRS)
+if (MODULE_DHDR)
+ALICE_Format (DHDR "correlationHF/" "" "${MODULE_DHDR}")
+endif(MODULE_DHDR)
+
+if(NOT DHDR)
+ set(CINTAUTOLINK 1)
+endif(NOT DHDR)
--- /dev/null
+#ifdef __CINT__
+
+#pragma link off all globals;
+#pragma link off all classes;
+#pragma link off all functions;
+
+
+#pragma link C++ class AliDxHFEParticleSelection+;
+#pragma link C++ class AliDxHFEParticleSelectionEl+;
+#pragma link C++ class AliDxHFEParticleSelectionD0+;
+#pragma link C++ class AliDxHFECorrelation+;
+#pragma link C++ class AliAnalysisTaskDxHFEParticleSelection+;
+#pragma link C++ class AliAnalysisTaskDxHFECorrelation+;
+
+
+#endif
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* Sedat Altinpinar <Sedat.Altinpinar@cern.ch> *
+//* Hege Erdal <hege.erdal@gmail.com> *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
+
+/// @file AliAnalysisTaskDxHFECorrelation.cxx
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief AnalysisTask D0 - HFE correlation
+///
+
+#include "AliAnalysisTaskDxHFECorrelation.h"
+#include "AliDxHFECorrelation.h"
+#include "AliDxHFEParticleSelectionD0.h"
+#include "AliDxHFEParticleSelectionEl.h"
+#include "AliAnalysisManager.h"
+#include "AliLog.h"
+#include "AliESDInputHandler.h"
+#include "TChain.h"
+#include "TSystem.h"
+#include "TFile.h"
+#include <memory>
+
+/// ROOT macro for the implementation of ROOT specific class methods
+ClassImp(AliAnalysisTaskDxHFECorrelation)
+
+AliAnalysisTaskDxHFECorrelation::AliAnalysisTaskDxHFECorrelation(const char* opt)
+ : AliAnalysisTaskSE("AliAnalysisTaskDxHFECorrelation")
+ , fOutput(0)
+ , fOption(opt)
+ , fCorrelation(NULL)
+ , fD0s(NULL)
+ , fElectrons(NULL)
+{
+ // constructor
+ //
+ //
+
+ DefineSlots();
+}
+
+int AliAnalysisTaskDxHFECorrelation::DefineSlots()
+{
+ // define the data slots
+ DefineInput(0, TChain::Class());
+ DefineOutput(1, TList::Class());
+ return 0;
+}
+
+AliAnalysisTaskDxHFECorrelation::~AliAnalysisTaskDxHFECorrelation()
+{
+ // destructor
+ //
+ //
+
+ // histograms are in the output list and deleted when the output
+ // list is deleted by the TSelector dtor
+
+ if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
+ delete fOutput;
+ fOutput = 0;
+ }
+ if (fD0s) delete fD0s;
+ fD0s=NULL;
+ if (fElectrons) delete fElectrons;
+ fElectrons=NULL;
+ if (fCorrelation) delete fCorrelation;
+ fCorrelation=NULL;
+}
+
+void AliAnalysisTaskDxHFECorrelation::UserCreateOutputObjects()
+{
+ // create result objects and add to output list
+
+ std::auto_ptr<TList> Output(new TList);
+ std::auto_ptr<AliDxHFEParticleSelection> D0s(new AliDxHFEParticleSelectionD0);
+ std::auto_ptr<AliDxHFEParticleSelection> Electrons(new AliDxHFEParticleSelectionEl);
+ std::auto_ptr<AliDxHFECorrelation> Correlation(new AliDxHFECorrelation);
+
+ if (!Output .get() ||
+ !D0s .get() ||
+ !Electrons .get() ||
+ !Correlation.get()) {
+ AliFatal("allocation of worker classes failed");
+ return;
+ }
+
+ fOutput = Output .release();
+ fD0s = D0s .release();
+ fElectrons = Electrons .release();
+ fCorrelation = Correlation.release();
+
+ fOutput->SetOwner();
+
+ // all tasks must post data once for all outputs
+ PostData(1, fOutput);
+}
+
+void AliAnalysisTaskDxHFECorrelation::UserExec(Option_t* /*option*/)
+{
+ // process the event
+
+ // TODO: implement correct input, this is likely not to be the
+ // ESD
+ TObject* pInput=InputEvent();
+ if (!pInput) {
+ AliError("failed to get input");
+ return;
+ }
+ AliVEvent *pEvent = dynamic_cast<AliVEvent*>(pInput);
+ if(!pEvent){
+ AliError(Form("input of wrong class type %s, expecting AliVEvent", pInput->ClassName()));
+ return;
+ }
+
+ std::auto_ptr<TObjArray> pSelectedD0s(fD0s->Select(pEvent));
+ std::auto_ptr<TObjArray> pSelectedElectrons(fElectrons->Select(pEvent));
+ int iResult=fCorrelation->Fill(pSelectedD0s.get(), pSelectedElectrons.get());
+ if (iResult<0) {
+ AliError(Form("%s processing failed with error %d", fCorrelation->GetName(), iResult));
+ }
+
+ PostData(1, fOutput);
+}
+
+void AliAnalysisTaskDxHFECorrelation::FinishTaskOutput()
+{
+ // end of the processing
+}
+
+void AliAnalysisTaskDxHFECorrelation::Terminate(Option_t *)
+{
+ // last action on the client
+ fOutput = dynamic_cast<TList*> (GetOutputData(1));
+ if (!fOutput) {
+ AliFatal("failed to get output container");
+ return;
+ }
+
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/// @file AliAnalysisTaskDxHFECorrelation.h
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief AnalysisTask D0 - HFE correlation
+///
+
+#ifndef ALIANALYSISTASKDXHFECORRELATION_H
+#define ALIANALYSISTASKDXHFECORRELATION_H
+
+#include "AliAnalysisTaskSE.h"
+#include "TString.h"
+class TList;
+class AliDxHFEParticleSelection;
+class AliDxHFECorrelation;
+
+/**
+ * @class AliAnalysisTaskDxHFECorrelation
+ * Task for D0-HFE correleations
+ */
+class AliAnalysisTaskDxHFECorrelation : public AliAnalysisTaskSE {
+ public:
+ /// constructor
+ AliAnalysisTaskDxHFECorrelation(const char* opt="");
+ /// destructor
+ virtual ~AliAnalysisTaskDxHFECorrelation();
+
+ /// inherited from AliAnalysisTask: connect tree branches at input slots
+ virtual void ConnectInputData(Option_t *option="") {
+ return AliAnalysisTaskSE::ConnectInputData(option);
+ }
+
+ /// inherited from AliAnalysisTaskSE: create output objects
+ virtual void UserCreateOutputObjects();
+ /// inherited from AliAnalysisTaskSE: event processing
+ virtual void UserExec(Option_t*);
+ /// inherited from AliAnalysisTask: called in SlaveTerminate phase for each task
+ virtual void FinishTaskOutput();
+ /// inherited from AliAnalysisTask: final step
+ virtual void Terminate(Option_t*);
+
+ /// set options
+ void SetOption(const char* opt) { fOption = opt; }
+ /// overloaded from TObject: get option
+ virtual Option_t* GetOption() const { return fOption;}
+
+ protected:
+
+ private:
+ /// copy constructor prohibited: might change
+ AliAnalysisTaskDxHFECorrelation(const AliAnalysisTaskDxHFECorrelation&);
+ /// assignment operator prohibited: might change
+ AliAnalysisTaskDxHFECorrelation& operator=(const AliAnalysisTaskDxHFECorrelation&);
+
+ int DefineSlots();
+
+ TList* fOutput; //! list send on output slot 1
+ TString fOption; // option string
+ AliDxHFECorrelation* fCorrelation; // correlation worker class
+ AliDxHFEParticleSelection* fD0s; // selection of D0s
+ AliDxHFEParticleSelection* fElectrons; // selection of electrons
+
+ ClassDef(AliAnalysisTaskDxHFECorrelation, 1);
+};
+
+#endif
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* Sedat Altinpinar <Sedat.Altinpinar@cern.ch> *
+//* Hege Erdal <hege.erdal@gmail.com> *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
+
+/// @file AliAnalysisTaskDxHFEParticleSelection.cxx
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief AnalysisTask electron selection for D0 - HFE correlation
+///
+
+#include "AliAnalysisTaskDxHFEParticleSelection.h"
+#include "AliDxHFEParticleSelection.h"
+#include "AliAnalysisManager.h"
+#include "AliLog.h"
+#include "AliESDInputHandler.h"
+#include "TChain.h"
+#include "TSystem.h"
+#include "TFile.h"
+
+/// ROOT macro for the implementation of ROOT specific class methods
+ClassImp(AliAnalysisTaskDxHFEParticleSelection)
+
+AliAnalysisTaskDxHFEParticleSelection::AliAnalysisTaskDxHFEParticleSelection(const char* opt)
+ : AliAnalysisTaskSE("AliAnalysisTaskDxHFEParticleSelection")
+ , fOutput(0)
+ , fOption(opt)
+ , fSelector(NULL)
+{
+ // constructor
+ //
+ //
+
+ DefineSlots();
+}
+
+int AliAnalysisTaskDxHFEParticleSelection::DefineSlots()
+{
+ // define the data slots
+ DefineInput(0, TChain::Class());
+ DefineOutput(1, TList::Class());
+ return 0;
+}
+
+AliAnalysisTaskDxHFEParticleSelection::~AliAnalysisTaskDxHFEParticleSelection()
+{
+ // destructor
+ //
+ //
+
+ // histograms are in the output list and deleted when the output
+ // list is deleted by the TSelector dtor
+
+ if (fOutput && !AliAnalysisManager::GetAnalysisManager()->IsProofMode()) {
+ delete fOutput;
+ fOutput = 0;
+ }
+
+ if (fSelector) {
+ fSelector->Clear();
+ delete fSelector;
+ fSelector=NULL;
+ }
+}
+
+void AliAnalysisTaskDxHFEParticleSelection::UserCreateOutputObjects()
+{
+ // create result objects and add to output list
+
+ fOutput = new TList;
+ fOutput->SetOwner();
+
+ // all tasks must post data once for all outputs
+ PostData(1, fOutput);
+}
+
+void AliAnalysisTaskDxHFEParticleSelection::UserExec(Option_t* /*option*/)
+{
+ // process the event
+
+ // TODO: implement correct input, this is likely not to be the
+ // ESD
+ TObject* pInput=InputEvent();
+ if (!pInput) {
+ AliError("failed to get input");
+ return;
+ }
+ AliVEvent *pEvent = dynamic_cast<AliVEvent*>(pInput);
+ if(!pEvent){
+ AliError(Form("input of wrong class type %s, expecting AliVEvent", pInput->ClassName()));
+ return;
+ }
+
+ PostData(1, fOutput);
+}
+
+void AliAnalysisTaskDxHFEParticleSelection::FinishTaskOutput()
+{
+ // end of the processing
+}
+
+void AliAnalysisTaskDxHFEParticleSelection::Terminate(Option_t *)
+{
+ // last action on the client
+ fOutput = dynamic_cast<TList*> (GetOutputData(1));
+ if (!fOutput) {
+ AliFatal("failed to get output container");
+ return;
+ }
+
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/// @file AliAnalysisTaskDxHFEParticleSelection.h
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief AnalysisTask electron selection for D0 - HFE correlation
+///
+
+#ifndef ALIANALYSISTASKDXHFEPARTICLESELECTION_H
+#define ALIANALYSISTASKDXHFEPARTICLESELECTION_H
+
+#include "AliAnalysisTaskSE.h"
+#include "TString.h"
+class TList;
+class AliDxHFEParticleSelection;
+
+/**
+ * @class AliAnalysisTaskDxHFEParticleSelection
+ * Selection task for particles uesd in the D0 - HFE correlation studies
+ * Task performs the selection based on a configured AliDxHFEParticleSelection
+ * instance.
+ */
+class AliAnalysisTaskDxHFEParticleSelection : public AliAnalysisTaskSE {
+ public:
+ /// constructor
+ AliAnalysisTaskDxHFEParticleSelection(const char* opt="");
+ /// destructor
+ virtual ~AliAnalysisTaskDxHFEParticleSelection();
+
+ /// inherited from AliAnalysisTask: connect tree branches at input slots
+ virtual void ConnectInputData(Option_t *option="") {
+ return AliAnalysisTaskSE::ConnectInputData(option);
+ }
+
+ /// inherited from AliAnalysisTaskSE: create output objects
+ virtual void UserCreateOutputObjects();
+ /// inherited from AliAnalysisTaskSE: event processing
+ virtual void UserExec(Option_t*);
+ /// inherited from AliAnalysisTask: called in SlaveTerminate phase for each task
+ virtual void FinishTaskOutput();
+ /// inherited from AliAnalysisTask: final step
+ virtual void Terminate(Option_t*);
+
+ void SetOption(const char* opt) { fOption = opt; }
+
+ protected:
+
+ private:
+ /// copy constructor prohibited: might change
+ AliAnalysisTaskDxHFEParticleSelection(const AliAnalysisTaskDxHFEParticleSelection&);
+ /// assignment operator prohibited: might change
+ AliAnalysisTaskDxHFEParticleSelection& operator=(const AliAnalysisTaskDxHFEParticleSelection&);
+
+ int DefineSlots();
+
+ TList* fOutput; //! list send on output slot 1
+ TString fOption; // option string
+ AliDxHFEParticleSelection* fSelector; // selector instance
+
+ ClassDef(AliAnalysisTaskDxHFEParticleSelection, 1);
+};
+
+#endif
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* Sedat Altinpinar <Sedat.Altinpinar@cern.ch> *
+//* Hege Erdal <hege.erdal@gmail.com> *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
+
+/// @file AliDxHFECorrelation.cxx
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-04-25
+/// @brief Worker class for D0-HF electron correlation
+///
+
+#include "AliDxHFECorrelation.h"
+#include "AliVParticle.h"
+#include "AliLog.h"
+#include "TObjArray.h"
+#include "TH1D.h"
+#include "TH2D.h"
+#include "TMath.h"
+#include "TFile.h"
+#include "TCanvas.h"
+#include <iostream>
+#include <cerrno>
+#include <memory>
+
+using namespace std;
+
+ClassImp(AliDxHFECorrelation)
+
+AliDxHFECorrelation::AliDxHFECorrelation(const char* name)
+ : TNamed(name?name:"AliDxHFECorrelation", "")
+ , fHistograms(NULL)
+{
+ // default constructor
+ //
+ //
+
+}
+
+AliDxHFECorrelation::~AliDxHFECorrelation()
+{
+ // destructor
+ //
+ //
+ if (fHistograms) {
+ delete fHistograms;
+ fHistograms=NULL;
+ }
+}
+
+int AliDxHFECorrelation::Init()
+{
+ /// init class and create histograms
+ if (fHistograms) delete fHistograms;
+ fHistograms=new TObjArray;
+ if (!fHistograms) return -ENOMEM;
+ fHistograms->SetOwner(kTRUE);
+ AliInfo(Form("initializing %s ", GetName()));
+
+ // TODO: This is just a mockup to illustrate the functionality
+ // the specific histograms need to be defined
+
+ // avoid the objects to be added to the global directory
+ bool statusAddDirectory=TH1::AddDirectoryStatus();
+ TH1::AddDirectory(false);
+ const double Pii=TMath::Pi();
+ TObjArray* a=fHistograms;
+ a->AddAt(new TH1D("hD0pT" , "D0 pT" ,100,0.0,10.0) , khD0pT );
+ a->AddAt(new TH1D("hD0Phi" , "D0 phi" ,180,0.0,2*Pii) , khD0Phi );
+ a->AddAt(new TH1D("hD0Eta" , "D0 eta" ,100,-10.0,10.0) , khD0Eta );
+ a->AddAt(new TH1D("hElectronpT" , "Electron pT" ,100,0.0,10.0) , khElectronpT );
+ a->AddAt(new TH1D("hElectronPhi", "Electron phi" ,180,0.0,2*Pii) , khElectronPhi );
+ a->AddAt(new TH1D("hElectronEta", "Electron eta" ,100,-10.0,10.0) , khElectronEta );
+ a->AddAt(new TH1D("hDeltaPhi" , "#Delta#Phi D0 - HFE",180,0.0,2*Pii) , khDeltaPhi );
+
+ TH1::AddDirectory(statusAddDirectory);
+ return 0;
+}
+
+int AliDxHFECorrelation::Fill(const TObjArray* candidatesD0, const TObjArray* candidatesElectron)
+{
+ /// fill histograms from array of AliVParticle objects
+ if (!candidatesD0 || !candidatesElectron) return -EINVAL;
+ if (!fHistograms) {
+ Init();
+ }
+ if (!fHistograms) {
+ AliError("Initialisation failed, can not fill histograms");
+ }
+
+ const double Pii=TMath::Pi();
+
+ TIter itrigger(candidatesD0);
+ TObject* otrigger=NULL;
+ int ctrigger=-1;
+ while ((otrigger=itrigger())!=NULL) {
+ // loop over trigger D0 particle
+ ctrigger++;
+ AliVParticle* ptrigger=reinterpret_cast<AliVParticle*>(otrigger);
+ if (!ptrigger) continue;
+ ((TH1D*)fHistograms->At(khD0pT)) ->Fill(ptrigger->Pt());
+ ((TH1D*)fHistograms->At(khD0Phi))->Fill(ptrigger->Phi());
+ ((TH1D*)fHistograms->At(khD0Eta))->Fill(ptrigger->Eta());
+ // TODO: add further correlation specific cuts here, e.g acceptance
+ // which are no primarily part of the particle selection
+
+ TIter iElectron(candidatesElectron);
+ TObject* oElectron=NULL;
+ int cElectron=-1;
+ while ((oElectron=iElectron())!=NULL) {
+ // loop over electrons
+ cElectron++;
+ AliVParticle* pElectron=reinterpret_cast<AliVParticle*>(oElectron);
+ if (!pElectron) continue;
+ ((TH1D*)fHistograms->At(khElectronpT)) ->Fill(pElectron->Pt());
+ ((TH1D*)fHistograms->At(khElectronPhi))->Fill(pElectron->Phi());
+ ((TH1D*)fHistograms->At(khElectronEta))->Fill(pElectron->Eta());
+
+ // phi difference to trigger particle
+ Double_t DeltaPhi = ptrigger->Phi() - pElectron->Phi();
+ if (DeltaPhi<-0.5*Pii) DeltaPhi += 2*Pii;
+ if (DeltaPhi>1.5*Pii) DeltaPhi -= 2*Pii;
+ ((TH1D*)fHistograms->At(khDeltaPhi))->Fill(DeltaPhi);
+
+ } // loop over electrons
+ } // loop over D0 trigger particle
+
+ return 0;
+}
+
+void AliDxHFECorrelation::Clear(Option_t * /*option*/)
+{
+ /// overloaded from TObject: cleanup
+
+ // nothing to be done so far
+ return TObject::Clear();
+}
+
+void AliDxHFECorrelation::Print(Option_t */*option*/) const
+{
+ /// overloaded from TObject: print info
+ cout << "====================================================================" << endl;
+ TObject::Print();
+ if (fHistograms) {
+ fHistograms->Print();
+ }
+}
+
+void AliDxHFECorrelation::Draw(Option_t */*option*/)
+{
+ /// overloaded from TObject: draw histograms
+ if (fHistograms) {
+ TString name;
+ int canvasno=1;
+ int padno=1;
+ const char* drawoption="";
+ name.Form("%s_%d", GetName(), canvasno++);
+ TCanvas* c=new TCanvas(name);
+ c->SetWindowSize(1600,800);
+ c->SetTitle(Form("%s: particle properties", GetName()));
+ c->Divide(3,2);
+ padno=1;
+ c->cd(padno++); fHistograms->At(khD0pT) ->Draw(drawoption);
+ c->cd(padno++); fHistograms->At(khD0Phi) ->Draw(drawoption);
+ c->cd(padno++); fHistograms->At(khD0Eta) ->Draw(drawoption);
+ c->cd(padno++); fHistograms->At(khDeltaPhi) ->Draw(drawoption);
+ c->cd(padno++); fHistograms->At(khElectronpT) ->Draw(drawoption);
+ c->cd(padno++); fHistograms->At(khElectronPhi)->Draw(drawoption);
+ c->cd(padno++); fHistograms->At(khElectronEta)->Draw(drawoption);
+ c->Print(".png");
+ }
+}
+
+TObject* AliDxHFECorrelation::FindObject(const char *name) const
+{
+ /// overloaded from TObject: find object by name
+ if (fHistograms) {
+ return fHistograms->FindObject(name);
+ }
+ return NULL;
+}
+
+TObject* AliDxHFECorrelation::FindObject(const TObject *obj) const
+{
+ /// overloaded from TObject: find object by pointer
+ if (fHistograms) {
+ return fHistograms->FindObject(obj);
+ }
+ return NULL;
+}
+
+void AliDxHFECorrelation::SaveAs(const char *filename,Option_t */*option*/) const
+{
+ /// overloaded from TObject: save to file
+ std::auto_ptr<TFile> output(TFile::Open(filename, "RECREATE"));
+ if (!output.get() || output->IsZombie()) {
+ AliError(Form("can not open file %s from writing", filename));
+ return;
+ }
+ output->cd();
+ if (fHistograms) fHistograms->Write();
+ output->Close();
+}
+
+AliDxHFECorrelation& AliDxHFECorrelation::operator+=(const AliDxHFECorrelation& other)
+{
+ /// add histograms from another instance
+ if (!fHistograms || !other.fHistograms) return *this;
+
+ for (int i=0; i<kNofHistograms; i++) {
+ if (fHistograms->At(i)==NULL || other.fHistograms->At(i)==NULL) continue;
+ TH1* target=reinterpret_cast<TH1*>(fHistograms->At(i));
+ TH1* source=reinterpret_cast<TH1*>(other.fHistograms->At(i));
+ if (!target || !source) continue;
+ TString name(fHistograms->At(i)->GetName());
+ if (name.CompareTo(target->GetName())!=0) {
+ AliWarning(Form("skipping incompatible objects at position %d: %s vs %s", i, source->GetName(), target->GetName()));
+ continue;
+ }
+ if (source->IsA()!=target->IsA()) {
+ AliWarning(Form("skipping incompatible classes at position %d: %s vs %s", i, source->ClassName(), target->ClassName()));
+ continue;
+ }
+ target->Add(source);
+ }
+ return *this;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/// @file AliDxHFECorrelation.h
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-04-25
+/// @brief Worker class for D0-HF electron correlation
+///
+
+#ifndef ALIDXHFECORRELATION_H
+#define ALIDXHFECORRELATION_H
+
+#include "TNamed.h"
+
+class TH1F;
+class TH2F;
+
+class AliDxHFECorrelation : public TNamed {
+ public:
+ /// default constructor
+ AliDxHFECorrelation(const char* name=NULL);
+ /// destructor
+ virtual ~AliDxHFECorrelation();
+
+ // init
+ int Init();
+
+ /// fill histograms from particles
+ int Fill(const TObjArray* candidatesD0, const TObjArray* candidatesElectron);
+
+ /// overloaded from TObject: cleanup
+ virtual void Clear(Option_t * option ="");
+ /// overloaded from TObject: print info
+ virtual void Print(Option_t *option="") const;
+ /// overloaded from TObject: draw histograms
+ virtual void Draw(Option_t *option="");
+ /// overloaded from TObject: find object by name
+ virtual TObject* FindObject(const char *name) const;
+ /// overloaded from TObject: find object by pointer
+ virtual TObject* FindObject(const TObject *obj) const;
+ /// overloaded from TObject: save to file
+ virtual void SaveAs(const char *filename="",Option_t *option="") const; // *MENU*
+
+ AliDxHFECorrelation& operator+=(const AliDxHFECorrelation& other);
+
+ enum {
+ khD0pT, // TH1F
+ khD0Phi, // TH1F
+ khD0Eta, // TH1F
+ khElectronpT, // TH1F
+ khElectronPhi, // TH1F
+ khElectronEta, // TH1F
+ khDeltaPhi, // TH1F
+ kNofHistograms
+ };
+
+ protected:
+ private:
+ /// copy constructor
+ AliDxHFECorrelation(const AliDxHFECorrelation& other);
+ /// assignment operator
+ AliDxHFECorrelation& operator=(const AliDxHFECorrelation& other);
+
+ TObjArray* fHistograms; // the histograms
+
+ ClassDef(AliDxHFECorrelation, 1)
+};
+#endif
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* Sedat Altinpinar <Sedat.Altinpinar@cern.ch> *
+//* Hege Erdal <hege.erdal@gmail.com> *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
+
+/// @file AliDxHFEParticleSelection.cxx
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief Base class for particle selection
+///
+
+#include "AliDxHFEParticleSelection.h"
+#include "AliVEvent.h"
+#include "AliVParticle.h"
+#include "TObjArray.h"
+#include <cerrno>
+
+/// ROOT macro for the implementation of ROOT specific class methods
+ClassImp(AliDxHFEParticleSelection)
+
+AliDxHFEParticleSelection::AliDxHFEParticleSelection(const char* opt)
+ : TObject()
+ , fOption(opt)
+ , fSelectedTracks(NULL)
+{
+ // constructor
+ //
+ //
+ //
+ //
+}
+
+AliDxHFEParticleSelection::~AliDxHFEParticleSelection()
+{
+ // destructor
+ if (fSelectedTracks) delete fSelectedTracks;
+ fSelectedTracks=NULL;
+}
+
+TObjArray* AliDxHFEParticleSelection::Select(const AliVEvent* pEvent)
+{
+ /// create selection, array contains only pointers but does not own the objects
+ /// object array needs to be deleted by caller
+ if (!pEvent) return NULL;
+ TObjArray* selectedTracks=new TObjArray;
+ if (!selectedTracks) return NULL;
+ int nofTracks=pEvent->GetNumberOfTracks();
+ for (int itrack=0; itrack<nofTracks; itrack++) {
+ AliVParticle* track=pEvent->GetTrack(itrack);
+ if (!IsSelected(track)) continue;
+ selectedTracks->Add(track);
+ }
+ return selectedTracks;
+}
+
+TObjArray* AliDxHFEParticleSelection::Select(TObjArray* pTracks)
+{
+ /// create selection, array contains only pointers but does not own the objects
+ /// object array needs to be deleted by caller
+ if (!pTracks) return NULL;
+ TObjArray* selectedTracks=new TObjArray;
+ if (!selectedTracks) return NULL;
+ TIter itrack(pTracks);
+ TObject* pObj=NULL;
+ while ((pObj=itrack())!=NULL) {
+ AliVParticle* track=dynamic_cast<AliVParticle*>(pObj);
+ if (!track) continue;
+ if (!IsSelected(track)) continue;
+ selectedTracks->Add(track);
+ }
+ return selectedTracks;
+}
+
+int AliDxHFEParticleSelection::CheckAndAdd(AliVParticle* /*p*/)
+{
+ /// check and add track to internal array
+ /// TODO: check if needed
+ return -ENOSYS;
+}
+
+bool AliDxHFEParticleSelection::IsSelected(AliVParticle* /*p*/)
+{
+ /// check particle if it passes the selection criteria
+ /// childs can overload, by default all tracks are selected
+ return true;
+}
+
+void AliDxHFEParticleSelection::AliDxHFEParticleSelection::Clear(Option_t * /*option*/)
+{
+ /// inherited from TObject: cleanup
+}
+
+void AliDxHFEParticleSelection::Print(Option_t */*option*/) const
+{
+ /// inherited from TObject: print info
+}
+
+void AliDxHFEParticleSelection::SaveAs(const char */*filename*/,Option_t */*option*/) const
+{
+ /// inherited from TObject: safe selection criteria
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/// @file AliDxHFEParticleSelection.h
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief Base class for particle selection
+///
+
+#ifndef ALIDXHFEPARTICLESELECTION_H
+#define ALIDXHFEPARTICLESELECTION_H
+
+#include "TObject.h"
+#include "TString.h"
+class AliVEvent;
+class AliVParticle;
+class TObjArray;
+
+/**
+ * @class AliDxHFEParticleSelection
+ * This is the base class for particle selections for the D0 - HFE
+ * correlation studies.
+ *
+ * Ideas:
+ * - configurable particle selection
+ * - eventually histogramming of particle properties before vs. after
+ * selection
+ *
+ * Might be that there is already something similar, then this class
+ * can be merged with some other class.
+ */
+class AliDxHFEParticleSelection : public TObject {
+ public:
+ /// constructor
+ AliDxHFEParticleSelection(const char* opt="");
+ /// destructor
+ virtual ~AliDxHFEParticleSelection();
+
+ /// set options
+ void SetOption(const char* opt) { fOption = opt; }
+ /// overloaded from TObject: get option
+ virtual Option_t* GetOption() const { return fOption;}
+
+ /// create selection, array contains only pointers but does not own the objects
+ /// object array needs to be deleted by caller
+ virtual TObjArray* Select(const AliVEvent* pEvent);
+
+ /// create selection, array contains only pointers but does not own the objects
+ /// object array needs to be deleted by caller
+ virtual TObjArray* Select(TObjArray* pTracks);
+
+ /// check and add track to internal array
+ int CheckAndAdd(AliVParticle* p);
+ /// get selected tracks
+ const TObjArray* GetSelected() const {return fSelectedTracks;}
+
+ /// check particle if it passes the selection criteria
+ virtual bool IsSelected(AliVParticle* p);
+
+ /// inherited from TObject: cleanup
+ virtual void Clear(Option_t * option ="");
+ /// inherited from TObject: print info
+ virtual void Print(Option_t *option="") const;
+ /// inherited from TObject: safe selection criteria
+ virtual void SaveAs(const char *filename="",Option_t *option="") const;
+
+ protected:
+
+ private:
+ /// copy contructor prohibited
+ AliDxHFEParticleSelection(const AliDxHFEParticleSelection&);
+ /// assignment operator prohibited
+ AliDxHFEParticleSelection& operator=(const AliDxHFEParticleSelection&);
+
+ TString fOption; // option
+ TObjArray* fSelectedTracks; //! array of selected tracks
+
+ ClassDef(AliDxHFEParticleSelection, 1);
+};
+
+#endif
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* Sedat Altinpinar <Sedat.Altinpinar@cern.ch> *
+//* Hege Erdal <hege.erdal@gmail.com> *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
+
+/// @file AliDxHFEParticleSelectionD0.cxx
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief D0 selection for D0-HFE correlation
+///
+
+#include "AliDxHFEParticleSelectionD0.h"
+#include "AliVParticle.h"
+#include "TObjArray.h"
+
+/// ROOT macro for the implementation of ROOT specific class methods
+ClassImp(AliDxHFEParticleSelectionD0)
+
+AliDxHFEParticleSelectionD0::AliDxHFEParticleSelectionD0(const char* opt)
+ : AliDxHFEParticleSelection(opt)
+{
+ // constructor
+ //
+ //
+ //
+ //
+}
+
+AliDxHFEParticleSelectionD0::~AliDxHFEParticleSelectionD0()
+{
+ // destructor
+}
+
+bool AliDxHFEParticleSelectionD0::IsSelected(AliVParticle* /*p*/)
+{
+ /// TODO: implement specific selection of D0 candidates
+ return true;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/// @file AliDxHFEParticleSelectionD0.h
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief D0 selection for D-HFE correlations
+///
+
+#ifndef ALIDXHFEPARTICLESELECTIOND0_H
+#define ALIDXHFEPARTICLESELECTIOND0_H
+
+#include "AliDxHFEParticleSelection.h"
+
+/**
+ * @class AliDxHFEParticleSelectionD0
+ * D0 selection for D-HFE correlations, implements the specific
+ * selection criteria.
+ */
+class AliDxHFEParticleSelectionD0 : public AliDxHFEParticleSelection {
+ public:
+ /// constructor
+ AliDxHFEParticleSelectionD0(const char* opt="");
+ /// destructor
+ virtual ~AliDxHFEParticleSelectionD0();
+
+ /// overloaded from AliDxHFEParticleSelection: check particle
+ virtual bool IsSelected(AliVParticle* p);
+
+ protected:
+
+ private:
+ /// copy contructor prohibited
+ AliDxHFEParticleSelectionD0(const AliDxHFEParticleSelectionD0&);
+ /// assignment operator prohibited
+ AliDxHFEParticleSelectionD0& operator=(const AliDxHFEParticleSelectionD0&);
+
+ ClassDef(AliDxHFEParticleSelectionD0, 1);
+};
+
+#endif
--- /dev/null
+// $Id$
+
+//**************************************************************************
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* *
+//* Primary Authors: Matthias Richter <Matthias.Richter@ift.uib.no> *
+//* Sedat Altinpinar <Sedat.Altinpinar@cern.ch> *
+//* Hege Erdal <hege.erdal@gmail.com> *
+//* *
+//* Permission to use, copy, modify and distribute this software and its *
+//* documentation strictly for non-commercial purposes is hereby granted *
+//* without fee, provided that the above copyright notice appears in all *
+//* copies and that both the copyright notice and this permission notice *
+//* appear in the supporting documentation. The authors make no claims *
+//* about the suitability of this software for any purpose. It is *
+//* provided "as is" without express or implied warranty. *
+//**************************************************************************
+
+/// @file AliDxHFEParticleSelectionEl.cxx
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief D0 selection for D0-HFE correlation
+///
+
+#include "AliDxHFEParticleSelectionEl.h"
+#include "AliVParticle.h"
+#include "TObjArray.h"
+
+/// ROOT macro for the implementation of ROOT specific class methods
+ClassImp(AliDxHFEParticleSelectionEl)
+
+AliDxHFEParticleSelectionEl::AliDxHFEParticleSelectionEl(const char* opt)
+ : AliDxHFEParticleSelection(opt)
+{
+ // constructor
+ //
+ //
+ //
+ //
+}
+
+AliDxHFEParticleSelectionEl::~AliDxHFEParticleSelectionEl()
+{
+ // destructor
+}
+
+bool AliDxHFEParticleSelectionEl::IsSelected(AliVParticle* /*p*/)
+{
+ /// TODO: implement specific selection of D0 candidates
+ return true;
+}
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/// @file AliDxHFEParticleSelectionEl.h
+/// @author Sedat Altinpinar, Hege Erdal, Matthias Richter
+/// @date 2012-03-19
+/// @brief Electron selection for D-HFE correlations
+///
+
+#ifndef ALIDXHFEPARTICLESELECTIONEL_H
+#define ALIDXHFEPARTICLESELECTIONEL_H
+
+#include "AliDxHFEParticleSelection.h"
+
+/**
+ * @class AliDxHFEParticleSelectionEl
+ * Electron selection for D-HFE correlations, implements the specific
+ * selection criteria.
+ */
+class AliDxHFEParticleSelectionEl : public AliDxHFEParticleSelection {
+ public:
+ /// constructor
+ AliDxHFEParticleSelectionEl(const char* opt="");
+ /// destructor
+ virtual ~AliDxHFEParticleSelectionEl();
+
+ /// overloaded from AliDxHFEParticleSelection: check particle
+ virtual bool IsSelected(AliVParticle* p);
+
+ protected:
+
+ private:
+ /// copy contructor prohibited
+ AliDxHFEParticleSelectionEl(const AliDxHFEParticleSelectionEl&);
+ /// assignment operator prohibited
+ AliDxHFEParticleSelectionEl& operator=(const AliDxHFEParticleSelectionEl&);
+
+ ClassDef(AliDxHFEParticleSelectionEl, 1);
+};
+
+#endif
--- /dev/null
+//-*- Mode: C++ -*-
+// $Id$
+
+//* This file is property of and copyright by the ALICE Project *
+//* ALICE Experiment at CERN, All rights reserved. *
+//* See cxx source for full Copyright notice *
+
+/// @file compile-DxHFE.C
+/// @author Matthias Richter
+/// @date 2012-03-19
+/// @brief Compile classes for the D0 - HFE correlation studies
+///
+/// Usage: aliroot -l $ALICE_ROOT/PWGHF/correlationHF/compile-DxHFE.C
+
+#if defined(__CINT__) && !defined(__MAKECINT__)
+{
+ //----------- Loading the required libraries ---------//
+
+ gSystem->Load("libSTEERBase");
+ gSystem->Load("libESD");
+ gSystem->Load("libAOD");
+ gSystem->Load("libANALYSIS");
+ gSystem->Load("libANALYSISalice");
+ gSystem->AddIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include");
+ gROOT->LoadMacro("$ALICE_ROOT/PWGHF/correlationHF/AliDxHFEParticleSelection.cxx+");
+ gROOT->LoadMacro("$ALICE_ROOT/PWGHF/correlationHF/AliDxHFEParticleSelectionD0.cxx+");
+ gROOT->LoadMacro("$ALICE_ROOT/PWGHF/correlationHF/AliDxHFEParticleSelectionEl.cxx+");
+ gROOT->LoadMacro("$ALICE_ROOT/PWGHF/correlationHF/AliAnalysisTaskDxHFEParticleSelection.cxx+");
+ gROOT->LoadMacro("$ALICE_ROOT/PWGHF/correlationHF/AliDxHFECorrelation.cxx+");
+ gROOT->LoadMacro("$ALICE_ROOT/PWGHF/correlationHF/AliAnalysisTaskDxHFECorrelation.cxx+");
+}
+#elif
+{
+ cerr << "this macro can not be compiled, remove option '+'" << endl;
+}
+#endif