 |
ATLAS Offline Software
|
Go to the documentation of this file.
10 #include "GaudiKernel/MsgStream.h"
11 #include "GaudiKernel/DataSvc.h"
12 #include "GaudiKernel/PhysicalConstants.h"
26 :
AthAlgorithm(
name, svcLoc ), m_classifier(
"MCTruthClassifier/MCTruthClassifier")
40 ATH_MSG_DEBUG(
"xAOD input TruthParticleContainer name = " << m_xaodTruthParticleContainerName );
41 ATH_MSG_DEBUG(
"xAOD output TruthPileupParticleContainer name = " << m_xaodTruthPileupParticleContainerName );
43 return StatusCode::SUCCESS;
51 if ( evtStore()->contains< xAOD::TruthParticleContainer >(m_xaodTruthPileupParticleContainerName) &&
53 ATH_MSG_WARNING(
"xAOD Pileup Truth Particles are already available in the event");
54 return StatusCode::SUCCESS;
60 CHECK( evtStore()->record( xTruthPileupParticleContainer, m_xaodTruthPileupParticleContainerName ) );
62 CHECK( evtStore()->record( xTruthPileupParticleAuxContainer, m_xaodTruthPileupParticleContainerName +
"Aux." ) );
63 xTruthPileupParticleContainer->setStore( xTruthPileupParticleAuxContainer );
64 ATH_MSG_DEBUG(
"Recorded TruthPileupParticleContainer with key: " << m_xaodTruthPileupParticleContainerName );
68 if (evtStore()->
retrieve(xTruthParticleContainer, m_xaodTruthParticleContainerName).isFailure()) {
69 ATH_MSG_ERROR(
"No TruthParticle collection with name " << m_xaodTruthParticleContainerName <<
" found in StoreGate!");
70 return StatusCode::FAILURE;
90 float this_abseta = theParticle->abseta();
91 float this_pt = theParticle->pt();
95 && (this_abseta < m_abseta_selection) ){
98 xTruthPileupParticleContainer->
push_back( xTruthParticle );
101 *xTruthParticle=*theParticle;
103 unsigned int particleOutCome;
106 unsigned int particleOrigin;
110 originDecorator(*xTruthParticle) = particleOrigin;
111 outcomeDecorator(*xTruthParticle) = particleOutCome;
113 classificationDecorator(*xTruthParticle) =
result;
114 parenthadronPIDDecorator(*xTruthParticle) = hadron_pdg;
119 return StatusCode::SUCCESS;
def retrieve(aClass, aKey=None)
std::string m_xaodTruthPileupParticleContainerName
The key for the output xAOD truth containers.
virtual StatusCode execute()
Function executing the algorithm.
void classify(ToolHandle< IMCTruthClassifier > &m_classif, const xAOD::TruthParticle *theParticle, unsigned int &particleOutCome, unsigned int &result, int &hadron_pdg, unsigned int &particleType, unsigned int &particleOrigin)
bool m_forceRerun
a flag to force rerunning (useful for rerunning on ESDs)
double m_photon_pt_selection
Selection values for keeping photons and leptons.
Helper class to provide type-safe access to aux data.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
bool isElectron(const xAOD::Egamma *eg)
is the object an electron (not Fwd)
Class describing a truth particle in the MC record.
double m_abseta_selection
TruthParticle_v1 TruthParticle
Typedef to implementation.
#define CHECK(...)
Evaluate an expression and check for errors.
std::string m_xaodTruthParticleContainerName
PileupTruthParticleSlimmer(const std::string &name, ISvcLocator *svcLoc)
Regular algorithm constructor.
Auxiliary store for the truth particles.
Helpers for checking error return status codes and reporting errors.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
TruthParticleContainer_v1 TruthParticleContainer
Declare the latest version of the truth particle container.
TruthParticleAuxContainer_v2 TruthParticleAuxContainer
Declare the latest version of the truth particle auxiliary container.
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
double m_lepton_pt_selection
#define ATH_MSG_WARNING(x)
bool isPhoton(const xAOD::Egamma *eg)
is the object a photon
virtual StatusCode initialize()
Function initialising the algorithm.