ATLAS Offline Software
Loading...
Searching...
No Matches
MuonValR4::MsTrackTester Class Reference

#include <MsTrackTester.h>

Inheritance diagram for MuonValR4::MsTrackTester:

Classes

struct  SegmentTagVariables
 Searched the MuTagIMO tag. More...

Public Member Functions

StatusCode initialize () override final
StatusCode execute (const EventContext &ctx) override final
 Execute method.
StatusCode finalize () override final
 AthHistogramAlgorithm (const std::string &name, ISvcLocator *pSvcLocator)
 Constructor with parameters:
virtual StatusCode sysInitialize ()
 Initialization method invoked by the framework.
const ServiceHandle< ITHistSvc > & histSvc () const
 The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a pointer to the THistSvc.
virtual bool isClonable () const override
 Specify if the algorithm is clonable.
virtual StatusCode sysExecute (const EventContext &ctx) override
 Execute an algorithm.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
virtual bool filterPassed (const EventContext &ctx) const
 Get filter decision:
virtual void setFilterPassed (bool state, const EventContext &ctx) const
 Set filter decision:
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () const
bool msgLvl (const MSG::Level lvl) const

Protected Member Functions

virtual bool isReEntrant () const override final
 Legacy algorithms are not thread-safe.
void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed.
StatusCode configAthHistogramming (const ServiceHandle< ITHistSvc > &histSvc, const std::string &prefix, const std::string &rootDir, const std::string &histNamePrefix, const std::string &histNamePostfix, const std::string &histTitlePrefix, const std::string &histTitlePostfix)
 To be called to fill the internal configuration.
