ATLAS Offline Software
Loading...
Searching...
No Matches
Muon::MuonSegPatAssMap Class Reference

Class stores associations between a MuonPatternCombination and a MuonSegmentCombination. More...

#include <MuonSegPatAssMap.h>

Inheritance diagram for Muon::MuonSegPatAssMap:
Collaboration diagram for Muon::MuonSegPatAssMap:

Public Types

Store Iterator Types
typedef AssociationVectorIterator asso_iterator
 association iterator type
typedef AssociationObjectIterator object_iterator
 object iterator type

Public Member Functions

 MuonSegPatAssMap ()
virtual ~MuonSegPatAssMap ()
Add Associations
Parameters
objectContainer- pointer to the object container
objectIndex- index of object in container
objectPointer- pointer to object
assoContainer- container of potentially associated objects
assoIndex- index of associated object in container
assoPointer- pointer to associated object
void addAssociation (const object_container_type *objectContainer, const object_index_type &objectIndex, const asso_container_type *assoContainer, const asso_index_type &assoIndex)

Object and Association Iterators

The association iterators are returned for a given object, which can either be referenced by its pointer or its iterator in the internal store.

Parameters
objectPointer- pointer to a given object
objectIter- iterator to a given object
object_iterator beginObject () const
 begin iterator for objects
object_iterator endObject () const
 end iterator for objects
asso_iterator beginAssociation (const object_type *objectPointer) const
 begin iterator for associations
asso_iterator endAssociation (const object_type *objectPointer) const
 end iterator for associations
const object_typegetObject (const object_iterator &objectIter) const
 get association iterators by object iterator
object_iterator findObject (const object_type *theObject) const
 finding an object with allocation
bool containsObject (const object_type *theObject) const
 testing if object is in store
size_t getNumberOfObjects () const
 retrieve number of objects in store
const asso_typegetAssociation (asso_iterator assoIter) const
 associations iterator access
asso_iterator findAssociation (const object_iterator &objectIter, const asso_type *assoPointer) const
 find association
bool containsAssociation (const object_iterator &objectIter, const asso_type *assoPointer) const
 containment check
bool getObjects (const asso_type *assoPointer, object_list &theObjects) const
 get all objects for a given association
bool getAssociations (const object_type *objPointer, asso_list &assocs) const
 get all associations for a given object
size_t size ()
 get number of associations
size_t getNumberOfAssociations (const object_type *objectPointer) const
store_type m_associationMap
 internal store
store_iterator_type internalFind (const object_link &objectLink, const asso_link &assoLink)
 internally used find method
bool addToStore (const object_link &objectLink, const asso_link &assoLink)
 internally used function to add links to store

Argument and Internal Store Types

typedef MuonPatternCombinationCollection object_container_type
typedef object_container_type::base_value_type object_type
typedef SG::GenerateIndexingPolicy< object_container_type >::type::index_type object_index_type
typedef ElementLink< object_container_typeobject_link
typedef std::list< const object_type * > object_list
typedef MuonSegmentCombinationCollection asso_container_type
typedef asso_container_type::base_value_type asso_type
typedef SG::GenerateIndexingPolicy< asso_container_type >::type::index_type asso_index_type
typedef std::list< const asso_type * > asso_list
typedef ElementLink< asso_container_typeasso_link
typedef ElementLinkVector< asso_container_typeasso_store
typedef asso_store::const_iterator asso_store_iterator
typedef std::map< object_link, asso_storestore_type
typedef store_type::iterator store_iterator_type
static const asso_store s_dum_asso_store

Detailed Description

Class stores associations between a MuonPatternCombination and a MuonSegmentCombination.

Author
Niels van Eldik niels.nosp@m..van.nosp@m..eldi.nosp@m.k@ce.nosp@m.rn.ch

MuonSegPatAssMap Usage

Creating a new map:

