 |
ATLAS Offline Software
|
Go to the documentation of this file.
41 DisableTool{ !m_convertAODTrackParticles }));
68 return StatusCode::SUCCESS;
91 return StatusCode::FAILURE;
103 return StatusCode::SUCCESS;
105 tracks = rh_tracks.
cptr();
117 return StatusCode::SUCCESS;
119 aodTruth = rh_aodTruth.
cptr();
123 if (!rh_trackTruth.
isValid()) {
126 return StatusCode::SUCCESS;
128 trackTruth = rh_trackTruth.
cptr();
133 if (!rh_truthParticleLinkVec.
isValid()) {
136 return StatusCode::SUCCESS;
138 truthLinks = rh_truthParticleLinkVec.
cptr();
144 if (!vtx_container.
isValid()) {
146 return StatusCode::SUCCESS;
149 for(
auto vtx : *vtx_container) {
163 ATH_MSG_INFO(
"No primary vertex found, will use dummy vertex at "
164 << dummyVertex->
x() <<
"," << dummyVertex->
y() <<
","
165 << dummyVertex->
z());
166 primaryVertex = dummyVertex;
170 ATH_MSG_WARNING(
"Neither primary nor dummy vertex found. Do Nothing.");
171 return StatusCode::SUCCESS;
179 wh_xaodout.
record(std::make_unique<xAOD::TrackParticleContainer>(),
180 std::make_unique<xAOD::TrackParticleAuxContainer>()));
187 return StatusCode::FAILURE;
190 tracksMap = rh_tracksMap.
cptr();
195 truthLinks, primaryVertex, tracksMap);
198 truthLinks, primaryVertex);
208 std::make_unique<xAOD::TrackParticleContainer>(),
209 std::make_unique<xAOD::TrackParticleAuxContainer>()));
211 wh_xaodTrackParticlesout, truthLinks);
217 return StatusCode::SUCCESS;
220 template<
typename CONT>
231 return track_particle->
track();
241 : m_contSrc(&cont_src)
243 if (cont_src.
size() != cont_dest->
size()) {
245 message << __FILE__ <<
":" << __LINE__
246 <<
" Expected one-to-one conversion from AOD to xAOD "
247 "TrackParticles but sizes differ: "
248 << cont_src.
size() <<
" != " << cont_dest->
size();
249 throw std::runtime_error(
message.str());
254 unsigned int idx)
const
256 return m_contSrc->at(
idx);
263 template<
typename CONT,
typename TRUTHCONT,
typename CONVTOOL>
266 const CONT& container,
267 const TRUTHCONT& truth,
281 if (conv_tool->convertAndAugment(&container, xaod.
ptr(), obs_track_map, primaryVertex).isFailure()) {
283 << xaod.
name() <<
") with the converting tool");
288 if (conv_tool->convert(&container, xaod.
ptr(), primaryVertex).isFailure()) {
290 << xaod.
name() <<
") with the converting tool");
299 unsigned int trackCounter(0);
301 for (; itr_xaod != end_xaod; ++itr_xaod) {
318 int npix, nsct, ntrt, npixh, nscth, npixshim, npixsplit;
319 npix = nsct = ntrt = npixh = nscth = npixshim = npixsplit = -1;
331 msg() <<
MSG::DEBUG <<
"REGTEST: " << std::setw(5) << trackCounter
332 <<
" pT: " << std::setw(10) <<
particle->pt()
337 <<
"\t" << npix <<
"/" << nsct <<
"/" << ntrt <<
"/holes/" << npixh <<
"/" << nscth
347 float probability = -1.0;
351 association_to_src(*itr_xaod, itr_xaod - xaod->
begin()), container);
353 ATH_MSG_WARNING(
"Failed to create ElementLink to Track/TrackParticle");
354 }
else if(truth->empty()){
358 auto result = truth->find(tpLink);
359 if (
result == truth->end()) {
361 "Failed find truth associated with Track/TrackParticle");
366 <<
result->second.particleLink().eventIndex());
367 probability =
result->second.probability();
368 link = truthLinkVec->
find(
result->second.particleLink());
372 <<
" eta " << (*link)->eta() <<
" phi "
375 if (
result->second.particleLink().cptr() &&
378 result->second.particleLink());
379 type = truthClass.first;
380 origin = truthClass.second;
383 <<
static_cast<int>(origin));
388 <<
result->second.particleLink());
397 theLink(
"truthParticleLink");
399 "truthMatchProbability");
401 theProbability(*
particle) = probability;
406 theOrigin(*
particle) =
static_cast<int>(origin);
412 <<
"] TrackParticles and stored in "
414 if (container.size() != xaod->
size()) {
417 <<
" is not equal to the number of items in its converted "
441 const EventContext& ctx)
@ numberOfPixelHits
number of pixel layers on track with absence of hits
float x() const
Returns the x position.
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::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
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.
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.