// ClusterFinder.cpp #include "ClusterFinder.h" #include "ClusterContainerStandard.h" using trf::ClusterList; using trf::ClusterContainer; using trf::ClusterContainerStandard; using trf::ClusterFinder; //********************************************************************** // Class data. //********************************************************************** ClusterContainerStandard _box; //********************************************************************** // Free functions. //********************************************************************** namespace { // Creator. ObjPtr create_ClusterFinder(const ObjData& data) { return ObjPtr(0); } } //********************************************************************** // Member functions. //********************************************************************** // constructor ClusterFinder::ClusterFinder() : _def1(false), _def2(false) { } //********************************************************************** // destructor ClusterFinder::~ClusterFinder() { } //********************************************************************** // Return the creator. ObjCreator ClusterFinder::get_creator() { return create_ClusterFinder; } //********************************************************************** // Default implementation for track version of get_clusters. The // default implementation calls the cut recorder version of this // method with null pointers, plus a check to abort if there is an // infinite loop. ClusterList ClusterFinder::get_clusters(const ETrack& tre) const { _def1 = true; assert(!_def2); if(_def2) abort(); return get_clusters_with_records(tre, 0, 0); } //********************************************************************** // Default implementation for track version of get_clusters with cut // records. The default implementation calls the non-cut-recorder // version of this method, plus a check for an infinite loop. ClusterList ClusterFinder::get_clusters_with_records(const ETrack& tre, const CutRecord* pcut_record, std::map< ClusterPtr, CutRecord*>* precs) const { _def2 = true; assert(!_def1); if(_def1) abort(); return get_clusters(tre); } //********************************************************************** // Default implementation for fetching clusters near a track. const ClusterContainer& ClusterFinder::get_cluster_container( const ETrack& tre, const CutRecord* pcut_record, std::map< ClusterPtr, CutRecord*>* precs) const { _box.drop_clusters(); _box.add_clusters(get_clusters_with_records(tre, pcut_record, precs)); return _box; } //**********************************************************************