ATLAS Offline Software
MissingETComponentMap_v1.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 /*
4  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 #ifndef XAODMISSINGET_VERSIONS_MISSINGETCOMPONENTMAP_V1_H
8 #define XAODMISSINGET_VERSIONS_MISSINGETCOMPONENTMAP_V1_H
9 
11 
12 #include "xAODBase/ObjectType.h"
13 
17 
18 #include <string>
19 #include <vector>
20 #include <map>
21 
22 namespace xAOD
23 {
24  class MissingETComponentMap_v1 : public DataVector<MissingETComponent_v1>
25  {
26  public:
27 
35  virtual ~MissingETComponentMap_v1();
36 
46  const_iterator find(const MissingET* pMET) const;
57  const_iterator find(const std::string& name) const;
76  iterator find(const MissingET* pMET);
87  iterator find(const std::string& name);
99  size_t findIndex(const MissingET* pMET) const;
100  size_t findIndex(const std::string& name) const;
109  const MissingET* retrieveMissingET(const std::string& name) const;
120  const MissingET* retrieveMissingET(MissingETBase::Types::bitmask_t src,bool excl=false) const;
133  public:
134 
161  //
162  bool addObjects(const MissingET* pMET,const IParticle* pPart,const MissingETBase::Types::object_vector_t& signalList,
164  bool setClusters(const MissingET* pMET,const IParticle* pPart,const MissingETBase::Types::object_vector_t& signalList);
165  bool setTracks(const MissingET* pMET,const IParticle* pPart,const MissingETBase::Types::object_vector_t& signalList);
166  bool setObjects(const MissingET* pMET,const IParticle* pPart,const MissingETBase::Types::object_vector_t& objectList);
167  size_t getComponentIndex(const IParticle* pPart) const;
168  size_t getObjectIndex(const IParticle* pPart) const;
171  /* override base DataVector methods that can remove elements
172  * in order to invalidate the cache
173  */
175  void pop_back();
176  void clear();
177  void sort();
178  template <class COMPARE> void sort(COMPARE comp);
183 
184  protected:
185 
188  typedef size_t signal_key_t;
189  typedef const IParticle* particle_key_t;
195  typedef std::vector<indexedlink_t> signal_vector_t;
201  typedef std::map<particle_key_t,indexedlink_t> particle_map_t;
225  template<int N> size_t f_getIndex(const IParticle* pPart) const
226  {
227  // check on cluster signal
228  if ( pPart->type() == Type::CaloCluster )
229  { size_t idx(pPart->index()); return idx < m_clusterLinks.size() ? std::get<N>( m_clusterLinks.at(idx)) : MissingETBase::Numerical::invalidIndex(); }
230  // check on track signal
231  if ( pPart->type() == Type::TrackParticle )
232  { size_t idx(pPart->index()); return idx < m_trackLinks.size() ? std::get<N>(m_trackLinks.at(idx)) : MissingETBase::Numerical::invalidIndex(); }
233  //
234  particle_map_t::const_iterator fPart(m_particleLinks.find(pPart));
235  return fPart != m_particleLinks.end() ? std::get<N>(fPart->second) : MissingETBase::Numerical::invalidIndex();
236  }
264  void f_fillLookupCache();
266  void f_clearLookupCache();
268  void f_setupLookupCache(signal_vector_t& signalLinks,size_t reserve);
278  template<int OBJTYPE>
280  {
282  while ( fSign != sig.end() ) { if ( (*fSign)->type() != OBJTYPE ) { fSign = sig.erase(fSign); } else { ++fSign; } }
283  return !sig.empty();
284  }
285 
290 
291  private:
292 
293  static const size_t m_clusterLinkReserve =10000;
294  static const size_t m_trackLinkReserve =10000;
295 
296  }; // class xAOD::MissingETComponentMap_v1
297 } // namespace xAOD
298 
299 #include "xAODCore/BaseInfo.h"
301 
303 #endif
DataVector< MissingETComponent_v1 >::reserve
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::MissingETComponentMap_v1::sort
void sort()
xAOD::MissingETComponentMap_v1::particle_key_t
const IParticle * particle_key_t
Key type for physics objects is the base pointer type of these objects.
Definition: MissingETComponentMap_v1.h:189
xAOD::MissingETComponentMap_v1
Definition: MissingETComponentMap_v1.h:25
plotting.yearwise_luminosity_vs_mu.comp
comp
Definition: yearwise_luminosity_vs_mu.py:23
xAOD::MissingETComponentMap_v1::m_trackLinks
signal_vector_t m_trackLinks
Store for linked track signal information lookup.
Definition: MissingETComponentMap_v1.h:215
xAOD::name
name
Definition: TriggerMenuJson_v1.cxx:29
xAOD::MissingETComponentMap_v1::clear
void clear()
xAOD::MissingETComponentMap_v1::indexedlink_t
MissingETBase::Types::indexedlink_t indexedlink_t
Type for the description of the link locations.
Definition: MissingETComponentMap_v1.h:190
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
xAOD::MissingETComponentMap_v1::sort
void sort(COMPARE comp)
MissingETComponent_v1.h
xAOD::MissingETComponentMap_v1::erase
iterator erase(iterator first, iterator last)
xAOD::MissingETComponentMap_v1::m_particleLinks
particle_map_t m_particleLinks
Store for linked physics object information lookup.
Definition: MissingETComponentMap_v1.h:218
fitman.sz
sz
Definition: fitman.py:527
xAOD::MissingETComponentMap_v1::find
const_iterator find(const MissingET *pMET) const
Find MET object referenced by pointer.
Definition: MissingETComponentMap_v1.cxx:48
LArConditions2Ntuple.objects
objects
Definition: LArConditions2Ntuple.py:59
xAOD::MissingETComponentMap_v1::MissingETComponentMap_v1
MissingETComponentMap_v1(SG::OwnershipPolicy own=SG::OWN_ELEMENTS, SG::IndexTrackingPolicy trackIndices=SG::DEFAULT_TRACK_INDICES)
Default constructor.
Definition: MissingETComponentMap_v1.cxx:25
xAOD::MissingETComponentMap_v1::setClusters
bool setClusters(const MissingET *pMET, const IParticle *pPart, const MissingETBase::Types::object_vector_t &signalList)
Definition: MissingETComponentMap_v1.cxx:276
WriteCellNoiseToCool.src
src
Definition: WriteCellNoiseToCool.py:513
xAOD::MissingETComponentMap_v1::f_checkObjectUsage
bool f_checkObjectUsage(MissingETBase::Types::object_vector_t &sig, const signal_vector_t &signalLinks) const
Check signal object usage.
Definition: MissingETComponentMap_v1.cxx:219
SG_BASE
SG_BASE(xAOD::MissingETComponentMap_v1, DataVector< xAOD::MissingETComponent_v1 >)
BaseInfo.h
xAOD::MissingETComponentMap_v1::m_trackLinkReserve
static const size_t m_trackLinkReserve
Definition: MissingETComponentMap_v1.h:294
MissingETCompositionBase.h
xAOD::IParticle::type
virtual Type::ObjectType type() const =0
The type of the object as a simple enumeration.
SG::DEFAULT_TRACK_INDICES
@ DEFAULT_TRACK_INDICES
Default value.
Definition: IndexTrackingPolicy.h:40
xAOD
ICaloAffectedTool is abstract interface for tools checking if 4 mom is in calo affected region.
Definition: ICaloAffectedTool.h:24
xAOD::MissingETComponentMap_v1::setObjects
bool setObjects(const MissingET *pMET, const IParticle *pPart, const MissingETBase::Types::object_vector_t &objectList)
Definition: MissingETComponentMap_v1.cxx:340
MissingETBase::Numerical::invalidIndex
static size_t invalidIndex()
Access invalid index indicator.
Definition: MissingETBase.h:103
xAOD::MissingETComponentMap_v1::pop_back
void pop_back()
xAOD::MissingETComponentMap_v1::f_getIndex
size_t f_getIndex(const IParticle *pPart) const
Definition: MissingETComponentMap_v1.h:225
xAOD::MissingETComponentMap_v1::clear
void clear(SG::OwnershipPolicy ownPolicy, SG::IndexTrackingPolicy trackIndices)
MissingETBase::Types::bitmask_t
uint64_t bitmask_t
Type for status word bit mask.
Definition: MissingETBase.h:39
MissingETBase::UsageHandler::OnlyCluster
@ OnlyCluster
CaloCluster based only.
Definition: MissingETCompositionBase.h:184
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:41
xAOD::MissingETComponentMap_v1::erase
iterator erase(iterator position)
xAOD::MissingETComponentMap_v1::~MissingETComponentMap_v1
virtual ~MissingETComponentMap_v1()
Base class destructor.
Definition: MissingETComponentMap_v1.cxx:41
xAOD::CaloCluster
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
Definition: Event/xAOD/xAODCaloEvent/xAODCaloEvent/CaloCluster.h:19
xAOD::MissingETComponentMap_v1::getObjectIndex
size_t getObjectIndex(const IParticle *pPart) const
Definition: MissingETComponentMap_v1.cxx:369
SG::OwnershipPolicy
OwnershipPolicy
describes the possible element ownership policies (see e.g. DataVector)
Definition: OwnershipPolicy.h:16
xAOD::TrackParticle
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Definition: Event/xAOD/xAODTracking/xAODTracking/TrackParticle.h:13
xAOD::MissingETComponentMap_v1::resize
void resize(size_type sz)
xAOD::MissingETComponentMap_v1::signal_key_t
size_t signal_key_t
Key type for signals (clusters, tracks) is type of index in container.
Definition: MissingETComponentMap_v1.h:188
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
xAOD::MissingETComponentMap_v1::f_clearLookupCache
void f_clearLookupCache()
Clear the lookup cache.
Definition: MissingETComponentMap_v1.cxx:360
ObjectType.h
xAOD::MissingETComponentMap_v1::getComponentIndex
size_t getComponentIndex(const IParticle *pPart) const
Definition: MissingETComponentMap_v1.cxx:368
xAOD::MissingETComponentMap_v1::f_extractSignal
bool f_extractSignal(MissingETBase::Types::object_vector_t &sig) const
Signal type extractor.
Definition: MissingETComponentMap_v1.h:279
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
xAOD::MissingETComponentMap_v1::setTracks
bool setTracks(const MissingET *pMET, const IParticle *pPart, const MissingETBase::Types::object_vector_t &signalList)
Definition: MissingETComponentMap_v1.cxx:308
SG::OWN_ELEMENTS
@ OWN_ELEMENTS
this data object owns its elements
Definition: OwnershipPolicy.h:17
xAOD::MissingETComponentMap_v1::signal_vector_t
std::vector< indexedlink_t > signal_vector_t
Indexed list type for signal object link locations.
Definition: MissingETComponentMap_v1.h:195
xAOD::MissingETComponentMap_v1::f_fillLookupCache
void f_fillLookupCache()
Fill the lookup cache from the composition map data content.
Definition: MissingETComponentMap_v1.cxx:363
python.BuildSignatureFlags.sig
sig
Definition: BuildSignatureFlags.py:218
xAOD::MissingET_v1
Principal data object for Missing ET.
Definition: MissingET_v1.h:25
xAOD::MissingETComponentMap_v1::f_retrieveMissingETIncl
const MissingET * f_retrieveMissingETIncl(MissingETBase::Types::bitmask_t src) const
Definition: MissingETComponentMap_v1.cxx:164
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
xAOD::MissingETComponentMap_v1::findIndex
size_t findIndex(const MissingET *pMET) const
Definition: MissingETComponentMap_v1.cxx:96
MissingETBase::UsageHandler::Policy
Policy
Policies on usage checks.
Definition: MissingETCompositionBase.h:182
MissingET.h
MissingETBase::Types::indexedlink_t
std::tuple< size_t, size_t > indexedlink_t
Type for links defined as index pairs.
Definition: MissingETBase.h:41
xAOD::MissingETComponentMap_v1::addObjects
bool addObjects(const MissingET *pMET, const IParticle *pPart, const MissingETBase::Types::object_vector_t &signalList, MissingETBase::UsageHandler::Policy p=MissingETBase::UsageHandler::OnlyCluster)
Definition: MissingETComponentMap_v1.cxx:257
xAOD::MissingETComponentMap_v1::m_clusterLinks
signal_vector_t m_clusterLinks
Store for linked cluuster signal information lookup.
Definition: MissingETComponentMap_v1.h:212
xAOD::MissingETComponentMap_v1::checkUsage
bool checkUsage(const IParticle *pPart, MissingETBase::UsageHandler::Policy p=MissingETBase::UsageHandler::OnlyCluster) const
Check if a given object is already used in MET.
Definition: MissingETComponentMap_v1.cxx:187
DataVector.h
An STL vector of pointers that by default owns its pointed-to elements.
DeMoScan.first
bool first
Definition: DeMoScan.py:536
MissingETComponentMap_v1.icc
xAOD::MissingETComponentMap_v1::f_setupLookupCache
void f_setupLookupCache(signal_vector_t &signalLinks, size_t reserve)
Set up the signal object lookup.
Definition: MissingETComponentMap_v1.cxx:357
LArNewCalib_DelayDump_OFC_Cali.idx
idx
Definition: LArNewCalib_DelayDump_OFC_Cali.py:69
xAOD::MissingETComponentMap_v1::retrieveMissingET
const MissingET * retrieveMissingET(const std::string &name) const
Retrieve MissingET object by name.
Definition: MissingETComponentMap_v1.cxx:127
xAOD::MissingETComponentMap_v1::clear
void clear(SG::OwnershipPolicy ownPolicy)
xAOD::MissingETComponentMap_v1::f_retrieveMissingETExcl
const MissingET * f_retrieveMissingETExcl(MissingETBase::Types::bitmask_t src) const
Definition: MissingETComponentMap_v1.cxx:146
DataVector< MissingETComponent_v1 >::ownPolicy
SG::OwnershipPolicy ownPolicy() const
Return the ownership policy setting for this container.
DataVector< MissingETComponent_v1 >::size_type
BASE::size_type size_type
Definition: DataVector.h:813
xAOD::MissingETComponentMap_v1::particle_map_t
std::map< particle_key_t, indexedlink_t > particle_map_t
Map type for physics object.
Definition: MissingETComponentMap_v1.h:201
SG::IndexTrackingPolicy
IndexTrackingPolicy
Definition: IndexTrackingPolicy.h:37
MissingETBase::Types::object_vector_t
std::vector< const xAOD::IParticle * > object_vector_t
Vector of object type.
Definition: MissingETCompositionBase.h:59
xAOD::MissingETComponentMap_v1::m_clusterLinkReserve
static const size_t m_clusterLinkReserve
Definition: MissingETComponentMap_v1.h:293