#include <Fireworks/Core/interface/FWTableViewManager.h>
Classes | |
struct | TableEntry |
class | TableHandle |
Public Types | |
typedef std::vector< const FWEventItem * > | Items |
typedef std::vector< TableEntry > | TableEntries |
typedef std::map< std::string, TableEntries > | TableSpecs |
Public Member Functions | |
void | addTo (FWConfiguration &) const |
void | addToImpl (FWConfiguration &) const |
FWViewBase * | buildView (TEveWindowSlot *iParent, const std::string &type) |
void | destroyItem (const FWEventItem *item) |
FWTableViewManager (FWGUIManager *) | |
const Items & | items () const |
virtual void | newItem (const FWEventItem *) |
void | notifyViews () |
void | removeAllItems (void) |
void | setFrom (const FWConfiguration &) |
virtual FWTypeToRepresentations | supportedTypesAndRepresentations () const |
TableSpecs::iterator | tableFormats (const edm::TypeWithDict &key) |
TableSpecs::iterator | tableFormats (const TClass &key) |
virtual | ~FWTableViewManager () |
Static Public Attributes | |
static const std::string | kConfigColumns |
static const std::string | kConfigTypeNames = "typeNames" |
Protected Types | |
typedef std::vector < boost::shared_ptr < FWTableView > > | Views |
Protected Member Functions | |
virtual void | colorsChanged () |
void | dataChanged () |
FWTableViewManager () | |
virtual void | modelChangesComing () |
virtual void | modelChangesDone () |
Protected Attributes | |
Items | m_items |
TableSpecs | m_tableFormats |
Views | m_views |
Private Member Functions | |
void | beingDestroyed (const FWViewBase *) |
FWTableViewManager (const FWTableViewManager &) | |
const FWTableViewManager & | operator= (const FWTableViewManager &) |
TableHandle | table (const char *collection) |
TableSpecs::iterator | tableFormatsImpl (const edm::TypeWithDict &key) |
Friends | |
class | FWTableView |
class | FWTableViewTableManager |
Description: Base class for a Manger for a specific type of View
Usage: <usage>
Definition at line 39 of file FWTableViewManager.h.
typedef std::vector<const FWEventItem *> FWTableViewManager::Items |
Container for the event items which have a table.
Definition at line 52 of file FWTableViewManager.h.
typedef std::vector<TableEntry> FWTableViewManager::TableEntries |
Container for the description of the columns of a given table.
Definition at line 54 of file FWTableViewManager.h.
typedef std::map<std::string, TableEntries> FWTableViewManager::TableSpecs |
Type for the collection specific (i.e. those that do not use default) table definition.
Definition at line 57 of file FWTableViewManager.h.
typedef std::vector<boost::shared_ptr<FWTableView> > FWTableViewManager::Views [protected] |
Definition at line 92 of file FWTableViewManager.h.
FWTableViewManager::FWTableViewManager | ( | FWGUIManager * | iGUIMgr | ) |
Definition at line 45 of file FWTableViewManager.cc.
References FWTableViewManager::TableEntry::BOOL, buildView(), f, FWViewType::idToName(), FWTableViewManager::TableEntry::INT, FWViewType::kTable, FWGUIManager::registerViewBuilder(), and table().
:FWViewManagerBase() { FWGUIManager::ViewBuildFunctor f; f=boost::bind(&FWTableViewManager::buildView, this, _1, _2); iGUIMgr->registerViewBuilder(FWViewType::idToName(FWViewType::kTable), f); // ---------- for some object types, we have default table contents ---------- table("reco::GenParticle"). column("pT", 1, "pt"). column("eta", 3). column("phi", 3). column("status", TableEntry::INT). column("pdgId", TableEntry::INT); table("reco::Muon"). column("q", TableEntry::INT, "charge"). column("pT", 1, "pt"). column("global", TableEntry::BOOL, "isGlobalMuon"). column("tracker", TableEntry::BOOL, "isTrackerMuon"). column("SA", TableEntry::BOOL, "isStandAloneMuon"). column("calo", TableEntry::BOOL, "isCaloMuon"). column("tr pt", 1, "track().pt()"). column("eta", 3). column("phi", 3). column("matches", TableEntry::INT, "numberOfMatches('SegmentArbitration')"). column("d0", 3, "track().d0()"). column("d0 / d0Err", 3, "track().d0() / track().d0Error()"); table("reco::GsfElectron"). column("q", TableEntry::INT, "charge"). column("pT", 1, "pt"). column("eta", 3). column("phi", 3). column("E/p", 3, "eSuperClusterOverP"). column("H/E", 3, "hadronicOverEm"). column("fbrem", 3, "(trackMomentumAtVtx().R() - trackMomentumOut().R()) / trackMomentumAtVtx().R()"). column("dei", 3, "deltaEtaSuperClusterTrackAtVtx()"). column("dpi", 3, "deltaPhiSuperClusterTrackAtVtx()"); table("reco::Photon"). column("pT", 1, "pt"). column("eta", 3). column("phi", 3). column("H/E", 3, "hadronicOverEm"); table("reco::CaloJet"). column("pT", 1, "pt"). column("eta", 3). column("phi", 3). column("ECAL", 1, "p4().E() * emEnergyFraction()"). column("HCAL", 1, "p4().E() * energyFractionHadronic()"). column("emf", 3, "emEnergyFraction()"); table("reco::Jet"). column("pT", 1, "pt"). column("eta", 3). column("phi", 3); table("reco::MET"). column("et", 1). column("phi", 3). column("sumEt", 1). column("mEtSig", 3); table("reco::Track"). column("q", TableEntry::INT, "charge"). column("pT", 1, "pt"). column("eta", 3). column("phi", 3). column("d0", 5). column("d0Err", 5, "d0Error"). column("dz", 5). column("dzErr", 5, "dzError"). column("vx", 5). column("vy", 5). column("vz", 5). column("pixel hits", TableEntry::INT, "hitPattern().numberOfValidPixelHits()"). column("strip hits", TableEntry::INT, "hitPattern().numberOfValidStripHits()"). column("chi2", 3). column("ndof", TableEntry::INT); table("reco::Vertex"). column("x", 5). column("xError", 5). column("y", 5). column("yError", 5). column("z", 5). column("zError", 5). column("tracks", TableEntry::INT, "tracksSize"). column("chi2", 3). column("ndof", 3); table("CaloTower"). column("emEt", 1). column("hadEt", 1). column("et", 1, "Et"). column("eta", 3). column("phi", 3); table("CaloRecHit"). column("id", TableEntry::INT,"detid.rawId"). column("energy",3). column("time",3). column("flags",TableEntry::INT,"flags"); }
FWTableViewManager::~FWTableViewManager | ( | ) | [virtual] |
Definition at line 153 of file FWTableViewManager.cc.
{ }
FWTableViewManager::FWTableViewManager | ( | ) | [protected] |
FWTableViewManager::FWTableViewManager | ( | const FWTableViewManager & | ) | [private] |
void FWTableViewManager::addTo | ( | FWConfiguration & | iTo | ) | const [virtual] |
Implements FWConfigurable.
Definition at line 426 of file FWTableViewManager.cc.
References addToImpl(), and m_views.
{ // if there are views, it's the job of the first view to store // the configuration (this is to avoid ordering problems in the // case of multiple views) if (!m_views.empty()) return; // if there are no views, then it's up to us to store the column // formats. This is done in addToImpl, which can be called by // FWTableView as well addToImpl(iTo); }
void FWTableViewManager::addToImpl | ( | FWConfiguration & | iTo | ) | const |
Definition at line 440 of file FWTableViewManager.cc.
References FWConfiguration::addKeyValue(), FWConfiguration::addValue(), python::tagInventory::entries, FWTableViewManager::TableEntry::expression, kConfigTypeNames, m_tableFormats, FWTableViewManager::TableEntry::name, FWTableViewManager::TableEntry::precision, AlCaHLTBitMon_QueryRunRegistry::string, and FWViewBase::typeName().
Referenced by FWTableView::addTo(), and addTo().
{ FWConfiguration typeNames(1); char prec[100]; for (TableSpecs::const_iterator iType = m_tableFormats.begin(), iType_end = m_tableFormats.end(); iType != iType_end; ++iType) { const std::string &typeName = iType->first; typeNames.addValue(typeName); FWConfiguration columns(1); const TableEntries &entries = iType->second; for (size_t ei = 0, ee = entries.size(); ei != ee; ++ei) { const TableEntry &entry = entries[ei]; columns.addValue(entry.name); columns.addValue(entry.expression); columns.addValue((snprintf(prec, 100, "%d", entry.precision), prec)); } iTo.addKeyValue(typeName, columns); } iTo.addKeyValue(kConfigTypeNames, typeNames); }
void FWTableViewManager::beingDestroyed | ( | const FWViewBase * | iView | ) | [private] |
Definition at line 319 of file FWTableViewManager.cc.
References m_views.
Referenced by buildView().
class FWViewBase * FWTableViewManager::buildView | ( | TEveWindowSlot * | iParent, |
const std::string & | type | ||
) |
Definition at line 307 of file FWTableViewManager.cc.
References beingDestroyed(), FWViewManagerBase::colorManager(), FWTableView, and m_views.
Referenced by FWTableViewManager().
{ TEveManager::TRedrawDisabler disableRedraw(gEve); boost::shared_ptr<FWTableView> view(new FWTableView(iParent, this)); view->setBackgroundColor(colorManager().background()); m_views.push_back(view); view->beingDestroyed_.connect(boost::bind(&FWTableViewManager::beingDestroyed, this, _1)); return view.get(); }
void FWTableViewManager::colorsChanged | ( | ) | [protected, virtual] |
Notify all the views that colors have changed
Implements FWViewManagerBase.
Definition at line 403 of file FWTableViewManager.cc.
References FWViewManagerBase::colorManager(), alignCSCRings::e, i, and m_views.
void FWTableViewManager::dataChanged | ( | ) | [protected] |
Definition at line 410 of file FWTableViewManager.cc.
References alignCSCRings::e, i, and m_views.
Referenced by FWTableView::addColumn(), FWTableView::deleteColumn(), modelChangesDone(), and FWTableView::modifyColumn().
void FWTableViewManager::destroyItem | ( | const FWEventItem * | iItem | ) |
Remove iItem from the list
iItem the item to be removed.
Definition at line 360 of file FWTableViewManager.cc.
References alignCSCRings::e, i, m_items, and notifyViews().
Referenced by newItem().
const Items& FWTableViewManager::items | ( | ) | const [inline] |
Definition at line 71 of file FWTableViewManager.h.
References m_items.
Referenced by FWTableView::addTo(), FWTableView::item(), FWTableView::selectCollection(), FWTableView::setFrom(), FWTableViewTableManager::updateEvaluators(), and FWTableView::updateItems().
{ return m_items; }
void FWTableViewManager::modelChangesComing | ( | ) | [protected, virtual] |
Called when models have changed and so the display must be updated.
Implements FWViewManagerBase.
Definition at line 386 of file FWTableViewManager.cc.
{ gEve->DisableRedraw(); }
void FWTableViewManager::modelChangesDone | ( | ) | [protected, virtual] |
Implements FWViewManagerBase.
Definition at line 392 of file FWTableViewManager.cc.
References dataChanged().
{ gEve->EnableRedraw(); // tell the views to update their item lists // FIXME: doesn't this need to call updateItems as well // and hence notifyViews would be more appropriate?? Boh... dataChanged(); }
void FWTableViewManager::newItem | ( | const FWEventItem * | iItem | ) | [virtual] |
Implements FWViewManagerBase.
Definition at line 334 of file FWTableViewManager.cc.
References destroyItem(), FWEventItem::goingToBeDestroyed_, m_items, and notifyViews().
{ m_items.push_back(iItem); iItem->goingToBeDestroyed_.connect(boost::bind(&FWTableViewManager::destroyItem, this, _1)); notifyViews(); }
void FWTableViewManager::notifyViews | ( | void | ) |
Tell the views to update their item list.
Definition at line 344 of file FWTableViewManager.cc.
References FWTableView::dataChanged(), alignCSCRings::e, i, m_views, and FWTableView::updateItems().
Referenced by destroyItem(), newItem(), and removeAllItems().
{ for(size_t i = 0, e = m_views.size(); i != e; ++i) { FWTableView *view = m_views[i].get(); view->updateItems(); view->dataChanged(); } }
const FWTableViewManager& FWTableViewManager::operator= | ( | const FWTableViewManager & | ) | [private] |
void FWTableViewManager::removeAllItems | ( | void | ) |
Remove all items present in the view.
This should watch the FWEventItemsManager::goingToClearItems_ signal.
Definition at line 379 of file FWTableViewManager.cc.
References m_items, and notifyViews().
Referenced by CmsShowMainBase::setupViewManagers().
{ m_items.clear(); notifyViews(); }
void FWTableViewManager::setFrom | ( | const FWConfiguration & | iFrom | ) | [virtual] |
Implements FWConfigurable.
Definition at line 467 of file FWTableViewManager.cc.
References FWTableViewManager::TableHandle::column(), fwLog, patZpeak::handle, kConfigTypeNames, fwlog::kWarning, mergeVDriftHistosByStation::name, AlCaHLTBitMon_QueryRunRegistry::string, FWConfiguration::stringValues(), table(), and FWConfiguration::valueForKey().
Referenced by FWTableView::setFrom().
{ try { const FWConfiguration *typeNames = iFrom.valueForKey(kConfigTypeNames); if (typeNames == 0) { fwLog(fwlog::kWarning) << "no table column configuration stored, using defaults\n"; return; } //NOTE: FWTableViewTableManagers hold pointers into m_tableFormats so if we // clear it those pointers would be invalid // instead we will just clear the lists and fill them with their new values //m_tableFormats.clear(); for (FWConfiguration::StringValuesIt iType = typeNames->stringValues()->begin(), iTypeEnd = typeNames->stringValues()->end(); iType != iTypeEnd; ++iType) { //std::cout << "reading type " << *iType << std::endl; const FWConfiguration *columns = iFrom.valueForKey(*iType); assert(columns != 0); TableHandle handle = table(iType->c_str()); for (FWConfiguration::StringValuesIt it = columns->stringValues()->begin(), itEnd = columns->stringValues()->end(); it != itEnd; ++it) { const std::string &name = *it++; const std::string &expr = *it++; int prec = atoi(it->c_str()); handle.column(name.c_str(), prec, expr.c_str()); } } } catch (...) { // No info about types in the configuration; this is not an // error, it merely means that the types are handled by the // first FWTableView. } }
FWTypeToRepresentations FWTableViewManager::supportedTypesAndRepresentations | ( | ) | const [virtual] |
Implements FWViewManagerBase.
Definition at line 417 of file FWTableViewManager.cc.
{ FWTypeToRepresentations returnValue; return returnValue; }
FWTableViewManager::TableHandle FWTableViewManager::table | ( | const char * | name | ) | [private] |
Define a new table for type name
name the typename of the object contained in the table.
If a table with the same name is already there, its entries are reset.
Definition at line 174 of file FWTableViewManager.cc.
References patZpeak::handle, and m_tableFormats.
Referenced by FWTableViewManager(), setFrom(), and tableFormats().
{ TableHandle handle(name, m_tableFormats); return handle; }
FWTableViewManager::TableSpecs::iterator FWTableViewManager::tableFormats | ( | const edm::TypeWithDict & | key | ) |
Find the entries for a given type key, possibly recursively searching recursively in the class hierarchy for a base class that matches.
key the edm::TypeWithDict of the collection for which we want to have the key definition.
FIXME: how about actually inspecting the type and show all the int and floats if no description is found??
Definition at line 236 of file FWTableViewManager.cc.
References FWTableViewManager::TableEntry::BOOL, FWTableViewManager::TableHandle::column(), edm::FunctionWithDict::functionParameterSize(), patZpeak::handle, FWTableViewManager::TableEntry::INT, edm::MemberWithDict::isConst(), edm::FunctionWithDict::isConst(), edm::FunctionWithDict::isPublic(), edm::MemberWithDict::isPublic(), m, m_tableFormats, edm::FunctionWithDict::name(), edm::MemberWithDict::name(), edm::TypeWithDict::name(), run_regression::ret, edm::FunctionWithDict::returnType(), edm::Scoped, AlCaHLTBitMon_QueryRunRegistry::string, table(), tableFormatsImpl(), and edm::MemberWithDict::typeOf().
Referenced by FWTableView::selectCollection(), and tableFormats().
{ static const std::string isint("int"); static const std::string isbool("bool"); static const std::string isdouble("double"); static const std::string isfloat("float"); std::string keyType = key.name(edm::TypeNameHandling::Scoped); TableSpecs::iterator ret = m_tableFormats.find(keyType); if (ret != m_tableFormats.end()) return ret; ret = tableFormatsImpl(key); // recursive search for base classes if (ret != m_tableFormats.end()) return ret; TableHandle handle = table(keyType.c_str()); edm::TypeFunctionMembers functionMembers(key); for (auto const& member : functionMembers) { edm::FunctionWithDict m(member); if (m.functionParameterSize()) continue; if (!m.isPublic()) continue; if (!m.isConst()) continue; if (m.returnType().name() == isint) handle.column(m.name().c_str(), TableEntry::INT); else if (m.returnType().name() == isbool) handle.column(m.name().c_str(), TableEntry::BOOL); else if (m.returnType().name() == isdouble) handle.column(m.name().c_str(), 5); else if (m.returnType().name() == isfloat) handle.column(m.name().c_str(), 3); } edm::TypeDataMembers dataMembers(key); for (auto const& member : dataMembers) { edm::MemberWithDict m(member); if (!m.isPublic()) continue; if (!m.isConst()) continue; if (m.typeOf().name() == isint) handle.column(m.name().c_str(), TableEntry::INT); else if (m.typeOf().name() == isbool) handle.column(m.name().c_str(), TableEntry::BOOL); else if (m.typeOf().name() == isdouble) handle.column(m.name().c_str(), 5); else if (m.typeOf().name() == isfloat) handle.column(m.name().c_str(), 3); } return m_tableFormats.find(keyType); }
FWTableViewManager::TableSpecs::iterator FWTableViewManager::tableFormats | ( | const TClass & | key | ) |
Helper function which uses TClass rather than edm::TypeWithDict.
Otherwise identical to FWTableViewManager::tableFormats(const TClass &key).
Definition at line 301 of file FWTableViewManager.cc.
References edm::TypeWithDict::byName(), and tableFormats().
{ return tableFormats(edm::TypeWithDict::byName(key.GetName())); }
FWTableViewManager::TableSpecs::iterator FWTableViewManager::tableFormatsImpl | ( | const edm::TypeWithDict & | key | ) | [private] |
Helper function to do recursive lookup of specialized table description for a given type key.
Definition at line 204 of file FWTableViewManager.cc.
References m_tableFormats, edm::TypeWithDict::name(), run_regression::ret, and edm::Scoped.
Referenced by tableFormats().
{ TableSpecs::iterator ret = m_tableFormats.find(key.name(edm::TypeNameHandling::Scoped)); if (ret != m_tableFormats.end()) return ret; // if there is no exact match for the type, try the base classes edm::TypeBases bases(key); for (auto const& base : bases) { ret = tableFormatsImpl(edm::BaseWithDict(base).toType()); if (ret != m_tableFormats.end()) return ret; } return m_tableFormats.end(); }
friend class FWTableView [friend] |
Definition at line 41 of file FWTableViewManager.h.
Referenced by buildView().
friend class FWTableViewTableManager [friend] |
Definition at line 42 of file FWTableViewManager.h.
const std::string FWTableViewManager::kConfigColumns [static] |
Definition at line 81 of file FWTableViewManager.h.
const std::string FWTableViewManager::kConfigTypeNames = "typeNames" [static] |
Definition at line 80 of file FWTableViewManager.h.
Referenced by addToImpl(), and setFrom().
Items FWTableViewManager::m_items [protected] |
Definition at line 95 of file FWTableViewManager.h.
Referenced by destroyItem(), items(), newItem(), and removeAllItems().
TableSpecs FWTableViewManager::m_tableFormats [protected] |
Definition at line 96 of file FWTableViewManager.h.
Referenced by addToImpl(), FWTableView::selectCollection(), table(), tableFormats(), and tableFormatsImpl().
Views FWTableViewManager::m_views [protected] |
Definition at line 94 of file FWTableViewManager.h.
Referenced by FWTableView::addTo(), addTo(), beingDestroyed(), buildView(), colorsChanged(), dataChanged(), notifyViews(), and FWTableView::setFrom().