ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::TrackParticleCreatorTool Class Referencefinal

#include <TrackParticleCreatorTool.h>

Inheritance diagram for Trk::TrackParticleCreatorTool:

Public Member Functions

 TrackParticleCreatorTool (const std::string &, const std::string &, const IInterface *)
virtual ~TrackParticleCreatorTool ()=default
virtual StatusCode initialize () override
virtual xAOD::TrackParticlecreateParticle (const EventContext &ctx, const Rec::TrackParticle &trackParticle, xAOD::TrackParticleContainer *container) const override final
 Method to construct a xAOD::TrackParticle from a Rec::TrackParticle.
virtual xAOD::TrackParticlecreateParticle (const EventContext &ctx, const Trk::Track &track, xAOD::TrackParticleContainer *container, const xAOD::Vertex *vxCandidate, xAOD::ParticleHypothesis prtOrigin) const override final
 Method to construct a xAOD::TrackParticle from a passed Track.
virtual xAOD::TrackParticlecreateParticle (const EventContext &ctx, const ElementLink< TrackCollection > &trackLink, xAOD::TrackParticleContainer *container, const xAOD::Vertex *vxCandidate, xAOD::ParticleHypothesis prtOrigin) const override final
 Method to construct a TrackParticle from a passed Track.
virtual xAOD::TrackParticlecreateParticle (const EventContext &ctx, 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, xAOD::ParticleHypothesis prtOrigin, xAOD::TrackParticleContainer *container) const override final
 create a xAOD::TrackParticle out of constituents
virtual const InDet::BeamSpotDataCacheBeamSpotData (const EventContext &ctx) const override final
void setFitQuality (xAOD::TrackParticle &tp, const FitQuality &fq) const
 Method to set FitQuality of a xAOD::TrackParticle.
void setTrackInfo (xAOD::TrackParticle &tp, const TrackInfo &trackInfo, xAOD::ParticleHypothesis prtOrigin) const
 Method to set TrackInfo of a xAOD::TrackParticle.
void setTrackSummary (xAOD::TrackParticle &tp, const TrackSummary &summary) const
 Method to set TrackSummary of a xAOD::TrackParticle.
void addPIDInformation (const EventContext &ctx, const Track *track, xAOD::TrackParticle &tp) const
 Add Pixel and TRT PID information to the track particle.
void addDetailedHitInformation (const Trk::TrackStates *trackStates, xAOD::TrackParticle &tp) const
 Add extra detailed hit summary info not computed in Trk::TrkSummary.
void addExpectedHitInformation (const Perigee *perigee, xAOD::TrackParticle &tp) const
 Add expected hit info for innermost pixel layers not computed in Trk::TrkSummary.
void addOutlierHitInformation (const Trk::TrackStates *trackStates, xAOD::TrackParticle &tp) const
 Add outlier hit info not computed in Trk::TrkSummary anymore.
void addSharedHitInformation (const Track *track, xAOD::TrackParticle &tp) const
 Add shared hit info not computed in Trk::TrkSummary anymore.
void setDefiningParameters (xAOD::TrackParticle &tp, const Perigee &perigee) const
 Method to set Defining parameters of a xAOD::TrackParticle.
void setParameters (const EventContext &ctx, xAOD::TrackParticle &tp, const std::vector< const Trk::TrackParameters * > &parameters, const std::vector< xAOD::ParameterPosition > &positions) const
 Method to set parameters of a xAOD::TrackParticle.

Static Public Member Functions

static void addDummyEndcapSharedHitInformation (xAOD::TrackParticle &tp)
 Add dummy endcap shared hit info as AuxDyn variable in case nominal shared hit info not computed (for ITk fast tracking).
static void setTilt (xAOD::TrackParticle &tp, float tiltx, float tilty)
static void setHitPattern (xAOD::TrackParticle &tp, unsigned long hitpattern)
static void setNumberOfUsedHits (xAOD::TrackParticle &tp, int hits)
static void setNumberOfOverflowHits (xAOD::TrackParticle &tp, int overflows)
static const std::string & trtdEdxUsedHitsAuxName ()
 Get the name used for the decoration of the track particle with the number of used hits for TRT dE/dx computation.

Protected Member Functions

xAOD::TrackParticlecreateParticle (const EventContext &ctx, 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, xAOD::ParticleHypothesis prtOrigin, xAOD::TrackParticleContainer *container, const Trk::Track *track) const
 create a xAOD::TrackParticle out of constituents

Private Member Functions

void compare (const Rec::TrackParticle &tp, const xAOD::TrackParticle &tpx) const
void compare (const TrackParameters &tp1, const TrackParameters &tp2) const
const Trk::ClusterSplitProbabilityContainer::ProbabilityInfogetClusterSplittingProbability (const InDet::PixelCluster *pix) const

Private Attributes

const AtlasDetectorIDm_detID
 atlas id helper
const PixelIDm_pixelID
const SCT_IDm_sctID
const TRT_IDm_trtID
PublicToolHandle< IExtendedTrackSummaryToolm_trackSummaryTool
ToolHandle< Reco::ITrackToVertexm_trackToVertex
ToolHandle< Muon::IMuonHitSummaryToolm_hitSummaryTool
ServiceHandle< IIBLParameterSvcm_IBLParameterSvc
ServiceHandle< ITrackingVolumesSvcm_trackingVolumesSvc {this,"TrackingVolumesSvc","Trk::TrackingVolumesSvc/TrackingVolumesSvc"}
SG::ReadCondHandleKey< AtlasFieldCacheCondObjm_fieldCacheCondObjInputKey
ToolHandle< ITRT_ElectronPidToolm_eProbabilityTool
 tool to calculate electron probabilities
ToolHandle< IPixelToTPIDToolm_dedxtool { this, "PixelToTPIDTool", "", "" }
 tool to calculate dE/dx using pixel clusters
ToolHandle< InDet::IInDetTestPixelLayerToolm_testPixelLayerTool
 tool to calculate expected hit information in innermost layers
StringArrayProperty m_copyExtraSummaryName
 Configurable to set the eProbabilities and extra track summary types which are to be copied from the track summary.
std::vector< Trk::eProbabilityTypem_copyEProbabilities
 Enums of an eProbability which are set in the xAOD::TrackSummary.
std::vector< std::pair< SG::AuxElement::Accessor< float >, Trk::eProbabilityType > > m_decorateEProbabilities
 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::Accessor< uint8_t >, Trk::SummaryType > > m_decorateSummaryTypes
bool m_doIBL
BooleanProperty m_doITk {this, "DoITk", false}
 if the track contains a summary, the shared, expected hit, and PID information will be recomputed.
BooleanProperty m_computeAdditionalInfo {this, "ComputeAdditionalInfo", false}
BooleanProperty m_doSharedSiHits {this, "DoSharedSiHits", false}
BooleanProperty m_doSharedTRTHits {this, "DoSharedTRTHits", false}
BooleanProperty m_runningTIDE_Ambi {this, "RunningTIDE_Ambi", false}
BooleanProperty m_updateTrackSummary {this, "UpdateTrackSummary", false}
BooleanProperty m_keepParameters {this, "KeepParameters", false}
 the following keep options are mutually exclusive
BooleanProperty m_keepFirstParameters {this, "KeepFirstParameters", false}
BooleanProperty m_keepAllPerigee {this, "KeepAllPerigee", false}
 keep all MeasuredPerigee parameters (e.g.
IntegerProperty m_badclusterID {this, "BadClusterID", 0}
StringProperty m_perigeeExpression {this, "PerigeeExpression", "BeamLine"}
std::vector< std::string > m_perigeeOptions
BooleanProperty m_checkConversion {this, "CheckConversion", true}
IntegerProperty m_minSiHits {this, "MinSiHitsForCaloExtrap", 4}
DoubleProperty m_minPt {this, "MinPtForCaloExtrap", 1000.}
SG::ReadCondHandleKey< InDet::BeamSpotDatam_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
SG::ReadHandleKey< Trk::ClusterSplitProbabilityContainerm_clusterSplitProbContainer { this, "ClusterSplitProbabilityName", "", "" }
SG::ReadHandleKey< Trk::PRDtoTrackMapm_assoMapContainer { this, "AssociationMapName", ""}
Gaudi::Property< int > m_itkDecorationLevel {this, "ITkDecorationLevel", 1, ">=200 split counts for inclined and flat barrel." }

Static Private Attributes

static const std::string s_trtdEdxUsedHitsDecorationName { "TRTdEdxUsedHits" }
 Name used for the decoration of the track particle with TRT dE/dx .
static const SG::AuxElement::Accessor< uint8_t > s_trtdEdxUsedHitsDecoration
static constexpr int s_expertLevel = 200

Detailed Description

Definition at line 71 of file TrackParticleCreatorTool.h.

Constructor & Destructor Documentation

◆ TrackParticleCreatorTool()

Trk::TrackParticleCreatorTool::TrackParticleCreatorTool ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 110 of file TrackParticleCreatorTool.cxx.

113 : base_class(t, n, p)
114 , m_detID(nullptr)
115 , m_pixelID(nullptr)
116 , m_sctID(nullptr)
117 , m_trtID(nullptr)
121 , m_doIBL(false)
122{
123}
std::vector< Trk::eProbabilityType > m_copyEProbabilities
Enums of an eProbability which are set in the xAOD::TrackSummary.
const AtlasDetectorID * m_detID
atlas id helper
std::vector< std::pair< SG::AuxElement::Accessor< float >, Trk::eProbabilityType > > m_decorateEProbabilities
The pairs if enums of an eProbability which is added as a decoration to the track particle and the na...
std::vector< std::pair< SG::AuxElement::Accessor< uint8_t >, Trk::SummaryType > > m_decorateSummaryTypes

◆ ~TrackParticleCreatorTool()

virtual Trk::TrackParticleCreatorTool::~TrackParticleCreatorTool ( )
virtualdefault

Member Function Documentation

◆ addDetailedHitInformation()

void Trk::TrackParticleCreatorTool::addDetailedHitInformation ( const Trk::TrackStates * trackStates,
xAOD::TrackParticle & tp ) const

Add extra detailed hit summary info not computed in Trk::TrkSummary.

Definition at line 1000 of file TrackParticleCreatorTool.cxx.

1001{
1002
1003 Trk::DetailedHitInfo detailedInfo;
1004
1005 for (const TrackStateOnSurface* tsos : *trackStates) {
1006
1007 const Trk::MeasurementBase* mesb = tsos->measurementOnTrack();
1008 if(mesb==nullptr) continue;
1009 // Check if the measurement type is RIO on Track (ROT)
1010 const RIO_OnTrack* rot = nullptr;
1012 rot = static_cast<const RIO_OnTrack*>(mesb);
1013 }
1014 if(rot==nullptr) continue;
1015
1016 const Identifier& id = rot->identify();
1017 if(!m_pixelID->is_pixel(id)) continue;
1018
1019 Trk::DetectorRegion region;
1020 const InDetDD::SiDetectorElement* detEl = static_cast<const InDetDD::SiDetectorElement*>(rot->detectorElement());
1023 else if(type==InDetDD::PixelBarrel) region = Trk::pixelBarrelFlat;
1024 else region = Trk::pixelEndcap;
1025
1026 detailedInfo.addHit(region, m_pixelID->layer_disk(id), m_pixelID->eta_module(id));
1027
1028 }
1029
1030 uint8_t nContribPixelLayers = static_cast<uint8_t>(detailedInfo.getPixelContributions());
1031
1032 uint8_t nContribPixelBarrelFlatLayers = static_cast<uint8_t>(detailedInfo.getContributionFromRegion(Trk::pixelBarrelFlat ));
1033 uint8_t nContribPixelBarrelInclinedLayers = static_cast<uint8_t>(detailedInfo.getContributionFromRegion(Trk::pixelBarrelInclined));
1034 uint8_t nContribPixelBarrelLayers = static_cast<uint8_t>(nContribPixelBarrelFlatLayers+nContribPixelBarrelInclinedLayers);
1035 uint8_t nContribPixelEndcap = static_cast<uint8_t>(detailedInfo.getContributionFromRegion(Trk::pixelEndcap ));
1036
1037 uint8_t nPixelBarrelFlatHits = static_cast<uint8_t>(detailedInfo.getHitsFromRegion(Trk::pixelBarrelFlat ));
1038 uint8_t nPixelBarrelInclinedHits = static_cast<uint8_t>(detailedInfo.getHitsFromRegion(Trk::pixelBarrelInclined));
1039 uint8_t nPixelBarrelHits = static_cast<uint8_t>(nPixelBarrelFlatHits+nPixelBarrelInclinedHits);
1040 uint8_t nPixelEndcapHits = static_cast<uint8_t>(detailedInfo.getHitsFromRegion(Trk::pixelEndcap ));
1041
1042 uint8_t nInnermostPixelLayerEndcapHits = static_cast<uint8_t>(detailedInfo.getHits(Trk::pixelEndcap, 0));
1043 uint8_t nNextToInnermostPixelLayerEndcapHits = static_cast<uint8_t>(detailedInfo.getHits(Trk::pixelEndcap, 1)
1044 + detailedInfo.getHits(Trk::pixelEndcap, 2)); // L0.5 shorties + L1
1045
1046 tp.setSummaryValue(nContribPixelLayers, xAOD::numberOfContribPixelLayers);
1047 tp.setSummaryValue(nContribPixelBarrelLayers, xAOD::numberOfContribPixelBarrelLayers);
1048 tp.setSummaryValue(nContribPixelEndcap, xAOD::numberOfContribPixelEndcap);
1050 tp.setSummaryValue(nPixelBarrelHits, xAOD::numberOfPixelBarrelHits);
1051 tp.setSummaryValue(nContribPixelBarrelFlatLayers, xAOD::numberOfContribPixelBarrelFlatLayers);
1052 tp.setSummaryValue(nContribPixelBarrelInclinedLayers, xAOD::numberOfContribPixelBarrelInclinedLayers);
1053 tp.setSummaryValue(nPixelBarrelFlatHits, xAOD::numberOfPixelBarrelFlatHits);
1054 tp.setSummaryValue(nPixelBarrelInclinedHits, xAOD::numberOfPixelBarrelInclinedHits);
1055 tp.setSummaryValue(nPixelEndcapHits, xAOD::numberOfPixelEndcapHits);
1056 }
1057 tp.setSummaryValue(nInnermostPixelLayerEndcapHits, xAOD::numberOfInnermostPixelLayerEndcapHits);
1058 tp.setSummaryValue(nNextToInnermostPixelLayerEndcapHits, xAOD::numberOfNextToInnermostPixelLayerEndcapHits);
1059
1060}
virtual DetectorType type() const
Type of element.
virtual const SiDetectorDesign & design() const override final
access to the local description (inline):
virtual const TrkDetElementBase * detectorElement() const =0
returns the detector element, assoicated with the PRD of this class
Identifier identify() const
return the identifier -extends MeasurementBase
int getContributionFromRegion(Trk::DetectorRegion region)
int getHits(Trk::DetectorRegion region, int layer)
void addHit(Trk::DetectorRegion region, int layer, int etaModule, int hit=1)
This class containes the detailed information on the contributing layers and regions to the hit count...
int getHitsFromRegion(Trk::DetectorRegion region)
virtual bool type(MeasurementBaseType::Type type) const =0
Interface method checking the type.
Gaudi::Property< int > m_itkDecorationLevel
void setSummaryValue(uint8_t &value, const SummaryType &information)
Set method for TrackSummary values.
@ pixelBarrelInclined
@ pixelEndcap
@ pixelBarrelFlat
@ numberOfInnermostPixelLayerEndcapHits
these are the hits in the 0th pixel layer endcap [unit8_t].
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector [unit8_t].
@ numberOfPixelBarrelHits
these are the pixel hits, in the barrel flat layers [unit8_t].
@ numberOfContribPixelBarrelFlatLayers
number of contributing barrel flat layers of the pixel detector [unit8_t].
@ numberOfContribPixelBarrelInclinedLayers
number of contributing barrel inclined layers of the pixel detector [unit8_t].
@ numberOfPixelEndcapHits
these are the pixel hits, in the endcap layers [unit8_t].
@ numberOfNextToInnermostPixelLayerEndcapHits
these are the hits in the 0.5th and 1st pixel layer endcap rings [unit8_t].
@ numberOfContribPixelEndcap
number of contributing endcap layers of the pixel detector [unit8_t].
@ numberOfPixelBarrelInclinedHits
these are the pixel hits, in the barrel inclined layers [unit8_t].
@ numberOfPixelBarrelFlatHits
these are the pixel hits, in the barrel flat layers [unit8_t].
@ numberOfContribPixelBarrelLayers
number of contributing barrel flat layers of the pixel detector [unit8_t].

