]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Improved Print() function
authorpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 9 Nov 2006 16:03:12 +0000 (16:03 +0000)
committerpulvir <pulvir@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 9 Nov 2006 16:03:12 +0000 (16:03 +0000)
PWG2/RESONANCES/AliRsnDaughter.cxx
PWG2/RESONANCES/AliRsnDaughter.h

index 382c2aeb2d0892f368350935e692e24ede68ed8f..be2001aac8d149d58cd27d15c5fd59c66e4e071d 100644 (file)
@@ -27,6 +27,7 @@
 #include <Riostream.h>
 
 #include <TParticle.h>
+#include <TString.h>
 
 #include "AliESDtrack.h"
 #include "AliRsnDaughter.h"
@@ -177,6 +178,57 @@ Bool_t AliRsnDaughter::Adopt(TParticle* particle)
        return kTRUE;
 }
 //--------------------------------------------------------------------------------------------------------
+void AliRsnDaughter::Print(Option_t *option) const
+{
+// 
+// Print informations about track.
+// All options are used to add some specifical information as required:
+// "S" --> charge sign
+// "L" --> track label
+// "I" --> assigned PID (PDG code)
+// "T" --> true PDG code
+// "V" --> coordinates of track vertex
+// "P" --> coordinates of track momentum
+// "M" --> mother label
+// "N" --> mother PDG code
+// "W" --> ESD PID weights
+//
+
+       TString output("Track info: ");
+       TString opt(option);
+       opt.ToUpper();
+       
+       if (opt.Contains("S")) {
+               output.Append(Form("sign = %d -- ", (Int_t)fSign));
+       }
+       if (opt.Contains("L")) {
+               output.Append(Form("label = %d -- ", fLabel));
+       }
+       if (opt.Contains("I")) {
+               output.Append(Form("PDG = %d -- ", fPDG));
+       }
+       if (opt.Contains("T")) {
+               output.Append(Form("true PDG = %d -- ", fTruePDG));
+       }
+       if (opt.Contains("V")) {
+               output.Append(Form("v = %f, %f, %f -- ", fV[0], fV[1], fV[2]));
+       }
+       if (opt.Contains("P")) {
+               output.Append(Form("p = %f, %f, %f -- ", fP[0], fP[1], fP[2]));
+       }
+       if (opt.Contains("M")) {
+               output.Append(Form("mum = %d -- ", fMother));
+       }
+       if (opt.Contains("N")) {
+               output.Append(Form("mum PDG = %d -- ", fMotherPDG));
+       }
+       if (opt.Contains("W")) {
+               output.Append(Form("PID wgts (e, mu, pi, K, p) = %f, %f, %f, %f, %f", fPIDwgt[0], fPIDwgt[1], fPIDwgt[2], fPIDwgt[3], fPIDwgt[4]));
+       }
+       
+       cout << output.Data() << endl;
+}
+//--------------------------------------------------------------------------------------------------------
 AliRsnDaughter AliRsnDaughter::Sum(AliRsnDaughter t1, AliRsnDaughter t2)
 {
 //
index 89018cfaf7f607e1ddcc7a2722cd930f699248a4..1594671b87e40b3a74fa5b2e441deaf8a6586931 100644 (file)
@@ -34,42 +34,43 @@ public:
                
        Bool_t         Adopt(TParticle* particle);
        Bool_t         Adopt(const AliESDtrack* track, Bool_t checkRefit = kTRUE);
-       TVector3       Get3Momentum() const                                               {TVector3 v(fP[0],fP[1],fP[2]); return v;}
-       TLorentzVector Get4Momentum() const                                       {TLorentzVector v(fP[0],fP[1],fP[2],GetEnergy()); return v;}
-       Double_t       GetEnergy() const                                              {return TMath::Sqrt(fMass*fMass + GetP2());}
-       UShort_t       GetIndex() const                                                           {return fIndex;}
-       Int_t          GetLabel() const                                                           {return fLabel;}
-       Double_t       GetMass() const                                {return fMass;}
-       Int_t          GetMother() const                                                          {return fMother;}
-       Short_t        GetMotherPDG() const                                               {return fMotherPDG;}
-       UShort_t       GetPDG() const                                                             {return fPDG;}
-       Double_t       GetPIDweight(Int_t i) const                                {return ( (i>=0&&i<AliPID::kSPECIES)?fPIDwgt[i]:-1.0 );}
-       Char_t         GetSign() const                                                            {return fSign;}
-       Double_t       GetP2() const                                                              {return fP[0]*fP[0] + fP[1]*fP[1] + fP[2]*fP[2];}
-       Double_t       GetP() const                                                               {return TMath::Sqrt(GetP2());}
-       Double_t       GetPx() const                                                              {return fP[0];}
-       Double_t       GetPy() const                                                              {return fP[1];}
-       Double_t       GetPz() const                                                              {return fP[2];}
-       Double_t       GetPt() const                                                              {return TMath::Sqrt(fP[0]*fP[0] + fP[1]*fP[1]);}
-       Short_t        GetTruePDG() const                                                         {return fTruePDG;}
-       TVector3       GetVertex() const                                                          {TVector3 v(fV[0],fV[1],fV[2]); return v;}
-       Double_t       GetVx() const                                                              {return fV[0];}
-       Double_t       GetVy() const                                                              {return fV[1];}
-       Double_t       GetVz() const                                                              {return fV[2];}
-       Double_t       GetVt() const                                                              {return TMath::Sqrt(fV[0]*fV[0] + fV[1]*fV[1]);}
-       void           SetIndex(UShort_t value)                                           {fIndex = value;}
-       void           SetIndex(Int_t value)                                              {fIndex = (UShort_t)value;}
-       void           SetLabel(Int_t l)                                                          {fLabel = l;}
-       void           SetMass(Double_t m)                            {fMass = m;}
-       void           SetMother(Int_t l)                                                         {fMother = l;}
-       void           SetMotherPDG(Short_t pdg)                                          {fMotherPDG = pdg;}
-       void           SetPDG(UShort_t pdg)                           {fPDG = TMath::Abs(pdg);}
-       void           SetPDG(Int_t pdg)                              {fPDG = (UShort_t)TMath::Abs(pdg);}
-       void           SetPIDweights(const Double_t *pid)                         {Int_t i;for(i=0;i<AliPID::kSPECIES;i++)fPIDwgt[i]=pid[i];}
+       TVector3       Get3Momentum() const {TVector3 v(fP[0],fP[1],fP[2]); return v;}
+       TLorentzVector Get4Momentum() const     {TLorentzVector v(fP[0],fP[1],fP[2],GetEnergy()); return v;}
+       Double_t       GetEnergy() const {return TMath::Sqrt(fMass*fMass + GetP2());}
+       UShort_t       GetIndex() const {return fIndex;}
+       Int_t          GetLabel() const {return fLabel;}
+       Double_t       GetMass() const {return fMass;}
+       Int_t          GetMother() const {return fMother;}
+       Short_t        GetMotherPDG() const {return fMotherPDG;}
+       UShort_t       GetPDG() const {return fPDG;}
+       Double_t       GetPIDweight(Int_t i) const {return ( (i>=0&&i<AliPID::kSPECIES)?fPIDwgt[i]:-1.0 );}
+       Char_t         GetSign() const {return fSign;}
+       Double_t       GetP2() const {return fP[0]*fP[0] + fP[1]*fP[1] + fP[2]*fP[2];}
+       Double_t       GetP() const  {return TMath::Sqrt(GetP2());}
+       Double_t       GetPx() const {return fP[0];}
+       Double_t       GetPy() const {return fP[1];}
+       Double_t       GetPz() const {return fP[2];}
+       Double_t       GetPt() const {return TMath::Sqrt(fP[0]*fP[0] + fP[1]*fP[1]);}
+       Short_t        GetTruePDG() const {return fTruePDG;}
+       TVector3       GetVertex() const {TVector3 v(fV[0],fV[1],fV[2]); return v;}
+       Double_t       GetVx() const {return fV[0];}
+       Double_t       GetVy() const {return fV[1];}
+       Double_t       GetVz() const {return fV[2];}
+       Double_t       GetVt() const {return TMath::Sqrt(fV[0]*fV[0] + fV[1]*fV[1]);}
+       void           Print(Option_t *option = "") const;
+       void           SetIndex(UShort_t value) {fIndex = value;}
+       void           SetIndex(Int_t value) {fIndex = (UShort_t)value;}
+       void           SetLabel(Int_t l) {fLabel = l;}
+       void           SetMass(Double_t m) {fMass = m;}
+       void           SetMother(Int_t l) {fMother = l;}
+       void           SetMotherPDG(Short_t pdg) {fMotherPDG = pdg;}
+       void           SetPDG(UShort_t pdg) {fPDG = TMath::Abs(pdg);}
+       void           SetPDG(Int_t pdg) {fPDG = (UShort_t)TMath::Abs(pdg);}
+       void           SetPIDweights(const Double_t *pid) {Int_t i;for(i=0;i<AliPID::kSPECIES;i++)fPIDwgt[i]=pid[i];}
        void           SetPxPyPz(Double_t px,Double_t py,Double_t pz) {fP[0]=px;fP[1]=py;fP[2]=pz;}
-       void           SetSign(Char_t value)                                              {fSign = value;}
-       void           SetSign(Int_t value)                                               {fSign = (Char_t)value;}
-       void           SetTruePDG(Short_t pdg)                                            {fTruePDG = pdg;}
+       void           SetSign(Char_t value) {fSign = value;}
+       void           SetSign(Int_t value) {fSign = (Char_t)value;}
+       void           SetTruePDG(Short_t pdg) {fTruePDG = pdg;}
        void           SetVxVyVz(Double_t vx,Double_t vy,Double_t vz) {fV[0]=vx;fV[1]=vy;fV[2]=vz;}
        
        static AliRsnDaughter Sum(AliRsnDaughter t1, AliRsnDaughter t2);