Belle II Software development
RawCluster Class Reference

Class representing a raw cluster candidate during clustering of the SVD. More...

#include <RawCluster.h>

Public Member Functions

 RawCluster ()
 Default Constructor to create an empty RawCluster.
 
 RawCluster (VxdID vxdID, bool isUside, double cutSeed, double cutAdjacent)
 Constructor to create an empty RawCluster.
 
 RawCluster (VxdID vxdID, bool isUside, double cutSeed, double cutAdjacent, const std::string &storeShaperDigitsName)
 You can specify the name of StoreArray<SVDShaperDigit> which are needed to get clustered samples.
 
bool add (VxdID vxdID, bool isUside, struct StripInRawCluster &aStrip)
 Add a Strip to the current cluster.
 
bool isGoodRawCluster ()
 
VxdID getSensorID () const
 
bool isUSide () const
 
Belle2::SVDShaperDigit::APVFloatSamples getClsSamples (bool inElectrons) const
 
std::pair< int, std::vector< float > > getMaxSum3Samples (bool inElectrons=false) const
 
int getSize () const
 
const std::vector< StripInRawClustergetStripsInRawCluster () const
 
int getSeedMaxSample () const
 
int getSeedInternalIndex () const
 
void setStripCharge (int index, double charge)
 set the strip charge
 
void setStripTime (int index, double time)
 set the strip time
 

Protected Attributes

VxdID m_vxdID
 VxdID of the cluster.
 
bool m_isUside
 side of the cluster
 
double m_cutSeed = 5
 SNR above which the strip can be considered as seed.
 
double m_cutAdjacent = 3
 SNR above which the strip can be considered for clustering.
 
int m_seedMaxSample = -1
 ADC MaxSample of the seed strip.
 
float m_seedSNR = -1
 SNR (using MaxSample) of the seed strip.
 
int m_seedIndex = -1
 SVDShaperDigit index of the seed strip of the cluster.
 
int m_seedInternalIndex = -1
 stripsInRawCluster index of the seed strip of the cluster
 
std::vector< StripInRawClusterm_strips
 vector containing the strips in the cluster
 
std::string m_storeShaperDigitsName
 Name of the collection to use for the SVDShaperDigits.
 

Detailed Description

Class representing a raw cluster candidate during clustering of the SVD.

Definition at line 33 of file RawCluster.h.

Constructor & Destructor Documentation

◆ RawCluster() [1/3]

RawCluster ( )
inline

Default Constructor to create an empty RawCluster.

Definition at line 40 of file RawCluster.h.

40{};

◆ RawCluster() [2/3]

RawCluster ( VxdID  vxdID,
bool  isUside,
double  cutSeed,
double  cutAdjacent 
)

Constructor to create an empty RawCluster.

Parameters
vxdIDsensorID
isUsidetrue if the RawCluster is on the U-side
cutSeedminimum SNR of the seed strip
cutAdjacentminimum SNR of a strip belonging to the cluster

Definition at line 30 of file RawCluster.cc.

31 : m_vxdID(vxdID)
32 , m_isUside(isUside)
33 , m_cutSeed(cutSeed)
34 , m_cutAdjacent(cutAdjacent)
35 , m_seedMaxSample(-1)
36 , m_seedSNR(-1)
37 , m_seedIndex(-1)
39 , m_storeShaperDigitsName("SVDShaperDigits")
40 {m_strips.clear();};
std::string m_storeShaperDigitsName
Name of the collection to use for the SVDShaperDigits.
Definition: RawCluster.h:165
int m_seedInternalIndex
stripsInRawCluster index of the seed strip of the cluster
Definition: RawCluster.h:159
bool m_isUside
side of the cluster
Definition: RawCluster.h:141
VxdID m_vxdID
VxdID of the cluster.
Definition: RawCluster.h:138
float m_seedSNR
SNR (using MaxSample) of the seed strip.
Definition: RawCluster.h:153
int m_seedMaxSample
ADC MaxSample of the seed strip.
Definition: RawCluster.h:150
double m_cutSeed
SNR above which the strip can be considered as seed.
Definition: RawCluster.h:144
int m_seedIndex
SVDShaperDigit index of the seed strip of the cluster.
Definition: RawCluster.h:156
std::vector< StripInRawCluster > m_strips
vector containing the strips in the cluster
Definition: RawCluster.h:162
double m_cutAdjacent
SNR above which the strip can be considered for clustering.
Definition: RawCluster.h:147

◆ RawCluster() [3/3]

RawCluster ( VxdID  vxdID,
bool  isUside,
double  cutSeed,
double  cutAdjacent,
const std::string &  storeShaperDigitsName 
)

