MET component descriptor contains object links and corresponding parameters. More...
#include <MissingETComponent_v1.h>
Classes | |
class | Weight |
Kinematic weight descriptor. More... | |
Public Member Functions | |
MissingETComponent_v1 (bool createStore=false) | |
Default constructor. | |
MissingETComponent_v1 (const MissingET *pmetObj, MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus()) | |
Construct with a link to a MissingET object. | |
MissingETComponent_v1 (const MissingET *pmetObj, const IParticle *pPart, const Weight &wght=Weight(), MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus()) | |
Construct with a link to a MissingET and a link to an IParticle object, and a Weight . | |
MissingETComponent_v1 (const MissingET *pmetObj, const IParticle *pPart, double wpx, double wpy, double wet, MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus()) | |
Construct with a link to a MissingET and a link to an IParticle object, and indivdual numerical weight components. | |
MissingETComponent_v1 (const MissingETComponent_v1 &compDescr) | |
Copy constructor. | |
MissingETComponent_v1 (const MissingETComponent_v1 &compDescr, MissingETBase::Types::bitmask_t sw) | |
Copy constructor with new status word. | |
MissingETComponent_v1 & | operator= (const MissingETComponent_v1 &compDescr) |
virtual | ~MissingETComponent_v1 () |
Assignment operator. | |
Set MET object | |
bool | setMET (const MissingET *pmetObj, MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus()) |
Set MET object by object pointer reference. | |
bool | setMET (const MissingETContainer_v1 *pmetCont, size_t pmedIdx, MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus()) |
Set MET object by container pointer and index reference. | |
Adding data to the MET component description | |
bool | addObject (const IParticle *pPart, const Weight &wght=Weight()) |
Add object (particle) from pointer reference with optional kinematic weight. | |
bool | addObject (const IParticle *pPart, double wpx, double wpy, double wet) |
Add object (particle) from pointer reference with individual kinematic weight components. | |
Conventional and dedicated getter and setters | |
const std::vector< double > & | wpx () const |
Get the vector of weight components. | |
double | wpx (const IParticle *pPart) const |
Get the weight component for a given object referenced by pointer. | |
double | wpx (size_t pIdx) const |
Get the weight component for a given object referenced by index. | |
bool | setWpx (const std::vector< double > &wcv) |
Set the vector of weight components. | |
bool | setWpx (const IParticle *pPart, double wpx) |
Set kinematic weight component for a given contributing object referenced by pointer. | |
bool | setWpx (size_t pIdx, double wpx) |
Set kinematic weight component for a given contributing object referenced by index. | |
const std::vector< double > & | wpy () const |
Get the vector of weight components. | |
double | wpy (const IParticle *pPart) const |
Get the weight component for a given object referenced by pointer. | |
double | wpy (size_t pIdx) const |
Get the weight component for a given object referenced by index. | |
bool | setWpy (const std::vector< double > &wpyVector) |
Set the vector of weight components. | |
bool | setWpy (const IParticle *pPart, double wpy) |
Set kinematic weight component for a given contributing object referenced by pointer. | |
bool | setWpy (size_t pIdx, double wpy) |
Set kinematic weight component for a given contributing object referenced by index. | |
const std::vector< double > & | wet () const |
Get the vector of weight components. | |
double | wet (const IParticle *pPart) const |
Get the weight component for a given object referenced by pointer. | |
double | wet (size_t pIdx) const |
Get the weight component for a given object referenced by index. | |
bool | setWet (const std::vector< double > &wcv) |
Set the vector of weight components. | |
bool | setWet (const IParticle *pPart, double wet) |
Set kinematic weight for a given contributing object referenced by pointer. | |
bool | setWet (size_t pIdx, double wet) |
Set kinematic weight for a given contributing object referenced by index. | |
bool | setWeight (const IParticle *pPart, const Weight &wght=Weight()) |
Set the kinematic weight of an object contribution referenced by pointer. | |
bool | setWeight (const IParticle *pPart, double wpx, double wpy, double wet) |
Set the kinematic weight components of an object contribution referenced by pointer. | |
bool | setWeight (size_t pIdx, const Weight &wght=Weight()) |
Set the kinematic weight of an object contribution referenced by index. | |
bool | setWeight (size_t pIdx, double wpx, double wpy, double wet) |
Set the kinematic weight components of an object contribution referenced by index. | |
const MissingETBase::Types::metlink_t & | metLink () const |
Get the link to the MET object. | |
bool | setMetLink (const MissingETBase::Types::metlink_t &metLnk) |
Set the link to the MET object. | |
const MissingETBase::Types::objlink_vector_t & | objectLinks () const |
Get the vector of links to the contributing physics or signal objects. | |
bool | setObjectLinks (const MissingETBase::Types::objlink_vector_t &objLnks) |
Set the vector of links to the contributing physics or signal objects. | |
MissingETBase::Types::bitmask_t | statusWord () const |
Get the statusword. | |
bool | setStatusWord (MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus()) |
Set the statusword of a MET term. | |
Specific methods for manipulating the component description data | |
bool | removeContrib (const IParticle *pPart) |
Remove a contribution referenced by an object pointer. | |
bool | removeContrib (size_t pIdx) |
Remove a contribution referenced by an index. | |
bool | removeContrib () |
Remove all contributions. | |
bool | resetContrib (const IParticle *pPart) |
Reset the contribution parameters of an object referenced by a pointer. | |
bool | resetContrib (size_t pIdx) |
Reset the contribution parameters of an object referenced by an index. | |
bool | resetContrib () |
Reset all contribution parameters. | |
bool | mergeStatusWord (MissingETBase::Types::bitmask_t sw) |
Merge patterns into the MET term status. | |
bool | clearStatusWord () |
Clear statusword. | |
Dedicated accessors for linked objects | |
const MissingET * | metObject () const |
Access MET object. | |
const MissingETContainer_v1 * | metObjectContainer () const |
Access MET object container holding MET object. | |
size_t | metObjectIndex () const |
Access index of MET object in its container. | |
std::vector< const IParticle * > | objects () const |
Access contributing objects. | |
std::vector< const IParticle * > | objects (std::vector< Weight > &kinePars) const |
Access contributing objects and retrieve kinematic weights. | |
std::vector< const IParticle * > | objects (const std::vector< double > *&wpxPtr, const std::vector< double > *&wpyPtr, const std::vector< double > *&wetPtr) const |
Access contributing objects and retrieve kinematic weight components. | |
Weight | weight (const IParticle *pPart) const |
Get kinematic weight for a given object. | |
Weight | weight (size_t pIdx) const |
Get kinematic weight for a given entry (index) in the contributing object list. | |
Allocating and accessing objects in the contribution | |
size_t | findIndex (const IParticle *pPart) const |
Find index of given object in contributing object store. | |
List management and information | |
void | updateLinks () |
Update all internally used ElementLink instances. | |
void | updateMETLink () |
Update link MissingET object only. | |
size_t | size () const |
bool | empty () const |
Empty list of contributing objects indicator. | |
Comparators | |
bool | operator== (const MissingETComponent_v1 &contrib) const |
bool | operator!= (const MissingETComponent_v1 &contrib) const |
Equality. | |
Protected Member Functions | |
void | createPrivateStore () |
Function initialising the object to work in standalone mode. | |
Internal non-const accessors | |
MissingETBase::Types::objlink_vector_t & | f_objectLinks () |
Non-const link reference. | |
MissingETBase::Types::metlink_t & | f_metLink () |
Non-const link reference. | |
std::vector< double > & | f_wpx () |
std::vector< double > & | f_wpy () |
std::vector< double > & | f_wet () |
MissingETBase::Types::bitmask_t & | f_statusWord () |
Helpers | |
bool | f_removeContrib (size_t pIdx) |
Copy the contribution data from a source | |
void | copyData (const MissingETComponent_v1 &compDescr, MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus()) |
template<class POBJ , class LINK > | |
void | f_setObject (const POBJ *pObj, LINK &elemLink) |
Generalized link manager. | |
template<class LINK > | |
bool | f_setLink (LINK &elemLink) |
MET component descriptor contains object links and corresponding parameters.
Overview
This class provides a data object with links to physics or signal objects contributing to a given MET term. Each component object features (1) a link to the MissingET object it describes, (2) the reconstruction status of the MET term, (3) links to the contributing signal/physics objects, and (4) a list of kinematic weights characterizing each object contribution.
MissingETComponent_v1 supports adding and removing objects from a MET contribution, and the modification of the kinematic weights of existing entries. It provides constructors for a non-functional default object without data store attached, and for various fully functional objects with (initially internal) data store wwith different initial data loads. The most basic functional object is constructed with just a link to the corresponding xAOD::MissingET object and an optional statusword . Other options construct objects with the link to the MET object, the optional statusword, and a reference to the first contributing physics or signal object and the associated kinematic weight, which can be provided using a xAOD::MissingETComponent::Weight object , or by three weight parameters .
The MET component object is not storable by itself. It needs to collected into a xAOD::MissingETComponentMap_v1, with an attached xAOD::MissingETAuxComponentMap_v1 object implementing the storable data structure..
(1) Link to MissingET object
This link is realized by an ElementLink (EL) from the component to the xAOD::MissingET object. The specific type of this EL is given by MissingETBase::Types::metlink_t. The EL can be incomplete, meaning it can be instantiated with a plain-old-data (POD) MissingET object not collected into a storable MissingETContainer_v1 yet. Once the MissingET object is collected into a container, the link can be updated using MissingETComponent_v1::updateMETLink().
(2) Status
The MET term can be qualified with a status indicator as provided in MissingETBase::Status. Logical combinations of these status indicators are possible. The status is a dataword of type MissingETBase::Types::bitmask_t. The statusword is typically set by the tool reconstructing a specific MET term. It should not be confused with the source of the MET object, which hhholds different information using the same MissingETBase::Types::bitmask_t.
(3) Links to contributing objects
The links to the objects contributing to a given MET object are stored in a vector of type MissingETBase::Types::objlink_vector_t. Each signal/physics object should contribute only once to a given MET. Any attempt to add the same object reference again leads to addition of the provided kinematic weights to the stored kinematic weights. This behaviour can produce unrealistic weights this way, suggesting that adding physics or signal objects should be done within the well controlled context of a MET reconstruction tool.
(4) Kinematic weights
The kinematic weights are scale factors applied to the object kinematics such that the contribution to the corresponding MET variables is given by . The overall MET contribution of all objects of the same type (e.g., electrons, photons, jets,...) is then given by
The individual weights are stored in vectors index-parallel to the link vector.
Setting data in a MET component (link to code documentation)
These methods establish a link to the xAOD::MissingET object in a (new) MET contribution. The link list to the contributing object and the lists storing the kinematic weights and the list of statuswords are empty. One of these methods needs to be invoked before attempting to set object data for the referenced MET object.
If this method is invoked for a component which already had links to contributing objects, the corresponding lists are purged, and the EL to the xAOD::MissingET object may be overwritten, if the pointer refers to a different object than the one in the original EL. This method acts like a reset of the MET component object.
Adding data to the contribution (link to code documentation)
Add a signal or physics object contribution to the MET object. A new link is added to linked object list if the referenced object is not yet in this list. If the referenced object is already in the list, the given kinematic weights are added to the weights already stored for the contribution. No new list entry is generated in this case.
Manipulating the contribution data (link to code documentation)
The parameters of the contribution from a given object to MET can be modified after the MET component object is created. This involves a linear search in the list of contributing objects. In addition, objects can be removed from the linked object vector. This again involves a linear search. Some behaviour is implemented to suppress searches for the same entities and just use the result from the previous search,
Other functions allow updating the EL to the MissingET object, and all other linked physics and signal objects. This is done by setting the container pointer in these ELs. At most, it involves a loop on all contributing objects, plus the update of the MissingET link
Allocating and accessing contributing objects (link to code documentation)
All allocators (finders) allow to parse the list of contributing objects and find contributions from a given object, as specified by its pointer. A linear search is performed to find the correct entries in the object lists. The returned results are represented by iterators referencing valid link objects (ElementLinks) if the requested object is in the contributing store, else a reference to the end of the store is returned.
Contributing objects and their associated parameters can be accessed individually using iterators for const and non-const access. In addition, public references to the whole contributing object store are available.
Accessing MET and contributing object, object container, and object index does not include an internal validity check. A returned object pointer can be NULL. It is necessary for clients to test the returned pointer value. The returned value for the index in case of an invalid ElementLink is the default value of this data type.
Comparisons (link to code documentation)
Comparators apply equality rules as follows: two MissingETComponent_v1 objects are identical if (1) the are linked to the same MissingET object, (2) they have the same status, (3) they have the same number of contributing objects, and (4) they have identical lists of contributing objects and kinematic weights. The comparisons are applied in the numerical order displayed. The MissingETComponent_v1::operator!= operator is implemented, as it allows a (fast) return when the first difference between the compared data words is detected.
xAOD::MissingETComponent_v1::MissingETComponent_v1 | ( | bool | createStore = false |
) |
Default constructor.
Instantiates a MissingETComponent_v1 object.
[in] | createStore | controls the creation of dedicated store for this data object (optional, default is false - no store created). |
false
is used, the created object not have a store for its data. It cannot be used as a plain old data (POD) object in this case, and any attempt to set or get data will likely cause undesired behaviour and/or program crashes. When instantiated with this state, It needs to be stored in a xAOD::MissingETComponentMap_v1 object prior to any use. Providing an explicit argument true
instantiates a standalone, fully functional POD object with a private store attached. When this object is stored in a MissingETComponentMap_v1, the data content of this store is copied to the attached MissingETAuxComponentMap_v1 object and the private store is disabled. xAOD::MissingETComponent_v1::MissingETComponent_v1 | ( | const MissingET * | pmetObj, | |
MissingETBase::Types::bitmask_t | sw = MissingETBase::Status::clearedStatus() | |||
) |
Construct with a link to a MissingET object.
Instantiates an empty component descriptor for a given MET (xAOD::MissingET) object with a private store attached.
[in] | pmetObj | pointer to non-modifiable xAOD::MissingET object |
[in] | sw | status word characterizing the MET term (optional, default is MissingETBase::Status::clearedStatus()) |
xAOD::MissingETComponent_v1::MissingETComponent_v1 | ( | const MissingET * | pmetObj, | |
const IParticle * | pPart, | |||
const Weight & | wght = Weight() , |
|||
MissingETBase::Types::bitmask_t | sw = MissingETBase::Status::clearedStatus() | |||
) |
Construct with a link to a MissingET and a link to an IParticle object, and a Weight
.
This allows construction of a MissingETComponent_v1 object with an initial contribution. This object has then all the features and behaviours as the one instantiated by xAOD::MissingETComponent_v1::MissingETComponent_v1(const MissingET*,MissingETBase::Types::bitmask_t), but a contributing objects link store and the corresponding stores for the kinematic weights filled with first data.
[in] | pmetObj | pointer to object representing a MET term |
[in] | pPart | pointer to non-modifiable IParticle typed object |
[in] | wght | kinematic weights (optional, default are xAOD::MissingETComponent_v1::Weight object defaults) |
[in] | sw | status word (optional, default is MissingETBase::Status::clearedStatus()) |
xAOD::MissingETComponent_v1::MissingETComponent_v1 | ( | const MissingET * | pmetObj, | |
const IParticle * | pPart, | |||
double | wpx, | |||
double | wpy, | |||
double | wet, | |||
MissingETBase::Types::bitmask_t | sw = MissingETBase::Status::clearedStatus() | |||
) |
Construct with a link to a MissingET and a link to an IParticle object, and indivdual numerical weight components.
Instantiates the same object as xAOD::MissingETComponent_v1::MissingETComponent_v1(const MissingET*,const IParticle*,const Weight&,MissingETBase::Types::bitmask_t), but allows to use individual weight components instead of weight components collected into a xAOD::MissingETComponent_v1::Weight typed object.
[in] | pmetObj | pointer to object representing a MET term |
[in] | pPart | pointer to non-modifiable IParticle typed object |
[in] | wpx | weight |
[in] | wpy | weight |
[in] | wet | weight |
[in] | sw | status word (optional, default is MissingETBase::Status::clearedStatus()) |
xAOD::MissingETComponent_v1::MissingETComponent_v1 | ( | const MissingETComponent_v1 & | compRef | ) |
Copy constructor.
This constructor performs a deep copy. The link to the source auxiliary store is severed for the copy, and a POD xAOD::MissingETComponent_v1 object is instantiated. The ElementLink objects used to establish the links to the xAOD::MissingET object and the contributing signal objects are copied, as well as the lists of kinematic weights and the status word.
in[] | compRef reference to non-modifiable MET component description (the source). |
xAOD::MissingETComponent_v1::MissingETComponent_v1 | ( | const MissingETComponent_v1 & | compRef, | |
MissingETBase::Types::bitmask_t | sw | |||
) |
Copy constructor with new status word.
This constructor performs a deep copy. The link to the source auxiliary store is severed for the copy, and a POD xAOD::MissingETComponent_v1 object is instantiated. The ElementLink objects used to establish the links to the xAOD::MissingET object and the contributing signal objects are copied, as well as the lists of kinematic weights. A new status word can be specified (can be same as the as the one in the source object - no restriction on value).
[in] | compRef | reference to non-modifiable MET component description (the source). |
[in] | sw | status word |
bool xAOD::MissingETComponent_v1::addObject | ( | const IParticle * | pPart, | |
const Weight & | wght = Weight() | |||
) | [inline] |
Add object (particle) from pointer reference with optional kinematic weight.
true
if new contribution is added. A return value of false
indicates that the referenced object already contributes to the MET term. There is no specific failure mode for this operation.[in] | pPart | pointer to non-modifiable xAOD::IParticle object |
[in] | wght | kinematic weight of object in MET (optional, default is defined in the xAOD::MissingETComponent_v1::Weight::Weight() constructor |
bool MissingETComponent_v1::f_removeContrib | ( | size_t | pIdx | ) | [protected] |
Copy the contribution data from a source
[in] | contrib | reference to non-modifiable contribution object (the source). |
template< class POBJ, class LINK > void xAOD::MissingETComponent_v1::f_setObject | ( | const POBJ * | pObj, | |
LINK & | elemLink | |||
) | [inline, protected] |
Generalized link manager.
Inserts link data into ElementLink, even if incomplete. At least, the pointer of linked object will be set (except if NULL).
POBJ | linked object type | |
LINK | specific ElementLink type |
[in] | pObj | pointer to non-modifiable object to be linked |
[in] | elemLink | reference to modifiable ElementLink object. Initial data content of this object are overwritten. |
size_t MissingETComponent_v1::findIndex | ( | const IParticle * | pPart | ) | const |
Find index of given object in contributing object store.
The returned index is valid for the contributing object store and the parameter stores (index-parallel stores).
This method makes use of a cache. If the pointer to the checked object is the same as the last one successfully searched for, the index is returned from a cached data word. If the pointer is not the same, xAOD::MissingETComponent::findIndex(const IParticle*) is invoked. If this method finds the referenced object, the cache is updated and the valid index is returned. In case the object is not found, MissingETBase::Nummerical::invalidIndex() is returned.
[in] | pPart | pointer to non-modifiable object |
[in] | pPart | pointer to non-modifiable object in the list of contributing objects |
const MissingETBase::Types::metlink_t & xAOD::MissingETComponent::metLink | ( | ) | const [inline] |
Get the link to the MET object.
Retrieve the link to the MET object.
const xAOD::MissingET * xAOD::MissingETComponent_v1::metObject | ( | ) | const [inline] |
Access MET object.
size_t xAOD::MissingETComponent_v1::metObjectIndex | ( | ) | const [inline] |
Access index of MET object in its container.
const MissingETBase::Types::objlink_vector_t & xAOD::MissingETComponent_v1::objectLinks | ( | ) | const [inline] |
Get the vector of links to the contributing physics or signal objects.
Retrieve the vector of links to the contributing objects.
std::vector< const xAOD::IParticle * > xAOD::MissingETComponent_v1::objects | ( | std::vector< Weight > & | kinePars | ) | const |
Access contributing objects and retrieve kinematic weights.
This method returns pointer references to all objects stored in the link list, and fills vectors with (index-parallel) kinematic weights and status words.
[out] | kinePars | reference to modifiable list of kinematic weights |
std::vector< const xAOD::IParticle * > xAOD::MissingETComponent_v1::objects | ( | ) | const |
Access contributing objects.
This method returns all objects stored in the link list.
xAOD::MissingETComponent_v1 & xAOD::MissingETComponent_v1::operator= | ( | const MissingETComponent_v1 & | compRef | ) |
[in] | compRef | reference to non-modifiable MET component description (the source). |
Reimplemented from SG::AuxElement.
bool xAOD::MissingETComponent_v1::resetContrib | ( | const IParticle * | pPart | ) | [inline] |
Reset the contribution parameters of an object referenced by a pointer.
Presently only resets the kinematic weight to its default value (defined in xAOD::MissingETComponent_v1::Weight::Weight()).
(wpx=0, wpy=0, wet=0)
(check MissingETBase::Numerical::wpxDefault(), MissingETBase::Numerical::wpyDefault() and MissingETBase::Numerical::wetDefault() for the respective default values)! If zero weights are desired, xAOD::MissingETComponent_v1::setWeight(const IParticle*,const Weight&) should be used with argument wght = Weight(0.,0.,0.)
(failsafe with this respect).true
if object is found and successfully reset, false
if object not found in list of contributing objects.[in] | pPart | pointer to non-modifiable object searched for in the list of contributing objects |
xAOD::MissingETComponent_v1::setMET | ( | const MissingET * | pmetObj, | |
MissingETBase::Types::bitmask_t | sw = MissingETBase::Status::clearedStatus() | |||
) |
Set MET object by object pointer reference.
This function sets a new link to the MET object reference given in its first argument. This can mean that a previously stored link is overwritten.
true
if no previous ElementLink to the referenced xAOD::MissingET object existed. In case of a reset, false
is returned.[in] | pmetObj | pointer to non-modifiable MET object. |
[in] | sw | status word (optional, default is MissingETBase::Status::clearedStatus()) |
bool xAOD::MissingETComponent_v1::setObjectLinks | ( | const MissingETBase::Types::objlink_vector_t & | objLnks | ) |
Set the vector of links to the contributing physics or signal objects.
Set the list of links for objects contributing to MET.
[in] | objLnks | vector of link objects. |
bool xAOD::MissingETComponent_v1::setWet | ( | const std::vector< double > & | wcv | ) |
Set the vector of weight components.
bool xAOD::MissingETComponent_v1::setWpx | ( | const IParticle * | pPart, | |
double | wpx | |||
) | [inline] |
Set kinematic weight component for a given contributing object referenced by pointer.
true
if referenced object is in list of contributing objects, else false
.[in] | pPart | pointer to non-modifiable object searched for in the list of contributing objects |
[in] | wpx | kinematic weight component |
bool xAOD::MissingETComponent_v1::setWpy | ( | const IParticle * | pPart, | |
double | wpy | |||
) | [inline] |
Set kinematic weight component for a given contributing object referenced by pointer.
true
if referenced object is in list of contributing objects, else false
.[in] | pPart | pointer to non-modifiable object searched for in the list of contributing objects |
[in] | wpy | kinematic weight component |
void xAOD::MissingETComponent_v1::setWpy | ( | const std::vector< double > & | wcv | ) |
Set the vector of weight components.
void MissingETComponent_v1::updateLinks | ( | ) |
Update all internally used ElementLink instances.
const std::vector< double > & xAOD::MissingETComponent_v1::wet | ( | ) | const [inline] |
Get the vector of weight components.
copydetails xAOD::MissingETComponent_v1::wpx()
double xAOD::MissingETComponent_v1::wpx | ( | const IParticle * | pPart | ) | const [inline] |
Get the weight component for a given object referenced by pointer.
[in] | pPart | pointer to non-modifiable (contributing) object |
const std::vector< double > & xAOD::MissingETComponent_v1::wpx | ( | ) | const [inline] |
Get the vector of weight components.
Retrieve the vector containing a weight component for all contributing objects.
const std::vector< double > & xAOD::MissingETComponent_v1::wpy | ( | ) | const [inline] |
Get the vector of weight components.
Retrieve the vector containing a weight component for all contributing objects.