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 // Track segment in PHOS
18 // Can be : 1 EmcRecPoint
19 // 1 EmcRecPoint + 1 PPSD
20 // 1 EmcRecPoint + 1 PPSD + 1 PPSD
22 //*-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
24 // --- ROOT system ---
29 // --- Standard library ---
33 // --- AliRoot header files ---
35 #include "AliPHOSTrackSegment.h"
36 #include "AliPHOSv0.h"
37 #include "AliPHOSIndexToObject.h"
39 ClassImp(AliPHOSTrackSegment)
41 //____________________________________________________________________________
42 AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
43 AliPHOSPpsdRecPoint * ppsdrp1,
44 AliPHOSPpsdRecPoint * ppsdrp2 )
49 fEmcRecPoint = emc->GetIndexInList() ;
54 fPpsdUpRecPoint = ppsdrp1->GetIndexInList() ;
56 fPpsdUpRecPoint = -1 ;
59 fPpsdLowRecPoint = ppsdrp2->GetIndexInList() ;
61 fPpsdLowRecPoint = -1 ;
66 //____________________________________________________________________________
67 AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
71 ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
75 //____________________________________________________________________________
76 void AliPHOSTrackSegment::Copy(TObject & obj)
78 // Copy of a track segment into another track segment
81 ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ;
82 ( (AliPHOSTrackSegment &)obj ).fPpsdLowRecPoint = fPpsdLowRecPoint ;
83 ( (AliPHOSTrackSegment &)obj ).fPpsdUpRecPoint = fPpsdUpRecPoint ;
84 ( (AliPHOSTrackSegment &)obj ).fIndexInList = fIndexInList ;
86 //____________________________________________________________________________
87 Int_t AliPHOSTrackSegment::DistancetoPrimitive(Int_t px, Int_t py)
89 // Compute distance from point px,py to a AliPHOSTrackSegment considered as a Tmarker
90 // Compute the closest distance of approach from point px,py to this marker.
91 // The distance is computed in pixels units.
96 TVector3 pos(0.,0.,0.) ;
98 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
99 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
100 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
103 emcrp->GetLocalPosition( pos) ;
104 Float_t x = pos.X() ;
105 Float_t y = pos.Z() ;
106 if ( ppsdlrp != 0 ) {
107 ppsdlrp->GetLocalPosition( pos ) ;
112 if ( ppsdurp != 0 ) {
113 ppsdurp->GetLocalPosition( pos ) ;
121 const Int_t kMaxDiff = 10;
122 Int_t pxm = gPad->XtoAbsPixel(x);
123 Int_t pym = gPad->YtoAbsPixel(y);
124 dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
126 if (dist > kMaxDiff) return 9999;
131 //___________________________________________________________________________
132 void AliPHOSTrackSegment::Draw(Option_t *option)
134 // Draw this AliPHOSTrackSegment with its current attribute
139 //______________________________________________________________________________
140 void AliPHOSTrackSegment::ExecuteEvent(Int_t event, Int_t px, Int_t py)
142 // Execute action corresponding to one event
143 // This member function is called when a AliPHOSTrackSegment is clicked with the locator
145 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
146 // and switched off when the mouse button is released.
148 static TPaveText* textTS = 0 ;
150 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
152 if (!gPad->IsEditable())
161 TVector3 pos(0.,0.,0.) ;
162 emcrp->GetLocalPosition(pos) ;
163 textTS = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+5,pos.Z()+15,"") ;
165 sprintf(line1,"See RecParticle for ID") ;
166 textTS ->AddText(line1) ;
183 //____________________________________________________________________________
184 Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
186 // Calculates the distance between the EMC RecPoint and PPSD RecPoint
188 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
189 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
192 emcrp->GetLocalPosition(vecEmc) ;
196 if( ppsdlrp->GetMultiplicity() )
197 ppsdlrp->GetLocalPosition(vecPpsd) ;
199 vecPpsd.SetX(10000.) ;
203 Float_t r = vecEmc.Mag();;
208 //____________________________________________________________________________
209 AliPHOSEmcRecPoint * AliPHOSTrackSegment::GetEmcRecPoint() const
211 // get the EMC recpoint at the origin of this track
213 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
214 AliPHOSEmcRecPoint * rv = 0 ;
215 if ( fEmcRecPoint > -1 )
216 rv = (AliPHOSEmcRecPoint *)please->GimeRecPoint( fEmcRecPoint, TString("emc") );
222 //____________________________________________________________________________
223 Float_t AliPHOSTrackSegment::GetEnergy()
225 // Returns energy in EMC
227 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
229 return emcrp->GetTotalEnergy() ;
232 //____________________________________________________________________________
233 TVector3 AliPHOSTrackSegment::GetMomentumDirection()
235 // Calculates the momentum direction:
236 // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint
237 // 2. if a EMC RecPoint and one PPSD RecPoint, direction is given by the line through the 2 recpoints
238 // 3. if a EMC RecPoint and two PPSD RecPoints, dirrection is given by the average line through
239 // the 2 pairs of recpoints
240 // However because of the poor position resolution of PPSD the direction is always taken as if we were
244 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
245 // AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
246 // AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
248 TVector3 dir(0,0,0) ;
252 emcrp->GetGlobalPosition(posEmc, mdummy) ;
254 // Correction for the depth of the shower starting point (TDR p 127)
256 Float_t energy = emcrp->GetEnergy() ;
257 Float_t para = 0.925 ;
258 Float_t parb = 6.52 ;
261 emcrp->GetLocalPosition(localpos) ;
263 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
264 Float_t radius = geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1) ;
265 Float_t incidencephi = TMath::ATan(localpos.X() / radius) ;
266 Float_t incidencetheta = TMath::ATan(localpos.Z() / radius) ;
268 Float_t depthx = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencephi) ;
269 Float_t depthz = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencetheta) ;
271 localpos.SetX(localpos.X() - depthx ) ;
272 localpos.SetZ(localpos.Z() - depthz ) ;
274 TVector3 emcglobalpos ;
277 emcrp->GetGlobalPosition(emcglobalpos, dummy) ;
279 emcglobalpos.SetX( emcglobalpos.X() - depthx ) ;
280 emcglobalpos.SetZ( emcglobalpos.Z() - depthz ) ;
282 // The following commeneted code becomes valid once the PPSD provides
283 // a reasonable position resolution, at least as good as EMC !
285 // TVector3 ppsdlglobalpos ;
286 // TVector3 ppsduglobalpos ;
288 // if( fPpsdLowRecPoint ){ // certainly a photon that has concerted
290 // fPpsdLowRecPoint->GetGlobalPosition(ppsdlglobalpos, mdummy) ;
291 // dir = emcglobalpos - ppsdlglobalpos ;
293 // if( fPpsdUpRecPoint ){ // nop looks like a charged
295 // fPpsdUpRecPoint->GetGlobalPosition(ppsduglobalpos, mdummy) ;
296 // dir = ( dir + emcglobalpos - ppsduglobalpos ) * 0.5 ;
300 // else { // looks like a neutral
305 dir.SetZ( -dir.Z() ) ; // why ?
311 //____________________________________________________________________________
312 Int_t AliPHOSTrackSegment:: GetPHOSMod(void)
314 // Returns the phos module which contains this track
316 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
318 return emcrp->GetPHOSMod();
321 //____________________________________________________________________________
322 AliPHOSPpsdRecPoint * AliPHOSTrackSegment::GetPpsdLowRecPoint() const
324 // Returns the lower PPSD rec point at the origin of this track
326 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
327 AliPHOSPpsdRecPoint * rv = 0 ;
329 if ( fPpsdLowRecPoint > -1 )
330 rv = (AliPHOSPpsdRecPoint *)please->GimeRecPoint( fPpsdLowRecPoint, TString("ppsd") ) ;
335 //____________________________________________________________________________
336 AliPHOSPpsdRecPoint * AliPHOSTrackSegment::GetPpsdUpRecPoint() const
338 // Returns the lower PPSD rec point at the origin of this track
340 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
341 AliPHOSPpsdRecPoint * rv = 0 ;
343 if ( fPpsdUpRecPoint > -1 )
344 rv = (AliPHOSPpsdRecPoint *)please->GimeRecPoint( fPpsdUpRecPoint, TString("ppsd") ) ;
349 //____________________________________________________________________________
350 Int_t * AliPHOSTrackSegment::GetPrimariesEmc(Int_t & number)
352 // Retrieves the primary particle(s) at the origin of the EMC RecPoint
354 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
359 rv = emcrp->GetPrimaries(number) ;
364 //____________________________________________________________________________
365 Int_t * AliPHOSTrackSegment::GetPrimariesPpsdLow(Int_t & number)
367 // Retrieves the primary particle(s) at the origin of the lower PPSD RecPoint
369 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
374 rv = ppsdlrp->GetPrimaries(number) ;
379 //____________________________________________________________________________
380 Int_t * AliPHOSTrackSegment::GetPrimariesPpsdUp(Int_t & number)
382 // Retrieves the primary particle(s) at the origin of the upper PPSD RecPoint
384 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
389 rv = ppsdurp->GetPrimaries(number) ;
394 //____________________________________________________________________________
395 void AliPHOSTrackSegment::GetPosition( TVector3 & pos )
397 // Returns position of the EMC RecPoint
399 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
402 emcrp->GetGlobalPosition(pos, dummy) ;
406 //______________________________________________________________________________
407 void AliPHOSTrackSegment::Paint(Option_t *)
409 // Paint this AliPHOSTrackSegment as a TMarker with its current attributes
411 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
412 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
413 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
415 TVector3 posemc(999., 999., 999.) ;
416 TVector3 posppsdl(999., 999., 999.) ;
417 TVector3 posppsdu(999., 999., 999.) ;
419 emcrp->GetLocalPosition(posemc) ;
421 ppsdlrp->GetLocalPosition(posppsdl) ;
423 ppsdurp->GetLocalPosition(posppsdu) ;
425 Coord_t xemc = posemc.X() ;
426 Coord_t yemc = posemc.Z() ;
428 Coord_t yppsdl = posppsdl.Z() ;
429 Coord_t xppsdl = posppsdl.X() ;
431 Coord_t yppsdu = posppsdu.Z() ;
432 Coord_t xppsdu = posppsdu.X() ;
434 Color_t markercolor = 1 ;
435 Size_t markersize = 1.5 ;
436 Style_t markerstyle = 20 ;
438 if (!gPad->IsBatch()) {
439 gVirtualX->SetMarkerColor(markercolor) ;
440 gVirtualX->SetMarkerSize (markersize) ;
441 gVirtualX->SetMarkerStyle(markerstyle) ;
443 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
444 gPad->PaintPolyMarker(1, &xemc, &yemc, "") ;
446 if (xppsdl != 999. && yppsdl != 999. ) {
452 if (!gPad->IsBatch()) {
453 gVirtualX->SetMarkerColor(markercolor) ;
454 gVirtualX->SetMarkerSize (markersize) ;
455 gVirtualX->SetMarkerStyle(markerstyle) ;
457 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
458 gPad->PaintPolyMarker(1, &xppsdl, &yppsdl, "") ;
461 if (xppsdu != 999. && yppsdu != 999. ) {
467 if (!gPad->IsBatch()) {
468 gVirtualX->SetMarkerColor(markercolor) ;
469 gVirtualX->SetMarkerSize (markersize) ;
470 gVirtualX->SetMarkerStyle(markerstyle) ;
472 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
473 gPad->PaintPolyMarker(1, &xppsdu, &yppsdu, "") ;
477 //____________________________________________________________________________
478 void AliPHOSTrackSegment::Print(const char * opt)
480 // Print all information on this track Segment
482 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
483 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
484 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
489 cout << "--------AliPHOSTrackSegment-------- "<<endl ;
492 cout << "******** EMC Reconstructed Point: " << endl;
495 emcrp->GetGlobalPosition( pos, dummy ) ;
497 cout << " Global position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << emcrp->GetTotalEnergy() << endl ;
500 if ( ppsdlrp != 0 ) {
501 cout << "******** PPSD Low Reconstructed Point: " << endl;
504 ppsdlrp->GetGlobalPosition( pos , dummy ) ;
505 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
509 cout << "******** PPSD Up Reconstructed Point: " << endl;
512 ppsdurp->GetGlobalPosition( pos, dummy ) ;
513 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
517 //____________________________________________________________________________
518 void AliPHOSTrackSegment::SetPpsdUpRecPoint(AliPHOSPpsdRecPoint * PpsdUpRecPoint)
520 // gives an id from its position in the list
522 fPpsdUpRecPoint = PpsdUpRecPoint->GetIndexInList() ;
524 fPpsdUpRecPoint = -1 ;