StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
Public Member Functions | List of all members
StiDetectorContainer Class Reference

#include <StiDetectorContainer.h>

Inheritance diagram for StiDetectorContainer:
Named Described

Public Member Functions

 StiDetectorContainer (const string &name, const string &description, StiMasterDetectorBuilder *)
 
void initialize ()
 
virtual void build (StiDetectorBuilder *builder)
 Builds the detector tree given a pointer to the detector builder. More...
 
const StiDetectorNoderoot () const
 Get the root detector node of this tree.
 
void add (StiDetector *det)
 Add a detector element to the sorted vector.
 
void reset ()
 This performs a full internal reset of interator structure. More...
 
void unset ()
 
void clear ()
 
StiDetectoroperator* () const
 Dereference current iterator and return a pointer to current StiDetector.
 
StiDetectorgetCurrentDetector () const
 
bool moveIn (double phiCut=-1.0, double zCut=-1.0, double rMin=-1.0)
 Step in radially in STAR TPC global coordinates. More...
 
void setToDetector (const StiDetector *layer)
 Set iterators to the detector nearest to the passed StiDetector pointer. More...
 
vector< StiDetector * > & getDetectors ()
 
vector< StiDetector * > & getDetectors (Filter< StiDetector > &filter)
 
StiMasterDetectorBuildergetDetectorBuilder ()
 
vector< StiDetector * >
::const_iterator 
begin () const
 
vector< StiDetector * >
::const_iterator 
end () const
 
vector< StiDetector * >::iterator begin ()
 
vector< StiDetector * >::iterator end ()
 
vector< StiDetectorNode * >
::const_iterator 
beginRadial (const StiDetector *detector)
 
vector< StiDetectorNode * >
::const_iterator 
endRadial ()
 
vector< StiDetectorNode * >
::reverse_iterator 
rbeginRadial (const StiDetector *detector)
 
StiDetectorNodeVector::const_reverse_iterator rendRadial ()
 
StiDetectorNodeVector::const_iterator beginPhi (StiDetectorNodeVector::const_iterator &radialIterator)
 
StiDetectorNodeVector::const_iterator endPhi (StiDetectorNodeVector::const_iterator &radialIterator)
 
StiDetectorNodeVector::const_iterator beginPhi (StiDetectorNodeVector::const_reverse_iterator &radialIterator)
 
StiDetectorNodeVector::const_iterator endPhi (StiDetectorNodeVector::const_reverse_iterator &radialIterator)
 
- Public Member Functions inherited from Named
void setName (const string &newName)
 Set the name of the object.
 
const string & getName () const
 Get the name of the object.
 
bool isName (const string &aName) const
 Determine whether name equals given name.
 
- Public Member Functions inherited from Described
void setDescription (const string &description)
 Set the Describe of the object.
 
const string getDescription () const
 Get the Describe of the object.
 
bool isDescribed () const
 Determine whether Describe is set, i.e object has a Describe.
 
bool isDescription (const string &description) const
 Determine whether Describe equals given Describe.
 
bool sameDescriptionAs (const Described &described) const
 Determine whether Describe equals that of given object.
 

Additional Inherited Members

- Protected Member Functions inherited from Named
 Named (const string &aName=" ")
 Only derived class are Named.
 
- Protected Member Functions inherited from Described
 Described (const string &aDescribe=" ")
 Only derived class are Described.
 
- Protected Attributes inherited from Named
string _name
 
- Protected Attributes inherited from Described
string _description
 

Detailed Description

StiDetectorContainer is an interface to the representation of the STAR detector material. It is an implementation of the 'facade' pattern. That is, it is meant to provide an unchanging interface to the detector model while the actual underlying reperesntation of the detector itself can change. In reality, the underlying model has undergone at least five significant changes, while the public interface of StiDetectorContainer has remained constant.

Because there is only one STAR detector, there is also only one instance of StiDetectorContainer. This is guarunteed by implementing StiDetectorContainer via the singelton design pattern. See the example below for more information on singleton access.

