Line data Source code
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 "AliMpEncodePair.h"
32 : #include "AliMpConnection.h"
33 :
34 : #include <Riostream.h>
35 :
36 : #include <iomanip>
37 :
38 : using std::cout;
39 : using std::endl;
40 : using std::setw;
41 : /// \cond CLASSIMP
42 18 : ClassImp(AliMpVMotif)
43 : /// \endcond
44 :
45 : //_____________________________________________________________________________
46 0 : AliMpVMotif::AliMpVMotif():
47 0 : fID(""),
48 0 : fMotifType(0)
49 0 : {
50 : /// Default constructor
51 0 : }
52 :
53 : //_____________________________________________________________________________
54 834 : AliMpVMotif::AliMpVMotif(const TString &id, AliMpMotifType *motifType):
55 834 : fID(id),
56 834 : fMotifType(motifType)
57 2502 : {
58 : /// Standard constructor.
59 : /// The dimension in a given direction is calculated by
60 : /// multiplying the total dimension by the number of pads
61 :
62 834 : }
63 :
64 : //_____________________________________________________________________________
65 : AliMpVMotif::~AliMpVMotif()
66 1112 : {
67 : /// Destructor
68 556 : }
69 :
70 : //_____________________________________________________________________________
71 : AliMpConnection*
72 : AliMpVMotif::FindConnectionByLocalPos(Double_t localPosX, Double_t localPosY) const
73 : {
74 : /// Return the local indices from the local
75 : /// (x,y) position
76 :
77 0 : MpPair_t padIndices = PadIndicesLocal(localPosX, localPosY);
78 0 : if ( padIndices > 0 )
79 0 : return fMotifType->FindConnectionByLocalIndices(padIndices);
80 : else
81 0 : return 0;
82 0 : }
83 :
84 : //_____________________________________________________________________________
85 : void AliMpVMotif::Print(Option_t *option) const
86 : {
87 : /// Print the map of the motif. In each cel, the value
88 : /// printed depends of option, as the following:
89 : /// - option="N" the "name" of the pad is written
90 : /// - option="K" the Kapton connect. number attached to the pad is written
91 : /// - option="B" the Berg connect. number attached to the pad is written
92 : /// - option="X" the (X,Y) position, in cm, of the center of the pad is written
93 : /// otherwise the number of the pad is written
94 : ///
95 : /// NOTE : this method is really not optimized, in case 'N' or '',
96 : /// but the Print() this should not be very important in a Print() method
97 :
98 0 : if (option[0]=='X') {
99 :
100 0 : cout<<"(X,Y) mapping";
101 0 : cout<<" in the motif "<<fID<<endl;
102 0 : cout<<"-----------------------------------"<<endl;
103 0 : for (Int_t j=fMotifType->GetNofPadsY()-1;j>=0;j--){
104 0 : for (Int_t i=0;i<fMotifType->GetNofPadsX();i++){
105 0 : if (fMotifType->FindConnectionByLocalIndices(i,j)){
106 0 : Double_t posx, posy;
107 0 : PadPositionLocal(i,j, posx, posy);
108 0 : cout<<setw(11)<<Form("(%.1f,%.1f)",posx,posy);
109 0 : }
110 : }
111 0 : cout<<endl;
112 : }
113 0 : } else fMotifType->Print(option);
114 0 : }
|