|
ATLAS Offline Software
|
Go to the documentation of this file.
22 #ifndef XAOD_STANDALONE
42 return StatusCode::SUCCESS;
48 std::vector<const xAOD::TruthParticle*>& promptLeptons,
49 std::map<const xAOD::TruthParticle*,unsigned int>& tc_results)
const {
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;
124 std::map<const xAOD::TruthParticle*,unsigned int>& tc_results)
const
126 if(tc_results.find(
tp) == tc_results.end()) {
130 return tc_results[
tp];
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 :
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: "
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;
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
DataVector adapter that acts like it holds const pointers.
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.
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
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
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.
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventKey
Key for input truth event.
Gaudi::Property< bool > m_includePromptLeptons
Gaudi::Property< std::string > m_dressingName
Name of the decoration to be used for identifying FSR (dressing) photons.
virtual int execute() const
redefine execute so we can call our own classify() with the barcode offset for the current event.
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
virtual StatusCode initialize()
Function initialising the tool.
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
Define macros for attributes used to control the static checker.
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....
CopyTruthJetParticles(const std::string &name)
Constructor.