ATLAS Offline Software
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ActsTrk::TruthGuidedProtoTrackCreatorTool Class Reference

#include <TruthGuidedProtoTrackCreatorTool.h>

Inheritance diagram for ActsTrk::TruthGuidedProtoTrackCreatorTool:
Collaboration diagram for ActsTrk::TruthGuidedProtoTrackCreatorTool:

Public Member Functions

 TruthGuidedProtoTrackCreatorTool (const std::string &type, const std::string &name, const IInterface *parent)
 
virtual ~TruthGuidedProtoTrackCreatorTool ()=default
 
virtual StatusCode initialize () override
 
virtual StatusCode findProtoTracks (const EventContext &ctx, const xAOD::PixelClusterContainer &pixelContainer, const xAOD::StripClusterContainer &stripContainer, std::vector< ActsTrk::ProtoTrack > &foundProtoTracks) const override final
 EF-style pattern recognition to create prototracks. More...
 

Protected Member Functions

std::unique_ptr< Acts::BoundTrackParameters > makeDummyParams (const HepMC::ConstGenParticlePtr &truthParticle) const
 creates a random, dummy set of parameters Warning: This is not a real parameter estimate. More...
 

Protected Attributes

SG::ReadHandleKeyArray< PRD_MultiTruthCollectionm_prdMultiTruthCollectionNames {this,"PRD_MultiTruthCollections", {}, "PRD multi truth collection names this builder is working on"}
 Truth track collection. More...
 

Detailed Description

Definition at line 16 of file TruthGuidedProtoTrackCreatorTool.h.

Constructor & Destructor Documentation

◆ TruthGuidedProtoTrackCreatorTool()

ActsTrk::TruthGuidedProtoTrackCreatorTool::TruthGuidedProtoTrackCreatorTool ( const std::string &  type,
const std::string &  name,
const IInterface *  parent 
)

Definition at line 11 of file TruthGuidedProtoTrackCreatorTool.cxx.

14  : base_class(type,name,parent)
15 {}

◆ ~TruthGuidedProtoTrackCreatorTool()

virtual ActsTrk::TruthGuidedProtoTrackCreatorTool::~TruthGuidedProtoTrackCreatorTool ( )
virtualdefault

Member Function Documentation

◆ findProtoTracks()

StatusCode ActsTrk::TruthGuidedProtoTrackCreatorTool::findProtoTracks ( const EventContext &  ctx,
const xAOD::PixelClusterContainer pixelContainer,
const xAOD::StripClusterContainer stripContainer,
std::vector< ActsTrk::ProtoTrack > &  foundProtoTracks 
) const
finaloverridevirtual

EF-style pattern recognition to create prototracks.

Parameters
ctxEvent context
pixelContainerpixel cluster
stripContainersct cluster
foundProtoTracksvector to hold the found proto tracks - will be populated by the method. Method will not discard existing content

Definition at line 23 of file TruthGuidedProtoTrackCreatorTool.cxx.

