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 **************************************************************************/
18 //_________________________________________________________________________
19 // A Particle modified by PHOS response and produced by AliPHOSvFast
20 // To become a general class of AliRoot ?
22 //*-- Author: Yves Schutz (SUBATECH)
24 // --- ROOT system ---
26 // --- Standard library ---
30 // --- AliRoot header files ---
32 #include "AliPHOSFastRecParticle.h"
34 #include "TPaveText.h"
36 ClassImp(AliPHOSFastRecParticle) ;
38 //____________________________________________________________________________
39 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const AliPHOSFastRecParticle & rp)
44 fPdgCode = rp.fPdgCode;
45 fStatusCode = rp.fStatusCode;
46 fMother[0] = rp.fMother[0];
47 fMother[1] = rp.fMother[1];
48 fDaughter[0] = rp.fDaughter[0];
49 fDaughter[1] = rp.fDaughter[1];
51 fCalcMass = rp.fCalcMass;
60 fPolarTheta = rp.fPolarTheta;
61 fPolarPhi = rp.fPolarPhi;
62 fParticlePDG = rp.fParticlePDG;
65 //____________________________________________________________________________
66 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp)
68 // ctor from a TParticle (crummy?!)
70 TParticle & pnoconst = (TParticle &)(pp) ;
71 AliPHOSFastRecParticle & p = (AliPHOSFastRecParticle &)(pnoconst) ;
73 fPdgCode = p.fPdgCode;
74 fStatusCode = p.fStatusCode;
75 fMother[0] = p.fMother[0];
76 fMother[1] = p.fMother[1];
77 fDaughter[0] = p.fDaughter[0];
78 fDaughter[1] = p.fDaughter[1];
80 fCalcMass = p.fCalcMass;
89 fPolarTheta = p.fPolarTheta;
90 fPolarPhi = p.fPolarPhi;
91 fParticlePDG = p.fParticlePDG;
94 //____________________________________________________________________________
95 Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
97 // Compute distance from point px,py to a AliPHOSFastRecParticle considered as a Tmarker
98 // Compute the closest distance of approach from point px,py to this marker.
99 // The distance is computed in pixels units.
101 Double_t kRADDEG = 180. / TMath::Pi() ;
102 Coord_t x = Phi() * kRADDEG ;
103 Coord_t y = Theta() * kRADDEG ;
104 const Int_t kMaxDiff = 10;
105 Int_t pxm = gPad->XtoAbsPixel(x);
106 Int_t pym = gPad->YtoAbsPixel(y);
107 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
109 if (dist > kMaxDiff) return 9999;
113 //___________________________________________________________________________
114 void AliPHOSFastRecParticle::Draw(Option_t *option)
116 // Draw this AliPHOSFastRecParticle with its current attributes
121 //______________________________________________________________________________
122 void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
124 // Execute action corresponding to one event
125 // This member function is called when a AliPHOSFastRecParticle is clicked with the locator
127 if (!gPad->IsEditable())
130 static TPaveText * clustertext = 0 ;
135 Double_t kRADDEG = 180. / TMath::Pi() ;
136 Coord_t x = Phi() * kRADDEG ;
137 Coord_t y = Theta() * kRADDEG ;
138 clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
141 sprintf( line1, "PID: %s ", (const char*)Name() ) ;
142 sprintf( line2, "ENERGY: %f ", Energy() ) ;
143 clustertext ->AddText(line1) ;
144 clustertext ->AddText(line2) ;
145 clustertext ->Draw("");
161 //____________________________________________________________________________
162 Int_t * AliPHOSFastRecParticle::GetPrimaries(Int_t & number)
164 // Retrieves the unique primary particle at the origine of the present reconstruced particle
167 Int_t * list = new Int_t[1] ;
173 //____________________________________________________________________________
174 TString AliPHOSFastRecParticle::Name()
176 // Returns the name of the particle type
187 name = "CHARGED_HA" ;
190 name = "NEUTRAL_HA" ;
193 name = "NEUTRAL_EM" ;
203 //______________________________________________________________________________
204 void AliPHOSFastRecParticle::Paint(Option_t *)
206 // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes
208 Double_t kRADDEG = 180. / TMath::Pi() ;
209 Coord_t x = Phi() * kRADDEG ;
210 Coord_t y = Theta() * kRADDEG ;
211 Color_t markercolor = 1 ;
212 Size_t markersize = 1. ;
213 Style_t markerstyle = 5 ;
215 if (!gPad->IsBatch()) {
216 gVirtualX->SetMarkerColor(markercolor) ;
217 gVirtualX->SetMarkerSize (markersize) ;
218 gVirtualX->SetMarkerStyle(markerstyle) ;
220 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
221 gPad->PaintPolyMarker(1,&x,&y,"") ;
224 //____________________________________________________________________________
225 void AliPHOSFastRecParticle::Print()
227 // Print the typr, energy and momentum
229 cout << "AliPHOSFastRecParticle > " << "type is " << Name() << endl
230 << " " << "Energy = " << fE << endl
231 << " " << "Px = " << fPx << endl
232 << " " << "Py = " << fPy << endl
233 << " " << "Pz = " << fPz << endl ;