]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpPad.h
Adding new libraries
[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 <TObject.h>
17
18 #include "AliMpContainers.h"
19 #include "AliMpIntPair.h"
20
21 #include <TVector2.h>
22 #ifdef WITH_ROOT
23 #include <TClonesArray.h>
24 #endif
25
26 #ifdef WITH_STL
27 #include <vector>
28 #endif
29
30 class AliMpPad : public TObject
31 {
32  public:
33 #ifdef WITH_STL
34   /// Int pair vector type
35   typedef std::vector<AliMpIntPair> IntPairVector;
36 #endif
37 #ifdef WITH_ROOT
38   /// Int pair vector type
39   typedef TClonesArray  IntPairVector;
40 #endif
41
42  public:
43   AliMpPad(const AliMpIntPair& location, const AliMpIntPair& indices,
44            const TVector2& position, const TVector2& dimensions,
45            Bool_t validity = true);
46   AliMpPad();
47   AliMpPad(const AliMpPad& src);
48   virtual ~AliMpPad();
49
50   //
51   // operators  
52   //
53   Bool_t operator == (const AliMpPad& pos2) const;
54   Bool_t operator != (const AliMpPad& pos2) const;
55   AliMpPad& operator = (const AliMpPad& src) ;
56   
57   //
58   // methods
59   //
60           void PrintOn(ostream& out) const;
61   virtual void Print(const char* /*option*/ = "") const;
62
63   //
64   // static get methods
65   //
66                /// Return invalid pad
67   static AliMpPad Invalid() {return AliMpPad();}
68
69   //
70   // set methods
71   //
72   Bool_t  AddLocation(const AliMpIntPair& location, Bool_t warn = true);
73
74   //
75   // get methods
76   //
77                /// Return pad location
78   AliMpIntPair GetLocation() const {return fLocation;}
79                /// Return pad indices
80   AliMpIntPair GetIndices()  const {return fIndices;}
81                /// Return the pad position (in cm)
82   TVector2     Position()    const {return fPosition  ;}
83                /// Return the pad dimensions (in cm)
84   TVector2     Dimensions()  const {return fDimensions;}
85                /// Return validity
86   Bool_t       IsValid()     const {return fValidity  ;}
87   
88   Int_t        GetNofLocations() const;
89   AliMpIntPair GetLocation(Int_t i) const;
90   Bool_t       HasLocation(const AliMpIntPair& location) const; 
91
92  private:
93   // static data members
94   static const Int_t  fgkMaxNofLocations; ///< \brief maximum number of pad locations
95                                           /// in the collection
96   // data members
97   IntPairVector*  fLocations;      ///<  collection of pad locations 
98   AliMpIntPair    fLocation;       ///<  pad location
99   AliMpIntPair    fIndices;        ///<  pad indices
100   TVector2        fPosition;       ///<  the pad position (in cm)
101   TVector2        fDimensions;     ///<  the pad dimensions (in cm)
102   Bool_t          fValidity;       ///<  validity
103
104   ClassDef(AliMpPad,1) //utility class for the motif type
105 };
106
107 ostream& operator << (ostream &out, const AliMpPad& op);
108 Bool_t operator < (const AliMpPad& left, const AliMpPad& right);
109
110 #endif //ALI_MP_PAD_H