]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AliAnalysisTaskSEVertexingHF.cxx
Analysis can take both AOD or ESD as input (Andrea)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAnalysisTaskSEVertexingHF.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2008, 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 // AliAnalysisTaskSE for the reconstruction of heavy flavor
19 // decays, using the class AliAnalysisVertexingHF.
20 //
21 // Author: A.Dainese, andrea.dainese@lnl.infn.it
22 /////////////////////////////////////////////////////////////
23
24 #include <TROOT.h>
25 #include <TSystem.h>
26 #include <TClonesArray.h>
27
28 #include "AliVEvent.h"
29 #include "AliAODEvent.h"
30 #include "AliESDEvent.h"
31 #include "AliAnalysisVertexingHF.h"
32 #include "AliAnalysisTaskSE.h"
33 #include "AliAnalysisTaskSEVertexingHF.h"
34
35 ClassImp(AliAnalysisTaskSEVertexingHF)
36
37
38 //________________________________________________________________________
39 AliAnalysisTaskSEVertexingHF::AliAnalysisTaskSEVertexingHF():
40 AliAnalysisTaskSE(),
41 fVHF(0),
42 fVerticesHFTClArr(0),
43 fD0toKpiTClArr(0),
44 fJPSItoEleTClArr(0),
45 fCharm3ProngTClArr(0),
46 fCharm4ProngTClArr(0)
47 {
48   // Default constructor
49 }
50
51 //________________________________________________________________________
52 AliAnalysisTaskSEVertexingHF::AliAnalysisTaskSEVertexingHF(const char *name):
53 AliAnalysisTaskSE(name),
54 fVHF(0),
55 fVerticesHFTClArr(0),
56 fD0toKpiTClArr(0),
57 fJPSItoEleTClArr(0),
58 fCharm3ProngTClArr(0),
59 fCharm4ProngTClArr(0)
60 {
61   // Default constructor
62 }
63
64 //________________________________________________________________________
65 AliAnalysisTaskSEVertexingHF::~AliAnalysisTaskSEVertexingHF()
66 {
67   // Destructor
68 }  
69
70 //________________________________________________________________________
71 void AliAnalysisTaskSEVertexingHF::Init()
72 {
73   // Initialization
74   // Instanciates vHF and loads its parameters
75
76   if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::Init() \n");
77
78   gROOT->LoadMacro("ConfigVertexingHF.C");
79
80   fVHF = (AliAnalysisVertexingHF*)gROOT->ProcessLine("ConfigVertexingHF()");  
81   fVHF->PrintStatus();
82
83   return;
84 }
85
86 //________________________________________________________________________
87 void AliAnalysisTaskSEVertexingHF::UserCreateOutputObjects()
88 {
89   // Create the output container
90   //
91   if(fDebug > 1) printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n");
92
93   if(!fVHF) {
94     printf("AnalysisTaskSEVertexingHF::UserCreateOutPutData() \n ERROR! no fvHF!\n");
95     return;
96   }
97
98   fVerticesHFTClArr = new TClonesArray("AliAODVertex", 0);
99   fVerticesHFTClArr->SetName("VerticesHF");
100   AddAODBranch("TClonesArray", &fVerticesHFTClArr);
101
102   if(fVHF->GetD0toKpi()) {
103     fD0toKpiTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
104     fD0toKpiTClArr->SetName("D0toKpi");
105     AddAODBranch("TClonesArray", &fD0toKpiTClArr);
106   }
107
108   if(fVHF->GetJPSItoEle()) {
109     fJPSItoEleTClArr = new TClonesArray("AliAODRecoDecayHF2Prong", 0);
110     fJPSItoEleTClArr->SetName("JPSItoEle");
111     AddAODBranch("TClonesArray", &fJPSItoEleTClArr);
112   }
113
114   if(fVHF->Get3Prong()) {
115     fCharm3ProngTClArr = new TClonesArray("AliAODRecoDecayHF3Prong", 0);
116     fCharm3ProngTClArr->SetName("Charm3Prong");
117     AddAODBranch("TClonesArray", &fCharm3ProngTClArr);
118   }
119
120   if(fVHF->Get4Prong()) {
121     fCharm4ProngTClArr = new TClonesArray("AliAODRecoDecayHF4Prong", 0);
122     fCharm4ProngTClArr->SetName("Charm4Prong");
123     AddAODBranch("TClonesArray", &fCharm4ProngTClArr);
124   }
125
126   return;
127 }
128
129 //________________________________________________________________________
130 void AliAnalysisTaskSEVertexingHF::UserExec(Option_t */*option*/)
131 {
132   // Execute analysis for current event:
133   // heavy flavor vertexing
134   
135   AliVEvent *event = dynamic_cast<AliVEvent*> (InputEvent());
136
137   // heavy flavor vertexing
138   fVHF->FindCandidates(event,
139                        fVerticesHFTClArr,
140                        fD0toKpiTClArr,
141                        fJPSItoEleTClArr,
142                        fCharm3ProngTClArr,
143                        fCharm4ProngTClArr);
144   
145   return;
146 }
147
148 //________________________________________________________________________
149 void AliAnalysisTaskSEVertexingHF::Terminate(Option_t */*option*/)
150 {
151   // Terminate analysis
152   //
153   if(fDebug > 1) printf("AnalysisTaskSEVertexingHF: Terminate() \n");
154 }