|
ATLAS Offline Software
|
#include <CopyTruthJetParticles.h>
|
| CopyTruthJetParticles (const std::string &name) |
| Constructor. More...
|
|
virtual StatusCode | initialize () |
| Function initialising the tool. More...
|
|
virtual int | execute () const |
| redefine execute so we can call our own classify() with the barcode offset for the current event. More...
|
|
bool | classifyJetInput (const xAOD::TruthParticle *tp, std::vector< const xAOD::TruthParticle * > &promptLeptons, std::map< const xAOD::TruthParticle *, unsigned int > &tc_results) const |
| Redefine our own Classifier function(s) More...
|
|
int | setBarCodeFromMetaDataCheck () const |
|
bool | classify (const xAOD::TruthParticle *) const |
| The base classify() is not used. More...
|
|
virtual int | inputContainerNames (std::vector< std::string > &connames) |
| Method to return the list of input containers. More...
|
|
virtual int | outputContainerNames (std::vector< std::string > &connames) |
| Method to return the list of output containers. More...
|
|
virtual void | print () const =0 |
| Print the state of the tool. More...
|
|
virtual void | print () const |
| Print the state of the tool. More...
|
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
Definition at line 16 of file CopyTruthJetParticles.h.
◆ StoreGateSvc_t
◆ CopyTruthJetParticles()
CopyTruthJetParticles::CopyTruthJetParticles |
( |
const std::string & |
name | ) |
|
◆ classify()
◆ classifyJetInput()
Redefine our own Classifier function(s)
Definition at line 47 of file CopyTruthJetParticles.cxx.
54 int pdgid =
tp->pdgId();
84 if (!
m_includeSM && ((abs(
tp->pdgId()) < 4.9e6) || (abs(
tp->pdgId()) >= 5e6)))
return false;
86 if (abs(
tp->pdgId()) <= 4900101)
return false;
87 if (
tp->hasDecayVtx() && (abs(
tp->child()->pdgId()) >= 4.9e6))
return false;
90 if (!
m_includeDark && (std::abs(
tp->pdgId()) >= 4.9e6) && (std::abs(
tp->pdgId()) < 5e6))
return false;
111 std::vector<int> used_vertices;
113 used_vertices.clear();
114 if (
comesFrom(
tp,anID,used_vertices))
return false;
◆ comesFrom()
Definition at line 248 of file CopyTruthJetParticles.cxx.
250 if (!
tp)
return false;
252 if (!
tp->prodVtx() ||
tp->nParents()==0)
return false;
260 if (!
tp->parent(
par))
continue;
262 if (
tp->parent(
par)->absPdgId()==pdgID)
return true;
264 if (
comesFrom(
tp->parent(
par), pdgID, used_vertices))
return true;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
int CopyTruthJetParticles::execute |
( |
| ) |
const |
|
virtual |
redefine execute so we can call our own classify() with the barcode offset for the current event.
Reimplemented from CopyTruthParticles.
Definition at line 157 of file CopyTruthJetParticles.cxx.
178 static std::once_flag metaDataFlag;
181 std::vector<const xAOD::TruthParticle*> promptLeptons;
182 promptLeptons.reserve(10);
186 if ( !truthEvents.isValid() ) {
193 std::map<const xAOD::TruthParticle*,unsigned int> tc_results;
195 size_t numCopied = 0;
198 ATH_MSG_ERROR(
"Null pointer received for first truth event!");
209 int pdgid =
tp->pdgId();
210 if ((std::abs(pdgid)==11 || std::abs(pdgid)==13) &&
tp->hasProdVtx()){
213 promptLeptons.push_back(
tp);
225 ptruth->push_back(
tp);
236 if (!truthParticles_out.put(std::move(ptruth))) {
237 ATH_MSG_ERROR(
"Unable to write new TruthParticleContainer to event store: "
240 ATH_MSG_DEBUG(
"Created new TruthParticleContainer in event store: "
◆ extraDeps_update_handler()
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
◆ getKey()
Get the (hashed) key of an object that is in the event store.
This is a bit of a special one. StoreGateSvc
and xAOD::TEvent
both provide ways for getting the SG::sgkey_t
key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.
In order to allow tools to efficiently perform this operation, they can use this helper function.
- See also
- asg::AsgTool::getName
- Parameters
-
ptr | The bare pointer to the object that the event store should know about |
- Returns
- The hashed key of the object in the store. If not found, an invalid (zero) key.
Definition at line 119 of file AsgTool.cxx.
121 #ifdef XAOD_STANDALONE
127 return (
proxy ==
nullptr ? 0 :
proxy->sgkey() );
128 #endif // XAOD_STANDALONE
◆ getName()
const std::string & asg::AsgTool::getName |
( |
const void * |
ptr | ) |
const |
|
inherited |
Get the name of an object that is / should be in the event store.
This is a bit of a special one. StoreGateSvc
and xAOD::TEvent
both provide ways for getting the std::string
name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.
In order to allow tools to efficiently perform this operation, they can use this helper function.
- See also
- asg::AsgTool::getKey
- Parameters
-
ptr | The bare pointer to the object that the event store should know about |
- Returns
- The string name of the object in the store. If not found, an empty string.
Definition at line 106 of file AsgTool.cxx.
108 #ifdef XAOD_STANDALONE
114 static const std::string
dummy =
"";
116 #endif // XAOD_STANDALONE
◆ getProperty()
template<class T >
const T* asg::AsgTool::getProperty |
( |
const std::string & |
name | ) |
const |
|
inherited |
Get one of the tool's properties.
◆ getTCresult()
◆ initialize()
StatusCode CopyTruthJetParticles::initialize |
( |
| ) |
|
|
virtual |
◆ inputContainerNames()
int IJetExecuteTool::inputContainerNames |
( |
std::vector< std::string > & |
connames | ) |
|
|
virtualinherited |
Method to return the list of input containers.
The names of required input containers are appended to connames. Returns nonzero for error. Default returns 0 and adds no names.
Reimplemented in JetRecTool.
Definition at line 11 of file IJetExecuteTool.cxx.
◆ inputHandles()
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.
◆ msg() [1/2]
◆ msg() [2/2]
◆ msg_level_name()
const std::string & asg::AsgTool::msg_level_name |
( |
| ) |
const |
|
inherited |
A deprecated function for getting the message level's name.
Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:
MSG::name( msg().level() )
This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.
- Returns
- The string name of the current minimum message level that's printed
Definition at line 101 of file AsgTool.cxx.
◆ msgLvl()
◆ outputContainerNames()
int IJetExecuteTool::outputContainerNames |
( |
std::vector< std::string > & |
connames | ) |
|
|
virtualinherited |
Method to return the list of output containers.
The names of produced output containers are appended to connames. Returns nonzero for error. Default returns 0 and adds no names.
Reimplemented in JetRecTool.
Definition at line 17 of file IJetExecuteTool.cxx.
◆ outputHandles()
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.
◆ print() [1/2]
void asg::AsgTool::print |
( |
| ) |
const |
|
virtualinherited |
Print the state of the tool.
Implements asg::IAsgTool.
Reimplemented in JetRecTool, JetFinder, JetModifiedMassDrop, JetFromPseudojet, JetReclusterer, JetReclusteringTool, JetTruthLabelingTool, JetPileupLabelingTool, HI::HIPileupTool, JetDumper, JetBottomUpSoftDrop, JetRecursiveSoftDrop, JetSoftDrop, JetConstituentsRetriever, JetSubStructureMomentToolsBase, JetSplitter, JetToolRunner, JetPruner, JetPseudojetRetriever, JetTrimmer, AsgHelloTool, and KtDeltaRTool.
Definition at line 131 of file AsgTool.cxx.
◆ print() [2/2]
virtual void asg::IAsgTool::print |
( |
| ) |
const |
|
pure virtualinherited |
Print the state of the tool.
Implemented in JetRecTool, JetFinder, JetModifiedMassDrop, JetFromPseudojet, JetReclusterer, JetReclusteringTool, JetTruthLabelingTool, JetPileupLabelingTool, HI::HIPileupTool, asg::AsgTool, JetDumper, JetBottomUpSoftDrop, JetRecursiveSoftDrop, JetSoftDrop, JetConstituentsRetriever, JetSubStructureMomentToolsBase, JetSplitter, JetToolRunner, JetPruner, JetPseudojetRetriever, JetTrimmer, AsgHelloTool, and KtDeltaRTool.
◆ renounce()
◆ renounceArray()
◆ setBarCodeFromMetaDataCheck()
int CopyTruthJetParticles::setBarCodeFromMetaDataCheck |
( |
| ) |
const |
Definition at line 133 of file CopyTruthJetParticles.cxx.
136 #ifndef XAOD_STANDALONE
140 int barcodeOffset_tmp(0);
141 ATH_MSG_INFO(
"Look for barcode offset in metadata ... ");
146 ATH_MSG_DEBUG(
" Could not retrieve barcode offset in metadata : "<<
e.what());
151 #else // standalone :
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_chargedOnly
Gaudi::Property<bool> CopyTruthJetParticles::m_chargedOnly |
|
private |
Initial value:{this, "ChargedParticlesOnly", false,
"Include only charged particles in the output collection" }
Definition at line 54 of file CopyTruthJetParticles.h.
◆ m_classif
ToolHandle<IMCTruthClassifier> CopyTruthJetParticles::m_classif {this, "MCTruthClassifier", ""} |
|
private |
◆ m_detStore
◆ m_dressingName
Gaudi::Property<std::string> CopyTruthJetParticles::m_dressingName |
|
private |
Initial value:{this, "DressingDecorationName", "",
"Name of the dressed photon decoration (if one should be used)"}
Name of the decoration to be used for identifying FSR (dressing) photons.
Definition at line 73 of file CopyTruthJetParticles.h.
◆ m_evtStore
◆ m_includeBSMNonInt
Gaudi::Property<bool> CopyTruthJetParticles::m_includeBSMNonInt |
|
private |
Initial value:{this, "IncludeBSMNonInteracting", false,
"Include noninteracting BSM particles (excluding neutrinos) in the output collection"}
Definition at line 44 of file CopyTruthJetParticles.h.
◆ m_includeDark
Gaudi::Property<bool> CopyTruthJetParticles::m_includeDark |
|
private |
Initial value:{this, "IncludeDarkHads", false,
"Include dark hadrons in the output collection"}
Definition at line 59 of file CopyTruthJetParticles.h.
◆ m_includeMu
Gaudi::Property<bool> CopyTruthJetParticles::m_includeMu |
|
private |
Initial value:{this, "IncludeMuons", false,
"Include muons in the output collection"}
Definition at line 48 of file CopyTruthJetParticles.h.
◆ m_includeNu
Gaudi::Property<bool> CopyTruthJetParticles::m_includeNu |
|
private |
Initial value:{this,"IncludeNeutrinos", false,
"Include neutrinos in the output collection"}
Definition at line 46 of file CopyTruthJetParticles.h.
◆ m_includePromptLeptons
Gaudi::Property<bool> CopyTruthJetParticles::m_includePromptLeptons |
|
private |
Initial value:{this, "IncludePromptLeptons", true,
"Include leptons from prompt decays (i.e. not from hadron decays) in the output collection"}
Definition at line 50 of file CopyTruthJetParticles.h.
◆ m_includePromptPhotons
Gaudi::Property<bool> CopyTruthJetParticles::m_includePromptPhotons |
|
private |
Initial value:{this, "IncludePromptPhotons", true,
"Include photons from Higgs and other decays that produce isolated photons"}
Definition at line 52 of file CopyTruthJetParticles.h.
◆ m_includeSM
Gaudi::Property<bool> CopyTruthJetParticles::m_includeSM |
|
private |
Initial value:{this, "IncludeSMParts", true,
"Include SM particles in the output collection"}
Definition at line 57 of file CopyTruthJetParticles.h.
◆ m_maxAbsEta
Gaudi::Property<float> CopyTruthJetParticles::m_maxAbsEta {this, "MaxAbsEta" , 5.} |
|
private |
◆ m_outTruthPartKey
◆ m_ptmin
Gaudi::Property<float> CopyTruthParticles::m_ptmin {this, "PtMin", 0. , "Minimum pT of particles to be accepted for tagging (in MeV)"} |
|
protectedinherited |
◆ m_truthEventKey
◆ m_varHandleArraysDeclared
◆ m_vetoPDG_IDs
Gaudi::Property<std::vector<int> > CopyTruthJetParticles::m_vetoPDG_IDs |
|
private |
Initial value:{this, "VetoPDG_IDs", {},
"List of PDG IDs (python list) to veto. Will ignore these and all children of these."}
Definition at line 68 of file CopyTruthJetParticles.h.
◆ m_vhka
The documentation for this class was generated from the following files:
constexpr int SIM_BARCODE_THRESHOLD
Constant defining the barcode threshold for simulated particles, eg. can be used to separate generato...
std::string find(const std::string &s)
return a remapped string
Gaudi::Property< bool > m_includeSM
bool comesFrom(const xAOD::TruthParticle *tp, const int pdgID, std::vector< int > &used_vertices) const
Helper class to provide type-safe access to aux data.
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
const TruthParticle * truthParticle(size_t index) const
Get a pointer to one of the truth particles.
bool isNeutrino(const T &p)
APID: the fourth generation neutrinos are neutrinos.
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
Gaudi::Property< float > m_maxAbsEta
Maximum allowed eta for particles in jets.
std::tuple< unsigned int, T > defOrigOfParticle(T thePart)
Gaudi::Property< bool > m_includeDark
#define ATH_MSG_VERBOSE(x)
Gaudi::Property< bool > m_includeMu
virtual void setOwner(IDataHandleHolder *o)=0
CopyTruthParticles(const std::string &name)
Constructor.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
SG::WriteHandleKey< ConstDataVector< xAOD::TruthParticleContainer > > m_outTruthPartKey
Key for output truth particles.
bool is_simulation_particle(const T &p)
Method to establish if a particle (or barcode) was created during the simulation (TODO update to be s...
::StatusCode StatusCode
StatusCode definition for legacy code.
Class describing a truth particle in the MC record.
int setBarCodeFromMetaDataCheck() const
Class describing a signal truth event in the MC record.
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventKey
Key for input truth event.
Gaudi::Property< bool > m_includePromptLeptons
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Gaudi::Property< std::string > m_dressingName
Name of the decoration to be used for identifying FSR (dressing) photons.
Gaudi::Property< bool > m_includePromptPhotons
Gaudi::Property< bool > m_includeBSMNonInt
size_t nTruthParticles() const
Get the number of truth particles.
ToolHandle< IMCTruthClassifier > m_classif
Handle on MCTruthClassifier for finding prompt leptons.
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
bool classifyJetInput(const xAOD::TruthParticle *tp, std::vector< const xAOD::TruthParticle * > &promptLeptons, std::map< const xAOD::TruthParticle *, unsigned int > &tc_results) const
Redefine our own Classifier function(s)
int isPrompt(const unsigned int classify, bool allow_prompt_tau_decays=true)
#define ATH_MSG_WARNING(x)
DataVector adapter that acts like it holds const pointers.
Gaudi::Property< float > m_ptmin
Minimum pT for particle selection (in MeV)
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
Gaudi::Property< std::vector< int > > m_vetoPDG_IDs
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
bool isInteracting(const T &p)
Identify if the particle with given PDG ID would not interact with the detector, i....
unsigned int getTCresult(const xAOD::TruthParticle *tp, std::map< const xAOD::TruthParticle *, unsigned int > &tc_results) const
bool isZeroEnergyPhoton(const T &p)
Identify a photon with zero energy. Probably a workaround for a generator bug.
Gaudi::Property< bool > m_includeNu
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
static std::string retrieveMetadata(const std::string &folder, const std::string &key, const ServiceHandle< StoreGateSvc > &inputMetaStore)
method that always returns as a string you can use from, e.g, pyROOT with evt = ROOT....