]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
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 e1a260d9bc11d9186aff60be820019fbd059c7f3..17d412251398ad0805ebfae43a6cd51c1075a032 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 41f6b99590f74bc6a2c7ea12140a64c20e2c44f3..e533c1b16fb899b1468aad75259d8914cfb979b5 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 d7c22f4c94101f0fea0180220f2f00645ee7143c..5f462c9754f7ce85060e1fe85420a92af892c517 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;
 }
 //