#include "AliLog.h"
#include "AliMpExMap.h"
-#include <cassert>
+///
+/// Basic implementation of AliMUONV2DStore container using
+/// AliMpExMap internally.
+/// What we store is a "double" map : an AliMpExMap of AliMpExMaps
+///
ClassImp(AliMUON2DMap)
//
}
-//______________________________________________________________________________
-AliMUON2DMap::AliMUON2DMap(const AliMUON2DMap& right)
- : AliMUONV2DStore(right)
-{
-/// Protected copy constructor (not implemented)
+//_____________________________________________________________________________
+AliMUON2DMap::AliMUON2DMap(const AliMUON2DMap& other)
+: AliMUONV2DStore(),
+fMap(0x0)
+{
+ other.CopyTo(*this);
+}
- AliFatal("Copy constructor not provided.");
+//_____________________________________________________________________________
+AliMUON2DMap&
+AliMUON2DMap::operator=(const AliMUON2DMap& other)
+{
+ other.CopyTo(*this);
+ return *this;
}
//_____________________________________________________________________________
delete fMap;
}
-//______________________________________________________________________________
-AliMUON2DMap&
-AliMUON2DMap::operator=(const AliMUON2DMap& right)
+//_____________________________________________________________________________
+void
+AliMUON2DMap::CopyTo(AliMUON2DMap&) const
{
-/// Protected assignement operator (not implemented)
-
- // check assignement to self
- if (this == &right) return *this;
-
- AliFatal("Assignement operator not provided.");
-
- return *this;
-}
+ //
+ // Copy this into dest.
+ //
+ AliFatal("Implement me if needed");
+}
//_____________________________________________________________________________
TObject*
AliMpExMap* m = new AliMpExMap(true);
fMap->Add(i,m);
o = fMap->GetValue(i);
- assert(m==o);
}
AliMpExMap* m = dynamic_cast<AliMpExMap*>(o);
if (!m) AliFatal(Form("fMap[%d] not of the expected type",i));
class AliMUON2DMap : public AliMUONV2DStore
{
public:
- AliMUON2DMap();
+ AliMUON2DMap();
virtual ~AliMUON2DMap();
virtual TObject* Get(Int_t i, Int_t j) const;
- virtual Bool_t Set(Int_t i, Int_t j, TObject*, Bool_t replace);
+ virtual Bool_t Set(Int_t i, Int_t j, TObject* object, Bool_t replace);
virtual Bool_t IsOwner() const { return kTRUE; }
virtual void Print(Option_t* opt="") const;
protected:
- AliMUON2DMap(const AliMUON2DMap& right);
- AliMUON2DMap& operator = (const AliMUON2DMap& right);
-
+ AliMUON2DMap(const AliMUON2DMap& other);
+ AliMUON2DMap& operator = (const AliMUON2DMap& other);
+
+private:
+ void CopyTo(AliMUON2DMap& destination) const;
private:
- AliMpExMap* fMap;
+ AliMpExMap* fMap; // Our internal map (an AliMpExMap of AliMpExMaps)
ClassDef(AliMUON2DMap,1) // A 2D container
};
#include "TMath.h"
#include "TString.h"
+/// This class is implementing the AliMUONVCalibParam interface.
+///
+/// It stores a given number of integers.
+///
+/// Those integers can also be retrieved as floats if really needed
+/// (this is to comply with the base class).
+///
+/// You might consider just as it is, namely a C++ wrapper to
+/// a plain int[] array.
+
ClassImp(AliMUONCalibParam1I)
//_____________________________________________________________________________
}
}
-//______________________________________________________________________________
-AliMUONCalibParam1I::AliMUONCalibParam1I(const AliMUONCalibParam1I& right)
- : AliMUONVCalibParam(right)
-{
-/// Protected copy constructor (not implemented)
+//_____________________________________________________________________________
+AliMUONCalibParam1I::AliMUONCalibParam1I(const AliMUONCalibParam1I& other)
+: AliMUONVCalibParam(other),
+fSize(0),
+fValues(0x0)
+{
+ //
+ // Copy ctor
+ //
+ other.CopyTo(*this);
+}
- AliFatal("Copy constructor not provided.");
+//_____________________________________________________________________________
+AliMUONCalibParam1I&
+AliMUONCalibParam1I::operator=(const AliMUONCalibParam1I& other)
+{
+ //
+ // Assignment operator
+ //
+ AliMUONVCalibParam::operator=(other);
+ other.CopyTo(*this);
+ return *this;
}
//_____________________________________________________________________________
delete[] fValues;
}
-//______________________________________________________________________________
-AliMUONCalibParam1I&
-AliMUONCalibParam1I::operator=(const AliMUONCalibParam1I& right)
+//_____________________________________________________________________________
+void
+AliMUONCalibParam1I::CopyTo(AliMUONCalibParam1I& destination) const
{
-/// Protected assignement operator (not implemented)
-
- // check assignement to self
- if (this == &right) return *this;
-
- AliFatal("Assignement operator not provided.");
-
- return *this;
-}
+ //
+ // Copy this into destination.
+ //
+ delete[] destination.fValues;
+ destination.fSize = fSize;
+ if ( fSize > 0 )
+ {
+ destination.fValues = new Int_t[fSize];
+ for ( Int_t i = 0; i < fSize; ++i )
+ {
+ destination.fValues[i] = fValues[i];
+ }
+ }
+}
//_____________________________________________________________________________
void
public:
AliMUONCalibParam1I();
AliMUONCalibParam1I(Int_t theSize, Int_t fillWithValue=0);
+ AliMUONCalibParam1I(const AliMUONCalibParam1I& other);
+ AliMUONCalibParam1I& operator=(const AliMUONCalibParam1I& other);
virtual ~AliMUONCalibParam1I();
+ /// The dimension of this object is 1, i.e. it's a vector.
virtual Int_t Dimension() const { return 1; }
virtual void Print(Option_t* opt="") const;
+ /** Set the value located at i (j must be zero).
+ * Note that the internal structure store ints, so the float is rounded
+ * prior to be stored
+ */
virtual void SetValueAsFloat(Int_t i, Int_t j, Float_t value);
+
+ /// Set the value located at i (j must be zero), as an int.
virtual void SetValueAsInt(Int_t i, Int_t j, Int_t value);
+ /// The number of values we hold.
virtual Int_t Size() const { return fSize; }
+ /// Retrieve the value located at i (j must remain zero), as a float.
virtual Float_t ValueAsFloat(Int_t i, Int_t j=0) const;
+
+ /// Retrieve the value located at i (j must remain zero).
virtual Int_t ValueAsInt(Int_t i, Int_t j=0) const;
- protected:
- AliMUONCalibParam1I(const AliMUONCalibParam1I& right);
- AliMUONCalibParam1I& operator = (const AliMUONCalibParam1I& right);
-
- private:
- Int_t fSize;
+private:
+ /// Copy *this to destination (used by copy ctor and operator=).
+ void CopyTo(AliMUONCalibParam1I& destination) const;
+
+private:
+ Int_t fSize; // The number of values we hold
Int_t* fValues; //[fSize]
ClassDef(AliMUONCalibParam1I,1) // Container for calibration parameters
#include "TMath.h"
#include "TString.h"
+///
+/// Implementation of AliMUONVCalibParam for pair of floats.
+///
+/// Conceptually, this class is the equivalent of a vector or float pairs,
+/// but it is implemented using bare Float_t[] array.
+///
+
ClassImp(AliMUONCalibParam2F)
//_____________________________________________________________________________
}
}
-//______________________________________________________________________________
-AliMUONCalibParam2F::AliMUONCalibParam2F(const AliMUONCalibParam2F& right)
- : AliMUONVCalibParam(right)
-{
-/// Protected copy constructor (not implemented)
- AliFatal("Copy constructor not provided.");
+//_____________________________________________________________________________
+AliMUONCalibParam2F::AliMUONCalibParam2F(const AliMUONCalibParam2F& other)
+: AliMUONVCalibParam(),
+fSize(0),
+fN(0),
+fValues(0x0)
+{
+ other.CopyTo(*this);
+}
+
+//_____________________________________________________________________________
+AliMUONCalibParam2F&
+AliMUONCalibParam2F::operator=(const AliMUONCalibParam2F& other)
+{
+ other.CopyTo(*this);
+ return *this;
}
//_____________________________________________________________________________
delete[] fValues;
}
-//______________________________________________________________________________
-AliMUONCalibParam2F&
-AliMUONCalibParam2F::operator=(const AliMUONCalibParam2F& right)
+//_____________________________________________________________________________
+void
+AliMUONCalibParam2F::CopyTo(AliMUONCalibParam2F& destination) const
{
-/// Protected assignement operator (not implemented)
-
- // check assignement to self
- if (this == &right) return *this;
+ //
+ // Copy *this to destination
+ //
+ delete[] destination.fValues;
+ destination.fN = fN;
+ destination.fSize = fSize;
- AliFatal("Assignement operator not provided.");
-
- return *this;
-}
+ if ( fN > 0 )
+ {
+ destination.fValues = new Float_t[fN];
+ for ( Int_t i = 0; i < fN; ++i )
+ {
+ destination.fValues[i] = fValues[i];
+ }
+ }
+}
//_____________________________________________________________________________
Int_t
public:
AliMUONCalibParam2F();
AliMUONCalibParam2F(Int_t theSize, Int_t fillWithValue=0);
+ AliMUONCalibParam2F(const AliMUONCalibParam2F& other);
+ AliMUONCalibParam2F& operator=(const AliMUONCalibParam2F& other);
+
virtual ~AliMUONCalibParam2F();
virtual Int_t Dimension() const { return 2; }
virtual Float_t ValueAsFloat(Int_t i, Int_t j=0) const;
virtual Int_t ValueAsInt(Int_t i, Int_t j=0) const;
-
-protected:
- AliMUONCalibParam2F(const AliMUONCalibParam2F& right);
- AliMUONCalibParam2F& operator = (const AliMUONCalibParam2F& right);
private:
+ void CopyTo(AliMUONCalibParam2F& destination) const;
Int_t Index(Int_t i, Int_t j) const;
private:
- Int_t fSize;
- Int_t fN;
+ Int_t fSize; // The number of float pair we hold
+ Int_t fN; // The total number of floats we hold (2*fSize)
Float_t* fValues; //[fN]
ClassDef(AliMUONCalibParam2F,1) // Container for calibration parameters
#include "AliMUONConstants.h"
-#include <TMath.h>
+#include "TMath.h"
+
+///
+/// This class holds various constants to be used in many places,
+/// such as the number of tracking and trigger chambers,
+/// some geometrical constants (to build the initial geometry for simulation)
+/// and mathieson distribution default values.
+/// Those constants should as much as possible replace hard-coded values
+/// which are to be considered strictly illegal in the MUON code (or any code,
+/// by the way).
+///
Int_t AliMUONConstants::fgNCh = 14;
Int_t AliMUONConstants::fgNTrackingCh = 10;
#include "AliMUONV2DStore.h"
+///
+/// Defines an interface equivalent to a 2D array of TObject, indexed
+/// by a pair of integers (somehow a matrix,
+/// except that indices are not necessarily sequential).
+///
+/// It's extremely simple and hopefully allow many implementations.
+/// It also makes the object ownership self-evident.
+///
+
ClassImp(AliMUONV2DStore)
+//_____________________________________________________________________________
+AliMUONV2DStore::AliMUONV2DStore()
+{
+}
+
//_____________________________________________________________________________
AliMUONV2DStore::~AliMUONV2DStore()
{
class AliMUONV2DStore : public TObject
{
public:
+ AliMUONV2DStore();
virtual ~AliMUONV2DStore();
/// Return the object stored at (i,j).