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 AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp)
51 fPHOSTrackSegment = new AliPHOSTrackSegment( *( rp.GetPHOSTrackSegment()) ) ;
53 fPdgCode = rp.fPdgCode;
54 fStatusCode = rp.fStatusCode;
55 fMother[0] = rp.fMother[0];
56 fMother[1] = rp.fMother[1];
57 fDaughter[0] = rp.fDaughter[0];
58 fDaughter[1] = rp.fDaughter[1];
60 fCalcMass = rp.fCalcMass;
69 fPolarTheta = rp.fPolarTheta;
70 fPolarPhi = rp.fPolarPhi;
71 fParticlePDG = rp.fParticlePDG;
74 //____________________________________________________________________________
75 AliPHOSRecParticle::~AliPHOSRecParticle()
77 if(!fPHOSTrackSegment) {
78 delete fPHOSTrackSegment ;
79 fPHOSTrackSegment = 0 ;
83 //____________________________________________________________________________
84 Int_t AliPHOSRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
86 // Compute distance from point px,py to a AliPHOSRecParticle considered as a Tmarker
87 // Compute the closest distance of approach from point px,py to this marker.
88 // The distance is computed in pixels units.
90 Double_t kRADDEG = 180. / TMath::Pi() ;
91 Coord_t x = Phi() * kRADDEG ;
92 Coord_t y = Theta() * kRADDEG ;
93 const Int_t kMaxDiff = 10;
94 Int_t pxm = gPad->XtoAbsPixel(x);
95 Int_t pym = gPad->YtoAbsPixel(y);
96 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
98 if (dist > kMaxDiff) return 9999;
102 //___________________________________________________________________________
103 void AliPHOSRecParticle::Draw(Option_t *option)
105 // Draw this AliPHOSRecParticle with its current attributes
110 //______________________________________________________________________________
111 void AliPHOSRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
113 // Execute action corresponding to one event
114 // This member function is called when a AliPHOSRecParticle is clicked with the locator
117 if (!gPad->IsEditable())
120 static TPaveText * clustertext = 0 ;
125 Double_t kRADDEG = 180. / TMath::Pi() ;
126 Coord_t x = Phi() * kRADDEG ;
127 Coord_t y = Theta() * kRADDEG ;
128 clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
131 sprintf( line1, "PID: %s ", (const char*)Name() ) ;
132 sprintf( line2, "ENERGY: %f ", Energy() ) ;
133 clustertext ->AddText(line1) ;
134 clustertext ->AddText(line2) ;
135 clustertext ->Draw("");
150 //____________________________________________________________________________
151 TString AliPHOSRecParticle::Name()
165 name = "CHARGED HADRON" ;
168 name = "NEUTRAL HADRON" ;
171 name = "NEUTRAL EM" ;
174 name = "PHOTON HADRON" ;
181 //______________________________________________________________________________
182 void AliPHOSRecParticle::Paint(Option_t *)
184 // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes
186 Double_t kRADDEG = 180. / TMath::Pi() ;
187 Coord_t x = Phi() * kRADDEG ;
188 Coord_t y = Theta() * kRADDEG ;
189 Color_t markercolor = 1 ;
190 Size_t markersize = 1. ;
191 Style_t markerstyle = 5 ;
193 if (!gPad->IsBatch()) {
194 gVirtualX->SetMarkerColor(markercolor) ;
195 gVirtualX->SetMarkerSize (markersize) ;
196 gVirtualX->SetMarkerStyle(markerstyle) ;
198 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
199 gPad->PaintPolyMarker(1,&x,&y,"") ;
202 //____________________________________________________________________________
203 void AliPHOSRecParticle::Print()
205 cout << "AliPHOSRecParticle > " << "type is " << Name() << endl
206 << " " << "Energy = " << fE << endl
207 << " " << "Px = " << fPx << endl
208 << " " << "Py = " << fPy << endl
209 << " " << "Pz = " << fPz << endl ;