Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ namespace o2::event_visualisation
class TPCFastTransform;

struct AO2DConverter {
o2::framework::Configurable<std::string> jsonPath{"jsons-folder", "./jsons", "name of the folder to store json files"};
o2::framework::Configurable<std::string> jsonPath{"jsons-folder", "./json", "name of the folder to store json files"};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, also the directory on /home/epn/ where the jsons are stored is jsons.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I changed this to follow the default directory from which ED reads them:

"datafolder,d", bpo::value<decltype(this->mDataFolder)>()->default_value("./json"), "name of the data folder")(

In any case I think the best solution would be to extract this value to a header, so it is in sync in both ED and the AOD workflow.


static constexpr float mWorkflowVersion = 1.00;
o2::header::DataHeader::RunNumberType mRunNumber = 1;
o2::framework::DataProcessingHeader::CreationTime mCreationTime;

void init(o2::framework::InitContext& ic);
void process(o2::aod::Collisions const& collisions, EveWorkflowHelper::AODFullTracks const& tracks);
void process(o2::aod::Collisions const& collisions, EveWorkflowHelper::AODBarrelTracks const& barrelTracks, EveWorkflowHelper::AODForwardTracks const& fwdTracks, EveWorkflowHelper::AODMFTTracks const& mftTracks);

DetectorData mData;
std::shared_ptr<EveWorkflowHelper> mHelper;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,14 @@ class EveWorkflowHelper
std::unique_ptr<gpu::TPCFastTransform> mTPCFastTransform;

public:
using AODFullTracks = soa::Join<aod::Tracks, aod::TracksCov, aod::TracksExtra>;
using AODFullTrack = AODFullTracks::iterator;
using AODBarrelTracks = soa::Join<aod::Tracks, aod::TracksCov, aod::TracksExtra>;
using AODBarrelTrack = AODBarrelTracks::iterator;

using AODForwardTracks = soa::Join<aod::FwdTracks, aod::FwdTracksCov>;
using AODForwardTrack = AODForwardTracks::iterator;

using AODMFTTracks = aod::MFTTracks;
using AODMFTTrack = AODMFTTracks::iterator;

EveWorkflowHelper();
static std::vector<PNT> getTrackPoints(const o2::track::TrackPar& trc, float minR, float maxR, float maxStep, float minZ = -25000, float maxZ = 25000);
Expand All @@ -124,7 +130,8 @@ class EveWorkflowHelper
void drawTPCTRDTOF(GID gid, float trackTime);
void drawTPCTRD(GID gid, float trackTime);
void drawTPCTOF(GID gid, float trackTime);
void drawAOD(AODFullTrack const& track, float trackTime);
void drawAODBarrel(AODBarrelTrack const& track, float trackTime);
void drawAODMFT(AODMFTTrack const& track, float trackTime);
void drawITSClusters(GID gid, float trackTime);
void drawTPCClusters(GID gid, float trackTime);
void drawMFTClusters(GID gid, float trackTime);
Expand All @@ -137,6 +144,8 @@ class EveWorkflowHelper
void prepareMFTClusters(const o2::itsmft::TopologyDictionary* dict); // fills mMFTClustersArray
void clear() { mEvent.clear(); }

GID::Source detectorMapToGIDSource(uint8_t dm);

void save(const std::string& jsonPath,
int numberOfFiles,
o2::dataformats::GlobalTrackID::mask_t trkMask,
Expand Down
14 changes: 9 additions & 5 deletions EventVisualisation/Workflow/src/AO2DConverter.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "CommonUtils/NameConf.h"
#include "TRDBase/GeometryFlat.h"
#include "TRDBase/Geometry.h"
#include "GlobalTrackingWorkflowHelpers/InputHelper.h"
#include "ReconstructionDataFormats/GlobalTrackID.h"
#include "DataFormatsMCH/TrackMCH.h"
#include "DataFormatsMCH/ROFRecord.h"
Expand All @@ -41,13 +40,18 @@ void AO2DConverter::init(o2::framework::InitContext& ic)
mHelper = std::make_shared<EveWorkflowHelper>();
}

void AO2DConverter::process(o2::aod::Collisions const& collisions, EveWorkflowHelper::AODFullTracks const& tracks)
void AO2DConverter::process(o2::aod::Collisions const& collisions, EveWorkflowHelper::AODBarrelTracks const& barrelTracks, EveWorkflowHelper::AODForwardTracks const& fwdTracks, EveWorkflowHelper::AODMFTTracks const& mftTracks)
{
for (auto const& c : collisions) {
auto const tracksCol = tracks.sliceBy(aod::track::collisionId, c.globalIndex());
auto const barrelTracksForCol = barrelTracks.sliceBy(aod::track::collisionId, c.globalIndex());
auto const mftTracksForCol = mftTracks.sliceBy(aod::fwdtrack::collisionId, c.globalIndex());

for (auto const& track : tracksCol) {
mHelper->drawAOD(track, c.collisionTime());
for (auto const& track : barrelTracksForCol) {
mHelper->drawAODBarrel(track, c.collisionTime());
}

for (auto const& track : mftTracksForCol) {
mHelper->drawAODMFT(track, c.collisionTime());
}

mHelper->save(jsonPath, collisions.size(), GlobalTrackID::MASK_ALL, GlobalTrackID::MASK_NONE, mWorkflowVersion, mRunNumber, mCreationTime);
Expand Down
58 changes: 56 additions & 2 deletions EventVisualisation/Workflow/src/EveWorkflowHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ void EveWorkflowHelper::drawTPCTOF(GID gid, float trackTime)
drawTOFClusters(gid, trackTime);
}

void EveWorkflowHelper::drawAOD(EveWorkflowHelper::AODFullTrack const& track, float trackTime)
void EveWorkflowHelper::drawAODBarrel(EveWorkflowHelper::AODBarrelTrack const& track, float trackTime)
{
std::array<float, 5> const arraypar = {track.y(), track.z(), track.snp(),
track.tgl(), track.signed1Pt()};
Expand All @@ -298,7 +298,33 @@ void EveWorkflowHelper::drawAOD(EveWorkflowHelper::AODFullTrack const& track, fl

auto const tr = o2::track::TrackParCov(track.x(), track.alpha(), arraypar, covpar);

addTrackToEvent(tr, GID::ITSTPCTRDTOF, trackTime, 0., GID::ITSTPCTRD);
addTrackToEvent(tr, GID{0, detectorMapToGIDSource(track.detectorMap())}, trackTime, 0.);
}

void EveWorkflowHelper::drawAODMFT(AODMFTTrack const& track, float trackTime)
{
auto tr = o2::track::TrackParFwd();

tr.setZ(track.z());
tr.setParameters({track.x(), track.y(), track.phi(), track.tgl(), track.signed1Pt()});

std::vector<float> zPositions = {-40.f, -45.f, -65.f, -85.f}; // Selected z positions to draw the track
tr.propagateParamToZlinear(zPositions[0]); // Fix the track starting position.

auto vTrack = mEvent.addTrack({.time = static_cast<float>(trackTime),
.charge = (int)tr.getCharge(),
.PID = o2::track::PID::Muon,
.startXYZ = {(float)tr.getX(), (float)tr.getY(), (float)tr.getZ()},
.phi = (float)tr.getPhi(),
.theta = (float)tr.getTanl(),
.eta = (float)tr.getEta(),
.gid = GID::getSourceName(GID::MFT),
.source = GID::MFT});

for (auto zPos : zPositions) {
tr.propagateParamToZlinear(zPos);
vTrack->addPolyPoint((float)tr.getX(), (float)tr.getY(), (float)tr.getZ());
}
}

void EveWorkflowHelper::drawTOFClusters(GID gid, float trackTime)
Expand Down Expand Up @@ -570,3 +596,31 @@ EveWorkflowHelper::EveWorkflowHelper()
const auto& elParams = o2::tpc::ParameterElectronics::Instance();
mMUS2TPCTimeBins = 1. / elParams.ZbinWidth;
}

GID::Source EveWorkflowHelper::detectorMapToGIDSource(uint8_t dm)
{
switch (dm) {
case static_cast<uint8_t>(o2::aod::track::ITS):
return GID::ITS;
case static_cast<uint8_t>(o2::aod::track::TPC):
return GID::TPC;
case static_cast<uint8_t>(o2::aod::track::TRD):
return GID::TRD;
case static_cast<uint8_t>(o2::aod::track::TOF):
return GID::TOF;
case static_cast<uint8_t>(o2::aod::track::ITS) | static_cast<uint8_t>(o2::aod::track::TPC):
return GID::ITSTPC;
case static_cast<uint8_t>(o2::aod::track::TPC) | static_cast<uint8_t>(o2::aod::track::TOF):
return GID::TPCTOF;
case static_cast<uint8_t>(o2::aod::track::TPC) | static_cast<uint8_t>(o2::aod::track::TRD):
return GID::TPCTRD;
case static_cast<uint8_t>(o2::aod::track::ITS) | static_cast<uint8_t>(o2::aod::track::TPC) | static_cast<uint8_t>(o2::aod::track::TRD):
return GID::ITSTPCTRD;
case static_cast<uint8_t>(o2::aod::track::ITS) | static_cast<uint8_t>(o2::aod::track::TPC) | static_cast<uint8_t>(o2::aod::track::TOF):
return GID::ITSTPCTOF;
case static_cast<uint8_t>(o2::aod::track::TPC) | static_cast<uint8_t>(o2::aod::track::TRD) | static_cast<uint8_t>(o2::aod::track::TOF):
return GID::TPCTRDTOF;
default:
return GID::ITSTPCTRDTOF;
}
}