]> git.uio.no Git - u/mrichter/AliRoot.git/blob - STEER/AliAODcascade.cxx
Added methods to set/get centrailty from clusters in outer layer, which is less noisy...
[u/mrichter/AliRoot.git] / STEER / AliAODcascade.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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 //     Implementation of the Analysis Oriented Data (AOD) Xi vertex class
18 //     Origin: A.Maire, IReS, antonin.maire@ires.in2p3.fr 
19 //             G.Van Buren, BNL,  gene@bnl.gov      (original STAR MuDsts)
20 //
21 //     Purpose: Having physics observables available for Xis
22 //-------------------------------------------------------------------------
23
24 #include <TVector3.h>
25 #include <TMath.h>
26 #include <TDatabasePDG.h>
27
28 #include "AliAODcascade.h"
29 #include "AliAODTrack.h"
30
31 ClassImp(AliAODcascade)
32
33
34 AliAODcascade::AliAODcascade() : 
35   AliAODv0(),
36      
37   fDecayVertexXi(0x0),
38   fChargeXi(0),
39
40   fDcaXiDaughters(999),
41   fDcaXiToPrimVertex(999),
42   fDcaBachToPrimVertex(999),
43   
44   fMomBachX(999),
45   fMomBachY(999),
46   fMomBachZ(999)
47    
48 {
49   //--------------------------------------------------------------------
50   // Default constructor
51   //--------------------------------------------------------------------
52  
53 }
54
55
56
57 AliAODcascade::AliAODcascade(const AliAODcascade& rSource) : 
58    AliAODv0( rSource ),
59   
60   fDecayVertexXi( rSource.fDecayVertexXi ),
61   fChargeXi(      rSource.fChargeXi ),
62   
63   fDcaXiDaughters(      rSource.fDcaXiDaughters ),
64   fDcaXiToPrimVertex(   rSource.fDcaXiToPrimVertex ),
65   fDcaBachToPrimVertex( rSource.fDcaBachToPrimVertex ),
66   
67   fMomBachX( rSource.fMomBachX ),
68   fMomBachY( rSource.fMomBachY ),
69   fMomBachZ( rSource.fMomBachZ )
70   
71 {
72   //--------------------------------------------------------------------
73   // Copy constructor
74   //--------------------------------------------------------------------
75   
76 }
77
78
79
80 AliAODcascade::AliAODcascade( AliAODVertex* rAODVertexXi, 
81                       Int_t         rChargeXi,
82                       Double_t      rDcaXiDaughters,
83                       Double_t      rDcaXiToPrimVertex,
84                       Double_t      rDcaBachToPrimVertex,
85                 const Double_t*     rMomBach,
86                 
87                               AliAODVertex* rAODVertexV0,
88                       Double_t rDcaV0Daughters,
89                       Double_t rDcaV0ToPrimVertex,
90                 const Double_t *rMomPos,
91                 const Double_t *rMomNeg,
92                       Double_t *rDcaDaughterToPrimVertex
93                 ) :
94   AliAODv0(rAODVertexV0, rDcaV0Daughters, rDcaV0ToPrimVertex, rMomPos, rMomNeg, rDcaDaughterToPrimVertex),
95   fDecayVertexXi( rAODVertexXi ),
96   fChargeXi( rChargeXi ),    
97   fDcaXiDaughters( rDcaXiDaughters ),     
98   fDcaXiToPrimVertex( rDcaXiToPrimVertex ),
99   fDcaBachToPrimVertex( rDcaBachToPrimVertex ),
100   fMomBachX( rMomBach[0] ),          
101   fMomBachY( rMomBach[1] ),      
102   fMomBachZ( rMomBach[2] )  
103 {
104   //--------------------------------------------------------------------
105   // Constructor via setting each data member
106   //--------------------------------------------------------------------
107  
108 }
109
110
111
112
113 AliAODcascade::AliAODcascade( AliAODVertex* rAODVertexXi,  
114                       Int_t         rChargeXi,
115                       Double_t      rDcaXiDaughters,
116                       Double_t      rDcaXiToPrimVertex,
117                       Double_t      rDcaBachToPrimVertex,
118                 const Double_t*     rMomBach,
119                 const AliAODv0&     rAODv0 ) :
120   AliAODv0(rAODv0),
121   fDecayVertexXi(rAODVertexXi),
122   fChargeXi( rChargeXi ),    
123   fDcaXiDaughters( rDcaXiDaughters ),     
124   fDcaXiToPrimVertex( rDcaXiToPrimVertex ),
125   fDcaBachToPrimVertex( rDcaBachToPrimVertex ),
126   fMomBachX( rMomBach[0] ),          
127   fMomBachY( rMomBach[1] ),      
128   fMomBachZ( rMomBach[2] )
129 {
130   //--------------------------------------------------------------------
131   // Constructor via setting each Xi data member + setting AODv0 
132   //--------------------------------------------------------------------
133  
134 }
135
136
137
138
139
140 AliAODcascade& AliAODcascade::operator=(const AliAODcascade& rSource){
141   //--------------------------------------------------------------------
142   // Assignment overload
143   //--------------------------------------------------------------------
144   
145   if (this == &rSource) return *this;
146      
147   AliAODv0::operator=(rSource);
148   
149   this->fDecayVertexXi       = rSource.fDecayVertexXi;
150   this->fChargeXi            = rSource.fChargeXi;
151
152   this->fDcaXiDaughters      = rSource.fDcaXiDaughters;
153   this->fDcaXiToPrimVertex   = rSource.fDcaXiToPrimVertex;
154   this->fDcaBachToPrimVertex = rSource.fDcaBachToPrimVertex;
155
156   this->fMomBachX            = rSource.fMomBachX;
157   this->fMomBachY            = rSource.fMomBachY;
158   this->fMomBachZ            = rSource.fMomBachZ;
159   
160   return *this;
161 }
162
163
164
165 AliAODcascade::~AliAODcascade(){
166   //--------------------------------------------------------------------
167   // Empty destructor
168   //--------------------------------------------------------------------
169 }
170
171 void  AliAODcascade::Fill(AliAODVertex* rAODVertexXi, 
172                       Int_t         rChargeXi,
173                       Double_t      rDcaXiDaughters,
174                       Double_t      rDcaXiToPrimVertex,
175                       Double_t      rDcaBachToPrimVertex,
176                 const Double_t*     rMomBach,
177                 
178                       AliAODVertex* rAODVertexV0,
179                       Double_t      rDcaV0Daughters,
180                       Double_t      rDcaV0ToPrimVertex,
181                 const Double_t*     rMomPos,
182                 const Double_t*     rMomNeg,
183                       Double_t*     rDcaDaughterToPrimVertex )
184 {
185   //--------------------------------------------------------------------
186   //  Fill the AODcascade
187   //--------------------------------------------------------------------
188
189   AliAODv0::Fill(rAODVertexV0,rDcaV0Daughters,rDcaV0ToPrimVertex,rMomPos,rMomNeg,rDcaDaughterToPrimVertex);
190       fDecayVertexXi =  rAODVertexXi;
191       fChargeXi      =  rChargeXi;
192
193       fDcaXiDaughters       = rDcaXiDaughters;   
194       fDcaXiToPrimVertex    = rDcaXiToPrimVertex;   
195       fDcaBachToPrimVertex  = rDcaBachToPrimVertex;
196
197       fMomBachX = rMomBach[0];   
198       fMomBachY = rMomBach[1];          
199       fMomBachZ = rMomBach[2];        
200 }                
201
202
203
204 void AliAODcascade::ResetXi(){
205   //--------------------------------------------------------------------
206   // Reset the values of the AOD data members to the default ones
207   //--------------------------------------------------------------------
208   
209   ResetV0();
210       
211   GetDecayVertexXi()->SetChi2perNDF(-999);
212   GetDecayVertexXi()->RemoveCovMatrix();              
213   GetDecayVertexXi()->RemoveDaughters();               
214   GetDecayVertexXi()->SetID(-1);                      
215   GetDecayVertexXi()->SetParent((TObject*) 0x0);      
216   GetDecayVertexXi()->SetPosition(-999, -999, -999);
217   GetDecayVertexXi()->SetType( AliAODVertex::kUndef );
218
219   fChargeXi = 0;
220   
221   fDcaXiDaughters = 999;
222   fDcaXiToPrimVertex = 999;
223   fDcaBachToPrimVertex = 999;
224   
225   fMomBachX = 999;
226   fMomBachY = 999;
227   fMomBachZ = 999;
228   
229   
230 }
231
232 void AliAODcascade::PrintXi(const Double_t& rPrimVtxX, 
233                             const Double_t& rPrimVtxY, 
234                             const Double_t& rPrimVtxZ) const
235 {
236   //--------------------------------------------------------------------
237   // Print the AOD data members
238   //--------------------------------------------------------------------
239    AliAODv0::Print();  
240    printf("- \n");
241    printf("AliAODcascade : posXiVtx (%.6f, %.6f, %.6f) \n", DecayVertexXiX(), DecayVertexXiY(), DecayVertexXiZ() );
242    printf("AliAODcascade : chargeXi =   %d \n", ChargeXi() );   
243    printf("AliAODcascade : dca (bachtpv %.6f, xid %.6f, xitpv-calc %.6f, xitpv-mb %.6f) \n",
244                      DcaBachToPrimVertex(), 
245                      DcaXiDaughters(), 
246                      DcaXiToPrimVertex( rPrimVtxX, rPrimVtxY, rPrimVtxZ),
247                      DcaXiToPrimVertex()  );
248    printf("AliAODcascade : cos(PtgAngle Xi) =     %.6f \n", CosPointingAngleXi(rPrimVtxX, rPrimVtxY, rPrimVtxZ) );
249    
250      
251    printf("AliAODcascade : posVtxXI  (x  %.6f, y  %.6f, z  %.6f) \n", DecayVertexXiX(),DecayVertexXiY(),DecayVertexXiZ() );
252    printf("AliAODcascade : decaylgth (V0 %.6f, Xi %.6f) \n", DecayLengthV0(),DecayLengthXi(rPrimVtxX, rPrimVtxY, rPrimVtxZ) );
253    printf("AliAODcascade : momBach   (px %.6f, py %.6f, pz %.6f, ptot2 %.6f) \n",  
254                       MomBachX(), 
255                       MomBachY(), 
256                       MomBachZ(),
257                       Ptot2Bach() );
258    printf("AliAODcascade : momXi     (px %.6f, py %.6f, pz %.6f, ptot2 %.6f, pt2 %.6f) \n", 
259                       MomXiX(), 
260                       MomXiY(),
261                       MomXiZ(),
262                       Ptot2Xi(),
263                       Pt2Xi()   );
264    printf("AliAODcascade :  momAlongXi  (Bach     %.6f, V0 %.6f) \n", MomBachAlongXi(), MomV0AlongXi() );
265    printf("AliAODcascade :  cin (alphaXi %.6f, PtArmXi     %.6f) \n", AlphaXi(), PtArmXi() );
266    printf("AliAODcascade :  rap (Xi      %.6f, Omega       %.6f) \n", RapXi(),RapOmega() );
267    printf("AliAODcascade :  nrg (BachPi  %.6f, BachK-      %.6f, Omega %.6f, Xi  %.6f ) \n", 
268                       EBachPion(), 
269                       EBachKaon(), 
270                       EOmega(),
271                       EXi() );
272    printf("AliAODcascade : inv mass (Xi  %.6f, Omega       %.6f) \n",  MassXi(), MassOmega()  );
273    printf("- \n");
274    // Methods Not printed =  GetBachID(),  Chi2Xi()
275  
276  
277 }
278
279 Double_t AliAODcascade::CosPointingAngleXi(const Double_t& rPrimVtxX, 
280                                            const Double_t& rPrimVtxY, 
281                                            const Double_t& rPrimVtxZ) const { 
282  
283   // Cosine of Xi pointing angle in 3D space, with respect to a point 
284   // (primary vtx ...)
285   
286   TVector3 lMomXi( MomXiX(),MomXiY(),MomXiZ() );
287   TVector3 lVectPrimVtxToXi(DecayVertexXiX() - rPrimVtxX,
288                             DecayVertexXiY() - rPrimVtxY,
289                             DecayVertexXiZ() - rPrimVtxZ);
290                 
291   Double_t lPtgAngle = lMomXi.Angle(lVectPrimVtxToXi);
292
293   return TMath::Cos(lPtgAngle); 
294
295 }
296
297 Double_t AliAODcascade::DcaXiToPrimVertex(const Double_t& rPrimVtxX, 
298                                           const Double_t& rPrimVtxY, 
299                                           const Double_t& rPrimVtxZ) const {
300   //
301   // Compute the DCA between this Xi and the primary vertex
302   //
303     Double_t rMomXiX = MomXiX();
304     Double_t rMomXiY = MomXiY();
305     Double_t rMomXiZ = MomXiZ();
306     Double_t dx = (rPrimVtxY- DecayVertexXiY() )*rMomXiZ - (rPrimVtxZ- DecayVertexXiZ() )*rMomXiY; 
307     Double_t dy = (rPrimVtxZ- DecayVertexXiZ() )*rMomXiX - (rPrimVtxX- DecayVertexXiX() )*rMomXiZ;
308     Double_t dz = (rPrimVtxX- DecayVertexXiX() )*rMomXiY - (rPrimVtxY- DecayVertexXiY() )*rMomXiX;
309   return TMath::Sqrt((dx*dx+dy*dy+dz*dz)/ Ptot2Xi() );
310 }
311
312 Int_t   AliAODcascade::GetBachID()  const     {
313   //
314   // Return the ID of the bachelor
315   //
316
317         if( GetDecayVertexXi() == 0) return -1;
318
319         AliAODTrack *rBachTrack = (AliAODTrack *) ( GetDecayVertexXi()->GetDaughter(0) );
320         // The fDecayVertexXi should just have one stored daughter. To be managed within the AliAnalysisTaskESDFilter
321         Short_t rBachId = rBachTrack->GetID();
322         return rBachId;
323 }
324
325 Double_t AliAODcascade::EBachPion() const {
326   static Double_t lMassPi = TDatabasePDG::Instance()->GetParticle("pi-")->Mass();
327   return ::sqrt(Ptot2Bach() + lMassPi*lMassPi);
328 }
329
330 Double_t AliAODcascade::EBachKaon() const {
331   static Double_t lMassKaon = TDatabasePDG::Instance()->GetParticle("K-")->Mass();
332   return ::sqrt(Ptot2Bach() + lMassKaon*lMassKaon);
333 }
334
335 Double_t AliAODcascade::EXi() const {
336   static Double_t lMassXi = TDatabasePDG::Instance()->GetParticle("Xi-")->Mass();
337   return ::sqrt(Ptot2Xi() + lMassXi*lMassXi);
338 }
339
340 Double_t AliAODcascade::EOmega() const {
341   static Double_t lMassOmega = TDatabasePDG::Instance()->GetParticle("Omega-")->Mass();
342   return ::sqrt(Ptot2Xi() + lMassOmega*lMassOmega);
343 }