CbmRoot
CbmStsAlgoFindClusters Class Reference

Algorithm for cluster finding in a linear array of channels. More...

#include <CbmStsAlgoFindClusters.h>

Collaboration diagram for CbmStsAlgoFindClusters:
[legend]

Public Types

typedef std::pair< const CbmStsDigi *, Long64_t > InputData
 Typedef for input data. More...
 

Public Member Functions

 CbmStsAlgoFindClusters ()
 Default constructor. More...
 
virtual ~CbmStsAlgoFindClusters ()
 Destructor. More...
 
Long64_t Exec (const std::vector< InputData > &input, std::vector< CbmStsCluster > &output, UInt_t address, UShort_t nChannels, UShort_t channelOffset, Double_t timeCutSigma, Double_t timeCutAbs, Bool_t connectEdge, const CbmStsParModule *modPar)
 Algorithm execution. More...
 

Private Member Functions

Short_t ChanLeft (UShort_t channel)
 Number of left neighbour channel. More...
 
Short_t ChanRight (UShort_t channel)
 Number of right neighbour channel. More...
 
Bool_t CheckChannel (Short_t channel, Double_t time)
 Check for a matching digi in a given channel. More...
 
void CreateCluster (UShort_t channel)
 Create a cluster from an active channel. More...
 
Bool_t IsActive (Short_t channel)
 Check for a channel being active. More...
 
Bool_t ProcessDigi (UShort_t channel, Double_t time, Int_t index)
 Process one input digi. More...
 

Private Attributes

std::vector< std::pair< Long64_t, Double_t > > fStatus {1024, {-1, 0.}}
 Status buffer. More...
 
std::vector< CbmStsCluster > * fOutput = nullptr
 Pointer to output vector. More...
 
UInt_t fAddress = 0
 Unique module address for clusters. More...
 
UShort_t fNofChannels = 0
 Number of channels. More...
 
UShort_t fChannelOffset = 0
 Number of first channel. More...
 
Double_t fTimeCutSig = 0.
 Time cut in multiples of error. More...
 
Double_t fTimeCutAbs = 0.
 Absolute time cut [ns]. More...
 
Bool_t fConnectEdge = kFALSE
 Connect last and first channel. More...
 
const CbmStsParModulefModPar = nullptr
 

Detailed Description

Algorithm for cluster finding in a linear array of channels.

Author
Volker Friese v.fri.nosp@m.ese@.nosp@m.gsi.d.nosp@m.e
Since
05.04.2017
Date
22.03.2020

Cluster finding is performed in a linear array of channels, corresponding e.g. to one side of a STS sensor / module. A cluster is defined by a group of matching digis. Two digis are considered matching if they are in neighbouring channels and their time difference is less than the chosen limit.

Clustering is performed in a streaming way, i.e. on adding of each digi by the method ProcessDigi. If a cluster in the same or in a neighbour channel is found which does not match the digi, it is written to the output. This makes the runtime of the algorithm independent of input data size, but has as a consequence that the output clusters are not sorted w.r.t. time.

The time resolution is assumed to be the same for all digis and has to be specified to the Exec method. The time cut can be specified in units of the time resolution or in absolute units. The latter, if positive, overrides the former.

Clustering around-the-edge means periodic boundary conditions, i.e., the first and the last channel are considered neighbours.

The digis are connected to the cluster in the order left to right, i.e. with ascending channel number. In case of clustering round the edge, the channel at the right edge is considered left neighbour of the first channel, i.e. the cluster starts with high channel number.

The algorithm is described in: V. Friese, EPJ Web of Conferences 214 (2019) 01008

Definition at line 54 of file CbmStsAlgoFindClusters.h.

Member Typedef Documentation

◆ InputData

typedef std::pair<const CbmStsDigi*, Long64_t> CbmStsAlgoFindClusters::InputData

Typedef for input data.

Definition at line 58 of file CbmStsAlgoFindClusters.h.

