ATTPCROOT  0.3.0-alpha
A ROOT-based framework for analyzing data from active target detectors
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
AtHitCluster Class Reference

: Class representing a cluster of hits that arise from the same deposition of charge in space. Or at least, that is the assumtion that underlies the math in the class. More...

#include <AtHitCluster.h>

Inheritance diagram for AtHitCluster:
Inheritance graph
[legend]
Collaboration diagram for AtHitCluster:
Collaboration graph
[legend]

Public Member Functions

 AtHitCluster ()
 
 AtHitCluster (const AtHitCluster &cluster)=default
 
virtual ~AtHitCluster ()=default
 
virtual std::unique_ptr< AtHitClone () override
 
void SetCovMatrix (TMatrixDSym matrix)
 
void SetCovMatrix (int i, int j, double val)
 Sets the cov[i,j] = cov[j,i] = val. More...
 
virtual void SetPositionVariance (const XYZVector &vec) override
 
void SetLength (Double_t length)
 
void SetClusterID (Int_t id)
 
virtual void AddHit (const AtHit &hit)
 Add hit to cluster. More...
 
Double_t GetLength () const
 
XYZPoint GetPositionCharge () const
 
const TMatrixDSym & GetCovMatrix () const
 
const TMatrixDSym & GetCovNumerator () const
 
Int_t GetClusterID () const
 
Int_t GetClusterSize () const
 
- Public Member Functions inherited from AtHit
 AtHit (Int_t hitID=-1)
 
 AtHit (Int_t padNum, XYZPoint location, Double_t charge)
 
 AtHit (Int_t hitID, Int_t padNum, XYZPoint location, Double_t charge)
 
 AtHit (const AtHit &)=default
 
 AtHit (AtHit &&)=default
 
AtHitoperator= (const AtHit &)=default
 
AtHitoperator= (AtHit &&)=default
 
virtual ~AtHit ()=default
 
H5::CompType GetHDF5Type ()
 Returns the type specification of a hit. More...
 
void SetCharge (Double_t charge)
 
void SetChargeVariance (Double_t chargeVar)
 
void SetPosition (const XYZPoint &pos)
 
void SetHitID (Int_t hitID)
 
void SetPadNum (Int_t padNum)
 
void SetTraceIntegral (Double_t integral)
 
void SetHitMult (Int_t HitMult)
 
void SetTimeStamp (Int_t Time)
 
void SetTimeStampCorr (Double_t TimeCorr)
 
void SetTimeStampCorrInter (Double_t TimeCorrInter)
 
void AddMCSimPoint (const AtHit::MCSimPoint &point)
 
Int_t GetHitID () const
 
const XYZPointGetPosition () const
 
const XYZVectorGetPositionVariance () const
 
XYZVector GetPositionSigma () const
 
Double_t GetCharge () const
 
Int_t GetPadNum () const
 
Double_t GetTraceIntegral () const
 
Int_t GetHitMult () const
 
Int_t GetTimeStamp () const
 
Double_t GetTimeStampCorr () const
 
Double_t GetTimeStampCorrInter () const
 
const std::vector< AtHit::MCSimPoint > & GetMCSimPointArray () const
 
 ClassDef (AtHit, 5)
 

Protected Member Functions

template<class A , class B >
XYZVector ElementMult (const A &a, const B &b)
 
template<class A , class B >
XYZVector ElementDiv (const A &a, const B &b)
 
template<class T >
ElementInvert (const T &b)
 
void updateWeightsAndCharge (const AtHit &hit)
 
void updatePosition (const AtHit &hit)
 
void updateCovariance (const AtHit &hit)
 
 ClassDefOverride (AtHitCluster, 4)
 

Protected Attributes

Int_t fClusterID {-1}
 
TMatrixDSym fCovMatrix {3}
 
TMatrixDSym fCovNumerator {3}
 
XYZVector fTotalWeight {0, 0, 0}
 
XYZVector fTotalWeight2 {0, 0, 0}
 
XYZVector fWeight {0, 0, 0}
 
XYZPoint fPositionCharge {0, 0, 0}
 
XYZPoint fPositionChargeOld {0, 0, 0}
 
XYZVector fPositionOld {0, 0, 0}
 
Double_t fLength {-999}
 
Int_t fClusterSize {0}
 
- Protected Attributes inherited from AtHit
Double_t fCharge
 
