]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/mapping/AliMpVMotif.cxx
Flexible pt range for the efficiency histogramming
[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 "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 ClassImp(AliMpVMotif)
43 /// \endcond
44
45 //_____________________________________________________________________________
46 AliMpVMotif::AliMpVMotif():
47   fID(""),
48   fMotifType(0)
49 {
50 /// Default constructor
51 }
52
53 //_____________________________________________________________________________
54 AliMpVMotif::AliMpVMotif(const TString &id, AliMpMotifType *motifType):
55   fID(id),
56   fMotifType(motifType)
57 {
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 }
63
64 //_____________________________________________________________________________
65 AliMpVMotif::~AliMpVMotif()
66 {
67   /// Destructor
68 }
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   MpPair_t padIndices = PadIndicesLocal(localPosX, localPosY);
78   if ( padIndices > 0 )
79     return fMotifType->FindConnectionByLocalIndices(padIndices);
80   else
81     return 0;
82 }
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   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++){
105         if (fMotifType->FindConnectionByLocalIndices(i,j)){
106           Double_t posx, posy;
107           PadPositionLocal(i,j, posx, posy);
108           cout<<setw(11)<<Form("(%.1f,%.1f)",posx,posy);
109         }
110       }
111       cout<<endl;
112     }
113   } else fMotifType->Print(option);
114 }