Constructor & Destructor Documentation

◆ CbmStsAlgoFindClusters()

CbmStsAlgoFindClusters::CbmStsAlgoFindClusters ( )
inline

Default constructor.

Definition at line 62 of file CbmStsAlgoFindClusters.h.

◆ ~CbmStsAlgoFindClusters()

virtual CbmStsAlgoFindClusters::~CbmStsAlgoFindClusters ( )
inlinevirtual

Destructor.

Definition at line 66 of file CbmStsAlgoFindClusters.h.

Member Function Documentation

◆ ChanLeft()

Short_t CbmStsAlgoFindClusters::ChanLeft ( UShort_t  channel)
inlineprivate

Number of left neighbour channel.

Parameters
channelChannel number
Returns
Number of left neighbour

In case of clustering round-the-edge, the left neighbour of the first channel is the last channel. Otherwise, it is -1.

Definition at line 104 of file CbmStsAlgoFindClusters.h.

References fConnectEdge, and fNofChannels.

Referenced by CreateCluster(), and ProcessDigi().

◆ ChanRight()

Short_t CbmStsAlgoFindClusters::ChanRight ( UShort_t  channel)
inlineprivate

Number of right neighbour channel.

Parameters
channelChannel number
Returns
Number of right neighbour

In case of clustering round-the-edge, the right neighbour of the last channel is the first channel. Otherwise, it is the increment.

Definition at line 117 of file CbmStsAlgoFindClusters.h.

References fConnectEdge, and fNofChannels.

Referenced by CreateCluster(), and ProcessDigi().

◆ CheckChannel()

Bool_t CbmStsAlgoFindClusters::CheckChannel ( Short_t  channel,
Double_t  time 
)
private

Check for a matching digi in a given channel.

Parameters
channelChannel number
timeTime [ns]
Returns
kTRUE if matching digi found

The digi is considered matching if the time difference between the time argument and the time of the active digi in the channel is within the time window defined by the cut value.

Definition at line 23 of file CbmStsAlgoFindClusters.cxx.

References CreateCluster(), fModPar, fNofChannels, fStatus, fTimeCutAbs, fTimeCutSig, CbmStsParModule::GetParAsic(), CbmStsParAsic::GetTimeResol(), and IsActive().

Referenced by ProcessDigi().

◆ CreateCluster()

void CbmStsAlgoFindClusters::CreateCluster ( UShort_t  channel)
private

Create a cluster from an active channel.

Parameters
channelChannel number

Starting from the specified channel, a cluster is created by searching for active neighbours left and right until an inactive channel is found.

No action if the channel is not active.

Definition at line 101 of file CbmStsAlgoFindClusters.cxx.

References ChanLeft(), ChanRight(), fAddress, fConnectEdge, first, fNofChannels, fOutput, fStatus, IsActive(), and CbmCluster::SetAddress().

Referenced by CheckChannel(), and Exec().

◆ Exec()

Long64_t CbmStsAlgoFindClusters::Exec ( const std::vector< InputData > &  input,
std::vector< CbmStsCluster > &  output,
UInt_t  address,
UShort_t  nChannels,
UShort_t  channelOffset,
Double_t  timeCutSigma,
Double_t  timeCutAbs,
Bool_t  connectEdge,
const CbmStsParModule modPar 
)

Algorithm execution.

Parameters
inputVector of input data (pairs of digi and index)
outputVector of output clusters
addressCluster address (module)
nChannelsNumber of channels
channelOffsetNumber of first channel
timeResolTime resolution of digis [ns]
timeCutSigmaTime cut in units of time resolution
timeCutAbsTime cut in ns
connectEdgeIf true, clustering round-the-edge is done.
isBackSideTreat back-side clusters w.r.t. channel number

The channel numbers are assumed to be consecutive, starting with channelOffset. If connectEdge is specififed, the first channel and the last channel are considered neighbours.

