]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpVMotif.cxx
Replacement of TVector2 object with two doubles
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpVMotif.cxx
CommitLineData
dee1d5f1 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
5f91c9e8 16// $Id$
13985652 17// $MpId: AliMpVMotif.cxx,v 1.9 2006/05/24 13:58:41 ivana Exp $
5f91c9e8 18// Category: motif
3d1463c8 19
20//-----------------------------------------------------------------------------
5f91c9e8 21// Class AliMpVMotif
22// -----------------
23// Class that defines a motif with its unique ID
24// and the motif type.
dbe945cc 25// Included in AliRoot: 2003/05/02
5f91c9e8 26// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
3d1463c8 27//-----------------------------------------------------------------------------
5f91c9e8 28
5f91c9e8 29#include "AliMpVMotif.h"
30#include "AliMpMotifType.h"
168e9c4d 31#include "AliMpEncodePair.h"
5f91c9e8 32#include "AliMpConnection.h"
33
2c605e66 34#include <Riostream.h>
35
36#include <iomanip>
37
13985652 38/// \cond CLASSIMP
5f91c9e8 39ClassImp(AliMpVMotif)
13985652 40/// \endcond
5f91c9e8 41
42//_____________________________________________________________________________
43AliMpVMotif::AliMpVMotif():
44 fID(""),
45 fMotifType(0)
46{
dee1d5f1 47/// Default constructor
5f91c9e8 48}
49
50//_____________________________________________________________________________
51AliMpVMotif::AliMpVMotif(const TString &id, AliMpMotifType *motifType):
52 fID(id),
53 fMotifType(motifType)
54{
dee1d5f1 55 /// Standard constructor.
56 /// The dimension in a given direction is calculated by
57 /// multiplying the total dimension by the number of pads
5f91c9e8 58
59}
60
2998a151 61//_____________________________________________________________________________
62AliMpVMotif::~AliMpVMotif()
63{
dee1d5f1 64 /// Destructor
2998a151 65}
66
5f91c9e8 67//_____________________________________________________________________________
68AliMpConnection*
6e97fbb8 69AliMpVMotif::FindConnectionByLocalPos(Double_t localPosX, Double_t localPosY) const
5f91c9e8 70{
dee1d5f1 71 /// Return the local indices from the local
72 /// (x,y) position
5f91c9e8 73
6e97fbb8 74 MpPair_t padIndices = PadIndicesLocal(localPosX, localPosY);
168e9c4d 75 if ( padIndices > 0 )
5f91c9e8 76 return fMotifType->FindConnectionByLocalIndices(padIndices);
77 else
78 return 0;
79}
6e97fbb8 80
5f91c9e8 81//_____________________________________________________________________________
82void AliMpVMotif::Print(Option_t *option) const
83{
dee1d5f1 84 /// Print the map of the motif. In each cel, the value
85 /// printed depends of option, as the following:
86 /// - option="N" the "name" of the pad is written
87 /// - option="K" the Kapton connect. number attached to the pad is written
88 /// - option="B" the Berg connect. number attached to the pad is written
89 /// - option="X" the (X,Y) position, in cm, of the center of the pad is written
90 /// otherwise the number of the pad is written
91 ///
92 /// NOTE : this method is really not optimized, in case 'N' or '',
93 /// but the Print() this should not be very important in a Print() method
5f91c9e8 94
95 if (option[0]=='X') {
96
97 cout<<"(X,Y) mapping";
98 cout<<" in the motif "<<fID<<endl;
99 cout<<"-----------------------------------"<<endl;
100 for (Int_t j=fMotifType->GetNofPadsY()-1;j>=0;j--){
101 for (Int_t i=0;i<fMotifType->GetNofPadsX();i++){
168e9c4d 102 if (fMotifType->FindConnectionByLocalIndices(i,j)){
6e97fbb8 103 Double_t posx, posy;
104 PadPositionLocal(i,j, posx, posy);
105 cout<<setw(11)<<Form("(%.1f,%.1f)",posx,posy);
5f91c9e8 106 }
107 }
108 cout<<endl;
109 }
110 } else fMotifType->Print(option);
111}