◆ addDummyEndcapSharedHitInformation()

void Trk::TrackParticleCreatorTool::addDummyEndcapSharedHitInformation ( xAOD::TrackParticle & tp)
static

Add dummy endcap shared hit info as AuxDyn variable in case nominal shared hit info not computed (for ITk fast tracking).

Definition at line 1296 of file TrackParticleCreatorTool.cxx.

1297{
1298
1299 uint8_t nInPixSharedEndcapHits = 0, nNInPixSharedEndcapHits = 0;
1300 uint8_t nInPixSplitEndcapHits = 0, nNInPixSplitEndcapHits = 0;
1301
1306
1307}
@ numberOfInnermostPixelLayerSharedEndcapHits
number of Pixel 0th layer endcap hits shared by several tracks.
@ numberOfNextToInnermostPixelLayerSharedEndcapHits
number of Pixel 1st layer endcap hits shared by several tracks.
@ numberOfNextToInnermostPixelLayerSplitEndcapHits
number of Pixel 1st layer endcap hits split by cluster splitting
@ numberOfInnermostPixelLayerSplitEndcapHits
number of Pixel 0th layer endcap hits shared by several tracks.

◆ addExpectedHitInformation()

void Trk::TrackParticleCreatorTool::addExpectedHitInformation ( const Perigee * perigee,
xAOD::TrackParticle & tp ) const

Add expected hit info for innermost pixel layers not computed in Trk::TrkSummary.

Definition at line 1063 of file TrackParticleCreatorTool.cxx.

1064{
1065
1066 if(m_testPixelLayerTool.empty() || perigee==nullptr) return;
1067
1068 uint8_t zero = static_cast<uint8_t>(0);
1069 uint8_t nContribPixLayers, nInPixHits, nNextInPixHits;
1070 if(!tp.summaryValue(nContribPixLayers, xAOD::numberOfContribPixelLayers)){
1071 nContribPixLayers = zero;
1072 }
1073 if(nContribPixLayers==0){
1074 ATH_MSG_DEBUG("No pixels on track, so wo do not expect hit in inner layers");
1077 }
1078
1079 else {
1080
1081 // Innermost pixel layer
1083 nInPixHits = zero;
1084 }
1085 if(nInPixHits>0){
1086 ATH_MSG_DEBUG("Innermost pixel Layer hit on track, so we expect an innermost pixel layer hit");
1087 uint8_t one = static_cast<uint8_t>(1);
1089 } else {
1090 uint8_t expectHit = static_cast<uint8_t>(m_testPixelLayerTool->expectHitInInnermostPixelLayer(perigee));
1092 }
1093
1094 // Next-to-innermost pixel layer
1096 nNextInPixHits = zero;
1097 }
1098 if(nNextInPixHits>0){
1099 ATH_MSG_DEBUG("Next-to-innermost pixel Layer hit on track, so we expect an next-to-innermost pixel layer hit");
1100 uint8_t one = static_cast<uint8_t>(1);
1102 } else {
1103 uint8_t expectHit = static_cast<uint8_t>(m_testPixelLayerTool->expectHitInNextToInnermostPixelLayer(perigee));
1105 }
1106
1107 } // end else if nContribPixLayers>0
1108
1109}
#define ATH_MSG_DEBUG(x)
ToolHandle< InDet::IInDetTestPixelLayerTool > m_testPixelLayerTool
tool to calculate expected hit information in innermost layers
bool summaryValue(uint8_t &value, const SummaryType &information) const
Accessor for TrackSummary values.
void zero(TH2 *h)
zero the contents of a 2d histogram
@ expectInnermostPixelLayerHit
Do we expect a 0th-layer barrel hit for this track?
@ numberOfNextToInnermostPixelLayerHits
these are the hits in the 1st pixel barrel layer
@ expectNextToInnermostPixelLayerHit
Do we expect a 1st-layer barrel hit for this track?
@ numberOfInnermostPixelLayerHits
these are the hits in the 0th pixel barrel layer

◆ addOutlierHitInformation()

void Trk::TrackParticleCreatorTool::addOutlierHitInformation ( const Trk::TrackStates * trackStates,
xAOD::TrackParticle & tp ) const

Add outlier hit info not computed in Trk::TrkSummary anymore.

Definition at line 1112 of file TrackParticleCreatorTool.cxx.

1113{
1114
1115 uint8_t nPixOutliers = 0, nInPixOutliers = 0, nNInPixOutliers = 0, nSCTOutliers = 0;
1116 uint8_t nInEndcapPixOutliers = 0, nNInEndcapPixOutliers = 0;
1117
1118 for (const TrackStateOnSurface* tsos : *trackStates) {
1119
1120 bool isOutlier = tsos->type(Trk::TrackStateOnSurface::Outlier);
1121 if(!isOutlier) continue;
1122
1123 const Trk::MeasurementBase* mesb = tsos->measurementOnTrack();
1124 if(mesb==nullptr) continue;
1125 // Check if the measurement type is RIO on Track (ROT)
1126 const RIO_OnTrack* rot = nullptr;
1128 rot = static_cast<const RIO_OnTrack*>(mesb);
1129 }
1130 if (rot == nullptr)
1131 continue;
1132
1133 const Identifier& id = rot->identify();
1134
1135 if (m_pixelID->is_pixel(id)) {
1136 nPixOutliers++;
1137 int layer = m_pixelID->layer_disk(id);
1138 if (m_pixelID->is_barrel(id)) {
1139 if (layer == 0){
1140 nInPixOutliers++;
1141 }
1142 else if (layer == 1){
1143 nNInPixOutliers++;
1144 }
1145 } else if (m_doITk) { // isITk && isEndCap -> ITk specific counters
1146 if (layer == 0){
1147 nInEndcapPixOutliers++;
1148 }
1149 else if (layer == 1 || layer == 2){
1150 nNInEndcapPixOutliers++; // L0.5 + L1 disks
1151 }
1152 }
1153 }
1154 else if (m_sctID->is_sct(id)) {
1155 nSCTOutliers++;
1156 }
1157
1158 // TRT outliers are already filled in the InDetTrackSummaryHelperTool as
1159 // used in the ambi solver
1160 }
1161
1166
1167 if(m_doITk){
1170 }
1171
1172}
BooleanProperty m_doITk
if the track contains a summary, the shared, expected hit, and PID information will be recomputed.
@ Outlier
This TSoS contains an outlier, that is, it contains a MeasurementBase/RIO_OnTrack which was not used ...
float nSCTOutliers(const U &p)
@ layer
Definition HitInfo.h:79
@ numberOfInnermostPixelLayerEndcapOutliers
number of 0th layer endcap outliers
@ numberOfPixelOutliers
these are the pixel outliers, including the b-layer [unit8_t].
@ numberOfInnermostPixelLayerOutliers
number of 0th layer barrel outliers
@ numberOfNextToInnermostPixelLayerEndcapOutliers
number of 1st layer endcap disk outliers
@ numberOfSCTOutliers
number of SCT outliers [unit8_t].
@ numberOfNextToInnermostPixelLayerOutliers
number of 1st pixel layer barrel outliers

◆ addPIDInformation()

void Trk::TrackParticleCreatorTool::addPIDInformation ( const EventContext & ctx,
const Track * track,
xAOD::TrackParticle & tp ) const

Add Pixel and TRT PID information to the track particle.

Parameters
ctxthe current event context
tracka valid track or nullptr to set all PID values to the default value.
tpthe trackparticle in which the PID values are set.

