17#if !defined(GPUCA_NO_ROOT) && !defined(GPUCA_NO_FMT) && !defined(GPUCA_STANDALONE)
36 res->setTimeStamp(
src.getTimeStamp());
37 res->setVDrift(
src.getVDrift());
39 res->setLumi(
src.getLumi());
59 size_t nextDynOffs = alignOffset(selfSizeFix);
60 nextDynOffs = alignOffset(nextDynOffs + origCorr.mNumberOfScenarios *
sizeof(
size_t));
61 nextDynOffs = alignOffset(nextDynOffs + origCorr.mNumberOfScenarios *
sizeof(
size_t));
63 for (
int isc = 0; isc < origCorr.mNumberOfScenarios; isc++) {
64 const auto& spline = origCorr.mScenarioPtr[isc];
65 nextDynOffs = alignOffset(nextDynOffs +
sizeof(
SplineType));
66 nextDynOffs = alignOffset(nextDynOffs + spline.getFlatBufferSize());
69 for (
int is = 0; is < 3; is++) {
73 nextDynOffs = alignOffset(nextDynOffs);
79 LOGP(info,
"TPCFastTransformPOD: this={:p} sizeof={} mApplyCorrection={} mNumberOfScenarios={} mTotalSize={} mOffsScenariosOffsets={} mT0={} mVdrift={} mLumi={} mIDC={}",
80 (
void*)
this,
sizeof(*
this), mApplyCorrection, mNumberOfScenarios, mTotalSize, mOffsScenariosOffsets, mT0, mVdrift, mLumi, mIDC);
83 for (
int i = 0;
i < NSplineIDs;
i++) {
84 LOGP(info,
"mSplineDataOffsets[{}][{}]={}",
s,
i, mSplineDataOffsets[
s][
i]);
87 const size_t scenOffset = getScenarioOffset(0);
88 const auto& spline = getSplineForRow(0);
89 LOGP(info,
"scenOffset={} spline_addr={:p} expected={:p}", scenOffset, (
void*)&spline, (
void*)(getThis() + scenOffset));
91 const float* splineData = getCorrectionData(0, 0);
92 LOGP(info,
"spline internal check: &spline={:p} splineData={:p} buf_start={:p} buf_end={:p}",
93 (
void*)&spline, (
void*)splineData,
94 (
void*)getThis(), (
void*)(getThis() + mTotalSize));
97 bool dataInBuf = (splineData >= (
float*)getThis()) && (splineData < (
float*)(getThis() + mTotalSize));
98 LOGP(info,
"splineData in buffer: {}", dataInBuf);
100 LOGP(info,
"splineData offset from buf_start = {}", (
size_t)((
const char*)splineData - getThis()));
107 auto& podMap = getNonConst(buff);
108 podMap.mApplyCorrection =
true;
111 podMap.mNumberOfScenarios = origCorr.mNumberOfScenarios;
114 podMap.mRowInfos[
row] = origCorr.getRowInfo(
row);
117 podMap.mTimeStamp = origCorr.mTimeStamp;
127 podMap.mOffsScenariosOffsets = nextDynOffs;
128 LOGP(
debug,
"Set mOffsScenariosOffsets = {}", podMap.mOffsScenariosOffsets);
129 nextDynOffs = alignOffset(nextDynOffs + podMap.mNumberOfScenarios *
sizeof(
size_t));
131 podMap.mOffsFlatBufferOffsets = nextDynOffs;
132 nextDynOffs = alignOffset(nextDynOffs + podMap.mNumberOfScenarios *
sizeof(
size_t));
135 size_t* scenOffs =
reinterpret_cast<size_t*
>(buff + podMap.mOffsScenariosOffsets);
136 size_t* flatBufOffs =
reinterpret_cast<size_t*
>(buff + podMap.mOffsFlatBufferOffsets);
138 for (
int isc = 0; isc < origCorr.mNumberOfScenarios; isc++) {
139 scenOffs[isc] = nextDynOffs;
140 const auto& spline = origCorr.mScenarioPtr[isc];
141 if (buffSize < nextDynOffs +
sizeof(
SplineType)) {
142 throw std::runtime_error(fmt::format(
"attempt to write {} bytes for slim spline for scenario {} to {}, overflowing the buffer of size {}",
sizeof(
SplineType), isc, nextDynOffs +
sizeof(
SplineType), buffSize));
146 auto* slimSpline =
new (buff + scenOffs[isc])
SplineType();
147 slimSpline->importFrom(spline);
148 nextDynOffs = alignOffset(nextDynOffs +
sizeof(
SplineType));
149 LOGP(
debug,
"Write {} bytes for slim spline scenario {} to offset {}",
sizeof(
SplineType), isc, scenOffs[isc]);
152 flatBufOffs[isc] = nextDynOffs;
153 std::memcpy(buff + nextDynOffs, spline.getFlatBufferPtr(), spline.getFlatBufferSize());
156 slimSpline->setActualBufferAddress(buff + nextDynOffs);
158 nextDynOffs = alignOffset(nextDynOffs + spline.getFlatBufferSize());
162 for (
int is = 0; is < 3; is++) {
164 float*
data =
reinterpret_cast<float*
>(buff + nextDynOffs);
165 LOGP(
debug,
"splinID={} start offset {} -> {}", is, nextDynOffs, (
void*)
data);
168 size_t sectorDataSizeBytes = origCorr.mSectorDataSizeBytes[is];
171 podMap.mSplineDataOffsets[
sector][is] = nextDynOffs + sectorDataSizeBytes *
sector;
174 if (buffSize < nextDynOffs +
dataSize) {
175 throw std::runtime_error(fmt::format(
"attempt to copy {} bytes of data for spline{} to {}, overflowing the buffer of size {}", sectorDataSizeBytes, is, nextDynOffs, buffSize));
177 const char* dataOr = origCorr.mCorrectionData[is];
181 nextDynOffs = alignOffset(nextDynOffs);
182 podMap.mTotalSize = nextDynOffs;
183 if (buffSize != podMap.mTotalSize) {
184 throw std::runtime_error(fmt::format(
"Estimated buffer size {} differs from filled one {}", buffSize, podMap.mTotalSize));
186 return &getNonConst(buff);
192 auto podMap =
create(buff, buffSize,
src.getCorrection());
194 podMap->mVdrift =
src.getVDrift();
195 podMap->mT0 =
src.getT0();
196 podMap->mLumi =
src.getLumi();
197 if (
src.isIDCSet()) {
198 podMap->mIDC =
src.getIDC();
200 podMap->mTimeStamp =
src.getTimeStamp();
205#ifndef GPUCA_STANDALONE
213 std::vector<float>
y,
z;
214 std::vector<std::array<float, 3>> corr0, corr1;
215 std::vector<std::array<float, 2>> corrInv0, corrInv1;
216 std::vector<float> corrInvX0, corrInvX1;
219 row.reserve(npoints);
222 corr0.reserve(npoints);
223 corr1.reserve(npoints);
224 corrInv0.reserve(npoints);
225 corrInv1.reserve(npoints);
226 corrInvX0.reserve(npoints);
227 corrInvX1.reserve(npoints);
229 for (
int i = 0;
i < npoints;
i++) {
230 sector.push_back(gRandom->Integer(NSECTORS));
231 row.push_back(gRandom->Integer(NROWS));
233 z.push_back((
sector.back() < NSECTORS / 2 ? 1.f : -1.f) * gRandom->Rndm() * 240);
235 long origStart[3], origEnd[3], thisStart[3], thisEnd[3];
236 origStart[0] = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
237 for (
int i = 0;
i < npoints;
i++) {
238 std::array<float, 3>
val;
240 corr0.push_back(
val);
243 origEnd[0] = origStart[1] = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
244 for (
int i = 0;
i < npoints;
i++) {
245 std::array<float, 2>
val;
247 corrInv0.push_back(
val);
250 origEnd[1] = origStart[2] = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
251 for (
int i = 0;
i < npoints;
i++) {
252 corrInvX0.push_back(origCorr.getCorrectionXatRealYZ(
sector[
i],
row[
i],
y[
i],
z[
i]));
255 origEnd[2] = thisStart[0] = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
256 for (
int i = 0;
i < npoints;
i++) {
257 std::array<float, 3>
val;
259 corr1.push_back(
val);
261 thisEnd[0] = thisStart[1] = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
262 for (
int i = 0;
i < npoints;
i++) {
263 std::array<float, 2>
val;
265 corrInv1.push_back(
val);
268 thisEnd[1] = thisStart[2] = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
269 for (
int i = 0;
i < npoints;
i++) {
270 corrInvX1.push_back(this->getCorrectionXatRealYZ(
sector[
i],
row[
i],
y[
i],
z[
i]));
272 thisEnd[2] = std::chrono::time_point_cast<std::chrono::microseconds>(std::chrono::system_clock::now()).time_since_epoch().count();
274 size_t ndiff[3] = {};
275 for (
int i = 0;
i < npoints;
i++) {
276 if (corr0[
i][0] != corr1[
i][0] || corr0[
i][1] != corr1[
i][1] || corr0[
i][2] != corr1[
i][2]) {
279 if (corrInv0[
i][0] != corrInv1[
i][0] || corrInv0[
i][1] != corrInv1[
i][1]) {
282 if (corrInvX0[
i] != corrInvX1[
i]) {
287 LOGP(info,
" (ns per call) original this Nmissmatch");
288 LOGP(info,
"getCorrection {:.3e} {:.3e} {}",
double(origEnd[0] - origStart[0]) / npoints * 1000.,
double(thisEnd[0] - thisStart[0]) / npoints * 1000., ndiff[0]);
289 LOGP(info,
"getCorrectionInvCorrectedX {:.3e} {:.3e} {}",
double(origEnd[1] - origStart[1]) / npoints * 1000.,
double(thisEnd[1] - thisStart[1]) / npoints * 1000., ndiff[1]);
290 LOGP(info,
"getCorrectionInvUV {:.3e} {:.3e} {}",
double(origEnd[2] - origStart[2]) / npoints * 1000.,
double(thisEnd[2] - thisStart[2]) / npoints * 1000., ndiff[2]);
291 return ndiff[0] == 0 && ndiff[1] == 0 && ndiff[2] == 0;
configStandalone Light OpenGL display display_light Apply smoothing to points Enable Z buffer Highlight links Highlight seeds Highlight sector tracks Highlight final tracks Show individual sector
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error s
static constexpr size_t alignSize(size_t sizeBytes, size_t alignmentBytes)
_______________ Generic utilities _______________________________________________
Forward declaration — specializations below select ClassDefNV based on FlatBase.
GLdouble GLdouble GLdouble z
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...