Coverity
authorfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Dec 2011 10:07:06 +0000 (10:07 +0000)
committerfca <fca@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 1 Dec 2011 10:07:06 +0000 (10:07 +0000)
PWG2/FEMTOSCOPY/AliFemto/AliFemtoLorentzVector.h
PWG2/FEMTOSCOPY/AliFemto/AliFemtoThreeVector.h
PWG2/FEMTOSCOPY/AliFemtoUser/AliFemtoModelAllHiddenInfo.cxx

index e1a260d..17d4122 100644 (file)
@@ -450,9 +450,11 @@ template<class X>
 AliFemtoLorentzVector<T>&
 AliFemtoLorentzVector<T>::operator=(const AliFemtoLorentzVector<X>& vec)
 {
+  if(this != &vec) {
     fThreeVector = vec.vect();
     fX4 = vec.t();
-    return *this;
+  }
+  return *this;
 }
 
 template<class T>
index 41f6b99..e533c1b 100644 (file)
@@ -504,8 +504,10 @@ template<class X>
 inline AliFmThreeVector<T>&
 AliFmThreeVector<T>::operator=(const AliFmThreeVector<X>& v)
 {
+  if(this != &v) {
     mX1 = v.x();  mX2 = v.y();  mX3 = v.z();
-    return *this;
+  }
+  return *this;
 }
 
 template<class T>
index d7c22f4..5f462c9 100644 (file)
@@ -34,59 +34,47 @@ AliFemtoModelAllHiddenInfo::AliFemtoModelAllHiddenInfo() :
 //_____________________________________________
 AliFemtoModelAllHiddenInfo::AliFemtoModelAllHiddenInfo(const AliFemtoModelAllHiddenInfo &aInfo) :
   AliFemtoModelHiddenInfo(aInfo),
-  fTrueMomentumMother(0),
-  fEmissionPointMother(0),
-  fPDGPidMother(0),
-  fTrueMomentumChild1(0),
-  fTrueMomentumChild2(0),
-  fPDGPidChild1(0),
-  fPDGPidChild2(0)
+  fTrueMomentumMother(new AliFemtoLorentzVector(*(aInfo.fTrueMomentumMother))),
+  fEmissionPointMother(new AliFemtoLorentzVector(*(aInfo.fEmissionPointMother))),
+  fPDGPidMother(aInfo.fPDGPidMother),
+  fTrueMomentumChild1(new AliFemtoLorentzVector(*(aInfo.fTrueMomentumChild1))),
+  fTrueMomentumChild2(new AliFemtoLorentzVector(*(aInfo.fTrueMomentumChild2))),
+  fPDGPidChild1(aInfo.fPDGPidChild1),
+  fPDGPidChild2(aInfo.fPDGPidChild2)
 {
+  //
   // Copy constructor
-  if (aInfo.GetTrueMomentumMother())
-    SetTrueMomentumMother(aInfo.GetTrueMomentumMother());
-  if (aInfo.GetEmissionPointMother())
-    SetEmissionPointMother(aInfo.GetEmissionPointMother());
-  fPDGPidMother = aInfo.GetPDGPidMother();
-  if (aInfo.GetTrueMomentumChild1())
-    SetTrueMomentumChild1(aInfo.GetTrueMomentumChild1());
-  if (aInfo.GetTrueMomentumChild2())
-    SetTrueMomentumChild2(aInfo.GetTrueMomentumChild2());
-  fPDGPidChild1 = aInfo.GetPDGPidChild1();
-  fPDGPidChild2 = aInfo.GetPDGPidChild2();
+  //
 }
 //_____________________________________________
 AliFemtoModelAllHiddenInfo::~AliFemtoModelAllHiddenInfo()
 {
   // Destructor
-  if (fTrueMomentumMother)  delete fTrueMomentumMother;
-  if (fEmissionPointMother) delete fEmissionPointMother;
-  if (fTrueMomentumChild1) delete fTrueMomentumChild1;
-  if (fTrueMomentumChild2) delete fTrueMomentumChild2;
+  delete fTrueMomentumMother;
+  delete fEmissionPointMother;
+  delete fTrueMomentumChild1;
+  delete fTrueMomentumChild2;
 }
 //_____________________________________________
 AliFemtoModelAllHiddenInfo& AliFemtoModelAllHiddenInfo::operator=(const AliFemtoModelAllHiddenInfo& aInfo)
 {
+  //
   // assignment operator
-  if (this == &aInfo)
-    return *this;
-
-  if (aInfo.GetTrueMomentumMother())
-    SetTrueMomentumMother(aInfo.GetTrueMomentumMother());
-  else SetTrueMomentumMother(0);
-  if (aInfo.GetEmissionPointMother())
-    SetEmissionPointMother(aInfo.GetEmissionPointMother());
-  else SetEmissionPointMother(0);
-  fPDGPidMother = aInfo.GetPDGPidMother();
-  if (aInfo.GetTrueMomentumChild1())
-    SetTrueMomentumChild1(aInfo.GetTrueMomentumChild1());
-  else SetTrueMomentumChild1(0);
-  if (aInfo.GetTrueMomentumChild2())
-    SetTrueMomentumChild2(aInfo.GetTrueMomentumChild2());
-  else SetTrueMomentumChild2(0);
-  fPDGPidChild1 = aInfo.GetPDGPidChild1();
-  fPDGPidChild2 = aInfo.GetPDGPidChild2();
-
+  //
+  if (this != &aInfo) {
+    AliFemtoModelHiddenInfo::operator=(aInfo);
+    delete fTrueMomentumMother;
+    fTrueMomentumMother = new AliFemtoLorentzVector(*(aInfo.fTrueMomentumMother));
+    delete fEmissionPointMother;
+    fEmissionPointMother = new AliFemtoLorentzVector(*(aInfo.fEmissionPointMother));
+    fPDGPidMother = aInfo.fPDGPidMother;
+    delete fTrueMomentumChild1;
+    fTrueMomentumChild1 = new AliFemtoLorentzVector(*(aInfo.fTrueMomentumChild1));
+    delete fTrueMomentumChild2;
+    fTrueMomentumChild2 = new AliFemtoLorentzVector(*(aInfo.fTrueMomentumChild2));
+    fPDGPidChild1 = aInfo.fPDGPidChild1;      
+    fPDGPidChild2 = aInfo.fPDGPidChild2;   
+  }
   return *this;
 }
 //