----------------------------------------------------------------------
[u/mrichter/AliRoot.git] / PHOS / AliPHOSTrackSegment.cxx
CommitLineData
d15a28e7 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//_________________________________________________________________________
17// class of PHOS Sub Track
18//*-- Author : Dmitri Peressounko RRC KI
19//////////////////////////////////////////////////////////////////////////////
20
21// --- ROOT system ---
22
23#include "TVector3.h"
24
25// --- Standard library ---
26
27#include "iostream.h"
28
29// --- AliRoot header files ---
30
31#include "AliPHOSTrackSegment.h"
32#include "AliPHOSv0.h"
33
34ClassImp(AliPHOSTrackSegment)
35
36//____________________________________________________________________________
37AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , AliPHOSPpsdRecPoint * ppsdRP1,
38 AliPHOSPpsdRecPoint * ppsdRP2 )
39{
40 if( emc )
41 fEmcRecPoint = emc ;
42
43 if( ppsdRP1 )
44 fPpsdUp = ppsdRP1 ;
45
46 if( ppsdRP2 )
47 fPpsdLow = ppsdRP2 ;
48
49 fCutOnDispersion = 1.5 ;
50}
51
52//____________________________________________________________________________
53AliPHOSTrackSegment::~AliPHOSTrackSegment() // dtor
54{
55// fEmcRecPoint.Delete() ; Not Owners !!!
56// fPpsdUp.Delete() ;
57// fPpsdLow.Delete() ;
58}
59
60//____________________________________________________________________________
61Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
62{
63
64 TVector3 vecEmc ;
65 fEmcRecPoint->GetLocalPosition(vecEmc) ;
66
67 TVector3 vecPpsd ;
68 if( fPpsdLow->GetMultiplicity() )
69 fPpsdLow->GetLocalPosition(vecPpsd) ;
70 else {
71 vecPpsd.SetX(10000.) ;
72 }
73 vecEmc -= vecPpsd ;
74
75 Float_t R = vecEmc.Mag();;
76
77 return R ;
78}
79
80//____________________________________________________________________________
81Bool_t AliPHOSTrackSegment::GetMomentumDirection( TVector3 & dir )
82{
83 // True if determined
84 Bool_t ifdeterm = kTRUE ;
85
86 if( fPpsdLow ){
87 TMatrix mdummy ;
88 if( fPpsdUp->GetMultiplicity() ) { // draw line trough 2 points
89 TVector3 posEmc ;
90 fEmcRecPoint->GetGlobalPosition(posEmc,mdummy) ;
91 TVector3 posPpsd ;
92 fPpsdLow->GetGlobalPosition(posPpsd,mdummy) ;
93 dir = posEmc - posPpsd ;
94 dir.SetMag(1.) ;
95 }
96
97 else { // draw line through 3 pionts
98 TVector3 posEmc ;
99 fEmcRecPoint->GetGlobalPosition(posEmc,mdummy) ;
100 TVector3 posPpsdl ;
101 fPpsdLow->GetGlobalPosition(posPpsdl,mdummy) ;
102 TVector3 posPpsdup ;
103 fPpsdUp->GetGlobalPosition(posPpsdup,mdummy) ;
104 posPpsdl = 0.5*( posPpsdup+posPpsdl ) ;
105 dir = posEmc - posPpsdl ;
106 dir.SetMag(1.) ;
107 }
108
109 }
110 else
111 ifdeterm = kFALSE ;
112
113 return ifdeterm ;
114}
115
116//____________________________________________________________________________
117Int_t AliPHOSTrackSegment::GetPartType()
118{
119 // Returns 0 - gamma
120 // 1 - e+, e-
121 // 2 - neutral hadron
122 // 3 - charged hadron
123
124 Int_t PartType =0;
125 if( fPpsdUp ){ // Neutral
126
127 if( fPpsdLow ) // Neutral hadron
128 PartType = 2 ;
129 else // Gamma
130 PartType = 0 ;
131
132 }
133
134 else { // Charged
135
136 if( fEmcRecPoint->GetDispersion() > fCutOnDispersion)
137 PartType = 3 ;
138 else
139 PartType = 1 ;
140
141 }
142
143 return PartType ;
144
145}
146
147//____________________________________________________________________________
148void AliPHOSTrackSegment::GetPosition( TVector3 & pos )
149{
150 // Returns positions of hits
151 TMatrix Dummy ;
152 fEmcRecPoint->GetGlobalPosition(pos, Dummy) ;
153}
154
155//____________________________________________________________________________
156void AliPHOSTrackSegment::Print()
157{
158 cout << "--------AliPHOSTrackSegment-------- "<<endl ;
159 cout << "EMC Reconstructed Point: " << fEmcRecPoint << endl;
160
161 TVector3 pos ;
162 TMatrix Dummy ;
163
164 fEmcRecPoint->GetGlobalPosition( pos, Dummy ) ;
165
166 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << fEmcRecPoint->GetTotalEnergy() << endl ;
167 cout << "PPSD Low Reconstructed Point: " << endl;
168
169 if(fPpsdLow){
170 fPpsdLow->GetGlobalPosition( pos , Dummy ) ;
171 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
172 }
173
174 cout << "PPSD Up Reconstructed Point: " << endl;
175
176 if(fPpsdUp ){
177 fPpsdUp->GetGlobalPosition( pos, Dummy ) ;
178 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
179 }
180
181}
182