Definition at line 55 of file CbmStsAlgoFindClusters.cxx.

References CreateCluster(), fAddress, fChannelOffset, fConnectEdge, fModPar, fNofChannels, fOutput, fStatus, fTimeCutAbs, fTimeCutSig, and ProcessDigi().

Referenced by CbmStsRecoModule::Reconstruct().

◆ IsActive()

Bool_t CbmStsAlgoFindClusters::IsActive ( Short_t  channel)
inlineprivate

Check for a channel being active.

Parameters
channelChannel number
Returns
kTRUE is the channel is active; else kFALSE

Definition at line 151 of file CbmStsAlgoFindClusters.h.

References fNofChannels, and fStatus.

Referenced by CheckChannel(), and CreateCluster().

◆ ProcessDigi()

Bool_t CbmStsAlgoFindClusters::ProcessDigi ( UShort_t  channel,
Double_t  time,
Int_t  index 
)
private

Process one input digi.

Parameters
channelChannel number
timeDigi time [ns]
indexIndex of digi object in its TClonesArray
Returns
kTRUE is digi was successfully processed

Depending on the state of the respective channel, the proper action is taken.

Definition at line 141 of file CbmStsAlgoFindClusters.cxx.

References ChanLeft(), ChanRight(), CheckChannel(), fNofChannels, and fStatus.

Referenced by Exec().

Member Data Documentation

◆ fAddress

UInt_t CbmStsAlgoFindClusters::fAddress = 0
private

Unique module address for clusters.

Definition at line 181 of file CbmStsAlgoFindClusters.h.

Referenced by CreateCluster(), and Exec().

◆ fChannelOffset

UShort_t CbmStsAlgoFindClusters::fChannelOffset = 0
private

Number of first channel.

Definition at line 183 of file CbmStsAlgoFindClusters.h.

Referenced by Exec().

◆ fConnectEdge

Bool_t CbmStsAlgoFindClusters::fConnectEdge = kFALSE
private

Connect last and first channel.

Definition at line 186 of file CbmStsAlgoFindClusters.h.

Referenced by ChanLeft(), ChanRight(), CreateCluster(), and Exec().

◆ fModPar

const CbmStsParModule* CbmStsAlgoFindClusters::fModPar = nullptr
private

Definition at line 187 of file CbmStsAlgoFindClusters.h.

Referenced by CheckChannel(), and Exec().

◆ fNofChannels

UShort_t CbmStsAlgoFindClusters::fNofChannels = 0
private

Number of channels.

Definition at line 182 of file CbmStsAlgoFindClusters.h.

Referenced by ChanLeft(), ChanRight(), CheckChannel(), CreateCluster(), Exec(), IsActive(), and ProcessDigi().

◆ fOutput

std::vector<CbmStsCluster>* CbmStsAlgoFindClusters::fOutput = nullptr
private

Pointer to output vector.

Definition at line 178 of file CbmStsAlgoFindClusters.h.

Referenced by CreateCluster(), and Exec().

◆ fStatus

std::vector<std::pair<Long64_t, Double_t> > CbmStsAlgoFindClusters::fStatus {1024, {-1, 0.}}
private

Status buffer.

The vector index is the channel number. The first element of the content is the digi index, the second one the time.

Definition at line 175 of file CbmStsAlgoFindClusters.h.

Referenced by CheckChannel(), CreateCluster(), Exec(), IsActive(), and ProcessDigi().

◆ fTimeCutAbs

Double_t CbmStsAlgoFindClusters::fTimeCutAbs = 0.
private

Absolute time cut [ns].

Definition at line 185 of file CbmStsAlgoFindClusters.h.

Referenced by CheckChannel(), and Exec().

◆ fTimeCutSig

Double_t CbmStsAlgoFindClusters::fTimeCutSig = 0.
private

Time cut in multiples of error.

Definition at line 184 of file CbmStsAlgoFindClusters.h.

Referenced by CheckChannel(), and Exec().


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