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", ""}

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

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 993 of file TrackParticleCreatorTool.cxx.

994{
995
996 Trk::DetailedHitInfo detailedInfo;
997
998 for (const TrackStateOnSurface* tsos : *trackStates) {
999
1000 const Trk::MeasurementBase* mesb = tsos->measurementOnTrack();
1001 if(mesb==nullptr) continue;
1002 // Check if the measurement type is RIO on Track (ROT)
1003 const RIO_OnTrack* rot = nullptr;
1005 rot = static_cast<const RIO_OnTrack*>(mesb);
1006 }
1007 if(rot==nullptr) continue;
1008
1009 const Identifier& id = rot->identify();
1010 if(!m_pixelID->is_pixel(id)) continue;
1011
1012 Trk::DetectorRegion region;
1013 const InDetDD::SiDetectorElement* detEl = dynamic_cast<const InDetDD::SiDetectorElement*>(rot->detectorElement());
1016 else if(type==InDetDD::PixelBarrel) region = Trk::pixelBarrelFlat;
1017 else region = Trk::pixelEndcap;
1018
1019 detailedInfo.addHit(region, m_pixelID->layer_disk(id), m_pixelID->eta_module(id));
1020
1021 }
1022
1023 uint8_t nContribPixelLayers = static_cast<uint8_t>(detailedInfo.getPixelContributions());
1024
1025 uint8_t nContribPixelBarrelFlatLayers = static_cast<uint8_t>(detailedInfo.getContributionFromRegion(Trk::pixelBarrelFlat ));
1026 uint8_t nContribPixelBarrelInclinedLayers = static_cast<uint8_t>(detailedInfo.getContributionFromRegion(Trk::pixelBarrelInclined));
1027 uint8_t nContribPixelEndcap = static_cast<uint8_t>(detailedInfo.getContributionFromRegion(Trk::pixelEndcap ));
1028
1029 uint8_t nPixelBarrelFlatHits = static_cast<uint8_t>(detailedInfo.getHitsFromRegion(Trk::pixelBarrelFlat ));
1030 uint8_t nPixelBarrelInclinedHits = static_cast<uint8_t>(detailedInfo.getHitsFromRegion(Trk::pixelBarrelInclined));
1031 uint8_t nPixelEndcapHits = static_cast<uint8_t>(detailedInfo.getHitsFromRegion(Trk::pixelEndcap ));
1032
1033 uint8_t nInnermostPixelLayerEndcapHits = static_cast<uint8_t>(detailedInfo.getHits(Trk::pixelEndcap, 0));
1034 uint8_t nNextToInnermostPixelLayerEndcapHits = static_cast<uint8_t>(detailedInfo.getHits(Trk::pixelEndcap, 1)
1035 + detailedInfo.getHits(Trk::pixelEndcap, 2)); // L0.5 shorties + L1
1036
1037 tp.setSummaryValue(nContribPixelLayers, xAOD::numberOfContribPixelLayers);
1038 tp.setSummaryValue(nContribPixelBarrelFlatLayers, xAOD::numberOfContribPixelBarrelFlatLayers);
1039 tp.setSummaryValue(nContribPixelBarrelInclinedLayers, xAOD::numberOfContribPixelBarrelInclinedLayers);
1040 tp.setSummaryValue(nContribPixelEndcap, xAOD::numberOfContribPixelEndcap);
1041 tp.setSummaryValue(nPixelBarrelFlatHits, xAOD::numberOfPixelBarrelFlatHits);
1042 tp.setSummaryValue(nPixelBarrelInclinedHits, xAOD::numberOfPixelBarrelInclinedHits);
1043 tp.setSummaryValue(nPixelEndcapHits, xAOD::numberOfPixelEndcapHits);
1044 tp.setSummaryValue(nInnermostPixelLayerEndcapHits, xAOD::numberOfInnermostPixelLayerEndcapHits);
1045 tp.setSummaryValue(nNextToInnermostPixelLayerEndcapHits, xAOD::numberOfNextToInnermostPixelLayerEndcapHits);
1046
1047}
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.
@ 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].
@ 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].

◆ 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 1283 of file TrackParticleCreatorTool.cxx.

1284{
1285
1286 uint8_t nInPixSharedEndcapHits = 0, nNInPixSharedEndcapHits = 0;
1287 uint8_t nInPixSplitEndcapHits = 0, nNInPixSplitEndcapHits = 0;
1288
1289 tp.setSummaryValue(nInPixSplitEndcapHits, xAOD::numberOfInnermostPixelLayerSplitEndcapHits);
1290 tp.setSummaryValue(nNInPixSplitEndcapHits, xAOD::numberOfNextToInnermostPixelLayerSplitEndcapHits);
1291 tp.setSummaryValue(nInPixSharedEndcapHits, xAOD::numberOfInnermostPixelLayerSharedEndcapHits);
1292 tp.setSummaryValue(nNInPixSharedEndcapHits, xAOD::numberOfNextToInnermostPixelLayerSharedEndcapHits);
1293
1294}
@ 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 1050 of file TrackParticleCreatorTool.cxx.

