Skip to content

Commit d48e6e1

Browse files
shahor02chiarazampolli
authored andcommitted
Make extra cov.error for TPC linear in CTP Lumi, provide error instead of error^2
1) Make sure the CTP lumi input is available if CorrectionMaps helper needs it. 2) Note that the meaning of the tpcCovInner and tpcCovOuter was chanded from err^2 to err: The trackTuneParams.tpcCovInnerSlope[0..4] and trackTuneParams.tpcCovOuterSlope[0..4] configurable can be used to scale the TPC extra cov.matrix errors lineraly with scaling parameters. All devices (re)fitting TPC tracks will apply the errors^2 (if allowed by other options of trackTuneParams) [tpcCovInner + lumi*tpcCovInnerSlope]^2 and [tpcCovOuter + lumi*tpcCovOuterSlope]^2, with lumi being CorrectionMapsHelper.getInstLumiCTP()
1 parent b9eeed6 commit d48e6e1

29 files changed

Lines changed: 138 additions & 60 deletions

File tree

DataFormats/Detectors/GlobalTracking/include/DataFormatsGlobalTracking/TrackTuneParams.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
#include "CommonUtils/ConfigurableParam.h"
1818
#include "CommonUtils/ConfigurableParamHelper.h"
19+
#include <array>
1920

2021
namespace o2
2122
{
@@ -32,13 +33,19 @@ struct TrackTuneParams : public o2::conf::ConfigurableParamHelper<TrackTuneParam
3233
};
3334
AddCovType tpcCovInnerType = AddCovType::Disable;
3435
AddCovType tpcCovOuterType = AddCovType::Disable;
35-
bool sourceLevelTPC = true; // if TPC corrections are allowed, apply them TPC source output level (tracking/reader), otherwise in the global tracking consumers BEFORE update by external detector
36+
bool sourceLevelTPC = true; // if TPC corrections are allowed, apply them TPC source output level (tracking), otherwise in the global tracking consumers BEFORE update by external detector
37+
bool applyWhenReading = false; // if true, then apply at reading tracks from the file. This better NOT used as there is no way to apply lumi-dependent scaling in the reader
3638
bool useTPCInnerCorr = false; // request to correct TPC inner param
3739
bool useTPCOuterCorr = false; // request to correct TPC outer param
3840
float tpcParInner[5] = {}; // ad hoc correction to be added to TPC param at the inner XRef
3941
float tpcParOuter[5] = {}; // ad hoc correction to be added to TPC param at the outer XRef
40-
float tpcCovInner[5] = {}; // ad hoc errors to be added to TPC cov.matrix at the inner XRef
41-
float tpcCovOuter[5] = {}; // ad hoc errors to be added to TPC outer param at the outer XRef
42+
float tpcCovInner[5] = {}; // ad hoc errors to be added to TPC cov.matrix at the inner XRef (not squared!)
43+
float tpcCovOuter[5] = {}; // ad hoc errors to be added to TPC outer param cov.matrix at the outer XRef (not squared!)
44+
float tpcCovInnerSlope[5] = {}; // slope of the error with respect to lumi, total correction = [tpcCovInner + lumi*tpcCovInnerSlope]^2
45+
float tpcCovOuterSlope[5] = {}; // slope of the error with respect to lumi, total correction = [tpcCovOuter + lumi*tpcCovOuterSlope]^2
46+
47+
std::array<float, 5> getCovInnerTotal(float scale) const;
48+
std::array<float, 5> getCovOuterTotal(float scale) const;
4249

4350
O2ParamDef(TrackTuneParams, "trackTuneParams");
4451
};

DataFormats/Detectors/GlobalTracking/src/TrackTuneParams.cxx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,25 @@
1515

1616
#include "DataFormatsGlobalTracking/TrackTuneParams.h"
1717
O2ParamImpl(o2::globaltracking::TrackTuneParams);
18+
19+
using namespace o2::globaltracking;
20+
21+
std::array<float, 5> TrackTuneParams::getCovInnerTotal(float scale) const
22+
{
23+
std::array<float, 5> cov{};
24+
for (int i = 0; i < 5; i++) {
25+
cov[i] = tpcCovInner[i] + scale * tpcCovInnerSlope[i];
26+
cov[i] *= cov[i];
27+
}
28+
return cov;
29+
}
30+
31+
std::array<float, 5> TrackTuneParams::getCovOuterTotal(float scale) const
32+
{
33+
std::array<float, 5> cov{};
34+
for (int i = 0; i < 5; i++) {
35+
cov[i] = tpcCovOuter[i] + scale * tpcCovOuterSlope[i];
36+
cov[i] *= cov[i];
37+
}
38+
return cov;
39+
}

