16#include "TStopwatch.h"
52namespace globaltracking
58 TOFMatchChecker(std::shared_ptr<DataRequest> dr, std::shared_ptr<o2::base::GRPGeomRequest> gr,
bool useMC) : mDataRequest(dr), mGGCCDBRequest(gr), mUseMC(useMC) {}
72 gsl::span<const o2::tof::Cluster> mTOFClustersArrayInp;
75 std::shared_ptr<DataRequest> mDataRequest;
76 std::shared_ptr<o2::base::GRPGeomRequest> mGGCCDBRequest;
99 const char*
sources[5] = {
"TPC",
"ITS-TPC",
"TPC-TRD",
"ITS-TPC-TRD",
"NONE"};
101 int tofcl =
match.getIdxTOFCl();
102 int trIndex =
match.getTrackIndex();
103 float chi2 =
match.getChi2();
104 float ttof = mTOFClustersArrayInp[tofcl].getTime();
105 float x = mTOFClustersArrayInp[tofcl].getX();
106 float y = mTOFClustersArrayInp[tofcl].getY();
107 float z = mTOFClustersArrayInp[tofcl].getZ();
108 int sector = mTOFClustersArrayInp[tofcl].getSector();
109 LOG(info) <<
"trkSource=" <<
sources[trksource] <<
" -- cl=" << tofcl <<
" - trk=" << trIndex <<
" - chi2 =" << chi2 <<
" - time=" << ttof <<
" - coordinates (to be rotated, sector=" << sector <<
") = (" <<
x <<
"," <<
y <<
"," <<
z <<
")";
112 int mainCh = mTOFClustersArrayInp[tofcl].getMainContributingChannel();
118 LOG(
debug) <<
"Cluster mult = " << mTOFClustersArrayInp[tofcl].getNumOfContributingChannels() <<
" - main channel (" << mainCh <<
") -> pos(" <<
pos[0] <<
"," <<
pos[1] <<
"," <<
pos[2] <<
")";
121 if (mTOFClustersArrayInp[tofcl].getNumOfContributingChannels() > 1) {
122 if (mTOFClustersArrayInp[tofcl].isAdditionalChannelSet(o2::tof::Cluster::kUpRight)) {
123 addCh = mainCh + 48 + 1;
126 LOG(
debug) <<
"top right (" << addCh <<
") -> pos(" <<
pos[0] <<
"," <<
pos[1] <<
"," <<
pos[2] <<
")";
128 if (mTOFClustersArrayInp[tofcl].isAdditionalChannelSet(o2::tof::Cluster::kUp)) {
132 LOG(
debug) <<
"top (" << addCh <<
") -> pos(" <<
pos[0] <<
"," <<
pos[1] <<
"," <<
pos[2] <<
")";
134 if (mTOFClustersArrayInp[tofcl].isAdditionalChannelSet(o2::tof::Cluster::kUpLeft)) {
135 addCh = mainCh + 48 - 1;
138 LOG(
debug) <<
"top left (" << addCh <<
") -> pos(" <<
pos[0] <<
"," <<
pos[1] <<
"," <<
pos[2] <<
")";
140 if (mTOFClustersArrayInp[tofcl].isAdditionalChannelSet(o2::tof::Cluster::kRight)) {
144 LOG(
debug) <<
"right (" << addCh <<
") -> pos(" <<
pos[0] <<
"," <<
pos[1] <<
"," <<
pos[2] <<
")";
146 if (mTOFClustersArrayInp[tofcl].isAdditionalChannelSet(o2::tof::Cluster::kLeft)) {
150 LOG(
debug) <<
"left (" << addCh <<
") -> pos(" <<
pos[0] <<
"," <<
pos[1] <<
"," <<
pos[2] <<
")";
152 if (mTOFClustersArrayInp[tofcl].isAdditionalChannelSet(o2::tof::Cluster::kDownRight)) {
153 addCh = mainCh - 48 + 1;
156 LOG(
debug) <<
"down right (" << addCh <<
") -> pos(" <<
pos[0] <<
"," <<
pos[1] <<
"," <<
pos[2] <<
")";
158 if (mTOFClustersArrayInp[tofcl].isAdditionalChannelSet(o2::tof::Cluster::kDown)) {
162 LOG(
debug) <<
"down (" << addCh <<
") -> pos(" <<
pos[0] <<
"," <<
pos[1] <<
"," <<
pos[2] <<
")";
164 if (mTOFClustersArrayInp[tofcl].isAdditionalChannelSet(o2::tof::Cluster::kDownLeft)) {
165 addCh = mainCh - 48 - 1;
168 LOG(
debug) <<
"down left (" << addCh <<
") -> pos(" <<
pos[0] <<
"," <<
pos[1] <<
"," <<
pos[2] <<
")";
187 updateTimeDependentParams(pc);
200 LOG(
debug) <<
"TOF cluster size = " << mTOFClustersArrayInp.size();
202 if (!mTOFClustersArrayInp.size()) {
206 auto creator = [
this](
auto& trk,
GID gid,
float time0,
float terr) {
217 LOGF(
debug,
"TOF matching total timing: Cpu: %.3e Real: %.3e s in %d slots",
218 mTimer.CpuTime(), mTimer.RealTime(), mTimer.Counter() - 1);
231 static bool initOnceDone =
false;
241 auto dataRequest = std::make_shared<DataRequest>();
244 dataRequest->requestTracks(
src, useMC);
245 dataRequest->requestClusters(GID::getSourceMask(
GID::TOF), useMC);
246 dataRequest->requestTOFMatches(
src, useMC);
247 auto ggRequest = std::make_shared<o2::base::GRPGeomRequest>(
false,
259 AlgorithmSpec{adaptFromTask<TOFMatchChecker>(dataRequest, ggRequest, useMC)},
Helper for geometry and GRP related CCDB requests.
Accessor for TrackParCov derived objects from multiple containers.
Global index for barrel track: provides provenance (detectors combination), index in respective array...
std::vector< o2::dataformats::MatchInfoHMP > MatchOutputType
Class to perform TPC ITS matching.
Definition of the Names Generator class.
Wrapper container for different reconstructed object types.
void checkUpdates(o2::framework::ProcessingContext &pc)
static GRPGeomHelper & instance()
void setRequest(std::shared_ptr< GRPGeomRequest > req)
Static class with identifiers, bitmasks and names for ALICE detectors.
TOFMatchChecker(std::shared_ptr< DataRequest > dr, std::shared_ptr< o2::base::GRPGeomRequest > gr, bool useMC)
void init(InitContext &ic) final
void endOfStream(framework::EndOfStreamContext &ec) final
This is invoked whenever we have an EndOfStream event.
void checkMatching(GID gid)
~TOFMatchChecker() override=default
void run(ProcessingContext &pc) final
void finaliseCCDB(ConcreteDataMatcher &matcher, void *obj) final
static void getPos(Int_t *det, Float_t *pos)
static void getVolumeIndices(Int_t index, Int_t *detId)
bool match(const std::vector< std::string > &queries, const char *pattern)
GLdouble GLdouble GLdouble z
Defining PrimaryVertex explicitly as messageable.
std::vector< ConfigParamSpec > Options
framework::DataProcessorSpec getTOFMatchCheckerSpec(o2::dataformats::GlobalTrackID::mask_t src, bool useMC)
create a processor spec
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
bool isTrackSourceLoaded(int src) const
bool isMatchSourceLoaded(int src) const
void createTracksVariadic(T creator, GTrackID::mask_t srcSel=GTrackID::getSourcesMask("all")) const
auto getTOFClusters() const
void collectData(o2::framework::ProcessingContext &pc, const DataRequest &request)
const o2::dataformats::MatchInfoTOF & getTOFMatch(GTrackID id) const
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"