1051{
1052
1053 if(m_testPixelLayerTool.empty() || perigee==nullptr) return;
1054
1055 uint8_t zero = static_cast<uint8_t>(0);
1056 uint8_t nContribPixLayers, nInPixHits, nNextInPixHits;
1057 if(!tp.summaryValue(nContribPixLayers, xAOD::numberOfContribPixelLayers)){
1058 nContribPixLayers = zero;
1059 }
1060 if(nContribPixLayers==0){
1061 ATH_MSG_DEBUG("No pixels on track, so wo do not expect hit in inner layers");
1062 tp.setSummaryValue(zero, xAOD::expectInnermostPixelLayerHit);
1064 }
1065
1066 else {
1067
1068 // Innermost pixel layer
1069 if(!tp.summaryValue(nInPixHits, xAOD::numberOfInnermostPixelLayerHits)){
1070 nInPixHits = zero;
1071 }
1072 if(nInPixHits>0){
1073 ATH_MSG_DEBUG("Innermost pixel Layer hit on track, so we expect an innermost pixel layer hit");
1074 uint8_t one = static_cast<uint8_t>(1);
1075 tp.setSummaryValue(one, xAOD::expectInnermostPixelLayerHit);
1076 } else {
1077 uint8_t expectHit = static_cast<uint8_t>(m_testPixelLayerTool->expectHitInInnermostPixelLayer(perigee));
1078 tp.setSummaryValue(expectHit, xAOD::expectInnermostPixelLayerHit);
1079 }
1080
1081 // Next-to-innermost pixel layer
1082 if(!tp.summaryValue(nNextInPixHits, xAOD::numberOfNextToInnermostPixelLayerHits)){
1083 nNextInPixHits = zero;
1084 }
1085 if(nNextInPixHits>0){
1086 ATH_MSG_DEBUG("Next-to-innermost pixel Layer hit on track, so we expect an next-to-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->expectHitInNextToInnermostPixelLayer(perigee));
1091 tp.setSummaryValue(expectHit, xAOD::expectNextToInnermostPixelLayerHit);
1092 }
1093
1094 } // end else if nContribPixLayers>0
1095
1096}
#define ATH_MSG_DEBUG(x)
ToolHandle< InDet::IInDetTestPixelLayerTool > m_testPixelLayerTool
tool to calculate expected hit information in innermost layers
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 1099 of file TrackParticleCreatorTool.cxx.

1100{
1101
1102 uint8_t nPixOutliers = 0, nInPixOutliers = 0, nNInPixOutliers = 0, nSCTOutliers = 0;
1103 uint8_t nInEndcapPixOutliers = 0, nNInEndcapPixOutliers = 0;
1104
1105 for (const TrackStateOnSurface* tsos : *trackStates) {
1106
1107 bool isOutlier = tsos->type(Trk::TrackStateOnSurface::Outlier);
1108 if(!isOutlier) continue;
1109
1110 const Trk::MeasurementBase* mesb = tsos->measurementOnTrack();
1111 if(mesb==nullptr) continue;
1112 // Check if the measurement type is RIO on Track (ROT)
1113 const RIO_OnTrack* rot = nullptr;
1115 rot = static_cast<const RIO_OnTrack*>(mesb);
1116 }
1117 if (rot == nullptr)
1118 continue;
1119
1120 const Identifier& id = rot->identify();
1121
1122 if (m_pixelID->is_pixel(id)) {
1123 nPixOutliers++;
1124 int layer = m_pixelID->layer_disk(id);
1125 if (m_pixelID->is_barrel(id)) {
1126 if (layer == 0){
1127 nInPixOutliers++;
1128 }
1129 else if (layer == 1){
1130 nNInPixOutliers++;
1131 }
1132 } else if (m_doITk) { // isITk && isEndCap -> ITk specific counters
1133 if (layer == 0){
1134 nInEndcapPixOutliers++;
1135 }
1136 else if (layer == 1 || layer == 2){
1137 nNInEndcapPixOutliers++; // L0.5 + L1 disks
1138 }
1139 }
1140 }
1141 else if (m_sctID->is_sct(id)) {
1142 nSCTOutliers++;
1143 }
1144
1145 // TRT outliers are already filled in the InDetTrackSummaryHelperTool as
1146 // used in the ambi solver
1147 }
1148
1149 tp.setSummaryValue(nPixOutliers, xAOD::numberOfPixelOutliers);
1150 tp.setSummaryValue(nInPixOutliers, xAOD::numberOfInnermostPixelLayerOutliers);
1151 tp.setSummaryValue(nNInPixOutliers, xAOD::numberOfNextToInnermostPixelLayerOutliers);
1152 tp.setSummaryValue(nSCTOutliers, xAOD::numberOfSCTOutliers);
1153
1154 if(m_doITk){
1155 tp.setSummaryValue(nInEndcapPixOutliers, xAOD::numberOfInnermostPixelLayerEndcapOutliers);
1156 tp.setSummaryValue(nNInEndcapPixOutliers, xAOD::numberOfNextToInnermostPixelLayerEndcapOutliers);
1157 }
1158
1159}
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 944 of file TrackParticleCreatorTool.cxx.