Definition at line 951 of file TrackParticleCreatorTool.cxx.

952{
953 // TRT PID information
954 {
955 static const std::vector<float> eProbabilityDefault(numberOfeProbabilityTypes,0.5);
956 constexpr int initialValue{-1};
957 std::vector<float> eProbability_tmp;
958 const std::vector<float>& eProbability(
959 track && !m_eProbabilityTool.empty()
960 ? eProbability_tmp =
961 m_eProbabilityTool->electronProbability(ctx, *track)
963 int nHits = track && !m_eProbabilityTool.empty()
965 : initialValue;
966 for (const Trk::eProbabilityType& copy : m_copyEProbabilities) {
967 float eProbability_value = eProbability.at(copy);
968 tp.setSummaryValue(eProbability_value, static_cast<xAOD::SummaryType>(copy + xAOD::eProbabilityComb));
969 }
970 for (const std::pair<SG::AuxElement::Accessor<float>, Trk::eProbabilityType>& decoration :
972 float fvalue = eProbability.at(decoration.second);
973 decoration.first(tp) = fvalue;
974 }
975 // now the extra summary types
976 for (const std::pair<SG::AuxElement::Accessor<uint8_t>, Trk::SummaryType>& decoration :
978 uint8_t summary_value = nHits;
979 decoration.first(tp) = summary_value;
980 }
981
982 }
983
984 // PixelPID
985 {
986 const int initialValue{-1};
987 float dedx = initialValue;
988 int nHitsUsed_dEdx = initialValue;
989 int nOverflowHits_dEdx = initialValue;
990 if (track && !m_dedxtool.empty() && track->info().trackFitter() != TrackInfo::Unknown) {
991 dedx = m_dedxtool->dEdx(ctx, *track, nHitsUsed_dEdx, nOverflowHits_dEdx);
992 }
993 tp.setNumberOfUsedHitsdEdx(nHitsUsed_dEdx);
994 tp.setNumberOfIBLOverflowsdEdx(nOverflowHits_dEdx);
995 tp.setSummaryValue(dedx, static_cast<xAOD::SummaryType>(51));
996 }
997}
static const uint32_t nHits
ToolHandle< ITRT_ElectronPidTool > m_eProbabilityTool
tool to calculate electron probabilities
ToolHandle< IPixelToTPIDTool > m_dedxtool
tool to calculate dE/dx using pixel clusters
void setNumberOfIBLOverflowsdEdx(uint8_t numoverflows)
void setNumberOfUsedHitsdEdx(uint8_t numhits)
@ eProbabilityNumberOfTRTHitsUsedFordEdx
Number of TRT hits used for dEdx measurement.
static const std::vector< float > eProbabilityDefault(numberOfeProbabilityTypes, 0.5)
SummaryType
enumerates the different types of information stored in Summary.
SummaryType
Enumerates the different types of information stored in Summary.
@ eProbabilityComb
Electron probability from combining the below probabilities [float].

◆ addSharedHitInformation()

void Trk::TrackParticleCreatorTool::addSharedHitInformation ( const Track * track,
xAOD::TrackParticle & tp ) const

Add shared hit info not computed in Trk::TrkSummary anymore.

Definition at line 1175 of file TrackParticleCreatorTool.cxx.

1176{
1177
1178 uint8_t nPixSharedHits = 0, nInPixSharedHits = 0, nNInPixSharedHits = 0, nSCTSharedHits = 0, nTRTSharedHits = 0;
1179 uint8_t nInPixSharedEndcapHits = 0, nNInPixSharedEndcapHits = 0;
1180 uint8_t nPixSplitHits = 0, nInPixSplitHits = 0, nNInPixSplitHits = 0;
1181 uint8_t nInPixSplitEndcapHits = 0, nNInPixSplitEndcapHits = 0;
1182
1183 const DataVector<const Trk::MeasurementBase>* measurements = track->measurementsOnTrack();
1184 if(!measurements){
1185 ATH_MSG_DEBUG("No measurement on track");
1186 return;
1187 }
1188
1189 const EventContext& ctx = Gaudi::Hive::currentContext();
1190 SG::ReadHandle<Trk::PRDtoTrackMap> prd_to_track_map(m_assoMapContainer, ctx);
1191
1192 for (const auto* const ms : *measurements) {
1193 // check if it's a rot
1194 const Trk::RIO_OnTrack* rot = nullptr;
1196 rot = static_cast<const Trk::RIO_OnTrack*>(ms);
1197 }
1198 if (!rot) {
1199 ATH_MSG_DEBUG("Cannot cast measurement to RIO_OnTrack");
1200 continue;
1201 }
1202
1203 const Identifier& id = rot->identify();
1204
1205 if (m_doSharedSiHits && m_pixelID->is_pixel(id)) {
1206 // check if split, when running TIDE
1207 bool hitIsSplit(false);
1208 if (m_runningTIDE_Ambi) {
1209 const InDet::PixelClusterOnTrack* pix = nullptr;
1211 pix = static_cast<const InDet::PixelClusterOnTrack*>(rot);
1212 }
1213 if (pix) {
1214 const InDet::PixelCluster* pixPrd = pix->prepRawData();
1215 const Trk::ClusterSplitProbabilityContainer::ProbabilityInfo&
1216 splitProb = getClusterSplittingProbability(pixPrd);
1217 int layer = m_pixelID->layer_disk(id);
1218 if (pixPrd and splitProb.isSplit()) {
1219 ATH_MSG_DEBUG("split Pixel hit found");
1220 hitIsSplit = true;
1221 nPixSplitHits++;
1222 if (m_pixelID->is_barrel(id)) {
1223 if (layer == 0)
1224 nInPixSplitHits++;
1225 else if (layer == 1)
1226 nNInPixSplitHits++;
1227 } else if (m_doITk) { // isITk && isEndCap -> ITk specific counters
1228 if (layer == 0)
1229 nInPixSplitEndcapHits++;
1230 else if (layer == 1 || layer == 2)
1231 nNInPixSplitEndcapHits++; // L0.5 + L1 disks
1232 }
1233 }
1234 }
1235 }
1236
1237 // check if shared
1238 // if we are running the TIDE ambi don't count split hits as shared
1239 if (!hitIsSplit) {
1240 if (prd_to_track_map->isShared(*(rot->prepRawData()))) {
1241 ATH_MSG_DEBUG("shared Pixel hit found");
1242 nPixSharedHits++;
1243 int layer = m_pixelID->layer_disk(id);
1244 if (m_pixelID->is_barrel(id)) {
1245 if (layer == 0)
1246 nInPixSharedHits++;
1247 else if (layer == 1)
1248 nNInPixSharedHits++;
1249 } else if (m_doITk) { // isITk && isEndCap -> ITk specific counters
1250 if (layer == 0)
1251 nInPixSharedEndcapHits++;
1252 else if (layer == 1 || layer == 2)
1253 nNInPixSharedEndcapHits++; // L0.5 + L1 disks
1254 }
1255 }
1256 }
1257
1258 } // end pixel
1259
1260 else if (m_doSharedSiHits && m_sctID->is_sct(id)) {
1261 if (prd_to_track_map->isShared(*(rot->prepRawData()))) {
1262 ATH_MSG_DEBUG("shared SCT hit found");
1264 }
1265 }
1266
1267 else if (m_doSharedTRTHits && m_trtID->is_trt(id)) {
1268 if (prd_to_track_map->isShared(*(rot->prepRawData()))) {
1269 ATH_MSG_DEBUG("shared TRT hit found");
1270 nTRTSharedHits++;
1271 }
1272 }
1273 }
1274
1278
1282 tp.setSummaryValue(nSCTSharedHits, xAOD::numberOfSCTSharedHits);
1283 tp.setSummaryValue(nTRTSharedHits, xAOD::numberOfTRTSharedHits);
1284
1285 if(m_doITk){
1290 }
1291
1292}
virtual const PixelCluster * prepRawData() const override final
returns the PrepRawData - is a SiCluster in this scope
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
Identifier identify() const
return the identifier -extends MeasurementBase
virtual bool rioType(RIO_OnTrackType::Type type) const =0
Method checking the Rio On Track type.
SG::ReadHandleKey< Trk::PRDtoTrackMap > m_assoMapContainer
const Trk::ClusterSplitProbabilityContainer::ProbabilityInfo & getClusterSplittingProbability(const InDet::PixelCluster *pix) const
float nSCTSharedHits(const U &p)
@ numberOfNextToInnermostPixelLayerSharedHits
number of Pixel 1st layer barrel hits shared by several tracks.
@ numberOfNextToInnermostPixelLayerSplitHits
number of Pixel 1st layer barrel hits split by cluster splitting
@ numberOfPixelSplitHits
number of Pixel all-layer hits split by cluster splitting [unit8_t].
@ numberOfInnermostPixelLayerSharedHits
number of Pixel 0th layer barrel hits shared by several tracks.
@ numberOfInnermostPixelLayerSplitHits
number of Pixel 0th layer barrel hits split by cluster splitting
@ numberOfPixelSharedHits
number of Pixel all-layer hits shared by several tracks [unit8_t].
@ numberOfSCTSharedHits
number of SCT hits shared by several tracks [unit8_t].
@ numberOfTRTSharedHits
number of TRT hits used by more than one track

◆ CacheBeamSpotData()

const InDet::BeamSpotData * Trk::TrackParticleCreatorTool::CacheBeamSpotData ( const EventContext & ctx) const
finaloverridevirtual

Definition at line 1327 of file TrackParticleCreatorTool.cxx.

1328{
1329 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx };
1330 return beamSpotHandle.cptr();
1331}
const_pointer_type cptr()
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey

◆ compare() [1/2]

void Trk::TrackParticleCreatorTool::compare ( const Rec::TrackParticle & tp,
const xAOD::TrackParticle & tpx ) const
private

Definition at line 766 of file TrackParticleCreatorTool.cxx.

767{
768 if (tp.measuredPerigee()) {
770 }
771
772 // trackParticle.info(),trackParticle.trackSummary(),
773 if (tp.trackParameters().size() != tpx.numberOfParameters()) {
774 ATH_MSG_WARNING("Number of parameters not the same " << tp.trackParameters().size() << " --- "
775 << tpx.numberOfParameters());
776 }
777}
#define ATH_MSG_WARNING(x)
const Trk::Perigee * measuredPerigee() const
Accessor method for Perigee.
const std::vector< const TrackParameters * > & trackParameters() const
Returns the track parameters.
void compare(const Rec::TrackParticle &tp, const xAOD::TrackParticle &tpx) const
const Trk::Perigee & perigeeParameters() const
Returns the Trk::MeasuredPerigee track parameters.
size_t numberOfParameters() const
Returns the number of additional parameters stored in the TrackParticle.

◆ compare() [2/2]

void Trk::TrackParticleCreatorTool::compare ( const TrackParameters & tp1,
const TrackParameters & tp2 ) const
private

Definition at line 747 of file TrackParticleCreatorTool.cxx.

748{
749 int index = Amg::compare(tp1.parameters(), tp2.parameters(), 1e-6, true);
750 if (index != -1) {
751 ATH_MSG_WARNING("Bad parameters conversion " << Amg::toString(tp1.parameters(), 7) << " --- "
752 << Amg::toString(tp2.parameters(), 7));
753 }
754 if ((tp1.covariance() && !tp2.covariance()) || (!tp1.covariance() && tp2.covariance())) {
755 ATH_MSG_WARNING("Bad Covariance conversion " << tp1.covariance() << " --- " << tp2.covariance());
756 } else if (tp1.covariance() && tp2.covariance()) {
757 std::pair<int, int> indices = Amg::compare(*tp1.covariance(), *tp2.covariance(), 1e-6, true);
758 if (indices.first != -1)
759 ATH_MSG_WARNING("Bad Covariance conversion " << std::endl
760 << Amg::toString(*tp1.covariance(), 10) << std::endl
761 << Amg::toString(*tp2.covariance(), 10));
762 }
763}
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
std::pair< int, int > compare(const AmgSymMatrix(N) &m1, const AmgSymMatrix(N) &m2, double precision=1e-9, bool relative=false)
compare two matrices, returns the indices of the first element that fails the condition,...
str index
Definition DeMoScan.py:362
std::pair< long int, long int > indices