Double_t fChargeVariance {0}
 
XYZPoint fPosition
 
XYZVector fPositionVariance {}
 
Int_t fHitID
 
Int_t fPadNum
 
Double_t fTraceIntegral {-1}
 
Int_t fHitMult {1}
 
Int_t fTimeStamp {0}
 
Double_t fTimeStampCorr {0}
 
Double_t fTimeStampCorrInter {0}
 
std::vector< AtHit::MCSimPointfMCSimPointArray
 

Additional Inherited Members

- Public Types inherited from AtHit
using XYZPoint = ROOT::Math::XYZPoint
 
using XYZVector = ROOT::Math::XYZVector
 
- Static Public Member Functions inherited from AtHit
static Bool_t SortHit (const AtHit &lhs, const AtHit &rhs)
 
static Bool_t SortHit (const std::unique_ptr< AtHit > &lhs, const std::unique_ptr< AtHit > &rhs)
 
static Bool_t SortHitTimePtr (const std::unique_ptr< AtHit > &lhs, const std::unique_ptr< AtHit > &rhs)
 
static Bool_t SortHitTime (const AtHit &lhs, const AtHit &rhs)
 

Detailed Description

: Class representing a cluster of hits that arise from the same deposition of charge in space. Or at least, that is the assumtion that underlies the math in the class.

Will update the position, charge, variance, and covariance as additional hits are added to the cluster. The variance is calcualted using both frequency weights (the charge) and reliability weights (the inverse of the position variance of the hit). The covariance is calculated just using the frequency weights (charge) w.r.t. the charge-weighted estimator for the true mean (not the frequency and reliability estimator of the mean). Eventually, I will sit down and work out a recursive expression for the covariance using the best estimate of the mean instead of just their charge weighted.

The covariance and matrix can also be manually set like the old version of the class.

Three positions are stored in the cluster: fPositionFull is the position using the full information(charge and hit position variance). fPositionCharge is the position from just charge weighting. fPosition is the position without any weighting applied.

Definition at line 37 of file AtHitCluster.h.

Constructor & Destructor Documentation

◆ AtHitCluster() [1/2]

AtHitCluster::AtHitCluster ( )

Definition at line 22 of file AtHitCluster.cxx.

◆ AtHitCluster() [2/2]

AtHitCluster::AtHitCluster ( const AtHitCluster cluster)
default

◆ ~AtHitCluster()

virtual AtHitCluster::~AtHitCluster ( )
virtualdefault

Member Function Documentation

◆ AddHit()

void AtHitCluster::AddHit ( const AtHit hit)
virtual

Add hit to cluster.

Adds a hit, updating the clusters position and charge. As well as the covariance matrix. The variance is updated using the charge-weighted variance of the passed hit. The off diagonal elements of the covariance matrix are updated according to the "standard" textbook definition of the covariance matrix $ COV_{x,y} = \frac{\Sigma_i^N (x_i - \hat{x})(y_i - \hat{y})}{N-1}$.

The on diagonal elements of the covariance matrix (i.e. the variance) are updated assuming both a charge weighting, and a "reliablility" weighting from the variance in the position of the hits used to construct the hit cluster.

Reimplemented in AtHitClusterFull.

Definition at line 52 of file AtHitCluster.cxx.

◆ ClassDefOverride()

AtHitCluster::ClassDefOverride ( AtHitCluster  ,
 
)
protected

◆ Clone()

std::unique_ptr< AtHit > AtHitCluster::Clone ( )
overridevirtual

Reimplemented from AtHit.

Reimplemented in AtHitClusterFull.

Definition at line 17 of file AtHitCluster.cxx.

◆ ElementDiv()

template<class A , class B >
XYZVector AtHitCluster::ElementDiv ( const A &  a,
const B &  b 
)
inlineprotected

Definition at line 88 of file AtHitCluster.h.

◆ ElementInvert()

template<class T >
T AtHitCluster::ElementInvert ( const T &  b)
inlineprotected

Definition at line 93 of file AtHitCluster.h.

◆ ElementMult()

template<class A , class B >
XYZVector AtHitCluster::ElementMult ( const A &  a,
const B &  b 
)
inlineprotected

Definition at line 83 of file AtHitCluster.h.

◆ GetClusterID()

Int_t AtHitCluster::GetClusterID ( ) const
inline

