Skip to content
Snippets Groups Projects
Commit bfe8ec60 authored by Niels Van Eldik's avatar Niels Van Eldik Committed by Graeme Stewart
Browse files

remove pointers (TrkVertexOnTrack-02-00-02)

parent 60593a0f
No related branches found
No related tags found
No related merge requests found
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRKVERTEXONTRACKDICT_H
#define TRKVERTEXONTRACKDICT_H
#include "TrkVertexOnTrack/VertexOnTrack.h"
//#include "TrkVertexOnTrack/VertexOnTrackMap.h"
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// VertexOnTrack.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef TRKVERTEXONTRACK_VERTEXONTRACK_H
#define TRKVERTEXONTRACK_VERTEXONTRACK_H
// Trk
#include "TrkMeasurementBase/MeasurementBase.h"
#include "TrkSurfaces/PerigeeSurface.h"
#include <ostream>
#include "GeoPrimitives/GeoPrimitives.h"
#include "EventPrimitives/EventPrimitives.h"
#include "TrkParameters/TrackParameters.h"
#include "GaudiKernel/GaudiException.h"
class MsgStream;
class TrackCollectionCnv;
namespace Trk{
class RecVertex;
/** @class VertexOnTrack
Class to handle Vertex On Tracks,
it inherits from the common MeasurementBase.
@author haertel@mppmu.mpg.de
*/
class VertexOnTrack : public MeasurementBase {
friend class ::TrackCollectionCnv;
public:
/** Default Constructor for POOL */
VertexOnTrack();
/** Copy Constructor */
VertexOnTrack(const VertexOnTrack& vot);
/** Assignment operator */
VertexOnTrack& operator=(const VertexOnTrack& vot);
/** Constructor with (LocalParameters&, LocalErrorMatrix&, PerigeeSurface&)
The associated PerigeeSurface is cloned*/
VertexOnTrack( const LocalParameters& locpars,
const Amg::MatrixX& locerr,
const PerigeeSurface& assocSurf);
/** Constructor from: RedVertex, Perigee - the perigee is needed for the measurement frame */
VertexOnTrack( const Trk::RecVertex& rvertex, const Trk::Perigee& mperigee) throw (GaudiException);
/** Destructor */
virtual ~VertexOnTrack();
/** Pseudo-constructor, needed to avoid excessive RTTI*/
VertexOnTrack* clone() const;
/** returns the surface for the local to global transformation
- interface from MeasurementBase */
const PerigeeSurface& associatedSurface() const;
/**Interface method to get the global Position
- interface from MeasurementBase */
const Amg::Vector3D& globalPosition() const;
/**returns the some information about this VertexOnTrack. */
virtual MsgStream& dump( MsgStream& out ) const;
/**returns the some information about this VertexOnTrack. */
virtual std::ostream& dump( std::ostream& out ) const;
// perhaps return Vertex Object
protected:
/** Perigee surface of the VoT*/
mutable const PerigeeSurface* m_associatedSurface;
/** Global position of the VoT*/
mutable const Amg::Vector3D* m_globalPosition;
};
inline VertexOnTrack* VertexOnTrack::clone() const
{ return new VertexOnTrack(*this); }
inline const PerigeeSurface& VertexOnTrack::associatedSurface() const
{ return *m_associatedSurface; }
inline const Amg::Vector3D& VertexOnTrack::globalPosition() const
{
if (m_globalPosition == 0) {m_globalPosition = new Amg::Vector3D();}
return *m_globalPosition;
}
}
#endif // TRKVERTEXONTRACK_VERTEXONTRACK_H
<lcgdict>
<class name="Trk::VertexOnTrack" >
<field name="m_globalPosition" transient="false" />
</class>
</lcgdict>
package TrkVertexOnTrack
author Roland Haertel <haertel -at- mppmu.mpg.de>
author Manuel Kayl <Manuel.Kayl -at- cern.ch>
author Andreas Salzburger < Andreas.Salzburger -at- cern.ch >
use AtlasPolicy AtlasPolicy-*
use TrkMeasurementBase TrkMeasurementBase-* Tracking/TrkEvent
use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr
use GaudiInterface GaudiInterface-* External
use TrkParameters TrkParameters-* Tracking/TrkEvent
use GeoPrimitives GeoPrimitives-* DetectorDescription
use EventPrimitives EventPrimitives-* Event
apply_pattern installed_library
library TrkVertexOnTrack *.cxx
private
#use AtlasReflex AtlasReflex-* External -no_auto_imports
use VxVertex VxVertex-* Tracking/TrkEvent
# Pattern to build the dict lib. User should create a single header
# file: <package>Dict.h which includes all other .h files. See MissingETDict
# A selection file must be created by hand. This file lists the
# classes to be added to the dictionary, and which fields are
# transient. It should be put in ../<package> dir and is conventionally called
# selection.xml.
#apply_pattern lcgdict dict=TrkVertexOnTrack selectionfile=selection.xml headerfiles="../TrkVertexOnTrack/TrkVertexOnTrackDict.h"
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage The VertexOnTrack class
@author haertel@mppmu.mpg.de
@section introductionTrkVertexOnTrack Introduction
Class to handle vertices as measurements in fitters and on track objects, it inherits from the common MeasurementBase.
Typically a VertexFinder is run to get the best possible VertexCandidates. A VertexOnTrack instance then needs to be
created for every track assoziated to a give VertexCandidate. Together with the hits from a track the VertexOnTrack
can then be used to fit a new track which has the vertex as constraining measurement.
This mechanism is e.g. used by the InnerDetector alignment approaches as one way to get vertexing information into
the alignment procedures.
@section used_packagesTrkVertexOnTrack Used Packages
@htmlinclude used_packages.html
@section requirements Requirements
@include requirements
@namespace Trk
A namespace to enclose the Tracking classes.
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// VertexOnTrack.cxx, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
//Trk
#include "TrkVertexOnTrack/VertexOnTrack.h"
#include "VxVertex/RecVertex.h"
// Gaudi & AthenaCommon
#include "GaudiKernel/MsgStream.h"
#include <string>
#include <typeinfo>
// Constructor with parameters:
Trk::VertexOnTrack::VertexOnTrack( const LocalParameters& locpars,
const Amg::MatrixX& locerr,
const PerigeeSurface& assocSurf) :
Trk::MeasurementBase(locpars,locerr),
m_associatedSurface(assocSurf.clone()),
m_globalPosition(0)
{
}
// Constructor with parameters:
Trk::VertexOnTrack::VertexOnTrack( const Trk::RecVertex& rvertex,
const Trk::Perigee& perigee ) throw (GaudiException) :
Trk::MeasurementBase(),
m_associatedSurface(perigee.associatedSurface().clone()),
m_globalPosition(new Amg::Vector3D(perigee.position()))
{
if ( (rvertex.position()-perigee.associatedSurface().center()).mag() > 10e-5 )
throw GaudiException("Inconsistent input data, Perigee not expressed at vertex!","Trk::VertexOnTrack", StatusCode::RECOVERABLE);
// the local parameters are by definition at (0,0)
Amg::Vector2D localPosition(0,0);
m_localParams = Trk::LocalParameters(localPosition);
// transform Cartesian (x,y,z) to perigee (d0,z0)
Amg::MatrixX jacobian(2,3);
jacobian.setZero();
double ptInv = 1./perigee.momentum().perp();
jacobian(0,0) = -ptInv*perigee.momentum().y();
jacobian(0,1) = ptInv*perigee.momentum().x();
jacobian(1,2) = 1.0;
// the covariance on matrix of the vertex
const Amg::MatrixX& vtxCov = rvertex.covariancePosition();
// the local coordinate
m_localCovariance = vtxCov.similarity(jacobian);
}
// Destructor:
Trk::VertexOnTrack::~VertexOnTrack()
{
delete m_associatedSurface;
delete m_globalPosition;
}
// default constructor:
Trk::VertexOnTrack::VertexOnTrack() :
Trk::MeasurementBase(),
m_associatedSurface(0),
m_globalPosition(0)
{}
// copy constructor:
Trk::VertexOnTrack::VertexOnTrack( const Trk::VertexOnTrack& vot) :
Trk::MeasurementBase(vot),
m_associatedSurface( new Trk::PerigeeSurface(*vot.m_associatedSurface) ),
m_globalPosition(0)
{}
// assignment operator:
Trk::VertexOnTrack& Trk::VertexOnTrack::operator=(const VertexOnTrack& vot)
{
if ( &vot != this) {
delete m_associatedSurface;
delete m_globalPosition;
Trk::MeasurementBase::operator=(vot);
m_globalPosition = 0;
m_associatedSurface = new Trk::PerigeeSurface(*vot.m_associatedSurface);
}
return *this;
}
MsgStream& Trk::VertexOnTrack::dump( MsgStream& sl ) const
{
std::string name(typeid(*this).name());
sl << "Concrete dump method not implemented - using base class" << std::endl;
sl << name << "\t local position = "<< this->localParameters() << std::endl;
sl << name << "\t global position ( " << this->globalPosition().x() << " , "
<< this->globalPosition().y() << " , "
<< this->globalPosition().z() << " ) " << std::endl;
sl << name << "\t has Error Matrix: " << std::endl;
sl << this->localCovariance() << std::endl;
sl << name << "\t has associated surface:" << std::endl;
sl<< this->associatedSurface() << std::endl;
return sl;
}
std::ostream& Trk::VertexOnTrack::dump( std::ostream& sl ) const
{
std::string name(typeid(*this).name());
sl << "Concrete dump method not implemented - using base class" << std::endl;
sl << name << "\t local position = "<< this->localParameters() << std::endl;
sl << name << "\t global position ( " << this->globalPosition().x() << " , "
<< this->globalPosition().y() << " , "
<< this->globalPosition().z() << " ) " << std::endl;
sl << name << "\t has Error Matrix: " << std::endl;
sl << this->localCovariance() << std::endl;
sl << name << "\t has associated surface:" << std::endl;
sl<< this->associatedSurface() << std::endl;
return sl;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment