]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpMotifType.h
Corrected GetNeighbours() (Laurent)
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpMotifType.h
1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2  * See cxx source for full Copyright notice                               */
3
4 // $Id$
5 // $MpId: AliMpMotifType.h,v 1.11 2006/05/24 13:58:18 ivana Exp $
6
7 /// \ingroup motif
8 /// \class AliMpMotifType
9 /// \brief Class that defines the motif properties.
10 ///
11 /// \author David Guez, Ivana Hrivnacova; IPN Orsay
12
13 #ifndef ALI_MP_MOTIF_TYPE_H
14 #define ALI_MP_MOTIF_TYPE_H
15
16 #include <TObject.h>
17
18 #include "AliMpContainers.h"
19
20 #include "AliMpIntPair.h"
21 #ifdef WITH_ROOT
22 #include "AliMpExMap.h"
23 #endif
24
25 #include <TString.h>
26
27 #ifdef WITH_STL
28 #include <map>
29 #endif
30
31 class AliMpConnection;
32 class AliMpVPadIterator;
33
34 class AliMpMotifType : public TObject
35 {
36   public:
37 #ifdef WITH_STL
38     typedef std::map< AliMpIntPair, AliMpConnection* > ConnectionMap;
39     typedef ConnectionMap::const_iterator     ConnectionMapCIterator;
40 #endif    
41 #ifdef WITH_ROOT
42     typedef AliMpExMap ConnectionMap;
43 #endif    
44
45   public:
46       /** Please note that id should be of the form %s for station 1,2,
47         %s-%e-%e for station345 and %sx%e for stationTrigger
48       */
49     AliMpMotifType(const TString &id);
50     AliMpMotifType(const AliMpMotifType& rhs);
51     AliMpMotifType& operator=(const AliMpMotifType& rhs);
52     AliMpMotifType();
53     virtual ~AliMpMotifType();
54
55     TObject* Clone(const char* newname="") const;
56     
57     virtual AliMpVPadIterator* CreateIterator() const;
58
59     // find methods
60     AliMpConnection *FindConnectionByPadNum(Int_t padNum) const;
61     AliMpConnection *FindConnectionByLocalIndices(
62                                const AliMpIntPair& localIndices) const;
63     AliMpConnection *FindConnectionByGassiNum(Int_t gassiNum) const;
64     AliMpConnection *FindConnectionByKaptonNum(Int_t kaptonNum) const;
65     AliMpConnection *FindConnectionByBergNum(Int_t bergNum) const;
66
67     AliMpIntPair FindLocalIndicesByPadNum(Int_t padNum) const;
68     AliMpIntPair FindLocalIndicesByGassiNum(Int_t gassiNum) const;
69     AliMpIntPair FindLocalIndicesByKaptonNum(Int_t kaptonNum) const;
70     AliMpIntPair FindLocalIndicesByBergNum(Int_t bergNum) const;
71     AliMpIntPair FindLocalIndicesByConnection(
72                                const AliMpConnection* connection) const;
73
74     // set methods
75     void SetNofPads(Int_t nofPadsX, Int_t nofPadY);
76     void SetVerboseLevel(Int_t level){fVerboseLevel=level;}
77     
78     // get methods
79     TString  GetID() const        {return fID;}
80     Int_t    GetNofPadsX() const  {return fNofPadsX;}
81     Int_t    GetNofPadsY() const  {return fNofPadsY;}
82     Int_t    GetNofPads() const;
83     
84     // Other methods
85     void AddConnection(const AliMpIntPair &localIndices, 
86                        AliMpConnection* connection);
87     virtual void Print(Option_t *option="") const;
88     Int_t   PadNum(const TString &padName) const;
89     TString PadName(Int_t padNum) const;
90     Bool_t  HasPad(const AliMpIntPair& localIndices) const;
91     Bool_t  IsFull() const;
92     
93     Bool_t Save(const char* motifName) const;
94     Bool_t Save() const;
95
96   private:
97       void Copy(TObject& o) const;
98     
99   private:
100     // static data members
101     static const Int_t  fgkPadNumForA; ///< the pad number for the pad "A"
102   
103     // data members
104     TString   fID;              ///< unique motif ID
105     Int_t     fNofPadsX;        ///< number of pads in x direction
106     Int_t     fNofPadsY;        ///< number of pads in y direction
107     Int_t     fVerboseLevel;    ///< verbose level
108     ConnectionMap fConnections; ///< Map (ix,iy) of connections
109     
110   ClassDef(AliMpMotifType,1)  // Motif type
111 };
112
113 // inline functions
114
115 inline Bool_t AliMpMotifType::IsFull() const 
116 { return GetNofPads() == fNofPadsX*fNofPadsY; }
117
118 #endif //ALI_MP_MOTIF_TYPE_H
119