]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpMotifType.h
mapping/AliMpPlaneSegmentation.cxx
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifType.h
1 // $Id$
2 // Category: motif
3 //
4 // Class AliMpMotifType
5 // --------------------
6 // Class that defines the motif properties.
7 //
8 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
9
10 #ifndef ALI_MP_MOTIF_TYPE_H
11 #define ALI_MP_MOTIF_TYPE_H
12
13 #include <TObject.h>
14 #include <TString.h>
15
16 #include "AliMpMotifTypes.h"
17 #include "AliMpIntPair.h"
18
19 class AliMpConnection;
20 class AliMpVPadIterator;
21
22 class AliMpMotifType : public TObject
23 {
24   public:
25     AliMpMotifType(const TString &id);
26     AliMpMotifType();
27     virtual ~AliMpMotifType();
28
29     virtual AliMpVPadIterator* CreateIterator() const;
30
31     // find methods
32     AliMpConnection *FindConnectionByPadNum(Int_t padNum) const;
33     AliMpConnection *FindConnectionByLocalIndices(
34                                const AliMpIntPair& localIndices) const;
35     AliMpConnection *FindConnectionByGassiNum(Int_t gassiNum) const;
36     AliMpConnection *FindConnectionByKaptonNum(Int_t kaptonNum) const;
37     AliMpConnection *FindConnectionByBergNum(Int_t bergNum) const;
38
39     AliMpIntPair FindLocalIndicesByPadNum(Int_t padNum) const;
40     AliMpIntPair FindLocalIndicesByGassiNum(Int_t gassiNum) const;
41     AliMpIntPair FindLocalIndicesByKaptonNum(Int_t kaptonNum) const;
42     AliMpIntPair FindLocalIndicesByBergNum(Int_t bergNum) const;
43     AliMpIntPair FindLocalIndicesByConnection(
44                                const AliMpConnection* connection) const;
45
46     // set methods
47     void SetNofPads(Int_t nofPadsX, Int_t nofPadY);
48     void SetVerboseLevel(Int_t level){fVerboseLevel=level;}
49     
50     // get methods
51     TString  GetID() const        {return fID;}
52     Int_t    GetNofPadsX() const  {return fNofPadsX;}
53     Int_t    GetNofPadsY() const  {return fNofPadsY;}
54     Int_t    GetNofPads() const;
55     
56     // Other methods
57     void AddConnection(const AliMpIntPair &localIndices, 
58                        AliMpConnection* connection);
59     virtual void Print(Option_t *option) const;
60     Int_t   PadNum(const TString &padName) const;
61     TString PadName(Int_t padNum) const;
62     Bool_t  HasPad(const AliMpIntPair& localIndices) const;
63     Bool_t  IsFull() const;
64
65   private:
66     // static data members
67     static const Int_t   fgkPadNumForA; // the pad number for the pad "A"
68
69 #ifdef WITH_ROOT
70     static const Int_t   fgkSeparator;  // the separator used for conversion
71                                         // of AliMpIntPair to Int_t
72     
73     // methods
74     Int_t  GetIndex(const AliMpIntPair& pair) const;
75     AliMpIntPair  GetPair(Int_t index) const;
76 #endif
77   
78     // data members
79     TString   fID;        // unique motif ID
80     Int_t     fNofPadsX;  // number of pads in x direction
81     Int_t     fNofPadsY;  // number of pads in y direction
82     Int_t     fVerboseLevel;  // verbose level
83
84 #ifdef WITH_STL
85     ConnectionMap_t fConnections; //! Map (ix,iy) of connections
86 #endif    
87 #ifdef WITH_ROOT
88     mutable ConnectionMap_t fConnections; // Map (ix,iy) of connections
89 #endif    
90     
91   ClassDef(AliMpMotifType,1)  //Motif type
92 };
93
94 // inline functions
95
96 inline Bool_t AliMpMotifType::IsFull() const 
97 { return GetNofPads() == fNofPadsX*fNofPadsY; }
98
99 #endif //ALI_MP_MOTIF_TYPE_H
100