]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/vertexingHF/AliAODRecoDecayHF.cxx
Bug fix
[u/mrichter/AliRoot.git] / PWG3 / vertexingHF / AliAODRecoDecayHF.cxx
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"
27
28 ClassImp(AliAODRecoDecayHF)
29
30 //--------------------------------------------------------------------------
31 AliAODRecoDecayHF::AliAODRecoDecayHF() :
32   AliAODRecoDecay(),
33   fOwnPrimaryVtx(0x0),
34   fEventPrimaryVtx(),
35   fd0err(0x0), 
36   fProngID(0x0) 
37 {
38   //
39   // Default Constructor
40   //
41 }
42 //--------------------------------------------------------------------------
43 AliAODRecoDecayHF::AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
44                                      Double_t *px,Double_t *py,Double_t *pz,
45                                      Double_t *d0,Double_t *d0err) :
46   AliAODRecoDecay(vtx2,nprongs,charge,px,py,pz,d0),
47   fOwnPrimaryVtx(0x0),
48   fEventPrimaryVtx(),
49   fd0err(0x0),
50   fProngID(0x0) 
51 {
52   //
53   // Constructor with AliAODVertex for decay vertex
54   //
55   fd0err = new Double_t[GetNProngs()];
56   for(Int_t i=0; i<GetNProngs(); i++) fd0err[i] = d0err[i];
57 }
58 //--------------------------------------------------------------------------
59 AliAODRecoDecayHF::AliAODRecoDecayHF(AliAODVertex *vtx2,Int_t nprongs,Short_t charge,
60                                      Double_t *d0,Double_t *d0err) :
61   AliAODRecoDecay(vtx2,nprongs,charge,d0),
62   fOwnPrimaryVtx(0x0),
63   fEventPrimaryVtx(),
64   fd0err(0x0),
65   fProngID(0x0) 
66 {
67   //
68   // Constructor with AliAODVertex for decay vertex and without prongs momenta
69   //
70   fd0err = new Double_t[GetNProngs()];
71   for(Int_t i=0; i<GetNProngs(); i++) fd0err[i] = d0err[i];
72 }
73 //--------------------------------------------------------------------------
74 AliAODRecoDecayHF::AliAODRecoDecayHF(Double_t vtx1[3],Double_t vtx2[3],
75                                      Int_t nprongs,Short_t charge,
76                                      Double_t *px,Double_t *py,Double_t *pz,
77                                      Double_t *d0) :
78   AliAODRecoDecay(0x0,nprongs,charge,px,py,pz,d0),
79   fOwnPrimaryVtx(0x0),
80   fEventPrimaryVtx(),
81   fd0err(0x0),
82   fProngID(0x0) 
83 {
84   //
85   // Constructor that can used for a "MC" object
86   //
87
88   fOwnPrimaryVtx = new AliAODVertex(vtx1);
89
90   AliAODVertex *vtx = new AliAODVertex(vtx2);
91   SetOwnSecondaryVtx(vtx);
92
93 }
94 //--------------------------------------------------------------------------
95 AliAODRecoDecayHF::AliAODRecoDecayHF(const AliAODRecoDecayHF &source) :
96   AliAODRecoDecay(source),
97   fOwnPrimaryVtx(0x0),
98   fEventPrimaryVtx(source.fEventPrimaryVtx),
99   fd0err(0x0),
100   fProngID(0x0)
101 {
102   //
103   // Copy constructor
104   //
105   if(source.GetOwnPrimaryVtx()) fOwnPrimaryVtx = new AliAODVertex(*(source.GetOwnPrimaryVtx()));
106
107   if(source.GetNProngs()>0) {
108     fd0err = new Double_t[GetNProngs()];
109     memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
110     if(source.fProngID) {
111       fProngID = new UShort_t[GetNProngs()];
112       memcpy(fProngID,source.fProngID,GetNProngs()*sizeof(UShort_t));
113     }
114   }
115 }
116 //--------------------------------------------------------------------------
117 AliAODRecoDecayHF &AliAODRecoDecayHF::operator=(const AliAODRecoDecayHF &source)
118 {
119   //
120   // assignment operator
121   //
122   if(&source == this) return *this;
123
124   AliAODRecoDecay::operator=(source);
125
126   fEventPrimaryVtx = source.fEventPrimaryVtx;
127
128   if(source.GetOwnPrimaryVtx()) fOwnPrimaryVtx = new AliAODVertex(*(source.GetOwnPrimaryVtx()));
129
130   if(source.GetNProngs()>0) {
131     fd0err = new Double_t[GetNProngs()];
132     memcpy(fd0err,source.fd0err,GetNProngs()*sizeof(Double_t));
133     if(source.fProngID) {
134       fProngID = new UShort_t[GetNProngs()];
135       memcpy(fProngID,source.fProngID,GetNProngs()*sizeof(UShort_t));
136     }
137   }
138   return *this;
139 }
140 //--------------------------------------------------------------------------
141 AliAODRecoDecayHF::~AliAODRecoDecayHF() {
142   //  
143   // Default Destructor
144   //
145   if(fOwnPrimaryVtx) delete fOwnPrimaryVtx;
146   if(fd0err) delete [] fd0err;
147   if(fProngID) delete [] fProngID;
148 }
149 //---------------------------------------------------------------------------