24 const IInterface* parent)
28 declareInterface<ITruthToTrack>(
this);
41 return StatusCode::SUCCESS;
47 if (part ==
nullptr)
return nullptr;
51 prodVertexVector.setZero();
58 if (trackRecordCollection.
isValid()) {
62 ATH_MSG_DEBUG(
"reading from track record, size=" << trackRecordCollection->size());
64 if (trackRecordCollection->empty())
ATH_MSG_WARNING (
"action required but TrackRecordCollection size is 0");
66 for (
const auto & trackRecord : *trackRecordCollection) {
70 id = trackRecord.GetPDGCode();
72 CLHEP::Hep3Vector tv = trackRecord.GetPosition();
74 globalPos = prodVertexVector;
76 Amg::Vector3D hv2(trackRecord.GetMomentum().x(), trackRecord.GetMomentum().y(),
77 trackRecord.GetMomentum().z());
80 ATH_MSG_DEBUG(
"Found particle " << part <<
", momentum " << hv2 <<
" production " << globalPos);
90 prodVertexVector.z() );
92 Amg::Transform3D tmpTransf = prodSurfaceCentre * Amg::RotationMatrix3D::Identity();
107 if (part ==
nullptr)
return nullptr;
118 if (trackRecordCollection.
isValid()) {
123 ATH_MSG_DEBUG(
"reading from track record, size=" << trackRecordCollection->size());
125 if (trackRecordCollection->empty())
ATH_MSG_WARNING (
"action required but TrackRecordCollection size is 0");
127 for (
const auto & trackRecord : *trackRecordCollection) {
129 id = trackRecord.GetPDGCode();
131 CLHEP::Hep3Vector tv = trackRecord.GetPosition();
133 globalPos = prodVertexVector;
134 Amg::Vector3D hv2(trackRecord.GetMomentum().x(), trackRecord.GetMomentum().y(), trackRecord.GetMomentum().z());
136 ATH_MSG_DEBUG(
"found particle " << part <<
", momentum " << hv2 <<
" production " << globalPos);
144 prodVertexVector.y(),
145 prodVertexVector.z() );
147 Amg::Transform3D tmpTransf = prodSurfaceCentre * Amg::RotationMatrix3D::Identity();
166 MsgStream log(msgSvc(), name());
169 if(productionVertexTrackParams) {
173 generatedTrackPerigee =
174 m_extrapolator->extrapolateDirectly(Gaudi::Hive::currentContext(),
175 *productionVertexTrackParams,
183 return generatedTrackPerigee;
192 MsgStream log(msgSvc(), name());
195 if(productionVertexTrackParams) {
199 generatedTrackPerigee =
200 m_extrapolator->extrapolateDirectly(Gaudi::Hive::currentContext(),
201 *productionVertexTrackParams,
209 return generatedTrackPerigee;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
double charge(const T &p)
ATLAS-specific HepMC functions.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Class describing the Line to which the Perigee refers to.
Class for a planaer rectangular or trapezoidal surface in the ATLAS detector.
ToolHandle< Trk::IExtrapolator > m_extrapolator
SG::ReadHandleKey< TrackRecordCollection > m_reccollkey
TruthTrackRecordToTrack(const std::string &type, const std::string &name, const IInterface *parent)
virtual StatusCode initialize()
virtual const Trk::TrackParameters * makeProdVertexParameters(HepMC::ConstGenParticlePtr part) const
This function produces a Trk::TrackParameters object corresponding to the HepMC::GenParticle at the p...
virtual const Trk::TrackParameters * makePerigeeParameters(HepMC::ConstGenParticlePtr part) const
This function extrapolates track to the perigee, and returns perigee parameters.
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 3, 1 > Vector3D
Eigen::Translation< double, 3 > Translation3D
bool is_same_particle(const T1 &p1, const T2 &p2)
Method to establish if two particles in the GenEvent actually represent the same particle.
const GenParticle * ConstGenParticlePtr
double charge(const T &p)
ParametersBase< TrackParametersDim, Charged > TrackParameters
ParametersT< TrackParametersDim, Charged, PlaneSurface > AtaPlane
TruthParticle_v1 TruthParticle
Typedef to implementation.