|
ATLAS Offline Software
|
#include <EtaPtFilterTool.h>
|
| EtaPtFilterTool (const std::string &type, const std::string &name, const IInterface *parent) |
| Constructor with parameters: More...
|
|
virtual | ~EtaPtFilterTool () |
| Destructor: More...
|
|
StatusCode | buildMcAod (const McEventCollection *in, McEventCollection *out) |
| This method will check the validity of the input McEventCollection and build a filtered one from the strategy implemented by this concrete tool. More...
|
|
StatusCode | initialize () |
| Athena Algorithm's Hooks. More...
|
|
StatusCode | execute () |
|
StatusCode | finalize () |
|
ServiceHandle< StoreGateSvc > & | evtStore () |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | evtStore () const |
| The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
const ServiceHandle< StoreGateSvc > & | detStore () const |
| The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc . More...
|
|
virtual StatusCode | sysInitialize () override |
| Perform system initialization for an algorithm. More...
|
|
virtual StatusCode | sysStart () override |
| Handle START transition. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | inputHandles () const override |
| Return this algorithm's input handles. More...
|
|
virtual std::vector< Gaudi::DataHandle * > | outputHandles () const override |
| Return this algorithm's output handles. More...
|
|
Gaudi::Details::PropertyBase & | declareProperty (Gaudi::Property< T > &t) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &) |
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &) |
| Declare a new Gaudi property. More...
|
|
Gaudi::Details::PropertyBase * | declareProperty (const std::string &name, T &property, const std::string &doc="none") |
| Declare a new Gaudi property. More...
|
|
void | updateVHKA (Gaudi::Details::PropertyBase &) |
|
MsgStream & | msg () const |
|
MsgStream & | msg (const MSG::Level lvl) const |
|
bool | msgLvl (const MSG::Level lvl) const |
|
Definition at line 23 of file EtaPtFilterTool.h.
◆ IsolTool_t
◆ McVtxFilterTool_t
◆ ParticleMap_t
◆ StoreGateSvc_t
◆ VertexMap_t
◆ EtaPtFilterTool() [1/2]
EtaPtFilterTool::EtaPtFilterTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Constructor with parameters:
Constructors.
Definition at line 34 of file EtaPtFilterTool.cxx.
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");
◆ ~EtaPtFilterTool()
EtaPtFilterTool::~EtaPtFilterTool |
( |
| ) |
|
|
virtual |
◆ EtaPtFilterTool() [2/2]
EtaPtFilterTool::EtaPtFilterTool |
( |
| ) |
|
|
protected |
◆ addVertex()
Helper method to copy a given vertex and add it to a GenEvent.
Fill the parent branch
Fill the children branch
Definition at line 295 of file EtaPtFilterTool.cxx.
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() );
345 p->set_status( child->status() );
351 vtx->add_particle_out(
p );
357 vtx =
new HepMC::GenVertex();
358 vtx->set_position( srcVtx->position() );
359 vtx->set_id( srcVtx->id() );
360 vtx->suggest_barcode( srcVtx->barcode() );
361 vtx->weights() = srcVtx->weights();
362 evt->add_vertex(vtx);
363 if (isSignalVertex)
evt->set_signal_process_vertex(vtx);
368 for ( HepMC::GenVertex::particles_in_const_iterator
369 parent = srcVtx->particles_in_const_begin(),
370 parentEnd = srcVtx->particles_in_const_end();
376 p->set_momentum( (*parent)->momentum() );
377 p->set_generated_mass( (*parent)->generated_mass() );
378 p->set_pdg_id( (*parent)->pdg_id() );
379 p->set_status( (*parent)->status() );
380 p->set_flow( (*parent)->flow() );
381 p->set_polarization( (*parent)->polarization() );
382 p->suggest_barcode( (*parent)->barcode() );
385 vtx->add_particle_in(
p );
391 for ( HepMC::GenVertex::particles_out_const_iterator
392 child = srcVtx->particles_out_const_begin(),
393 childEnd = srcVtx->particles_out_const_end();
399 p->set_momentum( (*child)->momentum() );
400 p->set_generated_mass( (*child)->generated_mass() );
401 p->set_pdg_id( (*child)->pdg_id() );
402 p->set_status( (*child)->status() );
403 p->set_flow( (*child)->flow() );
404 p->set_polarization( (*child)->polarization() );
405 p->suggest_barcode( (*child)->barcode() );
409 vtx->add_particle_out(
p );
414 return StatusCode::SUCCESS;
◆ buildGenEvent()
StatusCode EtaPtFilterTool::buildGenEvent |
( |
const HepMC::GenEvent * |
in, |
|
|
HepMC::GenEvent * |
out |
|
) |
| |
|
protected |
This method will check the validity of the input HepMC::GenEvent and build a filtered one from the strategy implemented by this concrete tool.
Const methods:
Definition at line 155 of file EtaPtFilterTool.cxx.
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;
◆ buildMcAod()
This method will check the validity of the input McEventCollection and build a filtered one from the strategy implemented by this concrete tool.
Implements ITruthParticleFilterTool.
Definition at line 111 of file EtaPtFilterTool.cxx.
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;
◆ declareGaudiProperty() [1/4]
specialization for handling Gaudi::Property<SG::VarHandleKeyArray>
Definition at line 170 of file AthCommonDataStore.h.
175 hndl.documentation());
◆ declareGaudiProperty() [2/4]
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition at line 156 of file AthCommonDataStore.h.
161 hndl.documentation());
◆ declareGaudiProperty() [3/4]
specialization for handling Gaudi::Property<SG::VarHandleBase>
Definition at line 184 of file AthCommonDataStore.h.
189 hndl.documentation());
◆ declareGaudiProperty() [4/4]
◆ declareProperty() [1/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleBase
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 245 of file AthCommonDataStore.h.
250 this->declare(hndl.
vhKey());
251 hndl.
vhKey().setOwner(
this);
253 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [2/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
hndl | Object holding the property value. |
doc | Documentation string for the property. |
This is the version for types that derive from SG::VarHandleKey
. The property value object is put on the input and output lists as appropriate; then we forward to the base class.
Definition at line 221 of file AthCommonDataStore.h.
229 return PBASE::declareProperty(
name,hndl,
doc);
◆ declareProperty() [3/6]
◆ declareProperty() [4/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This is the generic version, for types that do not derive from SG::VarHandleKey
. It just forwards to the base class version of declareProperty
.
Definition at line 333 of file AthCommonDataStore.h.
338 return PBASE::declareProperty(
name, property,
doc);
◆ declareProperty() [5/6]
Declare a new Gaudi property.
- Parameters
-
name | Name of the property. |
property | Object holding the property value. |
doc | Documentation string for the property. |
This dispatches to either the generic declareProperty
or the one for VarHandle/Key/KeyArray.
Definition at line 352 of file AthCommonDataStore.h.
◆ declareProperty() [6/6]
◆ detStore()
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ execute()
StatusCode TruthParticleFilterBaseTool::execute |
( |
| ) |
|
|
virtualinherited |
Implements ITruthParticleFilterTool.
Definition at line 120 of file TruthParticleFilterBaseTool.cxx.
127 if (!mcEventsReadHandle.isValid()){
129 return StatusCode::FAILURE;
134 ATH_CHECK(mcEventsOutputWriteHandle.record(std::make_unique<McEventCollection>()));
136 if (!mcEventsOutputWriteHandle.isValid()){
137 ATH_MSG_ERROR(
"Invalid WriteHamdle for McEventCollection with key ["
139 return StatusCode::FAILURE;
147 return StatusCode::FAILURE;
151 if ( this->
buildMcAod( mcEventsReadHandle.ptr(), mcEventsOutputWriteHandle.ptr() ).isFailure() ) {
153 return StatusCode::FAILURE;
164 "isolation energies !");
167 return StatusCode::SUCCESS;
◆ extraDeps_update_handler()
Add StoreName to extra input/output deps as needed.
use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given
◆ finalize()
StatusCode TruthParticleFilterBaseTool::finalize |
( |
| ) |
|
|
virtualinherited |
◆ finalizeTool()
StatusCode TruthParticleFilterBaseTool::finalizeTool |
( |
| ) |
|
|
inlineprotectedvirtualinherited |
◆ initialize()
StatusCode TruthParticleFilterBaseTool::initialize |
( |
| ) |
|
|
virtualinherited |
◆ initializeTool()
StatusCode EtaPtFilterTool::initializeTool |
( |
| ) |
|
|
protectedvirtual |
Method to initialize the tool: we need to check the validity of the parameters given for the inner and outer eta regions.
Non-const methods:
Reimplemented from TruthParticleFilterBaseTool.
Definition at line 459 of file EtaPtFilterTool.cxx.
470 (
"Wrong size for eta regions cut :" <<
endmsg
475 <<
"You have to provide a list of cuts of the form : " <<
endmsg
476 <<
" |etaMin| |etaMax| ptMin");
477 return StatusCode::FAILURE;
481 (
"Inner Eta region cuts : nCuts = "
487 <<
"Outer Eta region cuts : nCuts = "
494 return StatusCode::SUCCESS;
◆ inputHandles()
Return this algorithm's input handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ interfaceID()
const InterfaceID & ITruthParticleFilterTool::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
◆ isAccepted() [1/2]
Check if a given particle is within the acceptance (pt+eta)
Definition at line 191 of file EtaPtFilterTool.cxx.
226 const HepMC::FourVector hlv =
mc->momentum();
227 const double pt = hlv.perp();
228 const double eta = hlv.pseudoRapidity();
◆ isAccepted() [2/2]
Check if a given vertex has at least one in-going or out-going particle within the acceptance (pt+eta)
Definition at line 244 of file EtaPtFilterTool.cxx.
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) {
◆ isFromHardScattering()
Definition at line 441 of file EtaPtFilterTool.cxx.
448 for (
auto p = vtx->particles_in_const_begin();
p!=vtx->particles_in_const_end();++
p )
if (
MC::isQuark(*
p) ||
MC::isGluon(*
p)) partonsin++;
450 for (
auto&
p: *vtx)
if (
p->pdg_id() == 91||
p->pdg_id() == 92||
p->pdg_id() == 94) showerout++;
452 return isPartonVertex(vtx) && (partonsin >= 2) && (showerout == 0);
◆ isPartonVertex()
Definition at line 417 of file EtaPtFilterTool.cxx.
419 if (!vtx)
return false;
421 for (
auto&
p: vtx->particles_in()) {
423 auto pv =
p->production_vertex();
426 for (
auto&
p: vtx->particles_out()) {
430 for (
auto p = vtx->particles_in_const_begin(), parentEnd = vtx->particles_in_const_end();
p != parentEnd; ++
p ) {
432 auto pv = (*p)->production_vertex();
435 for (
auto p = vtx->particles_out_const_begin(), parentEnd = vtx->particles_out_const_end();
p != parentEnd; ++
p ) {
◆ msg() [1/2]
◆ msg() [2/2]
◆ msgLvl()
◆ outputHandles()
Return this algorithm's output handles.
We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.
◆ renounce()
◆ renounceArray()
◆ setupInnerEtaRegionCuts()
void EtaPtFilterTool::setupInnerEtaRegionCuts |
( |
Gaudi::Details::PropertyBase & |
innerEtaRegionCuts | ) |
|
|
protected |
Callback function to setup the "InnerEtaRegionCuts" property.
Definition at line 497 of file EtaPtFilterTool.cxx.
◆ setupOuterEtaRegionCuts()
void EtaPtFilterTool::setupOuterEtaRegionCuts |
( |
Gaudi::Details::PropertyBase & |
outerEtaRegionCuts | ) |
|
|
protected |
Callback function to setup the "OuterEtaRegionCuts" property.
Definition at line 502 of file EtaPtFilterTool.cxx.
◆ sysInitialize()
◆ sysStart()
Handle START transition.
We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.
◆ updateVHKA()
◆ m_butKeepAllGeneratorStable
BooleanProperty EtaPtFilterTool::m_butKeepAllGeneratorStable |
|
protected |
Switch to keep all stable generator particles (IsGenStable) regardless what eta or pt cuts are defined.
Definition at line 136 of file EtaPtFilterTool.h.
◆ m_detStore
◆ m_doEtIsolation
BooleanProperty TruthParticleFilterBaseTool::m_doEtIsolation |
|
protectedinherited |
◆ m_evtStore
◆ m_innerEtaRegionCuts
DoubleArrayProperty EtaPtFilterTool::m_innerEtaRegionCuts |
|
protected |
vector of cuts parameters for the inner region delimited in |eta| 0-th element is the minimum |eta| of this region 1-st element is the maximum |eta| of this region 2-nd element is the minimum pt for the stable particles to be accepted
Definition at line 119 of file EtaPtFilterTool.h.
◆ m_isol_energies
std::map<int,double> EtaPtFilterTool::m_isol_energies |
|
protected |
◆ m_isolationTool
IsolTool_t TruthParticleFilterBaseTool::m_isolationTool |
|
protectedinherited |
◆ m_keepAllLeptons
BooleanProperty EtaPtFilterTool::m_keepAllLeptons |
|
protected |
Switch to keep all leptons - i.e.
do not apply kinematic cuts on them
Definition at line 145 of file EtaPtFilterTool.h.
◆ m_keepDocumentaries
BooleanProperty EtaPtFilterTool::m_keepDocumentaries |
|
protected |
Switch to keep all generator particles which are documentaries (statuscode == 3)
Definition at line 141 of file EtaPtFilterTool.h.
◆ m_mcEventsOutputWriteHandleKey
◆ m_mcEventsReadHandleKey
◆ m_mcVtxFilterTool
◆ m_onlyGenerator
BooleanProperty EtaPtFilterTool::m_onlyGenerator |
|
protected |
Switch to only include particles from generation and reject particles from detector simulation (Geant4)
Definition at line 131 of file EtaPtFilterTool.h.
◆ m_outerEtaRegionCuts
DoubleArrayProperty EtaPtFilterTool::m_outerEtaRegionCuts |
|
protected |
vector of cuts parameters for the outer region delimited in |eta| 0-th element is the minimum |eta| of this region 1-st element is the maximum |eta| of this region 2-nd element is the minimum pt for the stable particles to be accepted
Definition at line 126 of file EtaPtFilterTool.h.
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
HepMC::GenVertex * GenVertexPtr
bool suggest_barcode(T &p, int i)
BooleanProperty m_doEtIsolation
Switch to compute or not the Et-isolations for TruthParticle (and their underlying HepMC::GenParticle...
Polarization polarization(const T &a)
Scalar eta() const
pseudorapidity method
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
virtual StatusCode buildMcAod(const McEventCollection *in, McEventCollection *filtered)=0
This method will check the validity of the input McEventCollection and build a filtered one from the ...
GenParticle * GenParticlePtr
virtual StatusCode finalizeTool()
void set_polarization(T &a, const Polarization &b)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
#define ATH_MSG_VERBOSE(x)
const std::string & key() const
Return the StoreGate ID for the referenced object.
virtual StatusCode initializeTool()
I/O operators.
virtual void setOwner(IDataHandleHolder *o)=0
void copyBeamParticles(const HepMC::GenEvent &inEvt[[maybe_unused]], HepMC::GenEvent &outEvt[[maybe_unused]])
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
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)
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.
McVtxFilterTool_t m_mcVtxFilterTool
Pointer to the McVtxFilterTool to be able to select additional vertices on some decay pattern criteri...
IsolTool_t m_isolationTool
Pointer to the TruthIsolationTool to be able to compute transverse energy isolations for various isol...
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
TruthParticleFilterBaseTool()
Default constructor:
bool isHadron(const T &p)
bool isStable(const T &p)
Identify if the particle is stable, i.e. has not decayed.
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 isBeam(const T &p)
Identify if the particle is beam particle.
bool isLepton(const T &p)
APID: the fourth generation leptons are leptons.
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
GenEvent * copyemptyGenEvent(const GenEvent *inEvt)
size_type size() const noexcept
Returns the number of elements in the collection.
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
SG::WriteHandleKey< McEventCollection > m_mcEventsOutputWriteHandleKey
Location of the output McEventCollection which has been filtered.
GenVertex * signal_process_vertex(const GenEvent *e)