]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliAODv0.cxx
OnFlyStatus added (B. Hyppolyte)
[u/mrichter/AliRoot.git] / STEER / AliAODv0.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 //     Analysis Oriented Data (AOD) V0 vertex class
18 //     Authors: B.Hippolyte, IReS, hippolyt@in2p3.fr 
19 //              G.Van Buren, BNL,  gene@bnl.gov      (original STAR MuDsts)
20 //-------------------------------------------------------------------------
21
22 //#include "AliESDEvent.h"
23 //#include "AliESDv0.h"
24
25 #include "AliAODv0.h"
26
27 //#include "AliAODTrack.h"
28
29 ClassImp(AliAODv0)
30
31   AliAODv0::AliAODv0() : 
32     AliAODRecoDecay(),
33     fDcaV0ToPrimVertex(999),
34     fOnFlyStatus(kFALSE)
35 {
36   //--------------------------------------------------------------------
37   // Default constructor
38   //--------------------------------------------------------------------
39   fCharge  = 0;
40   fNProngs = 2;
41   fNDCA    = 1;
42   fNPID    = 0; // used to be 2!
43
44   fDCA = new Double_t[fNDCA];
45   fDCA[0] = 999;
46
47   fPx = new Double_t[GetNProngs()];
48   fPy = new Double_t[GetNProngs()];
49   fPz = new Double_t[GetNProngs()];
50   fPx[0] = 999;
51   fPy[0] = 999;
52   fPz[0] = 999;
53
54   fPx[1] = 999;
55   fPy[1] = 999;
56   fPz[1] = 999;
57
58   fd0 = new Double_t[GetNProngs()];
59   fd0[0] = 999;
60   fd0[1] = 999;
61 }
62
63 //AliAODv0::AliAODv0(AliESDv0* rV0Vertex ,AliESDEvent* rEvent) :
64 //  AliAODRecoDecay(),
65 //  fDcaV0ToPrimVertex(999)
66 //{
67   //--------------------------------------------------------------------
68   // Constructor via fill to be removed eventually
69   //--------------------------------------------------------------------
70 //  fCharge  = 0;
71 //  fNProngs = 2;
72 //  fNDCA    = 1;
73 //  fNPID    = 2;
74
75 //  fDCA = new Double_t[fNDCA];
76
77 //   fPx = new Double_t[GetNProngs()];
78 //   fPy = new Double_t[GetNProngs()];
79 //   fPz = new Double_t[GetNProngs()];
80
81 //   fd0 = new Double_t[GetNProngs()];
82
83 //   this->Fill(rV0Vertex,rEvent);
84 // }
85
86 AliAODv0::AliAODv0(AliAODVertex* rAODVertex, Double_t rDcaV0Daughters, Double_t rDcaV0ToPrimVertex,
87            Double_t *rMomPos, Double_t *rMomNeg, Double_t *rDcaDaughterToPrimVertex) :
88   AliAODRecoDecay(rAODVertex,2,0,rDcaDaughterToPrimVertex),
89   fDcaV0ToPrimVertex(rDcaV0ToPrimVertex),
90   fOnFlyStatus(kFALSE)
91 {
92   //--------------------------------------------------------------------
93   // Constructor via setting each data member
94   //--------------------------------------------------------------------
95   fCharge  = 0;
96   fNProngs = 2;
97   fNDCA    = 1;
98   fNPID    = 0; // used to be 2!
99
100   fDCA = new Double_t[fNDCA];
101
102   fDCA[0] = rDcaV0Daughters;
103   fDcaV0ToPrimVertex = rDcaV0ToPrimVertex;
104
105   fPx = new Double_t[GetNProngs()];
106   fPy = new Double_t[GetNProngs()];
107   fPz = new Double_t[GetNProngs()];
108
109   fPx[0] = rMomPos[0] ;
110   fPy[0] = rMomPos[1];
111   fPz[0] = rMomPos[2];
112
113   fPx[1] = rMomNeg[0];
114   fPy[1] = rMomNeg[1];
115   fPz[1] = rMomNeg[2];
116 }
117
118 AliAODv0::AliAODv0(const AliAODv0& rAliAODv0) :
119   AliAODRecoDecay(rAliAODv0),
120   fDcaV0ToPrimVertex(rAliAODv0.fDcaV0ToPrimVertex),
121   fOnFlyStatus(rAliAODv0.fOnFlyStatus)
122  {
123   //--------------------------------------------------------------------
124   // Copy constructor
125   //--------------------------------------------------------------------
126 }
127
128 AliAODv0& AliAODv0::operator=(const AliAODv0& rAliAODv0){
129   //--------------------------------------------------------------------
130   // Assignment overload
131   //--------------------------------------------------------------------
132   this->fDcaV0ToPrimVertex  = rAliAODv0.fDcaV0ToPrimVertex ;
133   this->fOnFlyStatus        = rAliAODv0.fOnFlyStatus;
134   return *this;
135 }
136
137 AliAODv0::~AliAODv0(){
138   //--------------------------------------------------------------------
139   // Empty destructor
140   //--------------------------------------------------------------------
141 }
142
143
144 // void AliAODv0::Fill(AliESDv0* rV0Vertex ,AliESDEvent* rEvent){
145
146 //   Double_t tDecayVertexV0[3]; rV0Vertex->GetXYZ(tDecayVertexV0[0],tDecayVertexV0[1],tDecayVertexV0[2]); 
147 //   GetSecondaryVtx()->SetX(tDecayVertexV0[0]);
148 //   GetSecondaryVtx()->SetY(tDecayVertexV0[1]);
149 //   GetSecondaryVtx()->SetZ(tDecayVertexV0[2]);
150
151 //   Double_t lCovVtx[6];
152 //   rV0Vertex->GetPosCov(lCovVtx);
153 //   GetSecondaryVtx()->SetCovMatrix(lCovVtx);
154
155 //   GetSecondaryVtx()->SetChi2perNDF(rV0Vertex->GetChi2V0());
156 //   GetSecondaryVtx()->SetType(AliAODVertex::kV0);
157
158 //   UInt_t lKeyPos = (UInt_t)TMath::Abs(rV0Vertex->GetPindex());// need to ask why Abs
159 //   UInt_t lKeyNeg = (UInt_t)TMath::Abs(rV0Vertex->GetNindex());
160 //   GetSecondaryVtx()->AddDaughter(rEvent->GetTrack(lKeyPos));
161 //   GetSecondaryVtx()->AddDaughter(rEvent->GetTrack(lKeyNeg));
162
163 //   fDCA[0] = rV0Vertex->GetDcaV0Daughters();
164 //   fDcaV0ToPrimVertex = rV0Vertex->GetD();
165
166 //   Double_t tMomPos[3]; rV0Vertex->GetPPxPyPz(tMomPos[0],tMomPos[1],tMomPos[2]); 
167 //   fPx[0] = tMomPos[0];
168 //   fPy[0] = tMomPos[1];
169 //   fPz[0] = tMomPos[2];
170
171 //   Double_t tMomNeg[3]; rV0Vertex->GetNPxPyPz(tMomNeg[0],tMomNeg[1],tMomNeg[2]); 
172 //   fPx[1] = tMomNeg[0];
173 //   fPy[1] = tMomNeg[1];
174 //   fPz[1] = tMomNeg[2];
175
176 //   AliESDtrack *pTrack=rEvent->GetTrack(lKeyPos);
177 //   AliESDtrack *nTrack=rEvent->GetTrack(lKeyNeg);
178
179 //   Float_t tDcaPosToPrimVertex[2];
180 //   if(pTrack) pTrack->GetImpactParameters(tDcaPosToPrimVertex[0],tDcaPosToPrimVertex[1]);
181 //   else { tDcaPosToPrimVertex[0]=999.;  tDcaPosToPrimVertex[1]=999.;}
182 //   fd0[0] = TMath::Sqrt(tDcaPosToPrimVertex[0]*tDcaPosToPrimVertex[0]+tDcaPosToPrimVertex[1]*tDcaPosToPrimVertex[1]);
183
184 //   Float_t tDcaNegToPrimVertex[2];
185 //   if(nTrack) nTrack->GetImpactParameters(tDcaNegToPrimVertex[0],tDcaNegToPrimVertex[1]);
186 //   else { tDcaNegToPrimVertex[0]=999.;  tDcaNegToPrimVertex[1]=999.;}
187
188 //   fd0[1] = TMath::Sqrt(tDcaNegToPrimVertex[0]*tDcaNegToPrimVertex[0]+tDcaNegToPrimVertex[1]*tDcaNegToPrimVertex[1]);
189 // }
190
191 void AliAODv0::Fill(AliAODVertex *rAODVertex, Double_t rDcaV0Daughters, Double_t rDcaV0ToPrimVertex,
192                     Double_t *rMomPos, Double_t *rMomNeg, Double_t *rDcaDaughterToPrimVertex){
193
194   this->SetSecondaryVtx(rAODVertex);
195
196   fDCA[0] = rDcaV0Daughters;
197   fDcaV0ToPrimVertex = rDcaV0ToPrimVertex;
198
199   fPx[0] = rMomPos[0] ;
200   fPy[0] = rMomPos[1];
201   fPz[0] = rMomPos[2];
202
203   fPx[1] = rMomNeg[0];
204   fPy[1] = rMomNeg[1];
205   fPz[1] = rMomNeg[2];
206
207   fd0[0] = rDcaDaughterToPrimVertex[0];
208   fd0[1] = rDcaDaughterToPrimVertex[1];
209 }
210
211 void AliAODv0::ResetV0(){
212
213   GetSecondaryVtx()->SetX(999);
214   GetSecondaryVtx()->SetY(999);
215   GetSecondaryVtx()->SetZ(999);
216   GetSecondaryVtx()->SetChi2perNDF(999);
217   GetSecondaryVtx()->SetType(AliAODVertex::kUndef);
218
219   Int_t lNumDaughters = GetSecondaryVtx()->GetNDaughters();
220   for(Int_t iDaughterIndex = 0; iDaughterIndex<lNumDaughters;iDaughterIndex++)
221     GetSecondaryVtx()->RemoveDaughter(GetSecondaryVtx()->GetDaughter(iDaughterIndex));
222
223   fDCA[0] = 999;
224   fDcaV0ToPrimVertex  = 999;
225
226   fPx[0] = 999;
227   fPy[0] = 999;
228   fPz[0] = 999;
229
230   fPx[1] = 999;
231   fPy[1] = 999;
232   fPz[1] = 999;
233
234   fd0[0] = 999;
235   fd0[1] = 999;
236 }
237
238 void AliAODv0::Print(Option_t* /*option*/) const {
239   //
240   // Print some information
241   //
242   AliAODRecoDecay::Print();
243   printf("AliAODv0: invariant mass (k0s %.6f, lambda %.6f, anti-lambda %.6f) \n",MassK0Short(),MassLambda(),MassAntiLambda());
244   printf("AliAODv0: dca (v0d %.6f, v0tpv %.6f, postpv %.6f, negtpv %.6f ) \n",DcaV0Daughters(),DcaV0ToPrimVertex(),DcaPosToPrimVertex(),DcaNegToPrimVertex());
245   printf("AliAODv0: mom (ptot2 %.6f, pt2 %.6f, rapk0 %.6f, rapla %.6f ) \n",Ptot2V0(),Pt2V0(),RapK0Short(),RapLambda());
246   printf("AliAODv0: cin (mpav0 %.6f, mnav0 %.6f, alpha %.6f, ptarm %.6f ) \n",MomPosAlongV0(),MomNegAlongV0(),AlphaV0(),PtArmV0());
247   printf("AliAODv0: nrg (eppro %.6f, enpro %.6f, eppio %.6f, enpio %.6f ) \n",EPosProton(),ENegProton(),EPosPion(),ENegPion());
248
249   return;
250 }