 |
ATLAS Offline Software
|
Go to the documentation of this file.
23 #ifndef XAOD_STANDALONE
44 return StatusCode::SUCCESS;
50 std::vector<const xAOD::TruthParticle*>& promptLeptons,
51 std::map<const xAOD::TruthParticle*,unsigned int>& tc_results)
const {
54 const EventContext& ctx = Gaudi::Hive::currentContext();
59 int pdgid =
tp->pdgId();
91 if (abs(
tp->pdgId()) <= 4900101)
return false;
92 if (
tp->hasDecayVtx()) {
93 size_t good_hadrons = 0;
94 for (
size_t p = 0;
p <
tp->end_vertex()->nOutgoingParticles(); ++
p) {
99 if (good_hadrons == 0)
return false;
115 bool foundDressDec{
false};
120 if (foundDressDec)
return false;
128 std::vector<int> used_vertices;
130 used_vertices.clear();
131 if (
comesFrom(
tp,anID,used_vertices))
return false;
141 std::map<const xAOD::TruthParticle*,unsigned int>& tc_results)
const
143 if(tc_results.find(
tp) == tc_results.end()) {
147 return tc_results[
tp];
153 #ifndef XAOD_STANDALONE
157 int barcodeOffset_tmp(0);
158 ATH_MSG_INFO(
"Look for barcode offset in metadata ... ");
163 ATH_MSG_DEBUG(
" Could not retrieve barcode offset in metadata : "<<
e.what());
168 #else // standalone :
195 static std::once_flag metaDataFlag;
198 std::vector<const xAOD::TruthParticle*> promptLeptons;
199 promptLeptons.reserve(10);
203 if ( !truthEvents.isValid() ) {
210 std::map<const xAOD::TruthParticle*,unsigned int> tc_results;
212 size_t numCopied = 0;
215 ATH_MSG_ERROR(
"Null pointer received for first truth event!");
229 promptLeptons.push_back(
tp);
241 ptruth->push_back(
tp);
252 if (!truthParticles_out.put(std::move(ptruth))) {
253 ATH_MSG_ERROR(
"Unable to write new TruthParticleContainer to event store: "
256 ATH_MSG_DEBUG(
"Created new TruthParticleContainer in event store: "
266 if (!
tp)
return false;
268 if (!
tp->prodVtx() ||
tp->nParents()==0)
return false;
276 if (!
tp->parent(
par))
continue;
278 if (
tp->parent(
par)->absPdgId()==pdgID)
return true;
280 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
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
bool isHiddenValley(const T &p)
PDG rule 11k Hidden Valley particles have n = 4 and n_r = 9, and trailing numbers in agreement with t...
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.
Handle class for reading a decoration on an object.
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.
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
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
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)
SG::ReadDecorHandleKeyArray< xAOD::TruthParticleContainer > m_dressingNames
Name of the decoration to be used for identifying FSR (dressing) photons.
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.