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