]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpVRowSegmentSpecial.h
4c7c7c808935f640c52d27d3a908cc30945b04b7
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpVRowSegmentSpecial.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: AliMpVRowSegmentSpecial.h,v 1.10 2006/05/24 13:58:21 ivana Exp $
6
7 /// \ingroup sector
8 /// \class AliMpVRowSegmentSpecial
9 /// \brief Abstract base class for a special row segment composed of the 
10 /// pad rows.
11 ///
12 /// \author David Guez, Ivana Hrivnacova; IPN Orsay
13
14 #ifndef ALI_MP_V_ROW_SEGMENT_SPECIAL_H
15 #define ALI_MP_V_ROW_SEGMENT_SPECIAL_H
16
17 #include "AliMpContainers.h"
18
19 #include "AliMpVRowSegment.h"
20 #include "AliMpVMotif.h"
21
22 #include <TVector2.h>
23 #ifdef WITH_ROOT
24 #include <TArrayI.h>
25 #include <TObjArray.h>
26 #endif
27
28 #ifdef WITH_STL
29 #include <vector>
30 #endif
31
32 class AliMpRow;
33 class AliMpPadRow;
34 class AliMpVPadRowSegment;
35 class AliMpIntPair;
36
37 class AliMpVRowSegmentSpecial : public AliMpVRowSegment
38 {
39   public:
40 #ifdef WITH_STL
41     /// Pad row vector type
42     typedef std::vector<AliMpPadRow*>  PadRowVector;
43     /// Motif vector type
44     typedef std::vector<AliMpVMotif*>  MotifVector;
45     /// Motif position Id vector type
46     typedef std::vector<Int_t>         MotifPositionIdVector;
47 #endif
48 #ifdef WITH_ROOT
49     /// Pad row vector type
50     typedef  TObjArray  PadRowVector;
51     /// Motif vector type
52     typedef  TObjArray  MotifVector;
53     /// Motif position Id vector type
54     typedef  TArrayI    MotifPositionIdVector;
55 #endif
56
57   public:
58     AliMpVRowSegmentSpecial(AliMpRow* row, Double_t offsetX);
59     AliMpVRowSegmentSpecial();
60     virtual ~AliMpVRowSegmentSpecial();
61     
62     //
63     // methods
64     //
65     void  AddPadRow(AliMpPadRow* padRow);
66     void  UpdateMotifVector();
67     /// Update pads offset
68     virtual void  UpdatePadsOffset() = 0;
69     /// Return the x coordinate of the left border in the global coordinate system.
70     virtual Double_t  LeftBorderX() const = 0;
71     /// Return the x coordinate of the right border in the global coordinate system.
72     virtual Double_t  RightBorderX() const= 0;
73     /// Return the half size in y of this row segment.
74     virtual Double_t  HalfSizeY() const;
75
76     //
77     // find methods
78     //
79     virtual AliMpVMotif*  FindMotif(const TVector2& position) const;    
80     virtual Int_t     FindMotifPositionId(const TVector2& position) const;
81     virtual Bool_t    HasMotifPosition(Int_t motifPositionId) const;
82     virtual TVector2  MotifCenter(Int_t motifPositionId) const;
83
84     //
85     // geometry
86     //
87     /// Return the position of the row segment centre.
88     virtual TVector2  Position() const = 0;
89     virtual TVector2  Dimensions() const;
90
91     //
92     // set methods
93     //
94     /// Calculate offset
95     virtual void   SetOffset(const TVector2& /*offset*/) {}
96     /// Set global indices limits.
97     virtual void   SetGlobalIndices(AliMpRow* rowBefore) = 0;
98     /// Set global indices to i-th motif position and returns next index in x.
99     virtual Int_t  SetIndicesToMotifPosition(Int_t i, 
100                              const AliMpIntPair& indices) = 0;
101
102     //
103     // get methods
104     //
105     virtual AliMpRow*     GetRow() const;
106     virtual Int_t         GetNofMotifs() const;
107     virtual AliMpVMotif*  GetMotif(Int_t i) const;
108     virtual Int_t         GetMotifPositionId(Int_t i) const;
109
110   protected:
111     // methods
112     /// Return the coordinates of the motif specified with the given motif position Id                                           \n
113     virtual TVector2  MotifCenterSlow(Int_t motifPositionId) const = 0;
114     AliMpPadRow*         FindPadRow(Double_t y) const;
115     AliMpVPadRowSegment* FindPadRowSegment(Int_t motifPositionId) const;
116     AliMpIntPair         FindRelativeLowIndicesOf(Int_t motifPositionId) const;
117     Int_t   MaxNofPadsInRow() const;
118     Bool_t  HasMotif(const AliMpVMotif* motif) const;    
119
120     // get methods
121     Int_t         GetNofPadRows() const;
122     AliMpPadRow*  GetPadRow(Int_t i) const;
123     Double_t      GetOffsetX() const;
124
125   private:
126     /// Not implemented
127     AliMpVRowSegmentSpecial(const AliMpVRowSegmentSpecial& right);
128     /// Not implemented
129     AliMpVRowSegmentSpecial&  operator = (const AliMpVRowSegmentSpecial& right);
130
131 #ifdef WITH_ROOT
132     // static data members
133     static const Int_t  fgkMaxNofMotifPositionIds; ///< dimension of fMotifPositionIds
134 #endif    
135
136     // data members
137     AliMpRow*     fRow;     ///< the row containing this segment 
138     Double_t      fOffsetX; ///< \brief the x position of the border that touches a standard
139                             /// row segment
140     PadRowVector  fPadRows; ///< pad rows vector
141     MotifVector   fMotifs;  ///< motifs vector
142     MotifPositionIdVector  fMotifPositionIds; ///< motifs position Ids vector
143
144 #ifdef WITH_ROOT
145     Int_t  fNofMotifPositionIds; ///< number of motif positions Ids
146 #endif    
147     
148   ClassDef(AliMpVRowSegmentSpecial,1)  //Row segment
149 };
150
151 // inline functions
152
153 /// Return the x position of the border that touches a standard row segment
154 inline Double_t AliMpVRowSegmentSpecial::GetOffsetX() const
155 { return fOffsetX; }    
156
157 #endif //ALI_MP_V_ROW_SEGMENT_SPECIAL_H