Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:27:20

0001 // -*- C++ -*-
0002 //
0003 // Package:     Core
0004 // Class  :     FWTriggerTableViewManager
0005 //
0006 // Implementation:
0007 //     <Notes on implementation>
0008 //
0009 // Original Author:
0010 //         Created:  Sun Jan  6 22:01:27 EST 2008
0011 //
0012 
0013 // system include files
0014 #include <cassert>
0015 #include <iostream>
0016 #include <functional>
0017 
0018 // user include files
0019 
0020 #include "Fireworks/Core/interface/FWTriggerTableViewManager.h"
0021 #include "Fireworks/Core/interface/FWHLTTriggerTableView.h"
0022 #include "Fireworks/Core/interface/FWL1TriggerTableView.h"
0023 #include "Fireworks/Core/interface/FWEventItem.h"
0024 #include "Fireworks/Core/interface/FWGUIManager.h"
0025 #include "Fireworks/Core/interface/FWColorManager.h"
0026 #include "Fireworks/Core/interface/FWTypeToRepresentations.h"
0027 #include "Fireworks/Core/interface/FWJobMetadataManager.h"
0028 
0029 FWTriggerTableViewManager::FWTriggerTableViewManager(FWGUIManager* iGUIMgr) : FWViewManagerBase() {
0030   FWGUIManager::ViewBuildFunctor f;
0031   f = std::bind(&FWTriggerTableViewManager::buildView, this, std::placeholders::_1, std::placeholders::_2);
0032   iGUIMgr->registerViewBuilder(FWViewType::idToName(FWViewType::kTableHLT), f);
0033   iGUIMgr->registerViewBuilder(FWViewType::idToName(FWViewType::kTableL1), f);
0034 }
0035 
0036 FWTriggerTableViewManager::~FWTriggerTableViewManager() {}
0037 
0038 class FWViewBase* FWTriggerTableViewManager::buildView(TEveWindowSlot* iParent, const std::string& type) {
0039   std::shared_ptr<FWTriggerTableView> view;
0040 
0041   if (type == FWViewType::sName[FWViewType::kTableHLT])
0042     view.reset(new FWHLTTriggerTableView(iParent));
0043   else
0044     view.reset(new FWL1TriggerTableView(iParent));
0045 
0046   view->setProcessList(&(context().metadataManager()->processNamesInJob()));
0047 
0048   view->setBackgroundColor(colorManager().background());
0049   m_views.push_back(std::shared_ptr<FWTriggerTableView>(view));
0050   view->beingDestroyed_.connect(std::bind(&FWTriggerTableViewManager::beingDestroyed, this, std::placeholders::_1));
0051   return view.get();
0052 }
0053 
0054 void FWTriggerTableViewManager::beingDestroyed(const FWViewBase* iView) {
0055   for (std::vector<std::shared_ptr<FWTriggerTableView> >::iterator it = m_views.begin(), itEnd = m_views.end();
0056        it != itEnd;
0057        ++it) {
0058     if (it->get() == iView) {
0059       m_views.erase(it);
0060       return;
0061     }
0062   }
0063 }
0064 
0065 void FWTriggerTableViewManager::colorsChanged() {
0066   for (std::vector<std::shared_ptr<FWTriggerTableView> >::iterator it = m_views.begin(), itEnd = m_views.end();
0067        it != itEnd;
0068        ++it) {
0069     (*it)->setBackgroundColor(colorManager().background());
0070   }
0071 }
0072 
0073 void FWTriggerTableViewManager::eventEnd() {
0074   for (std::vector<std::shared_ptr<FWTriggerTableView> >::iterator it = m_views.begin(), itEnd = m_views.end();
0075        it != itEnd;
0076        ++it) {
0077     (*it)->dataChanged();
0078   }
0079 }
0080 
0081 void FWTriggerTableViewManager::updateProcessList() {
0082   // printf("FWTriggerTableViewManager::updateProcessLi\n");
0083   for (std::vector<std::shared_ptr<FWTriggerTableView> >::iterator it = m_views.begin(), itEnd = m_views.end();
0084        it != itEnd;
0085        ++it) {
0086     (*it)->setProcessList(&(context().metadataManager()->processNamesInJob()));
0087     (*it)->resetCombo();
0088   }
0089 }