Skip to content

Commit 517aa2b

Browse files
committed
Fix in passing TPC t0 to vdrift calibrations
1 parent 7122851 commit 517aa2b

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

Detectors/TPC/calibration/include/TPCCalibration/TPCVDriftTglCalibration.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ struct TPCVDTglContainer {
6666
}
6767
driftVFullMean = (driftVFullMean * nTFProc + vfull) / (nTFProc + 1);
6868
if (tOffsetRef == 0.f) {
69-
tOffsetRef = data[0].first; // assign 1st full toffset as a reference
69+
tOffsetRef = data[1].first; // assign 1st full toffset as a reference
7070
}
7171
nTFProc++;
7272
}

Detectors/TPC/calibration/src/VDriftHelper.cxx

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ void VDriftHelper::accountLaserCalibration(const LtrCalibData* calib, long fallB
6969
mVDLaser.refVDrift = ref;
7070
mVDLaser.corrFact = 1. / corr;
7171
mVDLaser.creationTime = calib->creationTime;
72+
mVDLaser.refTimeOffset = calib->refTimeOffset;
7273
mUpdated = true;
7374
mSource = Source::Laser;
7475
if (mMayRenormSrc & (0x1U << Source::Laser)) { // this was 1st setting?
@@ -79,7 +80,7 @@ void VDriftHelper::accountLaserCalibration(const LtrCalibData* calib, long fallB
7980
mMayRenormSrc &= ~(0x1U << Source::Laser); // unset MayRenorm
8081
} else if (ref != prevRef) { // we want to keep the same reference over the run, this may happen if run-time laser calibration is supplied
8182
LOGP(warn, "VDriftHelper: renorming updated TPC refVDrift={}/correction={} previous refVDrift {}, source: {}", mVDLaser.refVDrift, mVDLaser.corrFact, prevRef, getSourceName(mSource));
82-
mVDLaser.normalizeOffset(prevRef);
83+
mVDLaser.normalize(prevRef);
8384
}
8485
}
8586
}
@@ -134,6 +135,8 @@ void VDriftHelper::extractCCDBInputs(ProcessingContext& pc, bool laser, bool its
134135
// prefer among laser and tgl VDrift the one with the latest update time
135136
auto saveVD = mVD;
136137
mVD = mVDTPCITSTgl.creationTime < mVDLaser.creationTime ? mVDLaser : mVDTPCITSTgl;
138+
auto& loserVD = mVDTPCITSTgl.creationTime < mVDLaser.creationTime ? mVDTPCITSTgl : mVDLaser;
139+
137140
if (mForceParamDrift) {
138141
mVD.refVDrift = saveVD.refVDrift;
139142
mVD.corrFact = saveVD.corrFact;
@@ -144,13 +147,19 @@ void VDriftHelper::extractCCDBInputs(ProcessingContext& pc, bool laser, bool its
144147
mVD.timeOffsetCorr = 0.f;
145148
}
146149
mSource = mVDTPCITSTgl.creationTime < mVDLaser.creationTime ? Source::Laser : Source::ITSTPCTgl;
147-
LOGP(info, "Will prefer TPC Drift from {} with time {} to {} with time {}",
148-
SourceNames[int(mSource)], mVD.creationTime,
149-
mSource == Source::Laser ? SourceNames[int(Source::ITSTPCTgl)] : SourceNames[int(Source::Laser)],
150-
mSource == Source::Laser ? mVDTPCITSTgl.creationTime : mVDLaser.creationTime);
150+
auto loseCTime = loserVD.creationTime;
151+
loserVD = mVD; // override alternative VD to avoid normalization problems later
152+
std::string rep = fmt::format("Prefer TPC Drift from {} with time {} to {} with time {}",
153+
SourceNames[int(mSource)], mVD.creationTime, mSource == Source::Laser ? SourceNames[int(Source::ITSTPCTgl)] : SourceNames[int(Source::Laser)],
154+
mSource == Source::Laser ? mVDTPCITSTgl.creationTime : mVDLaser.creationTime);
151155
if (mForceParamDrift || mForceParamOffset) {
152-
LOGP(info, "but {} is imposed from the command line", mForceParamDrift ? "VDrift" : "DriftTimeOffset");
156+
std::string impos = mForceParamDrift ? "VDrift" : "";
157+
if (mForceParamOffset) {
158+
impos += mForceParamDrift ? " and DriftTimeOffset" : "DriftTimeOffset";
159+
}
160+
rep += fmt::format(" but {} imposed from command line", impos);
153161
}
162+
LOGP(info, "{}", rep);
154163
}
155164
}
156165

0 commit comments

Comments
 (0)