Definition at line 78 of file AtHitCluster.h.

◆ GetClusterSize()

Int_t AtHitCluster::GetClusterSize ( ) const
inline

Definition at line 79 of file AtHitCluster.h.

◆ GetCovMatrix()

const TMatrixDSym& AtHitCluster::GetCovMatrix ( ) const
inline

Definition at line 75 of file AtHitCluster.h.

◆ GetCovNumerator()

const TMatrixDSym& AtHitCluster::GetCovNumerator ( ) const
inline

Definition at line 76 of file AtHitCluster.h.

◆ GetLength()

Double_t AtHitCluster::GetLength ( ) const
inline

Definition at line 72 of file AtHitCluster.h.

◆ GetPositionCharge()

XYZPoint AtHitCluster::GetPositionCharge ( ) const
inline

Definition at line 73 of file AtHitCluster.h.

◆ SetClusterID()

void AtHitCluster::SetClusterID ( Int_t  id)
inline

Definition at line 69 of file AtHitCluster.h.

◆ SetCovMatrix() [1/2]

void AtHitCluster::SetCovMatrix ( int  i,
int  j,
double  val 
)

Sets the cov[i,j] = cov[j,i] = val.

Definition at line 32 of file AtHitCluster.cxx.

◆ SetCovMatrix() [2/2]

void AtHitCluster::SetCovMatrix ( TMatrixDSym  matrix)
inline

Definition at line 65 of file AtHitCluster.h.

◆ SetLength()

void AtHitCluster::SetLength ( Double_t  length)
inline

Definition at line 68 of file AtHitCluster.h.

◆ SetPositionVariance()

void AtHitCluster::SetPositionVariance ( const XYZVector vec)
overridevirtual

Reimplemented from AtHit.

Definition at line 149 of file AtHitCluster.cxx.

◆ updateCovariance()

void AtHitCluster::updateCovariance ( const AtHit hit)
protected

Updates the off diagonal covariance numerator according to eqn 15 and the off diagonal variance according to eqn 24. Updates the diagonal elements of the covariance according to eqns 20 and 24

Definition at line 66 of file AtHitCluster.cxx.

◆ updatePosition()

void AtHitCluster::updatePosition ( const AtHit hit)
protected

Update the position based on eqn 21.

Parameters
[in]hitHit to update the position with

Definition at line 113 of file AtHitCluster.cxx.

◆ updateWeightsAndCharge()

void AtHitCluster::updateWeightsAndCharge ( const AtHit hit)
protected
Parameters
[in]hitHit to add to the wights
Returns
weight of hit (1/var *q)

Definition at line 129 of file AtHitCluster.cxx.

Member Data Documentation

◆ fClusterID

Int_t AtHitCluster::fClusterID {-1}
protected

Definition at line 39 of file AtHitCluster.h.

◆ fClusterSize

Int_t AtHitCluster::fClusterSize {0}
protected

Definition at line 57 of file AtHitCluster.h.

◆ fCovMatrix

TMatrixDSym AtHitCluster::fCovMatrix {3}
protected

Definition at line 42 of file AtHitCluster.h.

◆ fCovNumerator

TMatrixDSym AtHitCluster::fCovNumerator {3}
protected

Definition at line 45 of file AtHitCluster.h.

◆ fLength

Double_t AtHitCluster::fLength {-999}
protected

Definition at line 56 of file AtHitCluster.h.

◆ fPositionCharge

XYZPoint AtHitCluster::fPositionCharge {0, 0, 0}
protected

Definition at line 52 of file AtHitCluster.h.

◆ fPositionChargeOld

XYZPoint AtHitCluster::fPositionChargeOld {0, 0, 0}
protected

Definition at line 53 of file AtHitCluster.h.

◆ fPositionOld

XYZVector AtHitCluster::fPositionOld {0, 0, 0}
protected

Definition at line 54 of file AtHitCluster.h.

◆ fTotalWeight

XYZVector AtHitCluster::fTotalWeight {0, 0, 0}
protected

Definition at line 48 of file AtHitCluster.h.

◆ fTotalWeight2

XYZVector AtHitCluster::fTotalWeight2 {0, 0, 0}
protected

Definition at line 49 of file AtHitCluster.h.

◆ fWeight

XYZVector AtHitCluster::fWeight {0, 0, 0}
protected

Definition at line 50 of file AtHitCluster.h.


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