]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpPad.h
8837f3fe2fb66436b7cec6e8fd0afefbef17b22f
[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 <TClonesArray.h>
21
22 class AliMpPad : public TObject
23 {
24  public:
25   AliMpPad(Int_t manuId, Int_t channel,
26            Int_t ix, Int_t iy,
27            Double_t x,  Double_t y, 
28            Double_t dx,  Double_t dy,
29            Bool_t validity = true);
30   AliMpPad(Int_t manuId, Int_t channel,
31            MpPair_t indices,
32            Double_t positionX,  Double_t positionY, 
33            Double_t dx,  Double_t dy,
34            Bool_t validity = true);
35
36   AliMpPad();
37   AliMpPad(const AliMpPad& src);
38   ~AliMpPad();
39
40   //
41   // operators  
42   //
43   Bool_t operator == (const AliMpPad& pos2) const;
44   Bool_t operator != (const AliMpPad& pos2) const;
45   AliMpPad& operator = (const AliMpPad& src) ;
46   
47   //
48   // methods
49   //
50   void PrintOn(ostream& out) const;
51   void Print(const char* /*option*/ = "") const;
52
53   //
54   // static get methods
55   //
56                /// Return invalid pad
57   static AliMpPad Invalid() {return AliMpPad();}
58
59   //
60   // set methods
61   //
62   Bool_t  AddLocation(Int_t localBoardId, Int_t localBoardChannel, 
63                       Bool_t warn = true);
64
65   //
66   // get methods
67   //
68                /// Return pad location as encoded pair (manuId, manuChannel)
69   MpPair_t     GetLocation() const { return fLLocation; }
70   Int_t        GetManuId() const;
71   Int_t        GetManuChannel() const;
72   
73                /// Return pad indices as encoded pair (ix, iy)
74   MpPair_t     GetIndices()  const { return fLIndices; }
75   Int_t        GetIx() const;
76   Int_t        GetIy() const;
77   
78                /// Return the pad x position (in cm)
79   Double_t     GetPositionX() const { return fPositionX; }
80                /// Return the pad x position (in cm)
81   Double_t     GetPositionY() const { return fPositionY; }
82   
83                /// Return the x pad dimension - half length (in cm)
84   Double_t     GetDimensionX()  const {return fDimensionX;}
85                /// Return the y pad dimension - half length (in cm)
86   Double_t     GetDimensionY()  const {return fDimensionY;}
87
88                /// Return validity
89   Bool_t       IsValid()     const {return fValidity  ;}
90   
91   Int_t        GetNofLocations() const;
92   MpPair_t     GetLocation(Int_t i) const;  
93   Int_t        GetLocalBoardId(Int_t i) const;
94   Int_t        GetLocalBoardChannel(Int_t i) const;
95
96   Bool_t       HasLocation(Int_t localBoardId, Int_t localBoardChannel) const; 
97
98  private:
99
100   // static data members
101   static const Int_t  fgkMaxNofLocations; ///< \brief maximum number of pad locations
102                                           /// in the collection
103   // data members
104   UInt_t          fNofLocations;   ///<  number of locations in fLocations
105   MpPair_t*       fLLocations;     //[fNofLocations]  collection of pad locations - encoded pair (localBoardId, localBoardChannel) 
106   MpPair_t        fLLocation;      ///<  pad location as encoded pair (manuId, manuChannel) 
107   MpPair_t        fLIndices;       ///<  pad indices as encoded pair (ix, iy)  
108   Double_t        fPositionX;      ///<  the pad x position (in cm)
109   Double_t        fPositionY;      ///<  the pad y position (in cm)
110   Double_t        fDimensionX;     ///<  the pad x dimension - half length (in cm)
111   Double_t        fDimensionY;     ///<  the pad y dimension - half length(in cm)
112   Bool_t          fValidity;       ///<  validity
113
114   ClassDef(AliMpPad,4) //utility class for the motif type
115 };
116
117 ostream& operator << (ostream &out, const AliMpPad& op);
118 Bool_t operator < (const AliMpPad& left, const AliMpPad& right);
119
120 #endif //ALI_MP_PAD_H