From aee86258635d34f054b397708001ae3caad5e237 Mon Sep 17 00:00:00 2001 From: loizides Date: Mon, 6 Feb 2012 19:29:14 +0000 Subject: [PATCH] clus/track match task --- .../AliEmcalClusTrackMatcherTask.cxx | 84 +++++++++++++++++++ .../EMCALTasks/AliEmcalClusTrackMatcherTask.h | 35 ++++++++ 2 files changed, 119 insertions(+) create mode 100644 PWGGA/EMCALTasks/AliEmcalClusTrackMatcherTask.cxx create mode 100644 PWGGA/EMCALTasks/AliEmcalClusTrackMatcherTask.h diff --git a/PWGGA/EMCALTasks/AliEmcalClusTrackMatcherTask.cxx b/PWGGA/EMCALTasks/AliEmcalClusTrackMatcherTask.cxx new file mode 100644 index 00000000000..a697c73fa50 --- /dev/null +++ b/PWGGA/EMCALTasks/AliEmcalClusTrackMatcherTask.cxx @@ -0,0 +1,84 @@ +// $Id$ + +#include "AliEmcalClusTrackMatcherTask.h" +//#include +//#include +//#include "AliAODJet.h" +//#include "AliAnalysisManager.h" +//#include "AliESDtrack.h" +//#include "AliESDtrackCuts.h" +//#include "AliBambooFJWrapper.h" +//#include "AliESDCaloCluster.h" + +ClassImp(AliEmcalClusTrackMatcherTask) + + +//________________________________________________________________________ +AliEmcalClusTrackMatcherTask::AliEmcalClusTrackMatcherTask(const char *name) : + AliAnalysisTaskSE("AliEmcalClusTrackMatcherTask"), + fTracksName("Tracks"), + fCaloName("CaloClusters") +{ + // Standard constructor. + if (!name) + return; + SetName(name); +// fBranchNames="ESD:AliESDRun.,AliESDHeader.,PrimaryVertex.,CaloClusters,Tracks"; +} + +//________________________________________________________________________ +AliEmcalClusTrackMatcherTask::~AliEmcalClusTrackMatcherTask() +{ + // Destructor +} + +//________________________________________________________________________ +void AliEmcalClusTrackMatcherTask::UserCreateOutputObjects() +{ + // Create user objects. + +} + +//________________________________________________________________________ +void AliEmcalClusTrackMatcherTask::UserExec(Option_t *) +{ + // Main loop, called for each event. + +#if 0 + // add jets to event if not yet there + if (!(InputEvent()->FindListObject(fJetsName))) + InputEvent()->AddObject(fJets); + + AliAnalysisManager *am = AliAnalysisManager::GetAnalysisManager(); + TClonesArray *tracks = 0; + TClonesArray *clus = 0; + TList *l = InputEvent()->GetList(); + if ((fType==0)||(fType==1)) { + if (fPrimTracksName == "Tracks") + am->LoadBranch("Tracks"); + tracks = dynamic_cast(l->FindObject(fPrimTracksName)); + if (!tracks) { + AliError(Form("Pointer to tracks %s == 0", fPrimTracksName.Data() )); + return; + } + } + if ((fType==0)||(fType==2)) { + if (fCaloName == "CaloClusters") + am->LoadBranch("CaloClusters"); + clus = dynamic_cast(l->FindObject(fCaloName)); + if (!clus) { + AliError(Form("Pointer to clus %s == 0", fCaloName.Data() )); + return; + } + if (!(InputEvent()->FindListObject(Form("%s_neutrals",fJetsName.Data())))) + InputEvent()->AddObject(fNeutrals); + } +#endif +} + +//________________________________________________________________________ +void AliEmcalClusTrackMatcherTask::Terminate(Option_t *) +{ + // Called once at the end of the analysis. + +} diff --git a/PWGGA/EMCALTasks/AliEmcalClusTrackMatcherTask.h b/PWGGA/EMCALTasks/AliEmcalClusTrackMatcherTask.h new file mode 100644 index 00000000000..ad78deb2bd7 --- /dev/null +++ b/PWGGA/EMCALTasks/AliEmcalClusTrackMatcherTask.h @@ -0,0 +1,35 @@ +#ifndef ALIEMCALCLUSTRACKMATCHERTASK_H +#define ALIEMCALCLUSTRACKMATCHERTASK_H + +// $Id$ + +class TClonesArray; +class AliESDtrackCuts; + +#include "AliAnalysisTaskSE.h" + +class AliEmcalClusTrackMatcherTask : public AliAnalysisTaskSE { + public: + AliEmcalClusTrackMatcherTask(const char *name=0); + virtual ~AliEmcalClusTrackMatcherTask(); + + void UserCreateOutputObjects(); + void UserExec(Option_t *option); + void Terminate(Option_t *option); + + void SetCaloName(const char *n) { fCaloName = n; } + void SetTracksName(const char *n) { fTracksName = n; } + + protected: + void FindJets(TObjArray *tracks, TObjArray *clus, Int_t algo, Double_t radius); + + TString fTracksName; // name of track collection (if "" use branch) + TString fCaloName; // name of calo collection + + private: + AliEmcalClusTrackMatcherTask(const AliEmcalClusTrackMatcherTask&); // not implemented + AliEmcalClusTrackMatcherTask &operator=(const AliEmcalClusTrackMatcherTask&); // not implemented + + ClassDef(AliEmcalClusTrackMatcherTask, 1) // Cluster-Track matching task +}; +#endif -- 2.43.0