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
8 changes: 2 additions & 6 deletions EventVisualisation/Base/src/GeometryManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ TEveGeoShape* GeometryManager::getGeometryForDetector(string detectorName)
f->Close();

geomShape->SetName(detectorName.c_str());
// tricks for different R-Phi geom of TPC:
if (detectorName == "RPH") { // use all other parameters of regular TPC geom
detectorName = "TPC";
}

// prepare geometry to be drawn including all children
drawDeep(geomShape,
Expand All @@ -88,7 +84,7 @@ void GeometryManager::drawDeep(TEveGeoShape* geomShape, Color_t color, Char_t tr
}
if (lineColor >= 0) {
geomShape->SetLineColor(lineColor);
geomShape->SetLineWidth(0.1);
geomShape->SetLineWidth(1); // 0.1
geomShape->SetDrawFrame(true);
} else {
geomShape->SetDrawFrame(false);
Expand All @@ -108,7 +104,7 @@ void GeometryManager::drawDeep(TEveGeoShape* geomShape, Color_t color, Char_t tr
}
if (lineColor >= 0) {
geomShape->SetLineColor(lineColor);
geomShape->SetLineWidth(0.1);
geomShape->SetLineWidth(1); // 0.1
geomShape->SetDrawFrame(true);
} else {
geomShape->SetDrawFrame(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ class VisualisationEvent
};
static GIDVisualisation mVis;
VisualisationEvent();
VisualisationEvent(std::string fileName);
VisualisationEvent(const VisualisationEvent& source, EVisualisationGroup filter, float minTime, float maxTime);

/// constructor parametrisation (Value Object) for VisualisationEvent class
Expand All @@ -68,6 +67,8 @@ class VisualisationEvent
// Default constructor
VisualisationEvent(const VisualisationEventVO vo);

void appendAnotherEventCalo(const VisualisationEvent& another);

VisualisationTrack* addTrack(VisualisationTrack::VisualisationTrackVO vo)
{
mTracks.emplace_back(vo);
Expand All @@ -87,6 +88,12 @@ class VisualisationEvent
return mTracks.back().addCluster(pos);
}

VisualisationCalo* addCalo(VisualisationCalo::VisualisationCaloVO vo)
{
mCalo.emplace_back(vo);
return &mCalo.back();
}

// Multiplicity getter
int GetMultiplicity() const
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class VisualisationEventJSONSerializer : public VisualisationEventSerializer
public:
bool fromFile(VisualisationEvent& event, std::string fileName) override;
void toFile(const VisualisationEvent& event, std::string fileName) override;
~VisualisationEventJSONSerializer() override = default;
};

} // namespace event_visualisation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,14 @@ class VisualisationEventSerializer

public:
static VisualisationEventSerializer* getInstance() { return instance; }
static void setInstance(VisualisationEventSerializer* newInstance)
{ // take ownership
delete instance;
instance = newInstance;
}
virtual bool fromFile(VisualisationEvent& event, std::string fileName) = 0;
virtual void toFile(const VisualisationEvent& event, std::string fileName) = 0;
virtual ~VisualisationEventSerializer() = default;
};

} // namespace event_visualisation
Expand Down
7 changes: 7 additions & 0 deletions EventVisualisation/DataConverter/src/VisualisationEvent.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,13 @@ VisualisationEvent::VisualisationEvent(VisualisationEventVO vo)
this->mMaxTimeOfTracks = numeric_limits<float>::min();
}

void VisualisationEvent::appendAnotherEventCalo(const VisualisationEvent& another)
{
for (auto calo : another.getCalorimetersSpan()) {
this->mCalo.push_back(calo);
}
}

