9#include <display/VisualRepMap.h>
11#include <display/EveTower.h>
12#include <framework/logging/Logger.h>
13#include <framework/datastore/RelationVector.h>
14#include <framework/datastore/DataStore.h>
16#include <TEveSelection.h>
17#include <TEveCaloData.h>
18#include <TEveManager.h>
20#include <boost/bimap/bimap.hpp>
21#include <boost/bimap/unordered_multiset_of.hpp>
27 typedef boost::bimaps::bimap <
28 boost::bimaps::unordered_multiset_of<const TObject*>,
29 boost::bimaps::unordered_multiset_of<TEveElement*>
30 > DataStoreEveElementMap_Base;
59 if (TEveCaloData* caloData =
dynamic_cast<TEveCaloData*
>(elem)) {
60 const auto& selectedCells = caloData->GetCellsSelected();
61 if (selectedCells.empty())
63 int id = selectedCells[0].fTower;
65 if (eveTower->getID() ==
id) {
90 B2FATAL(
"recursive select() call detected. Please check isCurrentlySelecting().");
93 for (
auto it = range.first; it != range.second; ++it) {
94 TEveElement* elem = it->second;
95 if (elem and !gEve->GetSelection()->HasChild(elem)) {
97 gEve->GetSelection()->UserPickedElement(elem,
true);
106 const std::list<TEveElement*> sel(gEve->GetSelection()->BeginChildren(), gEve->GetSelection()->EndChildren());
107 for (TEveElement* el : sel) {
108 if (el == eveObj or el->IsA() == EveTower::Class())
110 gEve->GetSelection()->UserUnPickedElement(el);
117 if (representedObject) {
121 for (
const TObject& relObj : relatedObjects) {
132 gEve->GetSelection()->UserPickedElement(
nullptr);
137 if (!dataStoreObject) {
138 B2ERROR(
"Trying to insert NULL for object represented by " << visualRepresentation->GetElementName());
141 auto ret =
m_dataStoreEveElementMap->insert(DataStoreEveElementMap::value_type(dataStoreObject, visualRepresentation));
143 B2DEBUG(100,
"Failed to insert object represented by " << visualRepresentation->GetElementName() <<
"! Duplicate?");
150 tower->IncDenyDestroy();
153 add(dataStoreObject, tower);
static RelationVector< T > getRelationsWithObj(const TObject *object, const std::string &name="", const std::string &namedRelation="")
Get the relations between an object and other objects in a store array.
handles selection of individual ECLClusters (getting them out of TEve is hard).
Class for type safe access to objects that are referred to in relations.
~VisualRepMap()
destructor
void addCluster(const TObject *dataStoreObject, TEveCaloData *caloData, int towerID)
Selection inside TEveCalo* is complicated, use this to keep track of ECL clusters.
const TObject * getDataStoreObject(TEveElement *elem) const
Get object represented by given visual representation.
bool m_currentlySelecting
are we currently in a select() call?
static VisualRepMap * getInstance()
get instance pointer.
void selectRelated(TEveElement *eveObj) const
Select related objects.
TEveElement * getEveElement(const TObject *obj) const
Get (first) visual representation of given object.
std::vector< EveTower * > m_eclTowers
individual ECL towers (getting them out of TEve is hard).
static void selectOnly(const TEveElement *eveObj)
Deselect all other objects.
void select(const TObject *object) const
Select the representation of the given object.
DataStoreEveElementMap * m_dataStoreEveElementMap
Map DataStore contents in current event with their visual representation.
static void clearSelection()
Clear existing selection in Eve Browser.
void clear()
Remove all contents in map.
VisualRepMap()
default constructor
void add(const TObject *dataStoreObject, TEveElement *visualRepresentation)
Generic function to keep track of which objects have which visual representation.
Hide implementation in private class.
Abstract base class for different kinds of events.