26  {
27 
28  // Read the PRD information
29  std::vector<const PRD_MultiTruthCollection*> prdMultiTruthCollections;
30  prdMultiTruthCollections.reserve(m_prdMultiTruthCollectionNames.size());
31  // load the PRD collections from SG
32  for(const auto& pmtCollNameIter:m_prdMultiTruthCollectionNames)
33  {
34  // try to retrieve the PRD multi truth collection
35  SG::ReadHandle<PRD_MultiTruthCollection> curColl (pmtCollNameIter, ctx);
36  if (!curColl.isValid())
37  {
38  ATH_MSG_WARNING("Could not retrieve " << pmtCollNameIter << ". Ignoring ... ");
39  }
40  else
41  {
42  ATH_MSG_INFO("Added " << pmtCollNameIter << " to collection list for truth track creation.");
43  prdMultiTruthCollections.push_back(curColl.cptr());
44  }
45  }
46 
47  // create the map for the ine
48  std::map<Identifier, HepMC::ConstGenParticlePtr> identToHepMCMap;
49  for (auto & PRD_truthCollec: prdMultiTruthCollections )
50  {
51  // loop over the map and get the identifier, GenParticle relation
52  PRD_MultiTruthCollection::const_iterator prdMtCIter = PRD_truthCollec->begin();
53  PRD_MultiTruthCollection::const_iterator prdMtCIterE = PRD_truthCollec->end();
54  for ( ; prdMtCIter != prdMtCIterE; ++ prdMtCIter ){
55 
56  // check if entry exists and if
57 #ifdef HEPMC3
58  HepMC::ConstGenParticlePtr curGenP = (*prdMtCIter).second.scptr();
59 #else
60 //AV Looks like an implicit conversion
61  HepMC::ConstGenParticlePtr curGenP = (*prdMtCIter).second;
62 #endif
63  Identifier curIdentifier = (*prdMtCIter).first;
64 
65  // Min pT cut
66  if ( curGenP->momentum().perp() < 500. ) continue;
67 
68 
69 
70  identToHepMCMap[curIdentifier] = curGenP;
71  }
72  }
73 
74  // Now loop over the pixel and strip container and make collectiong
75  std::map<HepMC::ConstGenParticlePtr, std::vector<ActsTrk::ATLASUncalibSourceLink>> trackCollections;
76 
77  for(const auto cluster: pixelContainer)
78  {
79  // Get the idetifier list for the RDOs
80  auto identifierList = cluster->rdoList();
81 
82  // Loop and push back the cluster in the corresponding trith particle
83  for(auto& id: identifierList)
84  {
85  // Found a match, so push it into the track collection
86  if(identToHepMCMap.find(id) != identToHepMCMap.end())
87  {
88  auto truthParticle = identToHepMCMap.at(id);
89  trackCollections[truthParticle].emplace_back(makeATLASUncalibSourceLink(&pixelContainer, cluster, ctx));
90  }
91  }
92  }
93 
94  for(const auto cluster: stripContainer)
95  {
96  // Get the idetifier list for the RDOs
97  auto identifierList = cluster->rdoList();
98 
99  // Loop and push back the cluster in the corresponding trith particle
100  for(auto& id: identifierList)
101  {
102  // Found a match, so push it into the track collection
103  if(identToHepMCMap.find(id) != identToHepMCMap.end())
104  {
105  auto truthParticle = identToHepMCMap.at(id);
106  trackCollections[truthParticle].emplace_back(makeATLASUncalibSourceLink(&stripContainer, cluster, ctx));
107  }
108  }
109  }
110 
111  for(const auto& var: trackCollections)
112  {
113  // Skip if we find less than 3 clusters per truth track
114  if(var.second.size() < 3) continue;
115 
116  // Make the intput perigee
117  auto inputPerigee = makeDummyParams(var.first);
118  ATH_MSG_INFO("Found " << var.second.size() << " clusters for truth partcle "<<var.first);
119  foundProtoTracks.push_back({var.second,std::move(inputPerigee)});
120  }
121 
122  // and add to the list (will only make one prototrack per event for now)
123 
124  return StatusCode::SUCCESS;
125 }

◆ initialize()

StatusCode ActsTrk::TruthGuidedProtoTrackCreatorTool::initialize ( )
overridevirtual

Definition at line 17 of file TruthGuidedProtoTrackCreatorTool.cxx.

18 {
20  return StatusCode::SUCCESS;
21 }

◆ makeDummyParams()

std::unique_ptr< Acts::BoundTrackParameters > ActsTrk::TruthGuidedProtoTrackCreatorTool::makeDummyParams ( const HepMC::ConstGenParticlePtr truthParticle) const
protected

creates a random, dummy set of parameters Warning: This is not a real parameter estimate.

Should only serve as a placeholder. Use with care

Parameters
truthParticleInput truth particle to get the parameters from
Returns
a set of puesdo-dummy params

Definition at line 129 of file TruthGuidedProtoTrackCreatorTool.cxx.

