From 699a38d6b3cd48df362db76b3733030246b9c525 Mon Sep 17 00:00:00 2001 From: dainese Date: Thu, 3 Apr 2008 18:19:34 +0000 Subject: [PATCH] New AliAnalysisTaskSE for vertexing HF (Andrea) --- PWG3/AliAnalysisTaskSEVertexingHF.cxx | 153 ++++++++++++++++++++++++ PWG3/AliAnalysisTaskSEVertexingHF.h | 51 ++++++++ PWG3/AliAnalysisTaskSEVertexingHFTest.C | 90 ++++++++++++++ 3 files changed, 294 insertions(+) create mode 100644 PWG3/AliAnalysisTaskSEVertexingHF.cxx create mode 100644 PWG3/AliAnalysisTaskSEVertexingHF.h create mode 100644 PWG3/AliAnalysisTaskSEVertexingHFTest.C diff --git a/PWG3/AliAnalysisTaskSEVertexingHF.cxx b/PWG3/AliAnalysisTaskSEVertexingHF.cxx new file mode 100644 index 00000000000..9af9842e6e6 --- /dev/null +++ b/PWG3/AliAnalysisTaskSEVertexingHF.cxx @@ -0,0 +1,153 @@ +/************************************************************************** + * Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * 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. * + **************************************************************************/ + +///////////////////////////////////////////////////////////// +// +// AliAnalysisTaskSE for the reconstruction of heavy flavor +// decays, using the class AliAnalysisVertexingHF. +// +// Author: A.Dainese, andrea.dainese@lnl.infn.it +///////////////////////////////////////////////////////////// + +#include +#include +#include + +#include "AliAODEvent.h" +#include "AliESDEvent.h" +#include "AliAnalysisVertexingHF.h" +#include "AliAnalysisTaskSE.h" +#include "AliAnalysisTaskSEVertexingHF.h" + +ClassImp(AliAnalysisTaskSEVertexingHF) + + +//________________________________________________________________________ +AliAnalysisTaskSEVertexingHF::AliAnalysisTaskSEVertexingHF(): +AliAnalysisTaskSE(), +fVHF(0), +fVerticesHFTClArr(0), +fD0toKpiTClArr(0), +fJPSItoEleTClArr(0), +fCharm3ProngTClArr(0), +fCharm4ProngTClArr(0) +{ + // Default constructor +} + +//________________________________________________________________________ +AliAnalysisTaskSEVertexingHF::AliAnalysisTaskSEVertexingHF(const char *name): +AliAnalysisTaskSE(name), +fVHF(0), +fVerticesHFTClArr(0), +fD0toKpiTClArr(0), +fJPSItoEleTClArr(0), +fCharm3ProngTClArr(0), +fCharm4ProngTClArr(0) +{ + // Default constructor +} + +//________________________________________________________________________ +AliAnalysisTaskSEVertexingHF::~AliAnalysisTaskSEVertexingHF() +{ + // Destructor +} + +//________________________________________________________________________ +void AliAnalysisTaskSEVertexingHF::Init() +{ + // Initialization + // Instanciates vHF and loads its parameters + + if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::Init() \n"); + + gROOT->LoadMacro("ConfigVertexingHF.C"); + + fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()"); + fVHF->PrintStatus(); + + return; +} + +//________________________________________________________________________ +void AliAnalysisTaskSEVertexingHF::UserCreateOutputObjects() +{ + // Create the output container + // + if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n"); + + if(!fVHF) { + printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n ERROR! no fvHF!\n"); + return; + } + + fVerticesHFTClArr = new TClonesArray("AliAODVertex", 0); + fVerticesHFTClArr->SetName("VerticesHF"); + AddAODBranch("TClonesArray", fVerticesHFTClArr); + + if(fVHF->GetD0toKpi()) { + fD0toKpiTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0); + fD0toKpiTClArr->SetName("D0toKpi"); + AddAODBranch("TClonesArray", fD0toKpiTClArr); + } + + if(fVHF->GetJPSItoEle()) { + fJPSItoEleTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0); + fJPSItoEleTClArr->SetName("JPSItoEle"); + AddAODBranch("TClonesArray", fJPSItoEleTClArr); + } + + if(fVHF->Get3Prong()) { + fCharm3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0); + fCharm3ProngTClArr->SetName("Charm3Prong"); + AddAODBranch("TClonesArray", fCharm3ProngTClArr); + } + + if(fVHF->Get4Prong()) { + fCharm4ProngTClArr = new TClonesArray("AliAODRecoDecayHF4Prong", 0); + fCharm4ProngTClArr->SetName("Charm4Prong"); + AddAODBranch("TClonesArray", fCharm4ProngTClArr); + } + + return; +} + +//________________________________________________________________________ +void AliAnalysisTaskSEVertexingHF::UserExec(Option_t */*option*/) +{ + // Execute analysis for current event: + // heavy flavor vertexing + + AliESDEvent *esd = dynamic_cast (InputEvent()); + + // heavy flavor vertexing + fVHF->FindCandidatesESDtoAOD(esd, + fVerticesHFTClArr, + fD0toKpiTClArr, + fJPSItoEleTClArr, + fCharm3ProngTClArr, + fCharm4ProngTClArr); + + return; +} + +//________________________________________________________________________ +void AliAnalysisTaskSEVertexingHF::Terminate(Option_t */*option*/) +{ + // Terminate analysis + // + if(fDebug > 1) printf("AnalysisTaskSEVertexingHF: Terminate() \n"); +} diff --git a/PWG3/AliAnalysisTaskSEVertexingHF.h b/PWG3/AliAnalysisTaskSEVertexingHF.h new file mode 100644 index 00000000000..f3d64f3abdd --- /dev/null +++ b/PWG3/AliAnalysisTaskSEVertexingHF.h @@ -0,0 +1,51 @@ +#ifndef ALIANALYSISTASKSEVERTEXINGHF_H +#define ALIANALYSISTASKSEVERTEXINGHF_H + +/* Copyright(c) 1998-2008, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +//************************************************************************* +// Class AliAnalysisTaskSEVertexingHF +// AliAnalysisTaskSE for the reconstruction of heavy-flavour decay candidates +// Author: A.Dainese, andrea.dainese@lnl.infn.it +//************************************************************************* + + +#include + +#include "AliAnalysisTaskSE.h" +#include "AliAnalysisVertexingHF.h" + + +class AliAnalysisTaskSEVertexingHF : public AliAnalysisTaskSE +{ + public: + + AliAnalysisTaskSEVertexingHF(); + AliAnalysisTaskSEVertexingHF(const char *name); + virtual ~AliAnalysisTaskSEVertexingHF(); + + AliAnalysisTaskSEVertexingHF(const AliAnalysisTaskSEVertexingHF &source); + AliAnalysisTaskSEVertexingHF& operator=(const AliAnalysisTaskSEVertexingHF& source); + + // Implementation of interface methods + virtual void UserCreateOutputObjects(); + virtual void Init(); + virtual void LocalInit() {Init();} + virtual void UserExec(Option_t *option); + virtual void Terminate(Option_t *option); + + private: + + AliAnalysisVertexingHF *fVHF; // Vertexer heavy flavour + TClonesArray *fVerticesHFTClArr; // Array of heavy-flavour vertices + TClonesArray *fD0toKpiTClArr; // Array of D0->Kpi + TClonesArray *fJPSItoEleTClArr; // Array of Jpsi->ee + TClonesArray *fCharm3ProngTClArr; // Array of D+,Ds,Lc + TClonesArray *fCharm4ProngTClArr; // Array of D0->Kpipipi + + ClassDef(AliAnalysisTaskSEVertexingHF,1); // AliAnalysisTaskSE for the reconstruction of heavy-flavour decay candidates +}; + +#endif + diff --git a/PWG3/AliAnalysisTaskSEVertexingHFTest.C b/PWG3/AliAnalysisTaskSEVertexingHFTest.C new file mode 100644 index 00000000000..4e3c905bce5 --- /dev/null +++ b/PWG3/AliAnalysisTaskSEVertexingHFTest.C @@ -0,0 +1,90 @@ +void AliAnalysisTaskSEVertexingHFTest() +{ + // + // Test macro for the AliAnalysisTaskSE for heavy-flavour vertexing + // A.Dainese, andrea.dainese@lnl.infn.it + // + + gSystem->Load("libTree.so"); + gSystem->Load("libGeom.so"); + gSystem->Load("libPhysics.so"); + gSystem->Load("libVMC.so"); + gSystem->Load("libSTEERBase.so"); + gSystem->Load("libESD.so"); + gSystem->Load("libAOD.so"); + gSystem->Load("libANALYSIS.so"); + gSystem->Load("libANALYSISalice.so"); + gSystem->Load("libPWG3base.so"); + + + // Local files + TChain *chain = new TChain("esdTree"); + chain->Add("./AliESDs.root"); + + // or: + /* + //Fetch files with AliEn : + const char *collectionfile = "CollectionTags.xml"; + TGrid::Connect("alien://") ; + //Create an AliRunTagCuts and an AliEventTagCuts Object and impose some selection criteria + AliRunTagCuts *runCuts = new AliRunTagCuts(); + AliEventTagCuts *eventCuts = new AliEventTagCuts(); + AliLHCTagCuts *lhcCuts = new AliLHCTagCuts(); + AliDetectorTagCuts *detCuts = new AliDetectorTagCuts(); + eventCuts->SetMultiplicityRange(0,20000); + //Create an AliTagAnalysis Object and chain the tags + AliTagAnalysis *tagAna = new AliTagAnalysis(); + tagAna->SetType("ESD"); + TAlienCollection *coll = TAlienCollection::Open(collectionfile); + TGridResult *tagResult = coll->GetGridResult("",0,0); + tagResult->Print(); + tagAna->ChainGridTags(tagResult); + //Create a new esd chain and assign the chain that is returned by querying the tags + TChain* chain = tagAna->QueryTags(runCuts,lhcCuts,detCuts,eventCuts); + */ + + + // Create the analysis manager + AliAnalysisManager *mgr = new AliAnalysisManager("My Manager","My Manager"); + mgr->SetDebugLevel(10); + + // Input Handler + //AliAODInputHandler *inputHandler = new AliAODInputHandler(); + AliESDInputHandler *inputHandler = new AliESDInputHandler(); + inputHandler->SetInactiveBranches("FMD CaloCluster"); + mgr->SetInputEventHandler(inputHandler); + + // Output + AliAODHandler *aodHandler = new AliAODHandler(); + aodHandler->SetOutputFileName("AliAOD.VertexingHF.root"); + aodHandler->SetCreateNonStandardAOD(); + mgr->SetOutputEventHandler(aodHandler); + + // Vertexing analysis task + AliAnalysisTaskSEVertexingHF *hfTask = new AliAnalysisTaskSEVertexingHF("VertexingHFAnalysis"); + hfTask->SetDebugLevel(2); + + mgr->AddTask(hfTask); + + // + // Create containers for input/output + AliAnalysisDataContainer *cinput1 = mgr->CreateContainer("cchain",TChain::Class(), + AliAnalysisManager::kInputContainer); + AliAnalysisDataContainer *coutput1 = mgr->CreateContainer("tree", TTree::Class(), + AliAnalysisManager::kOutputContainer, + "default"); + mgr->ConnectInput(hfTask,0,cinput1); + mgr->ConnectOutput(hfTask,0,coutput1); + + // + // Run the analysis + // + printf("CHAIN HAS %d ENTRIES\n",(Int_t)chain->GetEntries()); + if(mgr->InitAnalysis()) { + mgr->PrintStatus(); + mgr->StartAnalysis("local",chain); + //mgr->StartAnalysis("grid",chain); + } + + return; +} -- 2.39.3