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 // Reconstructed Particle
18 //*-- Y. Schutz: SUBATECH
19 //////////////////////////////////////////////////////////////////////////////
21 // --- ROOT system ---
23 // --- Standard library ---
25 // --- AliRoot header files ---
27 #include "AliPHOSRecParticle.h"
30 ClassImp(AliPHOSRecParticle)
33 //____________________________________________________________________________
34 AliPHOSRecParticle::AliPHOSRecParticle(AliPHOSTrackSegment * ts)
38 fPHOSTrackSegment = new AliPHOSTrackSegment(*ts) ;
39 fE = ts->GetEnergy() ;
40 TVector3 momdir = ts->GetMomentumDirection() ;
41 fPx = fE * momdir.X() ;
42 fPy = fE * momdir.Y() ;
43 fPz = fE * momdir.Z() ;
48 //____________________________________________________________________________
49 Int_t AliPHOSRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
51 // Compute distance from point px,py to a AliPHOSRecParticle considered as a Tmarker
52 // Compute the closest distance of approach from point px,py to this marker.
53 // The distance is computed in pixels units.
55 Double_t kRADDEG = 180. / TMath::Pi() ;
56 Coord_t x = Phi() * kRADDEG ;
57 Coord_t y = Theta() * kRADDEG ;
58 const Int_t kMaxDiff = 10;
59 Int_t pxm = gPad->XtoAbsPixel(x);
60 Int_t pym = gPad->YtoAbsPixel(y);
61 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
63 if (dist > kMaxDiff) return 9999;
67 //___________________________________________________________________________
68 void AliPHOSRecParticle::Draw(Option_t *option)
70 // Draw this AliPHOSRecParticle with its current attributes
75 //______________________________________________________________________________
76 void AliPHOSRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
78 // Execute action corresponding to one event
79 // This member function is called when a AliPHOSRecParticle is clicked with the locator
82 if (!gPad->IsEditable())
85 static TPaveText * clustertext = 0 ;
90 Double_t kRADDEG = 180. / TMath::Pi() ;
91 Coord_t x = Phi() * kRADDEG ;
92 Coord_t y = Theta() * kRADDEG ;
93 clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
96 sprintf( line1, "PID: %s ", (const char*)Name() ) ;
97 sprintf( line2, "ENERGY: %f ", Energy() ) ;
98 clustertext ->AddText(line1) ;
99 clustertext ->AddText(line2) ;
100 clustertext ->Draw("");
115 //____________________________________________________________________________
116 TString AliPHOSRecParticle::Name()
130 name = "CHARGED HADRON" ;
133 name = "NEUTRAL HADRON" ;
136 name = "NEUTRAL EM" ;
139 name = "PHOTON HADRON" ;
146 //______________________________________________________________________________
147 void AliPHOSRecParticle::Paint(Option_t *)
149 // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes
151 Double_t kRADDEG = 180. / TMath::Pi() ;
152 Coord_t x = Phi() * kRADDEG ;
153 Coord_t y = Theta() * kRADDEG ;
154 Color_t markercolor = 1 ;
155 Size_t markersize = 1. ;
156 Style_t markerstyle = 5 ;
158 if (!gPad->IsBatch()) {
159 gVirtualX->SetMarkerColor(markercolor) ;
160 gVirtualX->SetMarkerSize (markersize) ;
161 gVirtualX->SetMarkerStyle(markerstyle) ;
163 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
164 gPad->PaintPolyMarker(1,&x,&y,"") ;
167 //____________________________________________________________________________
168 void AliPHOSRecParticle::Print()
170 cout << "AliPHOSRecParticle > " << "type is " << Name() << endl
171 << " " << "Energy = " << fE << endl
172 << " " << "Px = " << fPx << endl
173 << " " << "Py = " << fPy << endl
174 << " " << "Pz = " << fPz << endl ;