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;
95 //____________________________________________________________________________
96 Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
98 // Compute distance from point px,py to a AliPHOSFastRecParticle considered as a Tmarker
99 // Compute the closest distance of approach from point px,py to this marker.
100 // The distance is computed in pixels units.
102 Double_t kRADDEG = 180. / TMath::Pi() ;
103 Coord_t x = Phi() * kRADDEG ;
104 Coord_t y = Theta() * kRADDEG ;
105 const Int_t kMaxDiff = 10;
106 Int_t pxm = gPad->XtoAbsPixel(x);
107 Int_t pym = gPad->YtoAbsPixel(y);
108 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
110 if (dist > kMaxDiff) return 9999;
114 //___________________________________________________________________________
115 void AliPHOSFastRecParticle::Draw(Option_t *option)
117 // Draw this AliPHOSFastRecParticle with its current attributes
122 //______________________________________________________________________________
123 void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
125 // Execute action corresponding to one event
126 // This member function is called when a AliPHOSFastRecParticle is clicked with the locator
128 if (!gPad->IsEditable())
131 static TPaveText * clustertext = 0 ;
136 Double_t kRADDEG = 180. / TMath::Pi() ;
137 Coord_t x = Phi() * kRADDEG ;
138 Coord_t y = Theta() * kRADDEG ;
139 clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
142 sprintf( line1, "PID: %s ", (const char*)Name() ) ;
143 sprintf( line2, "ENERGY: %f ", Energy() ) ;
144 clustertext ->AddText(line1) ;
145 clustertext ->AddText(line2) ;
146 clustertext ->Draw("");
162 //____________________________________________________________________________
163 TString AliPHOSFastRecParticle::Name()
165 // Returns the name of the particle type
176 name = "CHARGED_HA" ;
179 name = "NEUTRAL_HA" ;
182 name = "NEUTRAL_EM" ;
192 //______________________________________________________________________________
193 void AliPHOSFastRecParticle::Paint(Option_t *)
195 // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes
197 Double_t kRADDEG = 180. / TMath::Pi() ;
198 Coord_t x = Phi() * kRADDEG ;
199 Coord_t y = Theta() * kRADDEG ;
200 Color_t markercolor = 1 ;
201 Size_t markersize = 1. ;
202 Style_t markerstyle = 5 ;
204 if (!gPad->IsBatch()) {
205 gVirtualX->SetMarkerColor(markercolor) ;
206 gVirtualX->SetMarkerSize (markersize) ;
207 gVirtualX->SetMarkerStyle(markerstyle) ;
209 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
210 gPad->PaintPolyMarker(1,&x,&y,"") ;
213 //____________________________________________________________________________
214 void AliPHOSFastRecParticle::Print(const char * opt)
216 // Print the typr, energy and momentum
218 cout << "AliPHOSFastRecParticle > " << "type is " << Name() << endl
219 << " " << "Energy = " << fE << endl
220 << " " << "Px = " << fPx << endl
221 << " " << "Py = " << fPy << endl
222 << " " << "Pz = " << fPz << endl ;