ATLAS Offline Software
Public Member Functions | List of all members
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 More...
 
typedef AssociationObjectIterator object_iterator
 object iterator type More...
 
Store Iterator Types
typedef AssociationVectorIterator asso_iterator
 association iterator type More...
 
typedef AssociationObjectIterator object_iterator
 object iterator type More...
 

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)
 
void addAssociation (const object_container_type *objectContainer, const object_type *objectPointer, const asso_container_type *assoContainer, const asso_type *assoPointer)
 
void addAssociation (const object_link &objectLink, const asso_link &assoLink)
 
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)
 
void addAssociation (const object_container_type *objectContainer, const object_type *objectPointer, const asso_container_type *assoContainer, const asso_type *assoPointer)
 
void addAssociation (const object_link &objectLink, const asso_link &assoLink)
 

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
 

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

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;
}

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;
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;
for( ; assit != assos.end(); ++ assit ){
std::cout << " patCombi " << patCombi << " segCombi " << *assit << std::endl;
}

Definition at line 102 of file MuonSegPatAssMap.h.

Member Typedef Documentation

◆ asso_container_type

Definition at line 53 of file AssociationMap.h.

◆ asso_index_type

Definition at line 58 of file AssociationMap.h.

◆ asso_iterator

association iterator type

Definition at line 81 of file AssociationMap.h.

◆ asso_link

Definition at line 60 of file AssociationMap.h.

◆ asso_list

Definition at line 59 of file AssociationMap.h.

◆ asso_store

Definition at line 61 of file AssociationMap.h.

◆ asso_store_iterator

Definition at line 62 of file AssociationMap.h.

◆ asso_type

Definition at line 54 of file AssociationMap.h.

◆ object_container_type

Definition at line 44 of file AssociationMap.h.

◆ 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

Definition at line 50 of file AssociationMap.h.

◆ object_list

Definition at line 51 of file AssociationMap.h.

◆ object_type

Definition at line 45 of file AssociationMap.h.

◆ store_iterator_type

Definition at line 64 of file AssociationMap.h.

◆ store_type

Definition at line 63 of file AssociationMap.h.

Constructor & Destructor Documentation

◆ MuonSegPatAssMap()

Muon::MuonSegPatAssMap::MuonSegPatAssMap ( )
inline

◆ ~MuonSegPatAssMap()

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

Definition at line 108 of file MuonSegPatAssMap.h.

108 {}

Member Function Documentation

◆ addAssociation() [1/3]

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

◆ addAssociation() [2/3]

void AssociationMap< MuonPatternCombinationCollection , MuonSegmentCombinationCollection >::addAssociation ( const object_container_type objectContainer,
const object_type objectPointer,
const asso_container_type assoContainer,
const asso_type assoPointer 
)
inherited

◆ addAssociation() [3/3]

void AssociationMap< MuonPatternCombinationCollection , MuonSegmentCombinationCollection >::addAssociation ( const object_link objectLink,
const asso_link assoLink 
)
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() [1/2]

◆ beginAssociation() [2/2]

begin iterator for associations

◆ beginObject()

begin iterator for objects

◆ containsAssociation() [1/3]

bool AssociationMap< MuonPatternCombinationCollection , MuonSegmentCombinationCollection >::containsAssociation ( const asso_type assoPointer) const
inherited

◆ containsAssociation() [2/3]

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

containment check

Definition at line 166 of file AssociationMap.h.

168  { return objectIter.containsAssociation(assoPointer); }

◆ containsAssociation() [3/3]

bool AssociationMap< MuonPatternCombinationCollection , MuonSegmentCombinationCollection >::containsAssociation ( const object_type objectPointer,
const asso_type assoPointer 
) const
inherited

◆ containsObject()

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

testing if object is in store

Definition at line 144 of file AssociationMap.h.

145  { return this->findObject(theObject) != this->endObject(); }

◆ endAssociation() [1/2]

◆ endAssociation() [2/2]

end iterator for associations

◆ endObject()

end iterator for objects

◆ findAssociation() [1/2]

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

find association

Definition at line 159 of file AssociationMap.h.

161  { return objectIter.findAssociation(assoPointer); }

◆ findAssociation() [2/2]

asso_iterator AssociationMap< MuonPatternCombinationCollection , MuonSegmentCombinationCollection >::findAssociation ( const object_type objectPointer,
const asso_type assoPointer 
) const
inherited

◆ findObject()