◆ createParticle() [1/5]

xAOD::TrackParticle * Trk::TrackParticleCreatorTool::createParticle ( const EventContext & ctx,
const ElementLink< TrackCollection > & trackLink,
xAOD::TrackParticleContainer * container,
const xAOD::Vertex * vxCandidate,
xAOD::ParticleHypothesis prtOrigin ) const
finaloverridevirtual

Method to construct a TrackParticle from a passed Track.

Will keep parameters based on m_keepParameters,m_keepFirstParameters, m_keepAllPerigee. It will use the exising summary or redo it based on m_useTrackSummaryTool

Parameters
trackelement link to a valid track (i.e. do not pass a zero!).
TrackParticleContainerneeded to have an AuxStore, if provided particle will be added to store which takes ownership
xAOD::VertexPointer to a valid vxCandidate (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted)
prtOrigin

Definition at line 644 of file TrackParticleCreatorTool.cxx.

649{
650
651 xAOD::TrackParticle* trackparticle =
652 createParticle(ctx, **trackLink, container, vxCandidate, prtOrigin);
653
654 if (!trackparticle) {
655 ATH_MSG_WARNING("WARNING: Problem creating TrackParticle - Returning 0");
656 return nullptr;
657 }
658
659 trackparticle->setTrackLink(trackLink);
660
661 return trackparticle;
662}
virtual xAOD::TrackParticle * createParticle(const EventContext &ctx, const Rec::TrackParticle &trackParticle, xAOD::TrackParticleContainer *container) const override final
Method to construct a xAOD::TrackParticle from a Rec::TrackParticle.
void setTrackLink(const ElementLink< TrackCollection > &track)
Set the link to the original track.
TrackParticle_v1 TrackParticle
Reference the current persistent version:

◆ createParticle() [2/5]

xAOD::TrackParticle * Trk::TrackParticleCreatorTool::createParticle ( const EventContext & ctx,
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,
xAOD::ParticleHypothesis prtOrigin,
xAOD::TrackParticleContainer * container ) const
inlinefinaloverridevirtual

create a xAOD::TrackParticle out of constituents

Definition at line 664 of file TrackParticleCreatorTool.cxx.

673 {
674 return createParticle(ctx,perigee, fq, trackInfo, summary, parameters, positions, prtOrigin, container, nullptr);
675}

◆ createParticle() [3/5]

xAOD::TrackParticle * Trk::TrackParticleCreatorTool::createParticle ( const EventContext & ctx,
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,
xAOD::ParticleHypothesis prtOrigin,
xAOD::TrackParticleContainer * container,
const Trk::Track * track ) const
protected

create a xAOD::TrackParticle out of constituents

Definition at line 678 of file TrackParticleCreatorTool.cxx.

