]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/AliMUON2DMap.cxx
Added protection and 2 levels for problems
[u/mrichter/AliRoot.git] / MUON / AliMUON2DMap.cxx
index e695b0589462408f2dcf6c62a4431e45b2aa64bb..85c99f61d42dbabe7fea6e3f879bd9737fccc30b 100644 (file)
 #include "AliMpIntPair.h"
 #include "AliMpManuList.h"
 #include "AliMpDEManager.h"
-#include "AliMUONConstants.h"
+#include "AliMpConstants.h"
+#include <TList.h>
 
 /// \class AliMUON2DMap
-/// \brief Basic implementation of AliMUONV2DStore container using
+/// Basic implementation of AliMUONV2DStore container using
 /// AliMpExMap internally.
 /// What we store is a "double" map : an AliMpExMap of AliMpExMaps
 ///
@@ -47,7 +48,7 @@ AliMUON2DMap::AliMUON2DMap(Bool_t optimizeForDEManu)
     if ( fOptimizeForDEManu )
     {
       Int_t nDEs(0);
-      for ( Int_t i = 0; i < AliMUONConstants::NTrackingCh(); ++i )
+      for ( Int_t i = 0; i < AliMpConstants::NofTrackingChambers(); ++i )
       {
         nDEs += AliMpDEManager::GetNofDEInChamber(i);
       }
@@ -133,6 +134,34 @@ AliMUON2DMap::Iterator() const
   return 0x0;
 }
 
+//_____________________________________________________________________________
+AliMUONV2DStore* 
+AliMUON2DMap::Generate(const TObject& object)
+{
+  /// 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;
+}
+
 //_____________________________________________________________________________
 Bool_t 
 AliMUON2DMap::Set(Int_t i, Int_t j, TObject* object, Bool_t replace)