ATLAS Offline Software
Loading...
Searching...
No Matches
TruthParentDecoratorAlg.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4#ifndef TRUTH_PARENT_DECORATOR_ALG
5#define TRUTH_PARENT_DECORATOR_ALG
6
8
9// no need for forward declaration here, no one reads this header
13
14struct MatchedParent;
15
17{
18public:
19 CascadeCountDecorator(const std::string& name,
20 const std::vector<int>& pids);
21 void decorate(const SG::AuxElement& target,
22 const std::vector<MatchedParent>& parents) const;
23 void decorateDefault(const SG::AuxElement& target) const;
24 void lock(const xAOD::IParticleContainer* target) const;
25private:
26 std::vector<int> m_pids;
29};
30
32{
33public:
34 using Barcodex = std::map<int, std::set<int>>;
35 using IPMap = std::map<int, std::set<const xAOD::TruthParticle*>>;
40 TruthParentDecoratorAlg(const std::string& name, ISvcLocator* loc);
41 virtual StatusCode initialize () override;
42 virtual StatusCode execute (const EventContext&) const override;
43 virtual StatusCode finalize () override;
44private:
45 using cascade_counter_property_t = std::map<std::string,std::vector<int>>;
46 void addTruthContainer(Barcodex&, IPMap&, const TPC&) const;
48 this, "targetContainer", "", "target container to decorate"
49 };
50 Gaudi::Property<std::string> m_prefix{
51 this, "decoratorPrefix", "parentBoson", "prefix for decorations"
52 };
53 Gaudi::Property<std::vector<int>> m_parent_pdgids{
54 this, "parentPdgIds", {}, "PDGIDs of allowed parent particles"
55 };
56 Gaudi::Property<std::vector<int>> m_cascade_pdgids{
57 this, "cascadePdgIds", {}, "PDGIDs of particles in the decay chain"
58 };
59 Gaudi::Property<bool> m_add_b{
60 this, "addBsToCascade", false, "add all bhadrons to cascade"
61 };
62 Gaudi::Property<bool> m_add_c{
63 this, "addCsToCascade", false, "add all chadrons to cascade"
64 };
65 Gaudi::Property<bool> m_veto_soft_lepton{
66 this, "vetoSoftLeptonCascade", false,
67 "veto soft lepton decays from cascade"
68 };
69 Gaudi::Property<bool> m_veto_soft_charm{
70 this, "vetoSoftCharmCascade", false,
71 "veto soft charm decays from cascade"
72 };
73 Gaudi::Property<float> m_match_delta_r{
74 this, "matchDeltaR", -1,
75 "width of delta R cone for matching (zero or less -> infinite)"
76 };
78 this, "parents", "", "truth parent container"
79 };
81 this, "cascades", {}, "truth hadron container"
82 };
92
93 Gaudi::Property<cascade_counter_property_t> m_counts_matching_cascade {
94 this, "countChildrenInCascadeWithPdgIds", {},
95 "Create one counter for each entry, named by key. Counts children "
96 "with at least one overlapping value in the cascade."
97 };
99 std::vector<CascadeCountDecorator> m_cascade_count_decorators;
100
101 Gaudi::Property<std::unordered_set<int>> m_allow_missing_children_pdgids {
102 this, "allowMissingChildrenPdgIds", {},
103 "Allow particles matching these PDG IDs to have missing children"
104 };
106 this, "missingChildrenFractionWarningThreshold", 0.01,
107 "Turn the missing children info into a warning above this"
108 };
109 Gaudi::Property<std::unordered_set<int>> m_warn_missing_children_pdgids {
110 this, "warnMissingChildrenPdgIds", {},
111 "Warn if particles matching these PDF IDs have missing children"
112 };
113 mutable std::atomic<unsigned long long> m_missing_n_ignored;
114 mutable std::atomic<unsigned long long> m_missing_n_warned;
115 mutable std::atomic<unsigned long long> m_total_children;
116
117 // ATLASRECTS-8290: this is for backward compatability, remove eventually
118 Gaudi::Property<bool> m_use_barcode {
119 this, "useBarcode", false, "use barcode rather than UID"
120 };
122
123};
124
125#endif
An algorithm that can be simultaneously executed in multiple threads.
void decorate(const SG::AuxElement &target, const std::vector< MatchedParent > &parents) const
SG::AuxElement::Decorator< unsigned char > m_dec
CascadeCountDecorator(const std::string &name, const std::vector< int > &pids)
void decorateDefault(const SG::AuxElement &target) const
void lock(const xAOD::IParticleContainer *target) const
Base class for elements of a container that can have aux data.
Definition AuxElement.h:483
SG::Decorator< T, ALLOC > Decorator
Definition AuxElement.h:575
Helper class to provide constant type-safe access to aux data.
Property holding a SG store/key/clid from which a ReadHandle is made.
Property holding a SG store/key/clid/attr name from which a WriteDecorHandle is made.
SG::WriteDecorHandleKeyArray< JC > m_cascade_count_writer_keys
std::map< std::string, std::vector< int > > cascade_counter_property_t
void addTruthContainer(Barcodex &, IPMap &, const TPC &) const
Gaudi::Property< std::unordered_set< int > > m_allow_missing_children_pdgids
Gaudi::Property< bool > m_add_c
Gaudi::Property< bool > m_veto_soft_lepton
Gaudi::Property< bool > m_add_b
SG::WriteDecorHandleKey< JC > m_target_index_key
TruthParentDecoratorAlg(const std::string &name, ISvcLocator *loc)
std::vector< CascadeCountDecorator > m_cascade_count_decorators
SG::WriteDecorHandleKey< JC > m_target_n_matched_key
std::atomic< unsigned long long > m_total_children
Gaudi::Property< bool > m_use_barcode
SG::WriteDecorHandleKey< JC > m_match_children_key
Gaudi::Property< cascade_counter_property_t > m_counts_matching_cascade
SG::WriteDecorHandleKey< JC > m_target_pdgid_key
Gaudi::Property< std::vector< int > > m_cascade_pdgids
Gaudi::Property< std::string > m_prefix
std::map< int, std::set< const xAOD::TruthParticle * > > IPMap
Gaudi::Property< bool > m_veto_soft_charm
SG::ReadHandleKeyArray< TPC > m_cascades_key
SG::WriteDecorHandleKey< JC > m_match_link_key
virtual StatusCode initialize() override
Gaudi::Property< std::vector< int > > m_parent_pdgids
Gaudi::Property< float > m_missing_children_fraction_warning_threshold
SG::WriteDecorHandleKey< JC > m_target_match_mask_key
virtual StatusCode execute(const EventContext &) const override
std::map< int, std::set< int > > Barcodex
SG::WriteDecorHandleKey< JC > m_target_link_key
SG::WriteDecorHandleKey< JC > m_target_dr_truth_key
SG::ReadHandleKey< JC > m_target_container_key
SG::ConstAccessor< int > m_uid
std::atomic< unsigned long long > m_missing_n_warned
SG::WriteDecorHandleKey< JC > m_match_pdgid_key
xAOD::IParticleContainer JC
SG::ReadHandleKey< TPC > m_parents_key
virtual StatusCode finalize() override
Gaudi::Property< std::unordered_set< int > > m_warn_missing_children_pdgids
Gaudi::Property< float > m_match_delta_r
xAOD::TruthParticleContainer TPC
std::atomic< unsigned long long > m_missing_n_ignored
Class providing the definition of the 4-vector interface.
DecorHandleKeyArray< WriteDecorHandle< T, S >, WriteDecorHandleKey< T >, Gaudi::DataHandle::Writer > WriteDecorHandleKeyArray
HandleKeyArray< ReadHandle< T >, ReadHandleKey< T >, Gaudi::DataHandle::Reader > ReadHandleKeyArray
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.