Skip to content

Commit afe3a97

Browse files
committed
CalibLaserTracks optinally normalizes LtrCalibData to correction 1
1 parent 4ac9de7 commit afe3a97

4 files changed

Lines changed: 48 additions & 7 deletions

File tree

DataFormats/Detectors/TPC/include/DataFormatsTPC/LtrCalibData.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
#ifndef AliceO2_TPC_LtrCalibData_H_
2020
#define AliceO2_TPC_LtrCalibData_H_
2121

22+
#include <FairLogger.h>
23+
#include <Rtypes.h>
24+
2225
namespace o2::tpc
2326
{
2427

@@ -38,6 +41,20 @@ struct LtrCalibData {
3841

3942
float getDriftVCorrection() const { return 0.5f * (dvCorrectionA + dvCorrectionC); }
4043

44+
// renormalize reference and correction either to provided new reference (if >0) or to correction 1 wrt current reference
45+
void normalize(float newVRef = 0.f)
46+
{
47+
if (refVDrift == 0.) {
48+
LOG(fatal) << "LtrCalibData data has no reference";
49+
}
50+
if (newVRef == 0.) {
51+
newVRef = refVDrift / getDriftVCorrection();
52+
}
53+
float fact = newVRef / refVDrift;
54+
dvCorrectionA *= fact;
55+
dvCorrectionC *= fact;
56+
}
57+
4158
void reset()
4259
{
4360
processedTFs = 0;
@@ -50,7 +67,7 @@ struct LtrCalibData {
5067
dvOffsetC = 0;
5168
nTracksA = 0;
5269
nTracksC = 0;
53-
70+
refVDrift = 0;
5471
matchedLtrIDs.clear();
5572
}
5673

DataFormats/Detectors/TPC/include/DataFormatsTPC/VDriftCorrFact.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@ struct VDriftCorrFact {
3232
float corrFactErr{0.0}; ///< stat error of correction factor
3333
float refVDrift{0.}; ///< reference vdrift for which factor was extracted
3434

35+
float getVDrift() const { return refVDrift * corrFact; }
36+
float getVDriftError() const { return refVDrift * corrFactErr; }
37+
38+
// renormalize reference and correction either to provided new reference (if >0) or to correction 1 wrt current reference
39+
void normalize(float newVRef = 0.f)
40+
{
41+
if (newVRef == 0.f) {
42+
newVRef = refVDrift * corrFact;
43+
}
44+
float fact = refVDrift / newVRef;
45+
refVDrift = newVRef;
46+
corrFactErr *= fact;
47+
corrFact *= fact;
48+
}
49+
3550
ClassDefNV(VDriftCorrFact, 1);
3651
};
3752

Detectors/TPC/calibration/src/CalibLaserTracks.cxx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ void CalibLaserTracks::print() const
367367
{
368368
if (mFinalized) {
369369
LOGP(info,
370-
"Processed {} TFs from {} - {}; found tracks: {} / {}; T0 offsets: {} / {}; dv correction factors: {} / {} for A- / C-Side",
370+
"Processed {} TFs from {} - {}; found tracks: {} / {}; T0 offsets: {} / {}; dv correction factors: {} / {} for A- / C-Side, reference: {}",
371371
mCalibData.processedTFs,
372372
mCalibData.firstTime,
373373
mCalibData.lastTime,
@@ -376,7 +376,8 @@ void CalibLaserTracks::print() const
376376
mCalibData.dvOffsetA,
377377
mCalibData.dvOffsetC,
378378
mCalibData.dvCorrectionA,
379-
mCalibData.dvCorrectionC);
379+
mCalibData.dvCorrectionC,
380+
mCalibData.refVDrift);
380381
} else {
381382
LOGP(info,
382383
"Processed {} TFs from {} - {}; **Not finalized**",
@@ -385,14 +386,15 @@ void CalibLaserTracks::print() const
385386
mCalibData.lastTime);
386387

387388
LOGP(info,
388-
"Last processed TF from {} - {}; found tracks: {} / {}; T0 offsets: {} / {}; dv correction factors: {} / {} for A- / C-Side",
389+
"Last processed TF from {} - {}; found tracks: {} / {}; T0 offsets: {} / {}; dv correction factors: {} / {} for A- / C-Side, reference: {}",
389390
mCalibDataTF.firstTime,
390391
mCalibDataTF.lastTime,
391392
mCalibDataTF.nTracksA,
392393
mCalibDataTF.nTracksC,
393394
mCalibDataTF.dvOffsetA,
394395
mCalibDataTF.dvOffsetC,
395396
mCalibDataTF.dvCorrectionA,
396-
mCalibDataTF.dvCorrectionC);
397+
mCalibDataTF.dvCorrectionC,
398+
mCalibDataTF.refVDrift);
397399
}
398400
}

Detectors/TPC/workflow/include/TPCWorkflow/CalibLaserTracksSpec.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class CalibLaserTracksDevice : public o2::framework::Task
4141
mCalib.setWriteDebugTree(ic.options().get<bool>("write-debug"));
4242
mMinNumberTFs = ic.options().get<int>("min-tfs");
4343
mOnlyPublishOnEOS = ic.options().get<bool>("only-publish-on-eos");
44-
44+
mNormalize = !ic.options().get<bool>("ignore-normalization");
4545
auto finishFunction = [this]() {
4646
if (!mPublished) {
4747
const auto nTFs = mCalib.getCalibData().processedTFs;
@@ -87,6 +87,7 @@ class CalibLaserTracksDevice : public o2::framework::Task
8787
int mMinNumberTFs{100}; ///< minimum number of TFs required for good calibration
8888
bool mPublished{false}; ///< if calibration was already published
8989
bool mOnlyPublishOnEOS{false}; ///< if to only publish the calibration on EOS, not during running
90+
bool mNormalize{true}; ///< normalize reference to have mean correction = 1
9091

9192
//________________________________________________________________
9293
void sendOutput(DataAllocator& output)
@@ -97,7 +98,12 @@ class CalibLaserTracksDevice : public o2::framework::Task
9798
std::map<std::string, std::string> md;
9899

99100
using clbUtils = o2::calibration::Utils;
100-
const auto& ltrCalib = mCalib.getCalibData();
101+
auto ltrCalib = mCalib.getCalibData();
102+
103+
if (mNormalize) {
104+
ltrCalib.normalize(0.);
105+
LOGP(info, "After normalization: correction factors: {} / {} for A- / C-Side, reference: {}", ltrCalib.dvCorrectionA, ltrCalib.dvCorrectionC, ltrCalib.refVDrift);
106+
}
101107

102108
o2::ccdb::CcdbObjectInfo w;
103109
auto image = o2::ccdb::CcdbApi::createObjectImage(&ltrCalib, &w);
@@ -141,6 +147,7 @@ DataProcessorSpec getCalibLaserTracks(const std::string inputSpec)
141147
{"write-debug", VariantType::Bool, false, {"write a debug output tree."}},
142148
{"min-tfs", VariantType::Int, 100, {"minimum number of TFs with enough laser tracks to finalize the calibration."}},
143149
{"only-publish-on-eos", VariantType::Bool, false, {"only publish the calibration on eos, not during running"}},
150+
{"ignore-normalization", VariantType::Bool, false, {"ignore normalization of reference to have mean correction factor 1"}},
144151
}};
145152
}
146153

0 commit comments

Comments
 (0)