1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 //_________________________________________________________________________
17 // class of PHOS Sub Track
18 //*-- Author : Dmitri Peressounko RRC KI
19 //////////////////////////////////////////////////////////////////////////////
21 // --- ROOT system ---
26 // --- Standard library ---
30 // --- AliRoot header files ---
32 #include "AliPHOSTrackSegment.h"
33 #include "AliPHOSv0.h"
35 ClassImp(AliPHOSTrackSegment)
37 //____________________________________________________________________________
38 AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , AliPHOSPpsdRecPoint * ppsdRP1,
39 AliPHOSPpsdRecPoint * ppsdRP2 )
50 fCutOnDispersion = 1.5 ;
53 //____________________________________________________________________________
54 AliPHOSTrackSegment::~AliPHOSTrackSegment() // dtor
56 // fEmcRecPoint.Delete() ; Not Owners !!!
58 // fPpsdLow.Delete() ;
61 //____________________________________________________________________________
62 Int_t AliPHOSTrackSegment::DistancetoPrimitive(Int_t px, Int_t py)
64 //*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a AliPHOSTrackSegment considered as a Tmarker*-*-*-*-*-*
65 //*-* ===========================================
66 // Compute the closest distance of approach from point px,py to this marker.
67 // The distance is computed in pixels units.
70 TVector3 pos(0.,0.,0.) ;
71 fEmcRecPoint->GetLocalPosition( pos) ;
74 const Int_t kMaxDiff = 10;
75 Int_t pxm = gPad->XtoAbsPixel(x);
76 Int_t pym = gPad->YtoAbsPixel(y);
77 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
79 if (dist > kMaxDiff) return 9999;
83 //___________________________________________________________________________
84 void AliPHOSTrackSegment::Draw(Option_t *option)
86 // //*-*-*-*-*-*-*-*-*-*-*Draw this AliPHOSTrackSegment with its current attributes*-*-*-*-*-*-*
92 //______________________________________________________________________________
93 void AliPHOSTrackSegment::ExecuteEvent(Int_t event, Int_t px, Int_t py)
95 //*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
96 //*-* =========================================
97 // This member function is called when a AliPHOSTrackSegment is clicked with the locator
99 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
100 // and switched off when the mouse button is released.
102 static TPaveText* TrackSegmentText = 0 ;
104 if (!gPad->IsEditable()) return;
110 if (!TrackSegmentText) {
112 TVector3 pos(0.,0.,0.) ;
113 fEmcRecPoint->GetLocalPosition(pos) ;
114 TrackSegmentText = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+50,pos.Z()+35,"") ;
116 if (GetPartType() == 0 ) sprintf(line1,"PHOTON") ;
117 if (GetPartType() == 1 ) sprintf(line1,"NEUTRAL HADRON") ;
118 if (GetPartType() == 2 ) sprintf(line1,"CHARGED HADRON") ;
119 if (GetPartType() == 3 ) sprintf(line1,"ELECTRON") ;
120 TrackSegmentText ->AddText(line1) ;
121 TrackSegmentText ->Paint("");
128 if (TrackSegmentText) {
129 delete TrackSegmentText ;
130 TrackSegmentText = 0 ;
137 //____________________________________________________________________________
138 Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
142 fEmcRecPoint->GetLocalPosition(vecEmc) ;
145 if( fPpsdLow->GetMultiplicity() )
146 fPpsdLow->GetLocalPosition(vecPpsd) ;
148 vecPpsd.SetX(10000.) ;
152 Float_t R = vecEmc.Mag();;
157 //____________________________________________________________________________
158 Bool_t AliPHOSTrackSegment::GetMomentumDirection( TVector3 & dir )
160 // True if determined
161 Bool_t ifdeterm = kTRUE ;
165 if( fPpsdUp->GetMultiplicity() ) { // draw line trough 2 points
167 fEmcRecPoint->GetGlobalPosition(posEmc,mdummy) ;
169 fPpsdLow->GetGlobalPosition(posPpsd,mdummy) ;
170 dir = posEmc - posPpsd ;
174 else { // draw line through 3 pionts
176 fEmcRecPoint->GetGlobalPosition(posEmc,mdummy) ;
178 fPpsdLow->GetGlobalPosition(posPpsdl,mdummy) ;
180 fPpsdUp->GetGlobalPosition(posPpsdup,mdummy) ;
181 posPpsdl = 0.5*( posPpsdup+posPpsdl ) ;
182 dir = posEmc - posPpsdl ;
193 //____________________________________________________________________________
194 Int_t AliPHOSTrackSegment::GetPartType()
198 // 2 - neutral hadron
199 // 3 - charged hadron
202 if( fPpsdUp ){ // Neutral
204 if( fPpsdLow ) // Neutral hadron
213 if( fEmcRecPoint->GetDispersion() > fCutOnDispersion)
224 //____________________________________________________________________________
225 void AliPHOSTrackSegment::GetPosition( TVector3 & pos )
227 // Returns positions of hits
229 fEmcRecPoint->GetGlobalPosition(pos, Dummy) ;
232 //______________________________________________________________________________
233 void AliPHOSTrackSegment::Paint(Option_t *)
235 //*-*-*-*-*-*-*-*-*-*-*Paint this ALiPHOSTrackSegment as a TMarker with its current attributes*-*-*-*-*-*-*
236 //*-* =============================================
237 TVector3 pos(0.,0.,0.) ;
238 fEmcRecPoint->GetLocalPosition(pos) ;
239 Coord_t x = pos.X() ;
240 Coord_t y = pos.Z() ;
241 Color_t MarkerColor = 1 ;
242 Size_t MarkerSize = 1. ;
243 Style_t MarkerStyle = 29 ;
245 if (GetPartType() == 0 ) MarkerStyle = 20 ;
246 if (GetPartType() == 1 ) MarkerStyle = 21 ;
247 if (GetPartType() == 2 ) MarkerStyle = 22 ;
248 if (GetPartType() == 3 ) MarkerStyle = 23 ;
250 if (!gPad->IsBatch()) {
251 gVirtualX->SetMarkerColor(MarkerColor) ;
252 gVirtualX->SetMarkerSize (MarkerSize) ;
253 gVirtualX->SetMarkerStyle(MarkerStyle) ;
255 gPad->SetAttMarkerPS(MarkerColor,MarkerStyle,MarkerSize) ;
256 gPad->PaintPolyMarker(1,&x,&y,"") ;
260 //____________________________________________________________________________
261 void AliPHOSTrackSegment::Print()
263 cout << "--------AliPHOSTrackSegment-------- "<<endl ;
264 cout << "EMC Reconstructed Point: " << fEmcRecPoint << endl;
269 fEmcRecPoint->GetGlobalPosition( pos, Dummy ) ;
271 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << fEmcRecPoint->GetTotalEnergy() << endl ;
272 cout << "PPSD Low Reconstructed Point: " << endl;
275 fPpsdLow->GetGlobalPosition( pos , Dummy ) ;
276 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
279 cout << "PPSD Up Reconstructed Point: " << endl;
282 fPpsdUp->GetGlobalPosition( pos, Dummy ) ;
283 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;