Proton analysis for AODs - analysis train
[u/mrichter/AliRoot.git] / PWG2 / FLOW / AliFlowV0.cxx
CommitLineData
30a892e3 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"
92016a03 20#include "AliFlowTrack.h"
21#include "AliFlowEvent.h"
22
30a892e3 23#include <iostream>
24using namespace std; //required for resolving the 'cout' symbol
25
f847c9e2 26ClassImp(AliFlowV0)
30a892e3 27//////////////////////////////////////////////////////////////////////////////
4e566f2f 28AliFlowV0::AliFlowV0():
da5aa0a0 29 fPhi(0.), fPt(0.), fEta(0.), fChi2(0.), fMass(0.), fDca(0.), fCrossDCA(0.), fSigma(1.), fLabel(0), fMostLikelihoodPID(0), fPointAngle(0.),
30 fDaughterP(-1), fDaughterN(-1)
30a892e3 31{
32 // default constructor
d8b98e74 33 for(Int_t dd=0;dd<3;dd++) { fCrossPoint[dd] = 0. ; }
da5aa0a0 34 // fDaughterP = -1 ; fDaughterN = -1 ;
30a892e3 35}
36//////////////////////////////////////////////////////////////////////////////
d8b98e74 37AliFlowV0::AliFlowV0(const Char_t* name):
da5aa0a0 38 fPhi(0.), fPt(0.), fEta(0.), fChi2(0.), fMass(0.), fDca(0.), fCrossDCA(0.), fSigma(1.), fLabel(0), fMostLikelihoodPID(0), fPointAngle(0.),
39 fDaughterP(-1), fDaughterN(-1)
30a892e3 40{
41 // TNamed constructor
42
43 SetName(name) ;
44 AliFlowV0() ;
45}
46//////////////////////////////////////////////////////////////////////////////
47AliFlowV0::~AliFlowV0()
48{
49 // default destructor (dummy)
50}
51//////////////////////////////////////////////////////////////////////////////
52
53//////////////////////////////////////////////////////////////////////////////
54Float_t AliFlowV0::P() const
55{
56 // Returns the reconstructed momentum of the v0
57
9777bfcb 58 if(Pt()<=0) { return 0. ; }
59 if(Eta()==0) { return 0. ; }
60
30a892e3 61 float momentum = Pt()/TMath::Sqrt(1-(tanh(Eta())*tanh(Eta()))) ;
62 return momentum;
63}
64//////////////////////////////////////////////////////////////////////////////
65Float_t AliFlowV0::Y() const
66{
67 // Rapidity of the v0
68
69 if(TMath::Abs((Float_t)P()) == TMath::Abs((Float_t)Pt())) { return 0. ; }
da5aa0a0 70 else if(TMath::Abs((Float_t)P()) < TMath::Abs((Float_t)Pt())) { cout << "v0: " << GetName() << " has Pt() > P() !!!" << endl ; return -1000. ; }
30a892e3 71 // -
92016a03 72 Float_t mass = Mass() ;
73 Double_t pz = TMath::Sqrt(P()*P() - Pt()*Pt());
74 if(Eta() < 0) { pz = -pz ; }
75 Double_t e = TMath::Sqrt(P()*P() + mass*mass) ;
76 Float_t rapidity = 0.5 * TMath::Log((e + pz)/(e - pz)) ;
30a892e3 77 return rapidity ;
78}
79//////////////////////////////////////////////////////////////////////////////
30a892e3 80const char* AliFlowV0::Pid() const
81{
92016a03 82 // Returns the P.Id. in char* basing on the stored pdg code (MostLikelihoodPID()) .
30a892e3 83
84 const char *name[] = {"gamma","K0","K0s","K0l","Lambda0"} ;
92016a03 85 int pdgCode = TMath::Abs(MostLikelihoodPID()) ;
30a892e3 86
92016a03 87 TString pId = "" ;
88 if(pdgCode == 22) { pId = name[0] ; }
89 else if(pdgCode == 311) { pId = name[1] ; }
90 else if(pdgCode == 310) { pId = name[2] ; }
91 else if(pdgCode == 130) { pId = name[3] ; }
92 else if(pdgCode == 3122) { pId = name[4] ; }
30a892e3 93 // ...
92016a03 94 else { pId = "0" ; }
30a892e3 95
92016a03 96 return pId.Data() ;
30a892e3 97}
98//////////////////////////////////////////////////////////////////////////////
da5aa0a0 99// void AliFlowV0::SetPid(const Char_t* pid)
100// {
101// // Sets the P.Id. hypotesis of the track from a char* imput ("K0","Lambda0",...).
102// // The string itself is not stored, what is stored is the PDG code.
103//
104// if(strstr(pid,"gamma")) { fMostLikelihoodPID = 22 ; }
105// else if(strstr(pid,"K0")) { fMostLikelihoodPID = 311 ; }
106// else if(strstr(pid,"K0s")) { fMostLikelihoodPID = 310 ; }
107// else if(strstr(pid,"K0l")) { fMostLikelihoodPID = 130 ; }
108// else if(strstr(pid,"Lambda0")) { fMostLikelihoodPID = 3122 ; }
109// // ...
110// else { fMostLikelihoodPID = 0 ; cout << "AliFlowV0 - !BAD IMPUT!" << endl ; }
111// }
30a892e3 112//////////////////////////////////////////////////////////////////////////////