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