1 /**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
16 /////////////////////////////////////////////////////////////
18 // AliAnalysisTask for the reconstruction of heavy flavor
19 // decays, using the class AliAnalysisVertexingHF.
21 // Author: J.Faivre, julien.faivre@pd.infn.it
22 /////////////////////////////////////////////////////////////
28 #include "Riostream.h"
30 #include "AliAnalysisTask.h"
31 #include "AliESDEvent.h"
32 #include "AliAnalysisVertexingHF.h"
33 #include "AliAnalysisTaskVertexingHF.h"
35 ClassImp(AliAnalysisTaskVertexingHF)
38 //________________________________________________________________________
39 AliAnalysisTaskVertexingHF::AliAnalysisTaskVertexingHF(const char *name) :
40 AliAnalysisTask(name,""),
48 //Input slot #0 works with an Ntuple
49 DefineInput(0, TChain::Class());
50 //Output slots 0 to 3 write into a TTree
51 DefineOutput(0, TTree::Class());
52 DefineOutput(1, TTree::Class());
53 DefineOutput(2, TTree::Class());
54 DefineOutput(3, TTree::Class());
56 //________________________________________________________________________
57 void AliAnalysisTaskVertexingHF::ConnectInputData(Option_t *)
59 //Implementation of AliAnalysisTask::ConnectInputData
61 Info("ConnectInputData","ConnectInputData of task %s\n",GetName());
62 fChain = (TChain*)GetInputData(0);
64 fESD = new AliESDEvent();
65 fESD->ReadFromTree(fChain);
69 //________________________________________________________________________
70 void AliAnalysisTaskVertexingHF::CreateOutputObjects()
72 //Implementation of AliAnalysisTask::CreateOutputObjects
73 //4 output trees (D0 in 2-prongs, J/Psi to e+e-, 3-prongs (D+, Ds, /\c), D0 in 4-prongs)
75 fTrees = new TTree[4];
76 AliAODRecoDecayHF2Prong *rd2=0;
77 AliAODRecoDecayHF3Prong *rd3=0;
78 AliAODRecoDecayHF4Prong *rd4=0;
79 fTrees[0].SetName("NameD0toKpi");
80 fTrees[0].SetTitle("TitleD0toKpi");
81 fTrees[1].SetName("NameJPSItoEle");
82 fTrees[1].SetTitle("TitleJPSItoEle");
83 fTrees[2].SetName("NameCharmto3Prong");
84 fTrees[2].SetTitle("TitleCharmto3Prong");
85 fTrees[3].SetName("NameD0to4Prong");
86 fTrees[3].SetTitle("TitleD0to4Prong");
87 fTrees[0].Branch("D0toKpi","AliAODRecoDecayHF2Prong",&rd2);
88 fTrees[1].Branch("JPSItoEle","AliAODRecoDecayHF2Prong",&rd2);
89 fTrees[2].Branch("Charmto3Prong","AliAODRecoDecayHF3Prong",&rd3);
90 fTrees[3].Branch("D0to4Prong","AliAODRecoDecayHF4Prong",&rd4);
94 //________________________________________________________________________
95 void AliAnalysisTaskVertexingHF::LocalInit()
97 //Instanciates vHF and loads its parameters
99 gROOT->LoadMacro("ConfigVertexingHF.C");
101 fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");
106 //________________________________________________________________________
107 void AliAnalysisTaskVertexingHF::Exec(Option_t *)
109 //Performs heavy flavor vertexing
111 //Transition to new ESD format (from AliRoot v4-06 ?) :
112 fESD->GetAliESDOld();
113 if (fESD->GetAliESDOld()) fESD->CopyFromOldESD();
115 //Heavy flavor vertexing :
116 fVHF->FindCandidates(fESD,fTrees);
118 //Post final data. It will be written to a file with option "RECREATE"
119 PostData(0, &fTrees[0]);
120 PostData(1, &fTrees[1]);
121 PostData(2, &fTrees[2]);
122 PostData(3, &fTrees[3]);
126 //________________________________________________________________________
127 void AliAnalysisTaskVertexingHF::Terminate(Option_t *)
129 //Implementation of AliAnalysisTask::Terminate