]>
Commit | Line | Data |
---|---|---|
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 | ||
b80faac0 | 38 | using std::cout; |
39 | using std::endl; | |
40 | using std::setw; | |
13985652 | 41 | /// \cond CLASSIMP |
5f91c9e8 | 42 | ClassImp(AliMpVMotif) |
13985652 | 43 | /// \endcond |
5f91c9e8 | 44 | |
45 | //_____________________________________________________________________________ | |
46 | AliMpVMotif::AliMpVMotif(): | |
47 | fID(""), | |
48 | fMotifType(0) | |
49 | { | |
dee1d5f1 | 50 | /// Default constructor |
5f91c9e8 | 51 | } |
52 | ||
53 | //_____________________________________________________________________________ | |
54 | AliMpVMotif::AliMpVMotif(const TString &id, AliMpMotifType *motifType): | |
55 | fID(id), | |
56 | fMotifType(motifType) | |
57 | { | |
dee1d5f1 | 58 | /// Standard constructor. |
59 | /// The dimension in a given direction is calculated by | |
60 | /// multiplying the total dimension by the number of pads | |
5f91c9e8 | 61 | |
62 | } | |
63 | ||
2998a151 | 64 | //_____________________________________________________________________________ |
65 | AliMpVMotif::~AliMpVMotif() | |
66 | { | |
dee1d5f1 | 67 | /// Destructor |
2998a151 | 68 | } |
69 | ||
5f91c9e8 | 70 | //_____________________________________________________________________________ |
71 | AliMpConnection* | |
6e97fbb8 | 72 | AliMpVMotif::FindConnectionByLocalPos(Double_t localPosX, Double_t localPosY) const |
5f91c9e8 | 73 | { |
dee1d5f1 | 74 | /// Return the local indices from the local |
75 | /// (x,y) position | |
5f91c9e8 | 76 | |
6e97fbb8 | 77 | MpPair_t padIndices = PadIndicesLocal(localPosX, localPosY); |
168e9c4d | 78 | if ( padIndices > 0 ) |
5f91c9e8 | 79 | return fMotifType->FindConnectionByLocalIndices(padIndices); |
80 | else | |
81 | return 0; | |
82 | } | |
6e97fbb8 | 83 | |
5f91c9e8 | 84 | //_____________________________________________________________________________ |
85 | void AliMpVMotif::Print(Option_t *option) const | |
86 | { | |
dee1d5f1 | 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 | |
5f91c9e8 | 97 | |
98 | if (option[0]=='X') { | |
99 | ||
100 | cout<<"(X,Y) mapping"; | |
101 | cout<<" in the motif "<<fID<<endl; | |
102 | cout<<"-----------------------------------"<<endl; | |
103 | for (Int_t j=fMotifType->GetNofPadsY()-1;j>=0;j--){ | |
104 | for (Int_t i=0;i<fMotifType->GetNofPadsX();i++){ | |
168e9c4d | 105 | if (fMotifType->FindConnectionByLocalIndices(i,j)){ |
6e97fbb8 | 106 | Double_t posx, posy; |
107 | PadPositionLocal(i,j, posx, posy); | |
108 | cout<<setw(11)<<Form("(%.1f,%.1f)",posx,posy); | |
5f91c9e8 | 109 | } |
110 | } | |
111 | cout<<endl; | |
112 | } | |
113 | } else fMotifType->Print(option); | |
114 | } |