ATLAS Offline Software
Loading...
Searching...
No Matches
Event/xAOD/xAODMissingET/xAODMissingET/MissingETComposition.h
Go to the documentation of this file.
1// -*- c++ -*-
2
3/*
4 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
5*/
6
7#ifndef XAODMISSINGET_MISSINGETCOMPOSITION_H
8#define XAODMISSINGET_MISSINGETCOMPOSITION_H
9
17#include "xAODJet/Jet.h"
18
19namespace xAOD
20{
22 {
58 static bool insert(MissingETComponentMap* pMap,const MissingET* pMET,const IParticle* pPart,const MissingETBase::Types::object_vector_t& signalList,
71 static bool insert(MissingETComponentMap* pMap,const MissingET* pMET,const IParticle* pPart,double wpx,double wpy,double wet);
79 static bool insert(MissingETComponentMap* pMap,const MissingET* pMET,const IParticle* pPart,const MissingETBase::Types::object_vector_t& signalList,double wpx,double wpy,double wet,
81
96 static MissingETComponentMap::const_iterator find(const MissingETComponentMap* pMap,const std::string& metName);
97 static MissingETComponentMap::iterator find(MissingETComponentMap* pMap,const std::string& metName);
100 static size_t findIndex(const MissingETComponentMap* pMap,const MissingET* pmetObj);
101 static size_t findIndex(const MissingETComponentMap* pMap,const std::string& metName);
103
104
124
158 static const MissingETComponent* getComponent(const MissingETComponentMap* pMap,const IParticle* pPart);
159 static const MissingETComponent* getComponent(const MissingETComponentMap* pMap,const MissingET* pmetObj);
160 static const MissingETComponent* getComponent(const MissingETComponentMap* pMap,const std::string& metName);
169 static MissingETComponent* getComponent(MissingETComponentMap* pMap,const std::string& metName);
172
179 static const MissingET* getMissingET(const MissingETComponentMap* pMap,const IParticle* pPart);
181 static const MissingET* getMissingET(const MissingETComponentMap* pMap,const std::string& name);
184
199 template<int OBJTYPE>
200 static bool fillMissingET(const MissingETComponentMap* pMap,MissingET* pMET,
202 {
203 if ( pMap == 0 || pMap->empty() ) return false;
204 //
205 double sumet(pMET->sumet());
208 for ( ; fComp != lComp; ++fComp )
209 {
210 const MissingETComponent* pCont = *fComp;
211 if ( pCont != 0 )
212 {
213 // get objects from contribution
215 MissingETBase::Types::object_vector_t objs = pCont->objects(kinePars);
216 for ( size_t iObj(0); iObj<objs.size(); ++iObj )
217 {
218 if ( objs[iObj]->type() == OBJTYPE )
219 { // this is really stupid!!!!
220 pMET->add(objs.at(iObj)->p4().Px()*kinePars.at(iObj).wpx(),
221 objs.at(iObj)->p4().Py()*kinePars.at(iObj).wpy(),
222 objs.at(iObj)->pt()*kinePars.at(iObj).wet());
223 } // requested type
224 } // loop on contributing objects
225 } // contribution valid
226 } // loop on all contributions
227 return pMET->sumet() != sumet;
228 } // fillMissingET
229
247 static bool add(MissingETAssociationMap* pMap,const Jet* pJet,
248 const std::vector<ElementLink<IParticleContainer> >& jetconst=std::vector<ElementLink<IParticleContainer> >(),
263 static bool add(MissingETAssociationMap* pMap,const Jet* pJet,
264 const std::vector<const IParticle*>& jetracks=std::vector<const IParticle*>());
285 static bool insert(MissingETAssociationMap* pMap,size_t jetIndex,const IParticle* pPart,const std::vector<const IParticle*>& constlist);
295 static bool insert(MissingETAssociationMap* pMap,const Jet* pJet,const IParticle* pPart,const std::vector<const IParticle*>& constlist);
303 static bool insert(MissingETAssociationMap* pMap,const IParticle* pPart,const std::vector<const IParticle*>& constlist,
304 std::map<const IParticle*,MissingETBase::Types::constvec_t> pOverride=std::map<const IParticle*,MissingETBase::Types::constvec_t>());
305
306 static bool setJetConstSum(MissingETAssociationMap* metMap,const Jet* jet,const std::vector<const IParticle*>& altConsts,
307 std::map<const IParticle*,MissingETBase::Types::constvec_t> pOverride);
315 static bool insertMisc(MissingETAssociationMap* pMap,const IParticle* pPart,const std::vector<const IParticle*>& constlist);
317
332
352
364 static std::vector<const MissingETAssociation*> getAssociations(const MissingETAssociationMap* pMap,const IParticle* pPart);
366 static bool objSelected(const MissingETAssociationHelper& helper,const IParticle* obj);
368 static const MissingETAssociation* getAssociation(const MissingETAssociationMap* pMap,const Jet* pJet);
369 // static const MissingETAssociation* getMiscAssociation(const MissingETAssociationMap* pMap);
375 static std::vector<MissingETAssociation*> getAssociations(MissingETAssociationMap* pMap,const IParticle* pPart);
377 // static MissingETAssociation* getMiscAssociation(MissingETAssociationMap* pMap);
379
382 // Leave these for now -- decide how to treat calo vs track vs jet vs signal
383 // static MissingETBase::Types::constvec_t getConstVec(const MissingETAssociationMap* pMap,const IParticle* pPart);
384 // static MissingETBase::Types::constvec_t getConstVec(MissingETAssociationMap::const_iterator fCont,const IParticle* pPart);
385 static const Jet* getRefJet(const MissingETAssociationMap* pMap,const IParticle* pPart);
388
389 }; // MissingETComposition
390} // namespace xAOD
391
461
462 // /*! @brief Object factories for a MET contribution object
463 // *
464 // * These functions can be helpful to generate @link xAOD::MissingETComponent MissingETComponent @endlink objects. They invoke the respective constructor
465 // * with the given list of arguments.
466 // *
467 // * @warning These functions expose the @link xAOD::MissingETComponent MissingETComponent @endlink object to clients, which may not be desirable.
468 // * Non-experts should probably not use them.
469 // *
470 // */
471 // struct Contribution
472 // {
473 // /*! @name Object factories for contribution object
474 // * @anchor contrib_factory
475 // */
476 // /*!@{*/
477 // /*! @brief Default construction
478 // *
479 // * Instantiates an empty @link xAOD::MissingETComponent MissingETComponent @endlink object with default parameters given in
480 // * @link xAOD::MissingETComponent::MissingETComponent() MissingETComponent::MissingETComponent() @endlink.
481 // *
482 // * @return Pointer to valid but empty @link xAOD::MissingETComponent MissingETComponent @endlink object.
483 // */
484 // static MissingETComponent* generate();
485 // /*! @brief Construct with a given MET object
486 // *
487 // * Instantiates an incomplete (not fully loaded) @link xAOD::MissingETComponent MissingETComponent @endlink object with a link
488 // * to a @link xAOD::MissingET MissingET @endlink object and otherwise default data.
489 // *
490 // * @return Pointer to valid but incomplete @link xAOD::MissingETComponent MissingETComponent @endlink object.
491 // *
492 // * @param[in] pmetObj pointer to non-modifiable MET object.
493 // *
494 // * @note If the given pointer to the @link xAOD::MissingET MissingET @endlink is NULL, the returned contribution object
495 // * is empty. This is the same behaviour as implemented in the xAOD::MissingETComposition::generate() function.
496 // * If the reference to the container in the MET object is invalid,
497 // * @link xAOD::MissingETComponent::updateMETLink() MissingETComponent::updateMETlink() @endlink
498 // * must be called after the @link xAOD::MissingET MissingET @endlink object has been inserted into a storable
499 // * @link xAOD::MissingETContainer MissingETContainer @endlink. Only then is the EL complete and valid.
500 // */
501 // static MissingETComponent* generate(const MissingET* pmetObj);
502 // /*! @brief Construct with a given MET object and a first contributing object
503 // *
504 // * Instantiates a complete (loaded with one contributing object) @link xAOD::MissingETComponent MissingETComponent @endlink
505 // * object with a link to a @link xAOD::MissingET MissingET @endlink object and otherwise default data.
506 // *
507 // * @return Pointer to valid and loaded @link xAOD::MissingETComponent MissingETComponent @endlink object. Returns NULL if problems
508 // * with the generation occur.
509 // *
510 // * @param[in] pmetObj pointer to non-modifiable MET object.
511 // * @param[in] pPart pointer to non-modifiable contributing object.
512 // * @param[in] weight reference to non-modifiable kinematic weight object MissingETComposition::Weight (optional,
513 // * default is given by Weight::Weight()).
514 // * @param[in] sw status of contribution (optional, default is MissingETBase::Status::defaultAccept).
515 // *
516 // * @note If the reference to the container in the MET object is invalid,
517 // * xAOD::MissingETComposition::Contribution::updateMETLink() must be called after the @link MissingET MissingET @endlink object has been inserted into a storable
518 // * @link MissingETContainer MissingETContainer @endlink. Only then is the EL complete and valid.
519 // *
520 // * @warning Any invalid input (expecially NULL pointers) suppresses generation of the @link MissingETComponent MissingETComponent @endlink
521 // * object (a NULL pointer is returned).
522 // */
523 // static MissingETComponent* generate(const MissingET* pmetObj,const IParticle* pPart,const MissingETBase::Types::weight_t& weight=MissingETBase::Types::weight_t(),
524 // MissingETBase::Types::bitmask_t sw=MissingETBase::Status::defaultAccept);
525 // /*! @brief Construct with a given MET object and a first contributing object
526 // *
527 // * Instantiates a complete (loaded with one contributing object) @link MissingETComponent MissingETComponent @endlink
528 // * object with a link to a @link MissingET MissingET @endlink object and otherwise default data.
529 // *
530 // * @return Pointer to valid and loaded @link MissingETComponent MissingETComponent @endlink object. Returns NULL if problem with generation.
531 // *
532 // * @param[in] pmetObj pointer to non-modifiable MET object.
533 // * @param[in] pPart pointer to non-modifiable contributing object.
534 // * @param[in] wpx kinematic weight @f$ w_{x} @f$
535 // * @param[in] wpy kinematic weight @f$ w_{y} @f$
536 // * @param[in] wet kinematic weight @f$ w_{\rm T} @f$
537 // * @param[in] sw status of contribution (optional, default is MissingETBase::Status::defaultAccept.
538 // *
539 // * @note If the reference to the container in the MET object is invalid,
540 // * Contribution::updateMETLink() must be called after the @link MissingET MissingET @endlink object has been inserted into a storable
541 // * @link MissingETContainer MissingETContainer @endlink. Only then is the EL complete and valid. The same
542 // * applies to the EL to all contributing objects.
543 // * Invoking Contribution::updateLinks() updates all EL with the container pointers, making them valid if the container pointers are not
544 // * NULL. This action involves a loop over the full list of contributing objects.
545 // *
546 // * @warning Any invalid input (expecially NULL pointers) suppresses generation of the @link MissingETComponent MissingETComponent @endlink
547 // * object (a NULL pointer is returned).
548 // */
549 // static MissingETComponent* generate(const MissingET* pmetObj,const IParticle* pPart,double wpx,double wpy,double wet,MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus());
550
551 // /*!@}*/
552 // }; // Contribution
553
554#endif
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
DataModel_detail::iterator< DataVector > iterator
Definition DataVector.h:842
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.
bool empty() const noexcept
Returns true if the collection is empty.
Class providing the definition of the 4-vector interface.
std::vector< const IParticle * > objects() const
Access contributing objects.
float sumet() const
Returns.
void add(const IParticle *particle)
Add particle kinematics to MET.
std::vector< const xAOD::IParticle * > object_vector_t
Vector of object type.
std::vector< weight_t > weight_vector_t
Vector type for kinematic weight containers.
xAOD::MissingETAssociation_v1::ConstVec constvec_t
Type for constituent vector.
uint64_t bitmask_t
Type for status word bit mask.
xAOD::MissingETComponent_v1::Weight weight_t
Type for kinematic weight.
@ OnlyCluster
CaloCluster based only.
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Jet_v1 Jet
Definition of the current "jet version".
MissingETComponent_v1 MissingETComponent
Version control by type definition.
MissingETAssociation_v1 MissingETAssociation
Version control by type definition.
MissingETComponentMap_v1 MissingETComponentMap
Version control by type definition.
MissingET_v1 MissingET
Version control by type defintion.
MissingETAssociationMap_v1 MissingETAssociationMap
Version control by type defintion.
static Types::bitmask_t clearedStatus()
Cleared term tag accessor.
Collection of functions managing the MET composition map and association map.
static MissingETComponentMap::const_iterator find(const MissingETComponentMap *pMap, const MissingET *pmetObj)
Find non-modifiable contribution for a given MET object.
static bool addMiscAssociation(MissingETAssociationMap *pMap)
Add an association to hold objects not associated to any jet.
static std::vector< const MissingETAssociation * > getAssociations(const MissingETAssociationMap *pMap, const IParticle *pPart)
Access non-modifiable contribution object.
static MissingETAssociationMap::iterator find(MissingETAssociationMap *pMap, const IParticle *pPart)
Find modifiable contribution for given particle.
static bool setJetConstSum(MissingETAssociationMap *metMap, const Jet *jet, const std::vector< const IParticle * > &altConsts, std::map< const IParticle *, MissingETBase::Types::constvec_t > pOverride)
static MissingETComponentMap::const_iterator end(const MissingETComponentMap *pMap)
static MissingETBase::Types::bitmask_t getStatusWord(const MissingETComponentMap *pMap, const MissingET *pmetObj)
static MissingETComponentMap::iterator begin(MissingETComponentMap *pMap)
Iterator access to beginning of composition map.
static bool fillMissingET(const MissingETComponentMap *pMap, MissingET *pMET, MissingETBase::Types::bitmask_t=MissingETBase::Status::clearedStatus())
Fill a given MissingET object.
static const Jet * getRefJet(const MissingETAssociationMap *pMap, const IParticle *pPart)
static bool insert(MissingETComponentMap *pMap, const MissingET *pMET, const IParticle *pPart, MissingETBase::Types::weight_t weight=MissingETBase::Types::weight_t())
Insert contributing signal or physics object by pointer, with optional kinematic weight object.
static bool insertMisc(MissingETAssociationMap *pMap, const IParticle *pPart, const std::vector< const IParticle * > &constlist)
Insert contributing object into miscellaneous association.
static bool objSelected(const MissingETAssociationHelper &helper, const IParticle *obj)
static MissingETAssociationMap::const_iterator find(const MissingETAssociationMap *pMap, const IParticle *pPart)
Find non-modifiable contribution for given particle.
static const MissingETComponent * getComponent(const MissingETComponentMap *pMap, const IParticle *pPart)
Access non-modifiable contribution object.
static MissingETComponentMap::iterator end(MissingETComponentMap *pMap)
static MissingETBase::Types::constvec_t getConstVec(const MissingETAssociationMap *pMap, const IParticle *pPart, MissingETBase::UsageHandler::Policy p)
static bool selectIfNoOverlaps(MissingETAssociationHelper &helper, const IParticle *obj, MissingETBase::UsageHandler::Policy p)
static MissingETBase::Types::weight_t getWeight(const MissingETComponentMap *pMap, const IParticle *pPart)
static MissingETComponentMap::const_iterator begin(const MissingETComponentMap *pMap)
Const iterator access to beginning of composition map.
static size_t findIndex(const MissingETComponentMap *pMap, const MissingET *pmetObj)
static size_t findIndex(const MissingETComponentMap *pMap, const std::string &metName)
static size_t findIndex(const MissingETComponentMap *pMap, MissingETBase::Types::bitmask_t src)
static const MissingET * getMissingET(const MissingETComponentMap *pMap, const IParticle *pPart)
static const MissingETAssociation * getAssociation(const MissingETAssociationMap *pMap, const Jet *pJet)
static bool add(MissingETComponentMap *pMap, const MissingET *pMET, MissingETBase::Types::bitmask_t sw=MissingETBase::Status::clearedStatus())
Adding a MissingET object to the map.