Skip to content

Commit dcc5126

Browse files
wiechulashahor02
authored andcommitted
TPC: add merge function
1 parent 12da037 commit dcc5126

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

Detectors/TPC/qc/include/TPCQC/Clusters.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ class Clusters
5555

5656
void reset();
5757

58+
void merge(const Clusters& clusters);
59+
5860
void dumpToFile(std::string filename);
5961

6062
const CalPad& getNClusters() const { return mNClusters; }

Detectors/TPC/qc/src/Clusters.cxx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,26 @@ void Clusters::reset()
131131
mTimeBin = 0;
132132
}
133133

134+
//______________________________________________________________________________
135+
void Clusters::merge(const Clusters& clusters)
136+
{
137+
const bool isNormalized = mIsNormalized;
138+
if (isNormalized) {
139+
denormalize();
140+
}
141+
142+
mNClusters += clusters.mNClusters;
143+
mQMax += clusters.mQMax;
144+
mQTot += clusters.mQTot;
145+
mSigmaTime += clusters.mSigmaTime;
146+
mSigmaPad += clusters.mSigmaPad;
147+
mTimeBin += clusters.mTimeBin;
148+
149+
if (isNormalized) {
150+
normalize();
151+
}
152+
}
153+
134154
//______________________________________________________________________________
135155
void Clusters::dumpToFile(std::string filename)
136156
{

0 commit comments

Comments
 (0)