ROOT logo
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

// $Id$ 
// $MpId: AliMpPCB.h,v 1.9 2006/05/24 13:58:24 ivana Exp $ 

/// \ingroup slat
/// \class AliMpPCB
/// \brief A PCB for station 3,4 or 5
/// 
//  Author: Laurent Aphecetche

#ifndef ALIMPPCB_H
#define ALIMPPCB_H

#ifndef ALI_MP_VPAD_ITERATOR_H
#  include "AliMpVPadIterator.h"
#endif

#ifndef ALI_MP_AREA_H
#  include "AliMpArea.h"
#endif


#ifndef ROOT_TObject
#  include "TObject.h"
#endif

#ifndef ROOT_TString
#  include "TString.h"
#endif

#ifndef ROOT_TArraI
#  include "TArrayI.h"
#endif

#ifndef ROOT_TObjArray
#  include "TObjArray.h"
#endif

class AliMpSlatMotifMap;
class AliMpMotifPosition;
class AliMpMotifType;
class AliMpMotifSpecial;

class AliMpPCB : public TObject
{
 public:

  AliMpPCB();
  /** Ctor. The sizes are given in mm.
      See full doc for the meaning of enveloppe parameters.
  */
  AliMpPCB(AliMpSlatMotifMap* motifMap,
           const char* id, Double_t padSizeX, Double_t padSizeY,
           Double_t enveloppeSizeX, Double_t enveloppeSizeY);
  
  AliMpPCB(const char* id, AliMpMotifSpecial* ms);
  
  AliMpPCB(const AliMpPCB& o);
  AliMpPCB& operator=(const AliMpPCB& o);

  virtual ~AliMpPCB();

  TObject* Clone(const char* newname="") const;

  /** Duplicate this PCB. The copy has the manuids of its motifs changed 
      according to the manuid vector, and its x-offset according to ix 
      and x.
  */    
  AliMpPCB* Clone(const TArrayI& manuids,
                  Int_t ixOffset, Double_t xOffset) const;

  void Copy(TObject& o) const;

  /** Add a motif to this PCB. (ix,iy) are the coordinates of one corner 
    of the motif, in pad-units. Which corner depends on the sign(s) of (ix,iy):
    (ix>0,iy>0) : bottom-left corner
    (ix<0,iy>0) : bottom-right corner
    (ix<0,iy<0) : top-right corner
    (ix>0,iy<0) : top-left corner.
    */
  void Add(AliMpMotifType* motifType, Int_t ix, Int_t iy);

  AliMpArea Area() const;
  
  void Print(Option_t* option = "") const;

  Bool_t HasMotifPositionID(Int_t manuId) const;
  
  Double_t ActiveDX() const;
  Double_t ActiveDY() const;

  Double_t DX() const;
  Double_t DY() const;

  Double_t X() const;
  Double_t Y() const;

  Double_t Xmin() const;
  Double_t Xmax() const;
 
  Double_t ActiveXmin() const;
  Double_t ActiveXmax() const;

  Double_t Ymin() const;
  Double_t Ymax() const;

  Double_t PadSizeX() const;
  Double_t PadSizeY() const;

  /** Returns the i-th motifPosition of this PCB.
      i : [0..GetSize()-1]
  */
  AliMpMotifPosition* GetMotifPosition(Int_t i) const;

  /// Returns the motifPosition which contains the pad at (ix,iy).
  AliMpMotifPosition* FindMotifPosition(Int_t ix, Int_t iy) const;

  /// Returns the motifPosition which contains the pad at (x,y).
  AliMpMotifPosition* FindMotifPosition(Double_t x, Double_t y) const;

  /// The number of motifs, aka manus.
  Int_t GetSize() const;

  Int_t GetNofPadsX() const;
  Int_t GetNofPadsY() const;

  Int_t Ixmin() const;
  Int_t Ixmax() const;
  
  Int_t Iymin() const;
  Int_t Iymax() const;
  
  const char* GetID() const;
  
  /// Return the number of pads in this PCB 
  Int_t NofPads() const { return fNofPads; }
  
  /// Return the motif map
  AliMpSlatMotifMap* MotifMap() const { return fMotifMap; }
  
  void Save() const;
  
 private:
  TString fId; ///< PCB name
  Double_t fPadSizeX; ///< x-size of this PCB's pads (cm)
  Double_t fPadSizeY; ///< y-size of this PCB's pads (cm)
  Double_t fEnveloppeSizeX; ///< max x-size of this PCB (cm)
  Double_t fEnveloppeSizeY; ///< max y-size of this PCB (cm)
  Double_t fXoffset; ///< x-offset = x of first pad of this PCB (cm)
  Double_t fActiveXmin; ///< min x of an actual pad in this PCB (cm)
  Double_t fActiveXmax; ///< max x of an actual pad in this PCB (cm)
  Int_t fIxmin; ///< min pad index in x
  Int_t fIxmax; ///< max pad index in x
  Int_t fIymin; ///< min pad index in y
  Int_t fIymax; ///< max pad index in y
  TObjArray fMotifPositions; ///< array of motifs
  Int_t fNofPads; ///< number of pads in this PCB
  AliMpSlatMotifMap* fMotifMap; ///< to keep track of things to avoid duplications of motif and motiftypes, and get proper deletion
  
  ClassDef(AliMpPCB,3) // A PCB for Stations 3,4,5
};

