|
ATLAS Offline Software
|
Go to the documentation of this file.
44 DisableTool{ !m_convertAODTrackParticles }));
83 return StatusCode::SUCCESS;
106 return StatusCode::FAILURE;
118 return StatusCode::SUCCESS;
120 tracks = rh_tracks.
cptr();
132 return StatusCode::SUCCESS;
134 aodTruth = rh_aodTruth.
cptr();
138 if (!rh_trackTruth.
isValid()) {
141 return StatusCode::SUCCESS;
143 trackTruth = rh_trackTruth.
cptr();
148 if (!rh_truthParticleLinkVec.
isValid()) {
151 return StatusCode::SUCCESS;
153 truthLinks = rh_truthParticleLinkVec.
cptr();
159 if (!vtx_container.
isValid()) {
161 return StatusCode::SUCCESS;
164 for(
auto vtx : *vtx_container) {
178 ATH_MSG_INFO(
"No primary vertex found, will use dummy vertex at "<<dummyVertex->
x()<<
","<<dummyVertex->
y()<<
","<<dummyVertex->
z());
179 primaryVertex=dummyVertex;
183 ATH_MSG_WARNING(
"Neither primary nor dummy vertex found. Do Nothing.");
184 return StatusCode::SUCCESS;
192 wh_xaodout.
record(std::make_unique<xAOD::TrackParticleContainer>(),
193 std::make_unique<xAOD::TrackParticleAuxContainer>()));
200 return StatusCode::FAILURE;
203 tracksMap = rh_tracksMap.
cptr();
223 std::make_unique<xAOD::TrackParticleContainer>(),
224 std::make_unique<xAOD::TrackParticleAuxContainer>()));
228 wh_xaodTrackParticlesout,
235 return StatusCode::SUCCESS;
238 template<
typename CONT>
249 return track_particle->
track();
259 : m_contSrc(&cont_src)
261 if (cont_src.
size() != cont_dest->
size()) {
263 message << __FILE__ <<
":" << __LINE__
264 <<
" Expected one-to-one conversion from AOD to xAOD "
265 "TrackParticles but sizes differ: "
266 << cont_src.
size() <<
" != " << cont_dest->
size();
267 throw std::runtime_error(
message.str());
272 unsigned int idx)
const
274 return m_contSrc->at(
idx);
281 template<
typename CONT,
typename TRUTHCONT,
typename CONVTOOL>
284 const CONT& container,
285 const TRUTHCONT& truth,
299 if (conv_tool->convertAndAugment(&container, xaod.
ptr(), obs_track_map, primaryVertex).isFailure()) {
301 << xaod.
name() <<
") with the converting tool");
306 if (conv_tool->convert(&container, xaod.
ptr(), primaryVertex).isFailure()) {
308 << xaod.
name() <<
") with the converting tool");
317 unsigned int trackCounter(0);
319 for (; itr_xaod != end_xaod; ++itr_xaod) {
336 int npix, nsct, ntrt, npixh, nscth, npixshim, npixsplit;
337 npix = nsct = ntrt = npixh = nscth = npixshim = npixsplit = -1;
349 msg() <<
MSG::DEBUG <<
"REGTEST: " << std::setw(5) << trackCounter
350 <<
" pT: " << std::setw(10) <<
particle->pt()
355 <<
"\t" << npix <<
"/" << nsct <<
"/" << ntrt <<
"/holes/" << npixh <<
"/" << nscth
369 float probability = -1.0;
373 association_to_src(*itr_xaod, itr_xaod - xaod->
begin()), container);
375 ATH_MSG_WARNING(
"Failed to create ElementLink to Track/TrackParticle");
376 }
else if(truth->empty()){
380 auto result = truth->find(tpLink);
381 if (
result == truth->end()) {
383 "Failed find truth associated with Track/TrackParticle");
388 <<
result->second.particleLink().eventIndex());
389 probability =
result->second.probability();
390 link = truthLinkVec->
find(
result->second.particleLink());
394 <<
" eta " << (*link)->eta() <<
" phi "
397 if (
result->second.particleLink().cptr() &&
400 result->second.particleLink());
401 type = truthClass.first;
402 origin = truthClass.second;
405 <<
static_cast<int>(origin));
410 <<
result->second.particleLink());
417 theLink(
"truthParticleLink");
419 "truthMatchProbability");
421 theProbability(*
particle) = probability;
426 theOrigin(*
particle) =
static_cast<int>(origin);
432 <<
"] TrackParticles and stored in "
434 if (container.size() != xaod->
size()) {
437 <<
" is not equal to the number of items in its converted "
461 const EventContext& ctx)
@ numberOfPixelHits
number of pixel layers on track with absence of hits
float x() const
Returns the x position.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_xaodTruthLinkKey
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_xaodTruthOriginKey
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
ToolHandle< ITrackParticleMonitoring > m_trackMonitoringTool
Group
Properties of a chain group.
const_pointer_type cptr()
Dereference the pointer.
virtual StatusCode initialize()
Function initialising the algorithm.
vecmem::edm::container< TrackParticleInterface, vecmem::edm::type::vector< float >, vecmem::edm::type::vector< float >, vecmem::edm::type::vector< float > > TrackParticleContainer
SoA, GPU friendly TrackParticleContainer.
Helper class to provide type-safe access to aux data.
Gaudi::Property< bool > m_augmentObservedTracks
const std::string & name() const
Return the StoreGate ID for the referenced object.
const Trk::Track * operator()(xAOD::TrackParticle *track_particle, unsigned int) const
ElementLink< xAOD::TruthParticleContainer > find(const HepMcParticleLink &hepMCLink) const
xAOD::TrackParticle * createParticle(xAOD::TrackParticleContainer &xaod, const Rec::TrackParticleContainer &container, const Rec::TrackParticle &tp)
bool msgLvl(const MSG::Level lvl) const
ToolHandle< IMCTruthClassifier > m_truthClassifier
ToolHandle to truth classifier.
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
AssociationHelper(const TrackCollection &, xAOD::TrackParticleContainer *)
Gaudi::Property< bool > m_convertAODTrackParticles
toggle on converting AOD track particles to xAOD
@ numberOfSCTHoles
number of Holes in both sides of a SCT module
@ NoVtx
Dummy vertex. TrackParticle was not used in vertex fit.
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_xaodTrackParticlesout
bool isValid() const
Test to see if the link can be dereferenced.
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_xaodTruthMatchProbKey
SG::ReadHandleKey< ObservedTrackMap > m_tracksMap
An algorithm that can be simultaneously executed in multiple threads.
const Rec::TrackParticle * operator()(xAOD::TrackParticle *, unsigned int idx) const
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
SG::ReadHandleKey< Rec::TrackParticleContainer > m_aod
SG::ReadHandleKey< TrackTruthCollection > m_trackTruth
(Non-const) Iterator class for DataVector/DataList.
Name: MuonSpContainer.h Package : offline/Reconstruction/MuonIdentification/muonEvent.
const Rec::TrackParticleContainer * m_contSrc
::StatusCode StatusCode
StatusCode definition for legacy code.
@ numberOfSCTHits
number of SCT holes
pointer_type ptr()
Dereference the pointer.
Gaudi::Property< bool > m_addTruthLink
toggle on adding truth links
SG::ReadHandleKey< TrackParticleTruthCollection > m_aodTruth
SG::WriteDecorHandleKey< xAOD::TrackParticleContainer > m_xaodTruthTypeKey
float z() const
Returns the z position.
virtual StatusCode execute(const EventContext &ctx) const
Function executing the algorithm.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Header file to be included by clients of the Monitored infrastructure.
ToolHandle< xAODMaker::ITrackCollectionCnvTool > m_TrackCollectionCnvTool
virtual bool isValid() override final
Can the handle be successfully dereferenced?
@ numberOfPixelHoles
number of pixels which have a ganged ambiguity.
ElementLink implementation for ROOT usage.
AssociationHelper(const Rec::TrackParticleContainer &cont_src, xAOD::TrackParticleContainer *cont_dest)
Gaudi::Property< bool > m_doMonitoring
@ numberOfTRTHits
number of TRT outliers
int convert(const CONT &, const TRUTHCONT &, CONVTOOL &tool, SG::WriteHandle< xAOD::TrackParticleContainer > &, const xAODTruthParticleLinkVector *, const xAOD::Vertex *primaryVertex=nullptr, const ObservedTrackMap *obs_track_map=0) const
A summary of the information contained by a track.
ToolHandle< GenericMonitoringTool > m_monTool
ToolHandle< xAODMaker::IRecTrackParticleContainerCnvTool > m_RecTrackParticleContainerCnvTool
Helpers for checking error return status codes and reporting errors.
SG::ReadHandleKey< xAODTruthParticleLinkVector > m_truthParticleLinkVec
Gaudi::Property< bool > m_convertTracks
toggle on converting tracks to xAOD
SG::ReadHandleKey< TrackCollection > m_tracks
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Class describing a Vertex.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
#define ATH_MSG_WARNING(x)
const Trk::TrackSummary * trackSummary() const
Returns a pointer to the const Trk::TrackSummary owned by this const track (could be nullptr)
float y() const
Returns the y position.
ToolHandle< Trk::ITrackParticleCreatorTool > m_particleCreator
The key for the input TrackParticleTruthCollection.
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexContainer
TrackParticleCnvAlg(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
SG::WriteHandleKey< xAOD::TrackParticleContainer > m_xaodout
Class describing a TrackParticle.
const Trk::Track * track() const
Returns a pointer (which can be NULL) to the Trk::Track which was used to make this TrackParticle.
size_type size() const noexcept
Returns the number of elements in the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.