]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpVMotif.cxx
Mapping files of bending PCBs of station345
[u/mrichter/AliRoot.git] / MUON / mapping / AliMpVMotif.cxx
CommitLineData
5f91c9e8 1// $Id$
2// Category: motif
3///
4// Class AliMpVMotif
5// -----------------
6// Class that defines a motif with its unique ID
7// and the motif type.
dbe945cc 8// Included in AliRoot: 2003/05/02
5f91c9e8 9// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
10
11#include <iomanip>
12
fb1bf5c0 13#include <TError.h>
5f91c9e8 14#include <Riostream.h>
15
16#include "AliMpVMotif.h"
17#include "AliMpMotifType.h"
18#include "AliMpIntPair.h"
19#include "AliMpConnection.h"
20
21
22ClassImp(AliMpVMotif)
23
24//_____________________________________________________________________________
25AliMpVMotif::AliMpVMotif():
26 fID(""),
27 fMotifType(0)
28{
29 //default dummy constructor
30}
31
32//_____________________________________________________________________________
33AliMpVMotif::AliMpVMotif(const TString &id, AliMpMotifType *motifType):
34 fID(id),
35 fMotifType(motifType)
36{
37 // Normal constructor.
38 // The dimension in a given direction is calculated by
39 // multiplying the total dimension by the number of pads
40
41}
42
fb1bf5c0 43//_____________________________________________________________________________
44AliMpVMotif::AliMpVMotif(const AliMpVMotif& right)
45 : TObject(right) {
46//
47 Fatal("AliMpVMotif", "Copy constructor not provided.");
48}
49
2998a151 50//_____________________________________________________________________________
51AliMpVMotif::~AliMpVMotif()
52{
53 // destructor
54}
55
fb1bf5c0 56// operators
57
58//_____________________________________________________________________________
59AliMpVMotif& AliMpVMotif::operator=(const AliMpVMotif& right)
60{
61 // check assignement to self
62 if (this == &right) return *this;
63
64 Fatal("operator =", "Assignement operator not provided.");
65
66 return *this;
67}
68
5f91c9e8 69//_____________________________________________________________________________
70AliMpConnection*
71AliMpVMotif::FindConnectionByLocalPos(const TVector2& localPos) const
72{
73 // Return the local indices from the local
74 // (x,y) position
75
76 AliMpIntPair padIndices=PadIndicesLocal(localPos);
77 if (padIndices.GetFirst()>=0)
78 return fMotifType->FindConnectionByLocalIndices(padIndices);
79 else
80 return 0;
81}
82//_____________________________________________________________________________
83void AliMpVMotif::Print(Option_t *option) const
84{
85 // Print the map of the motif. In each cel, the value
86 // printed depends of option, as the following:
87 // option="N" the "name" of the pad is written
88 // option="K" the Kapton connect. number attached to the pad is written
89 // option="B" the Berg connect. number attached to the pad is written
90 // option="X" the (X,Y) position, in cm, of the center of the pad is written
91 // otherwise the number of the pad is written
92
93 // NOTE : this method is really not optimized, in case 'N' or '',
94 // but the Print() this should not be very important in a Print() method
95
96 if (option[0]=='X') {
97
98 cout<<"(X,Y) mapping";
99 cout<<" in the motif "<<fID<<endl;
100 cout<<"-----------------------------------"<<endl;
101 for (Int_t j=fMotifType->GetNofPadsY()-1;j>=0;j--){
102 for (Int_t i=0;i<fMotifType->GetNofPadsX();i++){
103 AliMpIntPair indices = AliMpIntPair(i,j);
104 if (fMotifType->FindConnectionByLocalIndices(indices)){
105 TVector2 pos = PadPositionLocal(indices);
106 cout<<setw(11)<<Form("(%.1f,%.1f)",pos.X(),pos.Y());
107 }
108 }
109 cout<<endl;
110 }
111 } else fMotifType->Print(option);
112}
113
114