]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpMotifType.h
3be991e03f3630b4b4d5941a1b2ed89a3f626307
[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 #ifndef ROOT_TObjArray
22 #  include "TObjArray.h"
23 #endif
24
25 #include <TString.h>
26
27 class AliMpVPadIterator;
28 class AliMpConnection;
29
30 class AliMpMotifType : public TObject
31   {
32   public:
33     AliMpMotifType(const TString &id);
34     AliMpMotifType(const AliMpMotifType& rhs);
35     AliMpMotifType& operator=(const AliMpMotifType& rhs);
36     AliMpMotifType(TRootIOCtor* ioCtor);
37     virtual ~AliMpMotifType();
38     
39     TObject* Clone(const char* newname="") const;
40     
41     virtual AliMpVPadIterator* CreateIterator() const;
42     
43     // find methods
44     AliMpConnection *FindConnectionByPadNum(Int_t padNum) const;
45     AliMpConnection *FindConnectionByLocalIndices(
46                          const AliMpIntPair& localIndices) const;
47     AliMpConnection *FindConnectionByGassiNum(Int_t gassiNum) const;
48     AliMpConnection *FindConnectionByKaptonNum(Int_t kaptonNum) const;
49     AliMpConnection *FindConnectionByBergNum(Int_t bergNum) const;
50     
51     AliMpIntPair FindLocalIndicesByPadNum(Int_t padNum) const;
52     AliMpIntPair FindLocalIndicesByGassiNum(Int_t gassiNum) const;
53     AliMpIntPair FindLocalIndicesByKaptonNum(Int_t kaptonNum) const;
54     AliMpIntPair FindLocalIndicesByBergNum(Int_t bergNum) const;
55     AliMpIntPair FindLocalIndicesByConnection(
56                          const AliMpConnection* connection) const;
57     
58     // set methods
59     void SetNofPads(Int_t nofPadsX, Int_t nofPadY);
60     
61     // get methods
62     /// Return unique motif ID
63     TString  GetID() const        {return fID;}
64     /// Return number of pads in x direction
65     Int_t    GetNofPadsX() const  {return fNofPadsX;}
66     /// Return number of pads in y direction
67     Int_t    GetNofPadsY() const  {return fNofPadsY;}
68     
69     Int_t    GetNofPads() const   {return fNofPads;}
70     
71     // Other methods
72     Bool_t AddConnection(AliMpConnection* connection);
73
74     virtual void Print(Option_t *option="") const;
75     
76     Int_t   PadNum(const TString &padName) const;
77     
78     TString PadName(Int_t padNum) const;
79
80     Bool_t HasPadByLocalIndices(const AliMpIntPair& localIndices) const;
81
82     Bool_t HasPadByManuChannel(Int_t manuChannel) const;
83
84     Bool_t HasPadByGassiNum(Int_t gassiNum) const { return HasPadByManuChannel(gassiNum); }
85     
86     Bool_t IsFull() const;
87     
88     Bool_t Save(const char* motifName) const;
89     Bool_t Save() const;
90     
91   private:
92     /// Not implemented
93     AliMpMotifType();
94
95     // methods
96     void Copy(TObject& o) const;
97
98     // static data members
99     static const Int_t  fgkPadNumForA; ///< the pad number for the pad "A"
100     
101     // data members
102     TString   fID;              ///< unique motif ID
103     Int_t     fNofPadsX;        ///< number of pads in x direction
104     Int_t     fNofPadsY;        ///< number of pads in y direction
105     Int_t     fNofPads;    ///< total number of pads (= the number of non-void entries in the arrays below)
106     Int_t     fMaxNofPads; ///< max number of pads we can hold
107     TObjArray fConnectionsByLocalIndices; ///< array [ix + 64*iy ] -> AliMpConnection*
108     TObjArray fConnectionsByManuChannel;  ///< array [manuChannel] -> AliMpConnection*
109     
110     ClassDef(AliMpMotifType,2)  // Motif type
111   };
112
113 // inline functions
114
115 /// Return true if the motif conatins all pads
116 inline Bool_t AliMpMotifType::IsFull() const 
117 { return GetNofPads() == fNofPadsX*fNofPadsY; }
118
119 #endif //ALI_MP_MOTIF_TYPE_H
120
121