1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // $MpId: AliMpVMotif.cxx,v 1.8 2006/03/17 11:38:06 ivana Exp $
22 // Class that defines a motif with its unique ID
23 // and the motif type.
24 // Included in AliRoot: 2003/05/02
25 // Authors: David Guez, Ivana Hrivnacova; IPN Orsay
27 #include "AliMpVMotif.h"
28 #include "AliMpMotifType.h"
29 #include "AliMpIntPair.h"
30 #include "AliMpConnection.h"
32 #include <Riostream.h>
39 //_____________________________________________________________________________
40 AliMpVMotif::AliMpVMotif():
44 /// Default constructor
47 //_____________________________________________________________________________
48 AliMpVMotif::AliMpVMotif(const TString &id, AliMpMotifType *motifType):
52 /// Standard constructor.
53 /// The dimension in a given direction is calculated by
54 /// multiplying the total dimension by the number of pads
58 //_____________________________________________________________________________
59 AliMpVMotif::AliMpVMotif(const AliMpVMotif& right)
62 /// Protected copy constructor (not provided)
64 Fatal("AliMpVMotif", "Copy constructor not provided.");
67 //_____________________________________________________________________________
68 AliMpVMotif::~AliMpVMotif()
75 //_____________________________________________________________________________
76 AliMpVMotif& AliMpVMotif::operator=(const AliMpVMotif& right)
78 /// Protected assignment operator (not provided)
80 // check assignment to self
81 if (this == &right) return *this;
83 Fatal("operator =", "Assignment operator not provided.");
88 //_____________________________________________________________________________
90 AliMpVMotif::FindConnectionByLocalPos(const TVector2& localPos) const
92 /// Return the local indices from the local
95 AliMpIntPair padIndices=PadIndicesLocal(localPos);
96 if (padIndices.GetFirst()>=0)
97 return fMotifType->FindConnectionByLocalIndices(padIndices);
101 //_____________________________________________________________________________
102 void AliMpVMotif::Print(Option_t *option) const
104 /// Print the map of the motif. In each cel, the value
105 /// printed depends of option, as the following:
106 /// - option="N" the "name" of the pad is written
107 /// - option="K" the Kapton connect. number attached to the pad is written
108 /// - option="B" the Berg connect. number attached to the pad is written
109 /// - option="X" the (X,Y) position, in cm, of the center of the pad is written
110 /// otherwise the number of the pad is written
112 /// NOTE : this method is really not optimized, in case 'N' or '',
113 /// but the Print() this should not be very important in a Print() method
115 if (option[0]=='X') {
117 cout<<"(X,Y) mapping";
118 cout<<" in the motif "<<fID<<endl;
119 cout<<"-----------------------------------"<<endl;
120 for (Int_t j=fMotifType->GetNofPadsY()-1;j>=0;j--){
121 for (Int_t i=0;i<fMotifType->GetNofPadsX();i++){
122 AliMpIntPair indices = AliMpIntPair(i,j);
123 if (fMotifType->FindConnectionByLocalIndices(indices)){
124 TVector2 pos = PadPositionLocal(indices);
125 cout<<setw(11)<<Form("(%.1f,%.1f)",pos.X(),pos.Y());
130 } else fMotifType->Print(option);