new functionality and new class added
[u/mrichter/AliRoot.git] / MUON / AliMUONTriggerTrack.cxx
CommitLineData
0b3dd00a 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
ee8a8d65 16// $Id$
0b3dd00a 17
ee8a8d65 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//-----------------------------------------------------------------------------
0b3dd00a 26
0b3dd00a 27#include "AliMUONTriggerTrack.h"
29f1b13a 28#include "AliMUONTrackReconstructor.h"
bdfb6eef 29#include "TString.h"
e5e7be4b 30#include <Riostream.h>
31#include "AliLog.h"
0b3dd00a 32
ee8a8d65 33/// \cond CLASSIMP
34ClassImp(AliMUONTriggerTrack)
35/// \endcond
36
0b3dd00a 37//__________________________________________________________________________
38AliMUONTriggerTrack::AliMUONTriggerTrack()
7fe0032c 39 : TObject(),
40 fx11(0),
41 fy11(0),
bdfb6eef 42 fz11(0.),
43 fz21(0.),
44 fSlopeX(0),
45 fSlopeY(0),
c6ba19f7 46 floTrgNum(0),
67c201be 47 fGTPattern(0),
bdfb6eef 48 fHitsPatternInTrigCh(0),
49 fCovariances(0x0)
0b3dd00a 50{
7945aae7 51 /// default ctr
e5e7be4b 52 AliDebug(1,Form("this=%p",this));
0b3dd00a 53}
54//__________________________________________________________________________
bdfb6eef 55AliMUONTriggerTrack::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)
1657f946 56 : TObject(),
57 fx11(x11),
58 fy11(y11),
bdfb6eef 59 fz11(z11),
60 fz21(z21),
61 fSlopeX(slopeX),
62 fSlopeY(slopeY),
c6ba19f7 63 floTrgNum(loTrgNum),
67c201be 64 fGTPattern(theGTPattern),
bdfb6eef 65 fHitsPatternInTrigCh(hitsPatternInTrigCh),
66 fCovariances(0x0)
0b3dd00a 67{
7945aae7 68/// ctor from local trigger output
bdfb6eef 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));
e5e7be4b 71
0b3dd00a 72}
73
74//__________________________________________________________________________
75AliMUONTriggerTrack::~AliMUONTriggerTrack()
76{
7945aae7 77 /// Destructor
e5e7be4b 78 AliDebug(1,Form("this=%p",this));
bdfb6eef 79 if (fCovariances) {
80 delete fCovariances;
81 fCovariances = 0x0;
82 }
0b3dd00a 83}
84
85//__________________________________________________________________________
30178c30 86AliMUONTriggerTrack::AliMUONTriggerTrack (const AliMUONTriggerTrack& theMUONTriggerTrack)
1657f946 87 : TObject(theMUONTriggerTrack),
88 fx11(theMUONTriggerTrack.fx11),
89 fy11(theMUONTriggerTrack.fy11),
bdfb6eef 90 fz11(theMUONTriggerTrack.fz11),
91 fz21(theMUONTriggerTrack.fz21),
92 fSlopeX(theMUONTriggerTrack.fSlopeX),
93 fSlopeY(theMUONTriggerTrack.fSlopeY),
c6ba19f7 94 floTrgNum(theMUONTriggerTrack.floTrgNum),
67c201be 95 fGTPattern(theMUONTriggerTrack.fGTPattern),
bdfb6eef 96 fHitsPatternInTrigCh(theMUONTriggerTrack.fHitsPatternInTrigCh),
97 fCovariances(0x0)
0b3dd00a 98{
7945aae7 99///
100/// copy ctor
101///
bdfb6eef 102 if (theMUONTriggerTrack.fCovariances) fCovariances = new TMatrixD(*(theMUONTriggerTrack.fCovariances));
103 AliDebug(1,Form("this=%p copy ctor",this));
e5e7be4b 104
0b3dd00a 105}
106
107//__________________________________________________________________________
108AliMUONTriggerTrack & AliMUONTriggerTrack::operator=(const AliMUONTriggerTrack&
30178c30 109theMUONTriggerTrack)
0b3dd00a 110{
7945aae7 111/// Assignment operator
112
30178c30 113 // check assignement to self
114 if (this == &theMUONTriggerTrack)
0b3dd00a 115 return *this;
116
7945aae7 117 /// base class assignement
30178c30 118 TObject::operator=(theMUONTriggerTrack);
119
30178c30 120 fx11 = theMUONTriggerTrack.fx11;
121 fy11 = theMUONTriggerTrack.fy11;
bdfb6eef 122 fz11 = theMUONTriggerTrack.fz11;
123 fz21 = theMUONTriggerTrack.fz21;
124 fSlopeX = theMUONTriggerTrack.fSlopeX;
125 fSlopeY = theMUONTriggerTrack.fSlopeY;
c6ba19f7 126 floTrgNum = theMUONTriggerTrack.floTrgNum;
30178c30 127 fGTPattern = theMUONTriggerTrack.fGTPattern;
67c201be 128 fHitsPatternInTrigCh = theMUONTriggerTrack.fHitsPatternInTrigCh;
9131b4fe 129
bdfb6eef 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
0b3dd00a 138 return *this;
139}
c6ba19f7 140
e5e7be4b 141//__________________________________________________________________________
142void
bdfb6eef 143AliMUONTriggerTrack::Print(Option_t* opt) const
e5e7be4b 144{
145/// Printing
bdfb6eef 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}
e5e7be4b 159
bdfb6eef 160//__________________________________________________________________________
161void 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//__________________________________________________________________________
169void 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//__________________________________________________________________________
177const 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;
e5e7be4b 185}