]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpPCB.h
In Print(): added an option to print area borders
[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.9 2006/05/24 13:58:24 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 #ifndef ALI_MP_VPAD_ITERATOR_H
39 #  include "AliMpVPadIterator.h"
40 #endif
41
42 #ifndef ALI_MP_AREA_H
43 #  include "AliMpArea.h"
44 #endif
45
46 class AliMpSlatMotifMap;
47 class AliMpMotifPosition;
48 class AliMpMotifType;
49 class AliMpMotifSpecial;
50
51 class AliMpPCB : public TObject
52 {
53  public:
54
55 #ifdef WITH_ROOT
56   /// Type def for the array size
57   typedef Int_t  Size_t;
58 #else  
59   /// Type def for the array size
60   typedef UInt_t Size_t;
61 #endif
62   
63   AliMpPCB();
64   /** Ctor. The sizes are given in mm.
65       See full doc for the meaning of enveloppe parameters.
66   */
67   AliMpPCB(AliMpSlatMotifMap* motifMap,
68            const char* id, Double_t padSizeX, Double_t padSizeY,
69            Double_t enveloppeSizeX, Double_t enveloppeSizeY);
70   
71   AliMpPCB(const char* id, AliMpMotifSpecial* ms);
72   
73   AliMpPCB(const AliMpPCB& o);
74   AliMpPCB& operator=(const AliMpPCB& o);
75
76   virtual ~AliMpPCB();
77
78   TObject* Clone(const char* newname="") const;
79
80   /** Duplicate this PCB. The copy has the manuids of its motifs changed 
81       according to the manuid vector, and its x-offset according to ix 
82       and x.
83   */    
84   AliMpPCB* Clone(const TArrayI& manuids,
85                   Int_t ixOffset, Double_t xOffset) const;
86
87   void Copy(TObject& o) const;
88
89   /** Add a motif to this PCB. (ix,iy) are the coordinates of one corner 
90     of the motif, in pad-units. Which corner depends on the sign(s) of (ix,iy):
91     (ix>0,iy>0) : bottom-left corner
92     (ix<0,iy>0) : bottom-right corner
93     (ix<0,iy<0) : top-right corner
94     (ix>0,iy<0) : top-left corner.
95     */
96   void Add(AliMpMotifType* motifType, Int_t ix, Int_t iy);
97
98   AliMpArea Area() const;
99   
100   void Print(Option_t* option = "") const;
101
102   Bool_t HasMotifPositionID(Int_t manuId) const;
103   
104   Double_t ActiveDX() const;
105   Double_t ActiveDY() const;
106
107   Double_t DX() const;
108   Double_t DY() const;
109
110   Double_t X() const;
111   Double_t Y() const;
112
113   Double_t Xmin() const;
114   Double_t Xmax() const;
115  
116   Double_t ActiveXmin() const;
117   Double_t ActiveXmax() const;
118
119   Double_t Ymin() const;
120   Double_t Ymax() const;
121
122   Double_t PadSizeX() const;
123   Double_t PadSizeY() const;
124
125   /** Returns the i-th motifPosition of this PCB.
126       i : [0..GetSize()-1]
127   */
128   AliMpMotifPosition* GetMotifPosition(Size_t i) const;
129
130   /// Returns the motifPosition which contains the pad at (ix,iy).
131   AliMpMotifPosition* FindMotifPosition(Int_t ix, Int_t iy) const;
132
133   /// Returns the motifPosition which contains the pad at (x,y).
134   AliMpMotifPosition* FindMotifPosition(Double_t x, Double_t y) const;
135
136   /// The number of motifs, aka manus.
137   Size_t GetSize() const;
138
139   Int_t GetNofPadsX() const;
140   Int_t GetNofPadsY() const;
141
142   Int_t Ixmin() const;
143   Int_t Ixmax() const;
144   
145   Int_t Iymin() const;
146   Int_t Iymax() const;
147   
148   const char* GetID() const;
149   
150   /// Return the number of pads in this PCB 
151   Int_t NofPads() const { return fNofPads; }
152   
153   /// Return the motif map
154   AliMpSlatMotifMap* MotifMap() const { return fMotifMap; }
155   
156   void Save() const;
157   
158  private:
159   TString fId; ///< PCB name
160   Double_t fPadSizeX; ///< x-size of this PCB's pads (cm)
161   Double_t fPadSizeY; ///< y-size of this PCB's pads (cm)
162   Double_t fEnveloppeSizeX; ///< max x-size of this PCB (cm)
163   Double_t fEnveloppeSizeY; ///< max y-size of this PCB (cm)
164   Double_t fXoffset; ///< x-offset = x of first pad of this PCB (cm)
165   Double_t fActiveXmin; ///< min x of an actual pad in this PCB (cm)
166   Double_t fActiveXmax; ///< max x of an actual pad in this PCB (cm)
167   Int_t fIxmin; ///< min pad index in x
168   Int_t fIxmax; ///< max pad index in x
169   Int_t fIymin; ///< min pad index in y
170   Int_t fIymax; ///< max pad index in y
171 #ifdef WITH_ROOT
172   TObjArray fMotifPositions; ///< array of motifs
173 #else  
174   std::vector<AliMpMotifPosition*> fMotifPositions; ///< array of motif positions
175 #endif
176   Int_t fNofPads; ///< number of pads in this PCB
177   AliMpSlatMotifMap* fMotifMap; ///< to keep track of things to avoid duplications of motif and motiftypes, and get proper deletion
178   
179   ClassDef(AliMpPCB,3) // A PCB for Stations 3,4,5
180 };
181
182 #endif