945{
946 // TRT PID information
947 {
948 static const std::vector<float> eProbabilityDefault(numberOfeProbabilityTypes,0.5);
949 constexpr int initialValue{-1};
950 std::vector<float> eProbability_tmp;
951 const std::vector<float>& eProbability(
952 track && !m_eProbabilityTool.empty()
953 ? eProbability_tmp =
954 m_eProbabilityTool->electronProbability(ctx, *track)
956 int nHits = track && !m_eProbabilityTool.empty()
958 : initialValue;
959 for (const Trk::eProbabilityType& copy : m_copyEProbabilities) {
960 float eProbability_value = eProbability.at(copy);
961 tp.setSummaryValue(eProbability_value, static_cast<xAOD::SummaryType>(copy + xAOD::eProbabilityComb));
962 }
963 for (const std::pair<SG::AuxElement::Accessor<float>, Trk::eProbabilityType>& decoration :
965 float fvalue = eProbability.at(decoration.second);
966 decoration.first(tp) = fvalue;
967 }
968 // now the extra summary types
969 for (const std::pair<SG::AuxElement::Accessor<uint8_t>, Trk::SummaryType>& decoration :
971 uint8_t summary_value = nHits;
972 decoration.first(tp) = summary_value;
973 }
974
975 }
976
977 // PixelPID
978 {
979 const int initialValue{-1};
980 float dedx = initialValue;
981 int nHitsUsed_dEdx = initialValue;
982 int nOverflowHits_dEdx = initialValue;
983 if (track && !m_dedxtool.empty() && track->info().trackFitter() != TrackInfo::Unknown) {
984 dedx = m_dedxtool->dEdx(ctx, *track, nHitsUsed_dEdx, nOverflowHits_dEdx);
985 }
986 tp.setNumberOfUsedHitsdEdx(nHitsUsed_dEdx);
987 tp.setNumberOfIBLOverflowsdEdx(nOverflowHits_dEdx);
988 tp.setSummaryValue(dedx, static_cast<xAOD::SummaryType>(51));
989 }
990}
static const uint32_t nHits
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:572
ToolHandle< ITRT_ElectronPidTool > m_eProbabilityTool
tool to calculate electron probabilities
ToolHandle< IPixelToTPIDTool > m_dedxtool
tool to calculate dE/dx using pixel clusters
@ 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 1162 of file TrackParticleCreatorTool.cxx.

1163{
1164
1165 uint8_t nPixSharedHits = 0, nInPixSharedHits = 0, nNInPixSharedHits = 0, nSCTSharedHits = 0, nTRTSharedHits = 0;
1166 uint8_t nInPixSharedEndcapHits = 0, nNInPixSharedEndcapHits = 0;
1167 uint8_t nPixSplitHits = 0, nInPixSplitHits = 0, nNInPixSplitHits = 0;
1168 uint8_t nInPixSplitEndcapHits = 0, nNInPixSplitEndcapHits = 0;
1169
1170 const DataVector<const Trk::MeasurementBase>* measurements = track->measurementsOnTrack();
1171 if(!measurements){
1172 ATH_MSG_DEBUG("No measurement on track");
1173 return;
1174 }
1175
1176 const EventContext& ctx = Gaudi::Hive::currentContext();
1177 SG::ReadHandle<Trk::PRDtoTrackMap> prd_to_track_map(m_assoMapContainer, ctx);
1178
1179 for (const auto* const ms : *measurements) {
1180 // check if it's a rot
1181 const Trk::RIO_OnTrack* rot = nullptr;
1183 rot = static_cast<const Trk::RIO_OnTrack*>(ms);
1184 }
1185 if (!rot) {
1186 ATH_MSG_DEBUG("Cannot cast measurement to RIO_OnTrack");
1187 continue;
1188 }
1189
1190 const Identifier& id = rot->identify();
1191
1192 if (m_doSharedSiHits && m_pixelID->is_pixel(id)) {
1193 // check if split, when running TIDE
1194 bool hitIsSplit(false);
1195 if (m_runningTIDE_Ambi) {
1196 const InDet::PixelClusterOnTrack* pix = nullptr;
1198 pix = static_cast<const InDet::PixelClusterOnTrack*>(rot);
1199 }
1200 if (pix) {
1201 const InDet::PixelCluster* pixPrd = pix->prepRawData();
1202 const Trk::ClusterSplitProbabilityContainer::ProbabilityInfo&
1203 splitProb = getClusterSplittingProbability(pixPrd);
1204 int layer = m_pixelID->layer_disk(id);
1205 if (pixPrd and splitProb.isSplit()) {
1206 ATH_MSG_DEBUG("split Pixel hit found");
1207 hitIsSplit = true;
1208 nPixSplitHits++;
1209 if (m_pixelID->is_barrel(id)) {
1210 if (layer == 0)
1211 nInPixSplitHits++;
1212 else if (layer == 1)
1213 nNInPixSplitHits++;
1214 } else if (m_doITk) { // isITk && isEndCap -> ITk specific counters
1215 if (layer == 0)
1216 nInPixSplitEndcapHits++;
1217 else if (layer == 1 || layer == 2)
1218 nNInPixSplitEndcapHits++; // L0.5 + L1 disks
1219 }
1220 }
1221 }
1222 }
1223
1224 // check if shared
1225 // if we are running the TIDE ambi don't count split hits as shared
1226 if (!hitIsSplit) {
1227 if (prd_to_track_map->isShared(*(rot->prepRawData()))) {
1228 ATH_MSG_DEBUG("shared Pixel hit found");
1229 nPixSharedHits++;
1230 int layer = m_pixelID->layer_disk(id);
1231 if (m_pixelID->is_barrel(id)) {
1232 if (layer == 0)
1233 nInPixSharedHits++;
1234 else if (layer == 1)
1235 nNInPixSharedHits++;
1236 } else if (m_doITk) { // isITk && isEndCap -> ITk specific counters
1237 if (layer == 0)
1238 nInPixSharedEndcapHits++;
1239 else if (layer == 1 || layer == 2)
1240 nNInPixSharedEndcapHits++; // L0.5 + L1 disks
1241 }
1242 }
1243 }
1244
1245 } // end pixel
1246
1247 else if (m_doSharedSiHits && m_sctID->is_sct(id)) {
1248 if (prd_to_track_map->isShared(*(rot->prepRawData()))) {
1249 ATH_MSG_DEBUG("shared SCT hit found");
1251 }
1252 }
1253
1254 else if (m_doSharedTRTHits && m_trtID->is_trt(id)) {
1255 if (prd_to_track_map->isShared(*(rot->prepRawData()))) {
1256 ATH_MSG_DEBUG("shared TRT hit found");
1257 nTRTSharedHits++;
1258 }
1259 }
1260 }
1261
1262 tp.setSummaryValue(nPixSplitHits, xAOD::numberOfPixelSplitHits);
1263 tp.setSummaryValue(nInPixSplitHits, xAOD::numberOfInnermostPixelLayerSplitHits);
1264 tp.setSummaryValue(nNInPixSplitHits, xAOD::numberOfNextToInnermostPixelLayerSplitHits);
1265
1266 tp.setSummaryValue(nPixSharedHits, xAOD::numberOfPixelSharedHits);
1267 tp.setSummaryValue(nInPixSharedHits, xAOD::numberOfInnermostPixelLayerSharedHits);
1268 tp.setSummaryValue(nNInPixSharedHits, xAOD::numberOfNextToInnermostPixelLayerSharedHits);
1269 tp.setSummaryValue(nSCTSharedHits, xAOD::numberOfSCTSharedHits);
1270 tp.setSummaryValue(nTRTSharedHits, xAOD::numberOfTRTSharedHits);
1271
1272 if(m_doITk){
1273 tp.setSummaryValue(nInPixSplitEndcapHits, xAOD::numberOfInnermostPixelLayerSplitEndcapHits);
1274 tp.setSummaryValue(nNInPixSplitEndcapHits, xAOD::numberOfNextToInnermostPixelLayerSplitEndcapHits);
1275 tp.setSummaryValue(nInPixSharedEndcapHits, xAOD::numberOfInnermostPixelLayerSharedEndcapHits);
1276 tp.setSummaryValue(nNInPixSharedEndcapHits, xAOD::numberOfNextToInnermostPixelLayerSharedEndcapHits);
1277 }
1278
1279}
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 1314 of file TrackParticleCreatorTool.cxx.

