]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/vertexingHF/AliAODRecoDecayHF.cxx
Replaced AliInfo by AliDebug (Chiara B)
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAODRecoDecayHF.cxx
CommitLineData
3244eeed 1/**************************************************************************
2 * Copyright(c) 1998-2006, 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// Base class for AOD reconstructed heavy-flavour decay
19//
20// Author: A.Dainese, andrea.dainese@lnl.infn.it
21/////////////////////////////////////////////////////////////
22
23#include <TDatabasePDG.h>
24#include <TVector3.h>
25#include "AliAODRecoDecay.h"
26#include "AliAODRecoDecayHF.h"
ec653946 27#include "AliKFVertex.h"
28#include "AliVVertex.h"
29#include "AliESDVertex.h"
3244eeed 30
31ClassImp(AliAODRecoDecayHF)
32
33//--------------------------------------------------------------------------
34AliAODRecoDecayHF::AliAODRecoDecayHF() :
35 AliAODRecoDecay(),
36 fOwnPrimaryVtx(0x0),
460cd990 37 fEventPrimaryVtx(),
a9b75906 38 fListOfCuts(),
6185d025 39 fd0err(0x0),
40 fProngID(0x0)
3244eeed 41{
42 //
43 // Default Constructor
44 //
45}
46//--------------------------------------------------------------------------
47AliAODRecoDecayHF::AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
48 Double_t *px,Double_t *py,Double_t *pz,
49 Double_t *d0,Double_t *d0err) :
50 AliAODRecoDecay(vtx2,nprongs,charge,px,py,pz,d0),
51 fOwnPrimaryVtx(0x0),
460cd990 52 fEventPrimaryVtx(),
a9b75906 53 fListOfCuts(),
6185d025 54 fd0err(0x0),
55 fProngID(0x0)
3244eeed 56{
57 //
58 // Constructor with AliAODVertex for decay vertex
59 //
60 fd0err = new Double_t[GetNProngs()];
61 for(Int_t i=0; i<GetNProngs(); i++) fd0err[i] = d0err[i];
62}
63//--------------------------------------------------------------------------
64AliAODRecoDecayHF::AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
65 Double_t *d0,Double_t *d0err) :
66 AliAODRecoDecay(vtx2,nprongs,charge,d0),
67 fOwnPrimaryVtx(0x0),
460cd990 68 fEventPrimaryVtx(),
a9b75906 69 fListOfCuts(),
6185d025 70 fd0err(0x0),
71 fProngID(0x0)
3244eeed 72{
73 //
74 // Constructor with AliAODVertex for decay vertex and without prongs momenta
75 //
76 fd0err = new Double_t[GetNProngs()];
77 for(Int_t i=0; i<GetNProngs(); i++) fd0err[i] = d0err[i];
78}
79//--------------------------------------------------------------------------
b39168f9 80AliAODRecoDecayHF::AliAODRecoDecayHF(Double_t vtx1[3],Double_t vtx2[3],
81 Int_t nprongs,Short_t charge,
82 Double_t *px,Double_t *py,Double_t *pz,
83 Double_t *d0) :
84 AliAODRecoDecay(0x0,nprongs,charge,px,py,pz,d0),
85 fOwnPrimaryVtx(0x0),
460cd990 86 fEventPrimaryVtx(),
a9b75906 87 fListOfCuts(),
b39168f9 88 fd0err(0x0),
89 fProngID(0x0)
90{
91 //
92 // Constructor that can used for a "MC" object
93 //
94
95 fOwnPrimaryVtx = new AliAODVertex(vtx1);
96
97 AliAODVertex *vtx = new AliAODVertex(vtx2);
98 SetOwnSecondaryVtx(vtx);
99
100}
101//--------------------------------------------------------------------------
3244eeed 102AliAODRecoDecayHF::AliAODRecoDecayHF(const AliAODRecoDecayHF &source) :
103 AliAODRecoDecay(source),
0a65d33f 104 fOwnPrimaryVtx(0x0),
460cd990 105 fEventPrimaryVtx(source.fEventPrimaryVtx),
a9b75906 106 fListOfCuts(source.fListOfCuts),
6185d025 107 fd0err(0x0),
108 fProngID(0x0)
3244eeed 109{
110 //
111 // Copy constructor
112 //
0a65d33f 113 if(source.GetOwnPrimaryVtx()) fOwnPrimaryVtx = new AliAODVertex(*(source.GetOwnPrimaryVtx()));
114
3244eeed 115 if(source.GetNProngs()>0) {
116 fd0err = new Double_t[GetNProngs()];
117 memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
6185d025 118 if(source.fProngID) {
119 fProngID = new UShort_t[GetNProngs()];
120 memcpy(fProngID,source.fProngID,GetNProngs()*sizeof(UShort_t));
121 }
3244eeed 122 }
123}
124//--------------------------------------------------------------------------
125AliAODRecoDecayHF &AliAODRecoDecayHF::operator=(const AliAODRecoDecayHF &source)
126{
127 //
128 // assignment operator
129 //
130 if(&source == this) return *this;
dcb444c9 131
132 AliAODRecoDecay::operator=(source);
133
460cd990 134 fEventPrimaryVtx = source.fEventPrimaryVtx;
a9b75906 135 fListOfCuts = source.fListOfCuts;
460cd990 136
0a65d33f 137 if(source.GetOwnPrimaryVtx()) fOwnPrimaryVtx = new AliAODVertex(*(source.GetOwnPrimaryVtx()));
138
3244eeed 139 if(source.GetNProngs()>0) {
3244eeed 140 fd0err = new Double_t[GetNProngs()];
3244eeed 141 memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
6185d025 142 if(source.fProngID) {
143 fProngID = new UShort_t[GetNProngs()];
144 memcpy(fProngID,source.fProngID,GetNProngs()*sizeof(UShort_t));
145 }
3244eeed 146 }
147 return *this;
148}
149//--------------------------------------------------------------------------
150AliAODRecoDecayHF::~AliAODRecoDecayHF() {
151 //
152 // Default Destructor
153 //
154 if(fOwnPrimaryVtx) delete fOwnPrimaryVtx;
155 if(fd0err) delete [] fd0err;
6185d025 156 if(fProngID) delete [] fProngID;
3244eeed 157}
158//---------------------------------------------------------------------------
ec653946 159AliKFParticle *AliAODRecoDecayHF::ApplyVertexingKF(Int_t *iprongs,Int_t nprongs,Int_t *pdgs,Bool_t topoCostraint, Double_t bzkG, Double_t *mass) const {
160 //
161 // Applies the KF vertexer
162 // Int_t iprongs[nprongs] = indices of the prongs to be used from the vertexer
163 // Int_t pdgs[nprongs] = pdgs assigned to the prongs, needed to define the AliKFParticle
164 // Bool_t topoCostraint = if kTRUE, the topological constraint is applied
165 // Double_t bzkG = magnetic field
166 // Double_t mass[2] = {mass, sigma} for the mass constraint (if mass[0]>0 the constraint is applied).
167 //
168
169 AliKFParticle::SetField(bzkG);
170 AliKFParticle *vertexKF=0;
171
172 AliKFVertex copyKF;
173 Int_t nt=0,ntcheck=0;
174
175 Double_t pos[3]={0.,0.,0.};
176 if(!fOwnPrimaryVtx) {
177 printf("AliAODRecoDecayHF::ApplyVertexingKF(): cannot apply because primary vertex is not found\n");
178 return vertexKF;
179 }
180 fOwnPrimaryVtx->GetXYZ(pos);
181 Int_t contr=fOwnPrimaryVtx->GetNContributors();
182 Double_t covmatrix[6]={0.,0.,0.,0.,0.,0.};
183 fOwnPrimaryVtx->GetCovarianceMatrix(covmatrix);
184 Double_t chi2=fOwnPrimaryVtx->GetChi2();
185 AliESDVertex primaryVtx2(pos,covmatrix,chi2,contr,"Vertex");
186
187
188 if(topoCostraint){
189 copyKF=AliKFVertex(primaryVtx2);
190 nt=primaryVtx2.GetNContributors();
191 ntcheck=nt;
192 }
193
194 vertexKF = new AliKFParticle();
195 for(Int_t i= 0;i<nprongs;i++){
196 Int_t ipr=iprongs[i];
197 AliAODTrack *aodTrack = (AliAODTrack*)GetDaughter(ipr);
198 if(!aodTrack) {
199 printf("AliAODRecoDecayHF::ApplyVertexingKF(): no daughters available\n");
200 delete vertexKF; vertexKF=NULL;
201 return vertexKF;
202 }
203 AliKFParticle daughterKF(*aodTrack,pdgs[i]);
204 vertexKF->AddDaughter(daughterKF);
205
206 if(topoCostraint && nt>0){
207 //Int_t index=(Int_t)GetProngID(ipr);
208 if(!aodTrack->GetUsedForPrimVtxFit()) continue;
209 copyKF -= daughterKF;
210 ntcheck--;
211 }
212 }
213
214 if(topoCostraint){
215 if(ntcheck>0) {
216 copyKF += (*vertexKF);
217 vertexKF->SetProductionVertex(copyKF);
218 }
219 }
220
221 if(mass[0]>0.){
222 vertexKF->SetMassConstraint(mass[0],mass[1]);
223 }
224
225 return vertexKF;
226}