 |
ATLAS Offline Software
|
Go to the documentation of this file.
47 return StatusCode::SUCCESS;
56 if (!inputCollection.
isValid()) {
57 ATH_MSG_ERROR(
"Could not get input truth collection " << inputCollection.
name() <<
" from store " << inputCollection.
store());
58 return StatusCode::FAILURE;
60 ATH_MSG_DEBUG(
"Found input truth collection " << inputCollection.
name() <<
" in store " << inputCollection.
store());
66 return StatusCode::FAILURE;
73 genPart->set_status(1);
78 genVertex->add_particle_out(genPart);
80 const HepMC::GenEvent* genEvt = *(inputCollection->
begin());
84 for (
const auto &oldbp : genEvt->beams()) {
89 evt->add_beam_particle(bp);
93 if (genEvt->cross_section()) {
94 auto cs = std::make_shared<HepMC3::GenCrossSection>(*genEvt->cross_section().get());
95 evt->set_cross_section(cs);
99 if (hScatVx !=
nullptr) {
100 HepMC::FourVector pmvxpos=hScatVx->position();
101 genVertex->set_position(pmvxpos);
104 if (hScatVx->particles_in().size()==2) {
105 double sum = hScatVx->particles_in().at(0)->momentum().e()+hScatVx->particles_in().at(1)->momentum().e();
106 genPart->set_momentum(HepMC::FourVector(
sum,0,0,
sum));
110 evt->set_beam_particles(genEvt->beam_particles());
111 if (genEvt->cross_section()) {
112 evt->set_cross_section(*genEvt->cross_section());
116 if (hScatVx !=
nullptr) {
117 HepMC::FourVector pmvxpos=hScatVx->position();
118 genVertex->set_position(pmvxpos);
120 HepMC::GenVertex::particles_in_const_iterator itrp =hScatVx->particles_in_const_begin();
121 if (hScatVx->particles_in_size()==2) {
122 HepMC::FourVector mom1=(*itrp)->momentum();
123 HepMC::FourVector mom2=(*(++itrp))->momentum();
124 double sum = mom1.e()+mom2.e();
125 genPart->set_momentum(HepMC::FourVector(
sum,0,0,
sum));
134 if (!inputCollectionH.
isValid()) {
135 ATH_MSG_ERROR(
"Could not get input hits collection " << inputCollectionH.
name() <<
" from store " << inputCollectionH.
store());
136 return StatusCode::FAILURE;
138 ATH_MSG_DEBUG(
"Found input hits collection " << inputCollectionH.
name() <<
" in store " << inputCollectionH.
store());
142 int pdgID = hit.GetParticleEncoding();
150 const HepMC::FourVector &position = vx->position();
152 newVertex->add_particle_out(newParticle);
153 evt->add_vertex(newVertex);
161 evt->add_vertex(genVertex);
170 return StatusCode::SUCCESS;
HepMC::GenVertex * GenVertexPtr
SG::ReadHandleKey< McEventCollection > m_inputTruthCollectionKey
bool suggest_barcode(T &p, int i)
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
const std::string & name() const
Return the StoreGate ID for the referenced object.
GenParticle * GenParticlePtr
McEventCollectionFilter(const std::string &name, ISvcLocator *pSvcLocator)
#define ATH_MSG_VERBOSE(x)
An algorithm that can be simultaneously executed in multiple threads.
HepMC::ConstGenParticlePtr cptr() const
Dereference.
a link optimized in size for a GenParticle in a McEventCollection
constexpr int SUPPRESSED_PILEUP_BARCODE(std::numeric_limits< int32_t >::max())
This barcode is used by objects matched to particles from pile-up interactions in standard MC Product...
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
SG::ReadHandleKey< TRTUncompressedHitCollection > m_inputTRTHitsKey
::StatusCode StatusCode
StatusCode definition for legacy code.
SG::WriteHandleKey< McEventCollection > m_outputTruthCollectionKey
std::string store() const
Return the name of the store holding the object we are proxying.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
constexpr int UNDEFINED_ID
const GenParticle * ConstGenParticlePtr
Gaudi::Property< int > m_pileUpParticlePDGID
virtual StatusCode initialize() override
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
GenVertex * barcode_to_vertex(const GenEvent *e, int id)
const HepMC::GenVertex * ConstGenVertexPtr
virtual StatusCode execute(const EventContext &ctx) const override
GenEvent * copyemptyGenEvent(const GenEvent *inEvt)
Gaudi::Property< bool > m_keepElectronsLinkedToTRTHits
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.