--- /dev/null
+/**************************************************************************
+ * Copyright(c) 1998-2007, 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. *
+ **************************************************************************/
+
+/////////////////////////////////////////////////////////////
+//
+// AliAnalysisTask for the reconstruction of heavy flavor
+// decays, using the class AliAnalysisVertexingHF.
+//
+// Author: J.Faivre, julien.faivre@pd.infn.it
+/////////////////////////////////////////////////////////////
+
+#include <TROOT.h>
+#include <TChain.h>
+#include <TCanvas.h>
+#include <TSystem.h>
+#include "Riostream.h"
+
+#include "AliAnalysisTask.h"
+#include "AliESDEvent.h"
+#include "AliAnalysisVertexingHF.h"
+#include "AliAnalysisTaskVertexingHF.h"
+
+ClassImp(AliAnalysisTaskVertexingHF)
+
+
+//________________________________________________________________________
+AliAnalysisTaskVertexingHF::AliAnalysisTaskVertexingHF(const char *name) :
+AliAnalysisTask(name,""),
+fESD(0),
+fChain(0),
+vHF(0),
+mTrees(0)
+{
+ //Constructor
+
+ //Input slot #0 works with an Ntuple
+ DefineInput(0, TChain::Class());
+ //Output slots 0 to 3 write into a TTree
+ DefineOutput(0, TTree::Class());
+ DefineOutput(1, TTree::Class());
+ DefineOutput(2, TTree::Class());
+ DefineOutput(3, TTree::Class());
+}
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::ConnectInputData(Option_t *)
+{
+ //Implementation of AliAnalysisTask::ConnectInputData
+
+ Info("ConnectInputData","ConnectInputData of task %s\n",GetName());
+ fChain = (TChain*)GetInputData(0);
+
+ fESD = new AliESDEvent();
+ fESD->ReadFromTree(fChain);
+
+ return;
+}
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::CreateOutputObjects()
+{
+ //Implementation of AliAnalysisTask::CreateOutputObjects
+ //4 output trees (D0 in 2-prongs, J/Psi to e+e-, 3-prongs (D+, Ds, /\c), D0 in 4-prongs)
+
+ mTrees = new TTree[4];
+ AliAODRecoDecayHF2Prong *rd2=0;
+ AliAODRecoDecayHF3Prong *rd3=0;
+ AliAODRecoDecayHF4Prong *rd4=0;
+ mTrees[0].SetName("NameD0toKpi");
+ mTrees[0].SetTitle("TitleD0toKpi");
+ mTrees[1].SetName("NameJPSItoEle");
+ mTrees[1].SetTitle("TitleJPSItoEle");
+ mTrees[2].SetName("NameCharmto3Prong");
+ mTrees[2].SetTitle("TitleCharmto3Prong");
+ mTrees[3].SetName("NameD0to4Prong");
+ mTrees[3].SetTitle("TitleD0to4Prong");
+ mTrees[0].Branch("D0toKpi","AliAODRecoDecayHF2Prong",&rd2);
+ mTrees[1].Branch("JPSItoEle","AliAODRecoDecayHF2Prong",&rd2);
+ mTrees[2].Branch("Charmto3Prong","AliAODRecoDecayHF3Prong",&rd3);
+ mTrees[3].Branch("D0to4Prong","AliAODRecoDecayHF4Prong",&rd4);
+
+ return;
+}
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::LocalInit()
+{
+ //Instanciates vHF and loads its parameters
+
+ gROOT->LoadMacro("ConfigVertexingHF.C");
+
+ vHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");
+ vHF->PrintStatus();
+
+ return;
+}
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::Exec(Option_t *)
+{
+ //Performs heavy flavor vertexing
+
+ //Transition to new ESD format (from AliRoot v4-06 ?) :
+ fESD->GetAliESDOld();
+ if (fESD->GetAliESDOld()) fESD->CopyFromOldESD();
+
+ //Heavy flavor vertexing :
+ vHF->FindCandidates(fESD,mTrees);
+
+ //Post final data. It will be written to a file with option "RECREATE"
+ PostData(0, &mTrees[0]);
+ PostData(1, &mTrees[1]);
+ PostData(2, &mTrees[2]);
+ PostData(3, &mTrees[3]);
+
+ return;
+}
+//________________________________________________________________________
+void AliAnalysisTaskVertexingHF::Terminate(Option_t *)
+{
+ //Implementation of AliAnalysisTask::Terminate
+
+ return;
+}
+
+
+
+
+
+
+
+
+
--- /dev/null
+#ifndef ALIANALYSISTASKVERTEXINGHF_H
+#define ALIANALYSISTASKVERTEXINGHF_H
+
+/* Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
+ * See cxx source for full Copyright notice */
+
+//*************************************************************************
+// Class AliAnalysisTaskVertexingHF
+// AliAnalysisTask for the reconstruction of heavy-flavour decay candidates
+// Author: J.Faivre, julien.faivre@pd.infn.it
+//*************************************************************************
+
+
+#include <TH1.h>
+#include <TChain.h>
+#include "AliESDEvent.h"
+#include "AliAnalysisTask.h"
+#include "AliAnalysisManager.h"
+#include "AliAnalysisDataContainer.h"
+#include "AliAnalysisVertexingHF.h"
+
+
+class AliAnalysisTaskVertexingHF : public AliAnalysisTask
+{
+ public:
+
+ AliAnalysisTaskVertexingHF() : AliAnalysisTask(), fESD(0), fChain(0), vHF(0), mTrees(0) {}
+ AliAnalysisTaskVertexingHF(const char *name);
+
+ virtual void ConnectInputData(Option_t *);
+ virtual void CreateOutputObjects();
+ virtual void Exec(Option_t *option);
+ virtual void Terminate(Option_t *);
+ virtual void LocalInit();
+
+ private:
+
+ AliESDEvent *fESD; //ESD
+ TChain *fChain; //Chain
+ AliAnalysisVertexingHF *vHF; //Vertexer heavy flavour
+ TTree *mTrees; //Output trees (D0 in 2-prongs, J/Psi to e+e-, 3-prongs (D+, Ds, Lc), D0 in 4-prongs)
+
+ ClassDef(AliAnalysisTaskVertexingHF,1); //AliAnalysisTask for the reconstruction of heavy-flavour decay candidates
+};
+
+#endif
+
--- /dev/null
+void AliAnalysisTaskVertexingHFTest() {
+
+ gSystem->Load("libANALYSIS");
+ gSystem->Load("libANALYSISRL");
+ gSystem->Load("libAOD.so");
+ gSystem->Load("libPWG3base.so");
+ //This file can cause problems :
+ if (!gSystem->AccessPathName("$ALICE_ROOT/ANALYSIS/AliAnalysisSelector_cxx.so",kFileExists)) {
+ printf("File $ALICE_ROOT/ANALYSIS/AliAnalysisSelector_cxx.so exists and can cause problems, delete it if you can...");
+ return;
+ }
+
+
+ //Run over local files :
+ TChain *chain= new TChain("esdTree");
+ chain->Add("AliESDs.root"); // put path to your files here
+
+ // OR :
+
+ /*
+ //Fetch files with AliEn :
+ const char *collectionfile = "essai6000CollectionTags1.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);
+ */
+
+ //Temporary solution to avoid memory leaks :
+ chain->SetBranchStatus("*FMD*",0);
+ chain->SetBranchStatus("*CaloClusters*",0);
+
+ //Create tasks
+ AliAnalysisManager *analManager = new AliAnalysisManager("myAnalysisManager");
+ //analManager->SetDebugLevel(10);
+ AliAnalysisTaskVertexingHF *task1 = new AliAnalysisTaskVertexingHF("myTask");
+ analManager->AddTask(task1);
+ //Create containers for input/output
+ AliAnalysisDataContainer *cinput1 = analManager->CreateContainer("cchain1",TChain::Class(),AliAnalysisManager::kInputContainer);
+ AliAnalysisDataContainer *coutput1 = analManager->CreateContainer("tree1", TTree::Class(),AliAnalysisManager::kOutputContainer,"HFtrees.root");
+ AliAnalysisDataContainer *coutput2 = analManager->CreateContainer("tree2", TTree::Class(),AliAnalysisManager::kOutputContainer,"HFtrees.root");
+ AliAnalysisDataContainer *coutput3 = analManager->CreateContainer("tree3", TTree::Class(),AliAnalysisManager::kOutputContainer,"HFtrees.root");
+ AliAnalysisDataContainer *coutput4 = analManager->CreateContainer("tree4", TTree::Class(),AliAnalysisManager::kOutputContainer,"HFtrees.root");
+ analManager->ConnectInput(task1,0,cinput1);
+ analManager->ConnectOutput(task1,0,coutput1);
+ analManager->ConnectOutput(task1,1,coutput2);
+ analManager->ConnectOutput(task1,2,coutput3);
+ analManager->ConnectOutput(task1,3,coutput4);
+ cinput1->SetData(chain);
+
+ printf("CHAIN HAS %d ENTRIES\n",(Int_t)chain->GetEntries());
+ if (analManager->InitAnalysis()) {
+ analManager->PrintStatus();
+ //analManager->StartAnalysis("grid",chain);
+ analManager->StartAnalysis("local",chain);
+ }
+
+ return;
+}
+
+
+
--- /dev/null
+AliAnalysisVertexingHF* ConfigVertexingHF() {
+
+ printf("Call to AliAnalysisVertexingHF parameters setting :\n");
+ vHF = new AliAnalysisVertexingHF();
+
+ //vHF->SetJPSItoEleOff();
+ vHF->Set3ProngOff();
+ vHF->Set4ProngOff();
+ vHF->SetITSrefitRequired();
+ vHF->SetBothSPDNotRequired();
+ vHF->SetMinITSCls(5);
+ vHF->SetMinPtCut(0.5);
+ vHF->SetMind0Cut(0.);
+ vHF->SetD0toKpiCuts(0.2,999999.,1.1,0.,0.,999999.,999999.,999999.,0.3);
+ vHF->SetBtoJPSICuts(0.350);
+ vHF->SetDplusCuts(0.2,0.,0.,0.,0.,0.01,0.06,0.,0.,0.8);
+
+ return vHF;
+}
+
+
+
#pragma link C++ class AliAODRecoDecayHF3Prong+;
#pragma link C++ class AliAODRecoDecayHF4Prong+;
#pragma link C++ class AliAnalysisVertexingHF+;
+#pragma link C++ class AliAnalysisTaskVertexingHF+;
#endif
AliAODRecoDecayHF.cxx \
AliAODRecoDecayHF2Prong.cxx AliAODRecoDecayHF3Prong.cxx \
AliAODRecoDecayHF4Prong.cxx \
- AliAnalysisVertexingHF.cxx
+ AliAnalysisVertexingHF.cxx AliAnalysisTaskVertexingHF.cxx
HDRS:= $(SRCS:.cxx=.h)