1315{
1316 SG::ReadCondHandle<InDet::BeamSpotData> beamSpotHandle { m_beamSpotKey, ctx };
1317 return beamSpotHandle.cptr();
1318}
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 764 of file TrackParticleCreatorTool.cxx.

765{
766 if (tp.measuredPerigee()) {
767 compare(*tp.measuredPerigee(), tpx.perigeeParameters());
768 }
769
770 // trackParticle.info(),trackParticle.trackSummary(),
771 if (tp.trackParameters().size() != tpx.numberOfParameters()) {
772 ATH_MSG_WARNING("Number of parameters not the same " << tp.trackParameters().size() << " --- "
773 << tpx.numberOfParameters());
774 }
775}
#define ATH_MSG_WARNING(x)
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 745 of file TrackParticleCreatorTool.cxx.

746{
747 int index = Amg::compare(tp1.parameters(), tp2.parameters(), 1e-6, true);
748 if (index != -1) {
749 ATH_MSG_WARNING("Bad parameters conversion " << Amg::toString(tp1.parameters(), 7) << " --- "
750 << Amg::toString(tp2.parameters(), 7));
751 }
752 if ((tp1.covariance() && !tp2.covariance()) || (!tp1.covariance() && tp2.covariance())) {
753 ATH_MSG_WARNING("Bad Covariance conversion " << tp1.covariance() << " --- " << tp2.covariance());
754 } else if (tp1.covariance() && tp2.covariance()) {
755 std::pair<int, int> indices = Amg::compare(*tp1.covariance(), *tp2.covariance(), 1e-6, true);
756 if (indices.first != -1)
757 ATH_MSG_WARNING("Bad Covariance conversion " << std::endl
758 << Amg::toString(*tp1.covariance(), 10) << std::endl
759 << Amg::toString(*tp2.covariance(), 10));
760 }
761}
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 642 of file TrackParticleCreatorTool.cxx.

