![Logo](../../ATLAS-Logo-Square-Blue-RGB.png) |
ATLAS Offline Software
|
Go to the documentation of this file.
18 #include "CLHEP/Units/SystemOfUnits.h"
35 const std::string&
name,
36 const IInterface*
parent ) :
46 "Vector of cuts parameters for the inner region.\n"
47 "Two first elements are minimum and maximum |eta| values "
48 "for this inner region.\n"
49 "Third element is the minimum pT for the stable particles "
52 std::vector<double> innerEtaRegionCuts;
53 innerEtaRegionCuts.push_back( 0.0 );
54 innerEtaRegionCuts.push_back( 3.5 );
55 innerEtaRegionCuts.push_back( 0.3*
GeV );
63 "Vector of cuts parameters for the outer region.\n"
64 "Two first elements are minimum and maximum |eta| values "
65 "for this outer region.\n"
66 "Third element is the minimum pT for the stable particles "
69 std::vector<double> outerEtaRegionCuts;
70 outerEtaRegionCuts.push_back( 3.5 );
71 outerEtaRegionCuts.push_back( 5.5 );
72 outerEtaRegionCuts.push_back( 1.0*
GeV );
81 "Switch to only include particles from generation and "
82 "reject particles from detector simulation (Geant4)" );
87 "Switch to keep all generated stable particles (they sum to "
88 "14 TeV) regardless of the eta and pt cuts defined for the "
89 "remaining particles" );
94 "Switch to keep *all* generator particles which are "
95 "documentaries (statuscode == 3)" );
99 "Switch to keep *all* leptons - i.e. do not apply kinematic cuts on them");
115 <<
" in: " << in <<
endmsg
117 return StatusCode::FAILURE;
120 for (
unsigned int iEvt = 0; iEvt != in->
size(); ++iEvt ) {
121 const HepMC::GenEvent * inEvt = (*in)[iEvt];
124 (
"Could not launch filtering procedure for GenEvent number ["
125 << iEvt <<
"] from McEventCollection ["
128 <<
" inEvt: " << inEvt);
144 out->push_back( outEvt );
147 return StatusCode::SUCCESS;
157 if (
nullptr == in ||
nullptr ==
out ) {
159 <<
" in: " << in <<
endmsg
161 return StatusCode::FAILURE;
169 for (
auto vtx: in->vertices() ) {
171 for ( HepMC::GenEvent::vertex_const_iterator vtxit = in->vertices_begin(); vtxit != in->vertices_end(); ++vtxit ) {
174 bool isSignalVertex = (vtx == spv);
181 if (
addVertex( vtx,
out, vmap, pmap, isSignalVertex ).isFailure() )
188 return StatusCode::SUCCESS;
226 const HepMC::FourVector hlv =
mc->momentum();
227 const double pt = hlv.perp();
228 const double eta = hlv.pseudoRapidity();
267 for (
const auto&
p: vtx->particles_in() ) {
274 for ( HepMC::GenVertex::particles_in_const_iterator
275 p = vtx->particles_in_const_begin(),
276 pEnd = vtx->particles_in_const_end();
286 for (
auto p : *vtx) {
298 bool isSignalVertex)
const
300 if ( 0 == srcVtx || 0 ==
evt ) {
302 return StatusCode::FAILURE;
308 evt->add_vertex(vtx);
309 vtx->set_position( srcVtx->position() );
310 vtx->set_status( srcVtx->status() );
312 vtx->add_attribute(
"weights",srcVtx->attribute<HepMC3::VectorDoubleAttribute> (
"weights"));
317 for (
auto parent: srcVtx->particles_in()) {
321 vtx->add_particle_in(
p );
322 p->set_momentum(
parent->momentum() );
323 p->set_generated_mass(
parent->generated_mass() );
324 p->set_pdg_id(
parent->pdg_id() );
325 p->set_status(
parent->status() );
331 vtx->add_particle_in(
p );
337 for (
auto child: srcVtx->particles_out()) {
341 vtx->add_particle_out(
p );
342 p->set_momentum( child->momentum() );
343 p->set_generated_mass( child->generated_mass() );
344 p->set_pdg_id( child->pdg_id() );
348 p->set_status( child->status() );
354 vtx->add_particle_out(
p );
360 vtx =
new HepMC::GenVertex();
361 vtx->set_position( srcVtx->position() );
362 vtx->set_id( srcVtx->id() );
363 vtx->suggest_barcode( srcVtx->barcode() );
364 vtx->weights() = srcVtx->weights();
365 evt->add_vertex(vtx);
366 if (isSignalVertex)
evt->set_signal_process_vertex(vtx);
371 for ( HepMC::GenVertex::particles_in_const_iterator
372 parent = srcVtx->particles_in_const_begin(),
373 parentEnd = srcVtx->particles_in_const_end();
379 p->set_momentum( (*parent)->momentum() );
380 p->set_generated_mass( (*parent)->generated_mass() );
381 p->set_pdg_id( (*parent)->pdg_id() );
382 p->set_status( (*parent)->status() );
383 p->set_flow( (*parent)->flow() );
384 p->set_polarization( (*parent)->polarization() );
385 p->suggest_barcode( (*parent)->barcode() );
388 vtx->add_particle_in(
p );
394 for ( HepMC::GenVertex::particles_out_const_iterator
395 child = srcVtx->particles_out_const_begin(),
396 childEnd = srcVtx->particles_out_const_end();
402 p->set_momentum( (*child)->momentum() );
403 p->set_generated_mass( (*child)->generated_mass() );
404 p->set_pdg_id( (*child)->pdg_id() );
408 p->set_status( (*child)->status() );
409 p->set_flow( (*child)->flow() );
410 p->set_polarization( (*child)->polarization() );
411 p->suggest_barcode( (*child)->barcode() );
415 vtx->add_particle_out(
p );
420 return StatusCode::SUCCESS;
425 if (!vtx)
return false;
427 for (
auto&
p: vtx->particles_in()) {
429 auto pv =
p->production_vertex();
432 for (
auto&
p: vtx->particles_out()) {
436 for (
auto p = vtx->particles_in_const_begin(), parentEnd = vtx->particles_in_const_end();
p != parentEnd; ++
p ) {
438 auto pv = (*p)->production_vertex();
441 for (
auto p = vtx->particles_out_const_begin(), parentEnd = vtx->particles_out_const_end();
p != parentEnd; ++
p ) {
454 for (
auto p = vtx->particles_in_const_begin();
p!=vtx->particles_in_const_end();++
p )
if (
MC::isQuark(*
p) ||
MC::isGluon(*
p)) partonsin++;
456 for (
auto&
p: *vtx)
if (
p->pdg_id() == 91||
p->pdg_id() == 92||
p->pdg_id() == 94) showerout++;
458 return isPartonVertex(vtx) && (partonsin >= 2) && (showerout == 0);
476 (
"Wrong size for eta regions cut :" <<
endmsg
481 <<
"You have to provide a list of cuts of the form : " <<
endmsg
482 <<
" |etaMin| |etaMax| ptMin");
483 return StatusCode::FAILURE;
487 (
"Inner Eta region cuts : nCuts = "
493 <<
"Outer Eta region cuts : nCuts = "
500 return StatusCode::SUCCESS;
HepMC::GenVertex * GenVertexPtr
bool suggest_barcode(T &p, int i)
Polarization polarization(const T &a)
Scalar eta() const
pseudorapidity method
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
GenParticle * GenParticlePtr
const std::string & key() const
Return the StoreGate ID for the referenced object.
void copyBeamParticles(const HepMC::GenEvent &inEvt[[maybe_unused]], HepMC::GenEvent &outEvt[[maybe_unused]])
bool isPhysical(const T &p)
bool isQuark(const T &p)
PDG rule 2: Quarks and leptons are numbered consecutively starting from 1 and 11 respectively; to dot...
void set_signal_process_vertex(GenEvent *e, T v)
constexpr int SPECIALSTATUS
Constant that the meaning of which is currently lost, to be recovered...
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...
int flow(const T &a, int i)
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
SG::ReadHandleKey< McEventCollection > m_mcEventsReadHandleKey
ReadHandleKey for the input McEventCollection one wants to filter.
::StatusCode StatusCode
StatusCode definition for legacy code.
McVtxFilterTool_t m_mcVtxFilterTool
Pointer to the McVtxFilterTool to be able to select additional vertices on some decay pattern criteri...
void set_polarization(T &a, Polarization b)
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
const GenParticle * ConstGenParticlePtr
bool isHadron(const T &p)
bool isStable(const T &p)
GenParticlePtr newGenParticlePtr(const HepMC::FourVector &mom=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), int pid=0, int status=0)
#define ATH_MSG_WARNING(x)
bool isDecayed(const T &p)
bool isLepton(const T &p)
APID: the fourth generation leptons are leptons.
const HepMC::GenVertex * ConstGenVertexPtr
GenEvent * copyemptyGenEvent(const GenEvent *inEvt)
size_type size() const noexcept
Returns the number of elements in the collection.
Helper to copy beam particle information.
GenVertex * signal_process_vertex(const GenEvent *e)