]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG2/FLOW/AliFlowV0.cxx
Coding conventions
[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 "AliFlowTrack.h"
21 #include "AliFlowEvent.h"
22
23 #include <iostream>
24 using namespace std; //required for resolving the 'cout' symbol
25
26 ClassImp(AliFlowV0) 
27 //////////////////////////////////////////////////////////////////////////////
28 AliFlowV0::AliFlowV0():
29   fDaughterP(0x0), fDaughterN(0x0)
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 ;
42  fPointAngle = 0. ;
43  for(Int_t dd=0;dd<3;dd++) { fCrossPoint[dd] = 0. ; }
44  // fDaughterP = 0  ; fDaughterN = 0  ;
45 }
46 //////////////////////////////////////////////////////////////////////////////
47 AliFlowV0::AliFlowV0(const Char_t* name) 
48 {
49  // TNamed constructor 
50  
51  SetName(name) ;
52  AliFlowV0() ;
53 }
54 //////////////////////////////////////////////////////////////////////////////
55 AliFlowV0::~AliFlowV0() 
56 {
57  // default destructor (dummy)
58 }
59 //////////////////////////////////////////////////////////////////////////////
60
61 //////////////////////////////////////////////////////////////////////////////
62 Float_t  AliFlowV0::P() const 
63
64  // Returns the reconstructed momentum of the v0
65
66  if(Pt()<=0)  { return 0. ; }
67  if(Eta()==0) { return 0. ; }
68
69  float momentum = Pt()/TMath::Sqrt(1-(tanh(Eta())*tanh(Eta()))) ; 
70  return momentum; 
71 }
72 //////////////////////////////////////////////////////////////////////////////
73 Float_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. ; }
78  else if(TMath::Abs((Float_t)P()) < TMath::Abs((Float_t)Pt()))  { cout << "v0: " << GetName() << "has  Pt() > P() !!!" << endl ; return -1000. ; }
79  // -
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)) ;
85  return rapidity ;
86 }
87 //////////////////////////////////////////////////////////////////////////////
88 const char* AliFlowV0::Pid() const
89 {
90  // Returns the P.Id. in char* basing on the stored pdg code (MostLikelihoodPID()) .
91  
92  const char *name[] = {"gamma","K0","K0s","K0l","Lambda0"} ;
93  int pdgCode = TMath::Abs(MostLikelihoodPID()) ;
94
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] ; }
101  // ...
102  else                     { pId = "0" ; }
103  
104  return pId.Data() ; 
105 }
106 //////////////////////////////////////////////////////////////////////////////
107 void AliFlowV0::SetPid(const Char_t* pid)               
108
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.
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 //////////////////////////////////////////////////////////////////////////////