* 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( const AliPHOSTrackSegment & ts)
-{
- ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
-}
-
-//____________________________________________________________________________
-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. ;
}
//____________________________________________________________________________
-void AliPHOSTrackSegment::Copy(TObject & obj)
-{
- TObject::Copy(obj) ;
- ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ;
- ( (AliPHOSTrackSegment &)obj ).fPpsdLow = fPpsdLow ;
- ( (AliPHOSTrackSegment &)obj ).fPpsdUp = fPpsdUp ;
-}
-//____________________________________________________________________________
-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.
- //
- Int_t div = 1 ;
- TVector3 pos(0.,0.,0.) ;
-
- fEmcRecPoint->GetLocalPosition( pos) ;
- Float_t x = pos.X() ;
- Float_t y = pos.Z() ;
- if ( fPpsdLow ) {
- fPpsdLow->GetLocalPosition( pos ) ;
- x += pos.X() ;
- y += pos.Z() ;
- div++ ;
- }
- if ( fPpsdUp ) {
- fPpsdUp->GetLocalPosition( pos ) ;
- x += pos.X() ;
- y += pos.Z() ;
- div++ ;
- }
- x /= div ;
- y /= div ;
+ // ctor
- 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 attribute
+ fTrack = -1 ;
- AppendPad(option);
- }
+ fIndexInList = -1 ;
+ fDcpv[0]=999. ;
+ fDcpv[1]=999. ;
+}
-//______________________________________________________________________________
-void AliPHOSTrackSegment::ExecuteEvent(Int_t event, Int_t px, Int_t py)
+//____________________________________________________________________________
+AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc ,
+ AliPHOSRecPoint * cpvrp1,
+ Int_t track)
+ : fEmcRecPoint(0),
+ fIndexInList(0),
+ fCpvRecPoint(0),
+ fTrack(0)
{
- // 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* textTS = 0 ;
-
- if (!gPad->IsEditable())
- return;
+ // ctor
- switch (event) {
-
- case kButton1Down:{
-
- if (!textTS) {
+ if( emc )
+ fEmcRecPoint = emc->GetIndexInList() ;
+ else
+ fEmcRecPoint = -1 ;
+
+ if( cpvrp1 )
+ fCpvRecPoint = cpvrp1->GetIndexInList() ;
+ else
+ fCpvRecPoint = -1 ;
- TVector3 pos(0.,0.,0.) ;
- fEmcRecPoint->GetLocalPosition(pos) ;
- textTS = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+5,pos.Z()+15,"") ;
- Text_t line1[40] ;
- if (GetPartType() == kGAMMA )
- sprintf(line1,"PHOTON") ;
- if (GetPartType() == kELECTRON )
- sprintf(line1,"ELECTRON") ;
- if (GetPartType() == kNEUTRAL )
- sprintf(line1,"NEUTRAL") ;
- if (GetPartType() == kCHARGEDHADRON )
- sprintf(line1,"CHARGED HADRON") ;
+ fTrack = track ;
- textTS ->AddText(line1) ;
- textTS ->Draw("");
- gPad->Update() ;
- }
- }
-
- break;
-
- case kButton1Up:
- if (textTS) {
- delete textTS ;
- textTS = 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
- TVector3 vecPpsd ;
- if( fPpsdLow->GetMultiplicity() )
- fPpsdLow->GetLocalPosition(vecPpsd) ;
- else {
- vecPpsd.SetX(10000.) ;
- }
- vecEmc -= vecPpsd ;
+ if( emc )
+ fEmcRecPoint = emc->GetIndexInList() ;
+ else
+ fEmcRecPoint = -1 ;
+
+ 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 ;
}
//____________________________________________________________________________
-TVector3 AliPHOSTrackSegment::GetMomentumDirection()
-{
- TVector3 dir, tempo ;
- TMatrix mdummy ;
-
- TVector3 posEmc ;
- fEmcRecPoint->GetGlobalPosition(posEmc, mdummy) ;
-
- TVector3 posPpsdl ;
- TVector3 posPpsdup ;
-
-// if( fPpsdLow ){
-// fPpsdLow->GetGlobalPosition(posPpsdl, mdummy) ;
-// if( !fPpsdUp ) { // draw line trough 2 points
-// tempo = posEmc - posPpsdl;
-// }
+AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts)
+ : TObject(ts),
+ fEmcRecPoint(0),
+ fIndexInList(0),
+ fCpvRecPoint(0),
+ fTrack(0)
+{
+ // Copy ctor
-// else { // draw line through 3 points
-// fPpsdUp->GetGlobalPosition(posPpsdup, mdummy) ;
-// posPpsdl = 0.5 * ( posPpsdup + posPpsdl ) ;
-// dir = posEmc - posPpsdl ;
-// }
-// }
-// else
- tempo = posEmc ;
-
- dir.SetX( tempo.X() ) ; // assumes that a neutral comes from the vertex
- dir.SetY( tempo.Y() ) ;
- dir.SetZ( -tempo.Z() ) ;
-
- dir.SetMag(1.) ;
- return dir ;
+ ( (AliPHOSTrackSegment &)ts ).Copy(*this) ;
}
-//____________________________________________________________________________
-Int_t AliPHOSTrackSegment::GetPartType()
-{
- // Returns 0 - gamma
- // 1 - e+, e-
- // 2 - neutral
- // 3 - charged hadron
- Int_t typeofparticle = kGAMMA ;
-
- if( fPpsdUp == 0 ) { // Neutral
-
- if( fPpsdLow == 0 ) // Neutral
- typeofparticle = kNEUTRAL ;
- else // Gamma
- typeofparticle = kGAMMA ;
+//____________________________________________________________________________
+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)
- typeofparticle = kCHARGEDHADRON ;
- else
- typeofparticle = kELECTRON ;
-
- }
+//____________________________________________________________________________
+void AliPHOSTrackSegment::Print(const Option_t *) const
+{
+ // Print all information on this track Segment
- return typeofparticle ;
+ 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 posemc(999., 999., 999.) ;
- TVector3 posppsdl(999., 999., 999.) ;
- TVector3 posppsdu(999., 999., 999.) ;
-
- fEmcRecPoint->GetLocalPosition(posemc) ;
- if (fPpsdLow !=0 )
- fPpsdLow->GetLocalPosition(posppsdl) ;
- if (fPpsdUp !=0 )
- fPpsdUp->GetLocalPosition(posppsdu) ;
-
- Coord_t xemc = posemc.X() ;
- Coord_t yemc = posemc.Z() ;
-
- Coord_t yppsdl = posppsdl.Z() ;
- Coord_t xppsdl = posppsdl.X() ;
-
- Coord_t yppsdu = posppsdu.Z() ;
- Coord_t xppsdu = posppsdu.X() ;
-
- Color_t markercolor = 1 ;
- Size_t markersize = 1.5 ;
- Style_t markerstyle = 20 ;
-
- if (!gPad->IsBatch()) {
- gVirtualX->SetMarkerColor(markercolor) ;
- gVirtualX->SetMarkerSize (markersize) ;
- gVirtualX->SetMarkerStyle(markerstyle) ;
- }
- gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
- gPad->PaintPolyMarker(1, &xemc, &yemc, "") ;
-
- if (xppsdl != 999. && yppsdl != 999. ) {
-
- markercolor = 2 ;
- markersize = 1.25 ;
- markerstyle = 21 ;
-
- if (!gPad->IsBatch()) {
- gVirtualX->SetMarkerColor(markercolor) ;
- gVirtualX->SetMarkerSize (markersize) ;
- gVirtualX->SetMarkerStyle(markerstyle) ;
- }
- gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
- gPad->PaintPolyMarker(1, &xppsdl, &yppsdl, "") ;
- }
-
- if (xppsdu != 999. && yppsdu != 999. ) {
-
- markercolor = 3 ;
- markersize = 1. ;
- markerstyle = 22 ;
-
- if (!gPad->IsBatch()) {
- gVirtualX->SetMarkerColor(markercolor) ;
- gVirtualX->SetMarkerSize (markersize) ;
- gVirtualX->SetMarkerStyle(markerstyle) ;
- }
- gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ;
- gPad->PaintPolyMarker(1, &xppsdu, &yppsdu, "") ;
- }
+ // 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. ;
}
-