53 return StatusCode::SUCCESS;
79 for(
auto vtx : *vtx_container) {
92 ATH_MSG_INFO(
"No primary vertex found, will use dummy vertex at "
93 << dummyVertex->
x() <<
"," << dummyVertex->
y() <<
","
95 primaryVertex = dummyVertex;
99 return StatusCode::SUCCESS;
106 ATH_CHECK(wh_xaodout.
record(std::make_unique<xAOD::TrackParticleContainer>(),
107 std::make_unique<xAOD::TrackParticleAuxContainer>()));
108 ATH_CHECK(
convert(ctx, (*tracks), trackTruth, *wh_xaodout, truthLinks, primaryVertex, tracksMap));
118 return StatusCode::SUCCESS;
136 unsigned int trackCounter{0};
143 return StatusCode::FAILURE;
148 int npix{-1}, nsct{-1}, ntrt{-1}, npixh{-1}, nscth{-1};
161 <<
" pT: " << std::setw(10) << particle->pt()
162 <<
" eta: " << particle->eta() <<
" phi: " << particle->phi()
163 <<
" d0: " << particle->d0() <<
" z0: " << particle->z0()
164 <<
"\t" << npix <<
"/" << nsct <<
"/" << ntrt <<
"/holes/" << npixh <<
"/" << nscth);
173 unsigned int classification = 0;
174 float probability = -1.0;
179 ATH_MSG_WARNING(
"Failed to create ElementLink to Track/TrackParticle");
180 }
else if(assocTruthColl->empty()){
184 auto result = assocTruthColl->find(tpLink);
185 if (result == assocTruthColl->end()) {
186 ATH_MSG_WARNING(
"Failed find truth associated with Track/TrackParticle");
191 << result->second.particleLink().eventIndex());
192 probability = result->second.probability();
193 link = truthLinkVec->
find(result->second.particleLink());
194 if (link.isValid()) {
197 <<
" eta " << (*link)->eta() <<
" phi "
200 if (result->second.particleLink().cptr() &&
203 result->second.particleLink());
204 type = truthClass.first;
205 origin = truthClass.second;
209 <<
static_cast<int>(origin)
210 <<
" classification "
211 <<
static_cast<unsigned int>(classification));
216 << result->second.particleLink());
223 static const SG::AuxElement::Accessor<
225 theLink(
"truthParticleLink");
226 static const SG::AuxElement::Accessor<float> theProbability(
227 "truthMatchProbability");
228 theLink(*particle) = link;
229 theProbability(*particle) = probability;
231 static const SG::AuxElement::Accessor<int> theType(
"truthType");
232 static const SG::AuxElement::Accessor<int> theOrigin(
"truthOrigin");
233 static const SG::AuxElement::Accessor<unsigned int> theClassification(
"truthClassification");
234 theType(*particle) =
static_cast<int>(
type);
235 theOrigin(*particle) =
static_cast<int>(origin);
236 theClassification(*particle) =
static_cast<unsigned int>(classification);
242 <<
"] TrackParticles");
243 if (trackColl.
size() != outTrackCont.
size()) {
246 <<
" is not equal to the number of items in its converted "
248 << outTrackCont.
size());
249 return StatusCode::FAILURE;
252 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Header file to be included by clients of the Monitored infrastructure.
std::map< int, std::tuple< Trk::Track *, double, xAOD::RejectionStep, xAOD::RejectionReason, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, float, float, int, std::vector< xAOD::RejectionStep >, std::vector< xAOD::RejectionReason > > > ObservedTrackMap
DataVector< Trk::Track > TrackCollection
This typedef represents a collection of Trk::Track objects.
bool msgLvl(const MSG::Level lvl) const
size_type size() const noexcept
Returns the number of elements in the collection.
ElementLink implementation for ROOT usage.
bool isValid() const
Check if the element can be found.
Group of local monitoring quantities and retain correlation when filling histograms
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
A summary of the information contained by a track.
const Trk::TrackSummary * trackSummary() const
Returns a pointer to the const Trk::TrackSummary owned by this const track (could be nullptr).
SG::ReadHandleKey< xAODTruthParticleLinkVector > m_truthParticleLinkVec
ToolHandle< GenericMonitoringTool > m_monTool
StatusCode convert(const EventContext &ctx, const TrackCollection &trackColl, const TrackTruthCollection *assocTruthColl, xAOD::TrackParticleContainer &outTrackCont, const xAODTruthParticleLinkVector *, const xAOD::Vertex *primaryVertex, const ObservedTrackMap *obs_track_map) const
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_truthOriginKey
ToolHandle< ITrackParticleMonitoring > m_trackMonitoringTool
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_truthTypeKey
ToolHandle< xAODMaker::ITrackCollectionCnvTool > m_TrackCollectionCnvTool
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_truthProbKey
virtual StatusCode initialize()
Function initialising the algorithm.
Gaudi::Property< bool > m_addTruthLink
toggle on adding truth links
virtual StatusCode execute(const EventContext &ctx) const
Function executing the algorithm.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_trackLinkKey
SG::ReadHandleKey< TrackTruthCollection > m_trackTruth
SG::ReadHandleKey< ObservedTrackMap > m_tracksMap
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_xaodout
Gaudi::Property< bool > m_augmentObservedTracks
SG::ReadHandleKey< TrackCollection > m_tracks
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexContainer
Gaudi::Property< bool > m_convertTracks
toggle on converting tracks to xAOD
ToolHandle< IMCTruthClassifier > m_truthClassifier
ToolHandle to truth classifier.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_truthClassKey
Gaudi::Property< bool > m_doMonitoring
ToolHandle< Trk::ITrackParticleCreatorTool > m_particleCreator
The key for the input TrackParticleTruthCollection.
ElementLink< xAOD::TruthParticleContainer > find(const HepMcParticleLink &hepMCLink) const
float z() const
Returns the z position.
float y() const
Returns the y position.
float x() const
Returns the x position.
::StatusCode StatusCode
StatusCode definition for legacy code.
std::tuple< unsigned int, T > defOrigOfParticle(T thePart)
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
@ numberOfSCTHits
number of SCT holes
@ numberOfPixelHits
number of pixel layers on track with absence of hits
@ numberOfTRTHits
number of TRT outliers
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
@ numberOfPixelHoles
number of pixels which have a ganged ambiguity.
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
TrackParticle_v1 TrackParticle
Reference the current persistent version:
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Vertex_v1 Vertex
Define the latest version of the vertex class.
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".