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