StiDetectorContainer behaves as an iterator. That is, once built it always points to a valid StiDetector object, which can be accessed via: *(StiDetectorContainer::instance()). One can set the location of the current detector position via the setToDetector() methods.

Internally, the STAR detector is modeld as a sorted tree structurere implemented via StiCompositeTreeNode objects. Additionally, StiDetectorContainer uses an instance of StiCompositeLeafIterator to implement the setToDetector() methods. However, the navigation methods (e.g., moveIn()) are implemented by using the sorted nature of the tree structure. As such, moveIn(), moveOut(), movePlusPhi(), and moveMinusPhi() require no searching or expensive computation. Instead, they are implemented via simple increment (++) or decrement (–) of STL random access iterators provided by StiCompositeTreeNode. Therefore, once StiDetectorContainer is initialized for propogation via a setToDetector() call, navigation should be extremely efficient.

Author
M.L. Miller (Yale Software)
Warning
You do not have to call StiDetectorContainer::kill() to avoid a memory leak. When you call kill(), you invalidate all pre-existing pointers to instance(). Because termination of program execution will automatically clean up the heap, it is generally good practice not to call kill().

Definition at line 69 of file StiDetectorContainer.h.

Member Function Documentation

void StiDetectorContainer::build ( StiDetectorBuilder builder)
virtual

Builds the detector tree given a pointer to the detector builder.

Recursively load all detector definition files from the given directory.

There is internal protection to avoid building the detector representation more than once.

Definition at line 211 of file StiDetectorContainer.cxx.

References StiDetectorTreeBuilder::build(), and Named::getName().

bool StiDetectorContainer::moveIn ( double  phiCut = -1.0,
double  zCut = -1.0,
double  rMin = -1.0 
)

Step in radially in STAR TPC global coordinates.

A call to moveIn() may not always alter the StiDetector to which the

container points. Notably, if there is nowhere else to 'move in to', then moveIn() will have no action. So, to see if the action succeeded, one must store a pointer to the StiDetector represented by the current state of the container, call moveIn(), and then check that the pointer to the StiDetector represented by the new state of the container is different than that of the previous state.

Additionally, when a call to moveIn() is made, the container 'selects' the StiDetector object that is closest in phi to the StiDetector object that is being 'movedIn' from. Therefore, a call to moveIn() usually need not be followed by a call to movePlusPhi() or moveMinusPhi(), except in cases of extreme assymetry, such as navigation through the Silicon Vertex Tracker.

Definition at line 143 of file StiDetectorContainer.cxx.

References StiCompositeTreeNode< T >::getChildCount(), StiCompositeTreeNode< T >::getData(), StiCompositeTreeNode< T >::getOrderKey(), and StiCompositeTreeNode< T >::getParent().

Referenced by StiLocalTrackSeedFinder::extendHit(), StiLocalTrackSeedFinder::extrapolate(), and StiKalmanTrack::getAllPointCount().

void StiDetectorContainer::reset ( void  )

This performs a full internal reset of interator structure.

A call to reset simply sets the pointer to the default StiDetector object. It does not alter the state of the detector model.

Definition at line 100 of file StiDetectorContainer.cxx.

References StiCompositeTreeNode< T >::begin(), and StiCompositeTreeNode< T >::end().

Referenced by StiKalmanTrackFinder::reset().

void StiDetectorContainer::setToDetector ( const StiDetector layer)

Set iterators to the detector nearest to the passed StiDetector pointer.

This is used, e.g., to set the iterators to a certain point in

preparation for propogation of a new track. If no StiDetector pointer is found that is equal to layer, then an error message is streamed to the screen and reset() is called.

Definition at line 92 of file StiDetectorContainer.cxx.

Referenced by StiLocalTrackSeedFinder::extendHit(), StiLocalTrackSeedFinder::extrapolate(), and StiKalmanTrack::getAllPointCount().


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