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"
39 #include "AliPHOSIndexToObject.h"
41 ClassImp(AliPHOSTrackSegment)
43 //____________________________________________________________________________
44 AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
45 AliPHOSPpsdRecPoint * ppsdrp1,
46 AliPHOSPpsdRecPoint * ppsdrp2 )
51 fEmcRecPoint = emc->GetIndexInList() ;
56 fPpsdUpRecPoint = ppsdrp1->GetIndexInList() ;
58 fPpsdUpRecPoint = -1 ;
61 fPpsdLowRecPoint = ppsdrp2->GetIndexInList() ;
63 fPpsdLowRecPoint = -1 ;
68 //____________________________________________________________________________
69 AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
73 ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
77 //____________________________________________________________________________
78 void AliPHOSTrackSegment::Copy(TObject & obj)
80 // Copy of a track segment into another track segment
83 ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ;
84 ( (AliPHOSTrackSegment &)obj ).fPpsdLowRecPoint = fPpsdLowRecPoint ;
85 ( (AliPHOSTrackSegment &)obj ).fPpsdUpRecPoint = fPpsdUpRecPoint ;
86 ( (AliPHOSTrackSegment &)obj ).fIndexInList = fIndexInList ;
88 //____________________________________________________________________________
89 Int_t AliPHOSTrackSegment::DistancetoPrimitive(Int_t px, Int_t py)
91 // Compute distance from point px,py to a AliPHOSTrackSegment considered as a Tmarker
92 // Compute the closest distance of approach from point px,py to this marker.
93 // The distance is computed in pixels units.
98 TVector3 pos(0.,0.,0.) ;
100 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
101 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
102 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
105 emcrp->GetLocalPosition( pos) ;
106 Float_t x = pos.X() ;
107 Float_t y = pos.Z() ;
108 if ( ppsdlrp != 0 ) {
109 ppsdlrp->GetLocalPosition( pos ) ;
114 if ( ppsdurp != 0 ) {
115 ppsdurp->GetLocalPosition( pos ) ;
123 const Int_t kMaxDiff = 10;
124 Int_t pxm = gPad->XtoAbsPixel(x);
125 Int_t pym = gPad->YtoAbsPixel(y);
126 dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
128 if (dist > kMaxDiff) return 9999;
133 //___________________________________________________________________________
134 void AliPHOSTrackSegment::Draw(Option_t *option)
136 // Draw this AliPHOSTrackSegment with its current attribute
141 //______________________________________________________________________________
142 void AliPHOSTrackSegment::ExecuteEvent(Int_t event, Int_t px, Int_t py)
144 // Execute action corresponding to one event
145 // This member function is called when a AliPHOSTrackSegment is clicked with the locator
147 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
148 // and switched off when the mouse button is released.
150 static TPaveText* textTS = 0 ;
152 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
154 if (!gPad->IsEditable())
163 TVector3 pos(0.,0.,0.) ;
164 emcrp->GetLocalPosition(pos) ;
165 textTS = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+5,pos.Z()+15,"") ;
167 sprintf(line1,"See RecParticle for ID") ;
168 textTS ->AddText(line1) ;
185 //____________________________________________________________________________
186 Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
188 // Calculates the distance between the EMC RecPoint and PPSD RecPoint
190 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
191 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
194 emcrp->GetLocalPosition(vecEmc) ;
198 if( ppsdlrp->GetMultiplicity() )
199 ppsdlrp->GetLocalPosition(vecPpsd) ;
201 vecPpsd.SetX(10000.) ;
205 Float_t r = vecEmc.Mag();;
210 //____________________________________________________________________________
211 AliPHOSEmcRecPoint * AliPHOSTrackSegment::GetEmcRecPoint() const
213 // get the EMC recpoint at the origin of this track
215 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
216 AliPHOSEmcRecPoint * rv = 0 ;
217 if ( fEmcRecPoint > -1 )
218 rv = (AliPHOSEmcRecPoint *)please->GimeRecPoint( fEmcRecPoint, TString("emc") );
224 //____________________________________________________________________________
225 Float_t AliPHOSTrackSegment::GetEnergy()
227 // Returns energy in EMC
229 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
231 return emcrp->GetTotalEnergy() ;
234 //____________________________________________________________________________
235 TVector3 AliPHOSTrackSegment::GetMomentumDirection()
237 // Calculates the momentum direction:
238 // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint
239 // 2. if a EMC RecPoint and one PPSD RecPoint, direction is given by the line through the 2 recpoints
240 // 3. if a EMC RecPoint and two PPSD RecPoints, dirrection is given by the average line through
241 // the 2 pairs of recpoints
242 // However because of the poor position resolution of PPSD the direction is always taken as if we were
246 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
247 // AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
248 // AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
250 TVector3 dir(0,0,0) ;
254 emcrp->GetGlobalPosition(posEmc, mdummy) ;
256 // Correction for the depth of the shower starting point (TDR p 127)
258 Float_t energy = emcrp->GetEnergy() ;
259 Float_t para = 0.925 ;
260 Float_t parb = 6.52 ;
263 emcrp->GetLocalPosition(localpos) ;
265 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
266 Float_t radius = geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1) ;
267 Float_t incidencephi = TMath::ATan(localpos.X() / radius) ;
268 Float_t incidencetheta = TMath::ATan(localpos.Z() / radius) ;
270 Float_t depthx = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencephi) ;
271 Float_t depthz = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencetheta) ;
273 localpos.SetX(localpos.X() - depthx ) ;
274 localpos.SetZ(localpos.Z() - depthz ) ;
276 TVector3 emcglobalpos ;
279 emcrp->GetGlobalPosition(emcglobalpos, dummy) ;
281 emcglobalpos.SetX( emcglobalpos.X() - depthx ) ;
282 emcglobalpos.SetZ( emcglobalpos.Z() - depthz ) ;
284 // The following commeneted code becomes valid once the PPSD provides
285 // a reasonable position resolution, at least as good as EMC !
287 // TVector3 ppsdlglobalpos ;
288 // TVector3 ppsduglobalpos ;
290 // if( fPpsdLowRecPoint ){ // certainly a photon that has concerted
292 // fPpsdLowRecPoint->GetGlobalPosition(ppsdlglobalpos, mdummy) ;
293 // dir = emcglobalpos - ppsdlglobalpos ;
295 // if( fPpsdUpRecPoint ){ // nop looks like a charged
297 // fPpsdUpRecPoint->GetGlobalPosition(ppsduglobalpos, mdummy) ;
298 // dir = ( dir + emcglobalpos - ppsduglobalpos ) * 0.5 ;
302 // else { // looks like a neutral
307 dir.SetZ( -dir.Z() ) ; // why ?
313 //____________________________________________________________________________
314 Int_t AliPHOSTrackSegment:: GetPHOSMod(void)
316 // Returns the phos module which contains this track
318 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
320 return emcrp->GetPHOSMod();
323 //____________________________________________________________________________
324 AliPHOSPpsdRecPoint * AliPHOSTrackSegment::GetPpsdLowRecPoint() const
326 // Returns the lower PPSD rec point at the origin of this track
328 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
329 AliPHOSPpsdRecPoint * rv = 0 ;
331 if ( fPpsdLowRecPoint > -1 )
332 rv = (AliPHOSPpsdRecPoint *)please->GimeRecPoint( fPpsdLowRecPoint, TString("ppsd") ) ;
337 //____________________________________________________________________________
338 AliPHOSPpsdRecPoint * AliPHOSTrackSegment::GetPpsdUpRecPoint() const
340 // Returns the lower PPSD rec point at the origin of this track
342 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
343 AliPHOSPpsdRecPoint * rv = 0 ;
345 if ( fPpsdUpRecPoint > -1 )
346 rv = (AliPHOSPpsdRecPoint *)please->GimeRecPoint( fPpsdUpRecPoint, TString("ppsd") ) ;
351 //____________________________________________________________________________
352 Int_t * AliPHOSTrackSegment::GetPrimariesEmc(Int_t & number)
354 // Retrieves the primary particle(s) at the origin of the EMC RecPoint
356 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
361 rv = emcrp->GetPrimaries(number) ;
366 //____________________________________________________________________________
367 Int_t * AliPHOSTrackSegment::GetPrimariesPpsdLow(Int_t & number)
369 // Retrieves the primary particle(s) at the origin of the lower PPSD RecPoint
371 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
376 rv = ppsdlrp->GetPrimaries(number) ;
381 //____________________________________________________________________________
382 Int_t * AliPHOSTrackSegment::GetPrimariesPpsdUp(Int_t & number)
384 // Retrieves the primary particle(s) at the origin of the upper PPSD RecPoint
386 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
391 rv = ppsdurp->GetPrimaries(number) ;
396 //____________________________________________________________________________
397 void AliPHOSTrackSegment::GetPosition( TVector3 & pos )
399 // Returns position of the EMC RecPoint
401 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
404 emcrp->GetGlobalPosition(pos, dummy) ;
408 //______________________________________________________________________________
409 void AliPHOSTrackSegment::Paint(Option_t *)
411 // Paint this AliPHOSTrackSegment as a TMarker with its current attributes
413 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
414 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
415 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
417 TVector3 posemc(999., 999., 999.) ;
418 TVector3 posppsdl(999., 999., 999.) ;
419 TVector3 posppsdu(999., 999., 999.) ;
421 emcrp->GetLocalPosition(posemc) ;
423 ppsdlrp->GetLocalPosition(posppsdl) ;
425 ppsdurp->GetLocalPosition(posppsdu) ;
427 Coord_t xemc = posemc.X() ;
428 Coord_t yemc = posemc.Z() ;
430 Coord_t yppsdl = posppsdl.Z() ;
431 Coord_t xppsdl = posppsdl.X() ;
433 Coord_t yppsdu = posppsdu.Z() ;
434 Coord_t xppsdu = posppsdu.X() ;
436 Color_t markercolor = 1 ;
437 Size_t markersize = 1.5 ;
438 Style_t markerstyle = 20 ;
440 if (!gPad->IsBatch()) {
441 gVirtualX->SetMarkerColor(markercolor) ;
442 gVirtualX->SetMarkerSize (markersize) ;
443 gVirtualX->SetMarkerStyle(markerstyle) ;
445 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
446 gPad->PaintPolyMarker(1, &xemc, &yemc, "") ;
448 if (xppsdl != 999. && yppsdl != 999. ) {
454 if (!gPad->IsBatch()) {
455 gVirtualX->SetMarkerColor(markercolor) ;
456 gVirtualX->SetMarkerSize (markersize) ;
457 gVirtualX->SetMarkerStyle(markerstyle) ;
459 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
460 gPad->PaintPolyMarker(1, &xppsdl, &yppsdl, "") ;
463 if (xppsdu != 999. && yppsdu != 999. ) {
469 if (!gPad->IsBatch()) {
470 gVirtualX->SetMarkerColor(markercolor) ;
471 gVirtualX->SetMarkerSize (markersize) ;
472 gVirtualX->SetMarkerStyle(markerstyle) ;
474 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
475 gPad->PaintPolyMarker(1, &xppsdu, &yppsdu, "") ;
479 //____________________________________________________________________________
480 void AliPHOSTrackSegment::Print(const char * opt)
482 // Print all information on this track Segment
484 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
485 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
486 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
491 cout << "--------AliPHOSTrackSegment-------- "<<endl ;
494 cout << "******** EMC Reconstructed Point: " << endl;
497 emcrp->GetGlobalPosition( pos, dummy ) ;
499 cout << " Global position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << emcrp->GetTotalEnergy() << endl ;
502 if ( ppsdlrp != 0 ) {
503 cout << "******** PPSD Low Reconstructed Point: " << endl;
506 ppsdlrp->GetGlobalPosition( pos , dummy ) ;
507 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
511 cout << "******** PPSD Up Reconstructed Point: " << endl;
514 ppsdurp->GetGlobalPosition( pos, dummy ) ;
515 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
519 //____________________________________________________________________________
520 void AliPHOSTrackSegment::SetPpsdUpRecPoint(AliPHOSPpsdRecPoint * PpsdUpRecPoint)
523 fPpsdUpRecPoint = PpsdUpRecPoint->GetIndexInList() ;
525 fPpsdUpRecPoint = -1 ;