// create a new association map to store the link between pattern and segment combinations
// pointer to the MuonPatternCombinationCollection...
const MuonPatternCombinationCollection* patCombiCol = ....;
// pointer to the MuonSegmentCombinationCollection
MuonSegmentCombinationCollection* segCombiCol = .....;
// calculate the position of the current MuonPatternCombination and MuonSegmentCombination
int patCombiIndex = ....;
int segCombiIndex = ....;
// create link between pattern and segment combination
assMap->addAssociation( patterns, patIndex , combiCol, segCombiIndex );
// storing the map for further usage
if( m_storeGate->record(assMap,"MyMuonSegPatAssociations").isSuccess() ){
log << MSG::DEBUG << "stored MuonSegPatAssociations " << endmsg;
}else{
log << MSG::DEBUG << "Failed to store MuonSegPatAssociations " << endmsg;
}
#define endmsg
DataVector< Muon::MuonPatternCombination > MuonPatternCombinationCollection
This typedef represents a collection of MuonPatternCombination objects.
DataVector< Muon::MuonSegmentCombination > MuonSegmentCombinationCollection
This typedef represents a collection of MuonSegmentCombination objects.
void addAssociation(const object_container_type *objectContainer, const object_index_type &objectIndex, const asso_container_type *assoContainer, const asso_index_type &assoIndex)
Class stores associations between a MuonPatternCombination and a MuonSegmentCombination.
std::vector< std::string > patterns
Definition listroot.cxx:187

Using the map:

// retieve your map
const Muon::MuonSegPatAssMap* assMap = 0;
StatusCode sc = m_storeGate->retrieve(assMap,"MyMuonSegPatAssociations");
if (sc.isFailure() ) {
log << MSG::ERROR << " Could not find MuonSegPatAssociations at " << "MyMuonSegPatAssociations" <<endmsg;
return StatusCode::SUCCESS;
}else{
log << MSG::INFO << " Retrieved MuonSegPatAssociations " << endmsg;
}
// the map supports the assocation of multiple patCombis with a given segCombi and visa versa
// find associated patCombis for a given segCombi
// get pointer to your combi..
const Muon::MuonSegmentCombination* segCombi = ...;
// look up
assMap->getObjects( combi, assos );
std::cout << " found association " << assos.size() << std::endl;
Muon::MuonSegPatAssMap::object_list::iterator assit = assos.begin();
for( ; assit != assos.end(); ++ assit ){
std::cout << " segCombi " << segCombi << " patCombi " << *assit << std::endl;
}
// find associated segCombis for a given patCombi
// get pointer to your combi..
const Muon::MuonPatternCombination* patCombi = ...;
assMap->getAssociations( patCombi, assos );
std::cout << " found association " << assos.size() << std::endl;
Muon::MuonSegPatAssMap::asso_list::iterator assit = assos.begin();
for( ; assit != assos.end(); ++ assit ){
std::cout << " patCombi " << patCombi << " segCombi " << *assit << std::endl;
}
static Double_t sc
bool getAssociations(const object_type *objPointer, asso_list &assocs) const
get all associations for a given object
bool getObjects(const asso_type *assoPointer, object_list &theObjects) const
get all objects for a given association
Class to hold a set of MuonSegments belonging together.

Definition at line 102 of file MuonSegPatAssMap.h.

Member Typedef Documentation

◆ asso_container_type

◆ asso_index_type

Definition at line 58 of file AssociationMap.h.

◆ asso_iterator

typedef AssociationVectorIterator AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::asso_iterator
inherited

association iterator type

Definition at line 81 of file AssociationMap.h.

◆ asso_link

◆ asso_list

Definition at line 59 of file AssociationMap.h.

◆ asso_store

◆ asso_store_iterator

◆ asso_type

◆ object_container_type

◆ object_index_type

Definition at line 49 of file AssociationMap.h.

◆ object_iterator

object iterator type

Definition at line 84 of file AssociationMap.h.

◆ object_link

◆ object_list

Definition at line 51 of file AssociationMap.h.

◆ object_type

◆ store_iterator_type

typedef store_type::iterator AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::store_iterator_type
inherited

Definition at line 64 of file AssociationMap.h.

◆ store_type

Definition at line 63 of file AssociationMap.h.

Constructor & Destructor Documentation

◆ MuonSegPatAssMap()

