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

// $Id$
// $MpId: AliMpVRowSegmentSpecial.h,v 1.10 2006/05/24 13:58:21 ivana Exp $

/// \ingroup sector
/// \class AliMpVRowSegmentSpecial
/// \brief Abstract base class for a special row segment composed of the 
/// pad rows.
///
/// \author David Guez, Ivana Hrivnacova; IPN Orsay

#ifndef ALI_MP_V_ROW_SEGMENT_SPECIAL_H
#define ALI_MP_V_ROW_SEGMENT_SPECIAL_H

#include "AliMpVRowSegment.h"
#include "AliMpVMotif.h"

#include <TVector2.h>
#include <TArrayI.h>
#include <TObjArray.h>

class AliMpRow;
class AliMpPadRow;
class AliMpVPadRowSegment;

class AliMpVRowSegmentSpecial : public AliMpVRowSegment
{
  public:
    AliMpVRowSegmentSpecial(AliMpRow* row, Double_t offsetX);
    AliMpVRowSegmentSpecial();
    virtual ~AliMpVRowSegmentSpecial();
    
    //
    // methods
    //
    void  AddPadRow(AliMpPadRow* padRow);
    void  UpdateMotifVector();
    /// Update pads offset
    virtual void  UpdatePadsOffset() = 0;
    /// Return the x coordinate of the left border in the global coordinate system.
    virtual Double_t  LeftBorderX() const = 0;
    /// Return the x coordinate of the right border in the global coordinate system.
    virtual Double_t  RightBorderX() const= 0;
    /// Return the half size in y of this row segment.
    virtual Double_t  HalfSizeY() const;

    //
    // find methods
    //
    virtual AliMpVMotif*  FindMotif(Double_t x, Double_t y) const;    
    virtual Int_t     FindMotifPositionId(Double_t x, Double_t y) const;
    virtual Bool_t    HasMotifPosition(Int_t motifPositionId) const;

    virtual void  MotifCenter(Int_t motifPositionId,
                              Double_t& x, Double_t& y) const;

    //
    // geometry
    //
    /// Return the x position of the row segment centre.
    virtual Double_t  GetPositionX() const = 0;
    /// Return the y position of the row segment centre.
    virtual Double_t  GetPositionY() const = 0;


    /// Return the x dimension of the row segment centre.
    virtual Double_t  GetDimensionX() const;
    /// Return the y dimension of the row segment centre.
    virtual Double_t  GetDimensionY() const;

    //
    // set methods
    //
    /// Calculate offset
    virtual void   SetOffset(Double_t /*x*/, Double_t /*y*/) {}
    /// Set global indices limits.
    virtual void   SetGlobalIndices(AliMpRow* rowBefore) = 0;
    /// Set global indices to i-th motif position and returns next index in x.
    virtual Int_t  SetIndicesToMotifPosition(Int_t i, MpPair_t indices) = 0;

    //
    // get methods
    //
    virtual AliMpRow*     GetRow() const;
    virtual Int_t         GetNofMotifs() const;
    virtual AliMpVMotif*  GetMotif(Int_t i) const;
    virtual Int_t         GetMotifPositionId(Int_t i) const;

  protected:
    // methods
    /// Return the coordinates of the motif specified with the given motif position Id                                           \n
    virtual void  MotifCenterSlow(Int_t motifPositionId, 
                                  Double_t& x, Double_t& y) const = 0;
    AliMpPadRow*         FindPadRow(Double_t y) const;
    AliMpVPadRowSegment* FindPadRowSegment(Int_t motifPositionId) const;
    MpPair_t             FindRelativeLowIndicesOf(Int_t motifPositionId) const;
    Int_t   MaxNofPadsInRow() const;
    Bool_t  HasMotif(const AliMpVMotif* motif) const;    

    // get methods
    Int_t         GetNofPadRows() const;
    AliMpPadRow*  GetPadRow(Int_t i) const;
    Double_t      GetOffsetX() const;

  private:
    /// Not implemented
    AliMpVRowSegmentSpecial(const AliMpVRowSegmentSpecial& right);
    /// Not implemented
    AliMpVRowSegmentSpecial&  operator = (const AliMpVRowSegmentSpecial& right);

    // static data members
    static const Int_t  fgkMaxNofMotifPositionIds; ///< dimension of fMotifPositionIds

    // data members
    AliMpRow*   fRow;     ///< the row containing this segment 
    Double_t    fOffsetX; ///< \brief the x position of the border that touches a standard
                          /// row segment
    TObjArray   fPadRows; ///< pad rows vector
    TObjArray   fMotifs;  ///< motifs vector
    TArrayI     fMotifPositionIds;    ///< motifs position Ids vector
    Int_t       fNofMotifPositionIds; ///< number of motif positions Ids
    
  ClassDef(AliMpVRowSegmentSpecial,1)  //Row segment
};

// inline functions

/// Return the x position of the border that touches a standard row segment
inline Double_t AliMpVRowSegmentSpecial::GetOffsetX() const
{ return fOffsetX; }    

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