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

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

/// \ingroup slat
/// \class AliMpSlat
/// \brief A slat (building block of stations 3, 4 and 5)
/// 
//  Author: Laurent Aphecetche

#ifndef ALI_MP_SLAT_H
#define ALI_MP_SLAT_H

#ifndef ALI_MP_PAD_H
#  include "AliMpPad.h"
#endif

#ifndef ALI_MP_V_SEGMENTATION_H
#  include "AliMpVSegmentation.h"
#endif

#ifndef ALI_MP_PLANE_TYPE_H
#  include "AliMpPlaneType.h"
#endif

#ifndef ALI_MP_EX_MAP_H
  #include "AliMpExMap.h"
#endif

#ifndef ROOT_TObject
  #include <TObject.h>
#endif

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

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

class TArrayI;


class AliMpMotifPosition;
class AliMpPCB;
class TArrayI;

class AliMpSlat : public TObject
{
 public:

  AliMpSlat(TRootIOCtor* ioCtor);
  AliMpSlat(const char* id, AliMp::PlaneType bendingOrNonBending);
  virtual ~AliMpSlat();

  /// Return x position
  Double_t  GetPositionX() const { return fPositionX; }
  /// Return y position
  Double_t  GetPositionY() const { return fPositionY; }
  
  const char* GetName() const;
  
  const char* GetID() const;

  void Add(const AliMpPCB& pcbType, const TArrayI& manuList);

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

  /// Find the PCB containing the pad at location (ix,any iy).
  AliMpPCB* FindPCB(Int_t ix) const;

  /// Find the index of the PCB containing the pad at location ix.
  Int_t FindPCBIndex(Int_t ix) const;

  /// Find the index of the PCB containing a given manu
  Int_t FindPCBIndexByMotifPositionID(Int_t manuId) const;
  
  /// Find the PCB containing location (x,y).
  AliMpPCB* FindPCB(Double_t x, Double_t y) const;

  /// Find the index of the PCB containing the pad at location (x,y).
  Int_t FindPCBIndex(Double_t x, Double_t y) const;

  /// Returns the i-th PCB of this slat.
  AliMpPCB* GetPCB(Int_t i) const;

  /// Returns the MotifPosition containing location (x,y).
  AliMpMotifPosition* FindMotifPosition(Double_t x, Double_t y) const;

  /// Returns the MotifPosition which id is manuid.
  AliMpMotifPosition* FindMotifPosition(Int_t manuid) const;

  /// Returns the MotifPosition containing the pad located at (ix,iy).
  AliMpMotifPosition* FindMotifPosition(Int_t ix, Int_t iy) const;

  /// Return the ids of the electronic cards (either manu or local board).
  void GetAllMotifPositionsIDs(TArrayI& ecn) const;
  
  /** Returns the max. number of pads in the x-direction contained in this slat.
    This is a max only as for e.g. non-bending slats, the y-dimension depends
    on the x-position.
    */
  Int_t GetMaxNofPadsY() const;
  
  /** Returns the max index useable in x-direction. 
    Note that this can be different from GetNofPadsX()-1 for rounded slats.
    */
  Int_t GetMaxPadIndexX() const;
  
  /// Return the number of electronic cards (either manu or local board).
  Int_t GetNofElectronicCards() const;
  
  /// Returns the number of pads in the x-direction contained in this slat.
  Int_t GetNofPadsX() const;
 
  /// Returns the number of PCBs of this slat.
  Int_t GetSize() const;
    
  void Print(Option_t* option="") const;

  /** This is normally only used by triggerSlats, as for ST345 slats,
    the position is DX(),DY() simply.
    */
  void ForcePosition(Double_t x, Double_t y);
  
  /// Return the plane type
  AliMp::PlaneType PlaneType() const { return fPlaneType; }
  
  /// Return the number of pads in this slat
  Int_t NofPads() const { return fNofPads; }
 
 private:
  /// Not implemented
  AliMpSlat();
  /// Not implemented
  AliMpSlat(const AliMpSlat& rhs);
  /// Not implemented
  AliMpSlat& operator=(const AliMpSlat& rhs);

  TString fId; ///< The name of this slat, e.g. 112233N
  AliMp::PlaneType fPlaneType; ///< Whether it's bending or non-bending plane
  Double_t fDX; ///< Half-size in X (cm)
  Double_t fDY; ///< Half-size in Y (cm)
  Int_t fNofPadsX; ///< Actual number of pads in x direction
  Int_t fMaxNofPadsY; ///< Maximum number of pads in y direction
  mutable AliMpExMap fManuMap; ///< map of int to AliMpMotifPosition*
  TObjArray fPCBs; ///< array of AliMpPCB*
  Double_t fPositionX; ///< x Position of the slat center.
  Double_t fPositionY; ///< y Position of the slat center.
  Int_t fNofPads; ///< number of pads in this slat
  
  ClassDef(AliMpSlat,3) // A slat for stations 3,4,5
};

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