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