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 )
50 fCutOnDispersion = 1.5 ;
53 //____________________________________________________________________________
54 AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
56 ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
59 //____________________________________________________________________________
60 AliPHOSTrackSegment::~AliPHOSTrackSegment() // dtor
62 // fEmcRecPoint.Delete() ; Not Owners !!!
64 // fPpsdLow.Delete() ;
67 //____________________________________________________________________________
68 void AliPHOSTrackSegment::Copy(TObject & obj)
71 ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ;
72 ( (AliPHOSTrackSegment &)obj ).fPpsdLow = fPpsdLow ;
73 ( (AliPHOSTrackSegment &)obj ).fPpsdUp = fPpsdUp ;
75 //____________________________________________________________________________
76 Int_t AliPHOSTrackSegment::DistancetoPrimitive(Int_t px, Int_t py)
78 //Compute distance from point px,py to a AliPHOSTrackSegment considered as a Tmarker
79 // Compute the closest distance of approach from point px,py to this marker.
80 // The distance is computed in pixels units.
83 TVector3 pos(0.,0.,0.) ;
85 fEmcRecPoint->GetLocalPosition( pos) ;
89 fPpsdLow->GetLocalPosition( pos ) ;
95 fPpsdUp->GetLocalPosition( pos ) ;
103 const Int_t kMaxDiff = 10;
104 Int_t pxm = gPad->XtoAbsPixel(x);
105 Int_t pym = gPad->YtoAbsPixel(y);
106 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
108 if (dist > kMaxDiff) return 9999;
112 //___________________________________________________________________________
113 void AliPHOSTrackSegment::Draw(Option_t *option)
115 // Draw this AliPHOSTrackSegment with its current attribute
120 //______________________________________________________________________________
121 void AliPHOSTrackSegment::ExecuteEvent(Int_t event, Int_t px, Int_t py)
123 // Execute action corresponding to one event
124 // This member function is called when a AliPHOSTrackSegment is clicked with the locator
126 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
127 // and switched off when the mouse button is released.
129 static TPaveText* textTS = 0 ;
131 if (!gPad->IsEditable())
140 TVector3 pos(0.,0.,0.) ;
141 fEmcRecPoint->GetLocalPosition(pos) ;
142 textTS = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+5,pos.Z()+15,"") ;
144 if (GetPartType() == kGAMMA )
145 sprintf(line1,"PHOTON") ;
146 if (GetPartType() == kELECTRON )
147 sprintf(line1,"ELECTRON") ;
148 if (GetPartType() == kNEUTRAL )
149 sprintf(line1,"NEUTRAL") ;
150 if (GetPartType() == kCHARGEDHADRON )
151 sprintf(line1,"CHARGED HADRON") ;
153 textTS ->AddText(line1) ;
171 //____________________________________________________________________________
172 Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
176 fEmcRecPoint->GetLocalPosition(vecEmc) ;
179 if( fPpsdLow->GetMultiplicity() )
180 fPpsdLow->GetLocalPosition(vecPpsd) ;
182 vecPpsd.SetX(10000.) ;
186 Float_t r = vecEmc.Mag();;
191 //____________________________________________________________________________
192 TVector3 AliPHOSTrackSegment::GetMomentumDirection()
194 TVector3 dir, tempo ;
198 fEmcRecPoint->GetGlobalPosition(posEmc, mdummy) ;
204 // fPpsdLow->GetGlobalPosition(posPpsdl, mdummy) ;
205 // if( !fPpsdUp ) { // draw line trough 2 points
206 // tempo = posEmc - posPpsdl;
209 // else { // draw line through 3 points
210 // fPpsdUp->GetGlobalPosition(posPpsdup, mdummy) ;
211 // posPpsdl = 0.5 * ( posPpsdup + posPpsdl ) ;
212 // dir = posEmc - posPpsdl ;
218 dir.SetX( tempo.X() ) ; // assumes that a neutral comes from the vertex
219 dir.SetY( tempo.Y() ) ;
220 dir.SetZ( -tempo.Z() ) ;
226 //____________________________________________________________________________
227 Int_t AliPHOSTrackSegment::GetPartType()
232 // 3 - charged hadron
234 Int_t typeofparticle = kGAMMA ;
236 if( fPpsdUp == 0 ) { // Neutral
238 if( fPpsdLow == 0 ) // Neutral
239 typeofparticle = kNEUTRAL ;
241 typeofparticle = kGAMMA ;
247 if( fEmcRecPoint->GetDispersion() > fCutOnDispersion)
248 typeofparticle = kCHARGEDHADRON ;
250 typeofparticle = kELECTRON ;
254 return typeofparticle ;
258 //____________________________________________________________________________
259 void AliPHOSTrackSegment::GetPosition( TVector3 & pos )
261 // Returns positions of hits
263 fEmcRecPoint->GetGlobalPosition(pos, dummy) ;
266 //______________________________________________________________________________
267 void AliPHOSTrackSegment::Paint(Option_t *)
269 //Paint this ALiPHOSTrackSegment as a TMarker with its current attributes
271 TVector3 posemc(999., 999., 999.) ;
272 TVector3 posppsdl(999., 999., 999.) ;
273 TVector3 posppsdu(999., 999., 999.) ;
275 fEmcRecPoint->GetLocalPosition(posemc) ;
277 fPpsdLow->GetLocalPosition(posppsdl) ;
279 fPpsdUp->GetLocalPosition(posppsdu) ;
281 Coord_t xemc = posemc.X() ;
282 Coord_t yemc = posemc.Z() ;
284 Coord_t yppsdl = posppsdl.Z() ;
285 Coord_t xppsdl = posppsdl.X() ;
287 Coord_t yppsdu = posppsdu.Z() ;
288 Coord_t xppsdu = posppsdu.X() ;
290 Color_t markercolor = 1 ;
291 Size_t markersize = 1.5 ;
292 Style_t markerstyle = 20 ;
294 if (!gPad->IsBatch()) {
295 gVirtualX->SetMarkerColor(markercolor) ;
296 gVirtualX->SetMarkerSize (markersize) ;
297 gVirtualX->SetMarkerStyle(markerstyle) ;
299 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
300 gPad->PaintPolyMarker(1, &xemc, &yemc, "") ;
302 if (xppsdl != 999. && yppsdl != 999. ) {
308 if (!gPad->IsBatch()) {
309 gVirtualX->SetMarkerColor(markercolor) ;
310 gVirtualX->SetMarkerSize (markersize) ;
311 gVirtualX->SetMarkerStyle(markerstyle) ;
313 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
314 gPad->PaintPolyMarker(1, &xppsdl, &yppsdl, "") ;
317 if (xppsdu != 999. && yppsdu != 999. ) {
323 if (!gPad->IsBatch()) {
324 gVirtualX->SetMarkerColor(markercolor) ;
325 gVirtualX->SetMarkerSize (markersize) ;
326 gVirtualX->SetMarkerStyle(markerstyle) ;
328 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
329 gPad->PaintPolyMarker(1, &xppsdu, &yppsdu, "") ;
334 //____________________________________________________________________________
335 void AliPHOSTrackSegment::Print()
337 cout << "--------AliPHOSTrackSegment-------- "<<endl ;
338 cout << "EMC Reconstructed Point: " << fEmcRecPoint << endl;
343 fEmcRecPoint->GetGlobalPosition( pos, dummy ) ;
345 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << fEmcRecPoint->GetTotalEnergy() << endl ;
346 cout << "PPSD Low Reconstructed Point: " << endl;
349 fPpsdLow->GetGlobalPosition( pos , dummy ) ;
350 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
353 cout << "PPSD Up Reconstructed Point: " << endl;
356 fPpsdUp->GetGlobalPosition( pos, dummy ) ;
357 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;