ATLAS Offline Software
Classes | Public Member Functions | Private Types | Private Attributes | List of all members
MuonCombined::MuonTagToSegMap Class Reference

#include <MuonTagToSegMap.h>

Collaboration diagram for MuonCombined::MuonTagToSegMap:

Classes

struct  SegmentLink
 Helper struct to cache the mapping between the segment in the store gate, that's associated with the TagBase & the one that will be written on disk The index parameters decodes the position of the persistent segment in its correpsonding container. More...
 

Public Member Functions

 MuonTagToSegMap ()=default
 
 ~MuonTagToSegMap ()=default
 
unsigned int persistify (const Muon::MuonSegment *assoc_seg, Trk::SegmentCollection *container)
 Pushes back the segment cached in the store gate back to the new segment container meant for write-out, if the segment has not already been added to the container. More...
 
std::set< const Trk::Segment * > getPersistifiedSegments () const
 Returns the set of all store gate segments that were persitified. More...
 
unsigned int linkIndex (const Trk::Segment *storegate) const
 Returns the index of the persistent in the output container In case, that the segment has not been persistified yet, -1 is returned. More...
 

Private Types

using LinkMap = std::vector< SegmentLink >
 

Private Attributes

LinkMap m_map {}
 

Detailed Description

Definition at line 21 of file MuonTagToSegMap.h.

Member Typedef Documentation

◆ LinkMap

Definition at line 53 of file MuonTagToSegMap.h.

Constructor & Destructor Documentation

◆ MuonTagToSegMap()

MuonCombined::MuonTagToSegMap::MuonTagToSegMap ( )
default

◆ ~MuonTagToSegMap()

MuonCombined::MuonTagToSegMap::~MuonTagToSegMap ( )
default

Member Function Documentation

◆ getPersistifiedSegments()

std::set< const Trk::Segment * > MuonCombined::MuonTagToSegMap::getPersistifiedSegments ( ) const

Returns the set of all store gate segments that were persitified.

Definition at line 27 of file MuonTagToSegMap.cxx.

27  {
28  std::set<const Trk::Segment*> ret;
29  for (const SegmentLink& link : m_map) ret.insert(link.storegate);
30  return ret;
31  }

◆ linkIndex()

unsigned int MuonCombined::MuonTagToSegMap::linkIndex ( const Trk::Segment storegate) const

Returns the index of the persistent in the output container In case, that the segment has not been persistified yet, -1 is returned.

Definition at line 19 of file MuonTagToSegMap.cxx.

19  {
20  LinkMap::const_iterator itr =
21  std::find_if(m_map.begin(), m_map.end(), [storegate](const SegmentLink& link) { return link.storegate == storegate; });
22  if (itr != m_map.end()) return itr->index;
23  return -1;
24  }

◆ persistify()

unsigned int MuonCombined::MuonTagToSegMap::persistify ( const Muon::MuonSegment assoc_seg,
Trk::SegmentCollection container 
)

Pushes back the segment cached in the store gate back to the new segment container meant for write-out, if the segment has not already been added to the container.

Returns the position index of the new segment in the container

Definition at line 9 of file MuonTagToSegMap.cxx.

9  {
10  unsigned int curr_size = container->size();
11  unsigned int test_stored = linkIndex(assoc_seg);
12  if (test_stored < curr_size) return test_stored;
13  std::unique_ptr<Muon::MuonSegment> copy = std::make_unique<Muon::MuonSegment>(*assoc_seg);
14  m_map.emplace_back(assoc_seg, copy.get(), curr_size);
15  container->push_back(std::move(copy));
16  return curr_size;
17  }

Member Data Documentation

◆ m_map

LinkMap MuonCombined::MuonTagToSegMap::m_map {}
private

Definition at line 54 of file MuonTagToSegMap.h.


The documentation for this class was generated from the following files:
MuonCombined::MuonTagToSegMap::linkIndex
unsigned int linkIndex(const Trk::Segment *storegate) const
Returns the index of the persistent in the output container In case, that the segment has not been pe...
Definition: MuonTagToSegMap.cxx:19
ret
T ret(T t)
Definition: rootspy.cxx:260
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
MuonCombined::MuonTagToSegMap::m_map
LinkMap m_map
Definition: MuonTagToSegMap.h:54
calibdata.copy
bool copy
Definition: calibdata.py:27
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.