Skip to content
Snippets Groups Projects

Remove Field Svc in TrackParticleCreator

Merged Abdelilah Moussa requested to merge ATLAS-EGamma/athena:TrackParticleCreator into master
3 files
+ 163
156
Compare changes
  • Side-by-side
  • Inline
Files
3
@@ -14,6 +14,7 @@ changes : 11.02.04 added docu
#ifndef TRKPARTICLECREATOR_PARTICLECREATORTOOL_H
#define TRKPARTICLECREATOR_PARTICLECREATORTOOL_H
#include "GaudiKernel/EventContext.h"
#include "TrkToolInterfaces/ITrackParticleCreatorTool.h"
#include "AthenaBaseComps/AthAlgTool.h"
@@ -21,7 +22,6 @@ changes : 11.02.04 added docu
#include "EventPrimitives/EventPrimitivesHelpers.h"
#include "InDetIdentifier/PixelID.h"
#include "ITrackToVertex/ITrackToVertex.h"
#include "MagFieldInterfaces/IMagFieldSvc.h"
#include "MuonRecToolInterfaces/IMuonHitSummaryTool.h"
#include "PixelGeoModel/IBLParameterSvc.h"
#include "TrkEventPrimitives/FitQuality.h"
@@ -38,6 +38,9 @@ changes : 11.02.04 added docu
#include "xAODTracking/VertexFwd.h"
#include "GaudiKernel/ToolHandle.h"
// MagField cache
#include "MagFieldConditions/AtlasFieldCacheCondObj.h"
#include "MagFieldElements/AtlasFieldCache.h"
namespace Rec
{
@@ -69,8 +72,8 @@ class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreato
@param track Pointer to a valid track (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted)
@param vxCandidate Pointer to a valid vxCandidate (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted)
@param bsdata BeamSpot data - can be obtained with CondHandle or from a tool.
@param prtOrigin
@warning In my opinion, the interface is not optimal - we're not taking ownership of the Trk::Track or Vx::Candidate,
@param prtOrigin
@warning In my opinion, the interface is not optimal - we're not taking ownership of the Trk::Track or Vx::Candidate,
so they should be passed by reference.
*/
virtual
@@ -79,7 +82,7 @@ class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreato
Trk::TrackParticleOrigin prtOrigin) const override;
/** Method to construct a xAOD::TrackParticle from a Rec::TrackParticle.
@param track particle
@param track particle
@param TrackParticleContainer needed to have an AuxStore, if provided particle will be added to store which takes ownership
*/
virtual
@@ -118,8 +121,8 @@ class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreato
/** create a xAOD::TrackParticle out of constituents */
virtual
xAOD::TrackParticle* createParticle( const Perigee* perigee, const FitQuality* fq, const TrackInfo* trackInfo, const TrackSummary* summary,
const std::vector<const Trk::TrackParameters*>& parameters,
const std::vector< xAOD::ParameterPosition>& positions,
const std::vector<const Trk::TrackParameters*>& parameters,
const std::vector< xAOD::ParameterPosition>& positions,
xAOD::ParticleHypothesis prtOrigin,
xAOD::TrackParticleContainer* container ) const override;
@@ -145,48 +148,50 @@ class TrackParticleCreatorTool : public extends<AthAlgTool, ITrackParticleCreato
void setNumberOfUsedHits(xAOD::TrackParticle& tp, int hits) const;
void setNumberOfOverflowHits(xAOD::TrackParticle& tp, int overflows) const;
/** Get the name used for the decoration of the track particle with the number of used hits for TRT dE/dx computation.*/
static const std::string & trtdEdxUsedHitsAuxName() { return s_trtdEdxUsedHitsDecorationName; }
virtual const InDet::BeamSpotData* CacheBeamSpotData(const ::EventContext &ctx) const override;
private:
void compare( const Rec::TrackParticle& tp, const xAOD::TrackParticle& tpx ) const;
void compare( const Rec::TrackParticle& tp, const xAOD::TrackParticle& tpx ) const;
void compare( const TrackParameters& tp1, const TrackParameters& tp2 ) const;
/**atlas id helper*/
const AtlasDetectorID* m_detID;
const PixelID* m_pixelID;
//Need to change to private when is safe to do so
PublicToolHandle<IExtendedTrackSummaryTool> m_trackSummaryTool{this,
"TrackSummaryTool","Trk::TrackSummaryTool/AtlasTrackSummaryTool"};
PublicToolHandle<IExtrapolator> m_extrapolator{this,
"Extrapolator","Trk::Extrapolator/AtlasExtrapolator"};
ToolHandle<Reco::ITrackToVertex> m_trackToVertex{this,
"TrackToVertex","Reco::TrackToVertex/TrackToVertex"};
ToolHandle<Muon::IMuonHitSummaryTool> m_hitSummaryTool{this,
"MuonSummaryTool","Muon::MuonHitSummaryTool/MuonHitSummaryTool"};
/** to query magnetic field configuration */
ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc;
//ServiceHandle<MagField::IMagFieldSvc> m_magFieldSvc;
ServiceHandle <IBLParameterSvc> m_IBLParameterSvc;
SG::ReadCondHandleKey<AtlasFieldCacheCondObj> m_fieldCacheCondObjInputKey {this, "AtlasFieldCacheCondObj", "fieldCondObj",
"Name of the Magnetic Field conditions object key"};
/** Configurable to set the eProbabilities and extra track summary types which are to be copied from the track summary.*/
std::vector<std::string> m_copyExtraSummaryName;
/** Enums of an eProbability which are set in the xAOD::TrackSummary.*/
std::vector<Trk::eProbabilityType> m_copyEProbabilities;
std::vector<Trk::eProbabilityType> m_copyEProbabilities;
/** The pairs if enums of an eProbability which is added as a decoration to the track particle and the name of the decoration.*/
std::vector<std::pair<SG::AuxElement::Decorator<float>,Trk::eProbabilityType> > m_decorateEProbabilities;
std::vector<std::pair<SG::AuxElement::Decorator<uint8_t>,Trk::SummaryType> > m_decorateSummaryTypes;
std::vector<std::pair<SG::AuxElement::Decorator<float>,Trk::eProbabilityType> > m_decorateEProbabilities;
std::vector<std::pair<SG::AuxElement::Decorator<uint8_t>,Trk::SummaryType> > m_decorateSummaryTypes;
/** Name used for the decoration of the track particle with TRT dE/dx .*/
static const std::string s_trtdEdxUsedHitsDecorationName;
static const SG::AuxElement::Decorator<uint8_t> s_trtdEdxUsedHitsDecoration;
@@ -205,14 +210,14 @@ private:
(e.g. adding those that may exist at Volume boundaries) */
bool m_expressPerigeeToBeamSpot;
int m_badclusterID;
std::string m_perigeeExpression;
std::vector<std::string> m_perigeeOptions{"BeamLine", "BeamSpot", "Vertex", "Origin"};
std::vector<std::string> m_perigeeOptions{"BeamLine", "BeamSpot", "Vertex", "Origin"};
bool m_checkConversion;
int m_minSiHits;
double m_minPt;
bool castPerigeeAndCheck(const Trk::Track* track, const Trk::Perigee* &aPer) const;
bool m_updateTrack;
};
@@ -230,7 +235,7 @@ inline void TrackParticleCreatorTool::setTrackInfo( xAOD::TrackParticle& tp, con
uint64_t patternReco=0;
const uint64_t c1=1;
for (unsigned int i = 0; i< xAOD::NumberOfTrackRecoInfo ; i++){
for (unsigned int i = 0; i< xAOD::NumberOfTrackRecoInfo ; i++){
if (trackInfo.patternRecoInfo(static_cast<Trk::TrackInfo::TrackPatternRecoInfo>(i))) patternReco |= c1 << i;
}
@@ -249,13 +254,13 @@ inline void TrackParticleCreatorTool::setDefiningParameters( xAOD::TrackParticle
perigee.parameters()[Trk::theta],
perigee.parameters()[Trk::qOverP]);
const AmgSymMatrix(5)* covMatrix = perigee.covariance();
// see https://its.cern.ch/jira/browse/ATLASRECTS-645 for justification to comment out the following line
// assert(covMatrix && covMatrix->rows()==5&& covMatrix->cols()==5);
// see https://its.cern.ch/jira/browse/ATLASRECTS-645 for justification to comment out the following line
// assert(covMatrix && covMatrix->rows()==5&& covMatrix->cols()==5);
std::vector<float> covMatrixVec;
if( !covMatrix ) ATH_MSG_WARNING("Setting Defining parameters without error matrix");
else Amg::compress(*covMatrix,covMatrixVec);
tp.setDefiningParametersCovMatrixVec(covMatrixVec);
const Amg::Vector3D& surfaceCenter = perigee.associatedSurface().center();
const Amg::Vector3D& surfaceCenter = perigee.associatedSurface().center();
tp.setParametersOrigin(surfaceCenter.x(), surfaceCenter.y(), surfaceCenter.z() );
}
Loading