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 {
public:
/** Default Constructor for POOL */
CaloCluster_OnTrack();
/** 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;
protected:
/** 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
}//Namespace
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
*/
#ifndef TRKCALOCLUSTERONTRACKDICT_H
#define TRKCALOCLUSTERONTRACKDICT_H
#include "TrkCaloCluster_OnTrack/CaloCluster_OnTrack.h"
#endif
<lcgdict>
<class name = "Trk::CaloCluster_OnTrack" >
<field name = "m_surface" transient="false" />
<field name = "m_globalpos" transient="true" />
<field name = "m_eloss" transient="false" />
</class>
</lcgdict>
package TrkCaloCluster_OnTrack
author Anthony Morley <a.morley@cern.ch>
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
private
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
*/
//CaloCluster_OnTrack.cxx
//Trk
#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_globalpos(0),
m_eloss(eloss)
{
m_surface = surface.isFree() ? surface.clone() : &surface;
this->globalPosition();
}
// Destructor:
Trk::CaloCluster_OnTrack::~CaloCluster_OnTrack()
{
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() :
m_surface(0),
m_globalpos(0),
m_eloss(0)
{
}
// copy constructor:
Trk::CaloCluster_OnTrack::CaloCluster_OnTrack( const Trk::CaloCluster_OnTrack& cot) :
Trk::MeasurementBase(cot),
m_globalpos( 0 )
{
m_surface= cot.m_surface? (cot.m_surface->isFree() ? cot.m_surface->clone():cot.m_surface) : 0;
this->globalPosition();
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;
Trk::MeasurementBase::operator=(cot);
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
{
if(!m_globalpos){
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;
sl<<localCovariance()<<"}"<<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;
sl<<localCovariance()<<"}"<<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