#include "Riostream.h"
#include "TMath.h"
+using std::cout;
+using std::endl;
///\cond CLASSIMP
ClassImp(AliMUONPolygon)
///\endcond
//______________________________________________________________________________
AliMUONPolygon::AliMUONPolygon(const AliMUONPolygon& rhs)
: TObject(rhs),
-fN(0),
+fN(rhs.fN),
fX(0x0),
fY(0x0)
{
/// Copy constructor.
- ((AliMUONPolygon&)rhs).AliMUONPolygon::Copy(*this);
+ if ( fN > 0 )
+ {
+ fX = new Double_t[fN];
+ fY = new Double_t[fN];
+
+ for ( Int_t i = 0; i < fN; ++i )
+ {
+ fX[i] = rhs.fX[i];
+ fY[i] = rhs.fY[i];
+ }
+
+ }
+
}
//______________________________________________________________________________
/// Assignment operator
if ( this != &rhs )
{
- rhs.AliMUONPolygon::Copy(*this);
+ static_cast<TObject&>(*this)=rhs;
+
+ delete[] fX;
+ delete[] fY;
+
+ fX = 0;
+ fY = 0;
+
+ fN = rhs.fN;
+
+ if ( fN > 0 )
+ {
+ fX = new Double_t[fN];
+ fY = new Double_t[fN];
+
+ for ( Int_t i = 0; i < fN; ++i )
+ {
+ fX[i] = rhs.fX[i];
+ fY[i] = rhs.fY[i];
+ }
+
+ }
}
return *this;
}
return TMath::IsInside(x,y,fN,fX,fY);
}
-//______________________________________________________________________________
-void AliMUONPolygon::Copy(TObject& obj) const
-{
- /// Copy this to obj
-
- TObject::Copy(obj);
-
- AliMUONPolygon& rhs = static_cast<AliMUONPolygon&>(obj);
-
- delete [] rhs.fX;
- delete [] rhs.fY;
-
- rhs.fX = 0;
- rhs.fY = 0;
- rhs.fN = 0;
-
- if ( fN > 0 )
- {
- rhs.fN = fN;
-
- rhs.fX = new Double_t[rhs.fN];
- rhs.fY = new Double_t[rhs.fN];
-
- for ( Int_t i = 0; i < rhs.fN; ++i )
- {
- rhs.fX[i] = fX[i];
- rhs.fY[i] = fY[i];
- }
- }
-}
-
//_____________________________________________________________________________
void
AliMUONPolygon::Close()