Skip to content

Commit 556c337

Browse files
pnwkwshahor02
authored andcommitted
Add annotation in the 3D view to display run parameters
1 parent f58d3f6 commit 556c337

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

EventVisualisation/View/include/EventVisualisationView/MultiView.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#ifndef ALICE_O2_EVENTVISUALISATION_VIEW_MULTIVIEW_H
1919
#define ALICE_O2_EVENTVISUALISATION_VIEW_MULTIVIEW_H
2020

21+
#include <TGLAnnotation.h>
2122
#include <TGLViewer.h>
2223
#include <TEveGeoShape.h>
2324
#include <TEveScene.h>
@@ -90,6 +91,9 @@ class MultiView
9091
/// Registers an element to be drawn
9192
void registerElement(TEveElement* event); // override;
9293

94+
/// Get annotation pointer
95+
TGLAnnotation* getAnnotation() { return mAnnotation.get(); }
96+
9397
///
9498
void registerEvent(TEveElement* event) { return registerElement(event); }
9599
/// Removes all shapes representing current event
@@ -108,6 +112,7 @@ class MultiView
108112
TEveScene* mScenes[NumberOfScenes]; ///< Array of all geometry and event scenes
109113
TEveProjectionManager* mProjections[NumberOfProjections]; ///< Array of all projection managers
110114
std::vector<TEveGeoShape*> mDetectors; ///< Vector of detector geometries
115+
std::unique_ptr<TGLAnnotation> mAnnotation; ///< 3D view annotation
111116

112117
std::string mSceneNames[NumberOfScenes]; ///< Names of event and geometry scenes
113118
std::string mSceneDescriptions[NumberOfScenes]; ///< Descriptions of event and geometry scenes

EventVisualisation/View/src/EventManager.cxx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ void EventManager::displayCurrentEvent()
7575
for (int i = 0; i < EVisualisationDataType::NdataTypes; ++i) {
7676
MultiView::getInstance()->registerElement(dataTypeLists[i]);
7777
}
78+
79+
MultiView::getInstance()->getAnnotation()->SetText(TString::Format("Run: %d", displayList[0].first.getRunNumber()));
7880
}
7981
MultiView::getInstance()->redraw3D();
8082
}
@@ -169,12 +171,12 @@ void EventManager::displayVisualisationEvent(VisualisationEvent& event, const st
169171
for (size_t i = 0; i < trackCount; ++i) {
170172
VisualisationTrack track = event.getTrack(i);
171173
TEveRecTrackD t;
172-
//double* p = track.getMomentum();
173-
//t.fP = {p[0], p[1], p[2]};
174+
// double* p = track.getMomentum();
175+
// t.fP = {p[0], p[1], p[2]};
174176
t.fSign = track.getCharge() > 0 ? 1 : -1;
175177
auto* vistrack = new TEveTrack(&t, &TEveTrackPropagator::fgDefault);
176178
vistrack->SetLineColor(kMagenta);
177-
//vistrack->SetName(detectorName + " track: " + i);
179+
// vistrack->SetName(detectorName + " track: " + i);
178180
vistrack->SetName(track.getGIDAsString().c_str());
179181
size_t pointCount = track.getPointCount();
180182
vistrack->Reset(pointCount);

EventVisualisation/View/src/EventManagerFrame.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ void EventManagerFrame::DoScreenshot()
250250
TASImage image(width, height);
251251
image.FillRectangle(backgroundColor, 0, 0, width, height);
252252

253+
auto annotationState = MultiView::getInstance()->getAnnotation()->GetState();
254+
MultiView::getInstance()->getAnnotation()->SetState(TGLOverlayElement::kInvisible);
253255
TImage* view3dImage = MultiView::getInstance()->getView(MultiView::EViews::View3d)->GetGLViewer()->GetPictureUsingBB();
256+
MultiView::getInstance()->getAnnotation()->SetState(annotationState);
254257
scaledImage = ScaleImage((TASImage*)view3dImage, width * 0.65, height * 0.95);
255258
if (scaledImage) {
256259
CopyImage(&image, scaledImage, width * 0.015, height * 0.025, 0, 0, scaledImage->GetWidth(), scaledImage->GetHeight());

EventVisualisation/View/src/MultiView.cxx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ void MultiView::setupMultiview()
143143
mViews[ViewZrho]->GetGLViewer()->SetCurrentCamera(TGLViewer::kCameraOrthoXOY);
144144
mViews[ViewZrho]->AddScene(mScenes[SceneZrhoGeom]);
145145
mViews[ViewZrho]->AddScene(mScenes[SceneZrhoEvent]);
146+
147+
mAnnotation = std::make_unique<TGLAnnotation>(mViews[View3d]->GetGLViewer(), "", 0, 1.0);
148+
mAnnotation->SetState(TGLOverlayElement::kDisabled); // make the annotation non-interactive
149+
mAnnotation->SetUseColorSet(false); // make the colors individually changeable
150+
mAnnotation->SetTextColor(0); // default color white
151+
mAnnotation->SetTextSize(0.06f);
146152
}
147153

148154
MultiView::EScenes MultiView::getSceneOfProjection(EProjections projection)

0 commit comments

Comments
 (0)