Skip to content

Commit 8ec1aea

Browse files
authored
Merge branch 'star-bnl:main' into main
2 parents 3048c8d + 0ad5eb6 commit 8ec1aea

240 files changed

Lines changed: 49541 additions & 10547 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/CODEOWNERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
/StRoot/PWGTools @nigmatkulov @zsweger @marrbnl @lbavinh
77
/StRoot/RTS @akioogawa @jml985 @tonko-lj
88
/StRoot/StAnalysisMaker @fisyak @R-Witt @iraklic
9+
/StRoot/*KFP* @fisyak @R-Witt @iraklic
910
/StRoot/StAnalysisUtilities/StHistUtil* @genevb
1011
/StRoot/StAssociationMaker/EMC @kkauder @rkunnawa @Navagyan
1112
/StRoot/StBFChain @genevb @plexoos @klendathu2k @fisyak @R-Witt @iraklic

.github/workflows/build-pull-request.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ on:
88
- '!.github/workflows/**'
99

1010
concurrency:
11-
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
group: ${{ github.workflow }}-x[${{ github.event.pull_request.number || github.ref }}
1212
cancel-in-progress: true
1313

1414
jobs:
1515
build:
1616
runs-on: ubuntu-latest
1717
strategy:
18+
fail-fast: false
1819
matrix:
1920
starenv: [root5, root6]
2021
compiler: [gcc485, gcc11]
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
/*
2+
* This file is part of KFParticle package
3+
* Copyright (C) 2007-2019 FIAS Frankfurt Institute for Advanced Studies
4+
* 2007-2019 Goethe University of Frankfurt
5+
* 2007-2019 Ivan Kisel <I.Kisel@compeng.uni-frankfurt.de>
6+
* 2007-2019 Maksym Zyzak
7+
*
8+
* KFParticle is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* KFParticle is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*/
21+
22+
#include "KFPEmcCluster.h"
23+
#include <iostream>
24+
25+
void KFPEmcCluster::SetParameter(const float32_v& value, int iP, int iTr)
26+
{
27+
/** Copies the SIMD vector "value" to the parameter vector KFPEmcCluster::fP[iP]
28+
** starting at the position "iTr".
29+
** \param[in] value - SIMD vector with the values to be stored
30+
** \param[in] iP - number of the parameter vector
31+
** \param[in] iTr - starting position in the parameter vector where the values should be stored
32+
**/
33+
if( (iTr+SimdLen) < Size())
34+
reinterpret_cast<float32_v&>(fP[iP][iTr]) = value;
35+
else
36+
{
37+
int32_v index = int32_v::indicesSequence();
38+
index = select(index<(Size() - iTr), index, 0);
39+
(reinterpret_cast<float32_v&>(fP[iP][iTr])).gather(reinterpret_cast<const float*>(&value), index);
40+
}
41+
}
42+
void KFPEmcCluster::SetCovariance(const float32_v& value, int iC, int iTr)
43+
{
44+
/** Copies the SIMD vector "value" to the element of the covariance matrix vector KFPEmcCluster::fC[iC]
45+
** starting at the position "iTr".
46+
** \param[in] value - SIMD vector with the values to be stored
47+
** \param[in] iC - number of the element of the covariance matrix
48+
** \param[in] iTr - starting position in the parameter vector where the values should be stored
49+
**/
50+
if( (iTr+SimdLen) < Size())
51+
reinterpret_cast<float32_v&>(fC[iC][iTr]) = value;
52+
else
53+
{
54+
int32_v index = int32_v::indicesSequence();
55+
index = select(index<(Size() - iTr), index, 0);
56+
(reinterpret_cast<float32_v&>(fC[iC][iTr])).gather(reinterpret_cast<const float*>(&value), index);
57+
}
58+
}
59+
60+
void KFPEmcCluster::Resize(const int n)
61+
{
62+
/** Resizes all vectors in the class to a given value.
63+
** \param[in] n - new size of the vector
64+
**/
65+
for(int i=0; i<4; i++)
66+
fP[i].resize(n);
67+
for(int i=0; i<10; i++)
68+
fC[i].resize(n);
69+
fId.resize(n);
70+
}
71+
72+
void KFPEmcCluster::Set(KFPEmcCluster& v, int vSize, int offset)
73+
{
74+
/** Copies "vSize" clusters from the KFPEmcCluster "v" to the current object.
75+
** Tracks are put starting from the "offset" position.
76+
** \param[in] v - external KFPEmcCluster with input clusters to be copied
77+
** \param[in] vSize - number of clusters to be copied from "v"
78+
** \param[in] offset - offset position in the current object, starting from which input clusters will be stored
79+
**/
80+
for(int iV=0; iV<vSize; iV++)
81+
{
82+
for(int i=0; i<4; i++)
83+
fP[i][offset+iV] = v.fP[i][iV];
84+
for(int i=0; i<10; i++)
85+
fC[i][offset+iV] = v.fC[i][iV];
86+
fId[offset+iV] = v.fId[iV];
87+
}
88+
}
89+
90+
void KFPEmcCluster::SetTracks(const KFPEmcCluster& track, const kfvector_int& trackIndex, const int nIndexes)
91+
{
92+
/** The current object is resised to "nIndexes", clusters with indices "trackIndex" are copied to the current object.
93+
** \param[in] track - input vector of clusters
94+
** \param[in] trackIndex - indices of clusters in a vector "track", which should be stored to the current object
95+
** \param[in] nIndexes - number of clusters to be copied, defines the new size of the current object
96+
**/
97+
98+
if(nIndexes == 0) return;
99+
100+
Resize(nIndexes);
101+
102+
for(int iP=0; iP<4; iP++)
103+
{
104+
int iElement = 0;
105+
for(iElement=0; iElement<nIndexes-SimdLen; iElement += SimdLen)
106+
{
107+
const int32_v& index = reinterpret_cast<const int32_v&>(trackIndex[iElement]);
108+
float32_v& vec = reinterpret_cast<float32_v&>(fP[iP][iElement]);
109+
vec.gather(&(track.fP[iP][0]), index);
110+
}
111+
const int32_v& index = reinterpret_cast<const int32_v&>(trackIndex[iElement]);
112+
float32_v& vec = reinterpret_cast<float32_v&>(fP[iP][iElement]);
113+
const int32_v correctedIndices = select(int32_v::indicesSequence(iElement)<nIndexes, index, 0);
114+
vec.gather(&(track.fP[iP][0]), correctedIndices);
115+
}
116+
for(int iC=0; iC<10; iC++)
117+
{
118+
int iElement=0;
119+
for(iElement=0; iElement<nIndexes-SimdLen; iElement += SimdLen)
120+
{
121+
const int32_v& index = reinterpret_cast<const int32_v&>(trackIndex[iElement]);
122+
float32_v& vec = reinterpret_cast<float32_v&>(fC[iC][iElement]);
123+
vec.gather(&(track.fC[iC][0]), index);
124+
}
125+
const int32_v& index = reinterpret_cast<const int32_v&>(trackIndex[iElement]);
126+
float32_v& vec = reinterpret_cast<float32_v&>(fC[iC][iElement]);
127+
const int32_v correctedIndices = select(int32_v::indicesSequence(iElement)<nIndexes, index, 0);
128+
vec.gather(&(track.fC[iC][0]), correctedIndices);
129+
}
130+
{
131+
int iElement=0;
132+
for(iElement=0; iElement<nIndexes-SimdLen; iElement += SimdLen)
133+
{
134+
const int32_v& index = reinterpret_cast<const int32_v&>(trackIndex[iElement]);
135+
int32_v& vec = reinterpret_cast<int32_v&>(fId[iElement]);
136+
vec.gather(&(track.fId[0]), index);
137+
}
138+
const int32_v& index = reinterpret_cast<const int32_v&>(trackIndex[iElement]);
139+
int32_v& vec = reinterpret_cast<int32_v&>(fId[iElement]);
140+
const int32_v correctedIndices = select(int32_v::indicesSequence(iElement)<nIndexes, index, 0);
141+
vec.gather(&(track.fId[0]), correctedIndices);
142+
}
143+
}
144+
145+
void KFPEmcCluster::PrintTrack(int n)
146+
{
147+
/** Prints parameters of the cluster with index "n".
148+
** \param[in] n - index of cluster to be printed
149+
**/
150+
for(int i=0; i<4; i++)
151+
std::cout << fP[i][n] << " ";
152+
std::cout << std::endl;
153+
for(int i=0; i<10; i++)
154+
std::cout << fC[i][n] << " ";
155+
std::cout << std::endl;
156+
157+
std::cout << fId[n] << std::endl;
158+
}
159+
160+
void KFPEmcCluster::PrintTracks()
161+
{
162+
/** Prints all field of the current object. **/
163+
164+
std::cout << "NTracks " << Size() << std::endl;
165+
if( Size()==0 ) return;
166+
167+
std::cout << "Parameters: " << std::endl;
168+
for(int iP=0; iP<4; iP++)
169+
{
170+
std::cout << " iP " << iP << ": ";
171+
for(int iTr=0; iTr<Size(); iTr++)
172+
std::cout << Parameter(iP)[iTr]<< " ";
173+
std::cout << std::endl;
174+
}
175+
176+
std::cout << "Cov matrix: " << std::endl;
177+
for(int iC=0; iC<10; iC++)
178+
{
179+
std::cout << " iC " << iC << ": ";
180+
for(int iTr=0; iTr<Size(); iTr++)
181+
std::cout << Covariance(iC)[iTr]<< " ";
182+
std::cout << std::endl;
183+
}
184+
185+
std::cout << "Id: " << std::endl;
186+
for(int iTr=0; iTr<Size(); iTr++)
187+
std::cout << Id()[iTr] << " ";
188+
std::cout << std::endl;
189+
}
190+

