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() : TParticle()
45 //____________________________________________________________________________
46 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const AliPHOSFastRecParticle & rp)
51 fPdgCode = rp.fPdgCode;
52 fStatusCode = rp.fStatusCode;
53 fMother[0] = rp.fMother[0];
54 fMother[1] = rp.fMother[1];
55 fDaughter[0] = rp.fDaughter[0];
56 fDaughter[1] = rp.fDaughter[1];
58 fCalcMass = rp.fCalcMass;
67 fPolarTheta = rp.fPolarTheta;
68 fPolarPhi = rp.fPolarPhi;
69 fParticlePDG = rp.fParticlePDG;
72 //____________________________________________________________________________
73 AliPHOSFastRecParticle::AliPHOSFastRecParticle(const TParticle & pp)
75 // ctor from a TParticle (crummy?!)
77 TParticle & pnoconst = (TParticle &)(pp) ;
78 AliPHOSFastRecParticle & p = (AliPHOSFastRecParticle &)(pnoconst) ;
80 fPdgCode = p.fPdgCode;
81 fStatusCode = p.fStatusCode;
82 fMother[0] = p.fMother[0];
83 fMother[1] = p.fMother[1];
84 fDaughter[0] = p.fDaughter[0];
85 fDaughter[1] = p.fDaughter[1];
87 fCalcMass = p.fCalcMass;
96 fPolarTheta = p.fPolarTheta;
97 fPolarPhi = p.fPolarPhi;
98 fParticlePDG = p.fParticlePDG;
102 //____________________________________________________________________________
103 Int_t AliPHOSFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py)
105 // Compute distance from point px,py to a AliPHOSFastRecParticle considered as a Tmarker
106 // Compute the closest distance of approach from point px,py to this marker.
107 // The distance is computed in pixels units.
109 Double_t kRADDEG = 180. / TMath::Pi() ;
110 Coord_t x = Phi() * kRADDEG ;
111 Coord_t y = Theta() * kRADDEG ;
112 const Int_t kMaxDiff = 10;
113 Int_t pxm = gPad->XtoAbsPixel(x);
114 Int_t pym = gPad->YtoAbsPixel(y);
115 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
117 if (dist > kMaxDiff) return 9999;
121 //___________________________________________________________________________
122 void AliPHOSFastRecParticle::Draw(Option_t *option)
124 // Draw this AliPHOSFastRecParticle with its current attributes
129 //______________________________________________________________________________
130 void AliPHOSFastRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py)
132 // Execute action corresponding to one event
133 // This member function is called when a AliPHOSFastRecParticle is clicked with the locator
135 if (!gPad->IsEditable())
138 static TPaveText * clustertext = 0 ;
143 Double_t kRADDEG = 180. / TMath::Pi() ;
144 Coord_t x = Phi() * kRADDEG ;
145 Coord_t y = Theta() * kRADDEG ;
146 clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ;
149 sprintf( line1, "PID: %s ", (const char*)Name() ) ;
150 sprintf( line2, "ENERGY: %f ", Energy() ) ;
151 clustertext ->AddText(line1) ;
152 clustertext ->AddText(line2) ;
153 clustertext ->Draw("");
166 // Bool_t GetPhotonHiPu_LoEf() {
167 // Bool_t pid=kFALSE ;
168 // if((TestPIDBit(9)==kTRUE)&&(TestPIDBit(8)==kTRUE)&&(TestPIDBit(7)==kTRUE)) pid = kTRUE;
171 // Bool_t GetPhotonMed_Pu_Ef() {
172 // Bool_t pid=kFALSE ;
173 // if((TestPIDBit(8))&&(TestPIDBit(7))) pid = kTRUE ;
176 // Bool_t GetPhotonHiEf_LoPu() {
177 // Bool_t pid=kFALSE ;
178 // if(TestPIDBit(7)) pid = kTRUE ;
181 //____________________________________________________________________________
182 TString AliPHOSFastRecParticle::Name()
184 // Returns the name of the particle type
195 name = "CHARGED_HA_FAST" ;
198 name = "NEUTRAL_HA_SLOW" ;
201 name = "NEUTRAL_EM_SLOW" ;
204 name = "NEUTRAL_HA_FAST" ;
211 //______________________________________________________________________________
212 void AliPHOSFastRecParticle::Paint(Option_t *)
214 // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes
216 Double_t kRADDEG = 180. / TMath::Pi() ;
217 Coord_t x = Phi() * kRADDEG ;
218 Coord_t y = Theta() * kRADDEG ;
219 Color_t markercolor = 1 ;
220 Size_t markersize = 1. ;
221 Style_t markerstyle = 5 ;
223 if (!gPad->IsBatch()) {
224 gVirtualX->SetMarkerColor(markercolor) ;
225 gVirtualX->SetMarkerSize (markersize) ;
226 gVirtualX->SetMarkerStyle(markerstyle) ;
228 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
229 gPad->PaintPolyMarker(1,&x,&y,"") ;
232 //____________________________________________________________________________
233 void AliPHOSFastRecParticle::Print(const char * opt)
235 // Print the type, energy and momentum of the reconstructed particle
237 cout << "AliPHOSFastRecParticle > " << "type is " << Name() << endl
238 << " " << "Energy = " << fE << endl
239 << " " << "Px = " << fPx << endl
240 << " " << "Py = " << fPy << endl
241 << " " << "Pz = " << fPz << endl ;