|
ATLAS Offline Software
|
#include <TruthIsolationTool.h>
|
| TruthIsolationTool (const std::string &type, const std::string &name, const IInterface *parent) |
|
virtual | ~TruthIsolationTool () |
|
StatusCode | initialize () |
|
const std::string & | etIsolationsName (const std::string &mcEvtName) const |
| Return the name of the TruthEtIsolations container (ie: its StoreGate location) given the StoreGate location of a McEventCollection . More...
|
|
StatusCode | buildEtIsolations (const std::string &mcEvtName, ITruthIsolationTool::ParticleSelect sel) |
| Computes the isolation energies for each of the HepMC::GenEvent contained into the McEventCollection . More...
|
|
StatusCode | registerAlias (const std::string &originalMcEvtColl, const std::string &aliasMcEvtColl) |
| Make an alias in the map of isolation energies. More...
|
|
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 |
|
|
StatusCode | buildEtIsolations (const std::string &mcEvtName, const HepMC::GenEvent *genEvt, const std::size_t genIdx, TruthEtIsolations &etIsols, ITruthIsolationTool::ParticleSelect sel) |
| Computes the isolation energies for a given HepMC::GenEvent contained into the McEventCollection . More...
|
|
void | computeIso (const std::list< HepMC::ConstGenParticlePtr > &parts, const HepMC::ConstGenParticlePtr &p, TruthEtIsolations &etIsolations, ITruthIsolationTool::ParticleSelect sel) |
| Computes and stores the list of transverse isolation energies for various cone sizes into the TruthEtIsolations container. More...
|
|
void | setupTruthEtIsolationsPrefix (Gaudi::Details::PropertyBase &truthEtIsolationsPrefix) |
| Callback method to ensure consistency of the TruthEtIsolations prefix key. More...
|
|
void | setupMcEventsOutput (Gaudi::Details::PropertyBase &mcEventsOutputName) |
| Callback method to ensure consistency of output McEventCollection key. More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKey> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &) |
| specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &) |
| specialization for handling Gaudi::Property<SG::VarHandleBase> More...
|
|
Gaudi::Details::PropertyBase & | declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &) |
| specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
|
|
◆ EtIsolMap_t
◆ StoreGateSvc_t
◆ ParticleSelect
enumerator to decide which strategy to apply in the selection of particles during the Et-isolation computation
Enumerator |
---|
UseChargedOnly | |
UseAll | |
Definition at line 43 of file ITruthIsolationTool.h.
◆ TruthIsolationTool()
TruthIsolationTool::TruthIsolationTool |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
Definition at line 41 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.
53 "Minimum transverse energy of gammas to be taken into "
54 "account into the isolation computation." );
58 "Prefix for the TruthEtIsolations container. This is the "
59 "string which will be prepended to the key of the "
60 "McEventCollection to build the (StoreGate) output "
61 "location for the TruthEtIsolations.\nie: \"GEN_EVENT\" "
62 "--> \"<prefix>_GEN_EVENT\"" );
69 "Name of the McEventCollection we should attach "
75 declareInterface<ITruthIsolationTool>(
this);
◆ ~TruthIsolationTool()
TruthIsolationTool::~TruthIsolationTool |
( |
| ) |
|
|
virtualdefault |
◆ buildEtIsolations() [1/2]
Computes the isolation energies for a given HepMC::GenEvent
contained into the McEventCollection
.
Definition at line 179 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.
185 if (
nullptr == genEvt ) {
187 <<
"Null pointer to GenEvent (idx = [" << genIdx <<
"] from "
188 <<
"McEventCollection [" << mcEvtName <<
"]) !!"
190 return StatusCode::RECOVERABLE;
195 for (
const auto&
i: *genEvt) {
201 for (
const auto&
i: *genEvt) {
202 const HepMC::FourVector hlv =
i->momentum();
203 const int ida = std::abs(
i->pdg_id());
204 const double pt = hlv.perp();
208 const bool doComputeIso = ( ( ida == 22 &&
pt >
m_ptGamMin ) ||
209 ida == 11 || ida == 13 || ida == 15 ) &&
211 if ( doComputeIso ) {
216 return StatusCode::SUCCESS;
◆ buildEtIsolations() [2/2]
Computes the isolation energies for each of the HepMC::GenEvent
contained into the McEventCollection
.
One can switch b/w using all particles or only the charged ones. Default (from interface) is to use all.
Implements ITruthIsolationTool.
Definition at line 121 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.
128 << mcEvtName <<
"] !!" <<
endmsg
129 <<
"No Et-isolations will be computed !");
130 return StatusCode::RECOVERABLE;
138 std::ostringstream truthEtIsolName;
143 <<
"_" << outMcEvtName;
146 if ( !
evtStore()->record( etIsolations,
147 truthEtIsolName.str() ).isSuccess() ) {
149 etIsolations =
nullptr;
151 << truthEtIsolName.str() <<
"] !!");
152 return StatusCode::RECOVERABLE;
154 if ( !
evtStore()->setConst( etIsolations ).isSuccess() ) {
155 ATH_MSG_WARNING(
"Could not setConst the TruthEtIsolations container at ["
156 << truthEtIsolName.str() <<
"] !!");
163 for ( std::size_t iMc = 0, iMax = mcEvts->
size(); iMc != iMax; ++iMc ) {
167 *etIsols, partSel ).isSuccess() ) {
169 <<
"Problem encountered while computing Et-isolations for idx=["
170 << iMc <<
"] of McEventCollection [" << mcEvtName <<
"] !!"
175 return allGood ? StatusCode::SUCCESS : StatusCode::RECOVERABLE;
◆ computeIso()
Computes and stores the list of transverse isolation energies for various cone sizes into the TruthEtIsolations
container.
Definition at line 220 of file TruthParticleID/McParticleTools/src/TruthIsolationTool.cxx.
225 const HepLorentzVector hlv = ::svToLv(
part->momentum());
226 const int ida = std::abs(
part->pdg_id());
240 if( std::abs(particleCharge)<1.
e-2 )
243 const HepLorentzVector itrHlv = ::svToLv(
particle->momentum());
244 const double r = hlv.deltaR(itrHlv);
245 for ( std::size_t iCone = 0;
249 pxi[iCone] += itrHlv.px();
250 pyi[iCone] += itrHlv.py();
259 auto decVtx =
part->end_vertex();
260 if (ida == 15 && decVtx) {
261 for (
const auto& child: *decVtx) {
264 double particleCharge =
MC::charge(child->pdg_id());
265 if( std::abs(particleCharge)<1.
e-2 )
268 const HepMC::FourVector childHlv = child->momentum();
269 pxv += childHlv.px();
270 pyv += childHlv.py();
275 for ( std::size_t
i = 0;
280 etIsol[
i] = std::sqrt(pxi[
i]*pxi[
i]+pyi[
i]*pyi[
i]);
◆ 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()
◆ etIsolationsName()
const std::string & TruthIsolationTool::etIsolationsName |
( |
const std::string & |
mcEvtName | ) |
const |
|
virtual |
◆ evtStore() [1/2]
◆ evtStore() [2/2]
◆ 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
◆ initialize()
StatusCode TruthIsolationTool::initialize |
( |
| ) |
|
|
virtual |
◆ 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 & ITruthIsolationTool::interfaceID |
( |
| ) |
|
|
inlinestaticinherited |
◆ 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.
◆ registerAlias()
StatusCode TruthIsolationTool::registerAlias |
( |
const std::string & |
originalMcEvtColl, |
|
|
const std::string & |
aliasMcEvtColl |
|
) |
| |
|
virtual |
◆ renounce()
◆ renounceArray()
◆ setupMcEventsOutput()
void TruthIsolationTool::setupMcEventsOutput |
( |
Gaudi::Details::PropertyBase & |
mcEventsOutputName | ) |
|
|
private |
◆ setupTruthEtIsolationsPrefix()
void TruthIsolationTool::setupTruthEtIsolationsPrefix |
( |
Gaudi::Details::PropertyBase & |
truthEtIsolationsPrefix | ) |
|
|
private |
◆ 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_detStore
◆ m_etIsolMap
◆ m_evtStore
◆ m_mcEventsOutputName
StringProperty TruthIsolationTool::m_mcEventsOutputName |
|
private |
◆ m_pdt
const HepPDT::ParticleDataTable* TruthIsolationTool::m_pdt |
|
private |
◆ m_prefix
StringProperty TruthIsolationTool::m_prefix |
|
private |
◆ m_ptGamMin
DoubleProperty TruthIsolationTool::m_ptGamMin |
|
private |
◆ m_varHandleArraysDeclared
◆ m_vhka
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
constexpr ParticleHypothesis particle[PARTICLEHYPOTHESES]
the array of masses
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
void setEtIsol(const HepMC::ConstGenParticlePtr &genParticle, const TruthParticleParameters::ConeSize coneIdx, const double etIsol)
Set the transverse energy isolation of a HepMC::GenParticle for a given Cone size.
ConeSize
Enum for Cone size indexes (for isolation)
bool isGenStable(const T &p)
Determine if the particle is stable at the generator (not det-sim) level,.
virtual void setOwner(IDataHandleHolder *o)=0
std::array< double, TruthParticleParameters::NbrOfCones > EtIsolations
An array of doubles of fixed size to modelize the Et isolations for different values of isolation rad...
bool isPhysical(const T &p)
Identify if the particle is physical, i.e. is stable or decayed.
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
double coneCut(const TruthParticleParameters::ConeSize idx)
The actual definition of delta R cuts for each cone.
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
bool allGood
Loop over the SDOs & Digits.
virtual void renounce()=0
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
double charge(const T &p)
value_type push_back(value_type pElem)
Add an element to the end of the collection.
#define ATH_MSG_WARNING(x)
bool isSimInteracting(const T &p)
Identify if the particle could interact with the detector during the simulation, e....
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
TruthEtIsolationsContainer
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>
std::list< HepMC::ConstGenParticlePtr > GenParticles_t