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)
74 std::shared_ptr<DataRequest> mDataRequest;
75 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
79 bool mEnableCCDBParams =
false;
80 bool mEnableCascades =
false;
81 bool mEnable3BodyVertices =
false;
82 bool mEnableStrangenessTracking =
false;
99 if (mEnableStrangenessTracking) {
108 mTPCCorrMapsLoader.
init(ic);
114 double timeCPU0 = mTimer.CpuTime(), timeReal0 = mTimer.RealTime();
116 static std::array<size_t, 3> fitCalls{};
120 updateTimeDependentParams(pc);
122 mVertexer.
process(recoData, pc);
126 LOGP(info,
"Found {} V0s ({} fits), {} cascades ({} fits), {} 3-body decays ({} fits), {} strange tracks. Timing: CPU: {:.2f} Real: {:.2f} s",
128 mTimer.CpuTime() - timeCPU0, mTimer.RealTime() - timeReal0);
134 LOGF(info,
"Secondary vertexing total timing: Cpu: %.3e Real: %.3e s in %d slots, nThreads = %d",
135 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1, mVertexer.
getNThreads());
150 LOG(info) <<
"cluster dictionary updated";
160 LOG(info) <<
"SVertexer Params updated from ccdb";
164 LOG(info) <<
"ITS GeomtetryTGeo loaded from ccdb";
168#ifdef ENABLE_UPGRADES
170 LOG(info) <<
"cluster dictionary updated";
184 static bool initOnceDone =
false;
188 if (mEnableCCDBParams) {
199 if (mEnableStrangenessTracking) {
204#ifdef ENABLE_UPGRADES
212 bool updateMaps =
false;
219 LOGP(info,
"Updating TPC fast transform map with new VDrift factor of {} wrt reference {} and DriftTimeOffset correction {} wrt {} from source {}",
231 if (mEnableStrangenessTracking) {
244 std::vector<OutputSpec> outputs;
246 {
"material-lut-path", VariantType::String,
"", {
"Path of the material LUT file"}},
247 {
"threads", VariantType::Int, 1, {
"Number of threads"}}};
248 auto dataRequest = std::make_shared<DataRequest>();
249 if (enableCCDBParams) {
250 dataRequest->inputs.emplace_back(
"SVParam",
"GLO",
"SVPARAM", 0, Lifetime::Condition,
ccdbParamSpec(
"GLO/Config/SVertexerParam"));
253 if (enableStrangenesTracking) {
257 throw std::runtime_error(
"Tracks involving TPC were requested w/o requesting TPC-only tracks");
263 dataRequest->requestClusters(srcClus, useMC);
265#ifdef ENABLE_UPGRADES
267 dataRequest->inputs.emplace_back(
"cldict",
"IT3",
"CLUSDICT", Lifetime::Condition,
ccdbParamSpec(
"IT3/Calib/ClusterDictionary"));
270 dataRequest->requestTracks(
src, useMC);
271 dataRequest->requestPrimaryVertices(useMC);
272 dataRequest->inputs.emplace_back(
"meanvtx",
"GLO",
"MEANVERTEX", 0, Lifetime::Condition,
ccdbParamSpec(
"GLO/Calib/MeanVertex", {}, 1));
273 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(
false,
281 if (!useGeom && enableStrangenesTracking) {
282 ggRequest->addInput({
"itsTGeo",
"ITS",
"GEOMTGEO", 0, Lifetime::Condition,
framework::ccdbParamSpec(
"ITS/Config/Geometry")}, dataRequest->inputs);
288 outputs.emplace_back(
"GLO",
"V0S_IDX", 0, Lifetime::Timeframe);
289 outputs.emplace_back(
"GLO",
"V0S", 0, Lifetime::Timeframe);
290 outputs.emplace_back(
"GLO",
"PVTX_V0REFS", 0, Lifetime::Timeframe);
292 outputs.emplace_back(
"GLO",
"CASCS_IDX", 0, Lifetime::Timeframe);
293 outputs.emplace_back(
"GLO",
"CASCS", 0, Lifetime::Timeframe);
294 outputs.emplace_back(
"GLO",
"PVTX_CASCREFS", 0, Lifetime::Timeframe);
296 outputs.emplace_back(
"GLO",
"DECAYS3BODY_IDX", 0, Lifetime::Timeframe);
297 outputs.emplace_back(
"GLO",
"DECAYS3BODY", 0, Lifetime::Timeframe);
298 outputs.emplace_back(
"GLO",
"PVTX_3BODYREFS", 0, Lifetime::Timeframe);
300 if (enableStrangenesTracking) {
301 outputs.emplace_back(
"GLO",
"STRANGETRACKS", 0, Lifetime::Timeframe);
302 outputs.emplace_back(
"GLO",
"CLUSUPDATES", 0, Lifetime::Timeframe);
304 outputs.emplace_back(
"GLO",
"STRANGETRACKS_MC", 0, Lifetime::Timeframe);
305 LOG(info) <<
"Strangeness tracker will use MC";
310 "secondary-vertexing",
313 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) 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)
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)
recalculate inverse correction
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
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"