Belle II Software  release-05-02-19
VisualRepMap.h
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2014 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Christian Pulvermacher *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #pragma once
12 
13 #include <vector>
14 
15 class TEveElement;
16 class TEveCaloData;
17 class TObject;
18 
19 namespace Belle2 {
24  class EveTower;
30  class VisualRepMap {
31  public:
33  static VisualRepMap* getInstance();
34 
36  void select(const TObject* object) const;
37 
39  void selectOnly(TEveElement* eveObj) const;
40 
42  void selectRelated(TEveElement* eveObj) const;
43 
45  void clearSelection() const;
46 
52  bool isCurrentlySelecting() const { return m_currentlySelecting; }
53 
58  const TObject* getDataStoreObject(TEveElement* elem) const;
59 
61  TEveElement* getEveElement(const TObject* obj) const;
62 
64  bool isVisualized(const TObject* obj) { return getEveElement(obj) != nullptr; }
65 
67  void clear();
68 
76  void add(const TObject* dataStoreObject, TEveElement* visualRepresentation);
77 
79  void addCluster(const TObject* dataStoreObject, TEveCaloData* caloData, int towerID);
80  private:
82  VisualRepMap();
84  VisualRepMap(const VisualRepMap&) = delete;
86  VisualRepMap& operator=(const VisualRepMap&) = delete;
88  ~VisualRepMap();
89 
91 
92  mutable bool m_currentlySelecting;
96 
98  std::vector<EveTower*> m_eclTowers;
99 
100  };
102 }
Belle2::VisualRepMap::selectOnly
void selectOnly(TEveElement *eveObj) const
Deselect all other objects.
Definition: VisualRepMap.cc:105
Belle2::VisualRepMap::VisualRepMap
VisualRepMap()
default constructor
Definition: VisualRepMap.cc:44
Belle2::VisualRepMap::clear
void clear()
Remove all contents in map.
Definition: VisualRepMap.cc:48
Belle2::VisualRepMap::m_currentlySelecting
bool m_currentlySelecting
are we currently in a select() call?
Definition: VisualRepMap.h:90
Belle2::VisualRepMap::~VisualRepMap
~VisualRepMap()
destructor
Definition: VisualRepMap.cc:46
Belle2::VisualRepMap::add
void add(const TObject *dataStoreObject, TEveElement *visualRepresentation)
Generic function to keep track of which objects have which visual representation.
Definition: VisualRepMap.cc:136
Belle2::VisualRepMap::selectRelated
void selectRelated(TEveElement *eveObj) const
Select related objects.
Definition: VisualRepMap.cc:116
Belle2::VisualRepMap::getDataStoreObject
const TObject * getDataStoreObject(TEveElement *elem) const
Get object represented by given visual representation.
Definition: VisualRepMap.cc:58
Belle2::VisualRepMap::isCurrentlySelecting
bool isCurrentlySelecting() const
are we currently in a select() call?
Definition: VisualRepMap.h:52
Belle2::VisualRepMap::getEveElement
TEveElement * getEveElement(const TObject *obj) const
Get (first) visual representation of given object.
Definition: VisualRepMap.cc:80
Belle2::VisualRepMap
defines a bidirectional (many to many) mapping between TObjects in DataStore and their visual represe...
Definition: VisualRepMap.h:30
Belle2::VisualRepMap::select
void select(const TObject *object) const
Select the representation of the given object.
Definition: VisualRepMap.cc:89
Belle2::VisualRepMap::addCluster
void addCluster(const TObject *dataStoreObject, TEveCaloData *caloData, int towerID)
Selection inside TEveCalo* is complicated, use this to keep track of ECL clusters.
Definition: VisualRepMap.cc:148
Belle2::VisualRepMap::operator=
VisualRepMap & operator=(const VisualRepMap &)=delete
no assignment
Belle2::VisualRepMap::getInstance
static VisualRepMap * getInstance()
get instance pointer.
Definition: VisualRepMap.cc:38
Belle2::VisualRepMap::m_eclTowers
std::vector< EveTower * > m_eclTowers
individual ECL towers (getting them out of TEve is hard).
Definition: VisualRepMap.h:98
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::VisualRepMap::m_dataStoreEveElementMap
DataStoreEveElementMap * m_dataStoreEveElementMap
Map DataStore contents in current event with their visual representation.
Definition: VisualRepMap.h:95
Belle2::VisualRepMap::clearSelection
void clearSelection() const
Clear existing selection in Eve Browser.
Definition: VisualRepMap.cc:129
Belle2::VisualRepMap::isVisualized
bool isVisualized(const TObject *obj)
Does obj have a visualization?
Definition: VisualRepMap.h:64
Belle2::VisualRepMap::DataStoreEveElementMap
Hide implementation in private class.
Definition: VisualRepMap.cc:36