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 , AliPHOSPpsdRecPoint * ppsdrp1,
45 AliPHOSPpsdRecPoint * ppsdrp2 )
50 fEmcRecPoint = emc->GetIndexInList() ;
55 fPpsdUpRecPoint = ppsdrp1->GetIndexInList() ;
57 fPpsdUpRecPoint = -1 ;
60 fPpsdLowRecPoint = ppsdrp2->GetIndexInList() ;
62 fPpsdLowRecPoint = -1 ;
67 //____________________________________________________________________________
68 AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
72 ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
76 //____________________________________________________________________________
77 void AliPHOSTrackSegment::Copy(TObject & obj)
79 // Copy of a track segment into another track segment
82 ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ;
83 ( (AliPHOSTrackSegment &)obj ).fPpsdLowRecPoint = fPpsdLowRecPoint ;
84 ( (AliPHOSTrackSegment &)obj ).fPpsdUpRecPoint = fPpsdUpRecPoint ;
85 ( (AliPHOSTrackSegment &)obj ).fIndexInList = fIndexInList ;
87 //____________________________________________________________________________
88 Int_t AliPHOSTrackSegment::DistancetoPrimitive(Int_t px, Int_t py)
90 // Compute distance from point px,py to a AliPHOSTrackSegment considered as a Tmarker
91 // Compute the closest distance of approach from point px,py to this marker.
92 // The distance is computed in pixels units.
97 TVector3 pos(0.,0.,0.) ;
99 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
100 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
101 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
104 emcrp->GetLocalPosition( pos) ;
105 Float_t x = pos.X() ;
106 Float_t y = pos.Z() ;
107 if ( ppsdlrp != 0 ) {
108 ppsdlrp->GetLocalPosition( pos ) ;
113 if ( ppsdurp != 0 ) {
114 ppsdurp->GetLocalPosition( pos ) ;
122 const Int_t kMaxDiff = 10;
123 Int_t pxm = gPad->XtoAbsPixel(x);
124 Int_t pym = gPad->YtoAbsPixel(y);
125 dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
127 if (dist > kMaxDiff) return 9999;
132 //___________________________________________________________________________
133 void AliPHOSTrackSegment::Draw(Option_t *option)
135 // Draw this AliPHOSTrackSegment with its current attribute
140 //______________________________________________________________________________
141 void AliPHOSTrackSegment::ExecuteEvent(Int_t event, Int_t px, Int_t py)
143 // Execute action corresponding to one event
144 // This member function is called when a AliPHOSTrackSegment is clicked with the locator
146 // If Left button is clicked on AliPHOSRecPoint, the digits are switched on
147 // and switched off when the mouse button is released.
149 static TPaveText* textTS = 0 ;
151 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
153 if (!gPad->IsEditable())
162 TVector3 pos(0.,0.,0.) ;
163 emcrp->GetLocalPosition(pos) ;
164 textTS = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+5,pos.Z()+15,"") ;
166 sprintf(line1,"See RecParticle for ID") ;
167 textTS ->AddText(line1) ;
184 //____________________________________________________________________________
185 Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
187 // Calculates the distance between the EMC RecPoint and PPSD RecPoint
189 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
190 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
193 emcrp->GetLocalPosition(vecEmc) ;
197 if( ppsdlrp->GetMultiplicity() )
198 ppsdlrp->GetLocalPosition(vecPpsd) ;
200 vecPpsd.SetX(10000.) ;
204 Float_t r = vecEmc.Mag();;
209 //____________________________________________________________________________
210 AliPHOSEmcRecPoint * AliPHOSTrackSegment::GetEmcRecPoint() const
212 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
213 AliPHOSEmcRecPoint * rv = 0 ;
214 if ( fEmcRecPoint > -1 )
215 rv = (AliPHOSEmcRecPoint *)please->GimeRecPoint( fEmcRecPoint, TString("emc") );
221 //____________________________________________________________________________
222 Float_t AliPHOSTrackSegment::GetEnergy()
224 // Returns energy in EMC
226 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
228 return emcrp->GetTotalEnergy() ;
231 //____________________________________________________________________________
232 TVector3 AliPHOSTrackSegment::GetMomentumDirection()
234 // Calculates the momentum direction:
235 // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint
236 // 2. if a EMC RecPoint and one PPSD RecPoint, direction is given by the line through the 2 recpoints
237 // 3. if a EMC RecPoint and two PPSD RecPoints, dirrection is given by the average line through
238 // the 2 pairs of recpoints
239 // However because of the poor position resolution of PPSD the direction is always taken as if we were
243 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
244 // AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
245 // AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
247 TVector3 dir(0,0,0) ;
251 emcrp->GetGlobalPosition(posEmc, mdummy) ;
253 // Correction for the depth of the shower starting point (TDR p 127)
255 Float_t energy = emcrp->GetEnergy() ;
256 Float_t para = 0.925 ;
257 Float_t parb = 6.52 ;
260 emcrp->GetLocalPosition(localpos) ;
262 AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ;
263 Float_t radius = geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1) ;
264 Float_t incidencephi = TMath::ATan(localpos.X() / radius) ;
265 Float_t incidencetheta = TMath::ATan(localpos.Z() / radius) ;
267 Float_t depthx = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencephi) ;
268 Float_t depthz = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencetheta) ;
270 localpos.SetX(localpos.X() - depthx ) ;
271 localpos.SetZ(localpos.Z() - depthz ) ;
273 TVector3 emcglobalpos ;
276 emcrp->GetGlobalPosition(emcglobalpos, dummy) ;
278 emcglobalpos.SetX( emcglobalpos.X() - depthx ) ;
279 emcglobalpos.SetZ( emcglobalpos.Z() - depthz ) ;
281 // The following commeneted code becomes valid once the PPSD provides
282 // a reasonable position resolution, at least as good as EMC !
284 // TVector3 ppsdlglobalpos ;
285 // TVector3 ppsduglobalpos ;
287 // if( fPpsdLowRecPoint ){ // certainly a photon that has concerted
289 // fPpsdLowRecPoint->GetGlobalPosition(ppsdlglobalpos, mdummy) ;
290 // dir = emcglobalpos - ppsdlglobalpos ;
292 // if( fPpsdUpRecPoint ){ // nop looks like a charged
294 // fPpsdUpRecPoint->GetGlobalPosition(ppsduglobalpos, mdummy) ;
295 // dir = ( dir + emcglobalpos - ppsduglobalpos ) * 0.5 ;
299 // else { // looks like a neutral
304 dir.SetZ( -dir.Z() ) ; // why ?
310 //____________________________________________________________________________
311 Int_t AliPHOSTrackSegment:: GetPHOSMod(void)
314 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
316 return emcrp->GetPHOSMod();
319 //____________________________________________________________________________
320 AliPHOSPpsdRecPoint * AliPHOSTrackSegment::GetPpsdLowRecPoint() const
322 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
323 AliPHOSPpsdRecPoint * rv = 0 ;
325 if ( fPpsdLowRecPoint > -1 )
326 rv = (AliPHOSPpsdRecPoint *)please->GimeRecPoint( fPpsdLowRecPoint, TString("ppsd") ) ;
331 //____________________________________________________________________________
332 AliPHOSPpsdRecPoint * AliPHOSTrackSegment::GetPpsdUpRecPoint() const
334 AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ;
335 AliPHOSPpsdRecPoint * rv = 0 ;
337 if ( fPpsdUpRecPoint > -1 )
338 rv = (AliPHOSPpsdRecPoint *)please->GimeRecPoint( fPpsdUpRecPoint, TString("ppsd") ) ;
343 //____________________________________________________________________________
344 Int_t * AliPHOSTrackSegment::GetPrimariesEmc(Int_t & number)
346 // Retrieves the primary particle(s) at the origin of the EMC RecPoint
348 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
353 rv = emcrp->GetPrimaries(number) ;
358 //____________________________________________________________________________
359 Int_t * AliPHOSTrackSegment::GetPrimariesPpsdLow(Int_t & number)
361 // Retrieves the primary particle(s) at the origin of the lower PPSD RecPoint
363 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
368 rv = ppsdlrp->GetPrimaries(number) ;
373 //____________________________________________________________________________
374 Int_t * AliPHOSTrackSegment::GetPrimariesPpsdUp(Int_t & number)
376 // Retrieves the primary particle(s) at the origin of the upper PPSD RecPoint
378 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
383 rv = ppsdurp->GetPrimaries(number) ;
388 //____________________________________________________________________________
389 void AliPHOSTrackSegment::GetPosition( TVector3 & pos )
391 // Returns position of the EMC RecPoint
393 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
396 emcrp->GetGlobalPosition(pos, dummy) ;
400 //______________________________________________________________________________
401 void AliPHOSTrackSegment::Paint(Option_t *)
403 // Paint this AliPHOSTrackSegment as a TMarker with its current attributes
405 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
406 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
407 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
409 TVector3 posemc(999., 999., 999.) ;
410 TVector3 posppsdl(999., 999., 999.) ;
411 TVector3 posppsdu(999., 999., 999.) ;
413 emcrp->GetLocalPosition(posemc) ;
415 ppsdlrp->GetLocalPosition(posppsdl) ;
417 ppsdurp->GetLocalPosition(posppsdu) ;
419 Coord_t xemc = posemc.X() ;
420 Coord_t yemc = posemc.Z() ;
422 Coord_t yppsdl = posppsdl.Z() ;
423 Coord_t xppsdl = posppsdl.X() ;
425 Coord_t yppsdu = posppsdu.Z() ;
426 Coord_t xppsdu = posppsdu.X() ;
428 Color_t markercolor = 1 ;
429 Size_t markersize = 1.5 ;
430 Style_t markerstyle = 20 ;
432 if (!gPad->IsBatch()) {
433 gVirtualX->SetMarkerColor(markercolor) ;
434 gVirtualX->SetMarkerSize (markersize) ;
435 gVirtualX->SetMarkerStyle(markerstyle) ;
437 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
438 gPad->PaintPolyMarker(1, &xemc, &yemc, "") ;
440 if (xppsdl != 999. && yppsdl != 999. ) {
446 if (!gPad->IsBatch()) {
447 gVirtualX->SetMarkerColor(markercolor) ;
448 gVirtualX->SetMarkerSize (markersize) ;
449 gVirtualX->SetMarkerStyle(markerstyle) ;
451 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
452 gPad->PaintPolyMarker(1, &xppsdl, &yppsdl, "") ;
455 if (xppsdu != 999. && yppsdu != 999. ) {
461 if (!gPad->IsBatch()) {
462 gVirtualX->SetMarkerColor(markercolor) ;
463 gVirtualX->SetMarkerSize (markersize) ;
464 gVirtualX->SetMarkerStyle(markerstyle) ;
466 gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
467 gPad->PaintPolyMarker(1, &xppsdu, &yppsdu, "") ;
471 //____________________________________________________________________________
472 void AliPHOSTrackSegment::Print()
474 // Print all information on this track Segment
476 AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ;
477 AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ;
478 AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ;
483 cout << "--------AliPHOSTrackSegment-------- "<<endl ;
486 cout << "******** EMC Reconstructed Point: " << endl;
489 emcrp->GetGlobalPosition( pos, dummy ) ;
491 cout << " Global position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << emcrp->GetTotalEnergy() << endl ;
494 if ( ppsdlrp != 0 ) {
495 cout << "******** PPSD Low Reconstructed Point: " << endl;
498 ppsdlrp->GetGlobalPosition( pos , dummy ) ;
499 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
503 cout << "******** PPSD Up Reconstructed Point: " << endl;
506 ppsdurp->GetGlobalPosition( pos, dummy ) ;
507 cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;