]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/AliAnalysisTaskVertexingHF.cxx
loading libANALYSIS.so
[u/mrichter/AliRoot.git] / PWG3 / AliAnalysisTaskVertexingHF.cxx
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"
32 #include "AliAnalysisVertexingHF.h"
33 #include "AliAnalysisTaskVertexingHF.h"
34
35 ClassImp(AliAnalysisTaskVertexingHF)
36
37
38 //________________________________________________________________________
39 AliAnalysisTaskVertexingHF::AliAnalysisTaskVertexingHF(const char *name) :
40 AliAnalysisTask(name,""), 
41 fESD(0), 
42 fChain(0), 
43 vHF(0), 
44 mTrees(0)
45 {
46   //Constructor
47
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());
55 }
56 //________________________________________________________________________
57 void AliAnalysisTaskVertexingHF::ConnectInputData(Option_t *)
58 {
59   //Implementation of AliAnalysisTask::ConnectInputData
60
61   Info("ConnectInputData","ConnectInputData of task %s\n",GetName());
62   fChain = (TChain*)GetInputData(0);
63  
64   fESD = new AliESDEvent();
65   fESD->ReadFromTree(fChain);
66
67   return;
68 }
69 //________________________________________________________________________
70 void AliAnalysisTaskVertexingHF::CreateOutputObjects()
71 {
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)
74
75   mTrees = new TTree[4];
76   AliAODRecoDecayHF2Prong *rd2=0;
77   AliAODRecoDecayHF3Prong *rd3=0;
78   AliAODRecoDecayHF4Prong *rd4=0;
79   mTrees[0].SetName("NameD0toKpi");
80   mTrees[0].SetTitle("TitleD0toKpi");
81   mTrees[1].SetName("NameJPSItoEle");
82   mTrees[1].SetTitle("TitleJPSItoEle");
83   mTrees[2].SetName("NameCharmto3Prong");
84   mTrees[2].SetTitle("TitleCharmto3Prong");
85   mTrees[3].SetName("NameD0to4Prong");
86   mTrees[3].SetTitle("TitleD0to4Prong");
87   mTrees[0].Branch("D0toKpi","AliAODRecoDecayHF2Prong",&rd2);
88   mTrees[1].Branch("JPSItoEle","AliAODRecoDecayHF2Prong",&rd2);
89   mTrees[2].Branch("Charmto3Prong","AliAODRecoDecayHF3Prong",&rd3);
90   mTrees[3].Branch("D0to4Prong","AliAODRecoDecayHF4Prong",&rd4);
91
92   return;
93 }
94 //________________________________________________________________________
95 void AliAnalysisTaskVertexingHF::LocalInit()
96 {
97   //Instanciates vHF and loads its parameters
98
99   gROOT->LoadMacro("ConfigVertexingHF.C");
100
101   vHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");  
102   vHF->PrintStatus();
103
104   return;
105 }
106 //________________________________________________________________________
107 void AliAnalysisTaskVertexingHF::Exec(Option_t *)
108 {
109   //Performs heavy flavor vertexing
110
111   //Transition to new ESD format (from AliRoot v4-06 ?) :
112   fESD->GetAliESDOld();
113   if (fESD->GetAliESDOld()) fESD->CopyFromOldESD();
114   
115   //Heavy flavor vertexing :
116   vHF->FindCandidates(fESD,mTrees);
117   
118   //Post final data. It will be written to a file with option "RECREATE"
119   PostData(0, &mTrees[0]);
120   PostData(1, &mTrees[1]);
121   PostData(2, &mTrees[2]);
122   PostData(3, &mTrees[3]);
123
124   return;
125 }      
126 //________________________________________________________________________
127 void AliAnalysisTaskVertexingHF::Terminate(Option_t *)
128 {
129   //Implementation of AliAnalysisTask::Terminate
130
131   return;
132 }
133
134
135
136
137
138
139
140
141