]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpSlat.h
A bunch of changes :
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpSlat.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: AliMpSlat.h,v 1.2 2005/09/19 19:01:09 ivana Exp $
6
7 /// \ingroup slat
8 /// \class AliMpSlat
9 /// \brief A slat (building block of stations 3, 4 and 5)
10 /// 
11 /// Author: Laurent Aphecetche
12
13 #ifndef ALI_MP_SLAT_H
14 #define ALI_MP_SLAT_H
15
16 #include <TObject.h>
17
18 #ifndef ROOT_TString
19 #  include "TString.h"
20 #endif
21
22 #ifndef ALI_MP_PAD_H
23 #  include "AliMpPad.h"
24 #endif
25
26 #ifndef ALI_MP_V_SEGMENTATION_H
27 #  include "AliMpVSegmentation.h"
28 #endif
29
30 #ifndef ALI_MP_PLANE_TYPE_H
31 #  include "AliMpPlaneType.h"
32 #endif
33
34 #include "AliMpContainers.h"
35
36 class TArrayI;
37
38 #ifdef WITH_ROOT
39 #  include "AliMpExMap.h"
40 #  include "TObjArray.h"
41 #else
42 #  include <vector>
43 #  include <map>
44 #endif
45
46 class AliMpMotifPosition;
47 class AliMpPCB;
48 class TArrayI;
49
50 class AliMpSlat : public TObject
51 {
52  public:
53
54 #ifdef WITH_ROOT
55   typedef Int_t Size_t;
56 #else
57   typedef UInt_t Size_t;
58 #endif  
59   
60   AliMpSlat();
61   AliMpSlat(const char* id, AliMpPlaneType bendingOrNonBending);
62   virtual ~AliMpSlat();
63
64   TVector2 Dimensions() const;
65   TVector2 Position() const;
66   
67   const char* GetName() const;
68   
69   const char* GetID() const;
70
71   void Add(AliMpPCB* pcbType, const TArrayI& manuList);
72
73   Double_t DX() const;
74   Double_t DY() const;
75
76   /// Find the PCB containing the pad at location (ix,any iy).
77   AliMpPCB* FindPCB(Int_t ix) const;
78
79   /** Find the index of the PCB containing the pad at location ix.
80    Should not be needed except to comply with Sector(), Dpx(), Dpy()
81          interface of old AliMUONVGeometrySegmentation.
82          FIXME: Remove me when VGeometrySegmentation dies at last.
83          */
84         Int_t FindPCBIndex(Int_t ix) const;
85         
86   /// Find the PCB containing location (x,y).
87   AliMpPCB* FindPCB(Double_t x, Double_t y) const;
88
89         /** Find the index of the PCB containing the pad at location (x,y).
90    Should not be needed except to comply with Sector(), Dpx(), Dpy()
91          interface of old AliMUONVGeometrySegmentation.
92          FIXME: Remove me when VGeometrySegmentation dies at last.
93          */
94         Int_t FindPCBIndex(Double_t x, Double_t y) const;
95
96   /// Returns the i-th PCB of this slat.
97   AliMpPCB* GetPCB(Size_t i) const;
98
99   /// Returns the MotifPosition containing location (x,y).
100   AliMpMotifPosition* FindMotifPosition(Double_t x, Double_t y) const;
101
102   /// Returns the MotifPosition which id is manuid.
103   AliMpMotifPosition* FindMotifPosition(Int_t manuid) const;
104
105   /// Returns the MotifPosition containing the pad located at (ix,iy).
106   AliMpMotifPosition* FindMotifPosition(Int_t ix, Int_t iy) const;
107
108   /// Return the ids of the electronic cards (either manu or local board).
109   void GetAllElectronicCardNumbers(TArrayI& ecn) const;
110   
111   /** Returns the max. number of pads in the x-direction contained in this slat.
112     This is a max only as for e.g. non-bending slats, the y-dimension depends
113     on the x-position.
114     */
115   Int_t GetMaxNofPadsY() const;
116   
117   /// Return the number of electronic cards (either manu or local board).
118   Int_t GetNofElectronicCards() const;
119   
120   /// Returns the number of pads in the x-direction contained in this slat.
121   Int_t GetNofPadsX() const;
122  
123   /// Returns the number of PCBs of this slat.
124   Size_t GetSize() const;
125     
126   void Print(Option_t* option="") const;
127
128   /** This is normally only used by triggerSlats, as for ST345 slats,
129     the position is DX(),DY() simply.
130     */
131   void ForcePosition(const TVector2& pos);
132   
133  private:
134   TString fId;
135   AliMpPlaneType fPlaneType;
136   Double_t fDX;
137   Double_t fDY;
138   Int_t fNofPadsX;
139   Int_t fMaxNofPadsY;
140 #ifdef WITH_ROOT
141   TObjArray fPCBs; // array of AliMpPCB*
142   mutable AliMpExMap fManuMap; // map of int to AliMpMotifPosition*
143 #else  
144   std::vector<AliMpPCB*> fPCBs;
145   std::map<int,AliMpMotifPosition*> fManuMap;
146 #endif
147   TVector2 fPosition;
148   
149   ClassDef(AliMpSlat,1) // A slat for stations 3,4,5
150 };
151
152 #endif