15#include <TObjString.h>
34#include "TStopwatch.h"
62 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) {}
72 std::shared_ptr<DataRequest> mDataRequest;
73 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
77 bool mEnableCCDBParams =
false;
78 bool mEnableCascades =
false;
79 bool mEnable3BodyVertices =
false;
80 bool mEnableStrangenessTracking =
false;
97 if (mEnableStrangenessTracking) {
109 double timeCPU0 = mTimer.CpuTime(), timeReal0 = mTimer.RealTime();
111 static std::array<size_t, 3> fitCalls{};
115 updateTimeDependentParams(pc);
117 mVertexer.
process(recoData, pc);
121 LOGP(info,
"Found {} V0s ({} fits), {} cascades ({} fits), {} 3-body decays ({} fits), {} strange tracks. Timing: CPU: {:.2f} Real: {:.2f} s",
123 mTimer.CpuTime() - timeCPU0, mTimer.RealTime() - timeReal0);
129 static bool first =
true;
136 md.SetOwnerKeyValue();
138 if (mEnableStrangenessTracking) {
150 LOGF(info,
"Secondary vertexing total timing: Cpu: %.3e Real: %.3e s in %d slots, nThreads = %d",
151 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1, mVertexer.
getNThreads());
163 LOG(info) <<
"cluster dictionary updated";
173 LOG(info) <<
"SVertexer Params updated from ccdb";
177 LOG(info) <<
"ITS GeomtetryTGeo loaded from ccdb";
181#ifdef ENABLE_UPGRADES
183 LOG(info) <<
"cluster dictionary updated";
195 auto const&
raw = pc.
inputs().
get<
const char*>(
"corrMap");
196 mTPCCorrMaps = &gpu::TPCFastTransformPOD::get(raw);
198 static bool initOnceDone =
false;
202 if (mEnableCCDBParams) {
213 if (mEnableStrangenessTracking) {
215 geom->
fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::T2GRot, o2::math_utils::TransformType::T2G));
218#ifdef ENABLE_UPGRADES
229 LOGP(info,
"Updating TPC fast transform map with new VDrift factor of {} wrt reference {} and DriftTimeOffset correction {} wrt {} from source {}",
237 if (mEnableStrangenessTracking) {
248 bool useMC,
bool useGeom,
bool itsStag)
250 std::vector<OutputSpec> outputs;
252 {
"material-lut-path", VariantType::String,
"", {
"Path of the material LUT file"}},
253 {
"threads", VariantType::Int, 1, {
"Number of threads"}}};
254 auto dataRequest = std::make_shared<DataRequest>();
255 if (enableCCDBParams) {
256 dataRequest->inputs.emplace_back(
"SVParam",
"GLO",
"SVPARAM", 0, Lifetime::Condition,
ccdbParamSpec(
"GLO/Config/SVertexerParam"));
258 dataRequest->setITSPerLayer(itsStag);
260 if (enableStrangenesTracking) {
264 LOGP(warn,
"Tracks involving TPC were requested w/o requesting TPC-only tracks, simplified selection will be applied");
270 dataRequest->requestClusters(srcClus, useMC);
272#ifdef ENABLE_UPGRADES
274 dataRequest->inputs.emplace_back(
"cldict",
"IT3",
"CLUSDICT", Lifetime::Condition,
ccdbParamSpec(
"IT3/Calib/ClusterDictionary"));
277 dataRequest->requestTracks(
src, useMC);
278 dataRequest->requestPrimaryVertices(useMC);
279 dataRequest->inputs.emplace_back(
"meanvtx",
"GLO",
"MEANVERTEX", 0, Lifetime::Condition,
ccdbParamSpec(
"GLO/Calib/MeanVertex", {}, 1));
280 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(
false,
288 if (!useGeom && enableStrangenesTracking) {
289 ggRequest->addInput({
"itsTGeo",
"ITS",
"GEOMTGEO", 0, Lifetime::Condition,
framework::ccdbParamSpec(
"ITS/Config/Geometry")}, dataRequest->inputs);
295 outputs.emplace_back(
"GLO",
"V0S_IDX", 0, Lifetime::Timeframe);
296 outputs.emplace_back(
"GLO",
"V0S", 0, Lifetime::Timeframe);
297 outputs.emplace_back(
"GLO",
"PVTX_V0REFS", 0, Lifetime::Timeframe);
299 outputs.emplace_back(
"GLO",
"CASCS_IDX", 0, Lifetime::Timeframe);
300 outputs.emplace_back(
"GLO",
"CASCS", 0, Lifetime::Timeframe);
301 outputs.emplace_back(
"GLO",
"PVTX_CASCREFS", 0, Lifetime::Timeframe);
303 outputs.emplace_back(
"GLO",
"DECAYS3BODY_IDX", 0, Lifetime::Timeframe);
304 outputs.emplace_back(
"GLO",
"DECAYS3BODY", 0, Lifetime::Timeframe);
305 outputs.emplace_back(
"GLO",
"PVTX_3BODYREFS", 0, Lifetime::Timeframe);
307 if (enableStrangenesTracking) {
308 outputs.emplace_back(
"GLO",
"STRANGETRACKS", 0, Lifetime::Timeframe);
309 outputs.emplace_back(
"GLO",
"CLUSUPDATES", 0, Lifetime::Timeframe);
311 outputs.emplace_back(
"GLO",
"STRANGETRACKS_MC", 0, Lifetime::Timeframe);
312 LOG(info) <<
"Strangeness tracker will use MC";
315 outputs.emplace_back(
"META",
"SVERTEXER", 0, Lifetime::Sporadic);
318 "secondary-vertexing",
321 AlgorithmSpec{adaptFromTask<SecondaryVertexingSpec>(dataRequest, ggRequest,
src, enableCasc, enable3body, enableStrangenesTracking, enableCCDBParams, useMC)},
Definition of the GeometryManager class.
o2::raw::RawFileWriter * raw
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 std::string asJSON(std::string const &keyOnly="")
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
void snapshot(const Output &spec, T const &object)
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
InputRecord & inputs()
The inputs associated with this processing context.
ServiceRegistryRef services()
The services registry associated with this processing context.
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)
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)
std::array< size_t, 3 > getNFitterCalls() const
void setEnable3BodyDecays(bool v)
void setTPCCorrMaps(const o2::gpu::TPCFastTransformPOD *maph)
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() override=default
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)
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
constexpr o2::header::DataOrigin gDataOriginTPC
Defining ITS Vertex 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, bool itsStag)
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)
float refTimeOffset
additive time offset reference (\mus)
float refVDrift
reference vdrift for which factor was extracted
float timeOffsetCorr
additive time offset correction (\mus)
float corrFact
drift velocity correction factor (multiplicative)
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"