25#include "GaudiKernel/IPartPropSvc.h"
28#include "HepPDT/ParticleDataTable.hh"
32 class Interactions_pair {
37 : first(
p1), second(std::move(
p2)) {};
39 bool operator> (
const Interactions_pair& other)
const
40 {
return first <
other.first;}
42 bool operator< (
const Interactions_pair& other)
const
43 {
return first >
other.first;}
58 declareProperty(
"PartPropSvc",
m_partPropSvc,
"Handle to the particle property service" );
69 return StatusCode::SUCCESS;
77 std::vector<Amg::Vector3D> seeds =
findMultiSeeds (perigeeList, constraint);
89 std::vector<Amg::Vector3D> seeds =
findMultiSeeds (vectorTrk, constraint);
99 std::vector<Amg::Vector3D> seeds;
110 std::vector<Amg::Vector3D> seeds;
124 if ( !mcEventCollection.
isValid() ) {
127 return StatusCode::FAILURE;
130 interactions.clear();
131 std::vector<Interactions_pair> interactionsColl;
133 for ( ; itr != mcEventCollection->end(); ++itr ) {
134 const HepMC::GenEvent* myEvent=(*itr);
135 if(!
pass( myEvent, mcEventCollection.
cptr()))
continue;
140 for (
const auto& part: *myEvent) {
141 if(!
pass(part, mcEventCollection.
cptr()))
continue;
142 sum_pt2 += part->momentum().perp2();
149 auto Vert = myEvent->vertices().begin();
151 HepMC::GenEvent::vertex_const_iterator Vert = myEvent->vertices_begin();
153 msg(MSG::DEBUG) <<
"Retrieved position x: " << (*Vert)->position().x() <<
154 " y: " << (*Vert)->position().y() <<
155 " z: " << (*Vert)->position().z() <<
endmsg;
157 (*Vert)->position().y(),
158 (*Vert)->position().z());
161 interactionsColl.emplace_back(sum_pt2, vtxPosition );
165 std::sort(interactionsColl.begin(), interactionsColl.end());
166 std::vector<Interactions_pair>::iterator itIp = interactionsColl.begin();
168 for (; itIp < interactionsColl.end(); ++itIp) {
169 interactions.push_back(itIp->second);
170 ATH_MSG_DEBUG(
"(" << itIp->second.x() <<
", " << itIp->second.y() <<
", "
171 << itIp->second.z() <<
"), SumPt2 = " << itIp->first);
174 ATH_MSG_DEBUG(
"New interactions info stored successfully: " << interactions.size() <<
" interactions found.");
175 return StatusCode::SUCCESS;
185 bool isEmpty = ( evt->particles_size() == 0 );
186 bool isDummy = ( ( evt->event_number() == -1 ) &&
188 if( isDummy ) isEmpty =
false;
190 if( isEmpty )
return false;
191 if( isDummy )
return false;
194 if( ! coll )
return true;
205 for( ; iter != end; ++iter ) {
206 if( ( ( ( *iter )->event_number() == -1 ) &&
210 if( evt == *iter )
break;
214 if( gotzero == 2 )
return false;
215 if( gotzero == 3 )
return false;
216 if( gotzero == 4 )
return false;
225 if( !
pass( part->parent_event(), coll ) )
return false;
234 int pdg = part->pdg_id();
237 if( std::abs(pdg) < 7 || std::abs(pdg) == 21 )
return false;
239 const HepPDT::ParticleData* pd =
m_partPropSvc->PDT()->particle( std::abs( pdg ) );
245 float charge = pd->charge();
247 return std::abs(
charge ) >= 1E-5;
#define ATH_CHECK
Evaluate an expression and check for errors.
double charge(const T &p)
bool operator>(const DataVector< T > &a, const DataVector< T > &b)
Based on operator<.
bool operator<(const DataVector< T > &a, const DataVector< T > &b)
Vector ordering relation.
ATLAS-specific HepMC functions.
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
This defines the McEventCollection, which is really just an ObjectVector of McEvent objectsFile: Gene...
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
bool m_removeHardScattering
Flag to consider hard-scattering interaction.
MCTrueSeedFinder(const std::string &t, const std::string &n, const IInterface *p)
StatusCode retrieveInteractionsInfo(std::vector< Amg::Vector3D > &interactions) const
bool pass(const HepMC::GenEvent *evt, const McEventCollection *coll=0) const
Function selecting GenEvent objects.
virtual ~MCTrueSeedFinder()
virtual std::vector< Amg::Vector3D > findMultiSeeds(const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
Finds full vector of linearization points from a vector of tracks and returns it as an Amg::Vector3D ...
ServiceHandle< IPartPropSvc > m_partPropSvc
Get particle properties.
bool m_removeInTimePileUp
Flag to consider in-time pile-up interactions.
SG::ReadHandleKey< McEventCollection > m_mcEventCollectionKey
virtual StatusCode initialize() override
virtual Amg::Vector3D findSeed(const std::vector< const Trk::Track * > &vectorTrk, const xAOD::Vertex *constraint=0) const override final
Finds a linearization point out of a vector of tracks and returns it as an Amg::Vector3D object.
Eigen::Matrix< double, 3, 1 > Vector3D
int signal_process_id(const GenEvent &e)
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...
const GenParticle * ConstGenParticlePtr
bool isSimInteracting(const T &p)
Identify if the particle could interact with the detector during the simulation, e....
bool isGenStable(const T &p)
Determine if the particle is stable at the generator (not det-sim) level,.
Ensure that the ATLAS eigen extensions are properly loaded.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
Vertex_v1 Vertex
Define the latest version of the vertex class.