21#include <TObjString.h>
51 TrackerDeviceDPL(std::shared_ptr<o2::base::GRPGeomRequest> gr,
bool isMC,
bool checkMasked) : mGGCCDBRequest(gr), mIsMC(isMC), mCheckMasked(checkMasked) {}
57 mKeepAll = !ic.
options().
get<
bool>(
"mid-tracker-keep-best");
59 auto stop = [
this]() {
60 double scaleFactor = (mNROFs == 0) ? 0. : 1.e6 / mNROFs;
61 LOG(info) <<
"Processing time / " << mNROFs <<
" ROFs: full: " << mTimer.count() * scaleFactor <<
" us tracking: " << mTimerTracker.count() * scaleFactor <<
" us hitMapBuilder: " << mTimerBuilder.count() <<
" us";
68 auto tStart = std::chrono::high_resolution_clock::now();
69 updateTimeDependentParams(pc);
74 auto inROFRecords = pc.
inputs().
get<gsl::span<ROFRecord>>(
"mid_clusters_rof");
76 auto tAlgoStart = std::chrono::high_resolution_clock::now();
77 mTracker->process(
clusters, inROFRecords);
78 mTimerTracker += std::chrono::high_resolution_clock::now() - tAlgoStart;
80 tAlgoStart = std::chrono::high_resolution_clock::now();
81 std::vector<Track> tracks = mTracker->getTracks();
82 mHitMapBuilder->process(tracks,
clusters);
83 mTimerBuilder += std::chrono::high_resolution_clock::now() - tAlgoStart;
87 mTrackLabeler.
process(mTracker->getClusters(), tracks, *
labels);
95 LOG(
debug) <<
"Sent " << tracks.size() <<
" tracks.";
97 LOG(
debug) <<
"Sent " << mTracker->getClusters().size() <<
" track clusters.";
100 LOG(
debug) <<
"Sent " << mTracker->getTrackROFRecords().size() <<
" ROFs.";
102 LOG(
debug) <<
"Sent " << mTracker->getClusterROFRecords().size() <<
" ROFs.";
104 mTimer += std::chrono::high_resolution_clock::now() - tStart;
105 mNROFs += inROFRecords.size();
114 bool rebuildMaskedChannels =
false;
116 LOG(info) <<
"Update MID_BAD_CH_TRK";
117 mBadChannels = *
static_cast<std::vector<ColumnData>*
>(obj);
118 rebuildMaskedChannels =
true;
120 LOG(info) <<
"Update MID_REJECTLIST_TRK";
121 mRejectList = *
static_cast<std::vector<ColumnData>*
>(obj);
122 rebuildMaskedChannels =
true;
124 if (rebuildMaskedChannels) {
125 mHitMapBuilder->setMaskedChannels(mBadChannels,
true);
126 mHitMapBuilder->setMaskedChannels(mRejectList,
false);
136 static bool initOnceDone =
false;
140 mTracker = std::make_unique<Tracker>(geoTrans);
141 if (!mTracker->init(mKeepAll)) {
142 LOG(error) <<
"Initialization of MID tracker device failed";
144 mHitMapBuilder = std::make_unique<HitMapBuilder>(geoTrans);
146 pc.
inputs().
get<std::vector<ColumnData>*>(
"mid_bad_channels_forTracks");
147 pc.
inputs().
get<std::vector<ColumnData>*>(
"mid_rejectlist_forTracks");
152 static bool first =
true;
159 md.SetOwnerKeyValue();
167 bool mKeepAll =
false;
168 bool mCheckMasked =
false;
169 TrackLabeler mTrackLabeler{};
170 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
171 std::unique_ptr<Tracker> mTracker{
nullptr};
172 std::unique_ptr<HitMapBuilder> mHitMapBuilder{
nullptr};
173 std::chrono::duration<double> mTimer{0};
174 std::chrono::duration<double> mTimerTracker{0};
175 std::chrono::duration<double> mTimerBuilder{0};
176 unsigned int mNROFs{0};
177 std::vector<ColumnData> mBadChannels{};
178 std::vector<ColumnData> mRejectList{};
183 std::vector<of::InputSpec> inputSpecs;
188 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(
false,
196 std::vector<of::OutputSpec> outputSpecs{
208 outputSpecs.emplace_back(
"META",
"MIDTRACKER", 0, of::Lifetime::Sporadic);
214 of::adaptFromTask<o2::mid::TrackerDeviceDPL>(ggRequest, isMC, checkMasked),
215 of::Options{{
"mid-tracker-keep-best", of::VariantType::Bool,
false, {
"Keep only best track (default is keep all)"}}}};
std::vector< std::string > labels
Definition of the GeometryManager class.
Helper for geometry and GRP related CCDB requests.
Utility to build the MID track hit maps.
Configurable parameters for MID tracking.
Track reconstruction algorithm for MID.
Data processor spec for MID tracker device.
Definition of the Names Generator class.
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)
static const TrackerParam & Instance()
static std::string asJSON(std::string const &keyOnly="")
static void write(std::string const &filename, std::string const &keyOnly="")
T get(const char *key) const
void snapshot(const Output &spec, T const &object)
ServiceRegistryRef services()
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.
const o2::dataformats::MCTruthContainer< MCClusterLabel > & getTrackClustersLabels()
Returns the cluster labels.
void process(gsl::span< const Cluster > clusters, gsl::span< const Track > tracks, const o2::dataformats::MCTruthContainer< MCClusterLabel > &inMCContainer)
const std::vector< MCCompLabel > & getTracksLabels()
Returns the tracks labels.
void run(o2::framework::ProcessingContext &pc)
void finaliseCCDB(o2::framework::ConcreteDataMatcher &matcher, void *obj)
void init(o2::framework::InitContext &ic)
~TrackerDeviceDPL()=default
TrackerDeviceDPL(std::shared_ptr< o2::base::GRPGeomRequest > gr, bool isMC, bool checkMasked)
constexpr o2::header::DataOrigin gDataOriginMID
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
framework::DataProcessorSpec getTrackerSpec(bool isMC, bool checkMasked)
GeometryTransformer createTransformationFromManager(const TGeoManager *geoManager)
std::vector< Cluster > clusters
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.
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"