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 // Track segment in PHOS
20 // Can be : 1 EmcRecPoint
21 // 1 EmcRecPoint + 1 PPSD
22 // 1 EmcRecPoint + 1 PPSD + 1 PPSD
24 //*-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
26 // --- ROOT system ---
31 // --- Standard library ---
35 // --- AliRoot header files ---
37 #include "AliPHOSTrackSegment.h"
38 #include "AliPHOSv0.h"
40 ClassImp(AliPHOSTrackSegment)
42 //____________________________________________________________________________
43 AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , AliPHOSPpsdRecPoint * ppsdRP1,
44 AliPHOSPpsdRecPoint * ppsdRP2 )
59 //____________________________________________________________________________
60 AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
64 ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
68 //____________________________________________________________________________
69 void AliPHOSTrackSegment::Copy(TObject & obj)
71 // Copy of a track segment into another track segment
74 ( (AliPHOSTrackSegment &)obj ).fEmcRecPointId = fEmcRecPointId ;
75 ( (AliPHOSTrackSegment &)obj ).fPpsdLowId = fPpsdLowId ;
76 ( (AliPHOSTrackSegment &)obj ).fPpsdUpId = fPpsdUpId ;
78 //____________________________________________________________________________
79 Int_t AliPHOSTrackSegment::DistancetoPrimitive(Int_t px, Int_t py)
81 // Compute distance from point px,py to a AliPHOSTrackSegment considered as a Tmarker
82 // Compute the closest distance of approach from point px,py to this marker.
83 // The distance is computed in pixels units.
86 TVector3 pos(0.,0.,0.) ;
88 fEmcRecPoint->GetLocalPosition( pos) ;
92 fPpsdLow->GetLocalPosition( pos ) ;
98 fPpsdUp->GetLocalPosition( pos ) ;
106 const Int_t kMaxDiff = 10;
107 Int_t pxm = gPad->XtoAbsPixel(x);
108 Int_t pym = gPad->YtoAbsPixel(y);
109 Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
111 if (dist > kMaxDiff) return 9999;
115 //___________________________________________________________________________
116 void AliPHOSTrackSegment::Draw(Option_t *option)
118 // Draw this AliPHOSTrackSegment with its current attribute
123 //______________________________________________________________________________
124 void AliPHOSTrackSegment::ExecuteEvent(Int_t event, Int_t px, Int_t py)
126 // Execute action corresponding to one event
127 // This member function is called when a AliPHOSTrackSegment is clicked with the locator
129 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
130 // and switched off when the mouse button is released.
132 static TPaveText* textTS = 0 ;
134 if (!gPad->IsEditable())
143 TVector3 pos(0.,0.,0.) ;
144 fEmcRecPoint->GetLocalPosition(pos) ;
145 textTS = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+5,pos.Z()+15,"") ;
147 sprintf(line1,"See RecParticle for ID") ;
148 textTS ->AddText(line1) ;
165 //____________________________________________________________________________
166 Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
168 // Calculates the distance between the EMC RecPoint and PPSD RecPoint
171 fEmcRecPoint->GetLocalPosition(vecEmc) ;
174 if( fPpsdLow->GetMultiplicity() )
175 fPpsdLow->GetLocalPosition(vecPpsd) ;
177 vecPpsd.SetX(10000.) ;
181 Float_t r = vecEmc.Mag();;
186 //____________________________________________________________________________
187 TVector3 AliPHOSTrackSegment::GetMomentumDirection()
189 // Calculates the momentum direction:
190 // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint
191 // 2. if a EMC RecPoint and one PPSD RecPoint, direction is given by the line through the 2 recpoints
192 // 3. if a EMC RecPoint and two PPSD RecPoints, dirrection is given by the average line through
193 // the 2 pairs of recpoints
194 // However because of the poor position resolution of PPSD the direction is always taken as if we were
197 TVector3 dir(0,0,0) ;
201 fEmcRecPoint->GetGlobalPosition(posEmc, mdummy) ;
203 // Correction for the depth of the shower starting point (TDR p 127)
205 Float_t energy = fEmcRecPoint->GetEnergy() ;
206 Float_t para = 0.925 ;
207 Float_t parb = 6.52 ;
210 fEmcRecPoint->GetLocalPosition(localpos) ;
212 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
213 Float_t radius = geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1) ;
214 Float_t incidencephi = TMath::ATan(localpos.X() / radius) ;
215 Float_t incidencetheta = TMath::ATan(localpos.Z() / radius) ;
217 Float_t depthx = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencephi) ;
218 Float_t depthz = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencetheta) ;
220 localpos.SetX(localpos.X() - depthx ) ;
221 localpos.SetZ(localpos.Z() - depthz ) ;
223 TVector3 emcglobalpos ;
226 fEmcRecPoint->GetGlobalPosition(emcglobalpos, dummy) ;
228 emcglobalpos.SetX( emcglobalpos.X() - depthx ) ;
229 emcglobalpos.SetZ( emcglobalpos.Z() - depthz ) ;
231 // The following commeneted code becomes valid once the PPSD provides
232 // a reasonable position resolution, at least as good as EMC !
234 // TVector3 ppsdlglobalpos ;
235 // TVector3 ppsduglobalpos ;
237 // if( fPpsdLow ){ // certainly a photon that has concerted
239 // fPpsdLow->GetGlobalPosition(ppsdlglobalpos, mdummy) ;
240 // dir = emcglobalpos - ppsdlglobalpos ;
242 // if( fPpsdUp ){ // nop looks like a charged
244 // fPpsdUp->GetGlobalPosition(ppsduglobalpos, mdummy) ;
245 // dir = ( dir + emcglobalpos - ppsduglobalpos ) * 0.5 ;
249 // else { // looks like a neutral
254 dir.SetZ( -dir.Z() ) ; // why ?
260 //____________________________________________________________________________
261 Int_t * AliPHOSTrackSegment::GetPrimariesEmc(Int_t & number)
263 // Retrieves the primary particle(s) at the origin of the EMC RecPoint
268 rv = fEmcRecPoint->GetPrimaries(number) ;
273 //____________________________________________________________________________
274 Int_t * AliPHOSTrackSegment::GetPrimariesPpsdLow(Int_t & number)
276 // Retrieves the primary particle(s) at the origin of the lower PPSD RecPoint
281 rv = fPpsdLow->GetPrimaries(number) ;
286 //____________________________________________________________________________
287 Int_t * AliPHOSTrackSegment::GetPrimariesPpsdUp(Int_t & number)
289 // Retrieves the primary particle(s) at the origin of the upper PPSD RecPoint
294 rv = fPpsdUp->GetPrimaries(number) ;
299 //____________________________________________________________________________
300 void AliPHOSTrackSegment::GetPosition( TVector3 & pos )
302 // Returns position of the EMC RecPoint
305 fEmcRecPoint->GetGlobalPosition(pos, dummy) ;
309 //______________________________________________________________________________
310 void AliPHOSTrackSegment::Paint(Option_t *)
312 // Paint this ALiPHOSTrackSegment as a TMarker with its current attributes
314 TVector3 posemc(999., 999., 999.) ;
315 TVector3 posppsdl(999., 999., 999.) ;
316 TVector3 posppsdu(999., 999., 999.) ;
318 fEmcRecPoint->GetLocalPosition(posemc) ;
320 fPpsdLow->GetLocalPosition(posppsdl) ;
322 fPpsdUp->GetLocalPosition(posppsdu) ;
324 Coord_t xemc = posemc.X() ;
325 Coord_t yemc = posemc.Z() ;
327 Coord_t yppsdl = posppsdl.Z() ;
328 Coord_t xppsdl = posppsdl.X() ;
330 Coord_t yppsdu = posppsdu.Z() ;
331 Coord_t xppsdu = posppsdu.X() ;
333 Color_t markercolor = 1 ;
334 Size_t markersize = 1.5 ;
335 Style_t markerstyle = 20 ;
337 if (!gPad->IsBatch()) {
338 gVirtualX->SetMarkerColor(markercolor) ;
339 gVirtualX->SetMarkerSize (markersize) ;
340 gVirtualX->SetMarkerStyle(markerstyle) ;
342 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
343 gPad->PaintPolyMarker(1, &xemc, &yemc, "") ;
345 if (xppsdl != 999. && yppsdl != 999. ) {
351 if (!gPad->IsBatch()) {
352 gVirtualX->SetMarkerColor(markercolor) ;
353 gVirtualX->SetMarkerSize (markersize) ;
354 gVirtualX->SetMarkerStyle(markerstyle) ;
356 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
357 gPad->PaintPolyMarker(1, &xppsdl, &yppsdl, "") ;
360 if (xppsdu != 999. && yppsdu != 999. ) {
366 if (!gPad->IsBatch()) {
367 gVirtualX->SetMarkerColor(markercolor) ;
368 gVirtualX->SetMarkerSize (markersize) ;
369 gVirtualX->SetMarkerStyle(markerstyle) ;
371 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
372 gPad->PaintPolyMarker(1, &xppsdu, &yppsdu, "") ;
376 //____________________________________________________________________________
377 void AliPHOSTrackSegment::Print()
379 // Print all information on this track Segment
381 cout << "--------AliPHOSTrackSegment-------- "<<endl ;
382 cout << "EMC Reconstructed Point: " << fEmcRecPoint << endl;
387 fEmcRecPoint->GetGlobalPosition( pos, dummy ) ;
389 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << fEmcRecPoint->GetTotalEnergy() << endl ;
390 cout << "PPSD Low Reconstructed Point: " << endl;
393 fPpsdLow->GetGlobalPosition( pos , dummy ) ;
394 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
397 cout << "PPSD Up Reconstructed Point: " << endl;
400 fPpsdUp->GetGlobalPosition( pos, dummy ) ;
401 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;