You can specify the name of StoreArray<SVDShaperDigit> which are needed to get clustered samples.

Parameters
vxdIDsensorID
isUsidetrue if the RawCluster is on the U-side
cutSeedminimum SNR of the seed strip
cutAdjacentminimum SNR of a strip belonging to the cluster
storeShaperDigitsNamename of the SVDShaperDigit StoreArray

Definition at line 42 of file RawCluster.cc.

43 : m_vxdID(vxdID)
44 , m_isUside(isUside)
45 , m_cutSeed(cutSeed)
46 , m_cutAdjacent(cutAdjacent)
47 , m_seedMaxSample(-1)
48 , m_seedSNR(-1)
49 , m_seedIndex(-1)
51 , m_storeShaperDigitsName(storeShaperDigitsName)
52 {m_strips.clear();};

Member Function Documentation

◆ add()

bool add ( VxdID  vxdID,
bool  isUside,
struct StripInRawCluster aStrip 
)

Add a Strip to the current cluster.

Update the cluster seed strip.

Parameters
vxdIDsensorID
isUsidetrue if the RawCluster is on the U-side
aStripthe raw strip to be added to the cluster
Returns
true if the strip is on the expected side and sensor and it's next to the last strip added to the cluster candidate

Definition at line 54 of file RawCluster.cc.

55 {
56
57 bool added = false;
58
59 //do not add if you are on the wrong sensor or side
60 if ((m_vxdID != vxdID) || (m_isUside != isUside))
61 return false;
62
63 //do not add if its SNR is below the minimum SNR for adjacents strips
64 if ((float)aStrip.maxSample / aStrip.noise < m_cutAdjacent)
65 return false;
66
67 //add if it's the first strip
68 if (m_strips.size() == 0)
69 added = true;
70
71 //add if it is adjacent to the last strip added
72 //(we assume that SVDShaperDigits are ordered)
73 if ((m_strips.size() > 0 && (aStrip.cellID == m_strips.at(m_strips.size() - 1).cellID + 1)))
74 added = true;
75
76 //add it to the vector of strips, update the seed max sample and index:
77 if (added) {
78 m_strips.push_back(aStrip);
79
80 if (aStrip.maxSample > m_seedMaxSample) {
81 m_seedMaxSample = aStrip.maxSample;
82 m_seedSNR = (float)aStrip.maxSample / (float)aStrip.noise;
83 m_seedInternalIndex = m_strips.size() - 1;
84 m_seedIndex = aStrip.shaperDigitIndex;
85 }
86 }
87 return added;
88
89 };

◆ getClsSamples()

Belle2::SVDShaperDigit::APVFloatSamples getClsSamples ( bool  inElectrons) const
Parameters
inElectronsif true samples are returned in electrons instead of ADC
Returns
the APVFloatSamples obtained summing sample-by-sample all the strips on the cluster

Definition at line 104 of file RawCluster.cc.

105 {
106
107 if (m_strips.size() == 0)
108 B2ERROR("oopps ... you are asking for the cluster samples of a cluster candidate with no strips");
109
110 //steps:
111 //1.loop on m_strips
112 //2. access the index of the shaperdigit from the element of m_strip
113 //3. sum each sample for each strip accessed in the loop
114 //4. you are done
115
116 Belle2::SVDShaperDigit::APVFloatSamples returnSamples = {0, 0, 0, 0, 0, 0};
117
118 const StoreArray<SVDShaperDigit> m_storeShaperDigits(m_storeShaperDigitsName.c_str());
119
120 SVDPulseShapeCalibrations pulseShapeCal;
121
122 for (auto istrip : m_strips) {
123 const SVDShaperDigit* shaperdigit = m_storeShaperDigits[istrip.shaperDigitIndex];
124 if (!shaperdigit) B2ERROR("No SVDShaperDigit for this strip! Are you sure you set the correct SVDShaperDigit StoreArray name?");
125 Belle2::SVDShaperDigit::APVFloatSamples APVsamples = shaperdigit->getSamples();
126 for (int iSample = 0; iSample < static_cast<int>(APVsamples.size()); ++iSample)
127 if (inElectrons)
128 returnSamples.at(iSample) += pulseShapeCal.getChargeFromADC(m_vxdID, m_isUside, shaperdigit->getCellID(), APVsamples.at(iSample));
129 else
130 returnSamples.at(iSample) += APVsamples.at(iSample);
131 }
132
133
134 return returnSamples;
135 }
std::array< APVFloatSampleType, c_nAPVSamples > APVFloatSamples
array of APVFloatSampleType objects

◆ getMaxSum3Samples()

