]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowV0.cxx
First CVS version of the flow analysis code (Emanuele)
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowV0.cxx
1 //////////////////////////////////////////////////////////////////////
2 //
3 // $Id$
4 //
5 // Author: Emanuele Simili
6 //
7 //////////////////////////////////////////////////////////////////////
8 //_____________________________________________________________
9 //
10 // Description: 
11 //         an array of AliFlowV0 is part of the AliFlowEvent, 
12 // The object AliFlowV0 contains data members wich summarize the V0s 
13 // information most useful for flow study (Pt, eta, phi, ecc.). 
14 // AliFlowV0 also contains a references to the two daughter tracks
15 // in the TrackClollection() of the AliFlowEvent from wich the V0 has 
16 // been reconstructed.
17 //
18
19 #include "AliFlowV0.h"
20 #include "AliFlowConstants.h"
21 #include <iostream>
22 using namespace std; //required for resolving the 'cout' symbol
23
24 ClassImp(AliFlowV0) ;
25 //////////////////////////////////////////////////////////////////////////////
26 AliFlowV0::AliFlowV0()
27 {
28  // default constructor  
29  
30  fPhi = 0. ;
31  fEta = 0. ;
32  fPt = 0. ;
33  fChi2 = 0. ;
34  fMass = 0. ;                   
35  fDca = 0. ;
36  fCrossDCA = 0. ;
37  fSigma = 1. ;
38  fLabel = 0 ;
39  for(Int_t dd=0;dd<3;dd++) { fCrossPoint[dd] = 0. ; }
40  for(Int_t dd=0;dd<2;dd++) { fDaughters[dd] = 0  ; }
41 }
42 //////////////////////////////////////////////////////////////////////////////
43 AliFlowV0::AliFlowV0(const Char_t* name) 
44 {
45  // TNamed constructor 
46  
47  SetName(name) ;
48  AliFlowV0() ;
49 }
50 //////////////////////////////////////////////////////////////////////////////
51 AliFlowV0::~AliFlowV0() 
52 {
53  // default destructor (dummy)
54 }
55 //////////////////////////////////////////////////////////////////////////////
56
57 //////////////////////////////////////////////////////////////////////////////
58 Float_t  AliFlowV0::P() const 
59
60  // Returns the reconstructed momentum of the v0
61
62  float momentum = Pt()/TMath::Sqrt(1-(tanh(Eta())*tanh(Eta()))) ; 
63  return momentum; 
64 }
65 //////////////////////////////////////////////////////////////////////////////
66 Float_t  AliFlowV0::Y() const 
67 {
68  // Rapidity of the v0
69
70  if(TMath::Abs((Float_t)P()) == TMath::Abs((Float_t)Pt()))      { return 0. ; }
71  else if(TMath::Abs((Float_t)P()) < TMath::Abs((Float_t)Pt()))  { cout << "v0: " << GetName() << "has  Pt() > P() !!!" << endl ; }
72  // -
73  float M = Mass() ; 
74  double Pz = TMath::Sqrt(P()*P() - Pt()*Pt()); 
75  if (Eta() < 0) { Pz = -Pz ; }
76  double E = TMath::Sqrt(P()*P() + M*M) ;
77  float rapidity = 0.5*TMath::Log((E + Pz)/(E - Pz)) ;
78  return rapidity ;
79 }
80 //////////////////////////////////////////////////////////////////////////////
81 void AliFlowV0::SetDaughters(AliFlowTrack* pos, AliFlowTrack* neg) 
82
83  // Sets positive and negative daughter tracks from the TrackCollection()
84
85  fDaughters[0] = pos ; 
86  fDaughters[1] = neg ; 
87 }
88 //////////////////////////////////////////////////////////////////////////////
89 void  AliFlowV0::CrossPoint(Float_t Pxyz[3]) const 
90 {
91  // Coordinates of the v0
92
93  for(Int_t ii=0;ii<3;ii++) { Pxyz[ii] = fCrossPoint[ii] ; }
94 }
95 //////////////////////////////////////////////////////////////////////////////
96 // TVector3 AliFlowV0::CrossPoint() const 
97 // {
98 //  // Coordinates of the v0
99 // 
100 //  TVector3 pxyz ;
101 //  pxyz.SetXYZ(fCrossPoint[0],fCrossPoint[1],fCrossPoint[2]) ;
102 //  return pxyz ; 
103 // }
104 //////////////////////////////////////////////////////////////////////////////
105 void AliFlowV0::SetCrossPoint(Float_t pox,Float_t poy,Float_t poz)
106
107  // Sets the coordinates of the v0
108
109  fCrossPoint[0] = pox ; fCrossPoint[1] = poy ; fCrossPoint[2] = poz ; 
110 }
111 //////////////////////////////////////////////////////////////////////////////
112 const char* AliFlowV0::Pid() const
113 {
114  // Returns the P.Id. in characters (,...) basing on the stored pdg code 
115  // (MostLikelihoodPID()) .
116  
117  const char *name[] = {"gamma","K0","K0s","K0l","Lambda0"} ;
118  int pdg_code = TMath::Abs(MostLikelihoodPID()) ;
119
120  TString p_id = "" ;
121  if(pdg_code == 22)        { p_id = name[0] ; }
122  else if(pdg_code == 311)  { p_id = name[1] ; }
123  else if(pdg_code == 310)  { p_id = name[2] ; }
124  else if(pdg_code == 130)  { p_id = name[3] ; }
125  else if(pdg_code == 3122) { p_id = name[4] ; }
126  // ...
127  else                      { p_id = "0" ; }
128  
129  return p_id.Data() ; 
130 }
131 //////////////////////////////////////////////////////////////////////////////
132 void AliFlowV0::SetPid(const Char_t* pid)               
133
134  // Sets the P.Id. hypotesis of the track from a String imput ("K0","K0s",
135  // "K0l","Lambda0"). The string itself is not stored, what is stored is the
136  // PDG code.
137  
138  if(strstr(pid,"gamma"))        { fMostLikelihoodPID = 22   ; }
139  else if(strstr(pid,"K0"))      { fMostLikelihoodPID = 311  ; }
140  else if(strstr(pid,"K0s"))     { fMostLikelihoodPID = 310  ; }
141  else if(strstr(pid,"K0l"))     { fMostLikelihoodPID = 130  ; }
142  else if(strstr(pid,"Lambda0")) { fMostLikelihoodPID = 3122 ; }
143  // ...
144  else { fMostLikelihoodPID = 0 ; cout << "AliFlowV0 - !BAD IMPUT!" << endl ; }
145 }
146 //////////////////////////////////////////////////////////////////////////////
147 Float_t  AliFlowV0::Mass()                const { return fMass ; }
148 Float_t  AliFlowV0::Phi()                 const { return fPhi; }             
149 Float_t  AliFlowV0::Eta()                 const { return fEta; }             
150 Float_t  AliFlowV0::Pt()                  const { return fPt; }              
151 Short_t  AliFlowV0::Charge()              const { return 0 ; }       
152 Float_t  AliFlowV0::Dca()                 const { return fDca ; }                 
153 Float_t  AliFlowV0::Chi2()                const { return fChi2; }                 
154 Float_t  AliFlowV0::CrossDca()            const { return fCrossDCA ; }
155 Float_t  AliFlowV0::V0Lenght()            const { return TMath::Sqrt(fCrossPoint[0]*fCrossPoint[0] + fCrossPoint[1]*fCrossPoint[1] + fCrossPoint[2]*fCrossPoint[2]) ; }   
156 Float_t  AliFlowV0::Sigma()               const { return fSigma ; }       
157 Int_t    AliFlowV0::MostLikelihoodPID()   const { return fMostLikelihoodPID; } 
158 Int_t    AliFlowV0::Label()               const { return fLabel ; }           
159 AliFlowTrack* AliFlowV0::DaughterP()      const { return fDaughters[0] ; }
160 AliFlowTrack* AliFlowV0::DaughterN()      const { return fDaughters[1] ; }
161 //////////////////////////////////////////////////////////////////////////////
162 void AliFlowV0::SetMostLikelihoodPID(Int_t val) { fMostLikelihoodPID = val ; } 
163 void AliFlowV0::SetVmass(Float_t mass)          { fMass = mass ; }
164 void AliFlowV0::SetPhi(Float_t phi)             { fPhi = phi; }
165 void AliFlowV0::SetEta(Float_t eta)             { fEta = eta; }
166 void AliFlowV0::SetPt(Float_t pt)               { fPt = pt; }
167 void AliFlowV0::SetChi2(Float_t chi2)           { fChi2 = chi2; }
168 void AliFlowV0::SetDca(Float_t dca)             { fDca = dca; }
169 void AliFlowV0::SetCrossDca(Float_t dca)        { fCrossDCA = dca ; }
170 void AliFlowV0::SetSigma(Float_t sigma)         { fSigma = sigma ; }      
171 void AliFlowV0::SetLabel(Int_t label)           { fLabel = label ; }
172 //////////////////////////////////////////////////////////////////////////////