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)
75 std::shared_ptr<DataRequest> mDataRequest;
76 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
80 bool mEnableCCDBParams =
false;
81 bool mEnableCascades =
false;
82 bool mEnable3BodyVertices =
false;
83 bool mEnableStrangenessTracking =
false;
100 if (mEnableStrangenessTracking) {
109 mTPCCorrMapsLoader.
init(ic);
115 double timeCPU0 = mTimer.CpuTime(), timeReal0 = mTimer.RealTime();
117 static std::array<size_t, 3> fitCalls{};
121 updateTimeDependentParams(pc);
123 mVertexer.
process(recoData, pc);
127 LOGP(info,
"Found {} V0s ({} fits), {} cascades ({} fits), {} 3-body decays ({} fits), {} strange tracks. Timing: CPU: {:.2f} Real: {:.2f} s",
129 mTimer.CpuTime() - timeCPU0, mTimer.RealTime() - timeReal0);
135 LOGF(info,
"Secondary vertexing total timing: Cpu: %.3e Real: %.3e s in %d slots, nThreads = %d",
136 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1, mVertexer.
getNThreads());
151 LOG(info) <<
"cluster dictionary updated";
161 LOG(info) <<
"SVertexer Params updated from ccdb";
165 LOG(info) <<
"ITS GeomtetryTGeo loaded from ccdb";
169#ifdef ENABLE_UPGRADES
171 LOG(info) <<
"cluster dictionary updated";
185 static bool initOnceDone =
false;
189 if (mEnableCCDBParams) {
200 if (mEnableStrangenessTracking) {
205#ifdef ENABLE_UPGRADES
213 bool updateMaps =
false;
220 LOGP(info,
"Updating TPC fast transform map with new VDrift factor of {} wrt reference {} and DriftTimeOffset correction {} wrt {} from source {}",
232 if (mEnableStrangenessTracking) {
245 std::vector<OutputSpec> outputs;
247 {
"material-lut-path", VariantType::String,
"", {
"Path of the material LUT file"}},
248 {
"threads", VariantType::Int, 1, {
"Number of threads"}}};
249 auto dataRequest = std::make_shared<DataRequest>();
250 if (enableCCDBParams) {
251 dataRequest->inputs.emplace_back(
"SVParam",
"GLO",
"SVPARAM", 0, Lifetime::Condition,
ccdbParamSpec(
"GLO/Config/SVertexerParam"));
254 if (enableStrangenesTracking) {
258 throw std::runtime_error(
"Tracks involving TPC were requested w/o requesting TPC-only tracks");
264 dataRequest->requestClusters(srcClus, useMC);
266#ifdef ENABLE_UPGRADES
268 dataRequest->inputs.emplace_back(
"cldict",
"IT3",
"CLUSDICT", Lifetime::Condition,
ccdbParamSpec(
"IT3/Calib/ClusterDictionary"));
271 dataRequest->requestTracks(
src, useMC);
272 dataRequest->requestPrimaryVertices(useMC);
273 dataRequest->inputs.emplace_back(
"meanvtx",
"GLO",
"MEANVERTEX", 0, Lifetime::Condition,
ccdbParamSpec(
"GLO/Calib/MeanVertex", {}, 1));
274 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(
false,
282 if (!useGeom && enableStrangenesTracking) {
283 ggRequest->addInput({
"itsTGeo",
"ITS",
"GEOMTGEO", 0, Lifetime::Condition,
framework::ccdbParamSpec(
"ITS/Config/Geometry")}, dataRequest->inputs);
289 outputs.emplace_back(
"GLO",
"V0S_IDX", 0, Lifetime::Timeframe);
290 outputs.emplace_back(
"GLO",
"V0S", 0, Lifetime::Timeframe);
291 outputs.emplace_back(
"GLO",
"PVTX_V0REFS", 0, Lifetime::Timeframe);
293 outputs.emplace_back(
"GLO",
"CASCS_IDX", 0, Lifetime::Timeframe);
294 outputs.emplace_back(
"GLO",
"CASCS", 0, Lifetime::Timeframe);
295 outputs.emplace_back(
"GLO",
"PVTX_CASCREFS", 0, Lifetime::Timeframe);
297 outputs.emplace_back(
"GLO",
"DECAYS3BODY_IDX", 0, Lifetime::Timeframe);
298 outputs.emplace_back(
"GLO",
"DECAYS3BODY", 0, Lifetime::Timeframe);
299 outputs.emplace_back(
"GLO",
"PVTX_3BODYREFS", 0, Lifetime::Timeframe);
301 if (enableStrangenesTracking) {
302 outputs.emplace_back(
"GLO",
"STRANGETRACKS", 0, Lifetime::Timeframe);
303 outputs.emplace_back(
"GLO",
"CLUSUPDATES", 0, Lifetime::Timeframe);
305 outputs.emplace_back(
"GLO",
"STRANGETRACKS_MC", 0, Lifetime::Timeframe);
306 LOG(info) <<
"Strangeness tracker will use MC";
311 "secondary-vertexing",
314 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)
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()
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 ...
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"