StRoot/KFParticle/KFPEmcCluster.h

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/*
2+
* This file is part of KFParticle package
3+
* Copyright (C) 2007-2019 FIAS Frankfurt Institute for Advanced Studies
4+
* 2007-2019 Goethe University of Frankfurt
5+
* 2007-2019 Ivan Kisel <I.Kisel@compeng.uni-frankfurt.de>
6+
* 2007-2019 Maksym Zyzak
7+
*
8+
* KFParticle is free software: you can redistribute it and/or modify
9+
* it under the terms of the GNU General Public License as published by
10+
* the Free Software Foundation, either version 3 of the License, or
11+
* (at your option) any later version.
12+
*
13+
* KFParticle is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU General Public License for more details.
17+
*
18+
* You should have received a copy of the GNU General Public License
19+
* along with this program. If not, see <https://www.gnu.org/licenses/>.
20+
*/
21+
22+
#ifndef KFPEmcCluster_H
23+
#define KFPEmcCluster_H
24+
25+
#include "KFParticleDef.h"
26+
27+
/** @class KFPEmcCluster
28+
** @brief A class to store vectors of input cluster from the electro-magnetic calorimeter.
29+
** @author M.Zyzak, I.Kisel
30+
** @date 05.02.2019
31+
** @version 1.0
32+
**
33+
** A cluster is described with the state vector { X, Y, Z, E }
34+
** and the corresponding covariance matrix. Also contains a unique id.
35+
** The data model implemented in the class is "Structure Of Arrays":
36+
** each parameter is stroed in a separate vector. Such data structure
37+
** allows fast vectorised access to the aligned data providing the
38+
** maximum possible speed for data reading, and at the same time easy
39+
** random access to the data members.
40+
**/
41+
42+
class KFPEmcCluster
43+
{
44+
public:
45+
KFPEmcCluster():fP(), fC(), fId() { }
46+
~KFPEmcCluster() {}
47+
48+
/**Returns size of the vectors. All data vectors have the same size. */
49+
int Size() const { return fP[0].size(); }
50+
51+
void Resize(const int n);
52+
void Set(KFPEmcCluster& v, int vSize, int offset);
53+
void SetTracks(const KFPEmcCluster& track, const kfvector_int& trackIndex, const int nIndexes);
54+
55+
const kfvector_float& X() const { return fP[0]; } ///< Returns constant reference to the vector with X coordinates.
56+
const kfvector_float& Y() const { return fP[1]; } ///< Returns constant reference to the vector with Y coordinates.
57+
const kfvector_float& Z() const { return fP[2]; } ///< Returns constant reference to the vector with Z coordinates.
58+
const kfvector_float& E() const { return fP[3]; } ///< Returns constant reference to the vector with energy of the cluster.
59+
60+
const kfvector_float& Parameter(const int i) const { return fP[i]; } ///< Returns constant reference to the parameter vector with index "i".
61+
const kfvector_float& Covariance(const int i) const { return fC[i]; } ///< Returns constant reference to the vector of the covariance matrix elements with index "i".
62+
const kfvector_int& Id() const { return fId; } ///< Returns constant reference to the vector with unique id of the clusters.
63+
64+
//modifiers
65+
void SetParameter (float value, int iP, int iTr) { fP[iP][iTr] = value; } ///< Sets the "value" of the parameter "iP" of the cluster with index "iTr".
66+
void SetCovariance(float value, int iC, int iTr) { fC[iC][iTr] = value; } ///< Sets the "value" of the element of covariance matrix "iC" of the cluster with index "iTr".
67+
68+
void SetParameter (const float32_v& value, int iP, int iTr);
69+
void SetCovariance(const float32_v& value, int iC, int iTr);
70+
71+
void SetId (int value, int iTr) { fId[iTr] = value; } ///< Sets the "value" of the id of the cluster with index "iTr".
72+
73+
void PrintTrack(int n);
74+
void PrintTracks();
75+
76+
KFPEmcCluster(const KFPEmcCluster& clusters): fId()
77+
{
78+
/** Copy-constructor. Makes one-to-one copy.*/
79+
const int localSize = clusters.Size();
80+
81+
for(int i=0; i<4; i++)
82+
{
83+
fP[i].resize(localSize);
84+
for(int n=0; n<localSize; n++)
85+
fP[i][n] = clusters.fP[i][n];
86+
}
87+
88+
for(int i=0; i<10; i++)
89+
{
90+
fC[i].resize(localSize);
91+
for(int n=0; n<localSize; n++)
92+
fC[i][n] = clusters.fC[i][n];
93+
}
94+
95+
fId.resize(localSize);
96+
for(int n=0; n<localSize; n++)
97+
fId[n] = clusters.fId[n];
98+
}
99+
100+
const KFPEmcCluster& operator = (const KFPEmcCluster& clusters)
101+
{
102+
/** Operator to copy one KFPEmcCluster object to another. Makes one-to-one copy.*/
103+
const int localSize = clusters.Size();
104+
105+
for(int i=0; i<4; i++)
106+
{
107+
fP[i].resize(localSize);
108+
for(int n=0; n<localSize; n++)
109+
fP[i][n] = clusters.fP[i][n];
110+
}
111+
112+
for(int i=0; i<10; i++)
113+
{
114+
fC[i].resize(localSize);
115+
for(int n=0; n<localSize; n++)
116+
fC[i][n] = clusters.fC[i][n];
117+
}
118+
119+
fId.resize(localSize);
120+
for(int n=0; n<localSize; n++)
121+
fId[n] = clusters.fId[n];
122+
123+
return *this;
124+
}
125+
126+
private:
127+
kfvector_float fP[4]; ///< Coordinates of the cluster and energy: X, Y, Z, E.
128+
kfvector_float fC[10]; ///< Covariance matrix of the parameters of the cluster.
129+
130+
kfvector_int fId; ///< Vector with unique ids of the clusters.
131+
};
132+
133+
#endif

0 commit comments

Comments
 (0)