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 // class of PHOS Sub Track
18 //*-- Author : Dmitri Peressounko RRC KI
19 //////////////////////////////////////////////////////////////////////////////
21 // --- ROOT system ---
26 // --- Standard library ---
30 // --- AliRoot header files ---
32 #include "AliPHOSTrackSegment.h"
33 #include "AliPHOSv0.h"
35 ClassImp(AliPHOSTrackSegment)
37 //____________________________________________________________________________
38 AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , AliPHOSPpsdRecPoint * ppsdRP1,
39 AliPHOSPpsdRecPoint * ppsdRP2 )
52 //____________________________________________________________________________
53 AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
55 ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
58 //____________________________________________________________________________
59 AliPHOSTrackSegment::~AliPHOSTrackSegment() // dtor
61 // fEmcRecPoint.Delete() ; Not Owners !!!
63 // fPpsdLow.Delete() ;
66 //____________________________________________________________________________
67 void AliPHOSTrackSegment::Copy(TObject & obj)
70 ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ;
71 ( (AliPHOSTrackSegment &)obj ).fPpsdLow = fPpsdLow ;
72 ( (AliPHOSTrackSegment &)obj ).fPpsdUp = fPpsdUp ;
74 //____________________________________________________________________________
75 Int_t AliPHOSTrackSegment::DistancetoPrimitive(Int_t px, Int_t py)
77 //Compute distance from point px,py to a AliPHOSTrackSegment considered as a Tmarker
78 // Compute the closest distance of approach from point px,py to this marker.
79 // The distance is computed in pixels units.
82 TVector3 pos(0.,0.,0.) ;
84 fEmcRecPoint->GetLocalPosition( pos) ;
88 fPpsdLow->GetLocalPosition( pos ) ;
94 fPpsdUp->GetLocalPosition( pos ) ;
102 const Int_t kMaxDiff = 10;
103 Int_t pxm = gPad->XtoAbsPixel(x);
104 Int_t pym = gPad->YtoAbsPixel(y);
105 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
107 if (dist > kMaxDiff) return 9999;
111 //___________________________________________________________________________
112 void AliPHOSTrackSegment::Draw(Option_t *option)
114 // Draw this AliPHOSTrackSegment with its current attribute
119 //______________________________________________________________________________
120 void AliPHOSTrackSegment::ExecuteEvent(Int_t event, Int_t px, Int_t py)
122 // Execute action corresponding to one event
123 // This member function is called when a AliPHOSTrackSegment is clicked with the locator
125 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
126 // and switched off when the mouse button is released.
128 static TPaveText* textTS = 0 ;
130 if (!gPad->IsEditable())
139 TVector3 pos(0.,0.,0.) ;
140 fEmcRecPoint->GetLocalPosition(pos) ;
141 textTS = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+5,pos.Z()+15,"") ;
143 sprintf(line1,"See RecParticle for ID") ;
144 textTS ->AddText(line1) ;
162 //____________________________________________________________________________
163 Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
167 fEmcRecPoint->GetLocalPosition(vecEmc) ;
170 if( fPpsdLow->GetMultiplicity() )
171 fPpsdLow->GetLocalPosition(vecPpsd) ;
173 vecPpsd.SetX(10000.) ;
177 Float_t r = vecEmc.Mag();;
182 //____________________________________________________________________________
183 TVector3 AliPHOSTrackSegment::GetMomentumDirection()
185 TVector3 dir, tempo ;
189 fEmcRecPoint->GetGlobalPosition(posEmc, mdummy) ;
191 // need to correct here for the depth of the shower start point (TDR p 127) ?
193 Float_t energy = fEmcRecPoint->GetEnergy() ;
194 Float_t para = 0.925 ;
195 Float_t parb = 6.52 ;
198 fEmcRecPoint->GetLocalPosition(localpos) ;
200 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
201 Float_t radius = geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1) ;
202 Float_t incidencephi = TMath::ATan(localpos.X() / radius) ;
203 Float_t incidencetheta = TMath::ATan(localpos.Z() / radius) ;
205 Float_t depthx = - ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencephi) ;
206 Float_t depthz = - ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencetheta) ;
212 // fPpsdLow->GetGlobalPosition(posPpsdl, mdummy) ;
213 // if( !fPpsdUp ) { // draw line trough 2 points
214 // tempo = posEmc - posPpsdl;
217 // else { // draw line through 3 points
218 // fPpsdUp->GetGlobalPosition(posPpsdup, mdummy) ;
219 // posPpsdl = 0.5 * ( posPpsdup + posPpsdl ) ;
220 // dir = posEmc - posPpsdl ;
226 dir.SetX( tempo.X() + depthx ) ; // assumes that a neutral comes from the vertex
227 dir.SetY( tempo.Y() ) ;
228 dir.SetZ( -tempo.Z() - depthz ) ;
235 //____________________________________________________________________________
236 void AliPHOSTrackSegment::GetPosition( TVector3 & pos )
238 // Returns positions of hits
240 fEmcRecPoint->GetGlobalPosition(pos, dummy) ;
243 //______________________________________________________________________________
244 void AliPHOSTrackSegment::Paint(Option_t *)
246 //Paint this ALiPHOSTrackSegment as a TMarker with its current attributes
248 TVector3 posemc(999., 999., 999.) ;
249 TVector3 posppsdl(999., 999., 999.) ;
250 TVector3 posppsdu(999., 999., 999.) ;
252 fEmcRecPoint->GetLocalPosition(posemc) ;
254 fPpsdLow->GetLocalPosition(posppsdl) ;
256 fPpsdUp->GetLocalPosition(posppsdu) ;
258 Coord_t xemc = posemc.X() ;
259 Coord_t yemc = posemc.Z() ;
261 Coord_t yppsdl = posppsdl.Z() ;
262 Coord_t xppsdl = posppsdl.X() ;
264 Coord_t yppsdu = posppsdu.Z() ;
265 Coord_t xppsdu = posppsdu.X() ;
267 Color_t markercolor = 1 ;
268 Size_t markersize = 1.5 ;
269 Style_t markerstyle = 20 ;
271 if (!gPad->IsBatch()) {
272 gVirtualX->SetMarkerColor(markercolor) ;
273 gVirtualX->SetMarkerSize (markersize) ;
274 gVirtualX->SetMarkerStyle(markerstyle) ;
276 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
277 gPad->PaintPolyMarker(1, &xemc, &yemc, "") ;
279 if (xppsdl != 999. && yppsdl != 999. ) {
285 if (!gPad->IsBatch()) {
286 gVirtualX->SetMarkerColor(markercolor) ;
287 gVirtualX->SetMarkerSize (markersize) ;
288 gVirtualX->SetMarkerStyle(markerstyle) ;
290 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
291 gPad->PaintPolyMarker(1, &xppsdl, &yppsdl, "") ;
294 if (xppsdu != 999. && yppsdu != 999. ) {
300 if (!gPad->IsBatch()) {
301 gVirtualX->SetMarkerColor(markercolor) ;
302 gVirtualX->SetMarkerSize (markersize) ;
303 gVirtualX->SetMarkerStyle(markerstyle) ;
305 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
306 gPad->PaintPolyMarker(1, &xppsdu, &yppsdu, "") ;
311 //____________________________________________________________________________
312 void AliPHOSTrackSegment::Print()
314 cout << "--------AliPHOSTrackSegment-------- "<<endl ;
315 cout << "EMC Reconstructed Point: " << fEmcRecPoint << endl;
320 fEmcRecPoint->GetGlobalPosition( pos, dummy ) ;
322 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << fEmcRecPoint->GetTotalEnergy() << endl ;
323 cout << "PPSD Low Reconstructed Point: " << endl;
326 fPpsdLow->GetGlobalPosition( pos , dummy ) ;
327 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
330 cout << "PPSD Up Reconstructed Point: " << endl;
333 fPpsdUp->GetGlobalPosition( pos, dummy ) ;
334 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;