Skip to content

Commit

Permalink
SVertexer: load config params form ccdb
Browse files Browse the repository at this point in the history
  • Loading branch information
Felix Schlepper committed Nov 30, 2023
1 parent 8cdb0ac commit eb68592
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace vertexing
{

/// create a processor spec
o2::framework::DataProcessorSpec getSecondaryVertexingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);
o2::framework::DataProcessorSpec getSecondaryVertexingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool enableCCDBParams, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts);

} // namespace vertexing
} // namespace o2
Expand Down
36 changes: 25 additions & 11 deletions Detectors/GlobalTrackingWorkflow/src/SecondaryVertexingSpec.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace o2d = o2::dataformats;
class SecondaryVertexingSpec : public Task
{
public:
SecondaryVertexingSpec(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, GTrackID::mask_t src, bool enabCasc, bool enable3body, bool enableStrangenessTracking, bool useMC) : mDataRequest(dr), mGGCCDBRequest(gr), mSrc(src), mEnableCascades(enabCasc), mEnable3BodyVertices(enable3body), mEnableStrangenessTracking(enableStrangenessTracking), mUseMC(useMC) {}
SecondaryVertexingSpec(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr, GTrackID::mask_t src, bool enabCasc, bool enable3body, bool enableStrangenessTracking, bool enableCCDBParams, bool useMC) : mDataRequest(dr), mGGCCDBRequest(gr), mSrc(src), mEnableCascades(enabCasc), mEnable3BodyVertices(enable3body), mEnableStrangenessTracking(enableStrangenessTracking), mEnableCCDBParams(enableCCDBParams), mUseMC(useMC) {}
~SecondaryVertexingSpec() override = default;
void init(InitContext& ic) final;
void run(ProcessingContext& pc) final;
Expand All @@ -71,6 +71,7 @@ class SecondaryVertexingSpec : public Task
o2::tpc::VDriftHelper mTPCVDriftHelper{};
o2::tpc::CorrectionMapsLoader mTPCCorrMapsLoader{};
GTrackID::mask_t mSrc{};
bool mEnableCCDBParams = false;
bool mEnableCascades = false;
bool mEnable3BodyVertices = false;
bool mEnableStrangenessTracking = false;
Expand Down Expand Up @@ -150,6 +151,11 @@ void SecondaryVertexingSpec::finaliseCCDB(ConcreteDataMatcher& matcher, void* ob
mVertexer.setMeanVertex((const o2::dataformats::MeanVertexObject*)obj);
return;
}
if (matcher == ConcreteDataMatcher("GLO", "SVPARAM", 0)) {
LOG(info) << "SVertexer Params updated from ccdb";
SVertexerParams::Instance().printKeyValues(true, true);
return;
}
}

void SecondaryVertexingSpec::updateTimeDependentParams(ProcessingContext& pc)
Expand All @@ -163,7 +169,12 @@ void SecondaryVertexingSpec::updateTimeDependentParams(ProcessingContext& pc)
if (!initOnceDone) { // this params need to be queried only once
initOnceDone = true;
mVertexer.init();
if (mEnableCCDBParams) {
// for reading the calib objects from the CCDB
pc.inputs().get<o2::vertexing::SVertexerParams>("SVParam");
}
if (pc.services().get<const o2::framework::DeviceSpec>().inputTimesliceId == 0) {
// setting and or overwriting the configurable params
SVertexerParams::Instance().printKeyValues();
}
if (mEnableStrangenessTracking) {
Expand Down Expand Up @@ -202,13 +213,16 @@ void SecondaryVertexingSpec::updateTimeDependentParams(ProcessingContext& pc)
pc.inputs().get<o2::dataformats::MeanVertexObject*>("meanvtx");
}

DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts)
DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool enableCCDBParams, bool useMC, const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts)
{
std::vector<OutputSpec> outputs;
Options opts{
{"material-lut-path", VariantType::String, "", {"Path of the material LUT file"}},
{"threads", VariantType::Int, 1, {"Number of threads"}}};
auto dataRequest = std::make_shared<DataRequest>();
if (enableCCDBParams) {
dataRequest->inputs.emplace_back("SVParam", "GLO", "SVPARAM", 0, Lifetime::Condition, ccdbParamSpec("GLO/Config/SVertexerParam"));
}
GTrackID::mask_t srcClus{};
if (enableStrangenesTracking) {
src |= (srcClus = GTrackID::getSourceMask(GTrackID::ITS));
Expand All @@ -234,17 +248,17 @@ DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCas
o2::tpc::VDriftHelper::requestCCDBInputs(dataRequest->inputs);
o2::tpc::CorrectionMapsLoader::requestCCDBInputs(dataRequest->inputs, opts, sclOpts);
}
outputs.emplace_back("GLO", "V0S_IDX", 0, Lifetime::Timeframe); // found V0s indices
outputs.emplace_back("GLO", "V0S", 0, Lifetime::Timeframe); // found V0s
outputs.emplace_back("GLO", "PVTX_V0REFS", 0, Lifetime::Timeframe); // prim.vertex -> V0s refs
outputs.emplace_back("GLO", "V0S_IDX", 0, Lifetime::Timeframe); // found V0s indices
outputs.emplace_back("GLO", "V0S", 0, Lifetime::Timeframe); // found V0s
outputs.emplace_back("GLO", "PVTX_V0REFS", 0, Lifetime::Timeframe); // prim.vertex -> V0s refs

outputs.emplace_back("GLO", "CASCS_IDX", 0, Lifetime::Timeframe); // found Cascades indices
outputs.emplace_back("GLO", "CASCS", 0, Lifetime::Timeframe); // found Cascades
outputs.emplace_back("GLO", "PVTX_CASCREFS", 0, Lifetime::Timeframe); // prim.vertex -> Cascades refs
outputs.emplace_back("GLO", "CASCS_IDX", 0, Lifetime::Timeframe); // found Cascades indices
outputs.emplace_back("GLO", "CASCS", 0, Lifetime::Timeframe); // found Cascades
outputs.emplace_back("GLO", "PVTX_CASCREFS", 0, Lifetime::Timeframe); // prim.vertex -> Cascades refs

outputs.emplace_back("GLO", "DECAYS3BODY_IDX", 0, Lifetime::Timeframe); // found 3 body vertices indices
outputs.emplace_back("GLO", "DECAYS3BODY", 0, Lifetime::Timeframe); // found 3 body vertices
outputs.emplace_back("GLO", "PVTX_3BODYREFS", 0, Lifetime::Timeframe); // prim.vertex -> 3 body vertices refs
outputs.emplace_back("GLO", "DECAYS3BODY", 0, Lifetime::Timeframe); // found 3 body vertices
outputs.emplace_back("GLO", "PVTX_3BODYREFS", 0, Lifetime::Timeframe); // prim.vertex -> 3 body vertices refs

if (enableStrangenesTracking) {
outputs.emplace_back("GLO", "STRANGETRACKS", 0, Lifetime::Timeframe); // found strange track
Expand All @@ -259,7 +273,7 @@ DataProcessorSpec getSecondaryVertexingSpec(GTrackID::mask_t src, bool enableCas
"secondary-vertexing",
dataRequest->inputs,
outputs,
AlgorithmSpec{adaptFromTask<SecondaryVertexingSpec>(dataRequest, ggRequest, src, enableCasc, enable3body, enableStrangenesTracking, useMC)},
AlgorithmSpec{adaptFromTask<SecondaryVertexingSpec>(dataRequest, ggRequest, src, enableCasc, enable3body, enableStrangenesTracking, enableCCDBParams, useMC)},
opts};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void customize(std::vector<ConfigParamSpec>& workflowOptions)
{"disable-cascade-finder", o2::framework::VariantType::Bool, false, {"do not run cascade finder"}},
{"disable-3body-finder", o2::framework::VariantType::Bool, false, {"do not run 3 body finder"}},
{"disable-strangeness-tracker", o2::framework::VariantType::Bool, false, {"do not run strangeness tracker"}},
{"disable-ccdb-params", o2::framework::VariantType::Bool, false, {"do not load the svertexer parameters from the ccdb"}},
{"configKeyValues", VariantType::String, "", {"Semicolon separated key=value strings ..."}},
{"combine-source-devices", o2::framework::VariantType::Bool, false, {"merge DPL source devices"}}};
o2::tpc::CorrectionMapsLoader::addGlobalOptions(options);
Expand All @@ -78,6 +79,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
o2::conf::ConfigurableParam::writeINI("o2secondary-vertexing-workflow_configuration.ini");
bool useMC = !configcontext.options().get<bool>("disable-mc");
auto disableRootOut = configcontext.options().get<bool>("disable-root-output");
auto enableCCDBParams = !configcontext.options().get<bool>("disable-ccdb-params");
auto enableCasc = !configcontext.options().get<bool>("disable-cascade-finder");
auto enable3body = !configcontext.options().get<bool>("disable-3body-finder");
auto enableStrTr = !configcontext.options().get<bool>("disable-strangeness-tracker");
Expand All @@ -95,7 +97,7 @@ WorkflowSpec defineDataProcessing(ConfigContext const& configcontext)
}
WorkflowSpec specs;

specs.emplace_back(o2::vertexing::getSecondaryVertexingSpec(src, enableCasc, enable3body, enableStrTr, useMC, sclOpt));
specs.emplace_back(o2::vertexing::getSecondaryVertexingSpec(src, enableCasc, enable3body, enableStrTr, enableCCDBParams, useMC, sclOpt));

// only TOF clusters are needed if TOF is involved, no clusters MC needed
WorkflowSpec inputspecs;
Expand Down
10 changes: 10 additions & 0 deletions Detectors/Vertexing/include/DetectorsVertexing/SVertexerParams.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ struct SVertexerParams : public o2::conf::ConfigurableParamHelper<SVertexerParam
O2ParamDef(SVertexerParams, "svertexer");
};
} // namespace vertexing

namespace framework
{
template <typename T>
struct is_messageable;
template <>
struct is_messageable<o2::vertexing::SVertexerParams> : std::true_type {
};
} // namespace framework

} // end namespace o2

#endif

0 comments on commit eb68592

Please sign in to comment.