688{
689
690 xAOD::TrackParticle* trackparticle = new xAOD::TrackParticle;
691 if (!trackparticle) {
692 ATH_MSG_WARNING("WARNING: Problem creating TrackParticle - Returning 0");
693 return nullptr;
694 }
695 /*
696 * The following needs care as in one case the ownership
697 * can be passed to StoreGate i.e to the relevant container
698 * DataVector.
699 * In the other the caller has the ownership
700 */
701
702 if (container) {
703 container->push_back(trackparticle);
704 } else {
705 trackparticle->makePrivateStore();
706 }
707
708 // Fit quality
709 if (fq) {
710 setFitQuality(*trackparticle, *fq);
711 }
712 // Track Info
713 if (trackInfo) {
714 setTrackInfo(*trackparticle, *trackInfo, prtOrigin);
715 }
716 // track summary
717 if (summary) {
718 setTrackSummary(*trackparticle, *summary);
719 setHitPattern(*trackparticle, summary->getHitPattern());
720 addPIDInformation(ctx, track, *trackparticle);
721 if(m_doITk) addDetailedHitInformation(track->trackStateOnSurfaces(), *trackparticle);
722 }
723
724 if (m_computeAdditionalInfo && track!=nullptr) {
725 addExpectedHitInformation(track->perigeeParameters(), *trackparticle);
726 addOutlierHitInformation(track->trackStateOnSurfaces(), *trackparticle);
727 if(m_doSharedSiHits || m_doSharedTRTHits) addSharedHitInformation(track, *trackparticle);
728 else if(m_doITk) addDummyEndcapSharedHitInformation(*trackparticle);
729 }
730
731 const auto* beamspot = CacheBeamSpotData(ctx);
732 if (beamspot) {
733 setTilt(*trackparticle, beamspot->beamTilt(0), beamspot->beamTilt(1));
734 }
735 // Parameters
736 if (perigee) {
737 setDefiningParameters(*trackparticle, *perigee);
738 } else {
739 ATH_MSG_WARNING("Track without perigee parameters? Not setting any defining parameters!");
740 }
741 setParameters(ctx, *trackparticle, parameters, positions);
742
743 return trackparticle;
744}
virtual const InDet::BeamSpotData * CacheBeamSpotData(const EventContext &ctx) const override final
void addOutlierHitInformation(const Trk::TrackStates *trackStates, xAOD::TrackParticle &tp) const
Add outlier hit info not computed in Trk::TrkSummary anymore.
void setTrackSummary(xAOD::TrackParticle &tp, const TrackSummary &summary) const
Method to set TrackSummary of a xAOD::TrackParticle.
void addPIDInformation(const EventContext &ctx, const Track *track, xAOD::TrackParticle &tp) const
Add Pixel and TRT PID information to the track particle.
void setTrackInfo(xAOD::TrackParticle &tp, const TrackInfo &trackInfo, xAOD::ParticleHypothesis prtOrigin) const
Method to set TrackInfo of a xAOD::TrackParticle.
static void addDummyEndcapSharedHitInformation(xAOD::TrackParticle &tp)
Add dummy endcap shared hit info as AuxDyn variable in case nominal shared hit info not computed (for...
void addDetailedHitInformation(const Trk::TrackStates *trackStates, xAOD::TrackParticle &tp) const
Add extra detailed hit summary info not computed in Trk::TrkSummary.
static void setHitPattern(xAOD::TrackParticle &tp, unsigned long hitpattern)
void addSharedHitInformation(const Track *track, xAOD::TrackParticle &tp) const
Add shared hit info not computed in Trk::TrkSummary anymore.
void addExpectedHitInformation(const Perigee *perigee, xAOD::TrackParticle &tp) const
Add expected hit info for innermost pixel layers not computed in Trk::TrkSummary.
static void setTilt(xAOD::TrackParticle &tp, float tiltx, float tilty)
void setParameters(const EventContext &ctx, xAOD::TrackParticle &tp, const std::vector< const Trk::TrackParameters * > &parameters, const std::vector< xAOD::ParameterPosition > &positions) const
Method to set parameters of a xAOD::TrackParticle.
void setDefiningParameters(xAOD::TrackParticle &tp, const Perigee &perigee) const
Method to set Defining parameters of a xAOD::TrackParticle.
void setFitQuality(xAOD::TrackParticle &tp, const FitQuality &fq) const
Method to set FitQuality of a xAOD::TrackParticle.
const SG::AuxVectorData * container() const
Return the container holding this element.

◆ createParticle() [4/5]

xAOD::TrackParticle * Trk::TrackParticleCreatorTool::createParticle ( const EventContext & ctx,
const Rec::TrackParticle & trackParticle,
xAOD::TrackParticleContainer * container ) const
finaloverridevirtual

Method to construct a xAOD::TrackParticle from a Rec::TrackParticle.

Parameters
trackparticle
TrackParticleContainerneeded to have an AuxStore, if provided particle will be added to store which takes ownership

Definition at line 595 of file TrackParticleCreatorTool.cxx.

598{
599
600 // Attempt to fill the position enums - will necessarily be a bit of a hack, since we don't have
601 // all the information.
602 std::vector<xAOD::ParameterPosition> positions;
603 bool firstMeasurement = false;
604 for (const auto* parameter : trackParticle.trackParameters()) {
605 if (!firstMeasurement && parameter && !parameter->associatedSurface().isFree()) {
606 // if the surface isn't free, it must belong to a detector element => measurement
607 firstMeasurement = true;
608 positions.push_back(xAOD::FirstMeasurement);
609 } else if (firstMeasurement && parameter && !parameter->associatedSurface().isFree()) {
610 // Making the (possibly unfounded assumption that if we have the first measurement, the next
611 // will be the last)
612 positions.push_back(xAOD::LastMeasurement);
613 } else {
614 positions.push_back(xAOD::BeamLine); // Don't have a default yet!
615 }
616 }
617
618 xAOD::TrackParticle* trackparticle =
619 createParticle(ctx,
620 trackParticle.measuredPerigee(),
621 trackParticle.fitQuality(),
622 &trackParticle.info(),
623 trackParticle.trackSummary(),
624 trackParticle.trackParameters(),
625 positions,
626 static_cast<xAOD::ParticleHypothesis>(trackParticle.info().particleHypothesis()),
627 container,
628 nullptr);
629
630 if (!trackparticle) {
631 ATH_MSG_WARNING("WARNING: Problem creating TrackParticle - Returning 0");
632 return nullptr;
633 }
634
635 trackparticle->setTrackLink(*(trackParticle.trackElementLink()));
636
638 compare(trackParticle, *trackparticle);
639
640 return trackparticle;
641}
ParticleHypothesis particleHypothesis() const
Returns the particle hypothesis used for Track fitting.
const ElementLink< TrackCollection > * trackElementLink() const
Return the ElementLink to the Track.
const FitQuality * fitQuality() const
accessor function for FitQuality.
const TrackSummary * trackSummary() const
accessor function for TrackSummary.
const TrackInfo & info() const
returns the info of the track.
const xAOD::UncalibratedMeasurement * firstMeasurement(const xAOD::MuonSegment &segment, const bool skipOutlier=true)
Retrieves the first measurement associated with the segment.
@ BeamLine
Parameter defined at the Vertex/Beamline.
@ FirstMeasurement
Parameter defined at the position of the 1st measurement.
@ LastMeasurement
Parameter defined at the position of the last measurement.

◆ createParticle() [5/5]

xAOD::TrackParticle * Trk::TrackParticleCreatorTool::createParticle ( const EventContext & ctx,
const Trk::Track & track,
xAOD::TrackParticleContainer * container,
const xAOD::Vertex * vxCandidate,
xAOD::ParticleHypothesis prtOrigin ) const
finaloverridevirtual

Method to construct a xAOD::TrackParticle from a passed Track.

Will keep parameters based on m_keepParameters,m_keepFirstParameters, m_keepAllPerigee. It will use the exising summary or redo it based on m_useTrackSummaryTool

Parameters
trackPointer to a valid track (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted)
TrackParticleContainerneeded to have an AuxStore, if provided particle will be added to store which takes ownership
xAOD::VertexPointer to a valid vxCandidate (i.e. do not pass a zero!). Ownership is not taken (i.e. it will not be deleted)
prtOriginParticle type

Definition at line 261 of file TrackParticleCreatorTool.cxx.

266{
267 const Trk::Perigee* aPer = nullptr;
268 const Trk::TrackParameters* parsToBeDeleted = nullptr;
269 // Origin
270 if (m_perigeeExpression == "Origin") {
271 aPer = track.perigeeParameters();
272 if (aPer) {
273 // aMeasPer clone will be created later if all perigee option selected
274 if (m_keepAllPerigee) {
275 aPer = nullptr;
276 }
277 } else {
278 const Amg::Vector3D persf(0, 0, 0);
279 const Trk::Perigee* result = m_trackToVertex->perigeeAtVertex(ctx, track, persf).release();
280 if (result != nullptr) {
281 aPer = result;
282 parsToBeDeleted = result;
283 } else {
284 ATH_MSG_WARNING("Could not extrapolate to 0,0,0. No TrackParticle created.");
285 return nullptr;
286 }
287 }
288 // Beamspot
289 } else if (m_perigeeExpression == "BeamSpot") {
290 const Trk::Perigee* result = m_trackToVertex->perigeeAtVertex(ctx, track, CacheBeamSpotData(ctx)->beamVtx().position()).release();
291 if (!result) {
292 ATH_MSG_WARNING("Failed to extrapolate to first Beamspot - No TrackParticle created.");
293 return nullptr;
294 }
295 parsToBeDeleted = result;
296 aPer = result;
297 }
298 // the non default way, express the perigee wrt. the vertex position
299 else if (m_perigeeExpression == "Vertex") {
300 if (vxCandidate != nullptr) {
301 const Trk::Perigee* result = m_trackToVertex->perigeeAtVertex(ctx, track, vxCandidate->position()).release();
302 if (result != nullptr) {
303 parsToBeDeleted = result;
304 aPer = result;
305 } else {
306 ATH_MSG_WARNING("Could not extrapolate track to vertex region! No TrackParticle created.");
307 return nullptr;
308 }
309 } else {
310 ATH_MSG_WARNING("Perigee expression at Vertex, but no vertex found! No TrackParticle created.");
311 }
312 //BeamLine
313 } else if (m_perigeeExpression == "BeamLine") {
314 const Trk::Perigee* result = m_trackToVertex->perigeeAtBeamline(ctx, track, CacheBeamSpotData(ctx)).release();
315 if (!result) {
316 ATH_MSG_WARNING("Failed to extrapolate to Beamline - No TrackParticle created.");
317 return nullptr;
318 }
319 parsToBeDeleted = result;
320 aPer = result;
321 }
322 /*
323 * We start from the existing summary
324 * and see what we want to add
325 */
326 std::unique_ptr<Trk::TrackSummary> updated_summary;
327 const Trk::TrackSummary* summary = track.trackSummary();
328 if (m_trackSummaryTool.get() != nullptr) {
329 if (!track.trackSummary() || m_updateTrackSummary) {
330 updated_summary = m_trackSummaryTool->summary(ctx, track);
331 summary = updated_summary.get();
332 }
333 } else {
335 "No proper TrackSummaryTool found. Creating TrackParticle with a TrackSummary on track");
336 }
337 if (!summary) {
338 ATH_MSG_WARNING("Track particle created for a track without a track summary");
339 }
340
341 // find the first and the last hit in track
342 // we do that the same way as in the track slimming tool!
343 // that way it is also ok on not slimmed tracks!
344 std::vector<const Trk::TrackParameters*> parameters;
345 std::vector<xAOD::ParameterPosition> parameterPositions;
346
347 int nbc_meas_A1 = 0;
348 int nbc_meas_B3 = 0;
349 int nbc_meas_A1_or_B3 = 0;
350 int nbc_meas_A1_or_B3_or_C = 0;
351
352 int isBC_A1 = 0;
353 int isBC_B3 = 0;
354 int isBC_C = 0;
355
356 const Trk::TrackStates* trackStates = track.trackStateOnSurfaces();
357 const Trk::TrackParameters* first(nullptr);
358 const Trk::TrackParameters* tp(nullptr);
359
360 if (m_badclusterID != 0) {
361 for (const TrackStateOnSurface* tsos : *trackStates) {
362 if (tsos->type(TrackStateOnSurface::Measurement) && tsos->trackParameters() != nullptr &&
363 tsos->measurementOnTrack() != nullptr &&
364 !(tsos->measurementOnTrack()->type(Trk::MeasurementBaseType::PseudoMeasurementOnTrack))) {
365 tp = tsos->trackParameters();
366
367 const InDet::SiClusterOnTrack* clus =
368 dynamic_cast<const InDet::SiClusterOnTrack*>(tsos->measurementOnTrack());
369 if (!clus) {
370 ATH_MSG_DEBUG("Failed dynamic_cast to InDet::SiClusterOnTrack ");
371 continue;
372 }
373 const Trk::PrepRawData* prdc = nullptr;
374 prdc = clus->prepRawData();
375 if (!prdc) {
376 ATH_MSG_DEBUG("No PRD for Si cluster");
377 }
378 const InDet::SiCluster* RawDataClus = dynamic_cast<const InDet::SiCluster*>(clus->prepRawData());
379 if (!RawDataClus) {
380 ATH_MSG_DEBUG("No RDC for Si cluster");
381 continue;
382 }
383 const Trk::MeasurementBase* mesb = tsos->measurementOnTrack();
384
385 if (RawDataClus->detectorElement()->isPixel()) {
386 const InDetDD::SiDetectorElement* element = nullptr;
387 const InDet::PixelCluster* pixelCluster =
388 dynamic_cast<const InDet::PixelCluster*>(RawDataClus);
389 if (!pixelCluster) {
390 ATH_MSG_DEBUG("Pixel cluster null though detector element matches pixel");
391 }
392
393 else {
394 float size = pixelCluster->rdoList().size();
395 float tot = pixelCluster->totalToT();
396 float charge = pixelCluster->totalCharge();
397 float cotthetaz = -1;
398 int zWidth = -1;
399
400 element = pixelCluster->detectorElement();
401 if (!element)
402 ATH_MSG_DEBUG("No element for track incidence angles!");
403 float PixTrkAngle = -1000;
404 float PixTrkThetaI = -1000;
405 float theta = -1000;
406 if (element) {
407 const Amg::Vector3D& my_track = tp->momentum();
408 const Amg::Vector3D& my_normal = element->normal();
409 const Amg::Vector3D& my_phiax = element->phiAxis();
410 const Amg::Vector3D& my_etaax = element->etaAxis();
411 // track component on etaAxis:
412 float trketacomp = my_track.dot(my_etaax);
413 // track component on phiAxis:
414 float trkphicomp = my_track.dot(my_phiax);
415 // track component on the normal to the module
416 float trknormcomp = my_track.dot(my_normal);
417 // Track angle
418 PixTrkAngle = std::atan2(trkphicomp, trknormcomp);
419 PixTrkThetaI = std::atan2(trketacomp, trknormcomp);
420 float length = std::sqrt(trketacomp * trketacomp + trkphicomp * trkphicomp + trknormcomp * trknormcomp);
421 theta = std::acos(trknormcomp / length);
422 cotthetaz = 1. / std::tan(PixTrkThetaI);
423
424 // reducing the angle in the right quadrant
425 // M_PI (pi) and M_PI_2 (pi/2.) are defined in cmath.
426 if (PixTrkThetaI > M_PI_2)
427 PixTrkThetaI -= M_PI;
428 else if (PixTrkThetaI < -M_PI_2)
429 PixTrkThetaI += M_PI;
430 PixTrkThetaI = M_PI_2 - PixTrkThetaI;
431 if (PixTrkAngle > M_PI_2)
432 PixTrkAngle -= M_PI;
433 else if (PixTrkAngle < -M_PI_2)
434 PixTrkAngle += M_PI;
435 PixTrkAngle = M_PI_2 - PixTrkAngle;
436 if (theta > M_PI_2)
437 theta = M_PI - theta;
438 }
439
440 Identifier surfaceID;
442 if (m_detID->is_pixel(surfaceID)) {
443 const InDet::SiWidth& width = pixelCluster->width();
444 zWidth = static_cast<int>(width.colRow().y());
445 }
446
447 int isIBLclus = false;
448 if (m_doIBL && m_pixelID->barrel_ec(surfaceID) == 0 &&
449 m_pixelID->layer_disk(surfaceID) == 0) {
450 isIBLclus = true;
451 }
452
453 // count bad clusters
454 if (!isIBLclus) {
455 if ((size == 1 && tot < 8) || (size == 2 && tot < 15)) {
456 isBC_A1 = true;
457 nbc_meas_A1++;
458 }
459 // Need to replace these magic numbers with constexpr with meaning full names
460 if (charge < 13750. / std::cos(theta) - 22500.) {
461 isBC_B3 = true;
462 nbc_meas_B3++;
463 }
464 if (isBC_A1 || isBC_B3) {
465 nbc_meas_A1_or_B3++;
466 }
467 if ((zWidth == 1 && cotthetaz > 5.8) || (zWidth == 2 && cotthetaz > 5.8) ||
468 (zWidth == 3 && cotthetaz > 6.2) || (zWidth > 3 && cotthetaz < 2.5)) {
469 isBC_C = true;
470 }
471 if (isBC_A1 || isBC_B3 || isBC_C) {
472 nbc_meas_A1_or_B3_or_C++;
473 }
474 }
475 }
476 }
477 }
478 }
479 }
481 // search first valid TSOS first
482 for (const TrackStateOnSurface* tsos : *trackStates) {
483 if (tsos->type(TrackStateOnSurface::Measurement) && tsos->trackParameters() != nullptr &&
484 tsos->measurementOnTrack() != nullptr &&
485 !(tsos->measurementOnTrack()->type(Trk::MeasurementBaseType::PseudoMeasurementOnTrack))) {
486 first = tsos->trackParameters();
487 parameters.push_back(tsos->trackParameters());
488 parameterPositions.push_back(xAOD::FirstMeasurement);
489 break;
490 }
491 }
492
494 // search last valid TSOS first
495 for (Trk::TrackStates::const_reverse_iterator rItTSoS = trackStates->rbegin();
496 rItTSoS != trackStates->rend();
497 ++rItTSoS) {
498 if ((*rItTSoS)->type(TrackStateOnSurface::Measurement) &&
499 (*rItTSoS)->trackParameters() != nullptr && (*rItTSoS)->measurementOnTrack() != nullptr &&
500 !((*rItTSoS)->measurementOnTrack()->type(
502 if (!(first == (*rItTSoS)->trackParameters())) {
503 parameters.push_back((*rItTSoS)->trackParameters());
504 parameterPositions.push_back(xAOD::LastMeasurement);
505 }
506 break;
507 }
508 }
509 }
510
511 // security check:
512 if (parameters.size() > 2)
513 ATH_MSG_WARNING("More than two additional track parameters to be stored in TrackParticle!");
514 }
515
516 // KeepAllPerigee will keep all perigee's on the track plus the parameters at the first
517 // measurement, provided this measurement precedes any second perigee. The track (initial) perigee
518 // is the 'defining parameter' for the TrackParticle, by convention this is pushed to the back of
519 // the parameter vector by the TP constructor.
520 else if (m_keepAllPerigee) {
521 bool haveFirstMeasurementParameters = false;
522 for (const TrackStateOnSurface* tsos : *(track.trackStateOnSurfaces())) {
523 if (!tsos->trackParameters())
524 continue;
525
526 if (!haveFirstMeasurementParameters && tsos->type(TrackStateOnSurface::Measurement) &&
527 !tsos->type(TrackStateOnSurface::Outlier) && tsos->measurementOnTrack() &&
528 !(tsos->measurementOnTrack()->type(Trk::MeasurementBaseType::PseudoMeasurementOnTrack))) {
529 haveFirstMeasurementParameters = true;
530 parameters.push_back(tsos->trackParameters());
531 ATH_MSG_VERBOSE(" including first measurement parameters at R "
532 << tsos->trackParameters()->position().perp() << ", Z "
533 << tsos->trackParameters()->position().z());
534 parameterPositions.push_back(xAOD::FirstMeasurement);
535 continue;
536 }
537 if (!tsos->type(TrackStateOnSurface::Perigee) ||
538 !(tsos->trackParameters()->surfaceType() == Trk::SurfaceType::Perigee) ||
539 !(tsos->trackParameters()->type() == Trk::AtaSurface)) {
540 continue;
541 }
542 if (!aPer) {
543 aPer = static_cast<const Perigee*>(tsos->trackParameters());
544 } else {
545 parameters.push_back(tsos->trackParameters());
546 }
547
548 ATH_MSG_VERBOSE(" including perigee at R " << tsos->trackParameters()->position().perp() << ", Z "
549 << tsos->trackParameters()->position().z());
550
551 // we are not interested in keeping measurement parameters after any second perigee
552 if (!parameters.empty())
553 haveFirstMeasurementParameters = true;
554 }
555 }
556
557 xAOD::TrackParticle* trackparticle = createParticle(ctx,
558 aPer,
559 track.fitQuality(),
560 &track.info(),
561 summary,
562 parameters,
563 parameterPositions,
564 prtOrigin,
565 container,
566 &track);
567
568 static const SG::AuxElement::Accessor<int> nbCmeas("nBC_meas");
569 switch (m_badclusterID) {
570 case 1: {
571 nbCmeas(*trackparticle) = nbc_meas_A1;
572 break;
573 }
574 case 2: {
575 nbCmeas(*trackparticle) = nbc_meas_B3;
576 break;
577 }
578 case 3: {
579 nbCmeas(*trackparticle) = nbc_meas_A1_or_B3;
580 break;
581 }
582 case 4: {
583 nbCmeas(*trackparticle) = nbc_meas_A1_or_B3_or_C;
584 break;
585 }
586 default: {
587 }
588 }
589
590 delete parsToBeDeleted;
591 return trackparticle;
592}
#define M_PI
#define ATH_MSG_VERBOSE(x)
double charge(const T &p)
Definition AtlasPID.h:1003
double length(const pvec &v)
size_t size() const
Number of registered mappings.
const double width
std::reverse_iterator< const_iterator > const_reverse_iterator
Definition DataVector.h:847
virtual const Amg::Vector3D & normal() const override final
Get reconstruction local normal axes in global frame.
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
virtual const Surface & associatedSurface() const =0
Interface method to get the associated Surface.
const TrkDetElementBase * associatedDetectorElement() const
return associated Detector Element
BooleanProperty m_keepParameters
the following keep options are mutually exclusive
PublicToolHandle< IExtendedTrackSummaryTool > m_trackSummaryTool
BooleanProperty m_keepAllPerigee
keep all MeasuredPerigee parameters (e.g.
ToolHandle< Reco::ITrackToVertex > m_trackToVertex
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ Perigee
This represents a perigee, and so will contain a Perigee object only.
virtual Identifier identify() const =0
Identifier.
const Amg::Vector3D & position() const
Returns the 3-pos.
Eigen::Matrix< double, 3, 1 > Vector3D
bool first
Definition DeMoScan.py:534
DataVector< const Trk::TrackStateOnSurface > TrackStates
ParametersT< TrackParametersDim, Charged, PerigeeSurface > Perigee
@ pixelCluster
@ theta
Definition ParamDefs.h:66
@ y
Definition ParamDefs.h:56
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ getClusterSplittingProbability()

const Trk::ClusterSplitProbabilityContainer::ProbabilityInfo & Trk::TrackParticleCreatorTool::getClusterSplittingProbability ( const InDet::PixelCluster * pix) const
private

Definition at line 1311 of file TrackParticleCreatorTool.cxx.

1312{
1313 const EventContext& ctx = Gaudi::Hive::currentContext();
1314 if (!pix || m_clusterSplitProbContainer.key().empty()) {
1316 }
1317 SG::ReadHandle<Trk::ClusterSplitProbabilityContainer> splitProbContainer(m_clusterSplitProbContainer, ctx);
1318 if (!splitProbContainer.isValid()) {
1319 ATH_MSG_FATAL("Failed to get cluster splitting probability container "
1321 }
1322 return splitProbContainer->splitProbability(pix);
1323}
#define ATH_MSG_FATAL(x)
static const ProbabilityInfo & getNoSplitProbability()
SG::ReadHandleKey< Trk::ClusterSplitProbabilityContainer > m_clusterSplitProbContainer

◆ initialize()

StatusCode Trk::TrackParticleCreatorTool::initialize ( )
overridevirtual

Definition at line 126 of file TrackParticleCreatorTool.cxx.

127{
128
129 ATH_MSG_DEBUG("initialize TrackParticleCreatorTool");
130 ATH_CHECK(m_beamSpotKey.initialize());
131 if (std::find(std::begin(m_perigeeOptions), std::end(m_perigeeOptions), m_perigeeExpression) ==
132 std::end(m_perigeeOptions)) {
133 ATH_MSG_ERROR("Unknown Configuration for Perigee Expression - please use one of "
135 return StatusCode::FAILURE;
136 }
137
138 /* Retrieve track summary tool */
139 if (!m_trackSummaryTool.empty()) {
140 if (m_trackSummaryTool.retrieve().isFailure()) {
141 ATH_MSG_FATAL("Failed to retrieve tool " << m_trackSummaryTool);
142 return StatusCode::FAILURE;
143 }
144 ATH_MSG_DEBUG("Retrieved tool " << m_trackSummaryTool);
145 } else {
146 m_trackSummaryTool.disable();
147 }
148
149 if (detStore()->retrieve(m_detID, "AtlasID").isFailure()) {
150 ATH_MSG_FATAL("Could not get AtlasDetectorID ");
151 return StatusCode::FAILURE;
152 }
153
154 if (detStore()->retrieve(m_pixelID, "PixelID").isFailure()) {
155 ATH_MSG_FATAL("Could not get PixelID ");
156 return StatusCode::FAILURE;
157 }
158
159 if (detStore()->retrieve(m_sctID, "SCT_ID").isFailure()) {
160 ATH_MSG_FATAL("Could not get SCT_ID ");
161 return StatusCode::FAILURE;
162 }
163
164 if (m_doSharedTRTHits) {
165 if (detStore()->retrieve(m_trtID, "TRT_ID").isFailure()) {
166 ATH_MSG_FATAL("Could not get TRT_ID ");
167 return StatusCode::FAILURE;
168 }
169 }
170
171 if (!m_IBLParameterSvc.empty()) {
172 if (m_IBLParameterSvc.retrieve().isFailure()) {
173 ATH_MSG_FATAL("Could not retrieve IBLParameterSvc");
174 return StatusCode::FAILURE;
175 }
176 }
177
178 m_doIBL = !m_IBLParameterSvc.empty() && m_IBLParameterSvc->containsIBL();
179
180 if (m_doIBL && !m_IBLParameterSvc->contains3D()) {
181 ATH_MSG_WARNING("Assuming hybrid 2D/3D IBL module composition, but geometry is all-planar");
182 }
183
184 /* Retrieve track to vertex from ToolService */
185 if (m_trackToVertex.retrieve().isFailure()) {
186 ATH_MSG_FATAL("Failed to retrieve tool " << m_trackToVertex);
187 return StatusCode::FAILURE;
188 }
189 ATH_MSG_DEBUG("Retrieved tool " << m_trackToVertex);
190
191 if (!m_hitSummaryTool.empty()) {
192 /* Retrieve hit summary tool from ToolService */
193 if (m_hitSummaryTool.retrieve().isFailure()) {
194 ATH_MSG_FATAL("Failed to retrieve tool " << m_hitSummaryTool);
195 return StatusCode::FAILURE;
196 }
197 ATH_MSG_DEBUG("Retrieved tool " << m_hitSummaryTool);
198
199 } else {
200 m_hitSummaryTool.disable();
201 }
203
205
206 StatusCode sc(StatusCode::SUCCESS);
207 m_copyEProbabilities.clear();
210
211 if (!m_copyExtraSummaryName.empty()) {
212 std::map<std::string, std::pair<Trk::eProbabilityType, bool>> eprob_map;
213 std::map<std::string, Trk::SummaryType> extra_summary_type_map;
214 createEProbabilityMap(eprob_map);
215 createExtraSummaryTypeMap(extra_summary_type_map);
216
217 std::vector<std::string> errors;
218 for (const std::string& eprob_to_copy : m_copyExtraSummaryName) {
219 std::map<std::string, std::pair<Trk::eProbabilityType, bool>>::const_iterator eprob_iter =
220 eprob_map.find(eprob_to_copy);
221 if (eprob_iter == eprob_map.end()) {
222 std::map<std::string, Trk::SummaryType>::const_iterator extra_summary_type_iter =
223 extra_summary_type_map.find(eprob_to_copy);
224 if (extra_summary_type_iter == extra_summary_type_map.end()) {
225 errors.push_back(eprob_to_copy);
226 } else {
227 m_decorateSummaryTypes.emplace_back(
228 SG::AuxElement::Accessor<uint8_t>(extra_summary_type_iter->first),
229 extra_summary_type_iter->second);
230 }
231 } else {
232 if (!eprob_iter->second.second) {
233 m_copyEProbabilities.push_back(eprob_iter->second.first);
234 } else {
235 m_decorateEProbabilities.emplace_back(SG::AuxElement::Accessor<float>(eprob_iter->first),
236 eprob_iter->second.first);
237 }
238 }
239 }
240
241 if (!errors.empty()) {
242 ATH_MSG_ERROR("Error in configuration. Unknown electron probability name: "
243 << errors << ". known are " << eprob_map << " " << extra_summary_type_map);
244 sc = StatusCode::FAILURE;
245 }
246 }
247
248 ATH_CHECK( m_eProbabilityTool.retrieve( DisableTool{m_eProbabilityTool.empty()} ) );
249 ATH_CHECK( m_dedxtool.retrieve( DisableTool{m_dedxtool.empty()} ) );
250 ATH_CHECK( m_testPixelLayerTool.retrieve( DisableTool{m_testPixelLayerTool.empty()} ) );
251
252 ATH_CHECK(m_assoMapContainer.initialize(!m_assoMapContainer.key().empty()));
254 !m_clusterSplitProbContainer.key().empty()));
255
256 ATH_MSG_VERBOSE(" initialize successful.");
257 return sc;
258}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
static Double_t sc
ServiceHandle< ITrackingVolumesSvc > m_trackingVolumesSvc
StringArrayProperty m_copyExtraSummaryName
Configurable to set the eProbabilities and extra track summary types which are to be copied from the ...
std::vector< std::string > m_perigeeOptions
ToolHandle< Muon::IMuonHitSummaryTool > m_hitSummaryTool
SG::ReadCondHandleKey< AtlasFieldCacheCondObj > m_fieldCacheCondObjInputKey
ServiceHandle< IIBLParameterSvc > m_IBLParameterSvc
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ setDefiningParameters()

void Trk::TrackParticleCreatorTool::setDefiningParameters ( xAOD::TrackParticle & tp,
const Perigee & perigee ) const

Method to set Defining parameters of a xAOD::TrackParticle.

◆ setFitQuality()

void Trk::TrackParticleCreatorTool::setFitQuality ( xAOD::TrackParticle & tp,
const FitQuality & fq ) const

Method to set FitQuality of a xAOD::TrackParticle.

◆ setHitPattern()

void Trk::TrackParticleCreatorTool::setHitPattern ( xAOD::TrackParticle & tp,
unsigned long hitpattern )
static

Definition at line 871 of file TrackParticleCreatorTool.cxx.

872{
873 tp.setHitPattern(hitpattern);
874}
void setHitPattern(uint32_t hitpattern)

◆ setNumberOfOverflowHits()

void Trk::TrackParticleCreatorTool::setNumberOfOverflowHits ( xAOD::TrackParticle & tp,
int overflows )
static

Definition at line 883 of file TrackParticleCreatorTool.cxx.

884{
885 tp.setNumberOfIBLOverflowsdEdx(overflows);
886}

◆ setNumberOfUsedHits()

void Trk::TrackParticleCreatorTool::setNumberOfUsedHits ( xAOD::TrackParticle & tp,
int hits )
static

Definition at line 877 of file TrackParticleCreatorTool.cxx.

878{
880}

◆ setParameters()

void Trk::TrackParticleCreatorTool::setParameters ( const EventContext & ctx,
xAOD::TrackParticle & tp,
const std::vector< const Trk::TrackParameters * > & parameters,
const std::vector< xAOD::ParameterPosition > & positions ) const

Method to set parameters of a xAOD::TrackParticle.

Definition at line 780 of file TrackParticleCreatorTool.cxx.

784{
785 std::vector<std::vector<float>> parametersVec;
786 parametersVec.resize(parameters.size());
787 unsigned int numParam = 0;
788
789 SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{ m_fieldCacheCondObjInputKey, ctx };
790 const AtlasFieldCacheCondObj* fieldCondObj{ *readHandle };
791 if (!fieldCondObj)[[unlikely]]{
792 ATH_MSG_ERROR("fieldCondObj is nullptr in TrackParticleCreatorTool::setParameters");
793 return;
794 }
795 MagField::AtlasFieldCache fieldCache;
796 //cppcheck-suppress nullPointerRedundantCheck
797 fieldCondObj->getInitializedCache(fieldCache);
798
799 for (const auto* param : parameters) {
800 std::vector<float>& values = parametersVec[numParam];
801 values.resize(6);
802 const Amg::Vector3D& pos = param->position();
803 const Amg::Vector3D& mom = param->momentum();
804 values[0] = pos[0];
805 values[1] = pos[1];
806 values[2] = pos[2];
807 values[3] = mom[0];
808 values[4] = mom[1];
809 values[5] = mom[2];
810
811 const bool straightPars = (!fieldCache.solenoidOn() && m_trackingVolumesSvc->volume(Trk::ITrackingVolumesSvc::CalorimeterEntryLayer).inside(pos)) ||
814 AmgSymMatrix(5) covarianceMatrix;
815 covarianceMatrix.setIdentity();
816
817 if (param->covariance()) {
818 // has covariance matrix
819 // now convert from to Curvilinear -- to be double checked for correctness
820 CurvilinearUVT curvilinearUVT(mom.unit());
821 if (!straightPars){
822 Amg::Vector3D magnFieldVect;
823 magnFieldVect.setZero();
824 fieldCache.getField(pos.data(), magnFieldVect.data());
825 const Amg::Transform3D& localToGlobalTransform = param->associatedSurface().transform();
826
827 JacobianLocalToCurvilinear jacobian(magnFieldVect,
828 param->parameters()[Trk::qOverP],
829 std::sin(param->parameters()[Trk::theta]),
830 curvilinearUVT,
831 localToGlobalTransform.rotation().col(0),
832 localToGlobalTransform.rotation().col(1));
833
834 covarianceMatrix = param->covariance()->similarity(jacobian);
835 } else {
836 const Amg::Vector3D loc_x {param->parameters()[Trk::locX],0,0};
837 const Amg::Vector3D loc_y {0,param->parameters()[Trk::locY],0};
838 JacobianLocalToCurvilinear jacobian(curvilinearUVT, loc_x, loc_y);
839 covarianceMatrix = param->covariance()->similarity(jacobian);
840 }
841 }
842 std::vector<float> covMatrixVec;
843 Amg::compress(covarianceMatrix, covMatrixVec);
844 tp.setTrackParameterCovarianceMatrix(numParam, covMatrixVec);
845
846 ++numParam;
847 }
848
849 tp.setTrackParameters(parametersVec);
850 unsigned int i = 0;
851 for (; i < positions.size(); ++i) {
852 tp.setParameterPosition(i, positions[i]);
853 if (positions[i] == xAOD::FirstMeasurement) {
854 float x_position = tp.parameterX(i);
855 float y_position = tp.parameterY(i);
856 tp.setRadiusOfFirstHit(std::sqrt(x_position * x_position + y_position * y_position));
858 parameters[i]->associatedSurface().associatedDetectorElementIdentifier().get_compact());
859 }
860 }
861}
#define AmgSymMatrix(dim)
if(pathvar)
void getInitializedCache(MagField::AtlasFieldCache &cache) const
get B field cache for evaluation as a function of 2-d or 3-d position.
bool solenoidOn() const
status of the magnets
void getField(const double *ATH_RESTRICT xyz, double *ATH_RESTRICT bxyz, double *ATH_RESTRICT deriv=nullptr)
get B field value at given position xyz[3] is in mm, bxyz[3] is in kT if deriv[9] is given,...
@ MuonSpectrometerExitLayer
Tracking Volume which defines the outer surfaces of the MS.
@ CalorimeterEntryLayer
Tracking Volume which defines the entrance srufaces of the calorimeter.
@ MuonSpectrometerEntryLayer
Tracking Volume which defines the entrance surfaces of the MS.
void setTrackParameterCovarianceMatrix(unsigned int index, std::vector< float > &cov)
Set the cov matrix of the parameter at 'index', using a vector of floats.
void setTrackParameters(std::vector< std::vector< float > > &parameters)
Set the parameters via the passed vector of vectors.
void setIdentifierOfFirstHit(uint64_t id)
Set the offline identifier of the first hit.
void setRadiusOfFirstHit(float radius)
Set the radius of the first hit.
void setParameterPosition(unsigned int index, ParameterPosition pos)
Set the 'position' (i.e. where it is in ATLAS) of the parameter at 'index', using the ParameterPositi...
float parameterX(unsigned int index) const
Returns the parameter x position, for 'index'.
float parameterY(unsigned int index) const
Returns the parameter y position, for 'index'.
void compress(const AmgSymMatrix(N) &covMatrix, std::vector< float > &vec)
Eigen::Affine3d Transform3D
@ locY
local cartesian
Definition ParamDefs.h:38
@ locX
Definition ParamDefs.h:37
@ qOverP
perigee
Definition ParamDefs.h:67
#define unlikely(x)

