]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/mapping/AliMpMotifType.h
Patch for the pointer to AOD event
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifType.h
index 9b636fa46bcf2f4d5a77e3e33ff7a4fccc811607..10bbfbb808574b9706de24e911eda45797ae4b4a 100755 (executable)
 
 #include <TObject.h>
 
-#include "AliMpContainers.h"
+#include "AliMpEncodePair.h"
 
-#include "AliMpIntPair.h"
-#ifdef WITH_ROOT
-#include "AliMpExMap.h"
+#ifndef ROOT_TObjArray
+#  include <TObjArray.h>
 #endif
 
 #include <TString.h>
 
-#ifdef WITH_STL
-#include <map>
-#endif
-
-class AliMpConnection;
 class AliMpVPadIterator;
+class AliMpConnection;
 
 class AliMpMotifType : public TObject
-{
-  public:
-#ifdef WITH_STL
-    /// Connection map type
-    typedef std::map< AliMpIntPair, AliMpConnection* > ConnectionMap;
-    /// Connection map iterator type
-    typedef ConnectionMap::const_iterator     ConnectionMapCIterator;
-#endif    
-#ifdef WITH_ROOT
-    /// Connection map type
-    typedef AliMpExMap ConnectionMap;
-#endif    
-
+  {
   public:
     AliMpMotifType(const TString &id);
     AliMpMotifType(const AliMpMotifType& rhs);
     AliMpMotifType& operator=(const AliMpMotifType& rhs);
-    AliMpMotifType();
+    AliMpMotifType(TRootIOCtor* ioCtor);
     virtual ~AliMpMotifType();
-
+    
     TObject* Clone(const char* newname="") const;
     
     virtual AliMpVPadIterator* CreateIterator() const;
-
+    
     // find methods
     AliMpConnection *FindConnectionByPadNum(Int_t padNum) const;
     AliMpConnection *FindConnectionByLocalIndices(
-                               const AliMpIntPair& localIndices) const;
+                         MpPair_t localIndices) const;
+    AliMpConnection *FindConnectionByLocalIndices(
+                         Int_t localIx, Int_t localIy) const;
     AliMpConnection *FindConnectionByGassiNum(Int_t gassiNum) const;
     AliMpConnection *FindConnectionByKaptonNum(Int_t kaptonNum) const;
     AliMpConnection *FindConnectionByBergNum(Int_t bergNum) const;
-
-    AliMpIntPair FindLocalIndicesByPadNum(Int_t padNum) const;
-    AliMpIntPair FindLocalIndicesByGassiNum(Int_t gassiNum) const;
-    AliMpIntPair FindLocalIndicesByKaptonNum(Int_t kaptonNum) const;
-    AliMpIntPair FindLocalIndicesByBergNum(Int_t bergNum) const;
-    AliMpIntPair FindLocalIndicesByConnection(
-                               const AliMpConnection* connection) const;
-
+    
+    MpPair_t FindLocalIndicesByPadNum(Int_t padNum) const;
+    MpPair_t FindLocalIndicesByGassiNum(Int_t gassiNum) const;
+    MpPair_t FindLocalIndicesByKaptonNum(Int_t kaptonNum) const;
+    MpPair_t FindLocalIndicesByBergNum(Int_t bergNum) const;
+    MpPair_t FindLocalIndicesByConnection(
+                         const AliMpConnection* connection) const;
+    
     // set methods
     void SetNofPads(Int_t nofPadsX, Int_t nofPadY);
     
     // get methods
-             /// Return unique motif ID
+    /// Return unique motif ID
     TString  GetID() const        {return fID;}
-             /// Return number of pads in x direction
+    /// Return number of pads in x direction
     Int_t    GetNofPadsX() const  {return fNofPadsX;}
-             /// Return number of pads in y direction
+    /// Return number of pads in y direction
     Int_t    GetNofPadsY() const  {return fNofPadsY;}
-    Int_t    GetNofPads() const;
+    /// Return the total number of pads
+    Int_t    GetNofPads() const   {return fNofPads;}
     
     // Other methods
-    void AddConnection(const AliMpIntPair &localIndices, 
-                       AliMpConnection* connection);
+    Bool_t AddConnection(AliMpConnection* connection);
+
     virtual void Print(Option_t *option="") const;
+    
     Int_t   PadNum(const TString &padName) const;
+    
     TString PadName(Int_t padNum) const;
-    Bool_t  HasPad(const AliMpIntPair& localIndices) const;
-    Bool_t  IsFull() const;
+
+    Bool_t HasPadByLocalIndices(MpPair_t localIndices) const;
+    Bool_t HasPadByLocalIndices(Int_t localIx, Int_t localIy) const;
+
+    Bool_t HasPadByManuChannel(Int_t manuChannel) const;
+
+    /// Return whether the pad with given manu channel exists
+    Bool_t HasPadByGassiNum(Int_t gassiNum) const { return HasPadByManuChannel(gassiNum); }
+    
+    Bool_t IsFull() const;
     
     Bool_t Save(const char* motifName) const;
     Bool_t Save() const;
-
-  private:
-      void Copy(TObject& o) const;
     
   private:
+    /// Not implemented
+    AliMpMotifType();
+
+    // methods
+    void Copy(TObject& o) const;
+
     // static data members
     static const Int_t  fgkPadNumForA; ///< the pad number for the pad "A"
-  
+    
     // data members
     TString   fID;              ///< unique motif ID
     Int_t     fNofPadsX;        ///< number of pads in x direction
     Int_t     fNofPadsY;        ///< number of pads in y direction
-    ConnectionMap fConnections; ///< Map (ix,iy) of connections
+    Int_t     fNofPads;    ///< total number of pads (= the number of non-void entries in the arrays below)
+    Int_t     fMaxNofPads; ///< max number of pads we can hold
+    TObjArray fConnectionsByLocalIndices; ///< array [ix + 64*iy ] -> AliMpConnection*
+    TObjArray fConnectionsByManuChannel;  ///< array [manuChannel] -> AliMpConnection*
     
-  ClassDef(AliMpMotifType,1)  // Motif type
-};
+    ClassDef(AliMpMotifType,2)  // Motif type
+  };
 
 // inline functions
 
@@ -119,3 +121,4 @@ inline Bool_t AliMpMotifType::IsFull() const
 
 #endif //ALI_MP_MOTIF_TYPE_H
 
+