Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Reorganize code to reduce repeating parts. Add tofExpMom to TrackExtra.
  • Loading branch information
nburmaso committed Jul 7, 2021
commit 2a9f3f997dabec554c81ee3b0bb066f5e9758ef2
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@

using namespace o2::framework;
using GID = o2::dataformats::GlobalTrackID;
using GIndex = o2::dataformats::VtxTrackIndex;
using DataRequest = o2::globaltracking::DataRequest;
using TPCClRefElem = uint32_t;

namespace o2::aodproducer
{
Expand Down Expand Up @@ -147,17 +147,16 @@ typedef boost::unordered_map<Triplet_t, int, TripletHash, TripletEqualTo> Triple
class AODProducerWorkflowDPL : public Task
{
public:
AODProducerWorkflowDPL(std::shared_ptr<DataRequest> dataRequest, bool fillSVertices) : mDataRequest(dataRequest), mFillSVertices(fillSVertices) {}
AODProducerWorkflowDPL(GID::mask_t src, std::shared_ptr<DataRequest> dataRequest, bool fillSVertices) : mInputSources(src), mDataRequest(dataRequest), mFillSVertices(fillSVertices) {}
~AODProducerWorkflowDPL() override = default;
void init(InitContext& ic) final;
void run(ProcessingContext& pc) final;
void endOfStream(framework::EndOfStreamContext& ec) final;

private:
int mFillTracksITS{1};
int mFillTracksMFT{1};
int mFillTracksTPC{0};
int mFillTracksITSTPC{1};
const float cSpeed = 0.029979246f; // speed of light in TOF units

GID::mask_t mInputSources;
int64_t mTFNumber{-1};
int mTruncate{1};
int mRecoOnly{0};
Expand Down Expand Up @@ -200,6 +199,7 @@ class AODProducerWorkflowDPL : public Task
uint32_t mFDDAmplitude = 0xFFFFF000; // 11 bits
uint32_t mT0Amplitude = 0xFFFFF000; // 11 bits

// helper struct for extra info in fillTrackTablesPerCollision()
struct TrackExtraInfo {
float tpcInnerParam = 0.f;
uint32_t flags = 0;
Expand All @@ -222,6 +222,15 @@ class AODProducerWorkflowDPL : public Task
float trackPhiEMCAL = -999.f;
};

// helper struct for mc track labels
struct MCLabels {
uint32_t labelID = std::numeric_limits<uint32_t>::max();
uint32_t labelITS = std::numeric_limits<uint32_t>::max();
uint32_t labelTPC = std::numeric_limits<uint32_t>::max();
uint16_t labelMask = 0;
uint8_t mftLabelMask = 0;
};

void collectBCs(gsl::span<const o2::ft0::RecPoints>& ft0RecPoints,
gsl::span<const o2::dataformats::PrimaryVertex>& primVertices,
const std::vector<o2::InteractionTimeRecord>& mcRecords,
Expand All @@ -239,6 +248,18 @@ class AODProducerWorkflowDPL : public Task
template <typename mftTracksCursorType>
void addToMFTTracksTable(mftTracksCursorType& mftTracksCursor, const o2::mft::TrackMFT& track, int collisionID);

// helper for track tables
// fills tables collision by collision
template <typename TracksCursorType, typename TracksCovCursorType, typename TracksExtraCursorType, typename mftTracksCursorType>
void fillTrackTablesPerCollision(int collisionID,
const o2::dataformats::VtxTrackRef& trackRef,
gsl::span<const GIndex>& GIndices,
o2::globaltracking::RecoContainer& data,
TracksCursorType& tracksCursor,
TracksCovCursorType& tracksCovCursor,
TracksExtraCursorType& tracksExtraCursor,
mftTracksCursorType& mftTracksCursor);

template <typename MCParticlesCursorType>
void fillMCParticlesTable(o2::steer::MCKinematicsReader& mcReader, const MCParticlesCursorType& mcParticlesCursor,
gsl::span<const o2::MCCompLabel>& mcTruthITS,
Expand All @@ -247,11 +268,12 @@ class AODProducerWorkflowDPL : public Task
TripletsMap_t& toStore,
std::vector<std::pair<int, int>> const& mccolidtoeventsource);

// helper for tpc shared clusters
uint8_t countTPCSharedCl(const o2::tpc::TrackTPC& track,
const gsl::span<const o2::tpc::TPCClRefElem>& tpcClusRefs,
const gsl::span<const unsigned char>& tpcClusShMap,
const o2::tpc::ClusterNativeAccess& tpcClusAcc);
// helper for tpc clusters
void countTPCClusters(const o2::tpc::TrackTPC& track,
const gsl::span<const o2::tpc::TPCClRefElem>& tpcClusRefs,
const gsl::span<const unsigned char>& tpcClusShMap,
const o2::tpc::ClusterNativeAccess& tpcClusAcc,
uint8_t& shared, uint8_t& found, uint8_t& crossed);

// helper for trd pattern
uint8_t getTRDPattern(const o2::trd::TrackTRD& track);
Expand Down
Loading