◆ setTilt()

void Trk::TrackParticleCreatorTool::setTilt ( xAOD::TrackParticle & tp,
float tiltx,
float tilty )
static

Definition at line 864 of file TrackParticleCreatorTool.cxx.

865{
866 tp.setBeamlineTiltX(tiltx);
867 tp.setBeamlineTiltY(tilty);
868}
void setBeamlineTiltX(float tiltX)
void setBeamlineTiltY(float tiltY)

◆ setTrackInfo()

void Trk::TrackParticleCreatorTool::setTrackInfo ( xAOD::TrackParticle & tp,
const TrackInfo & trackInfo,
xAOD::ParticleHypothesis prtOrigin ) const

Method to set TrackInfo of a xAOD::TrackParticle.

◆ setTrackSummary()

void Trk::TrackParticleCreatorTool::setTrackSummary ( xAOD::TrackParticle & tp,
const TrackSummary & summary ) const

Method to set TrackSummary of a xAOD::TrackParticle.

Definition at line 889 of file TrackParticleCreatorTool.cxx.

890{
891 // ensure that xAOD TrackSummary and TrackSummary enums are in sync.
892 constexpr unsigned int xAodReferenceEnum1 = static_cast<unsigned int>(xAOD::numberOfTRTXenonHits);
893 constexpr unsigned int TrkReferenceEnum1 = static_cast<unsigned int>(Trk::numberOfTRTXenonHits);
894 static_assert(xAodReferenceEnum1 == TrkReferenceEnum1, "Trk and xAOD enums differ in their indices");
895 constexpr unsigned int xAodReferenceEnum2 = static_cast<unsigned int>(xAOD::numberOfTRTTubeHits);
896 constexpr unsigned int TrkReferenceEnum2 = static_cast<unsigned int>(Trk::numberOfTRTTubeHits);
897 static_assert(xAodReferenceEnum2 == TrkReferenceEnum2, "Trk and xAOD enums differ in their indices");
898
899 for (unsigned int i = 0; i < Trk::numberOfTrackSummaryTypes; i++) {
900 // Only add values which are +ve (i.e., which were created)
902 continue;
903 }
905 continue;
906 }
908 continue;
909 }
910 // skip values which are floats
911 if (std::find(unusedSummaryTypes.begin(), unusedSummaryTypes.end(), i) != unusedSummaryTypes.end()) {
912 continue;
913 }
915 continue;
916 }
917 if (m_doITk && i == Trk::numberOfContribPixelLayers){ // Filled in addDetailedHitInformation for ITk
918 continue;
919 }
920
921 int value = summary.get(static_cast<Trk::SummaryType>(i));
922 uint8_t uvalue = static_cast<uint8_t>(std::min(value,255));
923 // coverity[first_enum_type]
924 if (value > 0) {
925 tp.setSummaryValue(uvalue, static_cast<xAOD::SummaryType>(i));
926 }
927 }
928
929 // muon hit info
930 if (!m_hitSummaryTool.empty()) {
931 ATH_MSG_DEBUG("now do muon hit info");
932 Muon::IMuonHitSummaryTool::CompactSummary msSummary = m_hitSummaryTool->summary(summary);
934 ATH_MSG_DEBUG("# of prec layers: " << static_cast<unsigned int>(numberOfPrecisionLayers));
940 tp.setSummaryValue(numberOfPrecisionLayers, xAOD::numberOfPrecisionLayers);
941 tp.setSummaryValue(numberOfPrecisionHoleLayers, xAOD::numberOfPrecisionHoleLayers);
942 tp.setSummaryValue(numberOfPhiLayers, xAOD::numberOfPhiLayers);
943 tp.setSummaryValue(numberOfPhiHoleLayers, xAOD::numberOfPhiHoleLayers);
944 tp.setSummaryValue(numberOfTriggerEtaLayers, xAOD::numberOfTriggerEtaLayers);
945 tp.setSummaryValue(numberOfTriggerEtaHoleLayers, xAOD::numberOfTriggerEtaHoleLayers);
946 }
947
948}
static const std::vector< unsigned int > unusedSummaryTypes
@ numberOfTgcPhiHoles
number of TGC Phi measurements missing from the track
@ numberOfContribPixelLayers
number of contributing layers of the pixel detector
@ numberOfStgcEtaHits
number of TGC Eta measurements missing from the track
@ numberOfMmHoles
number of TGC Eta measurements missing from the track
@ numberOfTRTTubeHits
number of TRT hits on track in straws with xenon
@ numberOfCscUnspoiltEtaHits
number of unspoilt CSC eta measurements (all CSC phi measurements are by definition spoilt).
@ numberOfCscEtaHoles
number of CSC Eta measurements missing from the track
@ numberOfPrecisionLayers
layers with at least 3 hits [unit8_t].
@ numberOfTriggerEtaHoleLayers
layers with trigger eta holes but no hits [unit8_t].
@ numberOfPhiHoleLayers
layers with trigger phi holes but no hits [unit8_t].
@ numberOfTRTXenonHits
number of TRT hits on track in straws with xenon [unit8_t].
@ numberOfTRTTubeHits
number of TRT tube hits [unit8_t].
@ numberOfTriggerEtaLayers
layers with trigger eta hits [unit8_t].
@ numberOfPhiLayers
layers with a trigger phi hit [unit8_t].
@ numberOfPrecisionHoleLayers
layers with holes AND no hits [unit8_t].
unsigned int nphiHoleLayers
number of eta trigger layer holes
unsigned int ntrigEtaLayers
number of phi layers
unsigned int ntrigEtaHoleLayers
number of precision holes
unsigned int nphiLayers
number of precision layers
unsigned int nprecisionHoleLayers
number of eta trigger layers

