CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes
FWDetailViewManager Class Reference

#include <Fireworks/Core/interface/FWDetailViewManager.h>

Classes

struct  ViewFrame
 

Public Member Functions

void colorsChanged ()
 
std::vector< std::string > detailViewsFor (const FWModelId &) const
 
void eveWindowDestroyed (TEveWindow *)
 
 FWDetailViewManager (fireworks::Context *)
 
void newEventCallback ()
 
void openDetailViewFor (const FWModelId &, const std::string &)
 
virtual ~FWDetailViewManager ()
 

Protected Attributes

fireworks::Contextm_context
 

Private Types

typedef vViews_t::iterator vViews_i
 
typedef std::vector< ViewFramevViews_t
 

Private Member Functions

std::vector< std::string > findViewersFor (const std::string &) const
 
 FWDetailViewManager (const FWDetailViewManager &)=delete
 
const FWDetailViewManageroperator= (const FWDetailViewManager &)=delete
 

Private Attributes

std::map< std::string, std::vector< std::string > > m_typeToViewers
 
vViews_t m_views
 

Detailed Description

Description: <one line="" class="" summary>="">

Usage: <usage>

Definition at line 35 of file FWDetailViewManager.h.

Member Typedef Documentation

◆ vViews_i

typedef vViews_t::iterator FWDetailViewManager::vViews_i
private

Definition at line 70 of file FWDetailViewManager.h.

◆ vViews_t

typedef std::vector<ViewFrame> FWDetailViewManager::vViews_t
private

Definition at line 69 of file FWDetailViewManager.h.

Constructor & Destructor Documentation

◆ FWDetailViewManager() [1/2]

FWDetailViewManager::FWDetailViewManager ( fireworks::Context iCtx)

Definition at line 51 of file FWDetailViewManager.cc.

51  : m_context(iCtx) {
52  // force white background for all embedded canvases
53  gROOT->SetStyle("Plain");
54 
56  gEve->GetWindowManager()->Connect(
57  "WindowDeleted(TEveWindow*)", "FWDetailViewManager", this, "eveWindowDestroyed(TEveWindow*)");
58 }

References fireworks::Context::colorManager(), colorsChanged(), FWColorManager::colorsHaveChanged_, and m_context.

◆ ~FWDetailViewManager()

FWDetailViewManager::~FWDetailViewManager ( )
virtual

Definition at line 60 of file FWDetailViewManager.cc.

60  {
62  gEve->GetWindowManager()->Disconnect("WindowDeleted(TEveWindow*)", this, "eveWindowDestroyed(TEveWindow*)");
63 }

References newEventCallback().

◆ FWDetailViewManager() [2/2]

FWDetailViewManager::FWDetailViewManager ( const FWDetailViewManager )
privatedelete

Member Function Documentation

◆ colorsChanged()

void FWDetailViewManager::colorsChanged ( )

Definition at line 194 of file FWDetailViewManager.cc.

194  {
195  for (vViews_i i = m_views.begin(); i != m_views.end(); ++i)
196  (*i).m_detailView->setBackgroundColor(m_context->colorManager()->background());
197 }

References FWColorManager::background(), fireworks::Context::colorManager(), mps_fire::i, m_context, and m_views.

Referenced by FWDetailViewManager().

◆ detailViewsFor()

std::vector< std::string > FWDetailViewManager::detailViewsFor ( const FWModelId iId) const

Definition at line 112 of file FWDetailViewManager.cc.

112  {
113  std::string typeName = edm::TypeWithDict(*(iId.item()->modelType()->GetTypeInfo())).name();
114  std::vector<std::string> fullNames = findViewersFor(typeName);
115  std::vector<std::string> justViewNames;
116  justViewNames.reserve(fullNames.size());
117  std::transform(fullNames.begin(), fullNames.end(), std::back_inserter(justViewNames), &viewNameFrom);
118  return justViewNames;
119 }

References findViewersFor(), FWModelId::item(), FWEventItem::modelType(), edm::TypeWithDict::name(), AlCaHLTBitMon_QueryRunRegistry::string, HcalDetIdTransform::transform(), dqmiodumpindices::typeName, and viewNameFrom().

Referenced by FWModelContextMenuHandler::chosenItem(), CmsShowModelPopup::clicked(), CmsShowModelPopup::fillModelPopup(), CmsShowModelPopup::openDetailedView(), and FWModelContextMenuHandler::showSelectedModelContext().

◆ eveWindowDestroyed()

void FWDetailViewManager::eveWindowDestroyed ( TEveWindow *  ew)

Definition at line 205 of file FWDetailViewManager.cc.

205  {
206  for (vViews_i i = m_views.begin(); i != m_views.end(); ++i) {
207  if (ew == i->m_eveWindow) {
208  // printf("========================== delete %s \n", ew->GetElementName());
209  m_views.erase(i);
210  break;
211  }
212  }
213 }

References mps_fire::i, and m_views.

◆ findViewersFor()

std::vector< std::string > FWDetailViewManager::findViewersFor ( const std::string &  iType) const
private

Definition at line 130 of file FWDetailViewManager.cc.

130  {
131  std::vector<std::string> returnValue;
132 
133  std::map<std::string, std::vector<std::string> >::const_iterator itFind = m_typeToViewers.find(iType);
134  if (itFind != m_typeToViewers.end()) {
135  return itFind->second;
136  }
137 
138  std::set<std::string> detailViews;
139 
140  std::vector<edmplugin::PluginInfo> all =
142  std::transform(all.begin(),
143  all.end(),
144  std::inserter(detailViews, detailViews.begin()),
145  boost::bind(&edmplugin::PluginInfo::name_, _1));
146  unsigned int closestMatch = 0xFFFFFFFF;
147 
148  for (std::set<std::string>::iterator it = detailViews.begin(), itEnd = detailViews.end(); it != itEnd; ++it) {
149  if (m_context->getHidePFBuilders()) {
150  std::size_t found = it->find("PF ");
151  if (found != std::string::npos)
152  continue;
153  }
154  std::string::size_type first = it->find_first_of('@');
155  std::string type = it->substr(0, first);
156 
157  //see if we match via inheritance
158  FWSimpleRepresentationChecker checker(type, "", 0, false);
159  FWRepresentationInfo info = checker.infoFor(iType);
160  bool pass = false;
161  if (closestMatch > info.proximity()) {
162  pass = true;
163  std::string::size_type firstD = it->find_first_of('&') + 1;
164  if (firstD != std::string::npos) {
165  std::stringstream ss(it->substr(firstD));
166  std::string ml;
167  while (std::getline(ss, ml, '&')) {
169  fwLog(fwlog::kDebug) << "DetailView " << *it << " requires module label " << ml << std::endl;
170  pass = false;
171  break;
172  }
173  }
174  }
175  if (pass) {
176  returnValue.push_back(*it);
177  } else {
178  std::string::size_type first = (*it).find_first_of('@');
179  std::string vn = *it;
180  vn.insert(++first, "!");
181  returnValue.push_back(vn);
182  }
183  }
184  }
185 
186  std::vector<std::string>::iterator it;
187  it = std::unique(returnValue.begin(), returnValue.end(), pluginComapreFunc);
188  returnValue.resize(std::distance(returnValue.begin(), it));
189 
190  m_typeToViewers[iType] = returnValue;
191  return returnValue;
192 }

References python.cmstools::all(), taus_updatedMVAIds_cff::category, edmplugin::PluginManager::categoryToInfos(), HLT_2018_cff::distance, dqmdumpme::first, newFWLiteAna::found, fwLog, edmplugin::PluginManager::get(), get, fireworks::Context::getHidePFBuilders(), FWJobMetadataManager::hasModuleLabel(), info(), FWSimpleRepresentationChecker::infoFor(), fwlog::kDebug, m_context, m_typeToViewers, fireworks::Context::metadataManager(), edmplugin::PluginInfo::name_, contentValuesCheck::ss, AlCaHLTBitMon_QueryRunRegistry::string, HcalDetIdTransform::transform(), and tier0::unique().

Referenced by detailViewsFor(), and openDetailViewFor().

◆ newEventCallback()

void FWDetailViewManager::newEventCallback ( )

Definition at line 199 of file FWDetailViewManager.cc.

199  {
200  while (!m_views.empty()) {
201  m_views.front().m_eveWindow->DestroyWindowAndSlot();
202  }
203 }

References m_views.

Referenced by FWGUIManager::eventChangedCallback(), and ~FWDetailViewManager().

◆ openDetailViewFor()

void FWDetailViewManager::openDetailViewFor ( const FWModelId id,
const std::string &  iViewName 
)

Definition at line 71 of file FWDetailViewManager.cc.

71  {
72  TEveWindowSlot* slot = TEveWindow::CreateWindowMainFrame();
73  TEveCompositeFrameInMainFrame* eveFrame = (TEveCompositeFrameInMainFrame*)slot->GetEveFrame();
74 
75  // find the right viewer for this item
76  std::string typeName = edm::TypeWithDict(*(id.item()->modelType()->GetTypeInfo())).name();
77  std::vector<std::string> viewerNames = findViewersFor(typeName);
78  if (viewerNames.empty()) {
79  fwLog(fwlog::kError) << "FWDetailViewManager: don't know what detailed view to "
80  "use for object "
81  << id.item()->name() << std::endl;
82  assert(!viewerNames.empty());
83  }
84 
85  //see if one of the names matches iViewName
87  for (std::vector<std::string>::iterator it = viewerNames.begin(), itEnd = viewerNames.end(); it != itEnd; ++it) {
88  std::string t = viewNameFrom(*it);
89  //std::cout <<"'"<<iViewName<< "' '"<<t<<"'"<<std::endl;
90  if (t == iViewName) {
91  match = *it;
92  break;
93  }
94  }
95  assert(!match.empty());
96  std::unique_ptr<FWDetailViewBase> detailView{FWDetailViewFactory::get()->create(match)};
97  assert(nullptr != detailView);
98 
99  TEveWindowSlot* ws = (TEveWindowSlot*)(eveFrame->GetEveWindow());
100  detailView->init(ws);
101  detailView->build(id);
102  detailView->setBackgroundColor(m_context->colorManager()->background());
103 
104  TGMainFrame* mf = (TGMainFrame*)(eveFrame->GetParent());
105  mf->SetWindowName(Form("%s Detail View [%d]", id.item()->name().c_str(), id.index()));
106 
107  m_views.emplace_back(eveFrame, std::move(detailView), eveFrame->GetEveWindow());
108 
109  mf->MapRaised();
110 }

References cms::cuda::assert(), FWColorManager::background(), fireworks::Context::colorManager(), findViewersFor(), fwLog, get, B2GTnPMonitor_cfi::item, fwlog::kError, m_context, m_views, match(), eostools::move(), Skims_PA_cff::name, edm::TypeWithDict::name(), AlCaHLTBitMon_QueryRunRegistry::string, OrderedSet::t, dqmiodumpindices::typeName, and viewNameFrom().

Referenced by FWModelContextMenuHandler::chosenItem(), CmsShowModelPopup::clicked(), and CmsShowModelPopup::openDetailedView().

◆ operator=()

const FWDetailViewManager& FWDetailViewManager::operator= ( const FWDetailViewManager )
privatedelete

Member Data Documentation

◆ m_context

fireworks::Context* FWDetailViewManager::m_context
protected

◆ m_typeToViewers

std::map<std::string, std::vector<std::string> > FWDetailViewManager::m_typeToViewers
mutableprivate

Definition at line 73 of file FWDetailViewManager.h.

Referenced by findViewersFor().

◆ m_views

vViews_t FWDetailViewManager::m_views
private
taus_updatedMVAIds_cff.category
category
Definition: taus_updatedMVAIds_cff.py:30
FWSimpleRepresentationChecker
Definition: FWSimpleRepresentationChecker.h:29
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:355
FWDetailViewManager::colorsChanged
void colorsChanged()
Definition: FWDetailViewManager.cc:194
fireworks::Context::colorManager
FWColorManager * colorManager() const
Definition: Context.h:58
FWColorManager::colorsHaveChanged_
sigc::signal< void > colorsHaveChanged_
Definition: FWColorManager.h:101
cms::cuda::assert
assert(be >=bs)
HLT_2018_cff.distance
distance
Definition: HLT_2018_cff.py:6417
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
FWModelId::item
const FWEventItem * item() const
Definition: FWModelId.h:39
fireworks::Context::metadataManager
FWJobMetadataManager * metadataManager() const
Definition: Context.h:60
newFWLiteAna.found
found
Definition: newFWLiteAna.py:118
dqmdumpme.first
first
Definition: dqmdumpme.py:55
edmplugin::PluginManager::get
static PluginManager * get()
Definition: PluginManager.cc:307
python.cmstools.all
def all(container)
workaround iterator generators for ROOT classes
Definition: cmstools.py:26
edmplugin::PluginManager::categoryToInfos
const CategoryToInfos & categoryToInfos() const
Definition: PluginManager.h:80
contentValuesCheck.ss
ss
Definition: contentValuesCheck.py:33
trigger::size_type
uint16_t size_type
Definition: TriggerTypeDefs.h:18
FWDetailViewManager::vViews_i
vViews_t::iterator vViews_i
Definition: FWDetailViewManager.h:70
FWEventItem::modelType
const TClass * modelType() const
Definition: FWEventItem.cc:464
HcalDetIdTransform::transform
unsigned transform(const HcalDetId &id, unsigned transformCode)
Definition: HcalDetIdTransform.cc:7
FWDetailViewManager::m_typeToViewers
std::map< std::string, std::vector< std::string > > m_typeToViewers
Definition: FWDetailViewManager.h:73
OrderedSet.t
t
Definition: OrderedSet.py:90
edmplugin::PluginInfo::name_
std::string name_
Definition: PluginInfo.h:29
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
viewNameFrom
static std::string viewNameFrom(const std::string &iFull)
Definition: FWDetailViewManager.cc:43
dqmiodumpindices.typeName
typeName
Definition: dqmiodumpindices.py:33
edm::TypeWithDict
Definition: TypeWithDict.h:38
FWDetailViewManager::m_context
fireworks::Context * m_context
Definition: FWDetailViewManager.h:61
FWDetailViewManager::m_views
vViews_t m_views
Definition: FWDetailViewManager.h:71
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
fireworks::Context::getHidePFBuilders
bool getHidePFBuilders() const
Definition: Context.h:80
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
get
#define get
FWRepresentationInfo
Definition: FWRepresentationInfo.h:28
type
type
Definition: HCALResponse.h:21
eostools.move
def move(src, dest)
Definition: eostools.py:511
tier0.unique
def unique(seq, keepstr=True)
Definition: tier0.py:24
FWJobMetadataManager::hasModuleLabel
virtual bool hasModuleLabel(std::string &moduleLabel)=0
fwlog::kDebug
Definition: fwLog.h:35
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
fwlog::kError
Definition: fwLog.h:35
FWDetailViewManager::newEventCallback
void newEventCallback()
Definition: FWDetailViewManager.cc:199
FWDetailViewManager::findViewersFor
std::vector< std::string > findViewersFor(const std::string &) const
Definition: FWDetailViewManager.cc:130
FWColorManager::background
Color_t background() const
Definition: FWColorManager.h:55
edm::TypeWithDict::name
std::string name() const
Definition: TypeWithDict.cc:456