647{
648
649 xAOD::TrackParticle* trackparticle =
650 createParticle(ctx, **trackLink, container, vxCandidate, prtOrigin);
651
652 if (!trackparticle) {
653 ATH_MSG_WARNING("WARNING: Problem creating TrackParticle - Returning 0");
654 return nullptr;
655 }
656
657 trackparticle->setTrackLink(trackLink);
658
659 return trackparticle;
660}
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 662 of file TrackParticleCreatorTool.cxx.

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

◆ 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 676 of file TrackParticleCreatorTool.cxx.

686{
687
688 xAOD::TrackParticle* trackparticle = new xAOD::TrackParticle;
689 if (!trackparticle) {
690 ATH_MSG_WARNING("WARNING: Problem creating TrackParticle - Returning 0");
691 return nullptr;
692 }
693 /*
694 * The following needs care as in one case the ownership
695 * can be passed to StoreGate i.e to the relevant container
696 * DataVector.
697 * In the other the caller has the ownership
698 */
699
700 if (container) {
701 container->push_back(trackparticle);
702 } else {
703 trackparticle->makePrivateStore();
704 }
705
706 // Fit quality
707 if (fq) {
708 setFitQuality(*trackparticle, *fq);
709 }
710 // Track Info
711 if (trackInfo) {
712 setTrackInfo(*trackparticle, *trackInfo, prtOrigin);
713 }
714 // track summary
715 if (summary) {
716 setTrackSummary(*trackparticle, *summary);
717 setHitPattern(*trackparticle, summary->getHitPattern());
718 addPIDInformation(ctx, track, *trackparticle);
719 if(m_doITk) addDetailedHitInformation(track->trackStateOnSurfaces(), *trackparticle);
720 }
721
722 if (m_computeAdditionalInfo && track!=nullptr) {
723 addExpectedHitInformation(track->perigeeParameters(), *trackparticle);
724 addOutlierHitInformation(track->trackStateOnSurfaces(), *trackparticle);
725 if(m_doSharedSiHits || m_doSharedTRTHits) addSharedHitInformation(track, *trackparticle);
726 else if(m_doITk) addDummyEndcapSharedHitInformation(*trackparticle);
727 }
728
729 const auto* beamspot = CacheBeamSpotData(ctx);
730 if (beamspot) {
731 setTilt(*trackparticle, beamspot->beamTilt(0), beamspot->beamTilt(1));
732 }
733 // Parameters
734 if (perigee) {
735 setDefiningParameters(*trackparticle, *perigee);
736 } else {
737 ATH_MSG_WARNING("Track without perigee parameters? Not setting any defining parameters!");
738 }
739 setParameters(ctx, *trackparticle, parameters, positions);
740
741 return trackparticle;
742}
value_type push_back(value_type pElem)
Add an element to the end of the collection.
void makePrivateStore()
Create a new (empty) private store for this object.
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.

◆ 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 593 of file TrackParticleCreatorTool.cxx.

