]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/mapping/AliMpVMotif.cxx
Code for MUON Station1 (I.Hrivnacova)
[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.
8//
9// Authors: David Guez, Ivana Hrivnacova; IPN Orsay
10
11#include <iomanip>
12
13#include <Riostream.h>
14
15#include "AliMpVMotif.h"
16#include "AliMpMotifType.h"
17#include "AliMpIntPair.h"
18#include "AliMpConnection.h"
19
20
21ClassImp(AliMpVMotif)
22
23//_____________________________________________________________________________
24AliMpVMotif::AliMpVMotif():
25 fID(""),
26 fMotifType(0)
27{
28 //default dummy constructor
29}
30
31//_____________________________________________________________________________
32AliMpVMotif::AliMpVMotif(const TString &id, AliMpMotifType *motifType):
33 fID(id),
34 fMotifType(motifType)
35{
36 // Normal constructor.
37 // The dimension in a given direction is calculated by
38 // multiplying the total dimension by the number of pads
39
40}
41
42//_____________________________________________________________________________
43AliMpConnection*
44AliMpVMotif::FindConnectionByLocalPos(const TVector2& localPos) const
45{
46 // Return the local indices from the local
47 // (x,y) position
48
49 AliMpIntPair padIndices=PadIndicesLocal(localPos);
50 if (padIndices.GetFirst()>=0)
51 return fMotifType->FindConnectionByLocalIndices(padIndices);
52 else
53 return 0;
54}
55//_____________________________________________________________________________
56void AliMpVMotif::Print(Option_t *option) const
57{
58 // Print the map of the motif. In each cel, the value
59 // printed depends of option, as the following:
60 // option="N" the "name" of the pad is written
61 // option="K" the Kapton connect. number attached to the pad is written
62 // option="B" the Berg connect. number attached to the pad is written
63 // option="X" the (X,Y) position, in cm, of the center of the pad is written
64 // otherwise the number of the pad is written
65
66 // NOTE : this method is really not optimized, in case 'N' or '',
67 // but the Print() this should not be very important in a Print() method
68
69 if (option[0]=='X') {
70
71 cout<<"(X,Y) mapping";
72 cout<<" in the motif "<<fID<<endl;
73 cout<<"-----------------------------------"<<endl;
74 for (Int_t j=fMotifType->GetNofPadsY()-1;j>=0;j--){
75 for (Int_t i=0;i<fMotifType->GetNofPadsX();i++){
76 AliMpIntPair indices = AliMpIntPair(i,j);
77 if (fMotifType->FindConnectionByLocalIndices(indices)){
78 TVector2 pos = PadPositionLocal(indices);
79 cout<<setw(11)<<Form("(%.1f,%.1f)",pos.X(),pos.Y());
80 }
81 }
82 cout<<endl;
83 }
84 } else fMotifType->Print(option);
85}
86
87