* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
+/* $Id$ */
+
+/* History of cvs commits:
+ *
+ * $Log$
+ * Revision 1.30 2006/08/28 10:01:56 kharlov
+ * Effective C++ warnings fixed (Timur Pocheptsov)
+ *
+ * Revision 1.29 2005/05/28 14:19:05 schutz
+ * Compilation warnings fixed by T.P.
+ *
+ */
//_________________________________________________________________________
-// class of PHOS Sub Track
-//*-- Author : Dmitri Peressounko RRC KI
-//////////////////////////////////////////////////////////////////////////////
+// Track segment in PHOS
+// Can be : 1 EmcRecPoint
+// 1 EmcRecPoint + 1 CPV
+// 1 EmcRecPoint + 1 CPV + 1 charged track
+//
+//*-- Author: Dmitri Peressounko (RRC KI & SUBATECH)
// --- ROOT system ---
-#include "TVector3.h"
-#include "TPad.h"
// --- Standard library ---
-#include <iostream>
-
// --- AliRoot header files ---
-
+#include "AliPHOSEmcRecPoint.h"
#include "AliPHOSTrackSegment.h"
-#include "AliPHOSv0.h"
+#include "AliESDtrack.h"
ClassImp(AliPHOSTrackSegment)
//____________________________________________________________________________
-AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , AliPHOSPpsdRecPoint * ppsdRP1,
- AliPHOSPpsdRecPoint * ppsdRP2 )
-{
- if( emc )
- fEmcRecPoint = emc ;
-
- if( ppsdRP1 )
- fPpsdUp = ppsdRP1 ;
-
- if( ppsdRP2 )
- fPpsdLow = ppsdRP2 ;
-
- fCutOnDispersion = 1.5 ;
-}
-
-//____________________________________________________________________________
-AliPHOSTrackSegment::~AliPHOSTrackSegment() // dtor
+AliPHOSTrackSegment::AliPHOSTrackSegment()
+ : fEmcRecPoint(0),
+ fIndexInList(0),
+ fCpvRecPoint(0),
+ fTrack(0)
{
-// fEmcRecPoint.Delete() ; Not Owners !!!
-// fPpsdUp.Delete() ;
-// fPpsdLow.Delete() ;
+ //def ctor
+ fDcpv[0]=999. ;
+ fDcpv[1]=999. ;
}
//____________________________________________________________________________
-Int_t AliPHOSTrackSegment::DistancetoPrimitive(Int_t px, Int_t py)
+AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
+ AliPHOSRecPoint * cpvrp1)
+ : fEmcRecPoint(0),
+ fIndexInList(0),
+ fCpvRecPoint(0),
+ fTrack(0)
{
-//*-*-*-*-*-*-*-*-*-*-*Compute distance from point px,py to a AliPHOSTrackSegment considered as a Tmarker*-*-*-*-*-*
-//*-* ===========================================
-// Compute the closest distance of approach from point px,py to this marker.
-// The distance is computed in pixels units.
-//
+ // ctor
- TVector3 pos(0.,0.,0.) ;
- fEmcRecPoint->GetLocalPosition( pos) ;
- Float_t x = pos.X() ;
- Float_t y = pos.Z() ;
- const Int_t kMaxDiff = 10;
- Int_t pxm = gPad->XtoAbsPixel(x);
- Int_t pym = gPad->YtoAbsPixel(y);
- Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym);
+ if( emc )
+ fEmcRecPoint = emc->GetIndexInList() ;
+ else
+ fEmcRecPoint = -1 ;
- if (dist > kMaxDiff) return 9999;
- return dist;
-}
+ if( cpvrp1 )
+ fCpvRecPoint = cpvrp1->GetIndexInList() ;
+ else
+ fCpvRecPoint = -1 ;
-//___________________________________________________________________________
- void AliPHOSTrackSegment::Draw(Option_t *option)
- {
-// //*-*-*-*-*-*-*-*-*-*-*Draw this AliPHOSTrackSegment with its current attributes*-*-*-*-*-*-*
-// //*-*
- // assert(0==1);
- AppendPad(option);
- }
+ fTrack = -1 ;
-//______________________________________________________________________________
-void AliPHOSTrackSegment::ExecuteEvent(Int_t event, Int_t px, Int_t py)
-{
-//*-*-*-*-*-*-*-*-*-*-*Execute action corresponding to one event*-*-*-*
-//*-* =========================================
-// This member function is called when a AliPHOSTrackSegment is clicked with the locator
-//
-// If Left button is clicked on AliPHOSRecPoint, the digits are switched on
-// and switched off when the mouse button is released.
-//
- static TPaveText* TrackSegmentText = 0 ;
+ fIndexInList = -1 ;
+ fDcpv[0]=999. ;
+ fDcpv[1]=999. ;
+}
- if (!gPad->IsEditable()) return;
+//____________________________________________________________________________
+AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
+ AliPHOSRecPoint * cpvrp1,
+ Int_t track)
+ : fEmcRecPoint(0),
+ fIndexInList(0),
+ fCpvRecPoint(0),
+ fTrack(0)
+{
+ // ctor
- switch (event) {
+ if( emc )
+ fEmcRecPoint = emc->GetIndexInList() ;
+ else
+ fEmcRecPoint = -1 ;
- case kButton1Down:{
-
- if (!TrackSegmentText) {
+ if( cpvrp1 )
+ fCpvRecPoint = cpvrp1->GetIndexInList() ;
+ else
+ fCpvRecPoint = -1 ;
- TVector3 pos(0.,0.,0.) ;
- fEmcRecPoint->GetLocalPosition(pos) ;
- TrackSegmentText = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+50,pos.Z()+35,"") ;
- Text_t line1[40] ;
- if (GetPartType() == 0 ) sprintf(line1,"PHOTON") ;
- if (GetPartType() == 1 ) sprintf(line1,"NEUTRAL HADRON") ;
- if (GetPartType() == 2 ) sprintf(line1,"CHARGED HADRON") ;
- if (GetPartType() == 3 ) sprintf(line1,"ELECTRON") ;
- TrackSegmentText ->AddText(line1) ;
- TrackSegmentText ->Paint("");
- }
- }
-
- break;
+ fTrack = track ;
- case kButton1Up:
- if (TrackSegmentText) {
- delete TrackSegmentText ;
- TrackSegmentText = 0 ;
- }
- break;
- }
+ fIndexInList = -1 ;
+ fDcpv[0]=999. ;
+ fDcpv[1]=999. ;
}
-
//____________________________________________________________________________
-Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane()
+AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
+ AliPHOSRecPoint * cpvrp1,
+ Int_t track, Float_t dx,Float_t dz)
+ : fEmcRecPoint(0),
+ fIndexInList(0),
+ fCpvRecPoint(0),
+ fTrack(0)
{
-
- TVector3 vecEmc ;
- fEmcRecPoint->GetLocalPosition(vecEmc) ;
+ // ctor
+
+ if( emc )
+ fEmcRecPoint = emc->GetIndexInList() ;
+ else
+ fEmcRecPoint = -1 ;
- TVector3 vecPpsd ;
- if( fPpsdLow->GetMultiplicity() )
- fPpsdLow->GetLocalPosition(vecPpsd) ;
- else {
- vecPpsd.SetX(10000.) ;
- }
- vecEmc -= vecPpsd ;
+ if( cpvrp1 )
+ fCpvRecPoint = cpvrp1->GetIndexInList() ;
+ else
+ fCpvRecPoint = -1 ;
+
+ fTrack = track ;
- Float_t R = vecEmc.Mag();;
+ fIndexInList = -1 ;
- return R ;
+ fDcpv[0] = dx ;
+ fDcpv[1] = dz ;
}
//____________________________________________________________________________
-Bool_t AliPHOSTrackSegment::GetMomentumDirection( TVector3 & dir )
-{
- // True if determined
- Bool_t ifdeterm = kTRUE ;
-
- if( fPpsdLow ){
- TMatrix mdummy ;
- if( fPpsdUp->GetMultiplicity() ) { // draw line trough 2 points
- TVector3 posEmc ;
- fEmcRecPoint->GetGlobalPosition(posEmc,mdummy) ;
- TVector3 posPpsd ;
- fPpsdLow->GetGlobalPosition(posPpsd,mdummy) ;
- dir = posEmc - posPpsd ;
- dir.SetMag(1.) ;
- }
+AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
+ : TObject(ts),
+ fEmcRecPoint(0),
+ fIndexInList(0),
+ fCpvRecPoint(0),
+ fTrack(0)
+{
+ // Copy ctor
- else { // draw line through 3 pionts
- TVector3 posEmc ;
- fEmcRecPoint->GetGlobalPosition(posEmc,mdummy) ;
- TVector3 posPpsdl ;
- fPpsdLow->GetGlobalPosition(posPpsdl,mdummy) ;
- TVector3 posPpsdup ;
- fPpsdUp->GetGlobalPosition(posPpsdup,mdummy) ;
- posPpsdl = 0.5*( posPpsdup+posPpsdl ) ;
- dir = posEmc - posPpsdl ;
- dir.SetMag(1.) ;
- }
-
- }
- else
- ifdeterm = kFALSE ;
-
- return ifdeterm ;
+ ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
}
-//____________________________________________________________________________
-Int_t AliPHOSTrackSegment::GetPartType()
-{
- // Returns 0 - gamma
- // 1 - e+, e-
- // 2 - neutral hadron
- // 3 - charged hadron
-
- Int_t PartType =0;
- if( fPpsdUp ){ // Neutral
- if( fPpsdLow ) // Neutral hadron
- PartType = 2 ;
- else // Gamma
- PartType = 0 ;
+//____________________________________________________________________________
+void AliPHOSTrackSegment::Copy(TObject & obj) const
+{
+ // Copy of a track segment into another track segment
- }
+ TObject::Copy(obj) ;
+ ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ;
+ ( (AliPHOSTrackSegment &)obj ).fCpvRecPoint = fCpvRecPoint ;
+ ( (AliPHOSTrackSegment &)obj ).fIndexInList = fIndexInList ;
+ ( (AliPHOSTrackSegment &)obj ).fTrack = fTrack ;
+ ( (AliPHOSTrackSegment &)obj ).fDcpv[0] = fDcpv[0] ;
+ ( (AliPHOSTrackSegment &)obj ).fDcpv[1] = fDcpv[1] ;
+}
- else { // Charged
- if( fEmcRecPoint->GetDispersion() > fCutOnDispersion)
- PartType = 3 ;
- else
- PartType = 1 ;
-
- }
+//____________________________________________________________________________
+void AliPHOSTrackSegment::Print(const Option_t *) const
+{
+ // Print all information on this track Segment
- return PartType ;
+ Info("Print", "");
+ printf("Stored at position %d\n", fIndexInList) ;
+ printf(" Emc RecPoint # %d\n", fEmcRecPoint) ;
+ if(fCpvRecPoint >= 0)
+ printf(" CPV RecPoint # %d\n", fCpvRecPoint) ;
+ else
+ printf(" No CPV RecPoint\n");
+ if (fTrack >= 0)
+ printf(" Charged track # %d\n", fTrack) ;
+ else
+ printf(" No Charged track\n");
+ printf(" Distance to CPV: x=%f, z=%f\n",fDcpv[0],fDcpv[1]) ;
}
//____________________________________________________________________________
-void AliPHOSTrackSegment::GetPosition( TVector3 & pos )
-{
- // Returns positions of hits
- TMatrix Dummy ;
- fEmcRecPoint->GetGlobalPosition(pos, Dummy) ;
-}
-
-//______________________________________________________________________________
-void AliPHOSTrackSegment::Paint(Option_t *)
+void AliPHOSTrackSegment::SetCpvRecPoint(AliPHOSRecPoint * cpvRecPoint)
{
-//*-*-*-*-*-*-*-*-*-*-*Paint this ALiPHOSTrackSegment as a TMarker with its current attributes*-*-*-*-*-*-*
-//*-* =============================================
- TVector3 pos(0.,0.,0.) ;
- fEmcRecPoint->GetLocalPosition(pos) ;
- Coord_t x = pos.X() ;
- Coord_t y = pos.Z() ;
- Color_t MarkerColor = 1 ;
- Size_t MarkerSize = 1. ;
- Style_t MarkerStyle = 29 ;
-
- if (GetPartType() == 0 ) MarkerStyle = 20 ;
- if (GetPartType() == 1 ) MarkerStyle = 21 ;
- if (GetPartType() == 2 ) MarkerStyle = 22 ;
- if (GetPartType() == 3 ) MarkerStyle = 23 ;
-
- if (!gPad->IsBatch()) {
- gVirtualX->SetMarkerColor(MarkerColor) ;
- gVirtualX->SetMarkerSize (MarkerSize) ;
- gVirtualX->SetMarkerStyle(MarkerStyle) ;
- }
- gPad->SetAttMarkerPS(MarkerColor,MarkerStyle,MarkerSize) ;
- gPad->PaintPolyMarker(1,&x,&y,"") ;
+ // gives an id from its position in the list
+ if( cpvRecPoint )
+ fCpvRecPoint = cpvRecPoint->GetIndexInList() ;
+ else
+ fCpvRecPoint = -1 ;
}
-
-
//____________________________________________________________________________
-void AliPHOSTrackSegment::Print()
+Float_t AliPHOSTrackSegment::GetCpvDistance(const Option_t* dr) const
{
- cout << "--------AliPHOSTrackSegment-------- "<<endl ;
- cout << "EMC Reconstructed Point: " << fEmcRecPoint << endl;
-
- TVector3 pos ;
- TMatrix Dummy ;
-
- fEmcRecPoint->GetGlobalPosition( pos, Dummy ) ;
-
- cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << fEmcRecPoint->GetTotalEnergy() << endl ;
- cout << "PPSD Low Reconstructed Point: " << endl;
-
- if(fPpsdLow){
- fPpsdLow->GetGlobalPosition( pos , Dummy ) ;
- cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
- }
-
- cout << "PPSD Up Reconstructed Point: " << endl;
-
- if(fPpsdUp ){
- fPpsdUp->GetGlobalPosition( pos, Dummy ) ;
- cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ;
- }
+ if(strcmp(dr,"x")==0||strcmp(dr,"X")==0) return fDcpv[0] ;
+ if(strcmp(dr,"z")==0||strcmp(dr,"Z")==0) return fDcpv[1] ;
+ if(strcmp(dr,"r")==0||strcmp(dr,"R")==0) return TMath::Sqrt(fDcpv[0]*fDcpv[0]+fDcpv[1]*fDcpv[1]) ;
+ return 999. ;
}
-