596{
597
598 // Attempt to fill the position enums - will necessarily be a bit of a hack, since we don't have
599 // all the information.
600 std::vector<xAOD::ParameterPosition> positions;
601 bool firstMeasurement = false;
602 for (const auto* parameter : trackParticle.trackParameters()) {
603 if (!firstMeasurement && parameter && !parameter->associatedSurface().isFree()) {
604 // if the surface isn't free, it must belong to a detector element => measurement
605 firstMeasurement = true;
606 positions.push_back(xAOD::FirstMeasurement);
607 } else if (firstMeasurement && parameter && !parameter->associatedSurface().isFree()) {
608 // Making the (possibly unfounded assumption that if we have the first measurement, the next
609 // will be the last)
610 positions.push_back(xAOD::LastMeasurement);
611 } else {
612 positions.push_back(xAOD::BeamLine); // Don't have a default yet!
613 }
614 }
615
616 xAOD::TrackParticle* trackparticle =
617 createParticle(ctx,
618 trackParticle.measuredPerigee(),
619 trackParticle.fitQuality(),
620 &trackParticle.info(),
621 trackParticle.trackSummary(),
622 trackParticle.trackParameters(),
623 positions,
624 static_cast<xAOD::ParticleHypothesis>(trackParticle.info().particleHypothesis()),
625 container,
626 nullptr);
627
628 if (!trackparticle) {
629 ATH_MSG_WARNING("WARNING: Problem creating TrackParticle - Returning 0");
630 return nullptr;
631 }
632
633 trackparticle->setTrackLink(*(trackParticle.trackElementLink()));
634
636 compare(trackParticle, *trackparticle);
637
638 return trackparticle;
639}
const Trk::Perigee * measuredPerigee() const
Accessor method for Perigee.
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 std::vector< const TrackParameters * > & trackParameters() const
Returns the track parameters.
const TrackInfo & info() const
returns the info of the track.
@ 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 259 of file TrackParticleCreatorTool.cxx.

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

◆ getClusterSplittingProbability()

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

Definition at line 1298 of file TrackParticleCreatorTool.cxx.

1299{
1300 const EventContext& ctx = Gaudi::Hive::currentContext();
1301 if (!pix || m_clusterSplitProbContainer.key().empty()) {
1303 }
1304 SG::ReadHandle<Trk::ClusterSplitProbabilityContainer> splitProbContainer(m_clusterSplitProbContainer, ctx);
1305 if (!splitProbContainer.isValid()) {
1306 ATH_MSG_FATAL("Failed to get cluster splitting probability container "
1308 }
1309 return splitProbContainer->splitProbability(pix);
1310}
#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 (detStore()->retrieve(m_trtID, "TRT_ID").isFailure()) {
165 ATH_MSG_FATAL("Could not get TRT_ID ");
166 return StatusCode::FAILURE;
167 }
168
169 if (!m_IBLParameterSvc.empty()) {
170 if (m_IBLParameterSvc.retrieve().isFailure()) {
171 ATH_MSG_FATAL("Could not retrieve IBLParameterSvc");
172 return StatusCode::FAILURE;
173 }
174 }
175
176 m_doIBL = !m_IBLParameterSvc.empty() && m_IBLParameterSvc->containsIBL();
177
178 if (m_doIBL && !m_IBLParameterSvc->contains3D()) {
179 ATH_MSG_WARNING("Assuming hybrid 2D/3D IBL module composition, but geometry is all-planar");
180 }
181
182 /* Retrieve track to vertex from ToolService */
183 if (m_trackToVertex.retrieve().isFailure()) {
184 ATH_MSG_FATAL("Failed to retrieve tool " << m_trackToVertex);
185 return StatusCode::FAILURE;
186 }
187 ATH_MSG_DEBUG("Retrieved tool " << m_trackToVertex);
188
189 if (!m_hitSummaryTool.empty()) {
190 /* Retrieve hit summary tool from ToolService */
191 if (m_hitSummaryTool.retrieve().isFailure()) {
192 ATH_MSG_FATAL("Failed to retrieve tool " << m_hitSummaryTool);
193 return StatusCode::FAILURE;
194 }
195 ATH_MSG_DEBUG("Retrieved tool " << m_hitSummaryTool);
196
197 } else {
198 m_hitSummaryTool.disable();
199 }
201
203
204 StatusCode sc(StatusCode::SUCCESS);
205 m_copyEProbabilities.clear();
208
209 if (!m_copyExtraSummaryName.empty()) {
210 std::map<std::string, std::pair<Trk::eProbabilityType, bool>> eprob_map;
211 std::map<std::string, Trk::SummaryType> extra_summary_type_map;
212 createEProbabilityMap(eprob_map);
213 createExtraSummaryTypeMap(extra_summary_type_map);
214
215 std::vector<std::string> errors;
216 for (const std::string& eprob_to_copy : m_copyExtraSummaryName) {
217 std::map<std::string, std::pair<Trk::eProbabilityType, bool>>::const_iterator eprob_iter =
218 eprob_map.find(eprob_to_copy);
219 if (eprob_iter == eprob_map.end()) {
220 std::map<std::string, Trk::SummaryType>::const_iterator extra_summary_type_iter =
221 extra_summary_type_map.find(eprob_to_copy);
222 if (extra_summary_type_iter == extra_summary_type_map.end()) {
223 errors.push_back(eprob_to_copy);
224 } else {
225 m_decorateSummaryTypes.emplace_back(
226 SG::AuxElement::Accessor<uint8_t>(extra_summary_type_iter->first),
227 extra_summary_type_iter->second);
228 }
229 } else {
230 if (!eprob_iter->second.second) {
231 m_copyEProbabilities.push_back(eprob_iter->second.first);
232 } else {
233 m_decorateEProbabilities.emplace_back(SG::AuxElement::Accessor<float>(eprob_iter->first),
234 eprob_iter->second.first);
235 }
236 }
237 }
238
239 if (!errors.empty()) {
240 ATH_MSG_ERROR("Error in configuration. Unknown electron probability name: "
241 << errors << ". known are " << eprob_map << " " << extra_summary_type_map);
242 sc = StatusCode::FAILURE;
243 }
244 }
245
246 ATH_CHECK( m_eProbabilityTool.retrieve( DisableTool{m_eProbabilityTool.empty()} ) );
247 ATH_CHECK( m_dedxtool.retrieve( DisableTool{m_dedxtool.empty()} ) );
248 ATH_CHECK( m_testPixelLayerTool.retrieve( DisableTool{m_testPixelLayerTool.empty()} ) );
249
250 ATH_CHECK(m_assoMapContainer.initialize(!m_assoMapContainer.key().empty()));
252 !m_clusterSplitProbContainer.key().empty()));
253
254 ATH_MSG_VERBOSE(" initialize successful.");
255 return sc;
256}
#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.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ 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 864 of file TrackParticleCreatorTool.cxx.