TH1 * bookGetPointer (const TH1 &hist, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
TH1 * bookGetPointer (TH1 *hist, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
TH1 * bookGetPointer (TH1 &histRef, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
TTree * bookGetPointer (const TTree &treeRef, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TTrees.
TGraph * bookGetPointer (const TGraph &graphRef, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TGraphs.
TEfficiency * bookGetPointer (const TEfficiency &eff, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
TEfficiency * bookGetPointer (TEfficiency *eff, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
TEfficiency * bookGetPointer (TEfficiency &effRef, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
StatusCode book (const TH1 &hist, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
StatusCode book (TH1 *hist, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
StatusCode book (TH1 &histRef, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of histograms.
StatusCode book (const TTree &treeRef, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TTrees.
StatusCode book (const TGraph &graphRef, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TGraphs.
StatusCode book (const TEfficiency &eff, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
StatusCode book (TEfficiency *eff, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
StatusCode book (TEfficiency &effRef, std::string_view tDir="", std::string_view stream="")
 Simplify the booking and registering (into THistSvc) of TEfficiency.
TH1 * hist (std::string_view histName, std::string_view tDir="", std::string_view stream="")
 Simplify the retrieval of registered histograms of any type.
TH2 * hist2d (std::string_view histName, std::string_view tDir="", std::string_view stream="")
 Simplify the retrieval of registered 2-d histograms.
TH3 * hist3d (std::string_view histName, std::string_view tDir="", std::string_view stream="")
 Simplify the retrieval of registered 3-d histograms.
TTree * tree (std::string_view treeName, std::string_view tDir="", std::string_view stream="")
 Simplify the retrieval of registered TTrees.
TGraph * graph (std::string_view graphName, std::string_view tDir="", std::string_view stream="")
 Simplify the retrieval of registered TGraphs.
TEfficiency * efficiency (std::string_view effName, std::string_view tDir="", std::string_view stream="")
 Simplify the retrieval of registered TEfficiency.

Private Types

using Location = MuonR4::MsTrackSeed::Location
using SectorProjector = MuonR4::ExpandedSector::SectorProjector
using TruthHitCol = std::unordered_set<const xAOD::MuonSimHit*>
using SegmentKey_t = SG::ReadHandleKey<xAOD::MuonSegmentContainer>
 Abrivate the ReadHandleKey_t for the segment container.
using TrackKey_t = SG::ReadHandleKey<xAOD::TrackParticleContainer>
 Abrivate the key type for the track particle container.
using MuonKey_t = SG::ReadHandleKey<xAOD::MuonContainer>
 Abrivate the key type for the muon container.
using MuonTagKey_t = SG::ReadHandleKey<MuonR4::MuonTagContainer>
 Abrivate the muon tag container.
using ParticleBranchPtr_t = std::shared_ptr<MuonVal::IParticleFourMomBranch>
using SegmentBranchPtr_t = std::shared_ptr<MuonPRDTest::SegmentVariables>
 Abrivation of the branches containing sement information.
typedef ServiceHandle< StoreGateSvc > StoreGateSvc_t
typedef uint32_t hash_t
 typedef for the internal hash
typedef std::map< const hash_t, TH1 * > HistMap_t
 Typedef for convenience.
typedef std::map< const hash_t, TEfficiency * > EffMap_t
 Typedef for convenience.
typedef std::map< const hash_t, TTree * > TreeMap_t
 Typedef for convenience.
typedef std::map< const hash_t, TGraph * > GraphMap_t
 Typedef for convenience.

Private Member Functions

std::optional< MuonR4::MsTrackSeed > makeSeedFromTruth (const Acts::GeometryContext &tgContext, const xAOD::TruthParticle &truthMuon) const
 Construct MS track seed from the truth associated segments.
std::pair< double, double > calcSeedLength (const Acts::GeometryContext &tgContext, const MuonR4::MsTrackSeed &seed) const
 Calculate the length of the seed and the theta deflection angle The length is defined as the spread of the seed's segments in the cylinder coordinate.
const xAOD::TruthParticle * truthTreeParticle (const xAOD::IParticle &part, const EventContext &ctx) const
 Returns the matched truth particle that is dumped in the tree.
std::vector< const xAOD::MuonSegment * > getAssociatedSegments (const xAOD::TrackParticle &idTrack, const EventContext &ctx) const
 Returns the collection of reconstructed segments that can be associated to the id track If the track is connected with a truth muon, the list of reconstructed segments matched to the truth muon is returned.
const MuonR4::MuonTag * findBaseIdTag (const xAOD::TrackParticle &idTrack, const EventContext &ctx) const
 Searches the Id track in the basline collection of all ID tracks selected for the combined muon reconstructiion (STACO/MuidCo/MuTagIMO/Calo).
const MuonR4::MuonTag * findMuTagIMO (const xAOD::TrackParticle &idTrack, const EventContext &ctx) const
const MuonGMR4::SpectrometerSector * getEnvelope (const xAOD::MuonSegment &segment) const
SegmentTagVariables calcSegTagVariables (const xAOD::TrackParticle &idTrack, const EventContext &ctx)
StatusCode dumpLegacyTracks (const EventContext &ctx)
 Dumps the legacy containers to the TTree.
StatusCode dumpTruthContent (const EventContext &ctx)
 Dump truth information.
StatusCode dumpRecoContent (const EventContext &ctx)
 Dump the reconstructed information.
const Acts::Logger & logger () const
 Return the reference to the Acts logger.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>
std::string buildBookingString (std::string_view histName, std::string_view tDir, std::string_view stream, bool usePrefixPostfix=false) const
 Method to build individual booking string.
hash_t hash (std::string_view histName) const
 Method to calculate a 32-bit hash from a string.

Private Attributes

MuonVal::MuonTesterTree m_tree {"MsTrackValidTest", "MuonTrackTester"}
 The output tree object.
const MuonGMR4::MuonDetectorManager * m_detMgr {nullptr}
 The detector manager to fetch the segment surfaces.
Gaudi::Property< bool > m_isMC {this, "isMC", false}
 Toggle whether the job runs on MC or not.
Gaudi::Property< bool > m_storeID {this, "storeIdTrks", true}
 Toggle whether to process ID tracks or not.
SegmentKey_t m_truthSegmentKey {this, "TruthSegmentKey", "MuonTruthSegments"}
 Segment from the truth hits.
SegmentKey_t m_recoSegmentKey {this, "SegmentKey", "MsSegments"}
 Primary segment container.
SegmentKey_t m_legacySegmentKey {this, "LegacySegmentKey", "MuonSegments"}
 Legacy segment container.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthKey {this, "TruthKey", "MuonTruthParticles"}
 Key to the truth particle collection.
SG::ReadDecorHandleKeyArray< SG::AuxVectorBase > m_trkTruthLinks {this, "TruthTrackLinks", {}}
 Decoration dependency to the MS truth track links.
SG::ReadHandleKey< MuonR4::MsTrackSeedContainer > m_msTrkSeedKey {this, "MsTrkSeedKey", "MsTrackSeeds"}
 Temporary container write handle to push the seeds to store gate for later efficiency analysis.
ActsTrk::ContextUtility m_ctxProvider {this}
 Context provider for geometry, magnetic field and calibration contexts.
MuonKey_t m_muonKey {this, "MuonKey", "Muons"}
 Dependency on the R4 muon container.
ToolHandle< MuonR4::ITrackSummaryTool > m_summaryTool {this, "SummaryTool" ,""}
 Hit summary tool.
ToolHandle< MuonR4::ITrackSeedingDiagnosticsTool > m_seedingTool {this, "SeedingTool", ""}
 The track seeding tool to construct the seed candidates and to estimate the initial parameters.
ToolHandle< MuonR4::ISegmentSelectionTool > m_segSelector {this, "SegmentSelectionTool" , "" }
 Selection tool to quantify the segment candidate quality.
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool {this, "ExtrapolationTool" ,"" }
 Track extrapolation tool.
TrackKey_t m_legacyTrackKey {this,"LegacyTrackKey", "MuonSpectrometerTrackParticles"}
 Legacy track reconstruction chain.
TrackKey_t m_idTrackKey {this, "IdTrackKey", "InDetTrackParticles"}
 The collection of ID tracks associated with the truth particle.
MuonTagKey_t m_idTagKey {this, "IdTagKey", "MuonInDetCandidates"}
 The collection of all ID tracks that are selected for combined reconstruction.
MuonTagKey_t m_segTagKey {this, "SegTagKey", "SegmentTags"}
 The collection of the original segment tags.
Gaudi::Property< double > m_toleranceX0 {this, "toleranceX0", 20.*Gaudi::Units::cm}
 Extra tolerance applied on the non-bending intercept when calculating the matching score.
Gaudi::Property< double > m_toleranceY0 {this, "toleranceY0", 5.*Gaudi::Units::cm}
 Extra tolerance applied on the bending intercept when calculating the matching score.
Gaudi::Property< double > m_toleranceTheta {this, "toleranceTheta", 1.*Gaudi::Units::deg}
 Extra tolerance applied on the bending direction when calculating the matching score.
Gaudi::Property< double > m_tolerancePhi {this, "tolerancePhi", 2.*Gaudi::Units::deg}
 Extra tolerance applied on the bending direction when calculating the matching score.
MuonKey_t m_legacyMuonKey {this,"LegacyMuonKey", "MuonsLegacy"}
 Legacy muons.
std::unique_ptr< const Acts::Logger > m_logger {}
 Instance to the Acts logger.
ParticleBranchPtr_t m_truthTrks {}
ParticleBranchPtr_t m_muonTrks {}
 Stored muon information from the Acts muon reco chain.
ParticleBranchPtr_t m_idTracks {}
 Stored ID track information.
SegmentBranchPtr_t m_truthSegs {}
SegmentBranchPtr_t m_recoSegs {}
SegmentBranchPtr_t m_legacyRecoSegs {}
MuonVal::ScalarBranch< std::uint16_t > & m_nIdTracks {m_tree.newScalar<std::uint16_t>("nIdTracks", 0)}
 The number of ID tracks in the event.
MuonVal::ScalarBranch< std::uint16_t > & m_nIdTags {m_tree.newScalar<std::uint16_t>("nIdTags", 0)}
 The number of selected ID tracks in the event.
MuonVal::ThreeVectorBranch m_seedPos {m_tree, "TrkSeed_position"}
 Simple seed information.
MuonVal::UnitThreeVectorBranch m_seedDir {m_tree, "TrkSeed_direction"}
 Seed direction vector.
MuonVal::VectorBranch< char > & m_seedType {m_tree.newVector<char>("TrkSeed_type")}
 Is the seed in the encap or in the barrel chambers.
MuonVal::VectorBranch< int > & m_seedSector {m_tree.newVector<int>("TrkSeed_sector")}
 Sector of the seed, even center, odd overlap regions, for details see:
MuonVal::VectorBranch< float > & m_seedLength {m_tree.newVector<float>("TrkSeed_length")}
 Maximum separation between the segments on the reference plane.
MuonVal::VectorBranch< float > & m_seedThetaCone {m_tree.newVector<float>("TrkSeed_thetaCone")}
 Maximum angular difference between the segments part of the seed.
MuonVal::VectorBranch< char > & m_seedGood {m_tree.newVector<char>("TrkSeed_goodSeed")}
 Does the seeding tool construct valid parameters from the seed.
MuonVal::VectorBranch< float > & m_seedQP {m_tree.newVector<float>("TrkSeed_qTimesP")}
 Estimated momentum times charge from the track seed.
MuonVal::VectorBranch< unsigned short > & m_seedTruthLink {m_tree.newVector<unsigned short>("TrkSeed_truthLink", -1)}
 Link to the truth muon.
std::shared_ptr< TrackSummaryModule > m_seedSummary {}
 Hit summary on the track seed.
MuonVal::MatrixBranch< unsigned short > & m_seedRecoSegMatch {m_tree.newMatrix<unsigned short>("TrkSeed_segmentLinks")}
 Link of the track seed to the building segment.
MuonVal::MatrixBranch< unsigned short > & m_truthSegToRecoLink {m_tree.newMatrix<unsigned short>("TruthSegments_recoSegLinks",-1)}
 Link of the truth segments to the matchin reco segments.
MuonVal::VectorBranch< unsigned short > & m_legacySegToTrkLinks {m_tree.newVector<unsigned short>("LegacyRecoSegments_trkLinks", -1)}
 Link of the legacy track to the legacy segment.
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedIdx {m_tree.newMatrix<unsigned short>("TruthMuons_seedLinks", -1)}
 Links to all MsTrkSeeds that could be matched to the truthMuon, i.e.
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedCounter {m_tree.newMatrix<unsigned short>("TruthMuons_seedNSeg")}
 Number of matched segments in the seed.
MuonVal::MatrixBranch< unsigned short > & m_truthMuRecoSegLinks {m_tree.newMatrix<unsigned short>("TruthMuons_recoSegLinks")}
 Links from the truth muon to the segments.
ParticleBranchPtr_t m_legacyTrks {}
 Output branches of the legacy MS tracks.
ServiceHandle< ITHistSvc > m_histSvc
 Default constructor: AthHistogramAlgorithm();.
std::string m_prefix
 Name of the ROOT output stream (file).
std::string m_rootDir
 Name of the ROOT directory.
std::string m_histNamePrefix
 The prefix for the histogram THx name.
std::string m_histNamePostfix
 The postfix for the histogram THx name.
std::string m_histTitlePrefix
 The prefix for the histogram THx title.
std::string m_histTitlePostfix
 The postfix for the histogram THx title.
DataObjIDColl m_extendedExtraObjects
 Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default).
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default).
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared
HistMap_t m_histMap
 The map of histogram names to their pointers.
EffMap_t m_effMap
 The map of histogram names to their pointers.
TreeMap_t m_treeMap
 The map of TTree names to their pointers.
GraphMap_t m_graphMap
 The map of TGraph names to their pointers.
std::string m_streamName
 Name of the ROOT output stream (file).
std::string m_name
 Instance name.
MsgStream m_msg
 Cached Message Stream.

Detailed Description

Definition at line 38 of file MsTrackTester.h.

Member Typedef Documentation

◆ EffMap_t

typedef std::map< const hash_t, TEfficiency* > AthHistogramming::EffMap_t
privateinherited

Typedef for convenience.

Definition at line 199 of file AthHistogramming.h.

◆ GraphMap_t

typedef std::map< const hash_t, TGraph* > AthHistogramming::GraphMap_t
privateinherited

Typedef for convenience.

Definition at line 213 of file AthHistogramming.h.

◆ hash_t

typedef uint32_t AthHistogramming::hash_t
privateinherited

typedef for the internal hash

Definition at line 171 of file AthHistogramming.h.

◆ HistMap_t

typedef std::map< const hash_t, TH1* > AthHistogramming::HistMap_t
privateinherited

Typedef for convenience.

Definition at line 192 of file AthHistogramming.h.

◆ Location

◆ MuonKey_t

Abrivate the key type for the muon container.

Definition at line 138 of file MsTrackTester.h.

◆ MuonTagKey_t

Abrivate the muon tag container.

Definition at line 140 of file MsTrackTester.h.

◆ ParticleBranchPtr_t

Definition at line 197 of file MsTrackTester.h.

◆ SectorProjector

◆ SegmentBranchPtr_t

Abrivation of the branches containing sement information.

Definition at line 205 of file MsTrackTester.h.

◆ SegmentKey_t

Abrivate the ReadHandleKey_t for the segment container.

Definition at line 134 of file MsTrackTester.h.

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::StoreGateSvc_t
privateinherited

Definition at line 376 of file AthCommonDataStore.h.

◆ TrackKey_t

Abrivate the key type for the track particle container.

Definition at line 136 of file MsTrackTester.h.

◆ TreeMap_t

typedef std::map< const hash_t, TTree* > AthHistogramming::TreeMap_t
privateinherited

Typedef for convenience.

Definition at line 206 of file AthHistogramming.h.

◆ TruthHitCol

using MuonValR4::MsTrackTester::TruthHitCol = std::unordered_set<const xAOD::MuonSimHit*>
private

Definition at line 132 of file MsTrackTester.h.

Member Function Documentation

◆ AthHistogramAlgorithm()

AthHistogramAlgorithm::AthHistogramAlgorithm ( const std::string & name,
ISvcLocator * pSvcLocator )

Constructor with parameters:

Definition at line 40 of file AthHistogramAlgorithm.cxx.

32 :
33 ::AthAlgorithm( name, pSvcLocator ),
34 ::AthHistogramming( name ),
35 m_histSvc ( "THistSvc/THistSvc", name )
36{
37 //
38 // Property declaration
39 //
40 // The histogram service
41 declareProperty("THistSvc",
42 m_histSvc = ServiceHandle<ITHistSvc>("THistSvc/THistSvc", name),
43 "Handle to a THistSvc instance: it will be used to write "
44 "ROOT objects to ROOT files" );
45 // declareProperty("THistService", m_histSvc, "The THistSvc" );
46
47 declareProperty("RootStreamName", m_prefix = "/ANALYSIS", "Name of the output ROOT stream (file) that the THistSvc uses");
48 declareProperty("RootDirName", m_rootDir = "",
49 "Name of the ROOT directory inside the ROOT file where the histograms will go");
50
51 declareProperty( "HistNamePrefix", m_histNamePrefix = "", "The prefix for the histogram THx name" );
52 declareProperty( "HistNamePostfix", m_histNamePostfix = "", "The postfix for the histogram THx name" );
53
54 declareProperty( "HistTitlePrefix", m_histTitlePrefix = "", "The prefix for the histogram THx title" );
55 declareProperty( "HistTitlePostfix", m_histTitlePostfix = "", "The postfix for the histogram THx title" );
56}
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
std::string m_histNamePrefix
The prefix for the histogram THx name.
ServiceHandle< ITHistSvc > m_histSvc
Default constructor: AthHistogramAlgorithm();.
std::string m_prefix
Name of the ROOT output stream (file).
std::string m_histNamePostfix
The postfix for the histogram THx name.
std::string m_histTitlePostfix
The postfix for the histogram THx title.
std::string m_rootDir
Name of the ROOT directory.
std::string m_histTitlePrefix
The prefix for the histogram THx title.
AthHistogramming(const std::string &name)
Constructor with parameters:

◆ book() [1/8]

StatusCode AthHistogramming::book ( const TEfficiency & eff,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 329 of file AthHistogramming.h.

330{
331 // We need to create a non-const clone
332 TEfficiency* effClone = dynamic_cast< TEfficiency* >( eff.Clone() );
333 if ( !effClone ) {
334 m_msg << MSG::ERROR << "Couldn't create a TEfficiency clone" << endmsg;
335 return StatusCode::FAILURE;
336 }
337 return this->book( *effClone, tDir, stream );
338}
#define endmsg
StatusCode book(const TH1 &hist, std::string_view tDir="", std::string_view stream="")
Simplify the booking and registering (into THistSvc) of histograms.
MsgStream m_msg
Cached Message Stream.

◆ book() [2/8]

StatusCode AthHistogramming::book ( const TGraph & graphRef,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TGraphs.

◆ book() [3/8]

StatusCode AthHistogramming::book ( const TH1 & hist,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 297 of file AthHistogramming.h.

298{
299 // We need to create a non-const clone
300 TH1* histClone = dynamic_cast< TH1* >( hist.Clone() );
301 if ( !histClone ) {
302 m_msg << MSG::ERROR << "Couldn't create a TH1 clone" << endmsg;
303 return StatusCode::FAILURE;
304 }
305 return this->book( *histClone, tDir, stream );
306}
TH1 * hist(std::string_view histName, std::string_view tDir="", std::string_view stream="")
Simplify the retrieval of registered histograms of any type.

◆ book() [4/8]

StatusCode AthHistogramming::book ( const TTree & treeRef,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TTrees.

Definition at line 397 of file AthHistogramming.h.

398{
399 // Call the other Book method and see if it returns a valid pointer
400 TTree* treePointer = this->bookGetPointer( treeRef, tDir, stream );
401 if ( treePointer )
402 {
403 return StatusCode::SUCCESS;
404 }
405 else
406 {
407 return StatusCode::FAILURE;
408 }
409}
TH1 * bookGetPointer(const TH1 &hist, std::string_view tDir="", std::string_view stream="")
Simplify the booking and registering (into THistSvc) of histograms.

◆ book() [5/8]

StatusCode AthHistogramming::book ( TEfficiency & effRef,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 350 of file AthHistogramming.h.

351{
352 // Call the other Book method and see if it returns a valid pointer
353 TEfficiency* effPointer = this->bookGetPointer( effRef, tDir, stream );
354 if ( !effPointer ) {
355 m_msg << MSG::ERROR << "Couldn't book a TEfficiency" << endmsg;
356 return StatusCode::FAILURE;
357 }
358 return StatusCode::SUCCESS;
359}

◆ book() [6/8]

StatusCode AthHistogramming::book ( TEfficiency * eff,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 340 of file AthHistogramming.h.

341{
342 if ( !eff ) {
343 m_msg << MSG::ERROR << "Got a zero pointer to a TEfficiency" << endmsg;
344 return StatusCode::FAILURE;
345 }
346 return this->book( *eff, tDir, stream );
347}

◆ book() [7/8]

StatusCode AthHistogramming::book ( TH1 & histRef,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 318 of file AthHistogramming.h.

319{
320 // Call the other Book method and see if it returns a valid pointer
321 TH1* histPointer = this->bookGetPointer( histRef, tDir, stream );
322 if ( !histPointer ) {
323 m_msg << MSG::ERROR << "Couldn't book a TH1" << endmsg;
324 return StatusCode::FAILURE;
325 }
326 return StatusCode::SUCCESS;
327}

◆ book() [8/8]

StatusCode AthHistogramming::book ( TH1 * hist,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 308 of file AthHistogramming.h.

309{
310 if ( !hist ) {
311 m_msg << MSG::ERROR << "Got a zero pointer to a TH1" << endmsg;
312 return StatusCode::FAILURE;
313 }
314 return this->book( *hist, tDir, stream );
315}

◆ bookGetPointer() [1/8]

TEfficiency * AthHistogramming::bookGetPointer ( const TEfficiency & eff,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 275 of file AthHistogramming.h.

276{
277 // We need to create a non-const clone
278 TEfficiency* histClone = dynamic_cast< TEfficiency* >( hist.Clone() );
279 if ( !histClone ) {
280 m_msg << MSG::ERROR << "Couldn't create a TEfficiency clone in bookGetPointer" << endmsg;
281 return 0;
282 }
283 return this->bookGetPointer( *histClone, tDir, stream );
284
285}

◆ bookGetPointer() [2/8]

TGraph * AthHistogramming::bookGetPointer ( const TGraph & graphRef,
std::string_view tDir = "",
std::string_view stream = "" )
protectedinherited

Simplify the booking and registering (into THistSvc) of TGraphs.

Definition at line 374 of file AthHistogramming.cxx.

375{
376 // Get a pointer
377 const TGraph* graphPointer = &graphRef;
378
379 // Check that we got a valid pointer
380 if ( !graphPointer )
381 {
382 m_msg << MSG::WARNING
383 << "We got an invalid TGraph pointer in the BookGetPointer(TGraph*) method of the class" << m_name
384 << "!" << endmsg;
385 return NULL;
386 }
387
388 // Modify the name and title according to the prefixes of this classes instance
389 std::string graphName = graphPointer->GetName();
390 const std::string graphTitle = graphPointer->GetTitle();
391
392 // Check if the hash for this graphName already exists, i.e., if we have a hash collision
393 const hash_t graphHash = this->hash(graphName);
394 GraphMap_t::const_iterator it = m_graphMap.find( graphHash );
395 if ( it != m_graphMap.end() ) // It does exist!
396 {
397 m_msg << MSG::WARNING
398 << "Detected a hash collision. The hash for the TGraph with name=" << graphName
399 << " already exists and points to a TGraph with name=" << it->second->GetName()
400 << " NOT going to book the new histogram and returning a NULL pointer!" << endmsg;
401 return NULL;
402 }
403
404 // Create a clone that has the new name
405 TGraph* graphClone = dynamic_cast< TGraph* >( graphPointer->Clone((m_histNamePrefix+graphName+m_histNamePostfix).c_str()) );
406 if( !graphClone )
407 {
408 m_msg << MSG::WARNING
409 << "We couldn't clone the TGraph in the BookGetPointer(TGraph&) method of the class" << m_name
410 << "!" << endmsg;
411 return NULL;
412 }
413 graphClone->SetTitle ((m_histTitlePrefix+graphTitle+m_histTitlePostfix).c_str());
414
415 // Massage the final string to book things
416 std::string bookingString = buildBookingString( graphName, tDir, stream );
417
418 // Register the TGraph into the THistSvc
419 if ( !((histSvc()->regGraph(bookingString, graphClone)).isSuccess()) )
420 {
421 m_msg << MSG::WARNING
422 << "Problem registering TGraph with name " << graphName
423 << ", title " << graphTitle
424 << " in " << m_name << "!" << endmsg;
425 return NULL;
426 }
427
428 // Also register it in the local map of string to pointer
429 m_graphMap.insert( m_graphMap.end(), std::pair< const hash_t, TGraph* >( graphHash, graphClone ) );
430
431 return graphClone;
432}
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
hash_t hash(std::string_view histName) const
Method to calculate a 32-bit hash from a string.
std::string buildBookingString(std::string_view histName, std::string_view tDir, std::string_view stream, bool usePrefixPostfix=false) const
Method to build individual booking string.
std::string m_histNamePostfix
The postfix for the histogram THx name.
uint32_t hash_t
typedef for the internal hash
std::string m_histTitlePostfix
The postfix for the histogram THx title.
std::string m_histTitlePrefix
The prefix for the histogram THx title.
std::string m_name
Instance name.
std::string m_histNamePrefix
The prefix for the histogram THx name.
GraphMap_t m_graphMap
The map of TGraph names to their pointers.

◆ bookGetPointer() [3/8]

TH1 * AthHistogramming::bookGetPointer ( const TH1 & hist,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 254 of file AthHistogramming.h.

255{
256 // We need to create a non-const clone
257 TH1* histClone = dynamic_cast< TH1* >( hist.Clone() );
258 if ( !histClone ) {
259 m_msg << MSG::ERROR << "Couldn't create a TH1 clone in bookGetPointer" << endmsg;
260 return 0;
261 }
262 return this->bookGetPointer( *histClone, tDir, stream );
263
264}

◆ bookGetPointer() [4/8]

TTree * AthHistogramming::bookGetPointer ( const TTree & treeRef,
std::string_view tDir = "",
std::string_view stream = "" )
protectedinherited

Simplify the booking and registering (into THistSvc) of TTrees.

Definition at line 268 of file AthHistogramming.cxx.

269{
270 // Get a pointer
271 const TTree* treePointer = &treeRef;
272
273 // Check that we got a valid pointer
274 if ( !treePointer )
275 {
276 m_msg << MSG::WARNING
277 << "We got an invalid TTree pointer in the BookGetPointer(TTree*) method of the class" << m_name
278 << "!" << endmsg;
279 return NULL;
280 }
281
282 // Modify the name and title according to the prefixes of this classes instance
283 std::string treeName = treePointer->GetName();
284 const std::string treeTitle = treePointer->GetTitle();
285
286 // Check if the hash for this treeName already exists, i.e., if we have a hash collision
287 const hash_t treeHash = this->hash(treeName);
288 TreeMap_t::const_iterator it = m_treeMap.find( treeHash );
289 if ( it != m_treeMap.end() ) // It does exist!
290 {
291 m_msg << MSG::WARNING
292 << "Detected a hash collision. The hash for the TTree with name=" << treeName
293 << " already exists and points to a TTree with name=" << it->second->GetName()
294 << " NOT going to book the new histogram and returning a NULL pointer!" << endmsg;
295 return NULL;
296 }
297
298 // Create a clone that has the new name
299 TTree* treeClone = dynamic_cast< TTree* >( treePointer->Clone(treeName.c_str()) );
300 if( !treeClone )
301 {
302 m_msg << MSG::WARNING
303 << "We couldn't clone the TTree in the BookGetPointer(TTree&) method of the class" << m_name
304 << "!" << endmsg;
305 return NULL;
306 }
307 treeClone->SetTitle (treeTitle.c_str());
308
309 // Massage the final string to book things
310 std::string bookingString = buildBookingString( treeName, tDir, stream );
311
312 // Register the TTree into the THistSvc
313 if ( !((histSvc()->regTree(bookingString, treeClone)).isSuccess()) )
314 {
315 m_msg << MSG::WARNING
316 << "Problem registering TTree with name " << treeName
317 << ", title " << treeTitle
318 << " in " << m_name << "!" << endmsg;
319 return NULL;
320 }
321
322 // Also register it in the local map of string to pointer
323 m_treeMap.insert( m_treeMap.end(), std::pair< const hash_t, TTree* >( treeHash, treeClone ) );
324
325 return treeClone;
326}
TreeMap_t m_treeMap
The map of TTree names to their pointers.

◆ bookGetPointer() [5/8]

TEfficiency * AthHistogramming::bookGetPointer ( TEfficiency & effRef,
std::string_view tDir = "",
std::string_view stream = "" )
protectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 139 of file AthHistogramming.cxx.

140{
141 std::string originalName{effRef.GetName()};
142 const auto effName = splitName(originalName).second;
143 const std::string effTitle(effRef.GetTitle());
144 std::string bookingString = buildBookingString(originalName, tDir, stream);
145 std::string finalEffName{m_histNamePrefix};
146 finalEffName += effName;
147 finalEffName += m_histNamePostfix;
148 effRef.SetTitle((m_histTitlePrefix + effTitle + m_histTitlePostfix).c_str());
149 effRef.SetName(finalEffName.c_str());
150
151 const hash_t effHash = this->hash(effName);
152 EffMap_t::const_iterator it = m_effMap.find(effHash);
153 if (it != m_effMap.end()) {
154 m_msg << MSG::WARNING
155 << "Detected a hash collision. The hash for the TEfficiency with name=" << effName
156 << " already exists and points to a TEfficiency with name=" << it->second->GetName()
157 << " NOT going to book the new TEfficiency and returning a NULL pointer!" << endmsg;
158 return nullptr;
159 }
160
161 if (!histSvc()->regEfficiency(bookingString, &effRef).isSuccess()) {
162 m_msg << MSG::WARNING
163 << "Problem registering TEfficiency with name " << effName
164 << ", name prefix " << m_histNamePrefix
165 << ", title " << effTitle
166 << ", title prefix " << m_histTitlePrefix
167 << ", and title postfix " << m_histTitlePostfix
168 << " in " << m_name << "!" << endmsg;
169 return nullptr;
170 }
171
172 m_effMap.insert(m_effMap.end(), std::pair<const hash_t, TEfficiency*>(effHash, &effRef));
173
174 return &effRef;
175}
EffMap_t m_effMap
The map of histogram names to their pointers.

◆ bookGetPointer() [6/8]

TEfficiency * AthHistogramming::bookGetPointer ( TEfficiency * eff,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of TEfficiency.

Definition at line 287 of file AthHistogramming.h.

288{
289 if ( !hist ) {
290 m_msg << MSG::ERROR << "Got a zero pointer to a TEfficiency in bookGetPointer" << endmsg;
291 return 0;
292 }
293 return this->bookGetPointer( *hist, tDir, stream );
294}

◆ bookGetPointer() [7/8]

TH1 * AthHistogramming::bookGetPointer ( TH1 & histRef,
std::string_view tDir = "",
std::string_view stream = "" )
protectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 97 of file AthHistogramming.cxx.

97 {
98
99 const std::string originalName{histRef.GetName()};
100 const auto histName = splitName(originalName).second;
101
102 const std::string histTitle(histRef.GetTitle());
103 std::string bookingString = buildBookingString(originalName, tDir, stream);
104
105 std::string finalHistName{m_histNamePrefix};
106 finalHistName += histName;
107 finalHistName += m_histNamePostfix;
108
109 histRef.SetTitle((m_histTitlePrefix + histTitle + m_histTitlePostfix).c_str());
110 histRef.SetName(finalHistName.c_str());
111
112 const hash_t histHash = this->hash(histName);
113 HistMap_t::const_iterator it = m_histMap.find(histHash);
114 if (it != m_histMap.end()) {
115 m_msg << MSG::WARNING
116 << "Detected a hash collision. The hash for the histogram with name=" << histName
117 << " already exists and points to a histogram with name=" << it->second->GetName()
118 << " NOT going to book the new histogram and returning a NULL pointer!" << endmsg;
119 return nullptr;
120 }
121
122 if (!histSvc()->regHist(bookingString, &histRef).isSuccess()) {
123 m_msg << MSG::WARNING
124 << "Problem registering histogram with name " << histName
125 << ", name prefix " << m_histNamePrefix
126 << ", title " << histTitle
127 << ", title prefix " << m_histTitlePrefix
128 << ", and title postfix " << m_histTitlePostfix
129 << " in " << m_name << "!" << endmsg;
130 return nullptr;
131 }
132
133 m_histMap.insert(m_histMap.end(), std::pair<const hash_t, TH1*>(histHash, &histRef));
134
135 return &histRef;
136}
HistMap_t m_histMap
The map of histogram names to their pointers.

◆ bookGetPointer() [8/8]

TH1 * AthHistogramming::bookGetPointer ( TH1 * hist,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the booking and registering (into THistSvc) of histograms.

Definition at line 266 of file AthHistogramming.h.

267{
268 if ( !hist ) {
269 m_msg << MSG::ERROR << "Got a zero pointer to a TH1 in bookGetPointer" << endmsg;
270 return 0;
271 }
272 return this->bookGetPointer( *hist, tDir, stream );
273}

◆ buildBookingString()

std::string AthHistogramming::buildBookingString ( std::string_view histName,
std::string_view tDir,
std::string_view stream,
bool usePrefixPostfix = false ) const
privateinherited

Method to build individual booking string.

Definition at line 500 of file AthHistogramming.cxx.

501 {
502 if (tDir.empty()) {
503 tDir = m_rootDir;
504 }
505 if (stream.empty()) {
507 }
508 const auto [histDir, baseName] = splitName(histName);
509 std::string bookingString{"/"};
510 bookingString += stream;
511 bookingString += '/';
512 bookingString += tDir;
513 if (!histDir.empty()) {
514 bookingString += '/';
515 bookingString += histDir;
516 }
517 bookingString += '/';
518 if (usePrefixPostfix) {
519 bookingString += m_histNamePrefix;
520 }
521 bookingString += baseName;
522 if (usePrefixPostfix) {
523 bookingString += m_histNamePostfix;
524 }
525 const auto tail = std::ranges::unique(
526 bookingString, [](char lhs, char rhs) { return lhs == '/' && rhs == '/'; });
527 bookingString.erase(tail.begin(), tail.end());
528 return bookingString;
529}
std::string m_rootDir
Name of the ROOT directory.
std::string m_streamName
Name of the ROOT output stream (file).
std::string tail(std::string s, const std::string &pattern)
tail of a string

◆ calcSeedLength()

std::pair< double, double > MuonValR4::MsTrackTester::calcSeedLength ( const Acts::GeometryContext & tgContext,
const MuonR4::MsTrackSeed & seed ) const
private

Calculate the length of the seed and the theta deflection angle The length is defined as the spread of the seed's segments in the cylinder coordinate.

The deflection angle is calculates as the spread of the theta angles of the individual segments

Parameters
gctxThe geometry context to align the segment within ATLAS
seedThe seed with the contributing segments

Definition at line 104 of file MsTrackTester.cxx.

105 {
106 double maxL{-1.*Gaudi::Units::km}, minL{1.*Gaudi::Units::km},
107 maxTheta{-181.}, minTheta{181};
108 for (const xAOD::MuonSegment* seg : seed.segments()) {
109 const Amg::Vector2D projPos{m_seedingTool->expressOnCylinder(tgContext, *seg, seed.location(), seed.sector())};
110 if (!m_seedingTool->withinBounds(projPos, seed.location())) {
111 continue;
112 }
113 const double projected = projPos[seed.location()==Location::Barrel];
114 const double theta = seg->direction().theta();
115 minL = std::min(minL, projected);
116 maxL = std::max(maxL, projected);
117 minTheta = std::min(minTheta, toDeg(theta));
118 maxTheta = std::max(maxTheta, toDeg(theta));
119 }
120 return std::make_pair(maxL - minL, maxTheta - minTheta);
121 }
Scalar theta() const
theta method
ToolHandle< MuonR4::ITrackSeedingDiagnosticsTool > m_seedingTool
The track seeding tool to construct the seed candidates and to estimate the initial parameters.
Eigen::Matrix< double, 2, 1 > Vector2D
MuonSegment_v1 MuonSegment
Reference the current persistent version:

◆ calcSegTagVariables()

MsTrackTester::SegmentTagVariables MuonValR4::MsTrackTester::calcSegTagVariables ( const xAOD::TrackParticle & idTrack,
const EventContext & ctx )
private

No associated segments found

Calo extension does not work

In case that there is already a

Store in the tree that the segment cannot be associated due to extrapolation failure

If there is a best segment dump the best segment to the tree

The segment does not measure phi. Reset anything in loc0 and non-precision direction

Definition at line 549 of file MsTrackTester.cxx.

550 {
551
554 const std::vector<const xAOD::MuonSegment*> compatibleSegs = getAssociatedSegments(idTrack, ctx);
555 if (compatibleSegs.empty()) {
556 return result;
557 }
559 const ActsTrk::CaloExtension* caloExt = ActsTrk::getCaloExtension(idTrack);
560 if (!caloExt) {
561 return result;
562 }
563 std::optional<Acts::BoundTrackParameters> startPars = caloExt->lastParameters();
564 if (!startPars) {
565 return result;
566 }
567
568 const MuonR4::MuonTag* muTag = findMuTagIMO(idTrack, ctx);
569
570 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
571
572 auto nextParameters = [&](const xAOD::MuonSegment& segment) {
574 const MuonGMR4::SpectrometerSector* msSector = getEnvelope(segment);
575 const Acts::Surface& target{msSector->surface()};
576 if (target.geometryId() == startPars->referenceSurface().geometryId()) {
577 return true;
578 }
579 if (muTag) {
580 auto surfPars = muTag->extrapolatedParsID(Acts::toUnderlying(segment.chamberIndex()));
581 if (surfPars) {
582 startPars = surfPars;
583 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Recycle cached parameters from muTag\n"
584 <<(*startPars));
585 return true;
586 }
587 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Extrapolation to "<<printID(segment)<<" failed somehow");
588 }
589
590 auto extpPars = m_extrapolationTool->propagate(ctx, *startPars, target);
591 if (!extpPars.ok()) {
592 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Extrapolation keeps failing");
593 return false;
594 }
595 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Updated parameters to \n"<<(*extpPars));
596 startPars = *extpPars;
597 return true;
598 };
599
600 const xAOD::MuonSegment* bestSeg{nullptr};
601 float bestMatchScore{std::numeric_limits<float>::max()};
602 Acts::BoundVector bestPars{Acts::BoundVector::Zero()};
603
604 auto dumpBestSeg = [&]() {
605 if (!bestSeg) {
606 return;
607 }
608 result.recoSegs.push_back(m_recoSegs->push_back(*bestSeg));
609 result.matchScores.push_back(bestMatchScore);
610 result.deltaPhi.push_back(toDeg(bestPars[Acts::eBoundPhi]));
611 result.deltaTheta.push_back(toDeg(bestPars[Acts::eBoundTheta]));
612 result.deltaY0.push_back(bestPars[Acts::eBoundLoc1]);
613 result.deltaX0.push_back(bestPars[Acts::eBoundLoc0]);
614 result.goodExtp.push_back(1);
615 result.taggedSeg.push_back(muTag && Acts::rangeContainsValue(muTag->segments(), bestSeg));
616 bestSeg = nullptr;
617 bestMatchScore = std::numeric_limits<float>::max();
618 bestPars = Acts::BoundVector::Zero();
619 };
620
621 for (auto segItr = compatibleSegs.begin(); segItr != compatibleSegs.end(); ) {
622 const xAOD::MuonSegment* testMe{*segItr};
624 if (!nextParameters(*testMe)) {
625 result.recoSegs.push_back(m_recoSegs->push_back(*testMe));
626 result.matchScores.push_back(-1.f);
627 result.deltaX0.push_back(1._m);
628 result.deltaY0.push_back(1._m);
629 result.deltaTheta.push_back(180.);
630 result.deltaPhi.push_back(180.);
631 result.goodExtp.push_back(0);
632 result.taggedSeg.push_back(0);
633 segItr = std::find_if(std::next(segItr),compatibleSegs.end(), [&](const xAOD::MuonSegment* assocSeg){
634 return getEnvelope(*testMe) != getEnvelope(*assocSeg);
635 });
636 } else {
637 ++segItr;
638 }
640 if (bestSeg && getEnvelope(*testMe) != getEnvelope(*bestSeg)) {
641 dumpBestSeg();
642 }
643 const Acts::BoundTrackParameters segmentPars{MuonR4::SegmentFit::boundSegmentPars(tgContext, *m_detMgr, *testMe)};
644 Acts::BoundVector dPars = segmentPars.parameters() - startPars->parameters();
646 if (!testMe->nPhiLayers()) {
647 dPars[Acts::eBoundPhi] = dPars[Acts::eBoundLoc0] = 0.;
648 } else {
649 dPars[Acts::eBoundPhi] = P4Helpers::deltaPhi(dPars[Acts::eBoundPhi], 0.);
650 }
651
652 dPars[Acts::eBoundQOverP] = dPars[Acts::eBoundTime] = 0.;
653 Acts::BoundMatrix covariance{Acts::BoundMatrix::Identity()};
654 covariance(Acts::eBoundLoc0, Acts::eBoundLoc0) = Acts::square(m_toleranceX0.value());
655 covariance(Acts::eBoundLoc1, Acts::eBoundLoc1) = Acts::square(m_toleranceY0.value());
656 covariance(Acts::eBoundTheta, Acts::eBoundTheta) = Acts::square(m_toleranceTheta.value());
657 covariance(Acts::eBoundPhi, Acts::eBoundPhi) = Acts::square(m_tolerancePhi.value());
658 if (startPars->covariance()) {
659 covariance += (*startPars->covariance());
660 }
661 if (segmentPars.covariance()) {
662 covariance += (*segmentPars.covariance());
663 }
664 const float chi2 = dPars.dot(covariance.inverse()*dPars);
665 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Difference: "<<Acts::toString(dPars)
666 <<", covariance: \n"<<Acts::toString(covariance)<<",\nchi2: "<<chi2);
667 if (chi2 < bestMatchScore) {
668 ATH_MSG_DEBUG(__func__<<"() "<<__LINE__<<" - Best parameters on surface thus far");
669 bestMatchScore = chi2;
670 bestSeg = testMe;
671 bestPars = std::move(dPars);
672 }
673 }
674 dumpBestSeg();
675 return result;
676 }
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_VERBOSE(x,...)
std::optional< Acts::BoundTrackParameters > lastParameters() const
Returns the outermost parameters known to the extension.
const Acts::PlaneSurface & surface() const
Returns the associated surface.
std::optional< Acts::BoundTrackParameters > extrapolatedParsID(const Acts::HashedString &parName) const
Returns the cached extrapolated ID track parameters.
Definition MuonTag.cxx:76
const std::vector< const xAOD::MuonSegment * > & segments() const
Returns the segments associated with the tag.
Definition MuonTag.cxx:12
const MuonGMR4::MuonDetectorManager * m_detMgr
The detector manager to fetch the segment surfaces.
const MuonGMR4::SpectrometerSector * getEnvelope(const xAOD::MuonSegment &segment) const
Gaudi::Property< double > m_toleranceTheta
Extra tolerance applied on the bending direction when calculating the matching score.
Gaudi::Property< double > m_toleranceX0
Extra tolerance applied on the non-bending intercept when calculating the matching score.
SegmentBranchPtr_t m_recoSegs
ToolHandle< ActsTrk::IExtrapolationTool > m_extrapolationTool
Track extrapolation tool.
const MuonR4::MuonTag * findMuTagIMO(const xAOD::TrackParticle &idTrack, const EventContext &ctx) const
Gaudi::Property< double > m_tolerancePhi
Extra tolerance applied on the bending direction when calculating the matching score.
std::vector< const xAOD::MuonSegment * > getAssociatedSegments(const xAOD::TrackParticle &idTrack, const EventContext &ctx) const
Returns the collection of reconstructed segments that can be associated to the id track If the track ...
ActsTrk::ContextUtility m_ctxProvider
Context provider for geometry, magnetic field and calibration contexts.
Gaudi::Property< double > m_toleranceY0
Extra tolerance applied on the bending intercept when calculating the matching score.
std::uint8_t nPhiLayers() const
Returns the number of trigger phi hits.
double chi2(TH1 *h0, TH1 *h1)
const CaloExtension * getCaloExtension(const xAOD::TrackParticle &track)
Retrieve a pointer to the CaloExtension linked with the passed TrackParticle.
Acts::BoundTrackParameters boundSegmentPars(const ActsTrk::GeometryContext &gctx, const MuonGMR4::MuonDetectorManager &detMgr, const xAOD::MuonSegment &segment, const Acts::ParticleHypothesis hypot=Acts::ParticleHypothesis::muon())
Returns the segment parameters as boundTrackParameters.
std::string printID(const xAOD::MuonSegment &seg)
Print the chamber ID of a segment, e.g.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition P4Helpers.h:34

◆ configAthHistogramming()

StatusCode AthHistogramming::configAthHistogramming ( const ServiceHandle< ITHistSvc > & histSvc,
const std::string & prefix,
const std::string & rootDir,
const std::string & histNamePrefix,
const std::string & histNamePostfix,
const std::string & histTitlePrefix,
const std::string & histTitlePostfix )
protectedinherited

To be called to fill the internal configuration.

Definition at line 64 of file AthHistogramming.cxx.

68{
71 m_rootDir = rootDir;
72 m_histNamePrefix = histNamePrefix;
73 m_histNamePostfix = histNamePostfix;
74 m_histTitlePrefix = histTitlePrefix;
75 m_histTitlePostfix = histTitlePostfix;
76
77 return StatusCode::SUCCESS;
78}
ServiceHandle< ITHistSvc > m_histSvc
Pointer to the THistSvc (event store by default).

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareGaudiProperty ( Gaudi::Property< T, V, H > & hndl,
const SG::VarHandleKeyType &  )
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::declareProperty ( Gaudi::Property< T, V, H > & t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ detStore()

const ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

◆ dumpLegacyTracks()

StatusCode MuonValR4::MsTrackTester::dumpLegacyTracks ( const EventContext & ctx)
private

Dumps the legacy containers to the TTree.

Definition at line 679 of file MsTrackTester.cxx.

679 {
680
681 //This for now is to be able to retrieve the matching between the legacy segments and tracks ...
682 const xAOD::MuonContainer* legacyMuons{nullptr};
683 ATH_CHECK(SG::get(legacyMuons, m_legacyMuonKey, ctx));
684
685 if (!legacyMuons) {
686 return StatusCode::SUCCESS;
687 }
688
689 for (const xAOD::Muon* muon : *legacyMuons) {
690 ATH_MSG_VERBOSE("iMuon " << muon->index() << " pT: "<<(muon->pt() *MeVtoGeV)<<" [GeV], eta: "
691 <<muon->eta() <<", phi: "<<toDeg(muon->phi())<<", q: "<<muon->charge()
692 <<", nSegments: "<<muon->nMuonSegments());
693 const xAOD::TrackParticle* track = muon->trackParticle(xAOD::Muon::TrackParticleType::MuonSpectrometerTrackParticle);
694 if (!track) {
695 continue;
696 }
697 m_summaryTool->copySummary(m_summaryTool->makeSummary(ctx, *track->track()), *track);
698 m_legacyTrks->push_back(track);
699 auto trkIdx = m_legacyTrks->find(track);
700 for (size_t s = 0; s < muon->nMuonSegments(); ++s) {
701 const xAOD::MuonSegment* segment = muon->muonSegment(s);
702 auto segIdx = m_legacyRecoSegs->push_back(*segment);
703 ATH_MSG_VERBOSE(std::format( "Legacy muon-segment link: segment {:} @{:}, eta: {:.2f}, phi {:.2f}",
704 printID(*segment), Amg::toString(segment->position()),
705 segment->direction().eta(), toDeg(segment->direction().phi())));
706 m_legacySegToTrkLinks[segIdx] = trkIdx;
707 }
708 }
709
710 //Dump also legacy segments
711 const xAOD::MuonSegmentContainer* legacyRecoSegs{nullptr};
712 ATH_CHECK(SG::get(legacyRecoSegs, m_legacySegmentKey, ctx));
713
714 if (legacyRecoSegs->size()) {
715 m_legacySegToTrkLinks[legacyRecoSegs->size()-1];
716 for (const xAOD::MuonSegment* seg : *legacyRecoSegs) {
717 //Store all segments
718 m_legacyRecoSegs->push_back(*seg);
719 }
720 }
721
722 const xAOD::TrackParticleContainer* legacyTrks{nullptr};
723 ATH_CHECK(SG::get(legacyTrks, m_legacyTrackKey, ctx));
724
725 for (const xAOD::TrackParticle* track : *legacyTrks) {
726 m_summaryTool->copySummary(m_summaryTool->makeSummary(ctx, *track->track()), *track);
727 m_legacyTrks->push_back(track);
728 }
729
730 return StatusCode::SUCCESS;
731 }
#define ATH_CHECK
Evaluate an expression and check for errors.
size_type size() const noexcept
Returns the number of elements in the collection.
ToolHandle< MuonR4::ITrackSummaryTool > m_summaryTool
Hit summary tool.
SegmentKey_t m_legacySegmentKey
Legacy segment container.
MuonVal::VectorBranch< unsigned short > & m_legacySegToTrkLinks
Link of the legacy track to the legacy segment.
ParticleBranchPtr_t m_legacyTrks
Output branches of the legacy MS tracks.
SegmentBranchPtr_t m_legacyRecoSegs
TrackKey_t m_legacyTrackKey
Legacy track reconstruction chain.
MuonKey_t m_legacyMuonKey
Legacy muons.
Amg::Vector3D direction() const
Returns the direction as Amg::Vector.
Amg::Vector3D position() const
Returns the position as Amg::Vector.
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
const T * get(const ReadCondHandleKey< T > &key, const EventContext &ctx)
Convenience function to retrieve an object given a ReadCondHandleKey.
MuonSegmentContainer_v1 MuonSegmentContainer
Definition of the current "MuonSegment container version".
TrackParticle_v1 TrackParticle
Reference the current persistent version:
TrackParticleContainer_v1 TrackParticleContainer
Definition of the current "TrackParticle container version".
Muon_v1 Muon
Reference the current persistent version:
Definition Muon.h:13
MuonContainer_v1 MuonContainer
Definition of the current "Muon container version".

◆ dumpRecoContent()

StatusCode MuonValR4::MsTrackTester::dumpRecoContent ( const EventContext & ctx)
private

Dump the reconstructed information.

Fetch the containers from store gate

Link the truth muons to the seeds

Link the seeds by the number of matched segments

Collect only the ID tracks that belong to a truth muon of interest.

Select only the id tags that are extrapolated to the calo exit

Definition at line 769 of file MsTrackTester.cxx.

769 {
770 const xAOD::MuonContainer* muons{nullptr};
771 ATH_CHECK(SG::get(muons, m_muonKey, ctx));
773 const xAOD::MuonSegmentContainer* recoSegments{nullptr};
774 ATH_CHECK(SG::get(recoSegments, m_recoSegmentKey, ctx));
775
776 const MuonR4::MsTrackSeedContainer* trkSeeds{nullptr};
777 ATH_CHECK(SG::get(trkSeeds, m_msTrkSeedKey, ctx));
778
779 const xAOD::TrackParticleContainer* idTracks{nullptr};
780 ATH_CHECK(SG::get(idTracks, m_idTrackKey, ctx));
781
782 const MuonR4::MuonTagContainer* idTags{nullptr};
783 ATH_CHECK(SG::get(idTags, m_idTagKey, ctx));
784
785 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
786 const Acts::MagneticFieldContext mfContext = m_ctxProvider.getMagneticFieldContext(ctx);
787
788 MagField::AtlasFieldCache magField{};
789 mfContext.get<const AtlasFieldCacheCondObj*>()->getInitializedCache(magField);
790
791 std::unordered_map<const xAOD::TruthParticle*,
792 std::vector<unsigned>> truthToSeedMatchCounter{};
793
794 if (!trkSeeds->empty()) {
795 m_seedTruthLink[trkSeeds->size() -1];
796 }
797
798 for (const MuonR4::MsTrackSeed& seed : *trkSeeds) {
799 unsigned int seedIdx = m_seedPos.size();
800 m_seedPos += seed.position();
801 m_seedType+= Acts::toUnderlying(seed.location());
802 m_seedSector += seed.sector().sector();
803 m_seedSummary->push_back(ctx, seed);
804
805 auto startPars = m_seedingTool->estimateStartParameters(ctx, seed);
806 if (startPars.ok()) {
807 m_seedDir += (*startPars).direction();
808 } else {
809 m_seedDir += Amg::Vector3D::UnitZ();
810 }
811 // m_seedDir
812 ATH_MSG_VERBOSE(" Dump new seed: "<<seed);
813 for (const xAOD::MuonSegment* seg : seed.segments()){
814 m_seedRecoSegMatch[seedIdx].push_back(m_recoSegs->push_back(*seg));
815 if (const xAOD::MuonSegment* truthSeg = MuonR4::getMatchedTruthSegment(*seg);
816 truthSeg != nullptr) {
817 std::vector<unsigned>& matchCounter = truthToSeedMatchCounter[MuonR4::getTruthMatchedParticle(*truthSeg)];
818 if (seedIdx >= matchCounter.size()) {
819 matchCounter.resize(seedIdx +1);
820 }
821 ++matchCounter[seedIdx];
822 }
823 }
824 const auto[seedLength, theta] = calcSeedLength(tgContext, seed);
825 m_seedLength+= seedLength;
827 m_seedQP += m_seedingTool->estimateQtimesP(tgContext, seed, magField) / Gaudi::Units::GeV;
828 m_seedGood += startPars.ok();
829 }
831 for (auto& [truthMuon, matches] : truthToSeedMatchCounter) {
832 const unsigned tIndex = m_truthTrks->find(truthMuon);
833 if (tIndex >= m_truthTrks->size()) {
834 continue;
835 }
837 while (std::count_if(matches.begin(), matches.end(),
838 [](const unsigned nMatched){
839 return nMatched > 0;
840 })) {
841 auto bestMatch = std::ranges::max_element(matches);
842 const std::size_t seedIdx = std::distance(matches.begin(), bestMatch);
843 m_truthMuToSeedIdx[tIndex].push_back(seedIdx);
844
845 m_seedTruthLink[seedIdx] = tIndex;
846 m_truthMuToSeedCounter[tIndex].push_back(*bestMatch);
847 (*bestMatch) = 0;
848 }
849 }
850
851 for (const xAOD::Muon* muon : *muons) {
852 m_muonTrks->push_back(muon);
853 }
854
855 for (const xAOD::MuonSegment* seg : *recoSegments) {
856 m_recoSegs->push_back(*seg);
857 }
858
860 if (idTracks) {
861 m_nIdTracks = idTracks->size();
862 for (const xAOD::TrackParticle* idTrk : *idTracks) {
863 if (m_truthTrks->find([idTrk](const xAOD::IParticle* p){
864 return xAOD::TruthHelpers::getTruthParticle(*idTrk) ==
865 xAOD::TruthHelpers::getTruthParticle(*p);
866 }) < m_truthTrks->size()) {
867 m_idTracks->push_back(idTrk);
868 }
869 }
870 }
871 if (idTags) {
872 m_nIdTags = idTags->size();
873 for (const MuonR4::MuonTag* idTag : *idTags) {
875 if (idTag->extrapolatedParsID(Acts::hashString("@CaloExit"))){
876 m_idTracks->push_back(idTag->idTrack());
877 }
878 }
879 }
880 return StatusCode::SUCCESS;
881 }
MuonVal::ScalarBranch< std::uint16_t > & m_nIdTags
The number of selected ID tracks in the event.
MuonTagKey_t m_idTagKey
The collection of all ID tracks that are selected for combined reconstruction.
TrackKey_t m_idTrackKey
The collection of ID tracks associated with the truth particle.
ParticleBranchPtr_t m_truthTrks
MuonVal::VectorBranch< int > & m_seedSector
Sector of the seed, even center, odd overlap regions, for details see:
MuonVal::VectorBranch< float > & m_seedThetaCone
Maximum angular difference between the segments part of the seed.
MuonVal::ScalarBranch< std::uint16_t > & m_nIdTracks
The number of ID tracks in the event.
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedIdx
Links to all MsTrkSeeds that could be matched to the truthMuon, i.e.
std::pair< double, double > calcSeedLength(const Acts::GeometryContext &tgContext, const MuonR4::MsTrackSeed &seed) const
Calculate the length of the seed and the theta deflection angle The length is defined as the spread o...
MuonVal::VectorBranch< char > & m_seedType
Is the seed in the encap or in the barrel chambers.
ParticleBranchPtr_t m_muonTrks
Stored muon information from the Acts muon reco chain.
SG::ReadHandleKey< MuonR4::MsTrackSeedContainer > m_msTrkSeedKey
Temporary container write handle to push the seeds to store gate for later efficiency analysis.
ParticleBranchPtr_t m_idTracks
Stored ID track information.
MuonVal::MatrixBranch< unsigned short > & m_seedRecoSegMatch
Link of the track seed to the building segment.
MuonVal::VectorBranch< float > & m_seedQP
Estimated momentum times charge from the track seed.
MuonVal::MatrixBranch< unsigned short > & m_truthMuToSeedCounter
Number of matched segments in the seed.
MuonVal::ThreeVectorBranch m_seedPos
Simple seed information.
MuonVal::VectorBranch< float > & m_seedLength
Maximum separation between the segments on the reference plane.
MuonVal::UnitThreeVectorBranch m_seedDir
Seed direction vector.
SegmentKey_t m_recoSegmentKey
Primary segment container.
MuonVal::VectorBranch< char > & m_seedGood
Does the seeding tool construct valid parameters from the seed.
std::shared_ptr< TrackSummaryModule > m_seedSummary
Hit summary on the track seed.
MuonVal::VectorBranch< unsigned short > & m_seedTruthLink
Link to the truth muon.
MuonKey_t m_muonKey
Dependency on the R4 muon container.
const xAOD::TruthParticle * getTruthMatchedParticle(const xAOD::MuonSegment &segment)
Returns the particle truth-matched to the segment.
std::vector< MsTrackSeed > MsTrackSeedContainer
Definition MsTrackSeed.h:96
DataVector< MuonTag > MuonTagContainer
Definition MuonTag.h:125
const xAOD::MuonSegment * getMatchedTruthSegment(const xAOD::MuonSegment &segment)
Returns the truth-matched segment.
TruthParticle_v1 TruthParticle
Typedef to implementation.

◆ dumpTruthContent()

StatusCode MuonValR4::MsTrackTester::dumpTruthContent ( const EventContext & ctx)
private

Dump truth information.

Allocate the memory

Definition at line 732 of file MsTrackTester.cxx.

732 {
733 if (!m_isMC) {
734 return StatusCode::SUCCESS;
735 }
736 const xAOD::MuonSegmentContainer* truthSegs{nullptr};
737 ATH_CHECK(SG::get(truthSegs, m_truthSegmentKey, ctx));
738
739
740 for (const xAOD::MuonSegment* seg : *truthSegs) {
741 ATH_MSG_VERBOSE("Dump truth segment "<<printID(*seg)<<" @"<<
742 Amg::toString(seg->position())<<", eta: "<<seg->direction().eta()
743 <<", phi: "<<toDeg(seg->direction().phi()));
744 m_truthSegs->push_back(*seg);
745 }
746 if (truthSegs->size()) {
747 m_truthSegToRecoLink[truthSegs->size()-1];
748 }
749
750
751 const xAOD::TruthParticleContainer* truthMuons{nullptr};
752 ATH_CHECK(SG::get(truthMuons, m_truthKey, ctx));
753 const std::size_t nT = truthMuons->size() - 1;
754 if (!truthMuons->empty()) {
759 }
760 for (const xAOD::TruthParticle* truth : *truthMuons) {
761 ATH_MSG_DEBUG("Truth muon: pT: "<<(truth->pt() *MeVtoGeV)
762 <<", eta: "<<truth->eta()<<", phi: "<<toDeg(truth->phi())<<", q: "<<truth->charge()
763 <<", uuid: "<<HepMC::uniqueID(truth));
764 m_truthTrks->push_back(*truth);
765 }
766
767 return StatusCode::SUCCESS;
768 }
bool empty() const noexcept
Returns true if the collection is empty.
SegmentBranchPtr_t m_truthSegs
MuonVal::MatrixBranch< unsigned short > & m_truthMuRecoSegLinks
Links from the truth muon to the segments.
SG::ReadHandleKey< xAOD::TruthParticleContainer > m_truthKey
Key to the truth particle collection.
Gaudi::Property< bool > m_isMC
Toggle whether the job runs on MC or not.
MuonVal::MatrixBranch< unsigned short > & m_truthSegToRecoLink
Link of the truth segments to the matchin reco segments.
SegmentKey_t m_truthSegmentKey
Segment from the truth hits.
int uniqueID(const T &p)
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.

◆ efficiency()

TEfficiency * AthHistogramming::efficiency ( std::string_view effName,
std::string_view tDir = "",
std::string_view stream = "" )
protectedinherited

Simplify the retrieval of registered TEfficiency.

Definition at line 214 of file AthHistogramming.cxx.

215{
216 // Build a 32 bit hash out of the name
217 const hash_t effHash = this->hash(effName);
218
219 // See if this entry exists in the map
220 EffMap_t::const_iterator it = m_effMap.find( effHash );
221 if ( it == m_effMap.end() ) // It doesn't exist!
222 { // Let's see into the THistSvc if somebody else has registered the TEfficiency...
223 // Massage the final string to book things
224 std::string bookingString = buildBookingString(effName, tDir, stream ,false);
225
226 TEfficiency* effPointer{};
227 if ( !((histSvc()->getEfficiency(bookingString, effPointer)).isSuccess()) )
228 {
229 // Book things
230 std::string bookingString = buildBookingString( effName, tDir, stream, true );
231
232 if ( !((histSvc()->getEfficiency(bookingString, effPointer)).isSuccess()) )
233 {
234 m_msg << MSG::WARNING
235 << "Problem retrieving the TEfficiency with name (including pre- and post-fixes) "
236 << bookingString
237 << " or with name " << effName
238 << " in " << m_name << "... it doesn't exist, neither in the cached map nor in the THistSvc!"
239 << " Will return an NULL pointer... you have to handle it correctly!" << endmsg;
240 return NULL;
241 }
242 // If we get to here, we actually found the TEfficiency in the THistSvc.
243 // So let's add it to the local cache map and return its pointer
244 m_effMap.insert( m_effMap.end(), std::pair< const hash_t, TEfficiency* >( effHash, effPointer ) );
245 return effPointer;
246 }
247 // If we get to here, we actually found the TEfficiency in the THistSvc.
248 // So let's add it to the local cache map and return its pointer
249 m_effMap.insert( m_effMap.end(), std::pair< const hash_t, TEfficiency* >( effHash, effPointer ) );
250 return effPointer;
251 }
252
253 // Return the pointer to the TEfficiency that we got from the local cache map
254 return it->second;
255}
std::pair< StatusCode, TEfficiency * > getEfficiency(ITHistSvc &svc, const std::string &name)

◆ evtStore()

ServiceHandle< StoreGateSvc > & AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode MuonValR4::MsTrackTester::execute ( const EventContext & ctx)
finaloverridevirtual

Execute method.

Implements AthAlgorithm.

Definition at line 882 of file MsTrackTester.cxx.

882 {
886
887 ATH_CHECK(m_tree.fill(ctx));
888 return StatusCode::SUCCESS;
889 }
StatusCode dumpLegacyTracks(const EventContext &ctx)
Dumps the legacy containers to the TTree.
StatusCode dumpRecoContent(const EventContext &ctx)
Dump the reconstructed information.
StatusCode dumpTruthContent(const EventContext &ctx)
Dump truth information.
MuonVal::MuonTesterTree m_tree
The output tree object.

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase & ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ extraOutputDeps()

const DataObjIDColl & AthCommonAlgorithm< Gaudi::Algorithm >::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 89 of file AthCommonAlgorithm.cxx.

54{
55 // If we didn't find any symlinks to add, just return the collection
56 // from the base class. Otherwise, return the extended collection.
57 if (!m_extendedExtraObjects.empty()) {
59 }
61}
Common base class for algorithms.

◆ filterPassed()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::filterPassed ( const EventContext & ctx) const
inlinevirtualinherited

Get filter decision:

Definition at line 93 of file AthCommonAlgorithm.h.

93 {
94 return execState( ctx ).filterPassed();
95 }
virtual bool filterPassed(const EventContext &ctx) const
Get filter decision:

◆ finalize()

StatusCode MuonValR4::MsTrackTester::finalize ( )
finaloverride

Definition at line 890 of file MsTrackTester.cxx.

890 {
891 ATH_CHECK(m_tree.write());
892 return StatusCode::SUCCESS;
893 }

◆ findBaseIdTag()

const MuonR4::MuonTag * MuonValR4::MsTrackTester::findBaseIdTag ( const xAOD::TrackParticle & idTrack,
const EventContext & ctx ) const
private

Searches the Id track in the basline collection of all ID tracks selected for the combined muon reconstructiion (STACO/MuidCo/MuTagIMO/Calo).

Parameters
idTrackThe inner detector track of interest
ctxThe current event context to access the segment tag collection from store gate

Definition at line 505 of file MsTrackTester.cxx.

506 {
507 return findTagMatchingToId(idTrack, m_idTagKey, ctx);
508 }

◆ findMuTagIMO()

const MuonR4::MuonTag * MuonValR4::MsTrackTester::findMuTagIMO ( const xAOD::TrackParticle & idTrack,
const EventContext & ctx ) const
private

Definition at line 509 of file MsTrackTester.cxx.

510 {
511 return findTagMatchingToId(idTrack, m_segTagKey, ctx);
512 }
MuonTagKey_t m_segTagKey
The collection of the original segment tags.

◆ getAssociatedSegments()

std::vector< const xAOD::MuonSegment * > MuonValR4::MsTrackTester::getAssociatedSegments ( const xAOD::TrackParticle & idTrack,
const EventContext & ctx ) const
private

Returns the collection of reconstructed segments that can be associated to the id track If the track is connected with a truth muon, the list of reconstructed segments matched to the truth muon is returned.

Otherwise, the list of segments associated with the MuTagIMO tag is returned.

Parameters
idTrackThe inner detector track of interest
ctxThe current event context to access the segment tag collection from store gate

Definition at line 515 of file MsTrackTester.cxx.

516 {
517 std::vector<const xAOD::MuonSegment*> compatibleSegs{};
518 if (const xAOD::TruthParticle* truthPart = truthTreeParticle(idTrack, ctx); truthPart != nullptr) {
519 std::vector<const xAOD::MuonSegment*> truthSegs = getTruthSegments(*truthPart);
520 const xAOD::MuonSegmentContainer* recoSegs{nullptr};
521 SG::get(recoSegs, m_recoSegmentKey, ctx).ignore();
522 std::copy_if(recoSegs->begin(), recoSegs->end(), std::back_inserter(compatibleSegs),
523 [&truthSegs](const xAOD::MuonSegment* recoSeg){
524 return Acts::rangeContainsValue(truthSegs, getMatchedTruthSegment(*recoSeg));
525 });
526 if (!compatibleSegs.empty()) {
527 return compatibleSegs;
528 }
529 }
530
531 const xAOD::MuonContainer* muons{nullptr};
532 SG::get(muons,m_muonKey, ctx).ignore();
533 for (const xAOD::Muon* muon : *muons) {
534 if (muon->trackParticle(xAOD::Muon::TrackParticleType::InnerDetectorTrackParticle) == &idTrack) {
535 for (std::size_t s = 0; s < muon->nMuonSegments() ; ++s) {
536 compatibleSegs.push_back(muon->muonSegment(s));
537 }
538 break;
539 }
540 }
541 return compatibleSegs;
542 }
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
const xAOD::TruthParticle * truthTreeParticle(const xAOD::IParticle &part, const EventContext &ctx) const
Returns the matched truth particle that is dumped in the tree.
std::vector< const xAOD::MuonSegment * > getTruthSegments(const xAOD::TruthParticle &truthMuon)
Returns the segments associated to the truth muon.

◆ getEnvelope()

const MuonGMR4::SpectrometerSector * MuonValR4::MsTrackTester::getEnvelope ( const xAOD::MuonSegment & segment) const
private

Definition at line 544 of file MsTrackTester.cxx.

544 {
545 return m_detMgr->getSectorEnvelope(segment.chamberIndex(), segment.sector(), segment.etaIndex());
546 }
::Muon::MuonStationIndex::ChIndex chamberIndex() const
Returns the chamber index.
int etaIndex() const
Returns the eta index, which corresponds to stationEta in the offline identifiers (and the ).

◆ graph()

TGraph * AthHistogramming::graph ( std::string_view graphName,
std::string_view tDir = "",
std::string_view stream = "" )
protectedinherited

Simplify the retrieval of registered TGraphs.

Definition at line 438 of file AthHistogramming.cxx.

439{
440 // Build a 32 bit hash out of the name
441 const hash_t graphHash = this->hash(graphName);
442
443 // See if this entry exists in the map
444 GraphMap_t::const_iterator it = m_graphMap.find( graphHash );
445 if ( it == m_graphMap.end() ) // It doesn't exist!
446 { // Let's see into the THistSvc if somebody else has registered the TGraph...
447
448 // Massage the final string to book things
449 std::string bookingString = buildBookingString( graphName, tDir, stream, false);
450
451 TGraph* graphPointer(nullptr);
452 if ( !((histSvc()->getGraph(bookingString, graphPointer)).isSuccess()) )
453 {
454 // Massage the final string to book things
455 std::string bookingString = buildBookingString( graphName, tDir, stream, true );
456
457 if ( !((histSvc()->getGraph(bookingString, graphPointer)).isSuccess()) )
458 {
459 m_msg << MSG::WARNING
460 << "Problem retrieving the TGraph with name (including pre- and post-fixes) "
461 << bookingString
462 << " or with name " << graphName
463 << " in " << m_name << "... it doesn't exist, neither in the cached map nor in the THistSvc!"
464 << " Will return an NULL pointer... you have to handle it correctly!" << endmsg;
465 return nullptr;
466 }
467 // If we get to here, we actually found the TGraph in the THistSvc.
468 // So let's add it to the local cache map and return its pointer
469 m_graphMap.insert( m_graphMap.end(), std::pair< const hash_t, TGraph* >( graphHash, graphPointer ) );
470 return graphPointer;
471 }
472 // If we get to here, we actually found the TGraph in the THistSvc.
473 // So let's add it to the local cache map and return its pointer
474 m_graphMap.insert( m_graphMap.end(), std::pair< const hash_t, TGraph* >( graphHash, graphPointer ) );
475 return graphPointer;
476 }
477
478
479 // Return the pointer to the TGraph that we got from the local cache map
480 return it->second;
481}
std::pair< StatusCode, TGraph * > getGraph(ITHistSvc &svc, const std::string &name)

◆ hash()

AthHistogramming::hash_t AthHistogramming::hash ( std::string_view histName) const
inlineprivateinherited

Method to calculate a 32-bit hash from a string.

Definition at line 422 of file AthHistogramming.h.

423{
424 const uint64_t hash64 = CxxUtils::crc64( std::string{histName} );
425 return (hash_t)(hash64 & 0xFFFFFFFF);
426}
uint64_t crc64(const CRCTable &table, const char *data, size_t data_len)
Find the CRC-64 of a string,.
Definition crc64.cxx:695
std::uint64_t hash64(const void *data, std::size_t size)
Passthrough to XXH3_64bits.
Definition XXH.cxx:9

◆ hist()

TH1 * AthHistogramming::hist ( std::string_view histName,
std::string_view tDir = "",
std::string_view stream = "" )
protectedinherited

Simplify the retrieval of registered histograms of any type.

Definition at line 182 of file AthHistogramming.cxx.

183 {
184
185 const auto histBaseName = splitName(histName).second;
186 std::string bookingString = buildBookingString(histName, tDir, stream, false);
187
188 const hash_t histHash = this->hash(histBaseName);
189
190 HistMap_t::const_iterator it = m_histMap.find(histHash);
191 if (it == m_histMap.end()) {
192 TH1* histPointer(nullptr);
193
194 if (!histSvc()->getHist(bookingString, histPointer).isSuccess()) {
195 std::string prefixedBookingString = buildBookingString(histName, tDir, stream, true);
196 if (!histSvc()->getHist(prefixedBookingString, histPointer).isSuccess()) {
197 m_msg << MSG::WARNING
198 << "Problem retrieving the histogram with name (including pre- and post-fixes) "
199 << prefixedBookingString
200 << " or with name " << histName
201 << " in " << m_name << "... it doesn't exist, neither in the cached map nor in the THistSvc!"
202 << " Will return an NULL pointer... you have to handle it correctly!" << endmsg;
203 return nullptr;
204 }
205 }
206
207 m_histMap.insert(m_histMap.end(), std::pair<const hash_t, TH1*>(histHash, histPointer));
208 return histPointer;
209 }
210
211 return it->second;
212}
std::pair< StatusCode, TH1 * > getHist(ITHistSvc &svc, const std::string &name, size_t index=0)

◆ hist2d()

TH2 * AthHistogramming::hist2d ( std::string_view histName,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the retrieval of registered 2-d histograms.

Definition at line 363 of file AthHistogramming.h.

364{
365 // Get the TH1 pointer
366 TH1* th1Pointer = this->hist(histName, tDir, stream);
367 if ( !th1Pointer )
368 {
369 m_msg << MSG::ERROR
370 << "Cannot get a 2-d histogram with name " << histName
371 << "... will probably seg-fault!" << endmsg;
372 return NULL;
373 }
374 // If the TH1 pointer is valid, simply return the dynamic_cast
375 return dynamic_cast<TH2*>( th1Pointer );
376}

◆ hist3d()

TH3 * AthHistogramming::hist3d ( std::string_view histName,
std::string_view tDir = "",
std::string_view stream = "" )
inlineprotectedinherited

Simplify the retrieval of registered 3-d histograms.

Definition at line 380 of file AthHistogramming.h.

381{
382 // Get the TH1 pointer
383 TH1* th1Pointer = this->hist(histName, tDir, stream);
384 if ( !th1Pointer )
385 {
386 m_msg << MSG::ERROR
387 << "Cannot get a 3-d histogram with name " << histName
388 << "... will probably seg-fault!" << endmsg;
389 return NULL;
390 }
391 // If the TH1 pointer is valid, simply return the dynamic_cast
392 return dynamic_cast<TH3*>( th1Pointer );
393}

◆ histSvc()

const ServiceHandle< ITHistSvc > & AthHistogramAlgorithm::histSvc ( ) const
inlineinherited

The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a pointer to the THistSvc.

Definition at line 113 of file AthHistogramAlgorithm.h.

114{
115 return m_histSvc;
116}

◆ initialize()

StatusCode MuonValR4::MsTrackTester::initialize ( )
finaloverride

Link the truth segment to the reconstructed segment...

Link the truth segments to the truth partcle

Count the number of matched truth segments

Calculate the truth seed length

Production vertex of the truth muon [mm]; prodR = -1 if the vertex is missing (is -1 really the best value? ...)

Dump whether the id track is selected and dump the parameters at calo exit

Link the reconstructed segments to the muon

Link the associated seed

Definition at line 122 of file MsTrackTester.cxx.

122 {
124 ATH_CHECK(m_truthKey.initialize(m_isMC));
125
126 ATH_CHECK(m_muonKey.initialize());
127 ATH_CHECK(m_msTrkSeedKey.initialize());
128 ATH_CHECK(m_recoSegmentKey.initialize());
129
130 ATH_CHECK(m_summaryTool.retrieve());
131 ATH_CHECK(m_seedingTool.retrieve());
132
133 ATH_CHECK(m_legacyMuonKey.initialize(!m_legacyMuonKey.empty()));
134 ATH_CHECK(m_legacyTrackKey.initialize(!m_legacyMuonKey.empty()));
135 ATH_CHECK(m_legacySegmentKey.initialize(!m_legacyMuonKey.empty()));
136 ATH_CHECK(m_idTrackKey.initialize(m_isMC && m_storeID));
137 ATH_CHECK(m_idTagKey.initialize(!m_idTrackKey.empty()));
138 ATH_CHECK(m_segTagKey.initialize(!m_idTrackKey.empty()));
139
140 ATH_CHECK(m_ctxProvider.initialize());
141 ATH_CHECK(m_extrapolationTool.retrieve(EnableTool{m_storeID || m_isMC}));
142 ATH_CHECK(detStore()->retrieve(m_detMgr));
144
145 int evOpts{0};
146
147 m_recoSegs = std::make_unique<SegmentVariables>(m_tree, m_recoSegmentKey.key(), "Segments", msgLevel());
148 m_recoSegs->addVariable(std::make_unique<MuonVal::GenericAuxDecorationBranch<unsigned short>>(m_tree,
149 "Segments_passSeedQual",[this](const SG::AuxElement* aux){
150 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
151 return m_segSelector->passSeedingQuality(Gaudi::Hive::currentContext(),
152 *seg); }));
153 m_recoSegs->addVariable(std::make_unique<MuonVal::GenericAuxDecorationBranch<unsigned short>>(m_tree,
154 "Segments_passTrackQual",[this](const SG::AuxElement* aux){
155 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
156 return m_segSelector->passTrackQuality(Gaudi::Hive::currentContext(),
157 *seg);
158 }));
159
160
161 if (m_isMC) {
162 evOpts |= EventInfoBranch::isMC;
163 m_recoSegs->addVariable(std::make_unique<MuonVal::GenericAuxDecorationBranch<unsigned short>>(m_tree,
164 "Segments_truthSegLink",[this](const SG::AuxElement* aux){
165 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
167 const unsigned linkIdx = truthS ? m_truthSegs->push_back(*truthS) : -1;
169 if (truthS) {
170 m_truthSegToRecoLink.push_back(linkIdx, m_recoSegs->push_back(*seg));
172 if (truthMuon){
173 m_truthTrks->push_back(truthMuon);
174 m_truthMuRecoSegLinks[m_truthTrks->find(truthMuon)].push_back(m_recoSegs->push_back(*seg));
175 }
176 }
177 return linkIdx;
178 }));
179
180 m_truthSegs = std::make_unique<SegmentVariables>(m_tree, m_truthSegmentKey.key(), "TruthSegments", msgLevel());
181
182 m_truthSegs->addVariable(std::make_unique<MuonVal::GenericAuxDecorationBranch<unsigned short>>(m_tree,
183 "TruthSegments_truthLink",[this](const SG::AuxElement* aux){
184 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
186 m_truthTrks->push_back(truthP);
187 unsigned short linkIdx = m_truthTrks->find(truthP);
188 return linkIdx;
189 }));
190 for (auto loc : {Location::Barrel, Location::Endcap}) {
191 m_truthSegs->addVariable(std::make_unique<MuonVal::GenericAuxDecorationBranch<unsigned short>>(m_tree,
192 std::format("TruthSegments_has{}Proj", loc), [loc, this](const SG::AuxElement* aux) -> unsigned short {
193
194 const auto* seg = static_cast<const xAOD::MuonSegment*>(aux);
195 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(Gaudi::Hive::currentContext());
196 ExpandedSector sector{seg->position().phi()};
197 const Amg::Vector2D projPos{m_seedingTool->expressOnCylinder(tgContext, *seg, loc, sector)};
198 return m_seedingTool->withinBounds(projPos, loc);
199 }));
200 }
201
202 m_tree.addBranch(m_truthSegs);
203
204 m_truthTrks = std::make_unique<IParticleFourMomBranch>(m_tree, "TruthMuons");
205 m_truthTrks->addVariable<int>(-1, "truthOrigin");
206 m_truthTrks->addVariable<int>(-1, "truthType");
208 m_truthTrks->addVariable(
209 std::make_unique<GenericPartDecorBranch<xAOD::TruthParticle,
210 std::vector<unsigned short>>>(m_tree,
211 std::format("{:}_truthSegLinks", m_truthTrks->name()), [&] (const xAOD::TruthParticle& p){
212 std::vector<unsigned short> idx{};
213 for (const xAOD::MuonSegment* truthSeg: getTruthSegments(p)){
214 idx.push_back(m_truthSegs->push_back(*truthSeg));
215 }
216 return idx;
217 }));
219 m_truthTrks->addVariable(
220 std::make_unique<GenericPartDecorBranch<xAOD::TruthParticle, unsigned short>>(m_tree,
221 std::format("{:}_nTruthSegments", m_truthTrks->name()), [&] (const xAOD::TruthParticle& p) -> unsigned short {
222 return getTruthSegments(p).size();
223 }));
224
225 m_truthTrks->addVariable(
226 std::make_unique<GenericPartDecorBranch<xAOD::TruthParticle, float>>(m_tree,
227 std::format("{:}_eLossInMS", m_truthTrks->name()), [] (const xAOD::TruthParticle& p) -> float {
228 std::vector<const xAOD::MuonSimHit*> allHits{};
229 for (const xAOD::MuonSegment* seg : getTruthSegments(p)){
230 auto hits = getMatchingSimHits(*seg);
231 allHits.insert_range(allHits.end(),getMatchingSimHits(*seg));
232 }
233 if (allHits.empty()) {
234 return 0.;
235 }
236 auto [min, max] = std::ranges::minmax(allHits, [](const xAOD::MuonSimHit* a, const xAOD::MuonSimHit* b){
237 return a->kineticEnergy() < b->kineticEnergy();
238 });
239 return (min->kineticEnergy() - max->kineticEnergy()) / Gaudi::Units::GeV;
240 }));
242 auto cone = std::make_shared<VectorBranch<float>>(m_tree,
243 std::format("{}_seedThetaCone", m_truthTrks->name()));
244 auto qTimesP = std::make_shared<VectorBranch<float>>(m_tree,
245 std::format("{}_qTimesP", m_truthTrks->name()));
246
247 m_tree.addBranch(cone);
248 m_tree.addBranch(qTimesP);
249 m_truthTrks->addVariable(
250 std::make_unique<GenericPartDecorBranch<xAOD::TruthParticle, float>>(m_tree,
251 std::format("{:}_seedLength", m_truthTrks->name()), [cone, qTimesP, this] (const xAOD::TruthParticle& p) -> float {
252
253 const EventContext& ctx{Gaudi::Hive::currentContext()};
254 const Acts::GeometryContext tgContext = m_ctxProvider.getGeometryContext(ctx);
255 const Acts::MagneticFieldContext mfContext = m_ctxProvider.getMagneticFieldContext(ctx);
256 MagField::AtlasFieldCache magField{};
257 mfContext.get<const AtlasFieldCacheCondObj*>()->getInitializedCache(magField);
258 auto truthSeed = makeSeedFromTruth(tgContext, p);
259 if (!truthSeed) {
260 cone->push_back(-1);
261 qTimesP->push_back(0);
262 return -1.;
263 }
264 auto [length, theta] = calcSeedLength(tgContext, *truthSeed);
265 cone->push_back(theta);
266 qTimesP->push_back(m_seedingTool->estimateQtimesP(tgContext, *truthSeed, magField) / Gaudi::Units::GeV);
267 return length;
268 }));
269
271 for (const auto var :{ "d0", "z0", "prodZ", "prodR"}) {
272 m_trkTruthLinks.emplace_back(m_truthKey, var);
273 m_truthTrks->addVariable<float>(-99999.f, var);
274
275 }
276 m_tree.addBranch(m_truthTrks);
277 m_trkTruthLinks.emplace_back(m_truthSegmentKey, "truthParticleLink");
278 m_trkTruthLinks.emplace_back(m_truthKey, "truthSegmentLinks");
279 m_trkTruthLinks.emplace_back(m_recoSegmentKey, "truthSegmentLink");
280 m_trkTruthLinks.emplace_back(m_muonKey, "truthParticleLink");
281 }
282
283 m_tree.addBranch(m_recoSegs);
284 m_tree.addBranch(std::make_unique<EventInfoBranch>(m_tree, evOpts));
285
286 static const std::vector<std::string> trackSummaries{
287 // Inner
288 "innerSmallHits", "innerLargeHits", "innerSmallHoles", "innerLargeHoles",
289 "innerClosePrecisionHits",
290 // Middle
291 "middleSmallHits", "middleLargeHits", "middleSmallHoles",
292 "middleLargeHoles", "middleClosePrecisionHits",
293 // Outer
294 "outerSmallHits", "outerLargeHits", "outerSmallHoles", "outerLargeHoles",
295 "outerClosePrecisionHits",
296 // Extended
297 "extendedSmallHits", "extendedLargeHits", "extendedSmallHoles",
298 "extendedLargeHoles", "extendedClosePrecisionHits",
299 "innerTriggerEtaHits", "innerTriggerPhiHits",
300 "middleTriggerEtaHits", "middleTriggerPhiHits",
301 "outerTriggerEtaHits", "outerTriggerPhiHits",
302
303 "innerTriggerEtaHoles", "innerTriggerPhiHoles",
304 "middleTriggerEtaHoles", "middleTriggerPhiHoles",
305 "outerTriggerEtaHoles", "outerTriggerPhiHoles",
306 };
307 if(!m_legacyTrackKey.empty()) {
308 m_legacyTrks = std::make_unique<IParticleFourMomBranch>(m_tree, "LegacyMSTrks");
309 m_legacyTrks->addVariable(std::make_unique<TrackChi2Branch>(*m_legacyTrks));
310 if (m_isMC) {
312 [](const xAOD::IParticle* trk){
314 }, "truth", "LegacyMS");
315 }
316 for (const auto& summary : trackSummaries) {
317 m_legacyTrks->addVariable<uint8_t>(-1, summary);
318 }
319 m_tree.addBranch(m_legacyTrks);
320 m_legacyRecoSegs = std::make_unique<SegmentVariables>(m_tree, m_legacySegmentKey.key(), "LegacyRecoSegments", msgLevel());
321 m_tree.addBranch(m_legacyRecoSegs);
322 }
323
324 m_seedSummary = std::make_shared<TrackSummaryModule>(m_tree, "TrkSeed", m_summaryTool.get());
325 m_muonTrks = std::make_shared<IParticleFourMomBranch>(m_tree, "ActsMuons");
326 m_muonTrks->addVariable(std::make_unique<TrackChi2Branch>(*m_muonTrks));
327 m_muonTrks->addVariable<float>(4.5, "segmentDeltaEta");
328 m_muonTrks->addVariable<float>(std::numbers::pi, "segmentDeltaPhi");
329 m_muonTrks->addVariable<float>(-1., "segmentChi2OverDoF");
330
331 using TrkType = xAOD::Muon::TrackParticleType;
332 auto dumpTrack = [&](const std::string& trkName, TrkType type) {
333 auto trkColl = std::make_shared<IParticleFourMomBranch>(m_tree, trkName);
334 trkColl->addVariable(std::make_unique<TrackChi2Branch>(*trkColl));
335 if (type != TrkType::InnerDetectorTrackParticle) {
336 trkColl->addVariable(std::make_unique<TrackFitIterBranch>(*trkColl));
337 }
338 trkColl->addVariable(std::make_unique<MaterialRecorderBranch>(*trkColl));
339 trkColl->addVariable(std::make_unique<EnergyLossBranch>(*trkColl));
340
341 trkColl->addVariable<float>("d0");
342 trkColl->addVariable<float>("z0");
343 if (type != TrkType::InnerDetectorTrackParticle) {
344 for (const auto& summary : trackSummaries) {
345 trkColl->addVariable<uint8_t>(-1, summary);
346 }
347 }
349 [type](const xAOD::IParticle* muonP) -> const xAOD::IParticle* {
350 const auto* muon = dynamic_cast<const xAOD::Muon*>(muonP);
351 if (!muon) {
352 return nullptr;
353 }
354 return muon->trackParticle(type);
355 }, trkName, "muon");
356
357 return trkColl;
358 };
359
360 auto msTracks = dumpTrack("MsTrk", TrkType::MuonSpectrometerTrackParticle);
361 dumpTrack("MeTrk", TrkType::ExtrapolatedMuonSpectrometerTrackParticle);
362 m_idTracks = dumpTrack("IdTrk", TrkType::InnerDetectorTrackParticle);
363
365 {
366 auto& l0{m_tree.newVector<float>(std::format("{:}_caloExitLoc0", m_idTracks->name()))};
367 auto& l1{m_tree.newVector<float>(std::format("{:}_caloExitLoc1", m_idTracks->name()))};
368 auto& theta{m_tree.newVector<float>(std::format("{:}_caloExitTheta", m_idTracks->name()))};
369 auto& phi{m_tree.newVector<float>(std::format("{:}_caloExitPhi", m_idTracks->name()))};
370 auto& mom{m_tree.newVector<float>(std::format("{:}_caloExitMom", m_idTracks->name()))};
371
372 m_idTracks->addVariable(std::make_unique<GenericPartDecorBranch<xAOD::TrackParticle, std::uint8_t>>(m_tree,
373 std::format("{:}_isCandidate", m_idTracks->name()),
374 [this, &l0, &l1, &theta, &phi, &mom] (const xAOD::TrackParticle& idTrack) -> std::uint8_t {
375 const MuonR4::MuonTag* tag = findBaseIdTag(idTrack, Gaudi::Hive::currentContext());
376 std::optional<Acts::BoundTrackParameters> trkPars = tag ? tag->extrapolatedParsID(Acts::hashString("@CaloExit"))
377 : std::nullopt;
378 const std::size_t idx = l0.size();
379 using namespace MuonCombinedR4;
380 l0[idx] = trkPars ? longitudinalParam(*trkPars, logger()) : 1._km;
381 l1[idx] = trkPars ? toDeg(localPolarAngle(*trkPars, logger())) : 360.;
382
383 theta[idx] = trkPars ? toDeg(trkPars->get<Acts::eBoundTheta>()) : 360.;
384 phi[idx] = trkPars ? toDeg(trkPars->get<Acts::eBoundPhi>()) : 360.;
385 mom[idx] = trkPars ? trkPars->absoluteMomentum() : -1._GeV;
386 return trkPars != std::nullopt;
387 }));
388 }
389 {
390 auto& dX0{m_tree.newMatrix<float>(std::format("{:}_segTagDx0", m_idTracks->name()))};
391 auto& dY0{m_tree.newMatrix<float>(std::format("{:}_segTagDy0", m_idTracks->name()))};
392 auto& dTheta{m_tree.newMatrix<float>(std::format("{:}_segTagDtheta", m_idTracks->name()))};
393 auto& dPhi{m_tree.newMatrix<float>(std::format("{:}_segTagDphi", m_idTracks->name()))};
394 auto& segments{m_tree.newMatrix<std::uint8_t>(std::format("{:}_segTagSegments", m_idTracks->name()))};
395 auto& goodExtp{m_tree.newMatrix<std::uint8_t>(std::format("{:}_segTagExtpGood",m_idTracks->name()))};
396 auto& taggedSeg{m_tree.newMatrix<std::uint8_t>(std::format("{:}_segTagOnTag", m_idTracks->name()))};
397 m_idTracks->addVariable(
398 std::make_unique<GenericPartDecorBranch<xAOD::TrackParticle, std::vector<float>>>(m_tree,
399 std::format("{:}_segTagScore", m_idTracks->name()),
400 [&dX0, &dY0, &dTheta, &dPhi, &segments,
401 &goodExtp, &taggedSeg,this] (const xAOD::TrackParticle& idTrack) -> std::vector<float> {
402 auto result = calcSegTagVariables(idTrack, Gaudi::Hive::currentContext());
403
404 segments.push_back(std::move(result.recoSegs));
405 dX0.push_back(std::move(result.deltaX0));
406 dY0.push_back(std::move(result.deltaY0));
407 dTheta.push_back(std::move(result.deltaTheta));
408 dPhi.push_back(std::move(result.deltaPhi));
409 goodExtp.push_back(std::move(result.goodExtp));
410 taggedSeg.push_back(std::move(result.taggedSeg));
411 return std::move(result.matchScores);
412 }));
413 }
414 if (m_isMC) {
416 [this](const xAOD::IParticle* trk) {
417 return truthTreeParticle(*trk, Gaudi::Hive::currentContext());
418 }, "truth", "IdTrack");
419
420 }
421
422 m_muonTrks->addVariable<uint16_t>("allAuthors");
423 m_muonTrks->addVariable<uint16_t>("author");
425 m_muonTrks->addVariable(std::make_unique<GenericPartDecorBranch<xAOD::Muon,
426 std::vector<unsigned short>>>(m_tree,
427 std::format("{:}_segmentLinks", m_muonTrks->name()), [&] (const xAOD::Muon& p){
428 std::vector<unsigned short> idx{};
429 for (unsigned seg = 0 ; seg < p.nMuonSegments(); ++seg) {
430 idx.push_back(m_recoSegs->push_back(*p.muonSegment(seg)));
431 }
432 return idx;
433 }));
435 msTracks->addVariable(std::make_unique<GenericPartDecorBranch<xAOD::TrackParticle, unsigned short>>(m_tree,
436 std::format("{:}_seedLink", msTracks->name()), [&] (const xAOD::TrackParticle& p) -> unsigned short {
437 auto actsTrk = ActsTrk::getActsTrack(p);
438 if (!actsTrk) {
439 THROW_EXCEPTION("Cannot find the associated ms track from the primary track");
440 }
441 return actsTrk->component<std::size_t>("parentSeed");
442 }));
443
444 msTracks->addVariable(std::make_unique<GenericPartDecorBranch<xAOD::TrackParticle, float>>(m_tree,
445 std::format("{:}_loc0", msTracks->name()), [&] (const xAOD::TrackParticle& p){
446 auto actsTrk = ActsTrk::getActsTrack(p);
447 if (!actsTrk) {
448 THROW_EXCEPTION("Cannot find the associated ms track from the primary track");
449 }
450 auto refPars = actsTrk->createParametersAtReference();
451 return isOnCaloExit(refPars) ? MuonCombinedR4::longitudinalParam(refPars, logger())
452 : refPars.get<Acts::eBoundLoc0>();
453 }));
454 msTracks->addVariable(std::make_unique<GenericPartDecorBranch<xAOD::TrackParticle, float>>(m_tree,
455 std::format("{:}_loc1", msTracks->name()), [&] (const xAOD::TrackParticle& p){
456 auto actsTrk = ActsTrk::getActsTrack(p);
457 if (!actsTrk) {
458 THROW_EXCEPTION("Cannot find the associated ms track from the primary track");
459 }
460 auto refPars = actsTrk->createParametersAtReference();
461 return isOnCaloExit(refPars) ? toDeg(MuonCombinedR4::localPolarAngle(refPars, logger()))
462 : refPars.get<Acts::eBoundLoc0>();
463 }));
464 msTracks->addVariable(std::make_unique<GenericPartDecorBranch<xAOD::TrackParticle, std::uint8_t>>(m_tree,
465 std::format("{:}_isOnCaloExit", msTracks->name()), [&] (const xAOD::TrackParticle& p){
466 auto actsTrk = ActsTrk::getActsTrack(p);
467 if (!actsTrk) {
468 THROW_EXCEPTION("Cannot find the associated ms track from the primary track");
469 }
470 return isOnCaloExit(actsTrk->referenceSurface());
471 }));
472 if (m_isMC) {
474 [](const xAOD::IParticle* trk) -> const xAOD::TruthParticle* {
476 }, "truth", "ActsMuon");
477 }
478
479 for (const auto& summary : trackSummaries) {
480 m_muonTrks->addVariable<uint8_t>(summary);
481 }
482 m_tree.addBranch(m_muonTrks);
483
484 m_tree.addBranch(m_seedSummary);
485
486 ATH_CHECK(m_trkTruthLinks.initialize());
487 ATH_CHECK(m_tree.init(this));
488 return StatusCode::SUCCESS;
489 }
Scalar phi() const
phi method
double length(const pvec &v)
static Double_t a
std::unique_ptr< const Acts::Logger > makeActsAthenaLogger(IMessageSvc *svc, const std::string &name, int level, std::optional< std::string > parent_name)
Definition Logger.cxx:64
#define min(a, b)
Definition cfImp.cxx:40
#define max(a, b)
Definition cfImp.cxx:41
const ServiceHandle< StoreGateSvc > & detStore() const
std::unique_ptr< const Acts::Logger > m_logger
Instance to the Acts logger.
Gaudi::Property< bool > m_storeID
Toggle whether to process ID tracks or not.
SG::ReadDecorHandleKeyArray< SG::AuxVectorBase > m_trkTruthLinks
Decoration dependency to the MS truth track links.
ToolHandle< MuonR4::ISegmentSelectionTool > m_segSelector
Selection tool to quantify the segment candidate quality.
const Acts::Logger & logger() const
Return the reference to the Acts logger.
std::optional< MuonR4::MsTrackSeed > makeSeedFromTruth(const Acts::GeometryContext &tgContext, const xAOD::TruthParticle &truthMuon) const
Construct MS track seed from the truth associated segments.
static bool connectCollections(ParticleBranch_ptr primColl, ParticleBranch_ptr secondColl, Linker_t fromPrimToSec, const std::string &altPrimName="", const std::string &altSecName="")
@ isMC
Flag determining whether the branch is simulation.
T * get(TKey *tobj)
get a TObject* from a TKey* (why can't a TObject be a TKey?)
Definition hcg.cxx:132
std::optional< ActsTrk::TrackContainer::ConstTrackProxy > getActsTrack(const xAOD::TrackParticle &trkPart)
Return the proxy to the Acts track from which the track particle was made frome.
Definition Decoration.cxx:9
for(size_t i=0;i< m_blockFillers.size();i++)
Fill one block.
double localPolarAngle(const Acts::BoundTrackParameters &pars, const Acts::Logger &logger)
Returns the local angular polar angle of the track parameter.
double longitudinalParam(const Acts::BoundTrackParameters &pars, const Acts::Logger &logger)
Returns the longitudinal local track parameter which is defined as.
std::vector< const xAOD::MuonSimHit * > getMatchingSimHits(const xAOD::MuonSegment &segment)
: Returns all sim hits matched to a xAOD::MuonSegment
AuxElement(SG::AuxVectorData *container, size_t index)
Base class for elements of a container that can have aux data.
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
const xAOD::TruthParticle * getTruthParticle(const xAOD::IParticle &p)
Return the truthParticle associated to the given IParticle (if any).
MuonSimHit_v1 MuonSimHit
Defined the version of the MuonSimHit.
Definition MuonSimHit.h:12
setWord1 uint16_t
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ isClonable()

virtual bool AthCommonAlgorithm< Gaudi::Algorithm >::isClonable ( ) const
inlineoverridevirtualinherited

Specify if the algorithm is clonable.

Only relevant for non-reentrant algorithms. Actual number of clones needs to be set via the "Cardinality" property.

Reimplemented in AFP_DigiTop, AlgB, AlgT, BCM_Digitization, CscDigitBuilder, CscDigitToCscRDO, G4AtlasAlg, G4RunAlg, HGTD_Digitization, HiveAlgBase, InDet::GNNSeedingTrackMaker, InDet::SCT_Clusterization, InDet::SiSPGNNTrackMaker, InDet::SiSPSeededTrackFinder, InDet::SiTrackerSpacePointFinder, ISF::SimKernelMT, ITk::StripDigitization, ITkPixelCablingAlg, ITkStripCablingAlg, LArHitEMapMaker, LArTTL1Maker, LUCID_DigiTop, LVL1::L1TopoSimulation, MergeCalibHits, MergeGenericMuonSimHitColl, MergeHijingPars, MergeMcEventCollection, MergeTrackRecordCollection, MergeTruthJets, MergeTruthParticles, MuonDigitizer, PileUpMTAlg, PixelDigitization, RoIBResultToxAOD, SCT_ByteStreamErrorsTestAlg, SCT_CablingCondAlgFromCoraCool, SCT_CablingCondAlgFromText, SCT_ConditionsParameterTestAlg, SCT_ConditionsSummaryTestAlg, SCT_ConfigurationConditionsTestAlg, SCT_Digitization, SCT_FlaggedConditionTestAlg, SCT_LinkMaskingTestAlg, SCT_MajorityConditionsTestAlg, SCT_ModuleVetoTestAlg, SCT_MonitorConditionsTestAlg, SCT_PrepDataToxAOD, SCT_RawDataToxAOD, SCT_ReadCalibChipDataTestAlg, SCT_ReadCalibDataTestAlg, SCT_RODVetoTestAlg, SCT_SensorsTestAlg, SCT_SiliconConditionsTestAlg, SCT_StripVetoTestAlg, SCT_TdaqEnabledTestAlg, SCT_TestCablingAlg, SCTEventFlagWriter, SCTRawDataProvider, SCTSiLorentzAngleTestAlg, SCTSiPropertiesTestAlg, SGInputLoader, Simulation::BeamEffectsAlg, TileHitVecToCnt, TileMuonFitter, TilePulseForTileMuonReceiver, TileRawChannelMaker, TRTDigitization, and ZDC_DigiTop.

Definition at line 68 of file AthCommonAlgorithm.h.

68 {
69 return true;
70 }

◆ isReEntrant()

virtual bool AthAlgorithm::isReEntrant ( ) const
inlinefinaloverrideprotectedvirtualinherited

Legacy algorithms are not thread-safe.

Definition at line 47 of file AthAlgorithm.h.

47{ return false; }

◆ logger()

const Acts::Logger & MuonValR4::MsTrackTester::logger ( ) const
inlineprivate

Return the reference to the Acts logger.

Definition at line 194 of file MsTrackTester.h.

194{ return *m_logger; }

◆ makeSeedFromTruth()

std::optional< MsTrackSeed > MuonValR4::MsTrackTester::makeSeedFromTruth ( const Acts::GeometryContext & tgContext,
const xAOD::TruthParticle & truthMuon ) const
private

Construct MS track seed from the truth associated segments.

A nullopt is returned if either no segment is matched to the particle or no valid seed could be constructed

Parameters
gctxThe geometry context to align the segment within ATLAS
truthMuonReference to the truth muon for which a seed should be constructed

Construct the 2 candidate seeds

Definition at line 72 of file MsTrackTester.cxx.

73 {
74 std::vector<const xAOD::MuonSegment*> matchedSegs = MuonR4::getTruthSegments(truthMuon);
75 if (matchedSegs.empty() || toLayerIndex(matchedSegs.front()->chamberIndex()) == toLayerIndex(matchedSegs.back()->chamberIndex())) {
76 return std::nullopt;
77 }
78 ExpandedSector sector{matchedSegs[0]->position().phi()};
80 MsTrackSeed barrelSeed{Location::Barrel, sector};
81 MsTrackSeed endcapSeed{Location::Endcap, sector};
82 for (const xAOD::MuonSegment* seg : matchedSegs) {
83 barrelSeed.addSegment(seg);
84 endcapSeed.addSegment(seg);
85 }
86 barrelSeed.setPosition(matchedSegs[0]->position());
87 endcapSeed.setPosition(matchedSegs[0]->position());
88 const auto [barrelLength, barrelTheta] = calcSeedLength(tgContext, barrelSeed);
89 const auto [endcapLength, endcapTheta] = calcSeedLength(tgContext, endcapSeed);
90 ATH_MSG_VERBOSE(__func__<<"() "<<__LINE__<<" - Constructed new seed from truth muon wih pT:"
91 <<(truthMuon.pt()/ Gaudi::Units::GeV)<<" [GeV], eta: "<<truthMuon.eta()
92 <<", phi: "<<toDeg(truthMuon.phi())<<", q: "<<truthMuon.charge()
93 <<", matchedSeg: "<<matchedSegs.size()<< " barrel (L/theta): "<<barrelLength
94 <<"/"<<barrelTheta<<" - endcap (L/theta): "
95 <<endcapLength<<"/"<<endcapTheta<<"\n"<<barrelSeed);
96 if (barrelLength < 0 && endcapLength < 0) {
97 ATH_MSG_WARNING(__func__<<"() "<<__LINE__<<" - Invalid seed");
98 return std::nullopt;
99 }
100 return barrelLength < 0 || std::abs(endcapLength) < barrelLength
101 ? endcapSeed : barrelSeed;
102 }
#define ATH_MSG_WARNING(x,...)
void addSegment(const xAOD::MuonSegment *seg)
Append a segment to the seed.
void setPosition(Amg::Vector3D &&pos)
set the seed's position
LayerIndex toLayerIndex(ChIndex index)
convert ChIndex into LayerIndex
const Amg::Vector3D & position() const
Method to retrieve the position of the Intersection.

◆ msg()

MsgStream & AthCommonMsg< Gaudi::Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24 {
25 return this->msgStream();
26 }

◆ msgLvl()

bool AthCommonMsg< Gaudi::Algorithm >::msgLvl ( const MSG::Level lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30 {
31 return this->msgLevel(lvl);
32 }

◆ outputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounce ( T & h)
inlineprotectedinherited

Definition at line 368 of file AthCommonDataStore.h.

369 {
370 h.renounce();
372 }
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 352 of file AthCommonDataStore.h.

352 {
354 }

◆ setFilterPassed()

virtual void AthCommonAlgorithm< Gaudi::Algorithm >::setFilterPassed ( bool state,
const EventContext & ctx ) const
inlinevirtualinherited

Set filter decision:

Definition at line 99 of file AthCommonAlgorithm.h.

99 {
101 }
virtual void setFilterPassed(bool state, const EventContext &ctx) const
Set filter decision:

◆ sysExecute()

StatusCode AthCommonAlgorithm< Gaudi::Algorithm >::sysExecute ( const EventContext & ctx)
overridevirtualinherited

Execute an algorithm.

We override this in order to work around an issue with the Algorithm base class storing the event context in a member variable that can cause crashes in MT jobs.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 80 of file AthCommonAlgorithm.cxx.

41{
42 return BaseAlg::sysExecute (ctx);
43}

◆ sysInitialize()

StatusCode AthHistogramAlgorithm::sysInitialize ( )
virtualinherited

Initialization method invoked by the framework.

This method is responsible for any bookkeeping of initialization required by the framework itself. It will in turn invoke the initialize() method of the derived algorithm, and of any sub-algorithms which it creates.

Reimplemented from AthCommonAlgorithm< Gaudi::Algorithm >.

Reimplemented in AthAnalysisAlgorithm.

Definition at line 75 of file AthHistogramAlgorithm.cxx.

76{
77 // ---- stolen from GaudiKernel/Algorithm::sysInitialize -------
78 // Bypass the initialization if the algorithm
79 // has already been initialized.
80 if ( Gaudi::StateMachine::INITIALIZED <= FSMState() ) return StatusCode::SUCCESS;
81
82 // Set the Algorithm's properties
83 bindPropertiesTo( serviceLocator()->getOptsSvc() );
84
85 // Bypass the initialization if the algorithm is disabled.
86 // Need to do this after bindPropertiesTo.
87 if ( !isEnabled( ) ) return StatusCode::SUCCESS;
88
89 // ---- stolen from GaudiKernel/Algorithm::sysInitialize ------- END ---
90
91
92 // Get the THistSvc
93 ATH_CHECK ( histSvc().retrieve() );
94
95 // Configure the underlying AthHistogramming helper
100
101 // Print some setup information into the log file
102 ATH_MSG_DEBUG ("Initializing {}...", name());
103 ATH_MSG_DEBUG (" using THistService = " << m_histSvc );
104 ATH_MSG_DEBUG (" using RootStreamName = {}", m_prefix );
105 ATH_MSG_DEBUG (" using RootDirName = {}", m_rootDir );
106 ATH_MSG_DEBUG (" using HistNamePrefix = {}", m_histNamePrefix );
107 ATH_MSG_DEBUG (" using HistNamePostfix = {}", m_histNamePostfix );
108 ATH_MSG_DEBUG (" using HistTitlePrefix = {}", m_histTitlePrefix );
109 ATH_MSG_DEBUG (" using HistTitlePostfix = {}", m_histTitlePostfix );
110
111
112 // re-direct to base class...
114}
virtual StatusCode sysInitialize() override
const ServiceHandle< ITHistSvc > & histSvc() const
The standard THistSvc (for writing histograms and TTrees and more to a root file) Returns (kind of) a...
StatusCode configAthHistogramming(const ServiceHandle< ITHistSvc > &histSvc, const std::string &prefix, const std::string &rootDir, const std::string &histNamePrefix, const std::string &histNamePostfix, const std::string &histTitlePrefix, const std::string &histTitlePostfix)
To be called to fill the internal configuration.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ tree()

TTree * AthHistogramming::tree ( std::string_view treeName,
std::string_view tDir = "",
std::string_view stream = "" )
protectedinherited

Simplify the retrieval of registered TTrees.

Definition at line 333 of file AthHistogramming.cxx.

334{
335 // Build a 32 bit hash out of the name
336 const hash_t treeHash = this->hash(treeName);
337 // See if this entry exists in the map
338 TreeMap_t::const_iterator it = m_treeMap.find( treeHash );
339 if ( it == m_treeMap.end() ) // It doesn't exist!
340 { // Let's see into the THistSvc if somebody else has registered the TTree...
341 // Massage the final string to book things
342 std::string bookingString = buildBookingString( treeName, tDir, stream);
343
344 TTree* treePointer(NULL);
345 if ( !((histSvc()->getTree(bookingString, treePointer)).isSuccess()) )
346 {
347 m_msg << MSG::WARNING
348 << "Problem retrieving the TTree with name " << treeName
349 << " in " << m_name << "... it doesn't exist, neither in the cached map nor in the THistSvc!"
350 << " Will return an NULL pointer... you have to handle it correctly!" << endmsg;
351 return NULL;
352 }
353 // If we get to here, we actually found the TTree in the THistSvc.
354 // So let's add it to the local cache map and return its pointer
355 m_treeMap.insert( m_treeMap.end(), std::pair< const hash_t, TTree* >( treeHash, treePointer ) );
356 return treePointer;
357 }
358
359 // Return the pointer to the TTree that we got from the local cache map
360 return it->second;
361}
std::pair< StatusCode, TTree * > getTree(ITHistSvc &svc, const std::string &name)

◆ truthTreeParticle()

const xAOD::TruthParticle * MuonValR4::MsTrackTester::truthTreeParticle ( const xAOD::IParticle & part,
const EventContext & ctx ) const
private

Returns the matched truth particle that is dumped in the tree.

This method only works downstream the dumpTruthContent call

Parameters
partReference to the particle of interest

Definition at line 491 of file MsTrackTester.cxx.

492 {
494 if (!truthTrk || !m_truthTrks) {
495 return nullptr;
496 }
497 for (const xAOD::IParticle* thisPart : m_truthTrks->getCached(ctx)) {
498 if (thisPart == truthTrk || truthTrk == xAOD::TruthHelpers::getTruthParticle(*thisPart)) {
499 return dynamic_cast<const xAOD::TruthParticle*>(thisPart);
500 }
501 }
502 return nullptr;
503 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::updateVHKA ( Gaudi::Details::PropertyBase & )
inlineinherited

Definition at line 298 of file AthCommonDataStore.h.

298 {
299 for (auto &a : m_vhka) {
301 for (auto k : keys) {
302 k->setOwner(this);
303 }
304 }
305 }

Member Data Documentation

◆ m_ctxProvider

ActsTrk::ContextUtility MuonValR4::MsTrackTester::m_ctxProvider {this}
private

Context provider for geometry, magnetic field and calibration contexts.

Definition at line 155 of file MsTrackTester.h.

155{this};

◆ m_detMgr

const MuonGMR4::MuonDetectorManager* MuonValR4::MsTrackTester::m_detMgr {nullptr}
private

The detector manager to fetch the segment surfaces.

Definition at line 126 of file MsTrackTester.h.

126{nullptr};

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default).

Definition at line 381 of file AthCommonDataStore.h.

◆ m_effMap

EffMap_t AthHistogramming::m_effMap
privateinherited

The map of histogram names to their pointers.

Definition at line 202 of file AthHistogramming.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default).

Definition at line 378 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthCommonAlgorithm< Gaudi::Algorithm >::m_extendedExtraObjects
privateinherited

Extra output dependency collection, extended by AthAlgorithmDHUpdate to add symlinks.

Empty if no symlinks were found.

Definition at line 108 of file AthCommonAlgorithm.h.

◆ m_extrapolationTool

ToolHandle<ActsTrk::IExtrapolationTool> MuonValR4::MsTrackTester::m_extrapolationTool {this, "ExtrapolationTool" ,"" }
private

Track extrapolation tool.

Definition at line 165 of file MsTrackTester.h.

165{this, "ExtrapolationTool" ,"" };

◆ m_graphMap

GraphMap_t AthHistogramming::m_graphMap
privateinherited

The map of TGraph names to their pointers.

Definition at line 216 of file AthHistogramming.h.

◆ m_histMap

HistMap_t AthHistogramming::m_histMap
privateinherited

The map of histogram names to their pointers.

Definition at line 195 of file AthHistogramming.h.

◆ m_histNamePostfix

std::string AthHistogramAlgorithm::m_histNamePostfix
privateinherited

The postfix for the histogram THx name.

Definition at line 97 of file AthHistogramAlgorithm.h.

◆ m_histNamePrefix

std::string AthHistogramAlgorithm::m_histNamePrefix
privateinherited

The prefix for the histogram THx name.

Definition at line 94 of file AthHistogramAlgorithm.h.

◆ m_histSvc

ServiceHandle<ITHistSvc> AthHistogramAlgorithm::m_histSvc
privateinherited

Default constructor: AthHistogramAlgorithm();.

a handle on the Hist/TTree registration service

Definition at line 83 of file AthHistogramAlgorithm.h.

◆ m_histTitlePostfix

std::string AthHistogramAlgorithm::m_histTitlePostfix
privateinherited

The postfix for the histogram THx title.

Definition at line 103 of file AthHistogramAlgorithm.h.

◆ m_histTitlePrefix

std::string AthHistogramAlgorithm::m_histTitlePrefix
privateinherited

The prefix for the histogram THx title.

Definition at line 100 of file AthHistogramAlgorithm.h.

◆ m_idTagKey

MuonTagKey_t MuonValR4::MsTrackTester::m_idTagKey {this, "IdTagKey", "MuonInDetCandidates"}
private

The collection of all ID tracks that are selected for combined reconstruction.

Definition at line 171 of file MsTrackTester.h.

171{this, "IdTagKey", "MuonInDetCandidates"};

◆ m_idTrackKey

TrackKey_t MuonValR4::MsTrackTester::m_idTrackKey {this, "IdTrackKey", "InDetTrackParticles"}
private

The collection of ID tracks associated with the truth particle.

Definition at line 169 of file MsTrackTester.h.

169{this, "IdTrackKey", "InDetTrackParticles"};

◆ m_idTracks

ParticleBranchPtr_t MuonValR4::MsTrackTester::m_idTracks {}
private

Stored ID track information.

Definition at line 202 of file MsTrackTester.h.

202{};

◆ m_isMC

Gaudi::Property<bool> MuonValR4::MsTrackTester::m_isMC {this, "isMC", false}
private

Toggle whether the job runs on MC or not.

Definition at line 128 of file MsTrackTester.h.

128{this, "isMC", false};

◆ m_legacyMuonKey

MuonKey_t MuonValR4::MsTrackTester::m_legacyMuonKey {this,"LegacyMuonKey", "MuonsLegacy"}
private

Legacy muons.

Definition at line 189 of file MsTrackTester.h.

189{this,"LegacyMuonKey", "MuonsLegacy"};

◆ m_legacyRecoSegs

SegmentBranchPtr_t MuonValR4::MsTrackTester::m_legacyRecoSegs {}
private

Definition at line 208 of file MsTrackTester.h.

208{};

◆ m_legacySegmentKey

SegmentKey_t MuonValR4::MsTrackTester::m_legacySegmentKey {this, "LegacySegmentKey", "MuonSegments"}
private

Legacy segment container.

Definition at line 146 of file MsTrackTester.h.

146{this, "LegacySegmentKey", "MuonSegments"};

◆ m_legacySegToTrkLinks

MuonVal::VectorBranch<unsigned short>& MuonValR4::MsTrackTester::m_legacySegToTrkLinks {m_tree.newVector<unsigned short>("LegacyRecoSegments_trkLinks", -1)}
private

Link of the legacy track to the legacy segment.

Definition at line 239 of file MsTrackTester.h.

239{m_tree.newVector<unsigned short>("LegacyRecoSegments_trkLinks", -1)};

◆ m_legacyTrackKey

TrackKey_t MuonValR4::MsTrackTester::m_legacyTrackKey {this,"LegacyTrackKey", "MuonSpectrometerTrackParticles"}
private

Legacy track reconstruction chain.

Definition at line 167 of file MsTrackTester.h.

167{this,"LegacyTrackKey", "MuonSpectrometerTrackParticles"};

◆ m_legacyTrks

ParticleBranchPtr_t MuonValR4::MsTrackTester::m_legacyTrks {}
private

Output branches of the legacy MS tracks.

Definition at line 249 of file MsTrackTester.h.

249{};

◆ m_logger

std::unique_ptr<const Acts::Logger> MuonValR4::MsTrackTester::m_logger {}
private

Instance to the Acts logger.

Definition at line 192 of file MsTrackTester.h.

192{};

◆ m_msg

MsgStream AthHistogramming::m_msg
privateinherited

Cached Message Stream.

Definition at line 242 of file AthHistogramming.h.

◆ m_msTrkSeedKey

SG::ReadHandleKey<MuonR4::MsTrackSeedContainer> MuonValR4::MsTrackTester::m_msTrkSeedKey {this, "MsTrkSeedKey", "MsTrackSeeds"}
private

Temporary container write handle to push the seeds to store gate for later efficiency analysis.

Definition at line 152 of file MsTrackTester.h.

152{this, "MsTrkSeedKey", "MsTrackSeeds"};

◆ m_muonKey

MuonKey_t MuonValR4::MsTrackTester::m_muonKey {this, "MuonKey", "Muons"}
private

Dependency on the R4 muon container.

Definition at line 157 of file MsTrackTester.h.

157{this, "MuonKey", "Muons"};

◆ m_muonTrks

ParticleBranchPtr_t MuonValR4::MsTrackTester::m_muonTrks {}
private

Stored muon information from the Acts muon reco chain.

Definition at line 200 of file MsTrackTester.h.

200{};

◆ m_name

std::string AthHistogramming::m_name
privateinherited

Instance name.

Definition at line 239 of file AthHistogramming.h.

◆ m_nIdTags

MuonVal::ScalarBranch<std::uint16_t>& MuonValR4::MsTrackTester::m_nIdTags {m_tree.newScalar<std::uint16_t>("nIdTags", 0)}
private

The number of selected ID tracks in the event.

Definition at line 212 of file MsTrackTester.h.

212{m_tree.newScalar<std::uint16_t>("nIdTags", 0)};

◆ m_nIdTracks

MuonVal::ScalarBranch<std::uint16_t>& MuonValR4::MsTrackTester::m_nIdTracks {m_tree.newScalar<std::uint16_t>("nIdTracks", 0)}
private

The number of ID tracks in the event.

Definition at line 210 of file MsTrackTester.h.

210{m_tree.newScalar<std::uint16_t>("nIdTracks", 0)};

◆ m_prefix

std::string AthHistogramAlgorithm::m_prefix
privateinherited

Name of the ROOT output stream (file).

Definition at line 88 of file AthHistogramAlgorithm.h.

◆ m_recoSegmentKey

SegmentKey_t MuonValR4::MsTrackTester::m_recoSegmentKey {this, "SegmentKey", "MsSegments"}
private

Primary segment container.

Definition at line 144 of file MsTrackTester.h.

144{this, "SegmentKey", "MsSegments"};

◆ m_recoSegs

SegmentBranchPtr_t MuonValR4::MsTrackTester::m_recoSegs {}
private

Definition at line 207 of file MsTrackTester.h.

207{};

◆ m_rootDir

std::string AthHistogramAlgorithm::m_rootDir
privateinherited

Name of the ROOT directory.

Definition at line 91 of file AthHistogramAlgorithm.h.

◆ m_seedDir

MuonVal::UnitThreeVectorBranch MuonValR4::MsTrackTester::m_seedDir {m_tree, "TrkSeed_direction"}
private

Seed direction vector.

Definition at line 216 of file MsTrackTester.h.

216{m_tree, "TrkSeed_direction"};

◆ m_seedGood

MuonVal::VectorBranch<char>& MuonValR4::MsTrackTester::m_seedGood {m_tree.newVector<char>("TrkSeed_goodSeed")}
private

Does the seeding tool construct valid parameters from the seed.

Definition at line 226 of file MsTrackTester.h.

226{m_tree.newVector<char>("TrkSeed_goodSeed")};

◆ m_seedingTool

ToolHandle<MuonR4::ITrackSeedingDiagnosticsTool> MuonValR4::MsTrackTester::m_seedingTool {this, "SeedingTool", ""}
private

The track seeding tool to construct the seed candidates and to estimate the initial parameters.

Definition at line 161 of file MsTrackTester.h.

161{this, "SeedingTool", ""};

◆ m_seedLength

MuonVal::VectorBranch<float>& MuonValR4::MsTrackTester::m_seedLength {m_tree.newVector<float>("TrkSeed_length")}
private

Maximum separation between the segments on the reference plane.

Definition at line 222 of file MsTrackTester.h.

222{m_tree.newVector<float>("TrkSeed_length")};

◆ m_seedPos

MuonVal::ThreeVectorBranch MuonValR4::MsTrackTester::m_seedPos {m_tree, "TrkSeed_position"}
private

Simple seed information.

Definition at line 214 of file MsTrackTester.h.

214{m_tree, "TrkSeed_position"};

◆ m_seedQP

MuonVal::VectorBranch<float>& MuonValR4::MsTrackTester::m_seedQP {m_tree.newVector<float>("TrkSeed_qTimesP")}
private

Estimated momentum times charge from the track seed.

Definition at line 228 of file MsTrackTester.h.

228{m_tree.newVector<float>("TrkSeed_qTimesP")};

◆ m_seedRecoSegMatch

MuonVal::MatrixBranch<unsigned short>& MuonValR4::MsTrackTester::m_seedRecoSegMatch {m_tree.newMatrix<unsigned short>("TrkSeed_segmentLinks")}
private

Link of the track seed to the building segment.

Definition at line 234 of file MsTrackTester.h.

234{m_tree.newMatrix<unsigned short>("TrkSeed_segmentLinks")};

◆ m_seedSector

MuonVal::VectorBranch<int>& MuonValR4::MsTrackTester::m_seedSector {m_tree.newVector<int>("TrkSeed_sector")}
private

Sector of the seed, even center, odd overlap regions, for details see:

Definition at line 220 of file MsTrackTester.h.

220{m_tree.newVector<int>("TrkSeed_sector")};

◆ m_seedSummary

std::shared_ptr<TrackSummaryModule> MuonValR4::MsTrackTester::m_seedSummary {}
private

Hit summary on the track seed.

Definition at line 232 of file MsTrackTester.h.

232{};

◆ m_seedThetaCone

MuonVal::VectorBranch<float>& MuonValR4::MsTrackTester::m_seedThetaCone {m_tree.newVector<float>("TrkSeed_thetaCone")}
private

Maximum angular difference between the segments part of the seed.

Definition at line 224 of file MsTrackTester.h.

224{m_tree.newVector<float>("TrkSeed_thetaCone")};

◆ m_seedTruthLink

MuonVal::VectorBranch<unsigned short>& MuonValR4::MsTrackTester::m_seedTruthLink {m_tree.newVector<unsigned short>("TrkSeed_truthLink", -1)}
private

Link to the truth muon.

Definition at line 230 of file MsTrackTester.h.

230{m_tree.newVector<unsigned short>("TrkSeed_truthLink", -1)};

◆ m_seedType

MuonVal::VectorBranch<char>& MuonValR4::MsTrackTester::m_seedType {m_tree.newVector<char>("TrkSeed_type")}
private

Is the seed in the encap or in the barrel chambers.

Definition at line 218 of file MsTrackTester.h.

218{m_tree.newVector<char>("TrkSeed_type")};

◆ m_segSelector

ToolHandle<MuonR4::ISegmentSelectionTool> MuonValR4::MsTrackTester::m_segSelector {this, "SegmentSelectionTool" , "" }
private

Selection tool to quantify the segment candidate quality.

Definition at line 163 of file MsTrackTester.h.

163{this, "SegmentSelectionTool" , "" };

◆ m_segTagKey

MuonTagKey_t MuonValR4::MsTrackTester::m_segTagKey {this, "SegTagKey", "SegmentTags"}
private

The collection of the original segment tags.

Definition at line 173 of file MsTrackTester.h.

173{this, "SegTagKey", "SegmentTags"};

◆ m_storeID

Gaudi::Property<bool> MuonValR4::MsTrackTester::m_storeID {this, "storeIdTrks", true}
private

Toggle whether to process ID tracks or not.

Definition at line 130 of file MsTrackTester.h.

130{this, "storeIdTrks", true};

◆ m_streamName

std::string AthHistogramming::m_streamName
privateinherited

Name of the ROOT output stream (file).

Definition at line 220 of file AthHistogramming.h.

◆ m_summaryTool

ToolHandle<MuonR4::ITrackSummaryTool> MuonValR4::MsTrackTester::m_summaryTool {this, "SummaryTool" ,""}
private

Hit summary tool.

Definition at line 159 of file MsTrackTester.h.

159{this, "SummaryTool" ,""};

◆ m_tolerancePhi

Gaudi::Property<double> MuonValR4::MsTrackTester::m_tolerancePhi {this, "tolerancePhi", 2.*Gaudi::Units::deg}
private

Extra tolerance applied on the bending direction when calculating the matching score.

Definition at line 186 of file MsTrackTester.h.

186{this, "tolerancePhi", 2.*Gaudi::Units::deg};

◆ m_toleranceTheta

Gaudi::Property<double> MuonValR4::MsTrackTester::m_toleranceTheta {this, "toleranceTheta", 1.*Gaudi::Units::deg}
private

Extra tolerance applied on the bending direction when calculating the matching score.

Definition at line 183 of file MsTrackTester.h.

183{this, "toleranceTheta", 1.*Gaudi::Units::deg};

◆ m_toleranceX0

Gaudi::Property<double> MuonValR4::MsTrackTester::m_toleranceX0 {this, "toleranceX0", 20.*Gaudi::Units::cm}
private

Extra tolerance applied on the non-bending intercept when calculating the matching score.

Definition at line 177 of file MsTrackTester.h.

177{this, "toleranceX0", 20.*Gaudi::Units::cm};

◆ m_toleranceY0

Gaudi::Property<double> MuonValR4::MsTrackTester::m_toleranceY0 {this, "toleranceY0", 5.*Gaudi::Units::cm}
private

Extra tolerance applied on the bending intercept when calculating the matching score.

Definition at line 180 of file MsTrackTester.h.

180{this, "toleranceY0", 5.*Gaudi::Units::cm};

◆ m_tree

MuonVal::MuonTesterTree MuonValR4::MsTrackTester::m_tree {"MsTrackValidTest", "MuonTrackTester"}
private

The output tree object.

Definition at line 124 of file MsTrackTester.h.

124{"MsTrackValidTest", "MuonTrackTester"};

◆ m_treeMap

TreeMap_t AthHistogramming::m_treeMap
privateinherited

The map of TTree names to their pointers.

Definition at line 209 of file AthHistogramming.h.

◆ m_trkTruthLinks

SG::ReadDecorHandleKeyArray<SG::AuxVectorBase> MuonValR4::MsTrackTester::m_trkTruthLinks {this, "TruthTrackLinks", {}}
private

Decoration dependency to the MS truth track links.

Definition at line 150 of file MsTrackTester.h.

150{this, "TruthTrackLinks", {}};

◆ m_truthKey

SG::ReadHandleKey<xAOD::TruthParticleContainer> MuonValR4::MsTrackTester::m_truthKey {this, "TruthKey", "MuonTruthParticles"}
private

Key to the truth particle collection.

Definition at line 148 of file MsTrackTester.h.

148{this, "TruthKey", "MuonTruthParticles"};

◆ m_truthMuRecoSegLinks

MuonVal::MatrixBranch<unsigned short>& MuonValR4::MsTrackTester::m_truthMuRecoSegLinks {m_tree.newMatrix<unsigned short>("TruthMuons_recoSegLinks")}
private

Links from the truth muon to the segments.

Definition at line 246 of file MsTrackTester.h.

246{m_tree.newMatrix<unsigned short>("TruthMuons_recoSegLinks")};

◆ m_truthMuToSeedCounter

MuonVal::MatrixBranch<unsigned short>& MuonValR4::MsTrackTester::m_truthMuToSeedCounter {m_tree.newMatrix<unsigned short>("TruthMuons_seedNSeg")}
private

Number of matched segments in the seed.

Definition at line 244 of file MsTrackTester.h.

244{m_tree.newMatrix<unsigned short>("TruthMuons_seedNSeg")};

◆ m_truthMuToSeedIdx

MuonVal::MatrixBranch<unsigned short>& MuonValR4::MsTrackTester::m_truthMuToSeedIdx {m_tree.newMatrix<unsigned short>("TruthMuons_seedLinks", -1)}
private

Links to all MsTrkSeeds that could be matched to the truthMuon, i.e.

>= 1 segment

Definition at line 242 of file MsTrackTester.h.

242{m_tree.newMatrix<unsigned short>("TruthMuons_seedLinks", -1)};

◆ m_truthSegmentKey

SegmentKey_t MuonValR4::MsTrackTester::m_truthSegmentKey {this, "TruthSegmentKey", "MuonTruthSegments"}
private

Segment from the truth hits.

Definition at line 142 of file MsTrackTester.h.

142{this, "TruthSegmentKey", "MuonTruthSegments"};

◆ m_truthSegs

SegmentBranchPtr_t MuonValR4::MsTrackTester::m_truthSegs {}
private

Definition at line 206 of file MsTrackTester.h.

206{};

◆ m_truthSegToRecoLink

MuonVal::MatrixBranch<unsigned short>& MuonValR4::MsTrackTester::m_truthSegToRecoLink {m_tree.newMatrix<unsigned short>("TruthSegments_recoSegLinks",-1)}
private

Link of the truth segments to the matchin reco segments.

Definition at line 236 of file MsTrackTester.h.

236{m_tree.newMatrix<unsigned short>("TruthSegments_recoSegLinks",-1)};

◆ m_truthTrks

ParticleBranchPtr_t MuonValR4::MsTrackTester::m_truthTrks {}
private

Definition at line 198 of file MsTrackTester.h.

198{};

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 387 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Gaudi::Algorithm > >::m_vhka
privateinherited

Definition at line 386 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files: