Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider the following formatting changes to #13731 #107

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion GPU/GPUTracking/Base/GPUParam.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -120,18 +120,20 @@ void GPUParam::SetDefaults(float solenoidBz)
par.toyMCEventsFlag = false;
par.continuousTracking = false;
continuousMaxTimeBin = 0;
tpcCutTimeBin = 0;
par.debugLevel = 0;
par.earlyTpcTransform = false;
}

void GPUParam::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p, const GPURecoStepConfiguration* w)
void GPUParam::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p, const GPURecoStepConfiguration* w, const GPUSettingsRecDyn* d)
{
if (g) {
UpdateBzOnly(g->solenoidBzNominalGPU);
par.assumeConstantBz = g->constBz;
par.toyMCEventsFlag = g->homemadeEvents;
par.continuousTracking = g->grpContinuousMaxTimeBin != 0;
continuousMaxTimeBin = g->grpContinuousMaxTimeBin == -1 ? GPUSettings::TPC_MAX_TF_TIME_BIN : g->grpContinuousMaxTimeBin;
tpcCutTimeBin = g->tpcCutTimeBin;
}
par.earlyTpcTransform = rec.tpc.forceEarlyTransform == -1 ? (!par.continuousTracking) : rec.tpc.forceEarlyTransform;
qptB5Scaler = CAMath::Abs(bzkG) > 0.1f ? CAMath::Abs(bzkG) / 5.006680f : 1.f; // Repeat here, since passing in g is optional
Expand All @@ -145,6 +147,9 @@ void GPUParam::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessi
dodEdxDownscaled = (rand() % 100) < p->tpcDownscaledEdx;
}
}
if (d) {
rec.dyn = *d;
}
}

void GPUParam::UpdateBzOnly(float newSolenoidBz)
Expand Down
3 changes: 2 additions & 1 deletion GPU/GPUTracking/Base/GPUParam.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ struct GPUParam_t {

int8_t dodEdxDownscaled;
int32_t continuousMaxTimeBin;
int32_t tpcCutTimeBin;

GPUTPCGeometry tpcGeometry; // TPC Geometry
GPUTPCGMPolynomialField polynomialField; // Polynomial approx. of magnetic field for TPC GM
Expand All @@ -84,7 +85,7 @@ struct GPUParam : public internal::GPUParam_t<GPUSettingsRec, GPUSettingsParam>
#ifndef GPUCA_GPUCODE
void SetDefaults(float solenoidBz);
void SetDefaults(const GPUSettingsGRP* g, const GPUSettingsRec* r = nullptr, const GPUSettingsProcessing* p = nullptr, const GPURecoStepConfiguration* w = nullptr);
void UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p = nullptr, const GPURecoStepConfiguration* w = nullptr);
void UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p = nullptr, const GPURecoStepConfiguration* w = nullptr, const GPUSettingsRecDynamic* d = nullptr);
void UpdateBzOnly(float newSolenoidBz);
void LoadClusterErrors(bool Print = 0);
void UpdateRun3ClusterErrors(const float* yErrorParam, const float* zErrorParam);
Expand Down
16 changes: 12 additions & 4 deletions GPU/GPUTracking/Base/GPUReconstruction.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ int32_t GPUReconstruction::InitPhaseAfterDevice()
(mProcessors[i].proc->*(mProcessors[i].InitializeProcessor))();
}

WriteConstantParams(); // First initialization, if the user doesn't use RunChains
WriteConstantParams(); // Initialize with initial values, can optionally be updated later

mInitialized = true;
return 0;
Expand Down Expand Up @@ -1105,7 +1105,12 @@ void GPUReconstruction::DumpSettings(const char* dir)
}
}

void GPUReconstruction::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p)
void GPUReconstruction::UpdateDynamicSettings(const GPUSettingsRecDynamic* d)
{
UpdateSettings(nullptr, nullptr, d);
}

void GPUReconstruction::UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p, const GPUSettingsRecDynamic* d)
{
if (g) {
mGRPSettings = *g;
Expand All @@ -1114,8 +1119,11 @@ void GPUReconstruction::UpdateSettings(const GPUSettingsGRP* g, const GPUSetting
mProcessingSettings.debugLevel = p->debugLevel;
mProcessingSettings.resetTimers = p->resetTimers;
}
GPURecoStepConfiguration w = mRecoSteps;
param().UpdateSettings(g, p, &w);
GPURecoStepConfiguration* w = nullptr;
if (mRecoSteps.steps.isSet(GPUDataTypes::RecoStep::TPCdEdx)) {
w = &mRecoSteps;
}
param().UpdateSettings(g, p, w, d);
if (mInitialized) {
WriteConstantParams();
}
Expand Down
3 changes: 2 additions & 1 deletion GPU/GPUTracking/Base/GPUReconstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ class GPUReconstruction
void SetSettings(const GPUSettingsGRP* grp, const GPUSettingsRec* rec = nullptr, const GPUSettingsProcessing* proc = nullptr, const GPURecoStepConfiguration* workflow = nullptr);
void SetResetTimers(bool reset) { mProcessingSettings.resetTimers = reset; } // May update also after Init()
void SetDebugLevelTmp(int32_t level) { mProcessingSettings.debugLevel = level; } // Temporarily, before calling SetSettings()
void UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p = nullptr);
void UpdateSettings(const GPUSettingsGRP* g, const GPUSettingsProcessing* p = nullptr, const GPUSettingsRecDynamic* d = nullptr);
void UpdateDynamicSettings(const GPUSettingsRecDynamic* d);
void SetOutputControl(const GPUOutputControl& v) { mOutputControl = v; }
void SetOutputControl(void* ptr, size_t size);
void SetInputControl(void* ptr, size_t size);
Expand Down
2 changes: 1 addition & 1 deletion GPU/GPUTracking/Base/GPUReconstructionCPU.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ int32_t GPUReconstructionCPU::RunChains()
mThreadId = GetThread();
}
if (mSlaves.size() || mMaster) {
WriteConstantParams(); // Reinitialize
WriteConstantParams(); // Reinitialize // TODO: Get this in sync with GPUChainTracking::DoQueuedUpdates, and consider the doublePipeline
}
for (uint32_t i = 0; i < mChains.size(); i++) {
int32_t retVal = mChains[i]->RunChain();
Expand Down
3 changes: 3 additions & 0 deletions GPU/GPUTracking/DataTypes/GPUNewCalibValues.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ void GPUNewCalibValues::updateFrom(const GPUNewCalibValues* from)
if (from->newContinuousMaxTimeBin) {
continuousMaxTimeBin = from->continuousMaxTimeBin;
}
if (from->newTPCTimeBinCut) {
tpcTimeBinCut = from->tpcTimeBinCut;
}
}
2 changes: 2 additions & 0 deletions GPU/GPUTracking/DataTypes/GPUNewCalibValues.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ namespace gpu
struct GPUNewCalibValues {
bool newSolenoidField = false;
bool newContinuousMaxTimeBin = false;
bool newTPCTimeBinCut = false;
float solenoidField = 0.f;
uint32_t continuousMaxTimeBin = 0;
int32_t tpcTimeBinCut = 0;

void updateFrom(const GPUNewCalibValues* from);
};
Expand Down
1 change: 1 addition & 0 deletions GPU/GPUTracking/DataTypes/GPUSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct GPUSettingsGRP {
int32_t grpContinuousMaxTimeBin = -2; // 0 for triggered events, -1 for automatic setting, -2 invalid default
int32_t needsClusterer = 0; // Set to true if the data requires the clusterizer
int32_t doCompClusterDecode = 0; // Set to true if the data contains compressed TPC clusters
int32_t tpcCutTimeBin = 0; // Cut TPC clusters and digits >= this cut
};

// Parameters of the current time frame
Expand Down
6 changes: 6 additions & 0 deletions GPU/GPUTracking/Definitions/GPUSettingsList.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ AddOptionRTC(pileupBwdNBC, uint8_t, 80, "", 0, "Pre-trigger Pile-up integration
AddHelp("help", 'h')
EndConfig()

// Dynamic settings, must NOT use AddOptionRTC(...) !!!
BeginSubConfig(GPUSettingsRecDynamic, dyn, configStandalone.rec, "RECDYN", 0, "Reconstruction settings", rec_dyn)
AddHelp("help", 'h')
EndConfig()

BeginSubConfig(GPUSettingsRec, rec, configStandalone, "REC", 0, "Reconstruction settings", rec)
AddOptionRTC(maxTrackQPtB5, float, 1.f / GPUCA_MIN_TRACK_PTB5_DEFAULT, "", 0, "required max Q/Pt (==min Pt) of tracks")
AddOptionRTC(nonConsecutiveIDs, int8_t, false, "", 0, "Non-consecutive cluster IDs as in HLT, disables features that need access to slice data in TPC merger")
Expand All @@ -193,6 +198,7 @@ AddOptionRTC(trackingRefitGPUModel, int8_t, 1, "", 0, "Use GPU track model for t
AddCustomCPP(void SetMinTrackPtB5(float v) { maxTrackQPtB5 = v > 0.001f ? (1.f / v) : (1.f / 0.001f); })
AddSubConfig(GPUSettingsRecTPC, tpc)
AddSubConfig(GPUSettingsRecTRD, trd)
AddSubConfig(GPUSettingsRecDynamic, dyn)
AddHelp("help", 'h')
EndConfig()

Expand Down
4 changes: 3 additions & 1 deletion GPU/GPUTracking/Global/GPUChainTracking.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,9 @@ int32_t GPUChainTracking::DoQueuedUpdates(int32_t stream, bool updateSlave)
if (mNewCalibValues->newContinuousMaxTimeBin) {
grp->grpContinuousMaxTimeBin = mNewCalibValues->continuousMaxTimeBin;
}
}
if (mNewCalibValues->newTPCTimeBinCut) {
grp->tpcCutTimeBin = mNewCalibValues->tpcTimeBinCut;
}
}
if (GetProcessingSettings().tpcDownscaledEdx != 0) {
p = &GetProcessingSettings();
Expand Down
1 change: 1 addition & 0 deletions GPU/GPUTracking/Global/GPUChainTrackingClusterizer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ int32_t GPUChainTracking::RunTPCClusterizer(bool synchronizeOutput)
return ForwardTPCDigits();
}
#ifdef GPUCA_TPC_GEOMETRY_O2
int32_t tpcTimeBinCut = mUpdateNewCalibObjects && mNewCalibValues->newTPCTimeBinCut ? mNewCalibValues->tpcTimeBinCut : param().tpcCutTimeBin;
mRec->PushNonPersistentMemory(qStr2Tag("TPCCLUST"));
const auto& threadContext = GetThreadContext();
const bool doGPU = GetRecoStepsGPU() & RecoStep::TPCClusterFinding;
Expand Down
4 changes: 2 additions & 2 deletions GPU/GPUTracking/Global/GPUChainTrackingCompression.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ int32_t GPUChainTracking::RunTPCDecompression()
GPUError("Error decompressing clusters");
return 1;
}
if (GetProcessingSettings().tpcApplyCFCutsAtDecoding) {
RunTPCClusterFilter(mClusterNativeAccess.get(), allocatorFinal, true);
if (GetProcessingSettings().tpcApplyCFCutsAtDecoding || param().tpcCutTimeBin > 0) {
RunTPCClusterFilter(mClusterNativeAccess.get(), allocatorFinal, GetProcessingSettings().tpcApplyCFCutsAtDecoding);
}
decompressTimer.Stop();
mIOPtrs.clustersNative = mClusterNativeAccess.get();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,9 @@ void GPUChainTracking::RunTPCClusterFilter(o2::tpc::ClusterNativeAccess* cluster
keep = keep && cl.qTot > param().rec.tpc.cfQTotCutoff && cl.qMax > param().rec.tpc.cfQMaxCutoff;
keep = keep && (!(cl.getFlags() & o2::tpc::ClusterNative::flagSingle) || ((cl.sigmaPadPacked || cl.qMax > param().rec.tpc.cfQMaxCutoffSinglePad) && (cl.sigmaTimePacked || cl.qMax > param().rec.tpc.cfQMaxCutoffSingleTime)));
}
if (param().tpcCutTimeBin > 0) {
keep = keep & cl.getTime() < param().tpcCutTimeBin;
}
keep = keep && (!GetProcessingSettings().tpcApplyDebugClusterFilter || clusterFilter.filter(iSector, iRow, cl));
if (iPhase && keep) {
outputBuffer[countTotal] = cl;
Expand Down
1 change: 1 addition & 0 deletions GPU/Workflow/include/GPUWorkflow/GPUWorkflowSpec.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ class GPURecoWorkflowSpec : public o2::framework::Task
bool mITSGeometryCreated = false;
bool mTRDGeometryCreated = false;
bool mPropagatorInstanceCreated = false;
int32_t mTPCCutAtTimeBin = -1;
};

} // end namespace gpu
Expand Down
9 changes: 7 additions & 2 deletions GPU/Workflow/src/GPUWorkflowSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1013,9 +1013,8 @@ void GPURecoWorkflowSpec::doCalibUpdates(o2::framework::ProcessingContext& pc, c
LOG(info) << "Updating solenoid field " << newCalibValues.solenoidField;
}
if (mAutoContinuousMaxTimeBin) {
mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mTFSettings->nHBFPerTF);
newCalibValues.newContinuousMaxTimeBin = true;
newCalibValues.continuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin;
newCalibValues.continuousMaxTimeBin = mConfig->configGRP.grpContinuousMaxTimeBin = GPUO2InterfaceUtils::getTpcMaxTimeBinFromNHbf(mTFSettings->nHBFPerTF);
LOG(info) << "Updating max time bin " << newCalibValues.continuousMaxTimeBin << " (" << mTFSettings->nHBFPerTF << " orbits)";
}

Expand Down Expand Up @@ -1050,6 +1049,11 @@ void GPURecoWorkflowSpec::doCalibUpdates(o2::framework::ProcessingContext& pc, c
if (mSpecConfig.runITSTracking) {
needCalibUpdate = fetchCalibsCCDBITS(pc) || needCalibUpdate;
}
if (mTPCCutAtTimeBin != mConfig->configGRP.tpcCutTimeBin) {
newCalibValues.newTPCTimeBinCut = true;
newCalibValues.tpcTimeBinCut = mConfig->configGRP.tpcCutTimeBin = mTPCCutAtTimeBin;
needCalibUpdate = true;
}
if (needCalibUpdate) {
LOG(info) << "Updating GPUReconstruction calibration objects";
mGPUReco->UpdateCalibration(newCalibObjects, newCalibValues);
Expand Down Expand Up @@ -1098,6 +1102,7 @@ Inputs GPURecoWorkflowSpec::inputs()
if (mSpecConfig.outputTracks || mSpecConfig.caClusterer) {
// calibration objects for TPC clusterization
inputs.emplace_back("tpcgain", gDataOriginTPC, "PADGAINFULL", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::CalPadGainFull)));
inputs.emplace_back("tpcaltrosync", gDataOriginTPC, "ALTROSYNCSIGNAL", 0, Lifetime::Condition, ccdbParamSpec(o2::tpc::CDBTypeMap.at(o2::tpc::CDBType::AltroSyncSignal)));
}
if (mSpecConfig.outputTracks) {
// calibration objects for TPC tracking
Expand Down
4 changes: 4 additions & 0 deletions GPU/Workflow/src/GPUWorkflowTPC.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,10 @@ bool GPURecoWorkflowSpec::fetchCalibsCCDBTPC<GPUCalibObjectsConst>(ProcessingCon
pc.inputs().get<o2::tpc::CalDet<float>*>("tpcgain");
}

if (mSpecConfig.outputTracks || mSpecConfig.caClusterer) {
mTPCCutAtTimeBin = pc.inputs().get<o2::tpc::CalDet<o2::tpc::AltroSyncSignal>*>("tpcaltrosync")->getTB2Cut(pc.services().get<o2::framework::TimingInfo>().tfCounter);
}

// these calibrations are only defined for the tracking
if (mSpecConfig.outputTracks) {
// update the calibration objects in case they changed in the CCDB
Expand Down
Loading