Detectors/Align/Workflow/src/BarrelAlignmentSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,10 +263,10 @@ void BarrelAlignmentSpec::updateTimeDependentParams(ProcessingContext& pc)
263263
mTPCCorrMapsLoader.extractCCDBInputs(pc);
264264
bool updateMaps = false;
265265
if (mTPCCorrMapsLoader.isUpdated()) {
266-
mController->setTPCCorrMaps(&mTPCCorrMapsLoader);
267266
mTPCCorrMapsLoader.acknowledgeUpdate();
268267
updateMaps = true;
269268
}
269+
mController->setTPCCorrMaps(&mTPCCorrMapsLoader);
270270
if (mTPCVDriftHelper.isUpdated()) {
271271
LOGP(info, "Updating TPC fast transform map with new VDrift factor of {} wrt reference {} and DriftTimeOffset correction {} wrt {} from source {}",
272272
mTPCVDriftHelper.getVDriftObject().corrFact, mTPCVDriftHelper.getVDriftObject().refVDrift,

Detectors/Align/Workflow/src/barrel-alignment-workflow.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
141141
}
142142
LOG(info) << "adding TOF request";
143143
}
144-
if (sclOpt.lumiType == 1) {
144+
if (sclOpt.requestCTPLumi) {
145145
src = src | GID::getSourcesMask("CTP");
146146
}
147147
// write the configuration used for the workflow

Detectors/GlobalTracking/include/GlobalTracking/MatchTOF.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ class MatchTOF
336336
UInt_t mDBGFlags = 0;
337337
std::string mDebugTreeFileName = "dbg_matchTOF.root"; ///< name for the debug tree file
338338

339+
std::array<float, 5> mCovDiagInner{}; ///< total cov.matrix extra diagonal error from TrackTuneParams
340+
std::array<float, 5> mCovDiagOuter{}; ///< total cov.matrix extra diagonal error from TrackTuneParams
341+
339342
///----------- aux stuff --------------///
340343
static constexpr float MAXSNP = 0.85; // max snp of ITS or TPC track at xRef to be matched
341344

Detectors/GlobalTracking/include/GlobalTracking/MatchTPCITS.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -611,6 +611,9 @@ class MatchTPCITS
611611
std::array<int16_t, o2::constants::lhc::LHCMaxBunches> mClosestBunchAbove; // closest filled bunch from above
612612
std::array<int16_t, o2::constants::lhc::LHCMaxBunches> mClosestBunchBelow; // closest filled bunch from below
613613

614+
std::array<float, 5> mCovDiagInner{}; ///< total cov.matrix extra diagonal error from TrackTuneParams
615+
std::array<float, 5> mCovDiagOuter{}; ///< total cov.matrix extra diagonal error from TrackTuneParams
616+
614617
const o2::itsmft::ChipMappingITS ITSChMap{};
615618

616619
const o2::globaltracking::RecoContainer* mRecoCont = nullptr;

Detectors/GlobalTracking/src/MatchTOF.cxx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ using trkType = o2::dataformats::MatchInfoTOFReco::TrackType;
5656
using Cluster = o2::tof::Cluster;
5757
using GTrackID = o2::dataformats::GlobalTrackID;
5858
using timeEst = o2::dataformats::TimeStampWithError<float, float>;
59+
using TrackTunePar = o2::globaltracking::TrackTuneParams;
5960

6061
bool MatchTOF::mHasFillScheme = false;
6162
bool MatchTOF::mFillScheme[o2::constants::lhc::LHCMaxBunches] = {0};
@@ -504,13 +505,13 @@ void MatchTOF::propagateTPCTracks(int sec)
504505

505506
o2::track::TrackLTIntegral& intLT0 = mLTinfos[sec][trkType::UNCONS][it];
506507

507-
const auto& trackTune = o2::globaltracking::TrackTuneParams::Instance();
508+
const auto& trackTune = TrackTuneParams::Instance();
508509
if (!trackTune.sourceLevelTPC) { // correct only if TPC track was not corrected at the source level
509510
if (trackTune.useTPCOuterCorr) {
510511
trc.updateParams(trackTune.tpcParOuter);
511512
}
512-
if (trackTune.tpcCovOuterType != o2::globaltracking::TrackTuneParams::AddCovType::Disable) { // only TRD-refitted track have cov.matrix already man>
513-
trc.updateCov(trackTune.tpcCovOuter, trackTune.tpcCovOuterType == o2::globaltracking::TrackTuneParams::AddCovType::WithCorrelations);
513+
if (trackTune.tpcCovOuterType != TrackTuneParams::AddCovType::Disable) { // only TRD-refitted track have cov.matrix already man>
514+
trc.updateCov(mCovDiagOuter, trackTune.tpcCovOuterType == TrackTuneParams::AddCovType::WithCorrelations);
514515
}
515516
}
516517
if (!propagateToRefXWithoutCov(trc, mXRef, 10, mBz)) { // we first propagate to 371 cm without considering the covariance matri
@@ -669,13 +670,13 @@ void MatchTOF::addTPCSeed(const o2::tpc::TrackTPC& _tr, o2::dataformats::GlobalT
669670
mLTinfos[sector][trkType::UNCONS].emplace_back(intLT0);
670671

671672
/*
672-
const auto& trackTune = o2::globaltracking::TrackTuneParams::Instance();
673+
const auto& trackTune = TrackTuneParams::Instance();
673674
if (!trackTune.sourceLevelTPC) { // correct only if TPC track was not corrected at the source level
674675
if (trackTune.useTPCOuterCorr) {
675676
trc.updateParams(trackTune.tpcParOuter);
676677
}
677-
if (trackTune.tpcCovOuterType != o2::globaltracking::TrackTuneParams::AddCovType::Disable) { // only TRD-refitted track have cov.matrix already manipulated
678-
trc.updateCov(trackTune.tpcCovOuter, trackTune.tpcCovOuterType == o2::globaltracking::TrackTuneParams::AddCovType::WithCorrelations);
678+
if (trackTune.tpcCovOuterType != TrackTuneParams::AddCovType::Disable) { // only TRD-refitted track have cov.matrix already manipulated
679+
trc.updateCov(mCovDiagOuter, trackTune.tpcCovOuterType == TrackTuneParams::AddCovType::WithCorrelations);
679680
}
680681
}
681682
if (!propagateToRefXWithoutCov(trc, mXRef, 10, mBz)) { // we first propagate to 371 cm without considering the covariance matri
@@ -1712,6 +1713,14 @@ void MatchTOF::updateTimeDependentParams()
17121713

17131714
mBz = o2::base::Propagator::Instance()->getNominalBz();
17141715
mMaxInvPt = abs(mBz) > 0.1 ? 1. / (abs(mBz) * 0.05) : 999.;
1716+
1717+
const auto& trackTune = TrackTuneParams::Instance();
1718+
float scale = mTPCCorrMapsHelper->getInstLumiCTP();
1719+
if (scale < 0.f) {
1720+
scale = 0.f;
1721+
}
1722+
mCovDiagInner = trackTune.getCovInnerTotal(scale);
1723+
mCovDiagOuter = trackTune.getCovOuterTotal(scale);
17151724
}
17161725

17171726
//_________________________________________________________
@@ -1763,12 +1772,12 @@ bool MatchTOF::makeConstrainedTPCTrack(int matchedID, o2::dataformats::TrackTPCT
17631772
LOGP(debug, "Inward Refit failed {}", trConstr.asString());
17641773
return false;
17651774
}
1766-
const auto& trackTune = o2::globaltracking::TrackTuneParams::Instance(); // if needed, correct TPC track after inward refit
1775+
const auto& trackTune = TrackTuneParams::Instance(); // if needed, correct TPC track after inward refit
17671776
if (!trackTune.useTPCInnerCorr) {
17681777
trConstr.updateParams(trackTune.tpcParInner);
17691778
}
1770-
if (trackTune.tpcCovInnerType != o2::globaltracking::TrackTuneParams::AddCovType::Disable) {
1771-
trConstr.updateCov(trackTune.tpcCovInner, trackTune.tpcCovInnerType == o2::globaltracking::TrackTuneParams::AddCovType::WithCorrelations);
1779+
if (trackTune.tpcCovInnerType != TrackTuneParams::AddCovType::Disable) {
1780+
trConstr.updateCov(mCovDiagInner, trackTune.tpcCovInnerType == TrackTuneParams::AddCovType::WithCorrelations);
17721781
}
17731782

17741783
trConstr.setChi2Refit(chi2);

Detectors/GlobalTracking/src/MatchTPCITS.cxx

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ using MatrixDSym4 = ROOT::Math::SMatrix<double, 4, 4, ROOT::Math::MatRepSym<doub
5555
using MatrixD4 = ROOT::Math::SMatrix<double, 4, 4, ROOT::Math::MatRepStd<double, 4>>;
5656
using NAMES = o2::base::NameConf;
5757
using GTrackID = o2::dataformats::GlobalTrackID;
58+
using TrackTunePar = o2::globaltracking::TrackTuneParams;
5859
constexpr float MatchTPCITS::Tan70, MatchTPCITS::Cos70I2, MatchTPCITS::MaxSnp, MatchTPCITS::MaxTgp;
5960

6061
LinksPoolMT* TPCABSeed::gLinksPool = nullptr;
@@ -265,6 +266,14 @@ void MatchTPCITS::updateTimeDependentParams()
265266
o2::math_utils::Point3D<float> p0(90., 1., 1), p1(90., 100., 100.);
266267
auto matbd = o2::base::Propagator::Instance()->getMatBudget(mParams->matCorr, p0, p1);
267268
mTPCmeanX0Inv = matbd.meanX2X0 / matbd.length;
269+
270+
const auto& trackTune = TrackTuneParams::Instance();
271+
float scale = mTPCCorrMapsHelper->getInstLumiCTP();
272+
if (scale < 0.f) {
273+
scale = 0.f;
274+
}
275+
mCovDiagInner = trackTune.getCovInnerTotal(scale);
276+
mCovDiagOuter = trackTune.getCovOuterTotal(scale);
268277
}
269278

270279
//______________________________________________
@@ -419,15 +428,15 @@ void MatchTPCITS::addTPCSeed(const o2::track::TrackParCov& _tr, float t0, float
419428
MinusOne,
420429
(extConstrained || tpcOrig.hasBothSidesClusters()) ? TrackLocTPC::Constrained : (tpcOrig.hasASideClustersOnly() ? TrackLocTPC::ASide : TrackLocTPC::CSide)});
421430
// propagate to matching Xref
422-
const auto& trackTune = o2::globaltracking::TrackTuneParams::Instance();
431+
const auto& trackTune = TrackTuneParams::Instance();
423432
// only TPC standalone need to be corrected on the input, provided they were not corrected at the source level,
424433
// other inputs are corrected in respective upstream matching processes
425434
if (srcGID.getSource() == GTrackID::TPC && !trackTune.sourceLevelTPC) {
426435
if (trackTune.useTPCInnerCorr) {
427436
trc.updateParams(trackTune.tpcParInner);
428437
}
429-
if (trackTune.tpcCovInnerType != o2::globaltracking::TrackTuneParams::AddCovType::Disable) {
430-
trc.updateCov(trackTune.tpcCovInner, trackTune.tpcCovInnerType == o2::globaltracking::TrackTuneParams::AddCovType::WithCorrelations);
438+
if (trackTune.tpcCovInnerType != TrackTuneParams::AddCovType::Disable) {
439+
trc.updateCov(mCovDiagInner, trackTune.tpcCovInnerType == TrackTuneParams::AddCovType::WithCorrelations);
431440
}
432441
}
433442
if (!propagateToRefX(trc)) {
@@ -1449,12 +1458,12 @@ bool MatchTPCITS::refitTrackTPCITS(int iTPC, int& iITS, pmr::vector<o2::dataform
14491458
tofL.addX2X0(lInt * mTPCmeanX0Inv);
14501459
propagator->PropagateToXBxByBz(tracOut, o2::constants::geom::XTPCOuterRef, MaxSnp, 10., mUseMatCorrFlag, &tofL);
14511460

1452-
const auto& trackTune = o2::globaltracking::TrackTuneParams::Instance();
1461+
const auto& trackTune = TrackTuneParams::Instance();
14531462
if (trackTune.useTPCOuterCorr) {
14541463
tracOut.updateParams(trackTune.tpcParOuter);
14551464
}
1456-
if (trackTune.tpcCovOuterType != o2::globaltracking::TrackTuneParams::AddCovType::Disable) {
1457-
tracOut.updateCov(trackTune.tpcCovOuter, trackTune.tpcCovOuterType == o2::globaltracking::TrackTuneParams::AddCovType::WithCorrelations);
1465+
if (trackTune.tpcCovOuterType != TrackTuneParams::AddCovType::Disable) {
1466+
tracOut.updateCov(mCovDiagOuter, trackTune.tpcCovOuterType == TrackTuneParams::AddCovType::WithCorrelations);
14581467
}
14591468
}
14601469
trfit.setChi2Match(tpcMatchRec.chi2);
@@ -1583,12 +1592,12 @@ bool MatchTPCITS::refitABTrack(int iITSAB, const TPCABSeed& seed, pmr::vector<o2
15831592
tofL.addStep(lInt, tracOut.getP2Inv());
15841593
tofL.addX2X0(lInt * mTPCmeanX0Inv);
15851594
propagator->PropagateToXBxByBz(tracOut, o2::constants::geom::XTPCOuterRef, MaxSnp, 10., mUseMatCorrFlag, &tofL);
1586-
const auto& trackTune = o2::globaltracking::TrackTuneParams::Instance();
1595+
const auto& trackTune = TrackTuneParams::Instance();
15871596
if (trackTune.useTPCOuterCorr) {
15881597
tracOut.updateParams(trackTune.tpcParOuter);
15891598
}
1590-
if (trackTune.tpcCovOuterType != o2::globaltracking::TrackTuneParams::AddCovType::Disable) {
1591-
tracOut.updateCov(trackTune.tpcCovOuter, trackTune.tpcCovOuterType == o2::globaltracking::TrackTuneParams::AddCovType::WithCorrelations);
1599+
if (trackTune.tpcCovOuterType != TrackTuneParams::AddCovType::Disable) {
1600+
tracOut.updateCov(mCovDiagOuter, trackTune.tpcCovOuterType == TrackTuneParams::AddCovType::WithCorrelations);
15921601
}
15931602
}
15941603

Detectors/GlobalTrackingWorkflow/src/CosmicsMatchingSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,10 +133,10 @@ void CosmicsMatchingSpec::updateTimeDependentParams(ProcessingContext& pc)
133133
}
134134
bool updateMaps = false;
135135
if (mTPCCorrMapsLoader.isUpdated()) {
136-
mMatching.setTPCCorrMaps(&mTPCCorrMapsLoader);
137136
mTPCCorrMapsLoader.acknowledgeUpdate();
138137
updateMaps = true;
139138
}
139+
mMatching.setTPCCorrMaps(&mTPCCorrMapsLoader);
140140
if (mTPCVDriftHelper.isUpdated()) {
141141
LOGP(info, "Updating TPC fast transform map with new VDrift factor of {} wrt reference {} and DriftTimeOffset correction {} wrt {} from source {}",
142142
mTPCVDriftHelper.getVDriftObject().corrFact, mTPCVDriftHelper.getVDriftObject().refVDrift,

Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,10 @@ void SecondaryVertexingSpec::updateTimeDependentParams(ProcessingContext& pc)
189189
if (mSrc[GTrackID::TPC]) {
190190
bool updateMaps = false;
191191
if (mTPCCorrMapsLoader.isUpdated()) {
192-
mVertexer.setTPCCorrMaps(&mTPCCorrMapsLoader);
193192
mTPCCorrMapsLoader.acknowledgeUpdate();
194193
updateMaps = true;
195194
}
195+
mVertexer.setTPCCorrMaps(&mTPCCorrMapsLoader);
196196
if (mTPCVDriftHelper.isUpdated()) {
197197
LOGP(info, "Updating TPC fast transform map with new VDrift factor of {} wrt reference {} and DriftTimeOffset correction {} wrt {} from source {}",
198198
mTPCVDriftHelper.getVDriftObject().corrFact, mTPCVDriftHelper.getVDriftObject().refVDrift,

0 commit comments

Comments
 (0)