#ifndef TChargeClusters2D_hxx_seen #define TChargeClusters2D_hxx_seen #include #include namespace COMET { class IHitSelection; class IChargeClusters2D; }; /// Cluster hits in a single plane by charge. The charge is clustered in a /// plane based on a simple neighbor algorithm. For hits in a plane, a /// cluster is started based on the hit with the most charge that's not /// already part of a cluster. Hits are then added to the cluster based on /// the distance to the cluster. By default, the detector planes are assumed /// to be normal to the Z axis. class COMET::IChargeClusters2D { public: /// Create a charge clusterer. This takes four optional parameters. The /// xGap and yGap define the maximum distance between adjacent hits /// (default: 3.1 cm). The zPrec defines the precision in the clustering /// plane (default: 1 mm). The plane defines the normal to the clustering /// plane (default: the Z axis). IChargeClusters2D(double xGap=3.1*unit::cm, double yGap=3.1*unit::cm, double zPrec=1*unit::mm, TVector3 plane = TVector3(0.,0.,1.)); virtual ~IChargeClusters2D(); /// Set the cut preventing a high charge hit from being added to a cluster /// based it's proximity to a low charge hit. The hit may still be added /// to the cluster if it is also near to another high-charge hit (which is /// already part of the cluster). void SetChargeRatioCut(double cr) { fChargeRatio = cr; } /// Set the maximum number of hits to be allowed to be clustered together. /// Setting this parameter allows one to prevent the clustering algorithm /// from clustering together, say, 10 hits from a track that goes /// alone a scintillator plane. If the maximum number is exceeded, then /// the constituent hits are saved individually rather than being clustered. void SetMaxHitsToCluster(int mh){ fMaxHitsToCluster = mh;} /// Do the clustering. COMET::IHitSelection* operator()(const COMET::IHitSelection& hits); private: /// The maximum "X" distance between hits that should be clustered. double fXGap; /// The maximum "Y" distance between hits that should be clustered. double fYGap; /// The "Z" precision. This is maximum "Z" distance between hits that are /// considered part of the same plane. double fPrec; /// A vector defining the X basis. TVector3 fXPlane; /// A vector defining the Y basis. TVector3 fYPlane; /// The vector defining the Z basis. This is the normal to the plane in /// which the charge clusters are found. TVector3 fZPlane; /// A cut preventing a high charge hit from being added to a cluster based /// it's proximity to a low charge hit. The hit may still be added to the /// cluster if it is also near to another high-charge hit (which is /// already part of the cluster). double fChargeRatio; /// This value specifies the maximum number of hits to cluster together. /// By default will be set very large. int fMaxHitsToCluster; }; #endif