#include "AliMUONVCalibParam.h"
-///
+#include "AliLog.h"
+
+//-----------------------------------------------------------------------------
/// \class AliMUONVCalibParam
///
/// Defines an interface for a calibration container object.
///
-/// \author Laurent Aphecetche
+/// Note that a VCalibParam object is identified by a pair (id0,id1),
+/// where each member of the pair is a 16 bits word, so that id0 and id1
+/// can be packed into a single 32 bits word.
+///
+/// id1 might be left to zero if not required (e.g. for calibparam which
+/// can be identified by a single integer)
+///
+/// Note that the ValueAsXXX methods have 2 versions : with or without bound
+/// checking. The latter is to be used in e.g. loops, where you know for
+/// sure the indices are ok, in order to gain some time.
+///
+/// \author Laurent Aphecetche, Subatech
+//-----------------------------------------------------------------------------
+/// \cond CLASSIMP
ClassImp(AliMUONVCalibParam)
+/// \endcond
+
+//_____________________________________________________________________________
+AliMUONVCalibParam::AliMUONVCalibParam() : TObject()
+{
+ /// Default constructor
+}
//_____________________________________________________________________________
- AliMUONVCalibParam::AliMUONVCalibParam() : TObject()
+AliMUONVCalibParam::AliMUONVCalibParam(Int_t id0, Int_t id1) : TObject()
{
- // ctor
+ /// constructor for 2D
+ SetUniqueID(BuildUniqueID(id0,id1));
}
//_____________________________________________________________________________
AliMUONVCalibParam::~AliMUONVCalibParam()
{
- //
- // dtor (virtual).
- //
+/// Destructor.
+}
+
+//_____________________________________________________________________________
+UInt_t
+AliMUONVCalibParam::BuildUniqueID(Int_t id0, Int_t id1)
+{
+ /// Build a single index from the pair (id0,id1)
+ return ( id0 | ( id1 << 16 ) );
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVCalibParam::DecodeUniqueID(UInt_t uniqueID, Int_t& id0, Int_t& id1)
+{
+ /// Convert single integer into a pair (i,j)
+ id0 = ID0(uniqueID);
+ id1 = ID1(uniqueID);
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONVCalibParam::ID0(UInt_t uniqueID)
+{
+ /// Extract id0 from uniqueID
+ return uniqueID & 0xFFFF;
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONVCalibParam::ID0() const
+{
+ /// Extract first identifier
+ return ID0(GetUniqueID());
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONVCalibParam::ID1(UInt_t uniqueID)
+{
+ /// Extract id1 from uniqueID
+ return ( uniqueID & 0xFFFF0000 ) >> 16;
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONVCalibParam::ID1() const
+{
+ /// Extract second identifier
+ return ID1(GetUniqueID());
+}
+
+//_____________________________________________________________________________
+const char*
+AliMUONVCalibParam::GetName() const
+{
+ /// Build a name for this object
+ return Form("I=%d,J=%d",ID0(),ID1());
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVCalibParam::SetValueAsDouble(Int_t, Int_t, Double_t)
+{
+ /// By default, this one does not exist
+ AliFatal("Not implemented");
+}
+
+//_____________________________________________________________________________
+void
+AliMUONVCalibParam::SetValueAsDoubleFast(Int_t, Int_t, Double_t)
+{
+ /// By default, this one does not exist
+ AliFatal("Not implemented");
}
+
+//_____________________________________________________________________________
+Double_t
+AliMUONVCalibParam::ValueAsDouble(Int_t , Int_t ) const
+{
+ /// By default, this one does not exist
+ AliFatal("Not implemented");
+ return 0;
+}
+
+//_____________________________________________________________________________
+Double_t
+AliMUONVCalibParam::ValueAsDoubleFast(Int_t , Int_t ) const
+{
+ /// By default, this one does not exist
+ AliFatal("Not implemented");
+ return 0;
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONVCalibParam::Compare(const TObject* object) const
+{
+ /// Compare AliMUONVCalibParam objects, trying to get as complete an order as possible.
+ /// We sort by ID0, then by ID1
+ ///
+ const AliMUONVCalibParam* param = static_cast<const AliMUONVCalibParam*>(object);
+
+ if ( ID0() == param->ID0() )
+ {
+ if ( ID1() == param->ID1() )
+ {
+ return 0;
+ }
+ else
+ return (ID1() >= param->ID1()) ? 1 : -1;
+ }
+ else
+ return ( ID0() >= param->ID0()) ? 1 : -1;
+}
+
+