129  {
130 
131  using namespace Acts::UnitLiterals;
132  std::shared_ptr<const Acts::Surface> actsSurface = Acts::Surface::makeShared<Acts::PerigeeSurface>(
133  Acts::Vector3(0., 0., 0.));
134  Acts::BoundVector params;
135 
136 
137  // No, this is not a physically correct parameter estimate!
138  // We just want a placeholder to point in roughly the expected direction...
139  // A real track finder would do something more reasonable here.
140  params << 0., 0.,
141  truthParticle->momentum().phi(), truthParticle->momentum().theta(),
142  static_cast<float>(::charge(truthParticle)) / (truthParticle->momentum().e()), 0.;
143 
144 
145  // Covariance - let's be honest and say we have no clue ;-)
146  Acts::BoundSquareMatrix cov = Acts::BoundSquareMatrix::Identity();
147  cov *= 100000;
148 
149  // some ACTS paperwork
150  Trk::ParticleHypothesis hypothesis = Trk::pion;
152  Acts::PdgParticle absPdg = Acts::makeAbsolutePdgParticle(Acts::ePionPlus);
153  Acts::ParticleHypothesis actsHypothesis{
154  absPdg, mass, Acts::AnyCharge{static_cast<float>(::charge(truthParticle))}};
155 
156  return std::make_unique<Acts::BoundTrackParameters>(actsSurface, params,
157  cov, actsHypothesis);
158 
159 }

Member Data Documentation

◆ m_prdMultiTruthCollectionNames

SG::ReadHandleKeyArray<PRD_MultiTruthCollection> ActsTrk::TruthGuidedProtoTrackCreatorTool::m_prdMultiTruthCollectionNames {this,"PRD_MultiTruthCollections", {}, "PRD multi truth collection names this builder is working on"}
protected

Truth track collection.

Definition at line 46 of file TruthGuidedProtoTrackCreatorTool.h.


The documentation for this class was generated from the following files:
beamspotnt.var
var
Definition: bin/beamspotnt.py:1394
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
python.SystemOfUnits.MeV
int MeV
Definition: SystemOfUnits.py:154
plotBeamSpotVxVal.cov
cov
Definition: plotBeamSpotVxVal.py:201
ActsTrk::TruthGuidedProtoTrackCreatorTool::makeDummyParams
std::unique_ptr< Acts::BoundTrackParameters > makeDummyParams(const HepMC::ConstGenParticlePtr &truthParticle) const
creates a random, dummy set of parameters Warning: This is not a real parameter estimate.
Definition: TruthGuidedProtoTrackCreatorTool.cxx:129
DataPrepToActsConfig.stripContainer
stripContainer
Definition: DataPrepToActsConfig.py:10
Trk::ParticleHypothesis
ParticleHypothesis
Definition: ParticleHypothesis.h:25
ActsTrk::makeATLASUncalibSourceLink
ATLASUncalibSourceLink makeATLASUncalibSourceLink(const xAOD::UncalibratedMeasurementContainer *container, std::size_t index, [[maybe_unused]] const EventContext &ctx)
Definition: ATLASSourceLink.h:30
Trk::pion
@ pion
Definition: ParticleHypothesis.h:29
test_pyathena.parent
parent
Definition: test_pyathena.py:15
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
Trk::ParticleMasses::mass
constexpr double mass[PARTICLEHYPOTHESES]
the array of masses
Definition: ParticleHypothesis.h:53
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
charge
double charge(const T &p)
Definition: AtlasPID.h:756
xAOD::ParticleHypothesis
ParticleHypothesis
Definition: TrackingPrimitives.h:192
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
python.CaloScaleNoiseConfig.type
type
Definition: CaloScaleNoiseConfig.py:78
PowhegControl_ttFCNC_NLO.params
params
Definition: PowhegControl_ttFCNC_NLO.py:226
DataPrepToActsConfig.pixelContainer
pixelContainer
Definition: DataPrepToActsConfig.py:9
ActsTrk::TruthGuidedProtoTrackCreatorTool::m_prdMultiTruthCollectionNames
SG::ReadHandleKeyArray< PRD_MultiTruthCollection > m_prdMultiTruthCollectionNames
Truth track collection.
Definition: TruthGuidedProtoTrackCreatorTool.h:46
Identifier
Definition: IdentifierFieldParser.cxx:14