]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliAnalysisTaskVertexingHF.cxx
New structure of PWG3: PWG3base, PWG3muon, PWG3vertexingHF and PWG3vertexingOld ...
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAnalysisTaskVertexingHF.cxx
CommitLineData
3ec50490 1/**************************************************************************
2 * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/////////////////////////////////////////////////////////////
17//
18// AliAnalysisTask for the reconstruction of heavy flavor
19// decays, using the class AliAnalysisVertexingHF.
20//
21// Author: J.Faivre, julien.faivre@pd.infn.it
22/////////////////////////////////////////////////////////////
23
24#include <TROOT.h>
25#include <TChain.h>
26#include <TCanvas.h>
27#include <TSystem.h>
28#include "Riostream.h"
29
30#include "AliAnalysisTask.h"
31#include "AliESDEvent.h"
cc887581 32#include "AliESDInputHandler.h"
3ec50490 33#include "AliAnalysisVertexingHF.h"
34#include "AliAnalysisTaskVertexingHF.h"
35
36ClassImp(AliAnalysisTaskVertexingHF)
37
38
39//________________________________________________________________________
40AliAnalysisTaskVertexingHF::AliAnalysisTaskVertexingHF(const char *name) :
41AliAnalysisTask(name,""),
42fESD(0),
43fChain(0),
969c08c6 44fVHF(0),
45fTrees(0)
3ec50490 46{
47 //Constructor
48
49 //Input slot #0 works with an Ntuple
50 DefineInput(0, TChain::Class());
51 //Output slots 0 to 3 write into a TTree
52 DefineOutput(0, TTree::Class());
53 DefineOutput(1, TTree::Class());
54 DefineOutput(2, TTree::Class());
55 DefineOutput(3, TTree::Class());
56}
57//________________________________________________________________________
cc887581 58AliAnalysisTaskVertexingHF::~AliAnalysisTaskVertexingHF()
59{
60 // Destructor
61 if (fTrees) delete [] fTrees;
62}
63//________________________________________________________________________
3ec50490 64void AliAnalysisTaskVertexingHF::ConnectInputData(Option_t *)
65{
66 //Implementation of AliAnalysisTask::ConnectInputData
67
68 Info("ConnectInputData","ConnectInputData of task %s\n",GetName());
69 fChain = (TChain*)GetInputData(0);
3ec50490 70
cc887581 71 if (!fChain) {
72 printf("ERROR: Could not read chain from input slot 0\n");
73 return;
74 }
75
76 //fESD = new AliESDEvent();
77 //fESD->ReadFromTree(fChain);
78
79 AliESDInputHandler *esdH = dynamic_cast<AliESDInputHandler*> (AliAnalysisManager::GetAnalysisManager()->GetInputEventHandler());
80
81 if (!esdH) {
82 printf("ERROR: Could not get ESDInputHandler\n");
83 } else {
84 fESD = esdH->GetEvent();
85 if (!fESD) printf("ERROR: Could not get ESD object\n");
86 }
87
3ec50490 88 return;
89}
90//________________________________________________________________________
91void AliAnalysisTaskVertexingHF::CreateOutputObjects()
92{
93 //Implementation of AliAnalysisTask::CreateOutputObjects
94 //4 output trees (D0 in 2-prongs, J/Psi to e+e-, 3-prongs (D+, Ds, /\c), D0 in 4-prongs)
95
cc887581 96 fTrees = new TTree*[4];
3ec50490 97 AliAODRecoDecayHF2Prong *rd2=0;
98 AliAODRecoDecayHF3Prong *rd3=0;
99 AliAODRecoDecayHF4Prong *rd4=0;
cc887581 100 fTrees[0] = new TTree("NameD0toKpi","TitleD0toKpi");
101 fTrees[0]->Branch("D0toKpi","AliAODRecoDecayHF2Prong",&rd2);
102 fTrees[1] = new TTree("NameJPSItoEle", "TitleJPSItoEle");
103 fTrees[1]->Branch("JPSItoEle","AliAODRecoDecayHF2Prong",&rd2);
104 fTrees[2] = new TTree("NameCharmto3Prong", "TitleCharmto3Prong");
105 fTrees[2]->Branch("Charmto3Prong","AliAODRecoDecayHF3Prong",&rd3);
106 fTrees[3] = new TTree("NameD0to4Prong","TitleD0to4Prong");
107 fTrees[3]->Branch("D0to4Prong","AliAODRecoDecayHF4Prong",&rd4);
3ec50490 108
109 return;
110}
111//________________________________________________________________________
112void AliAnalysisTaskVertexingHF::LocalInit()
113{
114 //Instanciates vHF and loads its parameters
115
116 gROOT->LoadMacro("ConfigVertexingHF.C");
117
969c08c6 118 fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");
119 fVHF->PrintStatus();
3ec50490 120
121 return;
122}
123//________________________________________________________________________
124void AliAnalysisTaskVertexingHF::Exec(Option_t *)
125{
126 //Performs heavy flavor vertexing
3ec50490 127
128 //Heavy flavor vertexing :
969c08c6 129 fVHF->FindCandidates(fESD,fTrees);
3ec50490 130
131 //Post final data. It will be written to a file with option "RECREATE"
cc887581 132 PostData(0, fTrees[0]);
133 PostData(1, fTrees[1]);
134 PostData(2, fTrees[2]);
135 PostData(3, fTrees[3]);
3ec50490 136
137 return;
138}
139//________________________________________________________________________
140void AliAnalysisTaskVertexingHF::Terminate(Option_t *)
141{
142 //Implementation of AliAnalysisTask::Terminate
143
144 return;
145}
146
147
148
149
150
151
152
153
154