◆ trtdEdxUsedHitsAuxName()

const std::string & Trk::TrackParticleCreatorTool::trtdEdxUsedHitsAuxName ( )
inlinestatic

Get the name used for the decoration of the track particle with the number of used hits for TRT dE/dx computation.

Definition at line 201 of file TrackParticleCreatorTool.h.

202 {
204 }
static const std::string s_trtdEdxUsedHitsDecorationName
Name used for the decoration of the track particle with TRT dE/dx .

Member Data Documentation

◆ m_assoMapContainer

SG::ReadHandleKey<Trk::PRDtoTrackMap> Trk::TrackParticleCreatorTool::m_assoMapContainer { this, "AssociationMapName", ""}
private

Definition at line 333 of file TrackParticleCreatorTool.h.

333{ this, "AssociationMapName", ""};

◆ m_badclusterID

IntegerProperty Trk::TrackParticleCreatorTool::m_badclusterID {this, "BadClusterID", 0}
private

Definition at line 319 of file TrackParticleCreatorTool.h.

319{this, "BadClusterID", 0};

◆ m_beamSpotKey

SG::ReadCondHandleKey<InDet::BeamSpotData> Trk::TrackParticleCreatorTool::m_beamSpotKey { this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" }
private

Definition at line 331 of file TrackParticleCreatorTool.h.

331{ this, "BeamSpotKey", "BeamSpotData", "SG key for beam spot" };

◆ m_checkConversion

BooleanProperty Trk::TrackParticleCreatorTool::m_checkConversion {this, "CheckConversion", true}
private

Definition at line 327 of file TrackParticleCreatorTool.h.

327{this, "CheckConversion", true};

◆ m_clusterSplitProbContainer

SG::ReadHandleKey<Trk::ClusterSplitProbabilityContainer> Trk::TrackParticleCreatorTool::m_clusterSplitProbContainer { this, "ClusterSplitProbabilityName", "", "" }
private

Definition at line 332 of file TrackParticleCreatorTool.h.

332{ this, "ClusterSplitProbabilityName", "", "" };

◆ m_computeAdditionalInfo

BooleanProperty Trk::TrackParticleCreatorTool::m_computeAdditionalInfo {this, "ComputeAdditionalInfo", false}
private

Definition at line 302 of file TrackParticleCreatorTool.h.

302{this, "ComputeAdditionalInfo", false};

◆ m_copyEProbabilities

std::vector<Trk::eProbabilityType> Trk::TrackParticleCreatorTool::m_copyEProbabilities
private

Enums of an eProbability which are set in the xAOD::TrackSummary.

Definition at line 285 of file TrackParticleCreatorTool.h.

◆ m_copyExtraSummaryName

StringArrayProperty Trk::TrackParticleCreatorTool::m_copyExtraSummaryName
private
Initial value:
{this, "ExtraSummaryTypes",
{"eProbabilityComb", "eProbabilityHT", "eProbabilityNN",
"TRTTrackOccupancy", "TRTdEdx", "TRTdEdxUsedHits"}}

Configurable to set the eProbabilities and extra track summary types which are to be copied from the track summary.

Definition at line 280 of file TrackParticleCreatorTool.h.

280 {this, "ExtraSummaryTypes",
281 {"eProbabilityComb", "eProbabilityHT", "eProbabilityNN",
282 "TRTTrackOccupancy", "TRTdEdx", "TRTdEdxUsedHits"}};

◆ m_decorateEProbabilities

std::vector<std::pair<SG::AuxElement::Accessor<float>, Trk::eProbabilityType> > Trk::TrackParticleCreatorTool::m_decorateEProbabilities
private

The pairs if enums of an eProbability which is added as a decoration to the track particle and the name of the decoration.

Definition at line 290 of file TrackParticleCreatorTool.h.

◆ m_decorateSummaryTypes

std::vector<std::pair<SG::AuxElement::Accessor<uint8_t>, Trk::SummaryType> > Trk::TrackParticleCreatorTool::m_decorateSummaryTypes
private

Definition at line 292 of file TrackParticleCreatorTool.h.

◆ m_dedxtool

ToolHandle<IPixelToTPIDTool> Trk::TrackParticleCreatorTool::m_dedxtool { this, "PixelToTPIDTool", "", "" }
private

tool to calculate dE/dx using pixel clusters

Definition at line 270 of file TrackParticleCreatorTool.h.

270{ this, "PixelToTPIDTool", "", "" };

◆ m_detID

const AtlasDetectorID* Trk::TrackParticleCreatorTool::m_detID
private

atlas id helper

Definition at line 225 of file TrackParticleCreatorTool.h.

◆ m_doIBL

bool Trk::TrackParticleCreatorTool::m_doIBL
private

Definition at line 298 of file TrackParticleCreatorTool.h.

◆ m_doITk

BooleanProperty Trk::TrackParticleCreatorTool::m_doITk {this, "DoITk", false}
private

if the track contains a summary, the shared, expected hit, and PID information will be recomputed.

The summary of the track is not updated.

Definition at line 299 of file TrackParticleCreatorTool.h.

299{this, "DoITk", false};

◆ m_doSharedSiHits

BooleanProperty Trk::TrackParticleCreatorTool::m_doSharedSiHits {this, "DoSharedSiHits", false}
private

Definition at line 303 of file TrackParticleCreatorTool.h.

303{this, "DoSharedSiHits", false};

◆ m_doSharedTRTHits

BooleanProperty Trk::TrackParticleCreatorTool::m_doSharedTRTHits {this, "DoSharedTRTHits", false}
private

Definition at line 304 of file TrackParticleCreatorTool.h.

304{this, "DoSharedTRTHits", false};

◆ m_eProbabilityTool

ToolHandle<ITRT_ElectronPidTool> Trk::TrackParticleCreatorTool::m_eProbabilityTool
private
Initial value:
{ this,
"TRT_ElectronPidTool",
"",
"" }

tool to calculate electron probabilities

Definition at line 265 of file TrackParticleCreatorTool.h.

265 { this,
266 "TRT_ElectronPidTool",
267 "",
268 "" };

◆ m_fieldCacheCondObjInputKey

SG::ReadCondHandleKey<AtlasFieldCacheCondObj> Trk::TrackParticleCreatorTool::m_fieldCacheCondObjInputKey
private
Initial value:
{
this,
"AtlasFieldCacheCondObj",
"fieldCondObj",
"Name of the Magnetic Field conditions object key"
}

Definition at line 257 of file TrackParticleCreatorTool.h.

257 {
258 this,
259 "AtlasFieldCacheCondObj",
260 "fieldCondObj",
261 "Name of the Magnetic Field conditions object key"
262 };

◆ m_hitSummaryTool

ToolHandle<Muon::IMuonHitSummaryTool> Trk::TrackParticleCreatorTool::m_hitSummaryTool
private
Initial value:
{
this,
"MuonSummaryTool",
""
}

Definition at line 242 of file TrackParticleCreatorTool.h.

242 {
243 this,
244 "MuonSummaryTool",
245 ""
246 };

◆ m_IBLParameterSvc

ServiceHandle<IIBLParameterSvc> Trk::TrackParticleCreatorTool::m_IBLParameterSvc
private
Initial value:
{
this,
"IBLParameterSvc",
"IBLParameterSvc"
}

Definition at line 248 of file TrackParticleCreatorTool.h.

248 {
249 this,
250 "IBLParameterSvc",
251 "IBLParameterSvc"
252 };

◆ m_itkDecorationLevel

Gaudi::Property<int> Trk::TrackParticleCreatorTool::m_itkDecorationLevel {this, "ITkDecorationLevel", 1, ">=200 split counts for inclined and flat barrel." }
private

Definition at line 336 of file TrackParticleCreatorTool.h.

337{this, "ITkDecorationLevel", 1, ">=200 split counts for inclined and flat barrel." };

◆ m_keepAllPerigee

BooleanProperty Trk::TrackParticleCreatorTool::m_keepAllPerigee {this, "KeepAllPerigee", false}
private

keep all MeasuredPerigee parameters (e.g.

adding those that may exist at Volume boundaries)

Definition at line 315 of file TrackParticleCreatorTool.h.

315{this, "KeepAllPerigee", false};

◆ m_keepFirstParameters

BooleanProperty Trk::TrackParticleCreatorTool::m_keepFirstParameters {this, "KeepFirstParameters", false}
private

Definition at line 312 of file TrackParticleCreatorTool.h.

312{this, "KeepFirstParameters", false};

◆ m_keepParameters

BooleanProperty Trk::TrackParticleCreatorTool::m_keepParameters {this, "KeepParameters", false}
private

the following keep options are mutually exclusive

keep all TrackParameters keep the first parameters when creating track particles.

Definition at line 310 of file TrackParticleCreatorTool.h.

310{this, "KeepParameters", false};

◆ m_minPt

DoubleProperty Trk::TrackParticleCreatorTool::m_minPt {this, "MinPtForCaloExtrap", 1000.}
private

Definition at line 329 of file TrackParticleCreatorTool.h.

329{this, "MinPtForCaloExtrap", 1000.};

◆ m_minSiHits

IntegerProperty Trk::TrackParticleCreatorTool::m_minSiHits {this, "MinSiHitsForCaloExtrap", 4}
private

Definition at line 328 of file TrackParticleCreatorTool.h.

328{this, "MinSiHitsForCaloExtrap", 4};

◆ m_perigeeExpression

StringProperty Trk::TrackParticleCreatorTool::m_perigeeExpression {this, "PerigeeExpression", "BeamLine"}
private

Definition at line 321 of file TrackParticleCreatorTool.h.

321{this, "PerigeeExpression", "BeamLine"};

◆ m_perigeeOptions

std::vector<std::string> Trk::TrackParticleCreatorTool::m_perigeeOptions
private
Initial value:
{ "BeamLine",
"BeamSpot",
"Vertex",
"Origin" }

Definition at line 322 of file TrackParticleCreatorTool.h.

322 { "BeamLine",
323 "BeamSpot",
324 "Vertex",
325 "Origin" };

◆ m_pixelID

const PixelID* Trk::TrackParticleCreatorTool::m_pixelID
private

Definition at line 226 of file TrackParticleCreatorTool.h.

◆ m_runningTIDE_Ambi

BooleanProperty Trk::TrackParticleCreatorTool::m_runningTIDE_Ambi {this, "RunningTIDE_Ambi", false}
private

Definition at line 305 of file TrackParticleCreatorTool.h.

305{this, "RunningTIDE_Ambi", false};

◆ m_sctID

const SCT_ID* Trk::TrackParticleCreatorTool::m_sctID
private

Definition at line 227 of file TrackParticleCreatorTool.h.

◆ m_testPixelLayerTool

ToolHandle<InDet::IInDetTestPixelLayerTool> Trk::TrackParticleCreatorTool::m_testPixelLayerTool
private
Initial value:
{ this,
"TestPixelLayerTool",
"",
"" }

tool to calculate expected hit information in innermost layers

Definition at line 273 of file TrackParticleCreatorTool.h.

273 { this,
274 "TestPixelLayerTool",
275 "",
276 "" };

◆ m_trackingVolumesSvc

ServiceHandle<ITrackingVolumesSvc> Trk::TrackParticleCreatorTool::m_trackingVolumesSvc {this,"TrackingVolumesSvc","Trk::TrackingVolumesSvc/TrackingVolumesSvc"}
private

Definition at line 254 of file TrackParticleCreatorTool.h.

254{this,"TrackingVolumesSvc","Trk::TrackingVolumesSvc/TrackingVolumesSvc"};

◆ m_trackSummaryTool

PublicToolHandle<IExtendedTrackSummaryTool> Trk::TrackParticleCreatorTool::m_trackSummaryTool
private
Initial value:
{
this,
"TrackSummaryTool",
"Trk::TrackSummaryTool/AtlasTrackSummaryTool"
}

Definition at line 231 of file TrackParticleCreatorTool.h.

231 {
232 this,
233 "TrackSummaryTool",
234 "Trk::TrackSummaryTool/AtlasTrackSummaryTool"
235 };

◆ m_trackToVertex

ToolHandle<Reco::ITrackToVertex> Trk::TrackParticleCreatorTool::m_trackToVertex
private
Initial value:
{
this,
"TrackToVertex",
"Reco::TrackToVertex/TrackToVertex"
}

Definition at line 237 of file TrackParticleCreatorTool.h.

237 {
238 this,
239 "TrackToVertex",
240 "Reco::TrackToVertex/TrackToVertex"
241 };

◆ m_trtID

const TRT_ID* Trk::TrackParticleCreatorTool::m_trtID
private

Definition at line 228 of file TrackParticleCreatorTool.h.

◆ m_updateTrackSummary

BooleanProperty Trk::TrackParticleCreatorTool::m_updateTrackSummary {this, "UpdateTrackSummary", false}
private

Definition at line 306 of file TrackParticleCreatorTool.h.

306{this, "UpdateTrackSummary", false};

◆ s_expertLevel

int Trk::TrackParticleCreatorTool::s_expertLevel = 200
staticconstexprprivate

Definition at line 335 of file TrackParticleCreatorTool.h.

◆ s_trtdEdxUsedHitsDecoration

const SG::AuxElement::Accessor< uint8_t > Trk::TrackParticleCreatorTool::s_trtdEdxUsedHitsDecoration
staticprivate

Definition at line 296 of file TrackParticleCreatorTool.h.

◆ s_trtdEdxUsedHitsDecorationName

const std::string Trk::TrackParticleCreatorTool::s_trtdEdxUsedHitsDecorationName { "TRTdEdxUsedHits" }
staticprivate

Name used for the decoration of the track particle with TRT dE/dx .

Definition at line 295 of file TrackParticleCreatorTool.h.


The documentation for this class was generated from the following files: