]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpPad.h
Replacement of AliMpIntPair object with algoritmic
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpPad.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: AliMpPad.h,v 1.11 2006/05/24 13:58:07 ivana Exp $
6
7 /// \ingroup basic
8 /// \class AliMpPad
9 /// \brief Class which encapsuate all information about a pad
10 ///
11 /// \author David Guez, Ivana Hrivnacova; IPN Orsay
12
13 #ifndef ALI_MP_PAD_H
14 #define ALI_MP_PAD_H
15
16 #include "AliMpEncodePair.h"
17
18 #include <TObject.h>
19
20 #include <TVector2.h>
21 #include <TClonesArray.h>
22
23 class AliMpPad : public TObject
24 {
25  public:
26   AliMpPad(Int_t manuId, Int_t channel,
27            Int_t ix, Int_t iy,
28            const TVector2& position, const TVector2& dimensions,
29            Bool_t validity = true);
30   AliMpPad(Int_t manuId, Int_t channel,
31            MpPair_t indices,
32            const TVector2& position, const TVector2& dimensions,
33            Bool_t validity = true);
34
35   AliMpPad();
36   AliMpPad(const AliMpPad& src);
37   virtual ~AliMpPad();
38
39   //
40   // operators  
41   //
42   Bool_t operator == (const AliMpPad& pos2) const;
43   Bool_t operator != (const AliMpPad& pos2) const;
44   AliMpPad& operator = (const AliMpPad& src) ;
45   
46   //
47   // methods
48   //
49           void PrintOn(ostream& out) const;
50   virtual void Print(const char* /*option*/ = "") const;
51
52   //
53   // static get methods
54   //
55                /// Return invalid pad
56   static AliMpPad Invalid() {return AliMpPad();}
57
58   //
59   // set methods
60   //
61   Bool_t  AddLocation(Int_t localBoardId, Int_t localBoardChannel, 
62                       Bool_t warn = true);
63
64   //
65   // get methods
66   //
67                /// Return pad location as encoded pair (manuId, manuChannel)
68   MpPair_t     GetLocation() const { return fLLocation; }
69   Int_t        GetManuId() const;
70   Int_t        GetManuChannel() const;
71   
72                /// Return pad indices as encoded pair (ix, iy)
73   MpPair_t     GetIndices()  const { return fLIndices; }
74   Int_t        GetIx() const;
75   Int_t        GetIy() const;
76   
77                /// Return the pad position (in cm)
78   TVector2     Position()    const {return fPosition  ;}
79                /// Return the pad dimensions (in cm)
80   TVector2     Dimensions()  const {return fDimensions;}
81                /// Return validity
82   Bool_t       IsValid()     const {return fValidity  ;}
83   
84   Int_t        GetNofLocations() const;
85   MpPair_t     GetLocation(Int_t i) const;  
86   Int_t        GetLocalBoardId(Int_t i) const;
87   Int_t        GetLocalBoardChannel(Int_t i) const;
88
89   Bool_t       HasLocation(Int_t localBoardId, Int_t localBoardChannel) const; 
90
91  private:
92
93   // static data members
94   static const Int_t  fgkMaxNofLocations; ///< \brief maximum number of pad locations
95                                           /// in the collection
96   // data members
97   MpPair_t*       fLLocations;     ///<  collection of pad locations - encoded pair (localBoardId, localBoardChannel) 
98   UInt_t          fNofLocations;   ///<  number of locations in fLocations
99   MpPair_t        fLLocation;      ///<  pad location as encoded pair (manuId, manuChannel) 
100   MpPair_t        fLIndices;       ///<  pad indices as encoded pair (ix, iy)  
101   TVector2        fPosition;       ///<  the pad position (in cm)
102   TVector2        fDimensions;     ///<  the pad dimensions (in cm)
103   Bool_t          fValidity;       ///<  validity
104
105   ClassDef(AliMpPad,3) //utility class for the motif type
106 };
107
108 ostream& operator << (ostream &out, const AliMpPad& op);
109 Bool_t operator < (const AliMpPad& left, const AliMpPad& right);
110
111 #endif //ALI_MP_PAD_H