VisualisationEvent::VisualisationEvent(const VisualisationEvent& source, EVisualisationGroup filter, float minTime, float maxTime)
{
for (auto it = source.mTracks.begin(); it != source.mTracks.end(); ++it) {
Expand Down
43 changes: 25 additions & 18 deletions EventVisualisation/View/src/EventManager.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@
#include "EventVisualisationView/Options.h"
#include "EventVisualisationDataConverter/VisualisationEvent.h"
#include <EventVisualisationBase/DataSourceOnline.h>

#include "EventVisualisationBase/ConfigurationManager.h"
#include <TEveManager.h>
#include <TEveTrack.h>
#include <TEveProjectionManager.h>
#include <TEveTrackPropagator.h>
#include <TEnv.h>
#include <TEveElement.h>
Expand Down Expand Up @@ -70,16 +69,22 @@ void EventManager::displayCurrentEvent()
dataTypeLists[i] = new TEveElementList(gDataTypeNames[i].c_str());
}

VisualisationEvent event; // collect calorimeters in one drawing step
auto displayList = getDataSource()->getVisualisationList(no, EventManagerFrame::getInstance().getMinTimeFrameSliderValue(), EventManagerFrame::getInstance().getMaxTimeFrameSliderValue(), EventManagerFrame::MaxRange);
for (auto it = displayList.begin(); it != displayList.end(); ++it) {
displayVisualisationEvent(it->first, gVisualisationGroupName[it->second]);
if (it->second == EVisualisationGroup::EMC || it->second == EVisualisationGroup::PHS) {
event.appendAnotherEventCalo(it->first);
} else {
displayVisualisationEvent(it->first, gVisualisationGroupName[it->second]);
}
}
displayCalorimeters(event);

for (int i = 0; i < EVisualisationDataType::NdataTypes; ++i) {
MultiView::getInstance()->registerElement(dataTypeLists[i]);
if (i != EVisualisationGroup::EMC && i != EVisualisationGroup::PHS) {
MultiView::getInstance()->registerElement(dataTypeLists[i]);
}
}
// displayCalorimeters(displayList[0].first);

MultiView::getInstance()->getAnnotation()->SetText(TString::Format("Run: %d", getDataSource()->getRunNumber()));
}
MultiView::getInstance()->redraw3D();
Expand Down Expand Up @@ -175,12 +180,9 @@ void EventManager::displayVisualisationEvent(VisualisationEvent& event, const st
for (size_t i = 0; i < trackCount; ++i) {
VisualisationTrack track = event.getTrack(i);
TEveRecTrackD t;
// double* p = track.getMomentum();
// t.fP = {p[0], p[1], p[2]};
t.fSign = track.getCharge() > 0 ? 1 : -1;
auto* vistrack = new TEveTrack(&t, &TEveTrackPropagator::fgDefault);
vistrack->SetLineColor(kMagenta);
// vistrack->SetName(detectorName + " track: " + i);
vistrack->SetName(track.getGIDAsString().c_str());
size_t pointCount = track.getPointCount();
vistrack->Reset(pointCount);
Expand Down Expand Up @@ -226,37 +228,42 @@ void EventManager::displayVisualisationEvent(VisualisationEvent& event, const st

LOG(info) << "tracks: " << trackCount << " detector: " << detectorName << ":" << dataTypeLists[EVisualisationDataType::Tracks]->NumChildren();
LOG(info) << "clusters: " << clusterCount << " detector: " << detectorName << ":" << dataTypeLists[EVisualisationDataType::Clusters]->NumChildren();

displayCalorimeters(event);
}

void EventManager::displayCalorimeters(VisualisationEvent& event)
{
int size = event.getCaloCount();
if (size > 0) {
auto data = new TEveCaloDataVec(1);
TEnv settings;
ConfigurationManager::getInstance().getConfig(settings);
const bool showAxes = settings.GetValue("axes.show", false);

auto data = new TEveCaloDataVec(2); // number of detectors
data->IncDenyDestroy();
data->RefSliceInfo(0).Setup("Data", 0.3, kYellow);
data->RefSliceInfo(0).Setup("emcal", 0.3, settings.GetValue("emcal.tower.color", kYellow));
data->RefSliceInfo(1).Setup("phos", 0.3, settings.GetValue("phos.tower.color", kYellow));

for (auto calo : event.getCalorimetersSpan()) {
const float dX = 0.173333;
const float dY = 0.104667;
const float dY = 0.104667; // to trzeba wziac ze stałych
data->AddTower(calo.getEta(), calo.getEta() + dX, calo.getPhi(), calo.getPhi() + dY);
data->FillSlice(0, calo.getEnergy());
data->FillSlice(calo.getSource() == o2::dataformats::GlobalTrackID::PHS ? 1 : 0, calo.getEnergy()); // do ktorego slice
}

data->DataChanged();
data->SetAxisFromBins();

float barrelRadius = 375;
float endCalPosition = 400;

auto calo3d = new TEveCalo3D(data);
calo3d->SetName("Calorimeters");

calo3d->SetBarrelRadius(barrelRadius);
calo3d->SetEndCapPos(endCalPosition);
calo3d->SetBarrelRadius(settings.GetValue("barrel.radius", 375)); // barel staring point
calo3d->SetEndCapPos(endCalPosition); // scaling factor
calo3d->SetRnrFrame(false, false); // do not draw barel

dataTypeLists[EVisualisationDataType::Calorimeters]->AddElement(calo3d);
MultiView::getInstance()->registerElement(calo3d);
}
}

Expand Down
4 changes: 0 additions & 4 deletions EventVisualisation/View/src/MultiView.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ void MultiView::registerGeometry(TEveGeoShape* geom, bool threeD, bool rPhi, boo
LOG(error) << "MultiView::registerGeometry -- geometry is NULL!";
exit(-1);
}
// mGeomVector.push_back(geom);

TEveProjectionManager* projection;

if (threeD) {
Expand Down Expand Up @@ -227,8 +225,6 @@ void MultiView::registerElement(TEveElement* event)
gEve->GetCurrentEvent()->AddElement(event);
getProjection(ProjectionRphi)->ImportElements(event, getScene(SceneRphiEvent));
getProjection(ProjectionZrho)->ImportElements(event, getScene(SceneZrhoEvent));

gEve->Redraw3D();
}

void MultiView::destroyAllEvents()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@ namespace o2::itsmft
class TopologyDictionary;
}

namespace o2::mft
{
class GeometryTGeo;
}

namespace o2::its
{
class GeometryTGeo;
}

namespace o2::phos
{
class Geometry;
}

namespace o2::event_visualisation
{
using GID = o2::dataformats::GlobalTrackID;
Expand Down Expand Up @@ -138,6 +153,7 @@ class EveWorkflowHelper
void drawTPCTRDTOF(GID gid, float trackTime);
void drawTPCTRD(GID gid, float trackTime);
void drawTPCTOF(GID gid, float trackTime);
void drawPHOS();
void drawAODBarrel(AODBarrelTrack const& track, float trackTime);
void drawAODMFT(AODMFTTrack const& track, float trackTime);
void drawITSClusters(GID gid, float trackTime);
Expand Down Expand Up @@ -176,6 +192,8 @@ class EveWorkflowHelper
std::vector<o2::BaseCluster<float>> mMFTClustersArray;
o2::mft::GeometryTGeo* mMFTGeom;
o2::its::GeometryTGeo* mITSGeom;
o2::phos::Geometry* mPHOSGeom;

float mMUS2TPCTimeBins = 5.0098627;
float mITSROFrameLengthMUS = 0; ///< ITS RO frame in mus
float mMFTROFrameLengthMUS = 0; ///< MFT RO frame in mus
Expand Down
30 changes: 30 additions & 0 deletions EventVisualisation/Workflow/src/EveWorkflowHelper.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
#include "DataFormatsITSMFT/TrkClusRef.h"
#include "ITSMFTBase/DPLAlpideParam.h"
#include "CommonDataFormat/IRFrame.h"
#include "MFTBase/GeometryTGeo.h"
#include "ITSBase/GeometryTGeo.h"
#include "PHOSBase/Geometry.h"
#include <TGeoBBox.h>
#include <tuple>

using namespace o2::event_visualisation;

Expand Down Expand Up @@ -121,6 +126,8 @@ void EveWorkflowHelper::selectTracks(const CalibObjectsConst* calib,

void EveWorkflowHelper::draw()
{
this->drawPHOS();

for (size_t it = 0; it < mTrackSet.trackGID.size(); it++) {
const auto& gid = mTrackSet.trackGID[it];
auto tim = mTrackSet.trackTime[it];
Expand Down Expand Up @@ -282,6 +289,28 @@ void EveWorkflowHelper::prepareMFTClusters(const o2::itsmft::TopologyDictionary*
}
}

void EveWorkflowHelper::drawPHOS()
{
for (auto phos : mRecoCont.getPHOSCells()) {
char relativeLocalPositionInModule[3]; // relative (local) position within module
float x, z;
o2::phos::Geometry::absToRelNumbering(phos.getAbsId(), relativeLocalPositionInModule);
o2::phos::Geometry::absIdToRelPosInModule(phos.getAbsId(), x, z);
TVector3 gPos;

// convert local position in module to global position in ALICE including actual mis-aslignment read with GetInstance("Run3")
this->mPHOSGeom->local2Global(relativeLocalPositionInModule[0], x, z, gPos);

auto vCalo = mEvent.addCalo({.time = static_cast<float>(phos.getTime()),
.energy = phos.getEnergy(),
.phi = (float)gPos.Phi(),
.eta = (float)gPos.Eta(),
.PID = 0,
.gid = GID::getSourceName(GID::PHS),
.source = GID::PHS});
}
}

void EveWorkflowHelper::drawITSTPC(GID gid, float trackTime, GID::Source source)
{
// LOG(info) << "EveWorkflowHelper::drawITSTPC " << gid;
Expand Down Expand Up @@ -653,6 +682,7 @@ EveWorkflowHelper::EveWorkflowHelper(const FilterSet& enabledFilters, std::size_
this->mMFTGeom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::L2G));
this->mITSGeom = o2::its::GeometryTGeo::Instance();
this->mITSGeom->fillMatrixCache(o2::math_utils::bit2Mask(o2::math_utils::TransformType::T2L, o2::math_utils::TransformType::T2GRot, o2::math_utils::TransformType::L2G));
this->mPHOSGeom = o2::phos::Geometry::GetInstance("");
this->mTPCFastTransform = (o2::tpc::TPCFastTransformHelperO2::instance()->create(0));
const auto& elParams = o2::tpc::ParameterElectronics::Instance();
mMUS2TPCTimeBins = 1. / elParams.ZbinWidth;
Expand Down
4 changes: 2 additions & 2 deletions EventVisualisation/Workflow/src/O2DPLDisplay.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ WorkflowSpec defineDataProcessing(ConfigContext const& cfgc)
int numberOfFiles = cfgc.options().get<int>("number-of_files");
int numberOfTracks = cfgc.options().get<int>("number-of_tracks");

GID::mask_t allowedTracks = GID::getSourcesMask("ITS,TPC,MFT,MCH,ITS-TPC,ITS-TPC-TOF,TPC-TRD,ITS-TPC-TRD,MID");
GID::mask_t allowedClusters = GID::getSourcesMask("ITS,TPC,MFT,MCH,TRD,TOF,MID,TRD");
GID::mask_t allowedTracks = GID::getSourcesMask("ITS,TPC,MFT,MCH,ITS-TPC,ITS-TPC-TOF,TPC-TRD,ITS-TPC-TRD,MID,PHS,EMC");
GID::mask_t allowedClusters = GID::getSourcesMask("ITS,TPC,MFT,MCH,TRD,TOF,MID,TRD,PHS,EMC");

GlobalTrackID::mask_t srcTrk = GlobalTrackID::getSourcesMask(cfgc.options().get<std::string>("display-tracks")) & allowedTracks;
GlobalTrackID::mask_t srcCl = GlobalTrackID::getSourcesMask(cfgc.options().get<std::string>("display-clusters")) & allowedClusters;
Expand Down