]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONTriggerTrack.cxx
The description of changes:
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerTrack.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
18 //-----------------------------------------------------------------------------
19 // Class AliMUONTriggerTrack
20 //---------------------------
21 // Reconstructed Trigger track in ALICE dimuon spectrometer
22 // Note: equivalent to AliMUONTriggerTrack for tracking,
23 // No need for a AliMUONTriggerTrackParam
24 // Author: Philippe Crochet
25 //-----------------------------------------------------------------------------
26
27 #include "AliMUONTriggerTrack.h"
28 #include "AliMUONTrackReconstructor.h" 
29 #include "TString.h"
30 #include <Riostream.h>
31 #include "AliLog.h"
32
33 /// \cond CLASSIMP
34 ClassImp(AliMUONTriggerTrack)
35 /// \endcond
36
37 //__________________________________________________________________________
38 AliMUONTriggerTrack::AliMUONTriggerTrack()
39   : TObject(),
40     fx11(0),
41     fy11(0),
42     fz11(0.),
43     fz21(0.),
44     fSlopeX(0),
45     fSlopeY(0),
46     floTrgNum(0),
47     fGTPattern(0),
48     fHitsPatternInTrigCh(0),
49     fCovariances(0x0)
50 {
51   /// default ctr
52       AliDebug(1,Form("this=%p",this));
53 }
54 //__________________________________________________________________________
55 AliMUONTriggerTrack::AliMUONTriggerTrack(Float_t x11, Float_t y11, Float_t z11, Float_t z21, Float_t slopeX, Float_t slopeY, Int_t loTrgNum, Long_t theGTPattern, UShort_t hitsPatternInTrigCh)
56     : TObject(),
57       fx11(x11),
58       fy11(y11),
59       fz11(z11),
60       fz21(z21),
61       fSlopeX(slopeX),
62       fSlopeY(slopeY),
63       floTrgNum(loTrgNum),
64       fGTPattern(theGTPattern),
65       fHitsPatternInTrigCh(hitsPatternInTrigCh),
66       fCovariances(0x0)
67 {
68 /// ctor from local trigger output
69         AliDebug(1,Form("this=%p x11=%f y11=%f z11=%f z21=%f slopeX=%f slopeY=%f loTrgNum=%d GTPattern=%ld HitsPatternInTrigCh %i",
70                         this,x11,y11,z11,z21,slopeX,slopeY,loTrgNum,theGTPattern,fHitsPatternInTrigCh));
71
72 }
73
74 //__________________________________________________________________________
75 AliMUONTriggerTrack::~AliMUONTriggerTrack()
76 {
77   /// Destructor
78   AliDebug(1,Form("this=%p",this));
79   if (fCovariances) {
80     delete fCovariances;
81     fCovariances = 0x0;
82   }
83 }
84
85 //__________________________________________________________________________
86 AliMUONTriggerTrack::AliMUONTriggerTrack (const AliMUONTriggerTrack& theMUONTriggerTrack)
87     : TObject(theMUONTriggerTrack),
88       fx11(theMUONTriggerTrack.fx11),
89       fy11(theMUONTriggerTrack.fy11),
90       fz11(theMUONTriggerTrack.fz11),
91       fz21(theMUONTriggerTrack.fz21),
92       fSlopeX(theMUONTriggerTrack.fSlopeX),
93       fSlopeY(theMUONTriggerTrack.fSlopeY),
94       floTrgNum(theMUONTriggerTrack.floTrgNum),
95       fGTPattern(theMUONTriggerTrack.fGTPattern),
96       fHitsPatternInTrigCh(theMUONTriggerTrack.fHitsPatternInTrigCh),
97       fCovariances(0x0)
98 {
99 ///
100 /// copy ctor
101 ///
102   if (theMUONTriggerTrack.fCovariances) fCovariances = new TMatrixD(*(theMUONTriggerTrack.fCovariances));
103   AliDebug(1,Form("this=%p copy ctor",this));
104
105 }
106       
107 //__________________________________________________________________________
108 AliMUONTriggerTrack & AliMUONTriggerTrack::operator=(const AliMUONTriggerTrack&
109 theMUONTriggerTrack)
110 {
111 /// Assignment operator
112
113     // check assignement to self
114     if (this == &theMUONTriggerTrack)
115         return *this;
116     
117     /// base class assignement
118     TObject::operator=(theMUONTriggerTrack);
119
120     fx11 = theMUONTriggerTrack.fx11;
121     fy11 = theMUONTriggerTrack.fy11;
122     fz11 = theMUONTriggerTrack.fz11;
123     fz21 = theMUONTriggerTrack.fz21;
124     fSlopeX = theMUONTriggerTrack.fSlopeX;
125     fSlopeY = theMUONTriggerTrack.fSlopeY;
126     floTrgNum = theMUONTriggerTrack.floTrgNum;
127     fGTPattern = theMUONTriggerTrack.fGTPattern;
128     fHitsPatternInTrigCh = theMUONTriggerTrack.fHitsPatternInTrigCh;
129
130     if (theMUONTriggerTrack.fCovariances) {
131       if (fCovariances) *fCovariances = *(theMUONTriggerTrack.fCovariances);
132       else fCovariances = new TMatrixD(*(theMUONTriggerTrack.fCovariances));
133     } else {
134       delete fCovariances;
135       fCovariances = 0x0;
136     }
137
138     return *this;
139 }
140
141 //__________________________________________________________________________
142 void
143 AliMUONTriggerTrack::Print(Option_t* opt) const
144 {
145 /// Printing
146   TString optString(opt);
147   optString.ToUpper();
148   if ( optString.Contains("FULL") ) optString = "PARAM COV";
149
150   if ( optString.Contains("PARAM"))
151     cout << Form("(X,Y,Z)11=(%7.2f,%7.2f,%7.2f) Z21=%7.2f Slope(X,Y)=(%7.2f,%7.2f) LocalBoard #%3d GlobalTriggerPattern %x HitsPatternInTrigCh %x",
152                  fx11,fy11,fz11,fz21,fSlopeX,fSlopeY,floTrgNum,fGTPattern,fHitsPatternInTrigCh) << endl;
153
154   if ( optString.Contains("COV") ){
155     if ( ! fCovariances ) cout << "Covariances not initialized " << endl;
156     else fCovariances->Print();
157   }
158 }
159
160 //__________________________________________________________________________
161 void AliMUONTriggerTrack::SetCovariances(const TMatrixD& covariances)
162 {
163   /// Set the covariance matrix
164   if (fCovariances) *fCovariances = covariances;
165   else fCovariances = new TMatrixD(covariances);
166 }
167
168 //__________________________________________________________________________
169 void AliMUONTriggerTrack::SetCovariances(const Double_t matrix[3][3])
170 {
171   /// Set the covariance matrix
172   if (fCovariances) fCovariances->SetMatrixArray(&(matrix[0][0]));
173   else fCovariances = new TMatrixD(3,3,&(matrix[0][0]));
174 }
175
176 //__________________________________________________________________________
177 const TMatrixD& AliMUONTriggerTrack::GetCovariances() const
178 {
179   /// Return the covariance matrix (create it before if needed)
180   if (!fCovariances) {
181     fCovariances = new TMatrixD(3,3);
182     fCovariances->Zero();
183   }
184   return *fCovariances;
185 }