]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpSlat.h
Fixing part of the Coding violation
[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.8 2006/05/24 13:58:24 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 #include "AliMpExMap.h"
36
37 class TArrayI;
38
39 #ifdef WITH_ROOT
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   /// Type def for the array size
56   typedef Int_t Size_t;
57 #else
58   /// Type def for the array size
59   typedef UInt_t Size_t;
60 #endif  
61   
62   AliMpSlat();
63   AliMpSlat(const char* id, AliMp::PlaneType bendingOrNonBending);
64   virtual ~AliMpSlat();
65
66   TVector2 Dimensions() const;
67   
68   /// Return position
69   TVector2 Position() const { return fPosition; }
70   
71   const char* GetName() const;
72   
73   const char* GetID() const;
74
75   void Add(const AliMpPCB& pcbType, const TArrayI& manuList);
76
77   Double_t DX() const;
78   Double_t DY() const;
79
80   /// Find the PCB containing the pad at location (ix,any iy).
81   AliMpPCB* FindPCB(Int_t ix) const;
82
83   /// Find the index of the PCB containing the pad at location ix.
84   Int_t FindPCBIndex(Int_t ix) const;
85
86   /// Find the index of the PCB containing a given manu
87   Int_t FindPCBIndexByMotifPositionID(Int_t manuId) const;
88   
89   /// Find the PCB containing location (x,y).
90   AliMpPCB* FindPCB(Double_t x, Double_t y) const;
91
92   /// Find the index of the PCB containing the pad at location (x,y).
93   Int_t FindPCBIndex(Double_t x, Double_t y) const;
94
95   /// Returns the i-th PCB of this slat.
96   AliMpPCB* GetPCB(Size_t i) const;
97
98   /// Returns the MotifPosition containing location (x,y).
99   AliMpMotifPosition* FindMotifPosition(Double_t x, Double_t y) const;
100
101   /// Returns the MotifPosition which id is manuid.
102   AliMpMotifPosition* FindMotifPosition(Int_t manuid) const;
103
104   /// Returns the MotifPosition containing the pad located at (ix,iy).
105   AliMpMotifPosition* FindMotifPosition(Int_t ix, Int_t iy) const;
106
107   /// Return the ids of the electronic cards (either manu or local board).
108   void GetAllMotifPositionsIDs(TArrayI& ecn) const;
109   
110   /** Returns the max. number of pads in the x-direction contained in this slat.
111     This is a max only as for e.g. non-bending slats, the y-dimension depends
112     on the x-position.
113     */
114   Int_t GetMaxNofPadsY() const;
115   
116   /** Returns the max index useable in x-direction. 
117     Note that this can be different from GetNofPadsX()-1 for rounded slats.
118     */
119   Int_t GetMaxPadIndexX() const;
120   
121   /// Return the number of electronic cards (either manu or local board).
122   Int_t GetNofElectronicCards() const;
123   
124   /// Returns the number of pads in the x-direction contained in this slat.
125   Int_t GetNofPadsX() const;
126  
127   /// Returns the number of PCBs of this slat.
128   Size_t GetSize() const;
129     
130   void Print(Option_t* option="") const;
131
132   /** This is normally only used by triggerSlats, as for ST345 slats,
133     the position is DX(),DY() simply.
134     */
135   void ForcePosition(const TVector2& pos);
136   
137   /// Return the plane type
138   AliMp::PlaneType PlaneType() const { return fPlaneType; }
139   
140   /// Return the number of pads in this slat
141   Int_t NofPads() const { return fNofPads; }
142  
143  private:
144   /// Not implemented
145   AliMpSlat(const AliMpSlat& rhs);
146   /// Not implemented
147   AliMpSlat& operator=(const AliMpSlat& rhs);
148
149   TString fId; ///< The name of this slat, e.g. 112233N
150   AliMp::PlaneType fPlaneType; ///< Whether it's bending or non-bending plane
151   Double_t fDX; ///< Half-size in X (cm)
152   Double_t fDY; ///< Half-size in Y (cm)
153   Int_t fNofPadsX; ///< Actual number of pads in x direction
154   Int_t fMaxNofPadsY; ///< Maximum number of pads in y direction
155   mutable AliMpExMap fManuMap; ///< map of int to AliMpMotifPosition*
156 #ifdef WITH_ROOT
157   TObjArray fPCBs; ///< array of AliMpPCB*
158 #else  
159   std::vector<AliMpPCB*> fPCBs; ///< array of AliMpPCB*
160 #endif
161   TVector2 fPosition; ///< Position of the slat center.
162   Int_t fNofPads; ///< number of pads in this slat
163   
164   ClassDef(AliMpSlat,2) // A slat for stations 3,4,5
165 };
166
167 #endif