32#include "TStopwatch.h"
61 SecondaryVertexingSpec(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr,
const o2::tpc::CorrectionMapsLoaderGloOpts& sclOpts,
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)
77 std::shared_ptr<DataRequest> mDataRequest;
78 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
82 bool mEnableCCDBParams =
false;
83 bool mEnableCascades =
false;
84 bool mEnable3BodyVertices =
false;
85 bool mEnableStrangenessTracking =
false;
102 if (mEnableStrangenessTracking) {
111 mTPCCorrMapsLoader.
init(ic);
117 double timeCPU0 = mTimer.CpuTime(), timeReal0 = mTimer.RealTime();
119 static std::array<size_t, 3> fitCalls{};
123 updateTimeDependentParams(pc);
125 mVertexer.
process(recoData, pc);
129 LOGP(info,
"Found {} V0s ({} fits), {} cascades ({} fits), {} 3-body decays ({} fits), {} strange tracks. Timing: CPU: {:.2f} Real: {:.2f} s",
131 mTimer.CpuTime() - timeCPU0, mTimer.RealTime() - timeReal0);
134 static bool first =
true;
139 if (mEnableStrangenessTracking) {
148 LOGF(info,
"Secondary vertexing total timing: Cpu: %.3e Real: %.3e s in %d slots, nThreads = %d",
149 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1, mVertexer.
getNThreads());
164 LOG(info) <<
"cluster dictionary updated";
174 LOG(info) <<
"SVertexer Params updated from ccdb";
178 LOG(info) <<
"ITS GeomtetryTGeo loaded from ccdb";
182#ifdef ENABLE_UPGRADES
184 LOG(info) <<
"cluster dictionary updated";
198 static bool initOnceDone =
false;
202 if (mEnableCCDBParams) {
213 if (mEnableStrangenessTracking) {
218#ifdef ENABLE_UPGRADES
226 bool updateMaps =
false;
233 LOGP(info,
"Updating TPC fast transform map with new VDrift factor of {} wrt reference {} and DriftTimeOffset correction {} wrt {} from source {}",
245 if (mEnableStrangenessTracking) {
258 std::vector<OutputSpec> outputs;
260 {
"material-lut-path", VariantType::String,
"", {
"Path of the material LUT file"}},
261 {
"threads", VariantType::Int, 1, {
"Number of threads"}}};
262 auto dataRequest = std::make_shared<DataRequest>();
263 if (enableCCDBParams) {
264 dataRequest->inputs.emplace_back(
"SVParam",
"GLO",
"SVPARAM", 0, Lifetime::Condition,
ccdbParamSpec(
"GLO/Config/SVertexerParam"));
267 if (enableStrangenesTracking) {
271 LOGP(warn,
"Tracks involving TPC were requested w/o requesting TPC-only tracks, simplified selection will be applied");
277 dataRequest->requestClusters(srcClus, useMC);
279#ifdef ENABLE_UPGRADES
281 dataRequest->inputs.emplace_back(
"cldict",
"IT3",
"CLUSDICT", Lifetime::Condition,
ccdbParamSpec(
"IT3/Calib/ClusterDictionary"));
284 dataRequest->requestTracks(
src, useMC);
285 dataRequest->requestPrimaryVertices(useMC);
286 dataRequest->inputs.emplace_back(
"meanvtx",
"GLO",
"MEANVERTEX", 0, Lifetime::Condition,
ccdbParamSpec(
"GLO/Calib/MeanVertex", {}, 1));
287 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(
false,
295 if (!useGeom && enableStrangenesTracking) {
296 ggRequest->addInput({
"itsTGeo",
"ITS",
"GEOMTGEO", 0, Lifetime::Condition,
framework::ccdbParamSpec(
"ITS/Config/Geometry")}, dataRequest->inputs);
302 outputs.emplace_back(
"GLO",
"V0S_IDX", 0, Lifetime::Timeframe);
303 outputs.emplace_back(
"GLO",
"V0S", 0, Lifetime::Timeframe);
304 outputs.emplace_back(
"GLO",
"PVTX_V0REFS", 0, Lifetime::Timeframe);
306 outputs.emplace_back(
"GLO",
"CASCS_IDX", 0, Lifetime::Timeframe);
307 outputs.emplace_back(
"GLO",
"CASCS", 0, Lifetime::Timeframe);
308 outputs.emplace_back(
"GLO",
"PVTX_CASCREFS", 0, Lifetime::Timeframe);
310 outputs.emplace_back(
"GLO",
"DECAYS3BODY_IDX", 0, Lifetime::Timeframe);
311 outputs.emplace_back(
"GLO",
"DECAYS3BODY", 0, Lifetime::Timeframe);
312 outputs.emplace_back(
"GLO",
"PVTX_3BODYREFS", 0, Lifetime::Timeframe);
314 if (enableStrangenesTracking) {
315 outputs.emplace_back(
"GLO",
"STRANGETRACKS", 0, Lifetime::Timeframe);
316 outputs.emplace_back(
"GLO",
"CLUSUPDATES", 0, Lifetime::Timeframe);
318 outputs.emplace_back(
"GLO",
"STRANGETRACKS_MC", 0, Lifetime::Timeframe);
319 LOG(info) <<
"Strangeness tracker will use MC";
324 "secondary-vertexing",
327 AlgorithmSpec{adaptFromTask<SecondaryVertexingSpec>(dataRequest, ggRequest, sclOpts,
src, enableCasc, enable3body, enableStrangenesTracking, enableCCDBParams, useMC)},
Helper class to access load maps from CCDB.
Definition of the GeometryManager class.
Helper for geometry and GRP related CCDB requests.
Global index for barrel track: provides provenance (detectors combination), index in respective array...
Definition of the Names Generator class.
Definition of the ITS track.
Result of refitting TPC-ITS matched track.
Helper class to extract VDrift from different sources.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
static std::string getConfigOutputFileName(const std::string &procName, const std::string &confName="", bool json=true)
GPUd() value_type estimateLTFast(o2 static GPUd() float estimateLTIncrement(const o2 PropagatorImpl * Instance(bool uninitialized=false)
void printKeyValues(bool showProv=true, bool useLogger=false, bool withPadding=true, bool showHash=true) const final
static const StrangenessTrackingParamConfig & Instance()
static void write(std::string const &filename, std::string const &keyOnly="")
TO BE DONE: extend to generic N body vertex.
T get(const char *key) const
ConfigParamRegistry const & options()
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
void setLumiScaleType(int32_t v)
void setLumiScaleMode(int32_t v)
void setCheckCTPIDCConsistency(bool v)
static GeometryTGeo * Instance()
void fillMatrixCache(int mask) override
static void adopt(GeometryTGeo *raw, bool canDelete=false)
void setConfigParams(const StrangenessTrackingParamConfig *params)
void setupThreads(int nThreads=1)
void setCorrType(const o2::base::PropagatorImpl< float >::MatCorrType &type)
void setClusterDictionaryITS(const o2::itsmft::TopologyDictionary *d)
void setMCTruthOn(bool v)
void extractCCDBInputs(o2::framework::ProcessingContext &pc)
void updateVDrift(float vdriftCorr, float vdrifRef, float driftTimeOffset=0)
bool accountCCDBInputs(const o2::framework::ConcreteDataMatcher &matcher, void *obj)
static void requestCCDBInputs(std::vector< o2::framework::InputSpec > &inputs, std::vector< o2::framework::ConfigParamSpec > &options, const CorrectionMapsLoaderGloOpts &gloOpts)
void init(o2::framework::InitContext &ic)
static void requestCCDBInputs(std::vector< o2::framework::InputSpec > &inputs, bool laser=true, bool itstpcTgl=true)
void extractCCDBInputs(o2::framework::ProcessingContext &pc, bool laser=true, bool itstpcTgl=true)
const VDriftCorrFact & getVDriftObject() const
bool accountCCDBInputs(const o2::framework::ConcreteDataMatcher &matcher, void *obj)
static std::string_view getSourceName(Source s)
void setEnableCascades(bool v)
void setTPCCorrMaps(o2::gpu::CorrectionMapsHelper *maph)
std::array< size_t, 3 > getNFitterCalls() const
void setEnable3BodyDecays(bool v)
void process(const o2::globaltracking::RecoContainer &recoTracks, o2::framework::ProcessingContext &pc)
void setTPCVDrift(const o2::tpc::VDriftCorrFact &v)
void setMeanVertex(const o2::dataformats::MeanVertexObject *v)
void setStrangenessTracker(o2::strangeness_tracking::StrangenessTracker *tracker)
int getNStrangeTracks() const
SecondaryVertexingSpec(std::shared_ptr< DataRequest > dr, std::shared_ptr< o2::base::GRPGeomRequest > gr, const o2::tpc::CorrectionMapsLoaderGloOpts &sclOpts, GTrackID::mask_t src, bool enabCasc, bool enable3body, bool enableStrangenessTracking, bool enableCCDBParams, bool useMC)
~SecondaryVertexingSpec() override=default
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj) final
void endOfStream(EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void init(InitContext &ic) final
void run(ProcessingContext &pc) final
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > ccdbParamSpec(std::string const &path, int runDependent, std::vector< CCDBMetadata > metadata={}, int qrate=0)
std::vector< ConfigParamSpec > Options
o2::framework::DataProcessorSpec getSecondaryVertexingSpec(o2::dataformats::GlobalTrackID::mask_t src, bool enableCasc, bool enable3body, bool enableStrangenesTracking, bool enableCCDBParams, bool useMC, bool useGeom, const o2::tpc::CorrectionMapsLoaderGloOpts &sclOpts)
create a processor spec
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
std::string name
The name of the associated DataProcessorSpec.
size_t inputTimesliceId
The time pipelining id of this particular device.
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
int lumiType
what estimator to used for corrections scaling: 0: no scaling, 1: CTP, 2: IDC
bool checkCTPIDCconsistency
int lumiMode
what corrections method to use: 0: classical scaling, 1: Using of the derivative map,...
float refTimeOffset
additive time offset reference (\mus)
float refVDrift
reference vdrift for which factor was extracted
float getTimeOffset() const
float timeOffsetCorr
additive time offset correction (\mus)
float corrFact
drift velocity correction factor (multiplicative)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"