]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpVMotif.cxx
- Reordering includes from most specific to more general ones
[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.8 2006/03/17 11:38:06 ivana Exp $
18 // Category: motif
19 ///
20 // Class AliMpVMotif
21 // -----------------
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
26
27 #include "AliMpVMotif.h"
28 #include "AliMpMotifType.h"
29 #include "AliMpIntPair.h"
30 #include "AliMpConnection.h"
31
32 #include <Riostream.h>
33
34 #include <iomanip>
35
36
37 ClassImp(AliMpVMotif)
38
39 //_____________________________________________________________________________
40 AliMpVMotif::AliMpVMotif():
41   fID(""),
42   fMotifType(0)
43 {
44 /// Default constructor
45 }
46
47 //_____________________________________________________________________________
48 AliMpVMotif::AliMpVMotif(const TString &id, AliMpMotifType *motifType):
49   fID(id),
50   fMotifType(motifType)
51 {
52   /// Standard constructor.              
53   /// The dimension in a given direction is calculated by
54   /// multiplying the total dimension by the number of pads
55
56 }
57
58 //_____________________________________________________________________________
59 AliMpVMotif::AliMpVMotif(const AliMpVMotif& right) 
60   : TObject(right) 
61 {
62   /// Protected copy constructor (not provided) 
63
64   Fatal("AliMpVMotif", "Copy constructor not provided.");
65 }
66
67 //_____________________________________________________________________________
68 AliMpVMotif::~AliMpVMotif()
69 {
70   /// Destructor
71 }
72
73 // operators
74
75 //_____________________________________________________________________________
76 AliMpVMotif& AliMpVMotif::operator=(const AliMpVMotif& right)
77 {
78   /// Protected assignment operator (not provided)
79   
80   // check assignment to self
81   if (this == &right) return *this;
82
83   Fatal("operator =", "Assignment operator not provided.");
84     
85   return *this;  
86 }    
87
88 //_____________________________________________________________________________
89 AliMpConnection* 
90 AliMpVMotif::FindConnectionByLocalPos(const TVector2& localPos) const
91 {
92   /// Return the local indices from the local
93   /// (x,y) position
94
95   AliMpIntPair padIndices=PadIndicesLocal(localPos);
96   if (padIndices.GetFirst()>=0)
97     return fMotifType->FindConnectionByLocalIndices(padIndices);
98   else
99     return 0;
100 }
101 //_____________________________________________________________________________
102 void AliMpVMotif::Print(Option_t *option) const
103 {
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
111   ///
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
114
115   if (option[0]=='X') {
116
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());
126         }
127       }
128       cout<<endl;
129     }
130   } else fMotifType->Print(option);
131 }
132
133