]>
Commit | Line | Data |
---|---|---|
6ad0bfa0 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
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 | **************************************************************************/ | |
15 | ||
16 | //_________________________________________________________________________ | |
17 | // Reconstructed Particle | |
18 | //*-- Y. Schutz: SUBATECH | |
19 | ////////////////////////////////////////////////////////////////////////////// | |
20 | ||
21 | // --- ROOT system --- | |
22 | ||
23 | // --- Standard library --- | |
24 | ||
25 | // --- AliRoot header files --- | |
26 | ||
27 | #include "AliPHOSRecParticle.h" | |
15605d3c | 28 | #include "TPad.h" |
6ad0bfa0 | 29 | |
30 | ClassImp(AliPHOSRecParticle) | |
31 | ||
32 | ||
33 | //____________________________________________________________________________ | |
34 | AliPHOSRecParticle::AliPHOSRecParticle(AliPHOSTrackSegment * ts) | |
35 | { | |
36 | // ctor | |
37 | ||
38 | fPHOSTrackSegment = new AliPHOSTrackSegment(*ts) ; | |
6ad0bfa0 | 39 | fE = ts->GetEnergy() ; |
40 | TVector3 momdir = ts->GetMomentumDirection() ; | |
41 | fPx = fE * momdir.X() ; | |
42 | fPy = fE * momdir.Y() ; | |
43 | fPz = fE * momdir.Z() ; | |
0dd37dda | 44 | fType = kUNDEFINED ; |
45 | ||
6ad0bfa0 | 46 | } |
47 | ||
a73f33f0 | 48 | //____________________________________________________________________________ |
49 | AliPHOSRecParticle::AliPHOSRecParticle(const AliPHOSRecParticle & rp) | |
50 | { | |
51 | fPHOSTrackSegment = new AliPHOSTrackSegment( *( rp.GetPHOSTrackSegment()) ) ; | |
52 | fType = rp.fType ; | |
b1aa729d | 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]; | |
59 | // fWeight = rp.fWeight; | |
60 | // fCalcMass = rp.fCalcMass; | |
61 | // fPx = rp.fPx; | |
62 | // fPy = rp.fPy; | |
63 | // fPz = rp.fPz; | |
64 | // fE = rp.fE; | |
65 | // fVx = rp.fVx; | |
66 | // fVy = rp.fVy; | |
67 | // fVz = rp.fVz; | |
68 | // fVt = rp.fVt; | |
69 | // fPolarTheta = rp.fPolarTheta; | |
70 | // fPolarPhi = rp.fPolarPhi; | |
71 | // fParticlePDG = rp.fParticlePDG; | |
a73f33f0 | 72 | } |
73 | ||
74 | //____________________________________________________________________________ | |
75 | AliPHOSRecParticle::~AliPHOSRecParticle() | |
76 | { | |
77 | if(!fPHOSTrackSegment) { | |
78 | delete fPHOSTrackSegment ; | |
79 | fPHOSTrackSegment = 0 ; | |
80 | } | |
81 | } | |
82 | ||
15605d3c | 83 | //____________________________________________________________________________ |
84 | Int_t AliPHOSRecParticle::DistancetoPrimitive(Int_t px, Int_t py) | |
85 | { | |
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. | |
89 | ||
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); | |
97 | ||
98 | if (dist > kMaxDiff) return 9999; | |
99 | return dist; | |
100 | } | |
101 | ||
102 | //___________________________________________________________________________ | |
103 | void AliPHOSRecParticle::Draw(Option_t *option) | |
104 | { | |
105 | // Draw this AliPHOSRecParticle with its current attributes | |
106 | ||
107 | AppendPad(option); | |
108 | } | |
109 | ||
110 | //______________________________________________________________________________ | |
111 | void AliPHOSRecParticle::ExecuteEvent(Int_t event, Int_t px, Int_t py) | |
112 | { | |
113 | // Execute action corresponding to one event | |
114 | // This member function is called when a AliPHOSRecParticle is clicked with the locator | |
115 | // | |
116 | ||
117 | if (!gPad->IsEditable()) | |
118 | return ; | |
119 | ||
120 | static TPaveText * clustertext = 0 ; | |
121 | ||
122 | switch (event) { | |
123 | ||
124 | case kButton1Down: { | |
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, "") ; | |
129 | Text_t line1[40] ; | |
130 | Text_t line2[40] ; | |
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(""); | |
136 | gPad->Update() ; | |
137 | break ; | |
138 | } | |
139 | ||
140 | case kButton1Up: { | |
141 | delete clustertext ; | |
142 | clustertext = 0 ; | |
143 | gPad->Update() ; | |
144 | break ; | |
145 | } | |
146 | ||
147 | } | |
148 | ||
149 | } | |
6ad0bfa0 | 150 | //____________________________________________________________________________ |
151 | TString AliPHOSRecParticle::Name() | |
152 | { | |
153 | TString name ; | |
154 | switch (fType) { | |
09fc14a0 | 155 | case kGAMMA: |
6ad0bfa0 | 156 | name = "PHOTON" ; |
157 | break ; | |
09fc14a0 | 158 | case kELECTRON: |
6ad0bfa0 | 159 | name = "ELECTRON" ; |
160 | break ; | |
09fc14a0 | 161 | case kNEUTRAL: |
6ad0bfa0 | 162 | name = "NEUTRAL" ; |
163 | break ; | |
92862013 | 164 | case kCHARGEDHADRON: |
6ad0bfa0 | 165 | name = "CHARGED HADRON" ; |
166 | break ; | |
b9bbdad1 | 167 | case kNEUTRALHADRON: |
168 | name = "NEUTRAL HADRON" ; | |
169 | break ; | |
170 | case kNEUTRALEM: | |
171 | name = "NEUTRAL EM" ; | |
09fc14a0 | 172 | break ; |
c1d256cb | 173 | case kGAMMAHADRON: |
174 | name = "PHOTON HADRON" ; | |
175 | break ; | |
176 | ||
6ad0bfa0 | 177 | } |
178 | return name ; | |
179 | } | |
180 | ||
15605d3c | 181 | //______________________________________________________________________________ |
182 | void AliPHOSRecParticle::Paint(Option_t *) | |
183 | { | |
184 | // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes | |
185 | ||
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 ; | |
192 | ||
193 | if (!gPad->IsBatch()) { | |
194 | gVirtualX->SetMarkerColor(markercolor) ; | |
195 | gVirtualX->SetMarkerSize (markersize) ; | |
196 | gVirtualX->SetMarkerStyle(markerstyle) ; | |
197 | } | |
198 | gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ; | |
199 | gPad->PaintPolyMarker(1,&x,&y,"") ; | |
200 | } | |
201 | ||
6ad0bfa0 | 202 | //____________________________________________________________________________ |
203 | void AliPHOSRecParticle::Print() | |
204 | { | |
205 | cout << "AliPHOSRecParticle > " << "type is " << Name() << endl | |
206 | << " " << "Energy = " << fE << endl | |
207 | << " " << "Px = " << fPx << endl | |
208 | << " " << "Py = " << fPy << endl | |
209 | << " " << "Pz = " << fPz << endl ; | |
210 | } |