]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpPCB.h
ec095543000be30013dd39be080feb1d8e6483f6
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpPCB.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: AliMpPCB.h,v 1.8 2006/05/23 13:07:47 ivana Exp $ 
6
7 /// \ingroup slat
8 /// \class AliMpPCB
9 /// \brief A PCB for station 3,4 or 5
10 /// 
11 /// Author: Laurent Aphecetche
12
13 #ifndef ALIMPPCB_H
14 #define ALIMPPCB_H
15
16 #ifndef ROOT_TObject
17 #  include "TObject.h"
18 #endif
19
20 #ifndef ROOT_TString
21 #  include "TString.h"
22 #endif
23
24 #  ifndef ROOT_TArraI
25 #    include "TArrayI.h"
26 #  endif
27
28 #include "AliMpContainers.h"
29
30 #ifdef WITH_ROOT
31 #  ifndef ROOT_TObjArray
32 #    include "TObjArray.h"
33 #  endif
34 #else
35 #  include <vector>
36 #endif
37
38 class AliMpMotifPosition;
39 class AliMpMotifType;
40 class AliMpMotifSpecial;
41
42 class AliMpPCB : public TObject
43 {
44  public:
45
46 #ifdef WITH_ROOT
47   typedef Int_t  Size_t;
48 #else  
49   typedef UInt_t Size_t;
50 #endif
51   
52   AliMpPCB();
53   /** Ctor. The sizes are given in mm.
54       See full doc for the meaning of enveloppe parameters.
55   */
56   AliMpPCB(const char* id, Double_t padSizeX, Double_t padSizeY,
57            Double_t enveloppeSizeX, Double_t enveloppeSizeY);
58   
59   AliMpPCB(const char* id, AliMpMotifSpecial* ms);
60   
61   AliMpPCB(const AliMpPCB& o);
62   AliMpPCB& operator=(const AliMpPCB& o);
63
64   virtual ~AliMpPCB();
65
66   TObject* Clone(const char* newname="") const;
67
68   /** Duplicate this PCB. The copy has the manuids of its motifs changed 
69       according to the manuid vector, and its x-offset according to ix 
70       and x.
71   */    
72   AliMpPCB* Clone(const TArrayI& manuids,
73                   Int_t ixOffset, Double_t xOffset) const;
74
75   void Copy(TObject& o) const;
76
77   /** Add a motif to this PCB. (ix,iy) are the coordinates of one corner 
78     of the motif, in pad-units. Which corner depends on the sign(s) of (ix,iy):
79     (ix>0,iy>0) : bottom-left corner
80     (ix<0,iy>0) : bottom-right corner
81     (ix<0,iy<0) : top-right corner
82     (ix>0,iy<0) : top-left corner.
83     */
84   void Add(AliMpMotifType* motifType, Int_t ix, Int_t iy);
85
86   void Print(Option_t* option = "") const;
87
88   Double_t ActiveDX() const;
89   Double_t ActiveDY() const;
90
91   Double_t DX() const;
92   Double_t DY() const;
93
94   Double_t X() const;
95   Double_t Y() const;
96
97   Double_t Xmin() const;
98   Double_t Xmax() const;
99  
100   Double_t ActiveXmin() const;
101   Double_t ActiveXmax() const;
102
103   Double_t Ymin() const;
104   Double_t Ymax() const;
105
106   Double_t PadSizeX() const;
107   Double_t PadSizeY() const;
108
109   /** Returns the i-th motifPosition of this PCB.
110       i : [0..GetSize()-1]
111   */
112   AliMpMotifPosition* GetMotifPosition(Size_t i) const;
113
114   /// Returns the motifPosition which contains the pad at (ix,iy).
115   AliMpMotifPosition* FindMotifPosition(Int_t ix, Int_t iy) const;
116
117   /// Returns the motifPosition which contains the pad at (x,y).
118   AliMpMotifPosition* FindMotifPosition(Double_t x, Double_t y) const;
119
120   /// The number of motifs, aka manus.
121   Size_t GetSize() const;
122
123   Int_t GetNofPadsX() const;
124   Int_t GetNofPadsY() const;
125
126   Int_t Ixmin() const;
127   Int_t Ixmax() const;
128   
129   Int_t Iymin() const;
130   Int_t Iymax() const;
131   
132   const char* GetID() const;
133   
134   Int_t NofPads() const { return fNofPads; }
135   
136  private:
137   TString fId; ///< PCB name
138   Double_t fPadSizeX; ///< x-size of this PCB's pads (cm)
139   Double_t fPadSizeY; ///< y-size of this PCB's pads (cm)
140   Double_t fEnveloppeSizeX; ///< max x-size of this PCB (cm)
141   Double_t fEnveloppeSizeY; // max y-size of this PCB (cm)
142   Double_t fXoffset; ///< x-offset = x of first pad of this PCB (cm)
143   Double_t fActiveXmin; ///< min x of an actual pad in this PCB (cm)
144   Double_t fActiveXmax; ///< max x of an actual pad in this PCB (cm)
145   Int_t fIxmin; ///< min pad index in x
146   Int_t fIxmax; ///< max pad index in x
147   Int_t fIymin; ///< min pad index in y
148   Int_t fIymax; ///< max pad index in y
149 #ifdef WITH_ROOT
150   TObjArray fMotifs; ///< array of motifs
151 #else  
152   std::vector<AliMpMotifPosition*> fMotifs; ///< array of motifs
153 #endif
154   Int_t fNofPads; ///< number of pads in this PCB
155   
156   ClassDef(AliMpPCB,2) // A PCB for Stations 3,4,5
157 };
158
159 #endif