std::pair< int, std::vector< float > > getMaxSum3Samples ( bool  inElectrons = false) const
Parameters
inElectronsif true samples are returned in electrons instead of ADC
Returns
the float vector of clustered 3-samples selected by the MaxSum method with First Frame of the selection

Definition at line 137 of file RawCluster.cc.

138 {
139
140 //take the cluster samples
142
143 SVDMaxSumAlgorithm maxSum = SVDMaxSumAlgorithm(clsSamples);
144 return std::make_pair(maxSum.getFirstFrame(), maxSum.getSelectedSamples());
145
146 }
Belle2::SVDShaperDigit::APVFloatSamples getClsSamples(bool inElectrons) const
Definition: RawCluster.cc:104

◆ getSeedInternalIndex()

int getSeedInternalIndex ( ) const
inline
Returns
the internal index (in the stripsInRawCluster vector) of the seed strip

Definition at line 120 of file RawCluster.h.

120{return m_seedInternalIndex;};

◆ getSeedMaxSample()

int getSeedMaxSample ( ) const
inline
Returns
the max sample (in ADC) of the seed strip

Definition at line 115 of file RawCluster.h.

115{return m_seedMaxSample;};

◆ getSensorID()

VxdID getSensorID ( ) const
inline
Returns
the VxdID of the cluster sensor

Definition at line 80 of file RawCluster.h.

80{return m_vxdID;}

◆ getSize()

int getSize ( ) const
inline
Returns
the cluster size (number of strips of the cluster)

Definition at line 105 of file RawCluster.h.

105{ return m_strips.size(); }

◆ getStripsInRawCluster()

const std::vector< StripInRawCluster > getStripsInRawCluster ( ) const
inline
Returns
the vector of the strips in the cluster

Definition at line 110 of file RawCluster.h.

110{ return m_strips; };

◆ isGoodRawCluster()

bool isGoodRawCluster ( )
Returns
true if the raw cluster candidate can be promoted to raw cluster (seedMaxSample > 0 and seedSNR > cutSeed)

Definition at line 92 of file RawCluster.cc.

93 {
94
95 bool isGood = false;
96
98 isGood = true;
99
100 return isGood;
101 };

◆ isUSide()

bool isUSide ( ) const
inline
Returns
true if the cluster is on the U/P side

Definition at line 85 of file RawCluster.h.

85{return m_isUside;}

◆ setStripCharge()

void setStripCharge ( int  index,
double  charge 
)
inline

set the strip charge

Parameters
indexof the strip in the cluster
chargeof the strip

Definition at line 127 of file RawCluster.h.

127{m_strips.at(index).charge = charge;}
double charge(int pdgCode)
Returns electric charge of a particle with given pdg code.
Definition: EvtPDLUtil.cc:44

◆ setStripTime()

void setStripTime ( int  index,
double  time 
)
inline

set the strip time

Parameters
indexof the strip in the cluster
timeof the strip

Definition at line 133 of file RawCluster.h.

133{m_strips.at(index).time = time;}

Member Data Documentation

◆ m_cutAdjacent

double m_cutAdjacent = 3
protected

SNR above which the strip can be considered for clustering.

Definition at line 147 of file RawCluster.h.

◆ m_cutSeed

double m_cutSeed = 5
protected

SNR above which the strip can be considered as seed.

Definition at line 144 of file RawCluster.h.

◆ m_isUside

bool m_isUside
protected

side of the cluster

Definition at line 141 of file RawCluster.h.

◆ m_seedIndex

int m_seedIndex = -1
protected

SVDShaperDigit index of the seed strip of the cluster.

Definition at line 156 of file RawCluster.h.

◆ m_seedInternalIndex

int m_seedInternalIndex = -1
protected

stripsInRawCluster index of the seed strip of the cluster

Definition at line 159 of file RawCluster.h.

◆ m_seedMaxSample

int m_seedMaxSample = -1
protected

ADC MaxSample of the seed strip.

Definition at line 150 of file RawCluster.h.

◆ m_seedSNR

float m_seedSNR = -1
protected

SNR (using MaxSample) of the seed strip.

Definition at line 153 of file RawCluster.h.

◆ m_storeShaperDigitsName

std::string m_storeShaperDigitsName
protected

Name of the collection to use for the SVDShaperDigits.

Definition at line 165 of file RawCluster.h.

◆ m_strips

std::vector<StripInRawCluster> m_strips
protected

vector containing the strips in the cluster

Definition at line 162 of file RawCluster.h.

◆ m_vxdID

VxdID m_vxdID
protected

VxdID of the cluster.

Definition at line 138 of file RawCluster.h.


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