◆ ~MuonSegPatAssMap()

virtual Muon::MuonSegPatAssMap::~MuonSegPatAssMap ( )
inlinevirtual

Definition at line 108 of file MuonSegPatAssMap.h.

108{}

Member Function Documentation

◆ addAssociation()

void AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::addAssociation ( const object_container_type * objectContainer,
const object_index_type & objectIndex,
const asso_container_type * assoContainer,
const asso_index_type & assoIndex )
inherited

◆ addToStore()

bool AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::addToStore ( const object_link & objectLink,
const asso_link & assoLink )
protectedinherited

internally used function to add links to store

◆ beginAssociation()

asso_iterator AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::beginAssociation ( const object_type * objectPointer) const
inherited

begin iterator for associations

◆ beginObject()

begin iterator for objects

◆ containsAssociation()

bool AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::containsAssociation ( const object_iterator & objectIter,
const asso_type * assoPointer ) const
inlineinherited

containment check

Definition at line 165 of file AssociationMap.h.

templated base class for a look-up map for associations
bool containsAssociation(const object_iterator &objectIter, const asso_type *assoPointer) const
containment check

◆ containsObject()

bool AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::containsObject ( const object_type * theObject) const
inlineinherited

testing if object is in store

Definition at line 143 of file AssociationMap.h.

◆ endAssociation()

end iterator for associations

◆ endObject()

end iterator for objects

◆ findAssociation()

asso_iterator AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::findAssociation ( const object_iterator & objectIter,
const asso_type * assoPointer ) const
inlineinherited

find association

Definition at line 158 of file AssociationMap.h.

asso_iterator findAssociation(const object_iterator &objectIter, const asso_type *assoPointer) const
find association

◆ findObject()

◆ getAssociation()

const asso_type * AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::getAssociation ( asso_iterator assoIter) const
inlineinherited

associations iterator access

The associations are accessed as function of the row key (the object).

Definition at line 154 of file AssociationMap.h.

155 { return *assoIter; }

◆ getAssociations()

bool AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::getAssociations ( const object_type * objPointer,
asso_list & assocs ) const
inherited

get all associations for a given object

◆ getNumberOfAssociations()

size_t AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::getNumberOfAssociations ( const object_type * objectPointer) const
inlineinherited

◆ getNumberOfObjects()

size_t AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::getNumberOfObjects ( ) const
inlineinherited

retrieve number of objects in store

Definition at line 147 of file AssociationMap.h.

147{ return this->size(); }

◆ getObject()

const object_type * AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::getObject ( const object_iterator & objectIter) const
inlineinherited

get association iterators by object iterator

type-safe retrieval of object pointer from iterator

Definition at line 135 of file AssociationMap.h.

136 { return (*objectIter).getObject(); }

◆ getObjects()

bool AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::getObjects ( const asso_type * assoPointer,
object_list & theObjects ) const
inherited

get all objects for a given association

◆ internalFind()

store_iterator_type AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::internalFind ( const object_link & objectLink,
const asso_link & assoLink )
inlineprotectedinherited

internally used find method

Definition at line 210 of file AssociationMap.h.

212 {
213 // check key
217 iMap != mapEnd;
218 ++iMap ) {
219 // look for the address of the pointed-at object
220 // must dereference the ElementLink pointer
221 if ( iMap->first.cptr() == objectLink.cptr() ) {
222 foundIter = iMap;
223 break;
224 }
225 }
226
227 if ( foundIter == m_associationMap.end() ) { return foundIter; }
228 // check data
229 if ( std::find((foundIter->second).begin(),
230 (foundIter->second).end(),
231 assoLink) !=
232 (foundIter->second).end() )
233 { return foundIter; }
234 // not found at all
235 return m_associationMap.end();
236 }

◆ size()

get number of associations

Definition at line 188 of file AssociationMap.h.

188{ return m_associationMap.size(); }

Member Data Documentation

◆ m_associationMap

internal store

Definition at line 207 of file AssociationMap.h.

◆ s_dum_asso_store

Definition at line 68 of file AssociationMap.h.


The documentation for this class was generated from the following file: