]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpSector.h
In SetNofManusPerModule(): return false if no action
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSector.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: AliMpSector.h,v 1.14 2006/05/24 13:58:21 ivana Exp $
6
7 /// \ingroup sector
8 /// \class AliMpSector
9 /// \brief A sector (quadrant) of the MUON chamber of stations 1 and 2.
10 ///
11 /// \author David Guez, Ivana Hrivnacova; IPN Orsay
12
13 #ifndef ALI_MP_SECTOR_H
14 #define ALI_MP_SECTOR_H
15
16 #include <TNamed.h>
17
18 #include "AliMpContainers.h"
19
20 #include "AliMpDirection.h"
21 #include "AliMpPlaneType.h"
22 #include "AliMpIntPair.h"
23
24 #include <TString.h>
25 #include <TVector2.h>
26 #ifdef WITH_ROOT
27 #include <TObjArray.h>
28 #endif
29
30 #ifdef WITH_STL
31 #include <vector>
32 #endif
33
34 class AliMpZone;
35 class AliMpRow;
36 class AliMpVRowSegment;
37 class AliMpVMotif;
38 class AliMpVPadIterator;
39 class AliMpMotifMap;
40
41 class TArrayI;
42
43 class AliMpSector : public TNamed
44 {
45   public:
46 #ifdef WITH_STL
47     /// Row vector type
48     typedef std::vector<AliMpRow*> RowVector;
49     /// Zone vector type
50     typedef std::vector<AliMpZone*> ZoneVector;
51 #endif
52 #ifdef WITH_ROOT
53     /// Row vector type
54     typedef TObjArray  RowVector;
55     /// Zone vector type
56     typedef TObjArray  ZoneVector;
57 #endif
58
59   public:
60     AliMpSector(const TString& id, Int_t nofZones, Int_t nofRows,
61                 AliMp::Direction direction, const TVector2& offset);
62     AliMpSector();
63     virtual ~AliMpSector();
64   
65     // methods  
66     virtual AliMpVPadIterator* CreateIterator() const;
67     void  SetRowSegmentOffsets();
68     void  Initialize(); 
69     void  PrintGeometry() const;
70
71     // find methods   
72     AliMpRow*     FindRow(const TVector2& position) const;    
73     AliMpVMotif*  FindMotif(const TVector2& position) const;
74     Int_t         FindMotifPositionId(const TVector2& position) const;
75
76     AliMpRow*          FindRow(Int_t motifPositionId) const;
77     AliMpVRowSegment*  FindRowSegment(Int_t motifPositionId) const;
78     TVector2           FindPosition(Int_t motifPositionId) const;
79
80     AliMpZone*  FindZone(const TVector2& padDimensions) const;
81
82     // geometry 
83     TVector2  Position() const;
84     TVector2  Dimensions() const;
85    
86     //
87     // get methods
88
89     Int_t       GetNofZones() const;
90     AliMpZone*  GetZone(Int_t i) const;    
91
92     Int_t       GetNofRows() const;
93     AliMpRow*   GetRow(Int_t i) const;
94
95     AliMp::Direction  GetDirection() const;  
96     AliMp::PlaneType  GetPlaneType() const;  
97
98     TVector2        GetMinPadDimensions() const;
99     TVector2        GetMaxPadDimensions() const;
100     AliMpIntPair    GetMaxPadIndices() const;
101     Int_t           GetNofPads() const;
102
103     AliMpMotifMap*  GetMotifMap() const;
104     void            GetAllMotifPositionsIDs(TArrayI& ecn) const;
105     
106     virtual void Print(Option_t* opt="") const;
107     
108     
109   private:
110     /// Not implemented
111     AliMpSector(const AliMpSector& right);
112     /// Not implemented
113     AliMpSector&  operator = (const AliMpSector& right);
114
115     // methods
116     AliMpVRowSegment* FindRowSegment(const TVector2& position) const;
117     void SetRowOffsets();
118     void SetMotifPositions();
119     void SetGlobalIndices();
120     void SetMinMaxPadDimensions();
121     void SetMaxPadIndices();
122     void SetNofPads();
123
124     // data members        
125     TString    fID;       ///< sector ID
126     TVector2   fOffset;   ///< sector position
127     ZoneVector fZones;    ///< zones
128     RowVector  fRows;     ///< rows
129     AliMpMotifMap*   fMotifMap;         ///< motif map
130     AliMp::Direction fDirection;        ///< the direction of constant pad size
131     TVector2         fMinPadDimensions; ///< minimum pad dimensions
132     TVector2         fMaxPadDimensions; ///< miximum pad dimensions
133     AliMpIntPair     fMaxPadIndices;    ///< maximum pad indices    
134     Int_t            fNofPads;          ///<  total number of pads
135
136   ClassDef(AliMpSector,1)  // Sector
137 };
138
139 // inline functions
140
141 /// Return the direction of constant pad size
142 inline AliMp::Direction AliMpSector::GetDirection() const 
143 { return fDirection; }    
144
145 /// Return minimum pad dimensions
146 inline TVector2   AliMpSector::GetMinPadDimensions() const
147 { return fMinPadDimensions; }
148
149 /// Return maxmum pad dimensions
150 inline TVector2   AliMpSector::GetMaxPadDimensions() const
151 { return fMaxPadDimensions; }
152
153 /// Return maximum pad indices
154 inline AliMpIntPair  AliMpSector::GetMaxPadIndices() const
155 { return fMaxPadIndices; }
156
157 /// Return total number of pads
158 inline Int_t  AliMpSector::GetNofPads() const
159 { return fNofPads; }
160
161 /// Return the motif map
162 inline AliMpMotifMap* AliMpSector::GetMotifMap() const 
163 { return fMotifMap; }    
164
165 #endif //ALI_MP_SECTOR_H
166