#endif 
 AliMpPCB.h:1
 AliMpPCB.h:2
 AliMpPCB.h:3
 AliMpPCB.h:4
 AliMpPCB.h:5
 AliMpPCB.h:6
 AliMpPCB.h:7
 AliMpPCB.h:8
 AliMpPCB.h:9
 AliMpPCB.h:10
 AliMpPCB.h:11
 AliMpPCB.h:12
 AliMpPCB.h:13
 AliMpPCB.h:14
 AliMpPCB.h:15
 AliMpPCB.h:16
 AliMpPCB.h:17
 AliMpPCB.h:18
 AliMpPCB.h:19
 AliMpPCB.h:20
 AliMpPCB.h:21
 AliMpPCB.h:22
 AliMpPCB.h:23
 AliMpPCB.h:24
 AliMpPCB.h:25
 AliMpPCB.h:26
 AliMpPCB.h:27
 AliMpPCB.h:28
 AliMpPCB.h:29
 AliMpPCB.h:30
 AliMpPCB.h:31
 AliMpPCB.h:32
 AliMpPCB.h:33
 AliMpPCB.h:34
 AliMpPCB.h:35
 AliMpPCB.h:36
 AliMpPCB.h:37
 AliMpPCB.h:38
 AliMpPCB.h:39
 AliMpPCB.h:40
 AliMpPCB.h:41
 AliMpPCB.h:42
 AliMpPCB.h:43
 AliMpPCB.h:44
 AliMpPCB.h:45
 AliMpPCB.h:46
 AliMpPCB.h:47
 AliMpPCB.h:48
 AliMpPCB.h:49
 AliMpPCB.h:50
 AliMpPCB.h:51
 AliMpPCB.h:52
 AliMpPCB.h:53
 AliMpPCB.h:54
 AliMpPCB.h:55
 AliMpPCB.h:56
 AliMpPCB.h:57
 AliMpPCB.h:58
 AliMpPCB.h:59
 AliMpPCB.h:60
 AliMpPCB.h:61
 AliMpPCB.h:62
 AliMpPCB.h:63
 AliMpPCB.h:64
 AliMpPCB.h:65
 AliMpPCB.h:66
 AliMpPCB.h:67
 AliMpPCB.h:68
 AliMpPCB.h:69
 AliMpPCB.h:70
 AliMpPCB.h:71
 AliMpPCB.h:72
 AliMpPCB.h:73
 AliMpPCB.h:74
 AliMpPCB.h:75
 AliMpPCB.h:76
 AliMpPCB.h:77
 AliMpPCB.h:78
 AliMpPCB.h:79
 AliMpPCB.h:80
 AliMpPCB.h:81
 AliMpPCB.h:82
 AliMpPCB.h:83
 AliMpPCB.h:84
 AliMpPCB.h:85
 AliMpPCB.h:86
 AliMpPCB.h:87
 AliMpPCB.h:88
 AliMpPCB.h:89
 AliMpPCB.h:90
 AliMpPCB.h:91
 AliMpPCB.h:92
 AliMpPCB.h:93
 AliMpPCB.h:94
 AliMpPCB.h:95
 AliMpPCB.h:96
 AliMpPCB.h:97
 AliMpPCB.h:98
 AliMpPCB.h:99
 AliMpPCB.h:100
 AliMpPCB.h:101
 AliMpPCB.h:102
 AliMpPCB.h:103
 AliMpPCB.h:104
 AliMpPCB.h:105
 AliMpPCB.h:106
 AliMpPCB.h:107
 AliMpPCB.h:108
 AliMpPCB.h:109
 AliMpPCB.h:110
 AliMpPCB.h:111
 AliMpPCB.h:112
 AliMpPCB.h:113
 AliMpPCB.h:114
 AliMpPCB.h:115
 AliMpPCB.h:116
 AliMpPCB.h:117
 AliMpPCB.h:118
 AliMpPCB.h:119
 AliMpPCB.h:120
 AliMpPCB.h:121
 AliMpPCB.h:122
 AliMpPCB.h:123
 AliMpPCB.h:124
 AliMpPCB.h:125
 AliMpPCB.h:126
 AliMpPCB.h:127
 AliMpPCB.h:128
 AliMpPCB.h:129
 AliMpPCB.h:130
 AliMpPCB.h:131
 AliMpPCB.h:132
 AliMpPCB.h:133
 AliMpPCB.h:134
 AliMpPCB.h:135
 AliMpPCB.h:136
 AliMpPCB.h:137
 AliMpPCB.h:138
 AliMpPCB.h:139
 AliMpPCB.h:140
 AliMpPCB.h:141
 AliMpPCB.h:142
 AliMpPCB.h:143
 AliMpPCB.h:144
 AliMpPCB.h:145
 AliMpPCB.h:146
 AliMpPCB.h:147
 AliMpPCB.h:148
 AliMpPCB.h:149
 AliMpPCB.h:150
 AliMpPCB.h:151
 AliMpPCB.h:152
 AliMpPCB.h:153
 AliMpPCB.h:154
 AliMpPCB.h:155
 AliMpPCB.h:156
 AliMpPCB.h:157
 AliMpPCB.h:158
 AliMpPCB.h:159
 AliMpPCB.h:160
 AliMpPCB.h:161
 AliMpPCB.h:162
 AliMpPCB.h:163
 AliMpPCB.h:164
 AliMpPCB.h:165