Commit 60593a0f authored by Niels Van Eldik's avatar Niels Van Eldik Committed by Graeme Stewart
Browse files

remove constructors taking pointers (TrkCaloCluster_OnTrack-01-00-02)

parent 2346b543
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#ifndef TRKCaloCluster_OnTrack_H
#define TRKCaloCluster_OnTrack_H
// Trk
#include "TrkMeasurementBase/MeasurementBase.h"
//#include "TrkEventPrimitives/GlobalPosition.h"
#include "EventPrimitives/EventPrimitives.h"
#include "GeoPrimitives/GeoPrimitives.h"
#include <ostream>
class MsgStream;
namespace Trk {
class Surface;
class EnergyLoss;
/** @class CaloCluster_OnTrack
Class to handle Cluster On Tracks (ROT) for CaloClusters,
it inherits from the common MeasurementBase.
The Track holds a vector of TrackStateOnSurface
that carry the MeasurmentBase class pointers.
class CaloCluster_OnTrack : public MeasurementBase {
/** Default Constructor for POOL */
/** Copy Constructor */
CaloCluster_OnTrack(const CaloCluster_OnTrack& cot);
/** Assignment operator */
CaloCluster_OnTrack& operator=(const CaloCluster_OnTrack& cot);
/** Constructor with parameters LocalParameters*, LocalErrorMatrix*, Surface&
This class owns the LocalParameters, ErrorMatrix & EnergyLoss. A copy of the
surface will be made if it is not owned by a detector element. */
CaloCluster_OnTrack( const LocalParameters& locpars,
const Amg::MatrixX& locerr,
const Surface& surf,
const EnergyLoss* eloss = 0);
/** Destructor */
virtual ~CaloCluster_OnTrack();
/** Pseudo-constructor, needed to avoid excessive RTTI*/
virtual CaloCluster_OnTrack* clone() const;
/** returns the surface for the local to global transformation
- interface from MeasurementBase */
virtual const Surface& associatedSurface() const;
/** Interface method to get the global Position
- interface from MeasurementBase */
virtual const Amg::Vector3D& globalPosition() const;
/** Extended method to get the EnergyLoss */
virtual const Trk::EnergyLoss* energyLoss() const;
/**returns the some information about this RIO_OnTrack. */
virtual MsgStream& dump( MsgStream& out ) const;
/**returns the some information about this RIO_OnTrack. */
virtual std::ostream& dump( std::ostream& out ) const;
/** Surface associated to the measurement*/
mutable const Surface* m_surface;
/** global position of the cluster hit*/
mutable const Amg::Vector3D* m_globalpos;
/** Energy Loss */
mutable const Trk::EnergyLoss* m_eloss;
};//End of Class
inline const Trk::Surface& Trk::CaloCluster_OnTrack::associatedSurface() const
{ return *m_surface; }
inline const Trk::EnergyLoss* Trk::CaloCluster_OnTrack::energyLoss() const
{ return m_eloss; }
#endif //TRKCaloCluster_OnTrack_H
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#include "TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h"
<class name = "Trk::CaloCluster_OnTrack" >
<field name = "m_surface" transient="false" />
<field name = "m_globalpos" transient="true" />
<field name = "m_eloss" transient="false" />
package TrkCaloCluster_OnTrack
author Anthony Morley <>
use AtlasPolicy AtlasPolicy-*
#use TrkEventPrimitives TrkEventPrimitives-* Tracking/TrkEvent
use EventPrimitives EventPrimitives-* Event
use GeoPrimitives GeoPrimitives-* DetectorDescription
use TrkMeasurementBase TrkMeasurementBase-* Tracking/TrkEvent
#use CLIDSvc CLIDSvc-* Control
#use DataModel DataModel-* Control
library TrkCaloCluster_OnTrack *.cxx
apply_pattern installed_library
use TrkMaterialOnTrack TrkMaterialOnTrack-* Tracking/TrkEvent
use TrkSurfaces TrkSurfaces-* Tracking/TrkDetDescr
#use AtlasReflex AtlasReflex-* External
use GaudiInterface GaudiInterface-* External
#apply_pattern lcgdict dict=TrkCaloCluster_OnTrack selectionfile=selection.xml headerfiles="../TrkCaloCluster_OnTrack/TrkCaloCluster_OnTrackDict.h"
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
#include "TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h"
//#include "TrkEventPrimitives/LocalParameters.h"
#include "TrkSurfaces/Surface.h"
#include "TrkMaterialOnTrack/EnergyLoss.h"
// Gaudi & AthenaCommon
#include "GaudiKernel/MsgStream.h"
#include <string>
Trk::CaloCluster_OnTrack::CaloCluster_OnTrack( const Trk::LocalParameters& locpars,
const Amg::MatrixX& locerr,
const Trk::Surface& surface,
const Trk::EnergyLoss* eloss)
: MeasurementBase(locpars,locerr),
m_surface = surface.isFree() ? surface.clone() : &surface;
// Destructor:
if (m_globalpos) delete m_globalpos;
if (m_surface && m_surface->isFree()) delete m_surface; // Don't delete surfaces belonging to DEs!
if (m_eloss) delete m_eloss;
// default constructor:
Trk::CaloCluster_OnTrack::CaloCluster_OnTrack() :
// copy constructor:
Trk::CaloCluster_OnTrack::CaloCluster_OnTrack( const Trk::CaloCluster_OnTrack& cot) :
m_globalpos( 0 )
m_surface= cot.m_surface? (cot.m_surface->isFree() ? cot.m_surface->clone():cot.m_surface) : 0;
m_eloss= cot.m_eloss ? new Trk::EnergyLoss(*cot.m_eloss) : 0 ;
Trk::CaloCluster_OnTrack* Trk::CaloCluster_OnTrack::clone() const
return new Trk::CaloCluster_OnTrack ( *this );
// assignment operator:
Trk::CaloCluster_OnTrack& Trk::CaloCluster_OnTrack::operator=(const Trk::CaloCluster_OnTrack& cot)
if ( &cot != this) {
delete m_surface;
delete m_globalpos;
if(m_eloss) delete m_eloss;
m_surface = (cot.m_surface? (cot.m_surface->isFree() ? cot.m_surface->clone():cot.m_surface) : 0);
m_globalpos = new Amg::Vector3D(*cot.m_globalpos);
m_eloss = cot.m_eloss ? new Trk::EnergyLoss(*cot.m_eloss) :0;
return *this;
const Amg::Vector3D& Trk::CaloCluster_OnTrack::globalPosition() const
m_globalpos = m_surface->localToGlobal(m_localParams);
return *m_globalpos;
MsgStream& Trk::CaloCluster_OnTrack::dump( MsgStream& sl ) const
sl << "Trk::CaloCluster_OnTrack { "<<endreq;
sl << "\t surface = "<< associatedSurface()<<endreq;
sl << "\t position = ("
<< localParameters()
<< endreq;
sl << "\t has Error Matrix: "<<endreq;
return sl;
std::ostream& Trk::CaloCluster_OnTrack::dump( std::ostream& sl ) const
sl << "\t surface = "<< associatedSurface()<<endreq;
sl << "\t position = ("
<< localParameters()
<< endreq;
sl << "\t has Error Matrix: "<<endreq;
return sl;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment