ROOT logo
/**************************************************************************
 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 *                                                                        *
 * Author: The ALICE Off-line Project.                                    *
 * Contributors are mentioned in the code where appropriate.              *
 *                                                                        *
 * Permission to use, copy, modify and distribute this software and its   *
 * documentation strictly for non-commercial purposes is hereby granted   *
 * without fee, provided that the above copyright notice appears in all   *
 * copies and that both the copyright notice and this permission notice   *
 * appear in the supporting documentation. The authors make no claims     *
 * about the suitability of this software for any purpose. It is          *
 * provided "as is" without express or implied warranty.                  *
 **************************************************************************/

// $Id$
// $MpId: AliMpVMotif.cxx,v 1.9 2006/05/24 13:58:41 ivana Exp $
// Category: motif

//-----------------------------------------------------------------------------
// Class AliMpVMotif
// -----------------
// Class that defines a motif with its unique ID
// and the motif type.
// Included in AliRoot: 2003/05/02
// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
//-----------------------------------------------------------------------------

#include "AliMpVMotif.h"
#include "AliMpMotifType.h"
#include "AliMpEncodePair.h"
#include "AliMpConnection.h"

#include <Riostream.h>

#include <iomanip>

using std::cout;
using std::endl;
using std::setw;
/// \cond CLASSIMP
ClassImp(AliMpVMotif)
/// \endcond

//_____________________________________________________________________________
AliMpVMotif::AliMpVMotif():
  fID(""),
  fMotifType(0)
{
/// Default constructor
}

//_____________________________________________________________________________
AliMpVMotif::AliMpVMotif(const TString &id, AliMpMotifType *motifType):
  fID(id),
  fMotifType(motifType)
{
  /// Standard constructor.              
  /// The dimension in a given direction is calculated by
  /// multiplying the total dimension by the number of pads

}

//_____________________________________________________________________________
AliMpVMotif::~AliMpVMotif()
{
  /// Destructor
}

//_____________________________________________________________________________
AliMpConnection* 
AliMpVMotif::FindConnectionByLocalPos(Double_t localPosX, Double_t localPosY) const
{
  /// Return the local indices from the local
  /// (x,y) position

  MpPair_t padIndices = PadIndicesLocal(localPosX, localPosY);
  if ( padIndices > 0 )
    return fMotifType->FindConnectionByLocalIndices(padIndices);
  else
    return 0;
}

