#include "AliMUON2DMapIterator.h"
#include "AliMpExMap.h"
#include "AliMpIntPair.h"
+#include "AliMpManuList.h"
+#include "AliMpDEManager.h"
+#include "AliMUONConstants.h"
+#include <TList.h>
/// \class AliMUON2DMap
/// \brief Basic implementation of AliMUONV2DStore container using
/// \endcond
//_____________________________________________________________________________
-AliMUON2DMap::AliMUON2DMap() : AliMUONV2DStore(), fMap(new AliMpExMap(true))
+AliMUON2DMap::AliMUON2DMap(Bool_t optimizeForDEManu)
+: AliMUONV2DStore(),
+ fMap(new AliMpExMap(true)),
+ fOptimizeForDEManu(optimizeForDEManu)
{
/// Default constructor.
+ if ( fOptimizeForDEManu )
+ {
+ Int_t nDEs(0);
+ for ( Int_t i = 0; i < AliMUONConstants::NTrackingCh(); ++i )
+ {
+ nDEs += AliMpDEManager::GetNofDEInChamber(i);
+ }
+ fMap->SetSize(nDEs);
+ }
}
//_____________________________________________________________________________
AliMUON2DMap::AliMUON2DMap(const AliMUON2DMap& other)
: AliMUONV2DStore(),
-fMap(0x0)
+fMap(0x0),
+fOptimizeForDEManu(kFALSE)
{
/// Copy constructor.
delete fMap;
}
+//_____________________________________________________________________________
+AliMUONV2DStore*
+AliMUON2DMap::CloneEmpty() const
+{
+ /// Create a void copy of *this.
+ return new AliMUON2DMap(fOptimizeForDEManu);
+}
+
//_____________________________________________________________________________
void
-AliMUON2DMap::CopyTo(AliMUON2DMap&) const
+AliMUON2DMap::CopyTo(AliMUON2DMap& dest) const
{
-/// Copy this into dest.
+ /// Copy this into dest.
- AliFatal("Implement me if needed");
+ delete dest.fMap;
+ dest.fMap = new AliMpExMap(*fMap);
+ dest.fOptimizeForDEManu = fOptimizeForDEManu;
}
//_____________________________________________________________________________
}
//_____________________________________________________________________________
-void
-AliMUON2DMap::Print(Option_t*) const
+AliMUONV2DStore*
+AliMUON2DMap::Generate(const TObject& object)
{
-/// Not implemented (yet?)
+ /// Build a complete (i.e. all detElemId,manuId couple will be there) store
+ /// but with identical values, given by object
+ /// The returned store will be obviously optimized for DEManu.
+
+ AliMUONV2DStore* store = new AliMUON2DMap(true);
+
+ TList* list = AliMpManuList::ManuList();
+
+ AliMpIntPair* pair;
+
+ TIter next(list);
+
+ while ( ( pair = static_cast<AliMpIntPair*>(next()) ) )
+ {
+ Int_t detElemId = pair->GetFirst();
+ Int_t manuId = pair->GetSecond();
+ store->Set(detElemId,manuId,object.Clone(),kFALSE);
+ }
+
+ delete list;
+
+ return store;
}
//_____________________________________________________________________________
if ( !o )
{
AliMpExMap* m = new AliMpExMap(true);
+ if ( fOptimizeForDEManu )
+ {
+ Int_t n(AliMpManuList::NumberOfManus(i));
+ if (!n)
+ {
+ AliError(Form("This does not look right : i = %d is supposed to "
+ "be a DetElemId with n = %d manus!",i,n));
+ }
+ else
+ {
+ m->SetSize(n);
+ }
+ }
fMap->Add(i,m);
o = fMap->GetValue(i);
}