finding an object with allocation

Definition at line 139 of file AssociationMap.h.

141  { return object_iterator(m_associationMap).find(theObject); }

◆ getAssociation()

associations iterator access

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

Definition at line 155 of file AssociationMap.h.

156  { return *assoIter; }

◆ getAssociations() [1/2]

bool AssociationMap< MuonPatternCombinationCollection , MuonSegmentCombinationCollection >::getAssociations ( const object_iterator objIter,
asso_list assocs 
) const
inlineinherited

get all associations for a given object

Definition at line 185 of file AssociationMap.h.

186  { return this->getAssociations(objIter.getObject(),assocs); }

◆ getAssociations() [2/2]

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

get all associations for a given object

◆ getNumberOfAssociations() [1/2]

size_t AssociationMap< MuonPatternCombinationCollection , MuonSegmentCombinationCollection >::getNumberOfAssociations ( const object_iterator objectIter) const
inlineinherited

Definition at line 202 of file AssociationMap.h.

203  { return this->size(objectIter); }

◆ getNumberOfAssociations() [2/2]

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

Definition at line 196 of file AssociationMap.h.

197  { return this->size(objectPointer); }

◆ getNumberOfObjects()

size_t AssociationMap< MuonPatternCombinationCollection , MuonSegmentCombinationCollection >::getNumberOfObjects
inlineinherited

retrieve number of objects in store

Definition at line 148 of file AssociationMap.h.

148 { return this->size(); }

◆ getObject()

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() [1/2]

bool AssociationMap< MuonPatternCombinationCollection , MuonSegmentCombinationCollection >::getObjects ( const asso_iterator assoIter,
object_list theObjects 
) const
inlineinherited

get all objects for a given association

Definition at line 178 of file AssociationMap.h.

179  { return this->getObjects(*assoIter,theObjects); }

◆ getObjects() [2/2]

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 211 of file AssociationMap.h.

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

◆ size() [1/4]

get number of associations

Definition at line 189 of file AssociationMap.h.

189 { return m_associationMap.size(); }

◆ size() [2/4]

get number of associations

Definition at line 192 of file AssociationMap.h.

192 { return m_associationMap.size(); }

◆ size() [3/4]

Definition at line 199 of file AssociationMap.h.

200  { return objectIter.getNumberOfAssociations(); }

◆ size() [4/4]

Member Data Documentation

◆ m_associationMap

internal store

Definition at line 208 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:
AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::store_iterator_type
store_type::iterator store_iterator_type
Definition: AssociationMap.h:64
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AssociationMap::getAssociations
bool getAssociations(const object_type *objPointer, asso_list &assocs) const
get all associations for a given object
Muon::MuonSegmentCombination
Definition: MuonSegmentCombination.h:30
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
patterns
std::vector< std::string > patterns
Definition: listroot.cxx:187
AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Muon::MuonSegPatAssMap
Class stores associations between a MuonPatternCombination and a MuonSegmentCombination.
Definition: MuonSegPatAssMap.h:102
AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::asso_list
std::list< const asso_type * > asso_list
Definition: AssociationMap.h:59
AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::object_iterator
AssociationObjectIterator object_iterator
object iterator type
Definition: AssociationMap.h:84
AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::endObject
object_iterator endObject() const
end iterator for objects
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
DataVector< Muon::MuonPatternCombination >
AssociationMap::addAssociation
void addAssociation(const object_container_type *objectContainer, const object_index_type &objectIndex, const asso_container_type *assoContainer, const asso_index_type &assoIndex)
AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::size
size_t size()
get number of associations
Definition: AssociationMap.h:189
DEBUG
#define DEBUG
Definition: page_access.h:11
AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::findObject
object_iterator findObject(const object_type *theObject) const
finding an object with allocation
Definition: AssociationMap.h:139
python.CaloCondTools.log
log
Definition: CaloCondTools.py:20
AssociationMap::getObjects
bool getObjects(const asso_type *assoPointer, object_list &theObjects) const
get all objects for a given association
AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::m_associationMap
store_type m_associationMap
internal store
Definition: AssociationMap.h:208
Muon::MuonPatternCombination
The MuonPatternCombination class provides the means to store the output of the initial global pattern...
Definition: MuonPatternCombination.h:29
AssociationMap< MuonPatternCombinationCollection, MuonSegmentCombinationCollection >::object_list
std::list< const object_type * > object_list
Definition: AssociationMap.h:51