865{
866 tp.setHitPattern(hitpattern);
867}

◆ setNumberOfOverflowHits()

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

Definition at line 876 of file TrackParticleCreatorTool.cxx.

877{
878 tp.setNumberOfIBLOverflowsdEdx(overflows);
879}

◆ setNumberOfUsedHits()

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

Definition at line 870 of file TrackParticleCreatorTool.cxx.

871{
872 tp.setNumberOfUsedHitsdEdx(hits);
873}

◆ 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 778 of file TrackParticleCreatorTool.cxx.

782{
783 std::vector<std::vector<float>> parametersVec;
784 parametersVec.resize(parameters.size());
785 unsigned int numParam = 0;
786
787 SG::ReadCondHandle<AtlasFieldCacheCondObj> readHandle{ m_fieldCacheCondObjInputKey, ctx };
788 const AtlasFieldCacheCondObj* fieldCondObj{ *readHandle };
789 MagField::AtlasFieldCache fieldCache;
790 fieldCondObj->getInitializedCache(fieldCache);
791
792 for (const auto* param : parameters) {
793 std::vector<float>& values = parametersVec[numParam];
794 values.resize(6);
795 const Amg::Vector3D& pos = param->position();
796 const Amg::Vector3D& mom = param->momentum();
797 values[0] = pos[0];
798 values[1] = pos[1];
799 values[2] = pos[2];
800 values[3] = mom[0];
801 values[4] = mom[1];
802 values[5] = mom[2];
803
804 const bool straightPars = (!fieldCache.solenoidOn() && m_trackingVolumesSvc->volume(Trk::ITrackingVolumesSvc::CalorimeterEntryLayer).inside(pos)) ||
807 AmgSymMatrix(5) covarianceMatrix;
808 covarianceMatrix.setIdentity();
809
810 if (param->covariance()) {
811 // has covariance matrix
812 // now convert from to Curvilinear -- to be double checked for correctness
813 CurvilinearUVT curvilinearUVT(mom.unit());
814 if (!straightPars){
815 Amg::Vector3D magnFieldVect;
816 magnFieldVect.setZero();
817 fieldCache.getField(pos.data(), magnFieldVect.data());
818 const Amg::Transform3D& localToGlobalTransform = param->associatedSurface().transform();
819
820 JacobianLocalToCurvilinear jacobian(magnFieldVect,
821 param->parameters()[Trk::qOverP],
822 std::sin(param->parameters()[Trk::theta]),
823 curvilinearUVT,
824 localToGlobalTransform.rotation().col(0),
825 localToGlobalTransform.rotation().col(1));
826
827 covarianceMatrix = param->covariance()->similarity(jacobian);
828 } else {
829 const Amg::Vector3D loc_x {param->parameters()[Trk::locX],0,0};
830 const Amg::Vector3D loc_y {0,param->parameters()[Trk::locY],0};
831 JacobianLocalToCurvilinear jacobian(curvilinearUVT, loc_x, loc_y);
832 covarianceMatrix = param->covariance()->similarity(jacobian);
833 }
834 }
835 std::vector<float> covMatrixVec;
836 Amg::compress(covarianceMatrix, covMatrixVec);
837 tp.setTrackParameterCovarianceMatrix(numParam, covMatrixVec);
838
839 ++numParam;
840 }
841
842 tp.setTrackParameters(parametersVec);
843 unsigned int i = 0;
844 for (; i < positions.size(); ++i) {
845 tp.setParameterPosition(i, positions[i]);
846 if (positions[i] == xAOD::FirstMeasurement) {
847 float x_position = tp.parameterX(i);
848 float y_position = tp.parameterY(i);
849 tp.setRadiusOfFirstHit(std::sqrt(x_position * x_position + y_position * y_position));
850 tp.setIdentifierOfFirstHit(
851 parameters[i]->associatedSurface().associatedDetectorElementIdentifier().get_compact());
852 }
853 }
854}
#define AmgSymMatrix(dim)
if(febId1==febId2)
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 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

◆ setTilt()

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

Definition at line 857 of file TrackParticleCreatorTool.cxx.

858{
859 tp.setBeamlineTiltX(tiltx);
860 tp.setBeamlineTiltY(tilty);
861}

◆ 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 882 of file TrackParticleCreatorTool.cxx.

883{
884 // ensure that xAOD TrackSummary and TrackSummary enums are in sync.
885 constexpr unsigned int xAodReferenceEnum1 = static_cast<unsigned int>(xAOD::numberOfTRTXenonHits);
886 constexpr unsigned int TrkReferenceEnum1 = static_cast<unsigned int>(Trk::numberOfTRTXenonHits);
887 static_assert(xAodReferenceEnum1 == TrkReferenceEnum1, "Trk and xAOD enums differ in their indices");
888 constexpr unsigned int xAodReferenceEnum2 = static_cast<unsigned int>(xAOD::numberOfTRTTubeHits);
889 constexpr unsigned int TrkReferenceEnum2 = static_cast<unsigned int>(Trk::numberOfTRTTubeHits);
890 static_assert(xAodReferenceEnum2 == TrkReferenceEnum2, "Trk and xAOD enums differ in their indices");
891
892 for (unsigned int i = 0; i < Trk::numberOfTrackSummaryTypes; i++) {
893 // Only add values which are +ve (i.e., which were created)
895 continue;
896 }
898 continue;
899 }
901 continue;
902 }
903 // skip values which are floats
904 if (std::find(unusedSummaryTypes.begin(), unusedSummaryTypes.end(), i) != unusedSummaryTypes.end()) {
905 continue;
906 }
908 continue;
909 }
910 if (m_doITk && i == Trk::numberOfContribPixelLayers){ // Filled in addDetailedHitInformation for ITk
911 continue;
912 }
913
914 int value = summary.get(static_cast<Trk::SummaryType>(i));
915 uint8_t uvalue = static_cast<uint8_t>(std::min(value,255));
916 // coverity[first_enum_type]
917 if (value > 0) {
918 tp.setSummaryValue(uvalue, static_cast<xAOD::SummaryType>(i));
919 }
920 }
921
922 // muon hit info
923 if (!m_hitSummaryTool.empty()) {
924 ATH_MSG_DEBUG("now do muon hit info");
925 Muon::IMuonHitSummaryTool::CompactSummary msSummary = m_hitSummaryTool->summary(summary);
927 ATH_MSG_DEBUG("# of prec layers: " << static_cast<unsigned int>(numberOfPrecisionLayers));
933 tp.setSummaryValue(numberOfPrecisionLayers, xAOD::numberOfPrecisionLayers);
934 tp.setSummaryValue(numberOfPrecisionHoleLayers, xAOD::numberOfPrecisionHoleLayers);
935 tp.setSummaryValue(numberOfPhiLayers, xAOD::numberOfPhiLayers);
936 tp.setSummaryValue(numberOfPhiHoleLayers, xAOD::numberOfPhiHoleLayers);
937 tp.setSummaryValue(numberOfTriggerEtaLayers, xAOD::numberOfTriggerEtaLayers);
938 tp.setSummaryValue(numberOfTriggerEtaHoleLayers, xAOD::numberOfTriggerEtaHoleLayers);
939 }
940
941}
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_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_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: