Belle II Software development
EveTower.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <display/EveTower.h>
9
10#include <TEveCaloData.h>
11#include <TEveSelection.h>
12#include <TEveManager.h>
13
14
15using namespace Belle2;
16
17void EveTower::SelectElement(Bool_t state)
18{
19 auto& cellVector = m_caloData->GetCellsSelected();
20 if (state)
21 cellVector.emplace_back(m_id, 0); //tower id, slice 0
22 else
23 cellVector.clear();
24 m_caloData->CellSelectionChanged();
25
26 //to emulate a user click, also select the parent ECLData object
27 //otherwise there will be no SelectionRepeated() signal if the
28 //user clicks on another cluster after we're done here.
29 //Note: also needs to be done without generating a selection event
30 if (!gEve->GetSelection()->HasChild(m_caloData))
31 gEve->GetSelection()->AddElement(m_caloData);
32
33 //without selecting the visualisation objects, there is no highlighting, so lets do that, too.
34 TEveElement::Set_t vizset;
35 m_caloData->FillImpliedSelectedSet(vizset);
36 for (TEveElement* viz : vizset)
37 viz->SelectElement(state);
38}
virtual void SelectElement(Bool_t state)
Overrides TEveElement::SelectElement(), performs magic to select a single cluster.
Definition: EveTower.cc:17
int m_id
id of tower.
Definition: EveTower.h:33
TEveCaloData * m_caloData
Calo data object containing the tower.
Definition: EveTower.h:32
Abstract base class for different kinds of events.