43 for (
int32_t uv = 0; uv < 2; ++uv) {
44 if (
n[uv] < mMaxNKnots[uv]) {
45 n[uv] = mMaxNKnots[uv];
56 mMaxNKnots[0] = nKnotsU;
57 mMaxNKnots[1] = nKnotsV;
59 for (
int32_t uv = 0; uv < 2; ++uv) {
60 if (mMaxNKnots[uv] < 5) {
71 mRasterData.resize(mRaster.getNumberOfKnots() * 3);
73 for (
int32_t i = 0;
i < mRaster.getNumberOfKnots(); ++
i) {
74 float u = 0,
v = 0, fx = 0, fy = 0, fz = 0;
75 mRaster.getKnotUV(
i, u,
v);
77 mRasterData[3 *
i + 0] = fx;
78 mRasterData[3 *
i + 1] = fy;
79 mRasterData[3 *
i + 2] = fz;
82 mRaster.correctEdges(mRasterData.data());
85 for (
int32_t uv = 0; uv < 2; ++uv) {
88 double du = 1. / (mMaxNKnots[uv] - 1);
90 for (
int32_t i = 1;
i < mMaxNKnots[uv] - 1; ++
i) {
94 d.rasterKnot = nearbyint(u * (mRaster.getGrid(uv).getNumberOfKnots() - 1));
96 if (
d.rasterKnot <= lastKnot) {
99 if (
d.rasterKnot >= mRaster.getGrid(uv).getNumberOfKnots() - 1) {
102 mKnots[uv].push_back(
d);
103 lastKnot =
d.rasterKnot;
107 createCurrentSpline();
110void IrregularSpline2D3DCalibrator::createCurrentSpline()
112 createSpline(mSpline, mSplineData);
115void IrregularSpline2D3DCalibrator::createActionSpline()
117 createSpline(mActionSpline, mActionSplineData);
120void IrregularSpline2D3DCalibrator::createSpline(IrregularSpline2D3D& sp, std::vector<float>&
data)
124 for (
int32_t uv = 0; uv < 2; ++uv) {
125 mTemp[uv].reserve(mMaxNKnots[uv]);
127 mTemp[uv].push_back(0.f);
128 for (std::list<KnotData>::iterator
i = mKnots[uv].begin();
i != mKnots[uv].end(); ++
i) {
130 mTemp[uv].push_back(mRaster.getGrid(uv).getKnot(
i->rasterKnot).
u);
132 mTemp[uv].push_back(1.f);
135 sp.construct(mTemp[0].
size(), mTemp[0].
data(), mRaster.getGrid(0).getNumberOfKnots(),
136 mTemp[1].size(), mTemp[1].data(), mRaster.getGrid(1).getNumberOfKnots());
138 data.resize(sp.getNumberOfKnots() * 3);
139 for (
int32_t i = 0;
i < sp.getNumberOfKnots(); ++
i) {
140 float u = 0,
v = 0, fx = 0, fy = 0, fz = 0;
141 sp.getKnotUV(
i, u,
v);
142 mRaster.getSplineVec(mRasterData.data(), u,
v, fx, fy, fz);
143 data[3 *
i + 0] = fx;
144 data[3 *
i + 1] = fy;
145 data[3 *
i + 2] = fz;
147 sp.correctEdges(
data.data());
150IrregularSpline2D3DCalibrator::Action IrregularSpline2D3DCalibrator::checkActionShift(std::list<KnotData>::iterator& knot)
156 ret.cost = mMaxDeviation + 1.e10;
163 if (knot->rasterKnot < mRaster.getGrid(uv).getNumberOfKnots() - 2) {
165 std::list<KnotData>::iterator next = knot;
167 if (next != mKnots[uv].
end()) {
168 if (next->rasterKnot <= knot->rasterKnot + 1) {
176 if (knot->rasterKnot > 1) {
178 std::list<KnotData>::iterator prev = knot;
179 if (prev != mKnots[uv].
begin()) {
181 if (prev->rasterKnot >= knot->rasterKnot - 1) {
187 if (!isSpaceUp && !isSpaceDn) {
192 int32_t regionKnotFirst = knot->rasterKnot;
193 int32_t regionKnotLast = knot->rasterKnot;
194 getRegionOfInfluence(knot, regionKnotFirst, regionKnotLast);
198 double costCurrent = getIntegralDeviationArea(mSpline, mSplineData, uv, regionKnotFirst, regionKnotLast);
204 createActionSpline();
207 ret.cost = getIntegralDeviationArea(mActionSpline, mActionSplineData, uv, regionKnotFirst, regionKnotLast) - costCurrent;
212 createActionSpline();
214 double costDn = getIntegralDeviationArea(mActionSpline, mActionSplineData, uv, regionKnotFirst, regionKnotLast) - costCurrent;
215 if (costDn < ret.cost) {
225IrregularSpline2D3DCalibrator::Action IrregularSpline2D3DCalibrator::checkActionRemove(std::list<KnotData>::iterator& knot)
231 ret.cost = mMaxDeviation + 1.e10;
236 if (mSpline.getGrid(uv).getNumberOfKnots() <= 5) {
241 int32_t regionKnotFirst = knot->rasterKnot;
242 int32_t regionKnotLast = knot->rasterKnot;
244 getRegionOfInfluence(knot, regionKnotFirst, regionKnotLast);
248 KnotData tmp = *knot;
249 std::list<KnotData>::iterator next = mKnots[uv].erase(knot);
250 createActionSpline();
251 knot = mKnots[uv].insert(next, tmp);
256 ret.cost = getMaxDeviationArea(mActionSpline, mActionSplineData, uv, regionKnotFirst, regionKnotLast);
262void IrregularSpline2D3DCalibrator::getRegionOfInfluence(std::list<KnotData>::iterator knot,
int32_t& regionKnotFirst,
int32_t& regionKnotLast)
const
265 regionKnotFirst = knot->rasterKnot;
266 regionKnotLast = knot->rasterKnot;
267 std::list<KnotData>::iterator next = knot;
268 std::list<KnotData>::iterator prev = knot;
270 if (prev != mKnots[uv].
begin()) {
272 regionKnotFirst = prev->rasterKnot;
277 if (next != mKnots[uv].
end()) {
279 if (next != mKnots[uv].
end()) {
280 regionKnotLast = next->rasterKnot;
282 regionKnotLast = mRaster.getGrid(uv).getNumberOfKnots() - 1;
296 bestAction.
cost = 1.e10;
298 for (
int32_t uv = 0; uv < 2; ++uv) {
299 for (std::list<KnotData>::iterator
i = mKnots[uv].begin();
i != mKnots[uv].end(); ++
i) {
301 if (
a.cost < bestAction.
cost) {
308 if (bestAction.
cost < 0) {
311 bestAction.
iter->rasterKnot++;
314 bestAction.
iter->rasterKnot--;
316 std::cerr <<
"Internal error!!!";
319 createCurrentSpline();
327 bestAction.
cost = mMaxDeviation + 1.e10;
329 for (
int32_t uv = 0; uv < 2; ++uv) {
331 for (std::list<KnotData>::iterator
i = mKnots[uv].begin();
i != mKnots[uv].end(); ++
i) {
333 if (
a.cost < bestAction.
cost) {
338 bestAction.
cost = sqrt(bestAction.
cost / 3.);
342 if (bestAction.
cost <= mMaxDeviation) {
345 mKnots[bestAction.
iter->uv].erase(bestAction.
iter);
347 LOG(info) <<
"Internal error!!!";
350 createCurrentSpline();
358 std::function<
void(
float,
float,
float&,
float&,
float&)> F)
366 createCurrentSpline();
368 std::unique_ptr<float[]> tmp(
new float[mSpline.getNumberOfKnots()]);
369 for (
int32_t i = 0;
i < mSpline.getNumberOfKnots(); ++
i) {
370 tmp[
i] = mSplineData[
i];
377 int32_t axis1 = (axis0 == 0) ? 1 : 0;
379 u[axis0] = mRaster.getGrid(axis0).getKnot(knot0).
u;
383 for (
int32_t knot1 = 0; knot1 < mRaster.getGrid(axis1).getNumberOfKnots(); ++knot1) {
384 u[axis1] = mRaster.getGrid(axis1).getKnot(knot1).
u;
385 float fx0, fy0, fz0, fx, fy, fz;
386 mRaster.getSplineVec(mRasterData.data(), u[0], u[1], fx0, fy0, fz0);
387 spline.getSplineVec(
data.data(), u[0], u[1], fx, fy, fz);
388 double dx = fx - fx0;
389 double dy = fy - fy0;
390 double dz = fz - fz0;
391 double d2 = dx * dx + dy * dy + dz * dz;
399double IrregularSpline2D3DCalibrator::getMaxDeviationArea(
const IrregularSpline2D3D& spline,
const std::vector<float>&
data,
403 for (
int32_t knot = knotFirst; knot <= knotLast; ++knot) {
404 double d = getMaxDeviationLine(spline,
data, axis, knot);
412double IrregularSpline2D3DCalibrator::getIntegralDeviationLine(
const IrregularSpline2D3D& spline,
const std::vector<float>&
data,
int32_t axis0,
int32_t knot0)
const
414 int32_t axis1 = (axis0 == 0) ? 1 : 0;
416 u[axis0] = mRaster.getGrid(axis0).getKnot(knot0).
u;
420 for (
int32_t knot1 = 0; knot1 < mRaster.getGrid(axis1).getNumberOfKnots(); ++knot1) {
421 u[axis1] = mRaster.getGrid(axis1).getKnot(knot1).
u;
422 float fx0, fy0, fz0, fx, fy, fz;
423 mRaster.getSplineVec(mRasterData.data(), u[0], u[1], fx0, fy0, fz0);
424 spline.getSplineVec(
data.data(), u[0], u[1], fx, fy, fz);
425 double dx = fx - fx0;
426 double dy = fy - fy0;
427 double dz = fz - fz0;
428 double d2 = dx * dx + dy * dy + dz * dz;
429 sum += sqrt(d2 / 3.);
435double IrregularSpline2D3DCalibrator::getIntegralDeviationArea(
const IrregularSpline2D3D& spline,
const std::vector<float>&
data,
439 for (
int32_t knot = knotFirst; knot <= knotLast; ++knot) {
440 sum += getIntegralDeviationLine(spline,
data, axis, knot);
std::vector< double > sum
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 First event to Number of events to Number of iterations to Number of iterations to Number of initial iterations excluded from const char Directory with events to Events directory is and not inside events d
configStandalone Reconstruction rec_tpc multiplier for the combined cluster track error during track following area in cm for the search of for z only used if decrease removal by when above this local occupancy rowx Shift of TPC revert cluster flag edge bit distance to edge exceeds this ZOffset for secondary multiple of radius max P of electron K BB bands crossing max P of electron p BB bands crossing max P of electron d BB bands crossing max P of electron t BB bands crossing min accepted dEdxMaxTPC of the track Additive extra cluster error for Y2 if edge flag set Additive extra cluster error for Y2 if single set Additive extra cluster error for Y2 if or single set Additive extra cluster error for Z2 if or single set Extra errors to add to track when crossing depending on addErrorsCECrossing Inner portion of y range in sector that is not used in searching for extrapolated track candidates factor2YS for track merging factor2K for track merging Margin in cm of Y position when rejecting edge clusters based on uncorrected track Y Max fraction of shared clusters for tracklet Except pad from cluster finding if total number of charges in a fragment is above this Except pad from cluster finding if number of consecutive charges in a fragment is above this Threshold where a timebin is considered disabling the noisy pad check for that pad Treat signal above this minimum as saturated Smoothing factor for the exponential Highly Ionising Particle tail filter Number of timebins to use for the averaging Add additional custom track errors when crossing relative as fraction of Do N fit passes in final fit of< 0:reject at max -n hits") AddOptionRTC(rejectIFCLowRadiusCluster, uint8_t, 1, "", 0, "Reject clusters that get the IFC mask error during refit") AddOptionRTC(dEdxTruncLow, uint8_t, 2, "", 0, "Low truncation threshold, fraction of 128") AddOptionRTC(dEdxTruncHigh, uint8_t, 77, "", 0, "High truncation threshold, fraction of 128") AddOptionRTC(extrapolationTracking, int8_t, 1, "", 0, "Enable Extrapolation Tracking(prolong tracks to adjacent sectors to find short segments)") AddOptionRTC(disableRefitAttachment, uint8_t, 0, "", 0, "Bitmask to disable certain attachment steps during refit(1:attachment, 2:propagation, 4:loop following, 8:mirroring)") AddOptionRTC(rejectionStrategy, uint8_t, o2::gpu::GPUSettings::RejectionStrategyA, "", 0, "Enable rejection of TPC clusters for compression(0=no, 1=strategy A, 2=strategy B)") AddOptionRTC(mergeLoopersAfterburner, uint8_t, 1, "", 0, "Run afterburner for additional looper merging") AddOptionRTC(compressionTypeMask, uint8_t, o2::gpu::GPUSettings::CompressionFull, "", 0, "TPC Compression mode bits(1=truncate charge/width LSB, 2=differences, 4=track-model)") AddOptionRTC(compressionSortOrder, uint8_t, o2::gpu::GPUSettings::SortTime, "", 0, "Sort order of TPC compression(0=time, 1=pad, 2=Z-time-pad, 3=Z-pad-time, 4=no sorting(use incoming order))") AddOptionRTC(sigBitsCharge, uint8_t, 4, "", 0, "Number of significant bits for TPC cluster charge in compression mode 1") AddOptionRTC(sigBitsWidth, uint8_t, 3, "", 0, "Number of significant bits for TPC cluster width in compression mode 1") AddOptionRTC(dropLoopers, uint8_t, 0, "", 0, "Drop looping tracks starting from second loop") AddOptionRTC(mergerInterpolateErrors, uint8_t, 1, "", 0, "Use interpolation instead of extrapolation for chi2 based cluster rejection") AddOptionRTC(mergerInterpolateRejectAlsoOnCurrentPosition, uint8_t, 1, "", 0, "When using mergerInterpolateErrors, reject based on chi2 twice computed with interpolated and current track position starting from NDF > mergerNonInterpolateRejectMinNDF Merge tracks accross the central electrode Enable PID response Add sub threshold clusters in TPC dEdx computation OR mask of TPC flags that will reject the cluster in alternative dEdx Reject edge clusters based on uncorrected track Y during track fit Increase decrease removal by when on this number of pads from the edge h configStandalone Reconstruction rec_trd Max chi2 for TRD tracklets to be matched to a track Chi2 cut for strict matching mode Number of sigmas for ITS TPC track time error estimate Addition to search road around track prolongation along Y in cm Optimal tracklet rphi resolution in maximum chi2 per attached tracklet for TRD tracks take into account the full likelihood of the slope including exponential tails Tracks with less attached tracklets are discarded after the tracking Post trigger Pile up integration time in BCs fits all iterations but the last one in projections Use material lookup table for TPC refit Apply workarounds to avoid cyclic merge should not be needed tpc dyn configStandalone Processing proc_rtc Replace constant variables static by constexpr expressions Compile RTC in deterministic with NO_FAST_MATH flags and GPUCA_DETERMINISTIC_MODE define Use RTC to optimize GPU code h configStandalone Processing proc_rtctech Use a file lock to serialize access to the cache folder int32_t
Definition of IrregularSpline2D3DCalibrator class.
Definition of IrregularSpline2D3D class.
std::unique_ptr< float[]> calibrateSpline(IrregularSpline2D3D &spline_uv, std::function< void(float, float, float &, float &, float &)> F)
void startCalibration(std::function< void(float, float, float &, float &, float &)> F)
void setMaxNKnots(int32_t nKnotsU, int32_t nKnotsV)
set maximal size of the spline grid
IrregularSpline2D3DCalibrator()
_____________ Constructors / destructors __________________________
void setRasterSize(int32_t nKnotsU, int32_t nKnotsV)
set size of the raster grid
void cloneFromObject(const IrregularSpline2D3D &obj, char *newFlatBufferPtr)
Construction interface.
void constructRegular(int32_t numberOfKnotsU, int32_t numberOfKnotsV)
Constructor for a regular spline.
GLboolean GLboolean GLboolean GLboolean a
Enum< T >::Iterator begin(Enum< T >)
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
define the action to be done by the writer
std::list< KnotData >::iterator iter
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"