#include "AliMUONObjectPair.h"
+#include "AliLog.h"
+#include <Riostream.h>
+
+//-----------------------------------------------------------------------------
/// \class AliMUONObjectPair
///
/// The equivalent of a std::pair<TObject*,TObject*> ;-)
/// we decide on the ownership of the first and/or second object...
///
/// \author Laurent Aphecetche
+//-----------------------------------------------------------------------------
/// \cond CLASSIMP
ClassImp(AliMUONObjectPair)
fIsOwnerOfSecond(kTRUE)
{
/// ctor
+ AliDebug(1,Form("this=%p",this));
}
//_____________________________________________________________________________
fIsOwnerOfSecond(isOwnerOfSecond)
{
/// ctor
+ AliDebug(1,Form("this=%p first is %s second is %s",
+ this,
+ (first ? first->ClassName() : "0x0"),
+ (second ? second->ClassName() : "0x0")
+ ));
+
}
//_____________________________________________________________________________
fIsOwnerOfSecond(kTRUE)
{
/// copy ctor
+ AliDebug(1,Form("this=%p copy ctor",this));
other.Copy(*this);
}
AliMUONObjectPair::operator=(const AliMUONObjectPair& other)
{
/// assignement operator
- AliMUONObjectPair pair(other);
- pair.Copy(*this);
+ if ( this != &other)
+ {
+ other.Copy(*this);
+ }
return *this;
}
AliMUONObjectPair::~AliMUONObjectPair()
{
/// dtor
+ AliDebug(1,Form("this=%p",this));
+ if ( fIsOwnerOfFirst ) delete fFirst;
+ if ( fIsOwnerOfSecond ) delete fSecond;
+}
+
+//_____________________________________________________________________________
+void
+AliMUONObjectPair::Clear(Option_t*)
+{
+ /// Reset
if ( fIsOwnerOfFirst ) delete fFirst;
if ( fIsOwnerOfSecond ) delete fSecond;
+ fFirst = 0x0;
+ fSecond = 0x0;
}
//_____________________________________________________________________________
pair.fSecond = fSecond;
}
}
+
+//_____________________________________________________________________________
+void
+AliMUONObjectPair::Print(Option_t* opt) const
+{
+ /// Printout
+
+ cout << "First:";
+ if ( First() )
+ {
+ First()->Print(opt);
+ }
+ else
+ {
+ cout << " NULL ";
+ }
+ cout << endl;
+ cout << "Second:";
+ if ( Second() )
+ {
+ Second()->Print(opt);
+ }
+ else
+ {
+ cout << " NULL ";
+ }
+ cout << endl;
+}