X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=PHOS%2FAliPHOSTrackSegment.cxx;h=6d9707f95924c216f6274e1c7da01ed5e97db3df;hb=140ba4b4d50b19c9068a90bdd7fb4d3019cde90f;hp=14acd77f626528fbb67923c8f8cd67405772e2c5;hpb=2f04ed65d5949adfed4f99b4cc36732eeca851d9;p=u%2Fmrichter%2FAliRoot.git diff --git a/PHOS/AliPHOSTrackSegment.cxx b/PHOS/AliPHOSTrackSegment.cxx index 14acd77f626..6d9707f9592 100644 --- a/PHOS/AliPHOSTrackSegment.cxx +++ b/PHOS/AliPHOSTrackSegment.cxx @@ -13,35 +13,57 @@ * 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. + * + */ + //_________________________________________________________________________ // Track segment in PHOS // Can be : 1 EmcRecPoint -// 1 EmcRecPoint + 1 PPSD -// 1 EmcRecPoint + 1 PPSD + 1 PPSD +// 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 - // --- AliRoot header files --- - +#include "AliPHOSEmcRecPoint.h" #include "AliPHOSTrackSegment.h" -#include "AliPHOSv0.h" -#include "AliPHOSIndexToObject.h" +#include "AliESDtrack.h" ClassImp(AliPHOSTrackSegment) +//____________________________________________________________________________ +AliPHOSTrackSegment::AliPHOSTrackSegment() + : fEmcRecPoint(0), + fIndexInList(0), + fCpvRecPoint(0), + fTrack(0) +{ + //def ctor + fDcpv[0]=999. ; + fDcpv[1]=999. ; +} + //____________________________________________________________________________ AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , - AliPHOSPpsdRecPoint * ppsdrp1, - AliPHOSPpsdRecPoint * ppsdrp2 ) + AliPHOSRecPoint * cpvrp1) + : fEmcRecPoint(0), + fIndexInList(0), + fCpvRecPoint(0), + fTrack(0) { // ctor @@ -50,477 +72,139 @@ AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , else fEmcRecPoint = -1 ; - if( ppsdrp1 ) - fPpsdUpRecPoint = ppsdrp1->GetIndexInList() ; + if( cpvrp1 ) + fCpvRecPoint = cpvrp1->GetIndexInList() ; else - fPpsdUpRecPoint = -1 ; + fCpvRecPoint = -1 ; - if( ppsdrp2 ) - fPpsdLowRecPoint = ppsdrp2->GetIndexInList() ; - else - fPpsdLowRecPoint = -1 ; + fTrack = -1 ; fIndexInList = -1 ; + fDcpv[0]=999. ; + fDcpv[1]=999. ; } //____________________________________________________________________________ -AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts) -{ - // Copy ctor - - ( (AliPHOSTrackSegment &)ts ).Copy(*this) ; -} - - -//____________________________________________________________________________ -void AliPHOSTrackSegment::Copy(TObject & obj) -{ - // Copy of a track segment into another track segment - - TObject::Copy(obj) ; - ( (AliPHOSTrackSegment &)obj ).fEmcRecPoint = fEmcRecPoint ; - ( (AliPHOSTrackSegment &)obj ).fPpsdLowRecPoint = fPpsdLowRecPoint ; - ( (AliPHOSTrackSegment &)obj ).fPpsdUpRecPoint = fPpsdUpRecPoint ; - ( (AliPHOSTrackSegment &)obj ).fIndexInList = fIndexInList ; -} -//____________________________________________________________________________ -Int_t AliPHOSTrackSegment::DistancetoPrimitive(Int_t px, Int_t py) -{ - // 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 ; - Int_t dist = 9999 ; - - TVector3 pos(0.,0.,0.) ; - - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ; - AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ; - - if ( emcrp != 0 ) { - emcrp->GetLocalPosition( pos) ; - Float_t x = pos.X() ; - Float_t y = pos.Z() ; - if ( ppsdlrp != 0 ) { - ppsdlrp->GetLocalPosition( pos ) ; - x += pos.X() ; - y += pos.Z() ; - div++ ; - } - if ( ppsdurp != 0 ) { - ppsdurp->GetLocalPosition( pos ) ; - x += pos.X() ; - y += pos.Z() ; - div++ ; - } - x /= div ; - y /= div ; - - const Int_t kMaxDiff = 10; - Int_t pxm = gPad->XtoAbsPixel(x); - Int_t pym = gPad->YtoAbsPixel(y); - dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym); - - if (dist > kMaxDiff) return 9999; - } - return dist; -} - -//___________________________________________________________________________ - void AliPHOSTrackSegment::Draw(Option_t *option) - { - // Draw this AliPHOSTrackSegment with its current attribute - - AppendPad(option); - } - -//______________________________________________________________________________ -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 ; - - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - - if (!gPad->IsEditable()) - return; - - switch (event) { - - case kButton1Down:{ - - if (!textTS) { - - TVector3 pos(0.,0.,0.) ; - emcrp->GetLocalPosition(pos) ; - textTS = new TPaveText(pos.X()-10,pos.Z()+10,pos.X()+5,pos.Z()+15,"") ; - Text_t line1[40] ; - sprintf(line1,"See RecParticle for ID") ; - textTS ->AddText(line1) ; - textTS ->Draw(""); - gPad->Update() ; - } - } - - break; - - case kButton1Up: - if (textTS) { - delete textTS ; - textTS = 0 ; - } - break; - } -} + // ctor -//____________________________________________________________________________ -Float_t AliPHOSTrackSegment::GetDistanceInPHOSPlane() -{ - // Calculates the distance between the EMC RecPoint and PPSD RecPoint - - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ; + if( emc ) + fEmcRecPoint = emc->GetIndexInList() ; + else + fEmcRecPoint = -1 ; - TVector3 vecEmc ; - emcrp->GetLocalPosition(vecEmc) ; + if( cpvrp1 ) + fCpvRecPoint = cpvrp1->GetIndexInList() ; + else + fCpvRecPoint = -1 ; - TVector3 vecPpsd ; - if ( ppsdlrp !=0 ) { - if( ppsdlrp->GetMultiplicity() ) - ppsdlrp->GetLocalPosition(vecPpsd) ; - else { - vecPpsd.SetX(10000.) ; - } - vecEmc -= vecPpsd ; - } - Float_t r = vecEmc.Mag();; + fTrack = track ; - return r ; + fIndexInList = -1 ; + fDcpv[0]=999. ; + fDcpv[1]=999. ; } //____________________________________________________________________________ -AliPHOSEmcRecPoint * AliPHOSTrackSegment::GetEmcRecPoint() const +AliPHOSTrackSegment::AliPHOSTrackSegment( AliPHOSEmcRecPoint * emc , + AliPHOSRecPoint * cpvrp1, + Int_t track, Float_t dx,Float_t dz) + : fEmcRecPoint(0), + fIndexInList(0), + fCpvRecPoint(0), + fTrack(0) { - // get the EMC recpoint at the origin of this track - - AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ; - AliPHOSEmcRecPoint * rv = 0 ; - if ( fEmcRecPoint > -1 ) - rv = (AliPHOSEmcRecPoint *)please->GimeRecPoint( fEmcRecPoint, TString("emc") ); - - return rv ; - -} - -//____________________________________________________________________________ - Float_t AliPHOSTrackSegment::GetEnergy() -{ - // Returns energy in EMC - - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - - return emcrp->GetTotalEnergy() ; -} - -//____________________________________________________________________________ -TVector3 AliPHOSTrackSegment::GetMomentumDirection() -{ - // Calculates the momentum direction: - // 1. if only a EMC RecPoint, direction is given by IP and this RecPoint - // 2. if a EMC RecPoint and one PPSD RecPoint, direction is given by the line through the 2 recpoints - // 3. if a EMC RecPoint and two PPSD RecPoints, dirrection is given by the average line through - // the 2 pairs of recpoints - // However because of the poor position resolution of PPSD the direction is always taken as if we were - // in case 1. - - - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - // AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ; - // AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ; - - TVector3 dir(0,0,0) ; - TMatrix mdummy ; - - TVector3 posEmc ; - emcrp->GetGlobalPosition(posEmc, mdummy) ; - - // Correction for the depth of the shower starting point (TDR p 127) - - Float_t energy = emcrp->GetEnergy() ; - Float_t para = 0.925 ; - Float_t parb = 6.52 ; - - TVector3 localpos ; - emcrp->GetLocalPosition(localpos) ; - - AliPHOSGeometry * geom = AliPHOSGeometry::GetInstance() ; - Float_t radius = geom->GetIPtoOuterCoverDistance() + geom->GetOuterBoxSize(1) ; - Float_t incidencephi = TMath::ATan(localpos.X() / radius) ; - Float_t incidencetheta = TMath::ATan(localpos.Z() / radius) ; - - Float_t depthx = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencephi) ; - Float_t depthz = ( para * TMath::Log(energy) + parb ) * TMath::Sin(incidencetheta) ; - - localpos.SetX(localpos.X() - depthx ) ; - localpos.SetZ(localpos.Z() - depthz ) ; - - TVector3 emcglobalpos ; - TMatrix dummy ; + // ctor - emcrp->GetGlobalPosition(emcglobalpos, dummy) ; + if( emc ) + fEmcRecPoint = emc->GetIndexInList() ; + else + fEmcRecPoint = -1 ; - emcglobalpos.SetX( emcglobalpos.X() - depthx ) ; - emcglobalpos.SetZ( emcglobalpos.Z() - depthz ) ; + if( cpvrp1 ) + fCpvRecPoint = cpvrp1->GetIndexInList() ; + else + fCpvRecPoint = -1 ; - // The following commeneted code becomes valid once the PPSD provides - // a reasonable position resolution, at least as good as EMC ! - -// TVector3 ppsdlglobalpos ; -// TVector3 ppsduglobalpos ; + fTrack = track ; -// if( fPpsdLowRecPoint ){ // certainly a photon that has concerted - -// fPpsdLowRecPoint->GetGlobalPosition(ppsdlglobalpos, mdummy) ; -// dir = emcglobalpos - ppsdlglobalpos ; - -// if( fPpsdUpRecPoint ){ // nop looks like a charged - -// fPpsdUpRecPoint->GetGlobalPosition(ppsduglobalpos, mdummy) ; -// dir = ( dir + emcglobalpos - ppsduglobalpos ) * 0.5 ; -// } -// } - -// else { // looks like a neutral - - dir = emcglobalpos ; -// } - - dir.SetZ( -dir.Z() ) ; // why ? - dir.SetMag(1.) ; - - return dir ; -} - -//____________________________________________________________________________ -Int_t AliPHOSTrackSegment:: GetPHOSMod(void) -{ - // Returns the phos module which contains this track - - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - - return emcrp->GetPHOSMod(); -} + fIndexInList = -1 ; -//____________________________________________________________________________ -AliPHOSPpsdRecPoint * AliPHOSTrackSegment::GetPpsdLowRecPoint() const -{ - // Returns the lower PPSD rec point at the origin of this track - - AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ; - AliPHOSPpsdRecPoint * rv = 0 ; - - if ( fPpsdLowRecPoint > -1 ) - rv = (AliPHOSPpsdRecPoint *)please->GimeRecPoint( fPpsdLowRecPoint, TString("ppsd") ) ; - - return rv ; + fDcpv[0] = dx ; + fDcpv[1] = dz ; } //____________________________________________________________________________ -AliPHOSPpsdRecPoint * AliPHOSTrackSegment::GetPpsdUpRecPoint() const +AliPHOSTrackSegment::AliPHOSTrackSegment( const AliPHOSTrackSegment & ts) + : TObject(ts), + fEmcRecPoint(0), + fIndexInList(0), + fCpvRecPoint(0), + fTrack(0) { - // Returns the lower PPSD rec point at the origin of this track - - AliPHOSIndexToObject * please = AliPHOSIndexToObject::GetInstance() ; - AliPHOSPpsdRecPoint * rv = 0 ; - - if ( fPpsdUpRecPoint > -1 ) - rv = (AliPHOSPpsdRecPoint *)please->GimeRecPoint( fPpsdUpRecPoint, TString("ppsd") ) ; - - return rv ; -} - -//____________________________________________________________________________ -Int_t * AliPHOSTrackSegment::GetPrimariesEmc(Int_t & number) -{ - // Retrieves the primary particle(s) at the origin of the EMC RecPoint - - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - - Int_t * rv = 0 ; - number = 0 ; - if ( emcrp ) - rv = emcrp->GetPrimaries(number) ; - - return rv ; -} - -//____________________________________________________________________________ -Int_t * AliPHOSTrackSegment::GetPrimariesPpsdLow(Int_t & number) -{ - // Retrieves the primary particle(s) at the origin of the lower PPSD RecPoint - - AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ; - - Int_t * rv = 0 ; - number = 0 ; - if ( ppsdlrp ) - rv = ppsdlrp->GetPrimaries(number) ; + // Copy ctor - return rv ; + ( (AliPHOSTrackSegment &)ts ).Copy(*this) ; } -//____________________________________________________________________________ -Int_t * AliPHOSTrackSegment::GetPrimariesPpsdUp(Int_t & number) -{ - // Retrieves the primary particle(s) at the origin of the upper PPSD RecPoint - - AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ; - - Int_t * rv = 0 ; - number = 0 ; - if ( ppsdurp ) - rv = ppsdurp->GetPrimaries(number) ; - - return rv ; -} //____________________________________________________________________________ -void AliPHOSTrackSegment::GetPosition( TVector3 & pos ) -{ - // Returns position of the EMC RecPoint - - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - - TMatrix dummy ; - emcrp->GetGlobalPosition(pos, dummy) ; -} - - -//______________________________________________________________________________ -void AliPHOSTrackSegment::Paint(Option_t *) +void AliPHOSTrackSegment::Copy(TObject & obj) const { - // Paint this AliPHOSTrackSegment as a TMarker with its current attributes + // Copy of a track segment into another track segment - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ; - AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ; + 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] ; +} - TVector3 posemc(999., 999., 999.) ; - TVector3 posppsdl(999., 999., 999.) ; - TVector3 posppsdu(999., 999., 999.) ; - - emcrp->GetLocalPosition(posemc) ; - if (ppsdlrp !=0 ) - ppsdlrp->GetLocalPosition(posppsdl) ; - if (ppsdurp !=0 ) - ppsdurp->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, "") ; - } -} //____________________________________________________________________________ -void AliPHOSTrackSegment::Print(const char * opt) +void AliPHOSTrackSegment::Print(const Option_t *) const { // Print all information on this track Segment - AliPHOSEmcRecPoint * emcrp = GetEmcRecPoint() ; - AliPHOSPpsdRecPoint * ppsdlrp = GetPpsdLowRecPoint() ; - AliPHOSPpsdRecPoint * ppsdurp = GetPpsdUpRecPoint() ; - - TVector3 pos ; - TMatrix dummy ; - - cout << "--------AliPHOSTrackSegment-------- "<Print() ; - - emcrp->GetGlobalPosition( pos, dummy ) ; - - cout << " Global position " << pos.X() << " " << pos.Y() << " " << pos.Z() << " Energy " << emcrp->GetTotalEnergy() << endl ; - } - - if ( ppsdlrp != 0 ) { - cout << "******** PPSD Low Reconstructed Point: " << endl; - - ppsdlrp->Print() ; - ppsdlrp->GetGlobalPosition( pos , dummy ) ; - cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ; - } - if( ppsdurp != 0 ) { - cout << "******** PPSD Up Reconstructed Point: " << endl; - - ppsdurp->Print() ; - ppsdurp->GetGlobalPosition( pos, dummy ) ; - cout << " position " << pos.X() << " " << pos.Y() << " " << pos.Z() << endl ; - } - + 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::SetPpsdUpRecPoint(AliPHOSPpsdRecPoint * PpsdUpRecPoint) +void AliPHOSTrackSegment::SetCpvRecPoint(AliPHOSRecPoint * cpvRecPoint) { // gives an id from its position in the list - if( PpsdUpRecPoint ) - fPpsdUpRecPoint = PpsdUpRecPoint->GetIndexInList() ; + if( cpvRecPoint ) + fCpvRecPoint = cpvRecPoint->GetIndexInList() ; else - fPpsdUpRecPoint = -1 ; + fCpvRecPoint = -1 ; } +//____________________________________________________________________________ +Float_t AliPHOSTrackSegment::GetCpvDistance(const Option_t* dr) const +{ + 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. ; +}