AssociationManager class

This class has been provided as an interim solution to the association problem.

It provides an implemetation of a general templated association mechanism which allows any object which inherits from ContainedObject (A Gauid special class used for items in the TES) to store a reference to any other such object .

The associations are set is a simple manner with the associate(..) method.

A user can then subsequently retrieve a SmartRefVector containing SmartRefs to all stored associations or to a subset selected by class type. Templates have been used to avoid the user having to cast ContainedObject to specific classes in the latter case. The examples should make this clear.

Every user class which wishes to use this mechanism simply inherits AssociationManager publically.
 
Include file: "AtlfastCode/AssociationManager.h "

Source code:    .cxx

 

Return type Method name Description
void  associate( ContainedObject* ) Used to set associations from this object to any another which inherits from ContainedObject.
SmartRefVector<ContainedObject> associations( )  Returns a SmartRefVector containing SmartRefs to all objects with which this object has been associated. The user must do the Type recovery themselves and cast appropriately
SmartRefVector<T> template< Class T > 
associations( T requiredType )
More useful accees method. User requests all associations to class type T. The return contains SmartRefs to T directly (no need to cast)
bool unAssociated( ) Quick way to check if there are NO associations set at all. Returns true in such case.
 
 
Source code ??????

Examples:

1) To set an association from an electron to a cluster

    ReconstructedParticle   particle( 11, .....rest of constructor arguments .....) ;

    Cluster   c( ....constructor arguments .... ) ;

    // Set electron->cluster
    particle.associate( c ) ;

    //set cluster ->electron if required
    c.associate( particle ) ;
 
 

2) To retrieve all associations

    SmartRefVector<ContainedObject>  localList ;

    localList = particle.associations( ) ;
 
Now the user passes over local List to do what you want.   Probably not very useful.
 
 

2) To retrieve all associations of a of a specific Type (say CLusters)

    SmartRefVector<Cluster>  associatedClusters ;

    associatedClusters = particle.associations( Cluster() ) ;
 
associatedClusters now contains SmartRefs to any clusters which were associaated with particle.
 

Uses so far: