Coverity fixes (A. Shabetai)
authorkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Feb 2012 07:54:25 +0000 (07:54 +0000)
committerkleinb <kleinb@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 22 Feb 2012 07:54:25 +0000 (07:54 +0000)
JETAN/DEV/AliJetCalTrk.cxx
JETAN/DEV/AliJetCalTrk.h

index e96c533..619f766 100644 (file)
@@ -99,10 +99,10 @@ void AliJetCalTrkTrack::Clear(Option_t* /*option*/)
 }
 
 //-----------------------------------------------------------------------
-void AliJetCalTrkTrack::Print(const Option_t* option)
+void AliJetCalTrkTrack::Print(const Option_t* option) const
 {
   cout << "Track: " << option << ", Pt: " << GetPt() << ", Eta: " << GetEta() << ", Phi: " << GetPhi() << endl;
-  if (!option) TObject::Print();
+
 }
 
 //...........................................................................
@@ -114,7 +114,10 @@ ClassImp(AliJetCalTrkTrackKine)
     fCalTrkPtReso(1.),
     fCalTrkTrackE(-999.),
     fCalTrkTrackPt(-999.),
-    fCalTrkTrackP(-999.)
+    fCalTrkTrackP(-999.),
+    fCalTrkTrackPx(-999.),
+    fCalTrkTrackPy(-999.),
+    fCalTrkTrackPz(-999.)
 {
   // Default constructor
 }
@@ -125,9 +128,14 @@ AliJetCalTrkTrackKine::AliJetCalTrkTrackKine(AliVParticle* track, Bool_t cutFlag
   fCalTrkPtReso(ptReso),
   fCalTrkTrackE(-999.),
   fCalTrkTrackPt(-999.),
-  fCalTrkTrackP(-999.)
+  fCalTrkTrackP(-999.),
+  fCalTrkTrackPx(-999.),
+  fCalTrkTrackPy(-999.),
+  fCalTrkTrackPz(-999.)
 {
   // Constructor 2
+  CalcPx(); CalcPy(); CalcPz(); CalcP(); CalcPt(); CalcE();
+
 }
 
 //------------------------------------------------------------------------
@@ -138,12 +146,15 @@ void AliJetCalTrkTrackKine::Clear(Option_t* option)
   fCalTrkTrackE     = -999;
   fCalTrkTrackPt    = -999;
   fCalTrkTrackP     = -999;
+  fCalTrkTrackPx    = -999;
+  fCalTrkTrackPy    = -999;
+  fCalTrkTrackPz    = -999;
   AliJetCalTrkTrack::Clear(option);
 
 }
 
 //------------------------------------------------------------------------
-Float_t AliJetCalTrkTrackKine::GetE()
+Float_t AliJetCalTrkTrackKine::CalcE()
 {
   // Particle energy
   if(fCalTrkTrackE==-999){
@@ -158,7 +169,7 @@ Float_t AliJetCalTrkTrackKine::GetE()
 }
 
 //------------------------------------------------------------------------
-Float_t AliJetCalTrkTrackKine::GetPt()
+Float_t AliJetCalTrkTrackKine::CalcPt()
 {
   // Particle transverse momentum
   if(fCalTrkTrackPt==-999){
@@ -173,7 +184,7 @@ Float_t AliJetCalTrkTrackKine::GetPt()
 }
 
 //------------------------------------------------------------------------
-Float_t AliJetCalTrkTrackKine::GetP()
+Float_t AliJetCalTrkTrackKine::CalcP()
 {
   // Particle momentum
   if(fCalTrkTrackP==-999){
index c1a4539..e52ea55 100644 (file)
@@ -45,16 +45,15 @@ class AliJetCalTrkTrack : public TObject
   Float_t         GetPtCorr() const      {return fCalTrkPtCorr;}
   Float_t         GetEta() const         {return GetParticle()->Eta();}
   Float_t         GetPhi() const         {return GetParticle()->Phi();}
-  virtual Float_t GetE()                 {return GetParticle()->E();}
-  virtual Float_t GetPt()                {return GetParticle()->Pt();}
-  virtual Float_t GetPx()                {return GetParticle()->Px();}
-  virtual Float_t GetPy()                {return GetParticle()->Py();}
-  virtual Float_t GetPz()                {return GetParticle()->Pz();}
-  virtual Float_t GetP()                 {return GetParticle()->P();}
+  virtual Float_t GetE() const           {return GetParticle()->E();}
+  virtual Float_t GetPt() const          {return GetParticle()->Pt();}
+  virtual Float_t GetPx() const          {return GetParticle()->Px();}
+  virtual Float_t GetPy() const          {return GetParticle()->Py();}
+  virtual Float_t GetPz() const          {return GetParticle()->Pz();}
+  virtual Float_t GetP() const           {return GetParticle()->P();}
   Int_t           GetID() const          {return GetTrack()->GetID();}
   Float_t         GetM() const           {return GetParticle()->M();}
-  using           TObject::Print;
-  void            Print(const Option_t* option);
+  void            Print(const Option_t* /*option*/) const;
 
   virtual void    Clear(Option_t* /*option = ""*/);
 
@@ -80,12 +79,18 @@ class AliJetCalTrkTrackKine : public AliJetCalTrkTrack
   virtual  ~AliJetCalTrkTrackKine() {;}
 
   Float_t        GetPtReso() const {return fCalTrkPtReso;}
-  Float_t        GetE();
-  Float_t        GetPt();
-  Float_t        GetPx() {return GetPtReso()*GetParticle()->Px();}
-  Float_t        GetPy() {return GetPtReso()*GetParticle()->Py();}
-  Float_t        GetPz() {return GetPtReso()*GetParticle()->Pz();}
-  Float_t        GetP();
+  Float_t        GetE()  const {return fCalTrkTrackE;}
+  Float_t        GetPt() const {return fCalTrkTrackPt;}
+  Float_t        GetPx() const {return fCalTrkTrackPx;}
+  Float_t        GetPy() const {return fCalTrkTrackPy;}
+  Float_t        GetPz() const {return fCalTrkTrackPz;}
+  Float_t        GetP()  const {return fCalTrkTrackP;}
+  Float_t        CalcPx() {fCalTrkTrackPx = GetPtReso()*GetParticle()->Px(); return fCalTrkTrackPx;}
+  Float_t        CalcPy() {fCalTrkTrackPy = GetPtReso()*GetParticle()->Py(); return fCalTrkTrackPy;}
+  Float_t        CalcPz() {fCalTrkTrackPz = GetPtReso()*GetParticle()->Pz(); return fCalTrkTrackPz;}
+  Float_t        CalcP();
+  Float_t        CalcPt();
+  Float_t        CalcE();
   void           Clear(Option_t* option = "");
 
  private:
@@ -93,6 +98,9 @@ class AliJetCalTrkTrackKine : public AliJetCalTrkTrack
   Float_t        fCalTrkTrackE;       // Particle energy
   Float_t        fCalTrkTrackPt;      // Particle Pt
   Float_t        fCalTrkTrackP;       // Particle P
+  Float_t        fCalTrkTrackPx;      // Particle Px
+  Float_t        fCalTrkTrackPy;      // Particle Py
+  Float_t        fCalTrkTrackPz;      // Particle Pz
 
   ClassDef(AliJetCalTrkTrackKine,1) // Implementation of AliJetCalTrkTrackKine
 };