//_____________________________________________________________________________
void AliMpVMotif::Print(Option_t *option) const
{
  /// Print the map of the motif. In each cel, the value
  /// printed depends of option, as the following:
  /// - option="N" the "name" of the pad is written
  /// - option="K" the Kapton connect. number attached to the pad is written
  /// - option="B" the Berg connect. number attached to the pad is written
  /// - option="X" the (X,Y) position, in cm, of the center of the pad is written
  /// otherwise the number of the pad is written
  ///
  /// NOTE : this method is really not optimized, in case 'N' or '',
  /// but the Print() this should not be very important in a Print() method

  if (option[0]=='X') {

    cout<<"(X,Y) mapping";
    cout<<" in the motif "<<fID<<endl;
    cout<<"-----------------------------------"<<endl;
    for (Int_t j=fMotifType->GetNofPadsY()-1;j>=0;j--){
      for (Int_t i=0;i<fMotifType->GetNofPadsX();i++){
	if (fMotifType->FindConnectionByLocalIndices(i,j)){
          Double_t posx, posy;
	  PadPositionLocal(i,j, posx, posy);
	  cout<<setw(11)<<Form("(%.1f,%.1f)",posx,posy);
	}
      }
      cout<<endl;
    }
  } else fMotifType->Print(option);
}
 AliMpVMotif.cxx:1
 AliMpVMotif.cxx:2
 AliMpVMotif.cxx:3
 AliMpVMotif.cxx:4
 AliMpVMotif.cxx:5
 AliMpVMotif.cxx:6
 AliMpVMotif.cxx:7
 AliMpVMotif.cxx:8
 AliMpVMotif.cxx:9
 AliMpVMotif.cxx:10
 AliMpVMotif.cxx:11
 AliMpVMotif.cxx:12
 AliMpVMotif.cxx:13
 AliMpVMotif.cxx:14
 AliMpVMotif.cxx:15
 AliMpVMotif.cxx:16
 AliMpVMotif.cxx:17
 AliMpVMotif.cxx:18
 AliMpVMotif.cxx:19
 AliMpVMotif.cxx:20
 AliMpVMotif.cxx:21
 AliMpVMotif.cxx:22
 AliMpVMotif.cxx:23
 AliMpVMotif.cxx:24
 AliMpVMotif.cxx:25
 AliMpVMotif.cxx:26
 AliMpVMotif.cxx:27
 AliMpVMotif.cxx:28
 AliMpVMotif.cxx:29
 AliMpVMotif.cxx:30
 AliMpVMotif.cxx:31
 AliMpVMotif.cxx:32
 AliMpVMotif.cxx:33
 AliMpVMotif.cxx:34
 AliMpVMotif.cxx:35
 AliMpVMotif.cxx:36
 AliMpVMotif.cxx:37
 AliMpVMotif.cxx:38
 AliMpVMotif.cxx:39
 AliMpVMotif.cxx:40
 AliMpVMotif.cxx:41
 AliMpVMotif.cxx:42
 AliMpVMotif.cxx:43
 AliMpVMotif.cxx:44
 AliMpVMotif.cxx:45
 AliMpVMotif.cxx:46
 AliMpVMotif.cxx:47
 AliMpVMotif.cxx:48
 AliMpVMotif.cxx:49
 AliMpVMotif.cxx:50
 AliMpVMotif.cxx:51
 AliMpVMotif.cxx:52
 AliMpVMotif.cxx:53
 AliMpVMotif.cxx:54
 AliMpVMotif.cxx:55
 AliMpVMotif.cxx:56
 AliMpVMotif.cxx:57
 AliMpVMotif.cxx:58
 AliMpVMotif.cxx:59
 AliMpVMotif.cxx:60
 AliMpVMotif.cxx:61
 AliMpVMotif.cxx:62
 AliMpVMotif.cxx:63
 AliMpVMotif.cxx:64
 AliMpVMotif.cxx:65
 AliMpVMotif.cxx:66
 AliMpVMotif.cxx:67
 AliMpVMotif.cxx:68
 AliMpVMotif.cxx:69
 AliMpVMotif.cxx:70
 AliMpVMotif.cxx:71
 AliMpVMotif.cxx:72
 AliMpVMotif.cxx:73
 AliMpVMotif.cxx:74
 AliMpVMotif.cxx:75
 AliMpVMotif.cxx:76
 AliMpVMotif.cxx:77
 AliMpVMotif.cxx:78
 AliMpVMotif.cxx:79
 AliMpVMotif.cxx:80
 AliMpVMotif.cxx:81
 AliMpVMotif.cxx:82
 AliMpVMotif.cxx:83
 AliMpVMotif.cxx:84
 AliMpVMotif.cxx:85
 AliMpVMotif.cxx:86
 AliMpVMotif.cxx:87
 AliMpVMotif.cxx:88
 AliMpVMotif.cxx:89
 AliMpVMotif.cxx:90
 AliMpVMotif.cxx:91
 AliMpVMotif.cxx:92
 AliMpVMotif.cxx:93
 AliMpVMotif.cxx:94
 AliMpVMotif.cxx:95
 AliMpVMotif.cxx:96
 AliMpVMotif.cxx:97
 AliMpVMotif.cxx:98
 AliMpVMotif.cxx:99
 AliMpVMotif.cxx:100
 AliMpVMotif.cxx:101
 AliMpVMotif.cxx:102
 AliMpVMotif.cxx:103
 AliMpVMotif.cxx:104
 AliMpVMotif.cxx:105
 AliMpVMotif.cxx:106
 AliMpVMotif.cxx:107
 AliMpVMotif.cxx:108
 AliMpVMotif.cxx:109
 AliMpVMotif.cxx:110
 AliMpVMotif.cxx:111
 AliMpVMotif.cxx:112
 AliMpVMotif.cxx:113
 AliMpVMotif.cxx:114