diff --git a/Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.cc b/Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.cc index 0fc1c8f6e2dd3..471da0e32b3a7 100644 --- a/Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.cc +++ b/Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.cc @@ -11,7 +11,7 @@ #include "Fireworks/Core/interface/FWProxyBuilderConfiguration.h" FWCaloRecHitDigitSetProxyBuilder::FWCaloRecHitDigitSetProxyBuilder() - : m_invertBox(false), m_ignoreGeoShapeSize(false) + : m_invertBox(false), m_ignoreGeoShapeSize(false), m_enlarge(1.0) {} //______________________________________________________________________________ @@ -19,12 +19,16 @@ FWCaloRecHitDigitSetProxyBuilder::FWCaloRecHitDigitSetProxyBuilder() void FWCaloRecHitDigitSetProxyBuilder::setItem(const FWEventItem* iItem) { FWProxyBuilderBase::setItem(iItem); - // if (iItem) iItem->getConfig()->assertParam( "IgnoreShapeSize", false); + if (iItem) { + iItem->getConfig()->assertParam( "Enlarge", 1.0, 1.0, 5.0); + // iItem->getConfig()->assertParam( "IgnoreShapeSize", false); + } } //______________________________________________________________________________ void FWCaloRecHitDigitSetProxyBuilder::viewContextBoxScale( const float* corners, float scale, bool plotEt, std::vector& scaledCorners, const CaloRecHit*) { + scale *= m_enlarge; if ( m_ignoreGeoShapeSize) { // Same functionality as fireworks::energyTower3DCorners() @@ -141,6 +145,7 @@ FWCaloRecHitDigitSetProxyBuilder::build( const FWEventItem* iItem, TEveElementLi if (!size) return; // m_ignoreGeoShapeSize = item()->getConfig()->value("IgnoreShapeSize"); + m_enlarge = item()->getConfig()->value("Enlarge"); std::vector scaledCorners(24); diff --git a/Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.h b/Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.h index 799237bb772db..aaf24e313ad99 100644 --- a/Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.h +++ b/Fireworks/Calo/plugins/FWCaloRecHitDigitSetProxyBuilder.h @@ -29,6 +29,7 @@ class FWCaloRecHitDigitSetProxyBuilder : public FWDigitSetProxyBuilder bool m_invertBox; bool m_ignoreGeoShapeSize; + double m_enlarge; TEveVector m_vector; // internal memeber, to avoid constant recreation }; #endif diff --git a/Fireworks/Core/doc/Core.doc b/Fireworks/Core/doc/Core.doc index 7867e52174c4c..a7d0a81c6c309 100644 --- a/Fireworks/Core/doc/Core.doc +++ b/Fireworks/Core/doc/Core.doc @@ -90,7 +90,6 @@ - FWHFView - FWHLTTriggerTableView - FWHLTValidator -- FWHandle - FWISpyView - FWIntValueListener - FWIntValueListenerBase diff --git a/Fireworks/Core/interface/ActionsList.h b/Fireworks/Core/interface/ActionsList.h index 9b45ed33ebbdb..71dccd4c24265 100644 --- a/Fireworks/Core/interface/ActionsList.h +++ b/Fireworks/Core/interface/ActionsList.h @@ -11,6 +11,11 @@ namespace cmsshow { extern const std::string sLoadConfig; extern const std::string sSaveConfig; extern const std::string sSaveConfigAs; + + extern const std::string sLoadPartialConfig; + extern const std::string sSavePartialConfig; + extern const std::string sSavePartialConfigAs; + extern const std::string sExportImage; extern const std::string sExportAllImages; diff --git a/Fireworks/Core/interface/CmsShowMainBase.h b/Fireworks/Core/interface/CmsShowMainBase.h index aadbde982a659..50e28b861b9d6 100644 --- a/Fireworks/Core/interface/CmsShowMainBase.h +++ b/Fireworks/Core/interface/CmsShowMainBase.h @@ -80,7 +80,10 @@ class CmsShowMainBase void writeToConfigFile(const std::string &config); void writeToCurrentConfigFile(); + void writePartialToConfigFile(); void reloadConfiguration(const std::string &config); + void partialWriteToConfigFile(const std::string &config); + void partialLoadConfiguration(const std::string &config); void setupConfiguration(); void registerPhysicsObject(const FWPhysicsObjectDesc&iItem); @@ -114,8 +117,9 @@ class CmsShowMainBase void playForward(); void playBackward(); bool isPlaying() const { return m_isPlaying; } - void setIsPlaying(bool value) { m_isPlaying = value; } - virtual void stopPlaying() = 0; + + virtual void checkKeyBindingsOnPLayEventsStateChanged() {} + virtual void stopPlaying(); virtual void autoLoadNewEvent() = 0; void setPlayLoop(); diff --git a/Fireworks/Core/interface/FW3DView.h b/Fireworks/Core/interface/FW3DView.h index 9fdfc2146f8eb..06ee333b265d8 100644 --- a/Fireworks/Core/interface/FW3DView.h +++ b/Fireworks/Core/interface/FW3DView.h @@ -1,4 +1,4 @@ -#ifndef Fireworks_Core_FW3DEnergyView_h +#ifndef Fireworks_Core_FW3DView_h #define Fireworks_Core_FW3DView_h // -*- C++ -*- // diff --git a/Fireworks/Core/interface/FW3DViewBase.h b/Fireworks/Core/interface/FW3DViewBase.h index 17d0174c99202..3dfeeb6cec384 100644 --- a/Fireworks/Core/interface/FW3DViewBase.h +++ b/Fireworks/Core/interface/FW3DViewBase.h @@ -34,6 +34,7 @@ class FW3DViewGeometry; class FWColorManager; class TGLClip; class TEveLine; +class TEveBoxSet; class FW3DViewDistanceMeasureTool; @@ -61,6 +62,7 @@ class FW3DViewBase : public FWEveView virtual bool requestGLHandlerPick() const; void setCurrentDMTVertex(double x, double y, double z); + void showEcalBarrel(bool); private: FW3DViewBase(const FW3DViewBase&); // stop default @@ -78,6 +80,9 @@ class FW3DViewBase : public FWEveView FWBoolParameter m_showTrackerBarrel; FWBoolParameter m_showTrackerEndcap; + TEveBoxSet* m_ecalBarrel; + FWBoolParameter m_showEcalBarrel; + FWEnumParameter m_rnrStyle; FWBoolParameter m_clipParam; FWBoolParameter m_selectable; diff --git a/Fireworks/Core/interface/FWConfiguration.h b/Fireworks/Core/interface/FWConfiguration.h index d3e39f3bddf70..860e32ff50b4a 100644 --- a/Fireworks/Core/interface/FWConfiguration.h +++ b/Fireworks/Core/interface/FWConfiguration.h @@ -70,6 +70,7 @@ class FWConfiguration FWConfiguration& addValue(const std::string&); void swap(FWConfiguration& ); + static void streamTo(std::ostream& oTo, const FWConfiguration& iConfig, const std::string &name); private: diff --git a/Fireworks/Core/interface/FWConfigurationManager.h b/Fireworks/Core/interface/FWConfigurationManager.h index 834d53a6f7daa..ce9e0fb8baf24 100644 --- a/Fireworks/Core/interface/FWConfigurationManager.h +++ b/Fireworks/Core/interface/FWConfigurationManager.h @@ -42,14 +42,14 @@ class FWConfigurationManager void writeToFile(const std::string&) const; void readFromFile(const std::string&) const; - void guessAndReadFromFile(FWJobMetadataManager*) const; + std::string guessAndReadFromFile(FWJobMetadataManager*) const; // ---------- static member functions -------------------- // ---------- member functions --------------------------- ///does not take ownership void add(const std::string& iName, FWConfigurable*); - void setIgnore() { m_ignore = false; } + void setIgnore() { m_ignore = true; } bool getIgnore() const { return m_ignore; } private: diff --git a/Fireworks/Core/interface/FWFileEntry.h b/Fireworks/Core/interface/FWFileEntry.h index 31b0f1b562dfe..0c92952d661dc 100644 --- a/Fireworks/Core/interface/FWFileEntry.h +++ b/Fireworks/Core/interface/FWFileEntry.h @@ -1,6 +1,6 @@ // -*- C++ -*- #ifndef Fireworks_Core_FWFileEntry_h -#define Fireworks_Core_FWFileEntryr_h +#define Fireworks_Core_FWFileEntry_h // // Package: Core // Class : FWFileEntry diff --git a/Fireworks/Core/interface/FWGUIEventFilter.h b/Fireworks/Core/interface/FWGUIEventFilter.h index 1a7dc4a9b8c39..a46bf5a74da26 100644 --- a/Fireworks/Core/interface/FWGUIEventFilter.h +++ b/Fireworks/Core/interface/FWGUIEventFilter.h @@ -1,3 +1,7 @@ + +#ifndef Fireworks_Core_GUIEventFilter_h +#define Fireworks_Core_GUIEventFilter_h + #include #include "TGFrame.h" @@ -79,3 +83,4 @@ class FWGUIEventFilter: public TGMainFrame CmsShowNavigator* m_navigator; }; +#endif diff --git a/Fireworks/Core/interface/FWGUIManager.h b/Fireworks/Core/interface/FWGUIManager.h index 83c3b05ef49fe..476c6d681120a 100644 --- a/Fireworks/Core/interface/FWGUIManager.h +++ b/Fireworks/Core/interface/FWGUIManager.h @@ -205,7 +205,9 @@ class FWGUIManager : public FWConfigurable sigc::signal filterButtonClicked_; sigc::signal showEventFilterGUI_; sigc::signal writeToConfigurationFile_; + sigc::signal writePartialToConfigurationFile_; sigc::signal loadFromConfigurationFile_; + sigc::signal loadPartialFromConfigurationFile_; sigc::signal changedEventId_; sigc::signal goingToQuit_; sigc::signal writeToPresentConfigurationFile_; @@ -224,7 +226,10 @@ class FWGUIManager : public FWConfigurable bool promptForConfigurationFile(std::string &result, enum EFileDialogMode mode); void promptForSaveConfigurationFile(); + void promptForPartialSaveConfigurationFile(); void promptForLoadConfigurationFile(); + void promptForPartialLoadConfigurationFile(); + void savePartialToConfigurationFile(); void delaySliderChanged(Int_t); diff --git a/Fireworks/Core/interface/FWHandle.h b/Fireworks/Core/interface/FWHandle.h deleted file mode 100644 index bfbfa880a6b48..0000000000000 --- a/Fireworks/Core/interface/FWHandle.h +++ /dev/null @@ -1,72 +0,0 @@ -#ifndef Fireworks_Core_FWHandle_h -#define Fireworks_Core_FWHandle_h -// -*- C++ -*- -// -// Package: Core -// Class : FWHandle -// -/**\class FWHandle FWHandle.h Fireworks/Core/interface/FWHandle.h - - Description: Used to get a particular data item from a FWEventItem - - Usage: - - - */ -// -// Original Author: Chris Jones -// Created: Thu Jan 3 19:23:45 EST 2008 -// - -// system include files -#if !defined(__CINT__) && !defined(__MAKECINT__) -//CINT can't handle parsing these files -#include "DataFormats/Common/interface/Wrapper.h" -#include "Fireworks/Core/interface/FWEventItem.h" -#endif - -// user include files - -// forward declarations - -class FWHandle -{ - -public: - FWHandle() : data(0) { - } - //virtual ~FWHandle(); - - // ---------- const member functions --------------------- - const T* get() const { - return data_; - } - - const T* operator->() const { - return data_; - } - - const T& operator*() const { - return *data_; - } - // ---------- static member functions -------------------- - - // ---------- member functions --------------------------- - void getFrom(const FWEventItem& iItem) { - data_ = reinterpet_cast( - iItem.data(edm::Wrapper::productTypeInfo()) - ); - } - -private: - //FWHandle(const FWHandle&); // stop default - - //const FWHandle& operator=(const FWHandle&); // stop default - - // ---------- member data -------------------------------- - const T* data_; - -}; - - -#endif diff --git a/Fireworks/Core/interface/FWISpyView.h b/Fireworks/Core/interface/FWISpyView.h index e237febd345dd..15ab0681bbc58 100644 --- a/Fireworks/Core/interface/FWISpyView.h +++ b/Fireworks/Core/interface/FWISpyView.h @@ -24,7 +24,6 @@ #include "Fireworks/Core/interface/FW3DViewBase.h" // forward declarations -class TEveBoxSet; class FWISpyView : public FW3DViewBase { @@ -34,7 +33,6 @@ class FWISpyView : public FW3DViewBase virtual void setContext(const fireworks::Context& x); virtual void populateController(ViewerParameterGUI&) const; - void showEcalBarrel(bool); // ---------- const member functions --------------------- // ---------- static member functions -------------------- @@ -46,10 +44,7 @@ class FWISpyView : public FW3DViewBase const FWISpyView& operator=(const FWISpyView&); // stop default - // ---------- member data -------------------------------- - TEveBoxSet* m_ecalBarrel; - FWBoolParameter m_showEcalBarrel; + // ---------- member data --------------------------------}; }; - #endif diff --git a/Fireworks/Core/interface/FWPartialConfig.h b/Fireworks/Core/interface/FWPartialConfig.h new file mode 100644 index 0000000000000..31236e2969a9d --- /dev/null +++ b/Fireworks/Core/interface/FWPartialConfig.h @@ -0,0 +1,61 @@ +#ifndef Fireworks_Core_FWPartialConfig +#define Fireworks_Core_FWPartialConfig +#include +#include +#include "Fireworks/Core/interface/FWConfiguration.h" + +class TGCheckButton; +class FWConfigurationManager; +class FWEventItemsManager; + +class FWPartialConfigGUI : public TGTransientFrame +{ + public: + FWPartialConfigGUI(const char* path, FWConfigurationManager*); + ~FWPartialConfigGUI() {} + void Cancel(); + + protected: + std::vector m_entries; + FWConfiguration m_origConfig; + FWConfigurationManager* m_cfgMng; + + ClassDef(FWPartialConfigGUI, 0); +}; + +//--------------------------------------------------------------------- + +class FWPartialConfigLoadGUI : public FWPartialConfigGUI +{ + public: + FWPartialConfigLoadGUI( const char* path, FWConfigurationManager* ,FWEventItemsManager*); + ~FWPartialConfigLoadGUI(); + + void Load(); + + private: + FWEventItemsManager* m_eiMng; + const char* m_oldConfigName; + ClassDef(FWPartialConfigLoadGUI, 0); +}; + + +//--------------------------------------------------------------------- + +class FWPartialConfigSaveGUI : public FWPartialConfigGUI +{ + public: + FWPartialConfigSaveGUI( const char* path_out,const char* path_in, FWConfigurationManager* ); + ~FWPartialConfigSaveGUI() {} + + void Write(); + + private: + std::string m_outFileName; + std::string m_currFileName; + + ClassDef(FWPartialConfigSaveGUI, 0); +}; + + +#endif diff --git a/Fireworks/Core/interface/FWXMLConfigParser.h b/Fireworks/Core/interface/FWXMLConfigParser.h new file mode 100644 index 0000000000000..fa1d322e9c3b2 --- /dev/null +++ b/Fireworks/Core/interface/FWXMLConfigParser.h @@ -0,0 +1,193 @@ +#ifndef Fireworks_Core_FWXMLConfigParser +#define Fireworks_Core_FWXMLConfigParser +#include +#include +#include "Fireworks/Core/src/SimpleSAXParser.h" + +#include "Fireworks/Core/interface/FWConfiguration.h" + + +/** Helper class which reads the XML configuration and constructs the + FWConfiguration classes. + + State machine for the parser can be found by cut and pasting the following + in graphviz. + + digraph { + IN_BEGIN_DOCUMENT->IN_PUSHED_CONFIG [label = "beginElement(config)"] + + IN_PUSHED_CONFIG->IN_PUSHED_CONFIG [label = "beginElement(config)"] + IN_PUSHED_CONFIG->IN_POPPED_CONFIG [label = "endElement(config)"] + IN_PUSHED_CONFIG->IN_BEGIN_STRING [label = "beginElement(string)"] + + IN_POPPED_CONFIG->IN_PUSHED_CONFIG [label = "beginElement(config)"] + IN_POPPED_CONFIG->IN_POPPED_CONFIG [label = "endElement(config)"] + IN_POPPED_CONFIG->DONE [label = "top level config popped"] + + IN_BEGIN_STRING->IN_STORED_STRING [label = "data()"]; + IN_BEGIN_STRING->IN_PUSHED_CONFIG [label = "endElement(string)"] + + IN_STORED_STRING->IN_PUSHED_CONFIG [label = "endElement(string)"] + } +*/ +class FWXMLConfigParser : public SimpleSAXParser +{ + enum STATES { + IN_BEGIN_DOCUMENT, + IN_PUSHED_CONFIG, + IN_POPPED_CONFIG, + IN_BEGIN_STRING, + IN_STORED_STRING + }; + +public: + FWXMLConfigParser(std::istream &f) + : SimpleSAXParser(f), + m_state(IN_BEGIN_DOCUMENT), + m_first(0) + {} + + /** Pushes the configuration on stack eventually */ + void pushConfig(Attributes &attributes) + { + std::string name; + int version = 0; + for (size_t i = 0, e = attributes.size(); i != e; ++i) + { + Attribute &attr = attributes[i]; + if (attr.key == "name") + name = attr.value; + else if (attr.key == "version") + { + char *endptr; + version = strtol(attr.value.c_str(), &endptr, 10); + if (endptr == attr.value.c_str()) + throw ParserError("Version must be an integer."); + } + else + throw ParserError("Unexpected attribute " + attr.key); + } + m_configs.push_back(std::make_pair(name, new FWConfiguration(version))); + } + + + /** Executes any transaction in the state machine which happens when the + xml parser finds an new element. + */ + virtual void startElement(const std::string &tag, Attributes &attributes) override + { + debug_config_state_machine("start", tag, m_state); + if (m_state == IN_BEGIN_DOCUMENT) + { + if (tag != "config") + throw ParserError("Expecting toplevel tag"); + pushConfig(attributes); + m_first.reset(m_configs.back().second); + m_state = IN_PUSHED_CONFIG; + } + else if (m_state == IN_PUSHED_CONFIG) + { + if (tag == "config") + pushConfig(attributes); + else if (tag == "string") + m_state = IN_BEGIN_STRING; + else + throw ParserError("Unexpected element " + tag); + } + else if (m_state == IN_POPPED_CONFIG) + { + if (tag != "config") + throw ParserError("Unexpected element " + tag); + pushConfig(attributes); + m_state = IN_PUSHED_CONFIG; + } + else + throw ParserError("Wrong opening tag found " + tag); + } + + /** Executes any transaction in the state machine which happens when the + xml parser closes an element. + + Notice that we need to do addKeyValue on endElement (and carry around + the FWConfigutation name) because of the "copy by value" + policy of addKeyValue addition which would add empty + FWConfiguration objects if done on startElement. + */ + virtual void endElement(const std::string &tag) override + { + debug_config_state_machine("end", tag, m_state); + if (m_state == IN_PUSHED_CONFIG || m_state == IN_POPPED_CONFIG) + { + if (tag != "config") + throw ParserError("Wrong closing tag found " + tag); + + FWConfiguration *current = m_configs.back().second; + std::string key = m_configs.back().first; + m_configs.pop_back(); + if (!m_configs.empty()) + m_configs.back().second->addKeyValue(key, *current); + m_state = IN_POPPED_CONFIG; + } + else if (m_state == IN_BEGIN_STRING && tag == "string") + { + m_configs.back().second->addValue(""); + m_state = IN_PUSHED_CONFIG; + } + else if (m_state == IN_STORED_STRING && tag == "string") + m_state = IN_PUSHED_CONFIG; + else + throw ParserError("Wrong closing tag found " + tag); + } + + /** Executes any transaction in the state machine which happens when + the xml parser finds some data (i.e. text) between tags + This is mainly used to handle element contents + but also whitespace between tags. + */ + virtual void data(const std::string &data) override + { + debug_config_state_machine("data", data, m_state); + // We ignore whitespace but complain about any text which is not + // in the tag. + if (m_state == IN_BEGIN_STRING) + { + m_configs.back().second->addValue(data); + m_state = IN_STORED_STRING; + } + else if (strspn(data.c_str(), " \t\n") != data.size()) + throw ParserError("Unexpected text " + data); + } + + /** The parsed configuration. Notice that the parser owns it and destroys + it when destroyed. + */ + FWConfiguration *config(void) + { + return m_first.get(); + } + + +void +debug_config_state_machine(const char *where, const std::string &tag, int state) +{ +#ifdef FW_CONFIG_PARSER_DEBUG + static char *debug_states[] = { + "IN_BEGIN_DOCUMENT", + "IN_PUSHED_CONFIG", + "IN_POPPED_CONFIG", + "IN_BEGIN_STRING", + "IN_STORED_STRING" + }; + + std::cerr << " " << where << " tag/data " << tag << "in state " << debug_states[state] << std::endl; +#endif +} + +private: + std::vector > m_configs; + enum STATES m_state; + std::auto_ptr m_first; + // unsigned int m_currentConfigVersion; + std::string m_currentConfigName; +}; +#endif diff --git a/Fireworks/Core/scripts/cmsShow b/Fireworks/Core/scripts/cmsShow index 6df31852147dd..afadf43495d66 100755 --- a/Fireworks/Core/scripts/cmsShow +++ b/Fireworks/Core/scripts/cmsShow @@ -8,8 +8,6 @@ checkOS() osname=`uname -s` if [ f$osname = f"Darwin" ]; then - - gdbCmd="lldb --" arch=`sysctl hw | grep 64bit | awk '{print $2;}'` if [ $arch -eq 0 ]; then echo "###################################" @@ -113,6 +111,15 @@ setupEnv() fi } +printEnv() +{ + # Needed only for debugging of a standalone version + for i in CMSSW_BASE CMSSW_SEARCH_PATH CMSSW_DATA_PATH LD_LIBRARY_PATH DYLD_FALLBACK_LIBRARY_PATH PATH SHELLDIR; do + echo export $i=`eval echo \\$$i` + done + exit; +} + parseOptions() { # We store in originalOptions all the options that need to be passed to the @@ -182,8 +189,11 @@ fi # Developers cases -- run from gdb or valgrind. if [ "X$debuginteractiveflag" = Xon ] ; then - gdbCmd="gdb --args " "$SHELLDIR/cmsShow.exe" $originalOptions - if-shell 'test "$(uname)" = "Darwin"' gdbCmd="lldb -- " + if [[ `uname` == 'Linux' ]]; then + gdbCmd="gdb --args $SHELLDIR/cmsShow.exe $originalOptions" + else + gdbCmd="lldb $SHELLDIR/cmsShow.exe $originalOptions" + fi exec $gdbCmd elif [ "X$valgrindflag" = Xon ] ; then # MT: This should supposedly get rid of ROOT dicitonary reports etc. but it diff --git a/Fireworks/Core/src/ActionsList.cc b/Fireworks/Core/src/ActionsList.cc index 6b27c79bed68c..c581098487160 100644 --- a/Fireworks/Core/src/ActionsList.cc +++ b/Fireworks/Core/src/ActionsList.cc @@ -16,6 +16,12 @@ const std::string cmsshow::sSearchFiles = "Open Remote Data File"; const std::string cmsshow::sLoadConfig = "Load Configuration"; const std::string cmsshow::sSaveConfig = "Save Configuration"; const std::string cmsshow::sSaveConfigAs = "Save Configuration As"; + +const std::string cmsshow::sLoadPartialConfig = "Load Partial Configuration"; +const std::string cmsshow::sSavePartialConfig = "Save Partial Configuration"; +const std::string cmsshow::sSavePartialConfigAs = "Save Partial Configuration As"; + + const std::string cmsshow::sExportImage = "Export Main View Image"; const std::string cmsshow::sExportAllImages = "Export Images of All Views"; diff --git a/Fireworks/Core/src/CSGAction.cc b/Fireworks/Core/src/CSGAction.cc index 9469da086d73a..aa54db16d43d5 100644 --- a/Fireworks/Core/src/CSGAction.cc +++ b/Fireworks/Core/src/CSGAction.cc @@ -378,6 +378,10 @@ CSGAction::keycodeToString(Int_t keycode) { rep = TString("->"); return rep; } + if (keycode == gVirtualX->KeysymToKeycode(kKey_Space)) { + rep = TString("space"); + return rep; + } rep = TString(""); return rep; } diff --git a/Fireworks/Core/src/CmsShowMain.cc b/Fireworks/Core/src/CmsShowMain.cc index 33136e08ee90c..e48095d81fac0 100644 --- a/Fireworks/Core/src/CmsShowMain.cc +++ b/Fireworks/Core/src/CmsShowMain.cc @@ -28,6 +28,7 @@ #include "TEveManager.h" #include "TFile.h" #include "TGClient.h" +#include #include "Fireworks/Core/src/CmsShowMain.h" @@ -319,6 +320,20 @@ CmsShowMain::CmsShowMain(int argc, char *argv[]) f=boost::bind(&CmsShowMainBase::setupViewManagers,this); startupTasks()->addTask(f); + + + if(vm.count(kLiveCommandOpt)) + { + f = boost::bind(&CmsShowMain::setLiveMode, this); + startupTasks()->addTask(f); + } + + if(vm.count(kFieldCommandOpt)) + { + m_context->getField()->setSource(FWMagField::kUser); + m_context->getField()->setUserField(vm[kFieldCommandOpt].as()); + } + if ( m_inputFiles.empty()) { f=boost::bind(&CmsShowMainBase::setupConfiguration,this); startupTasks()->addTask(f); @@ -348,17 +363,6 @@ CmsShowMain::CmsShowMain(int argc, char *argv[]) startupTasks()->addTask(f); } - if(vm.count(kLiveCommandOpt)) - { - f = boost::bind(&CmsShowMain::setLiveMode, this); - startupTasks()->addTask(f); - } - - if(vm.count(kFieldCommandOpt)) - { - m_context->getField()->setSource(FWMagField::kUser); - m_context->getField()->setUserField(vm[kFieldCommandOpt].as()); - } if(vm.count(kAutoSaveAllViews)) { std::string type = "png"; if(vm.count(kAutoSaveType)) { @@ -784,13 +788,23 @@ CmsShowMain::notified(TSocket* iSocket) } } +void +CmsShowMain::checkKeyBindingsOnPLayEventsStateChanged() +{ + if (m_live) { + Int_t keycode = gVirtualX->KeysymToKeycode((int)kKey_Space); + Window_t id = FWGUIManager::getGUIManager()->getMainFrame()->GetId(); + gVirtualX->GrabKey(id, keycode, 0, isPlaying()); + } +} + void CmsShowMain::stopPlaying() { stopAutoLoadTimer(); if (m_live) m_navigator->resetNewFileOnNextEvent(); - setIsPlaying(false); + CmsShowMainBase::stopPlaying(); guiManager()->enableActions(); checkPosition(); } diff --git a/Fireworks/Core/src/CmsShowMain.h b/Fireworks/Core/src/CmsShowMain.h index bf909b4ba31a0..7f2b763b111de 100644 --- a/Fireworks/Core/src/CmsShowMain.h +++ b/Fireworks/Core/src/CmsShowMain.h @@ -97,6 +97,7 @@ class CmsShowMain : public CmsShowMainBase virtual void autoLoadNewEvent(); virtual void checkPosition(); virtual void stopPlaying(); + virtual void checkKeyBindingsOnPLayEventsStateChanged(); void reachedEnd(); void reachedBeginning(); diff --git a/Fireworks/Core/src/CmsShowMainBase.cc b/Fireworks/Core/src/CmsShowMainBase.cc index e5f03bf18a51a..451a0ff84de5f 100644 --- a/Fireworks/Core/src/CmsShowMainBase.cc +++ b/Fireworks/Core/src/CmsShowMainBase.cc @@ -44,7 +44,7 @@ #include "Fireworks/Core/interface/CmsShowCommon.h" #include "Fireworks/Core/interface/fwLog.h" #include "Fireworks/Core/interface/fwPaths.h" - +#include "Fireworks/Core/interface/FWPartialConfig.h" CmsShowMainBase::CmsShowMainBase() : @@ -247,6 +247,12 @@ CmsShowMainBase::setup(FWNavigatorBase *navigator, m_guiManager->loadFromConfigurationFile_.connect(boost::bind(&CmsShowMainBase::reloadConfiguration, this, _1)); + m_guiManager->loadPartialFromConfigurationFile_.connect(boost::bind(&CmsShowMainBase::partialLoadConfiguration, + this, _1)); + + m_guiManager->writePartialToConfigurationFile_.connect(boost::bind(&CmsShowMainBase::partialWriteToConfigFile, + this,_1)); + std::string macPath(gSystem->Getenv("CMSSW_BASE")); macPath += "/src/Fireworks/Core/macros"; const char* base = gSystem->Getenv("CMSSW_RELEASE_BASE"); @@ -274,6 +280,15 @@ CmsShowMainBase::writeToCurrentConfigFile() m_configurationManager->writeToFile(m_configFileName); } +void +CmsShowMainBase::partialWriteToConfigFile(const std::string &name) +{ + std::string p = (name == "current") ? m_configFileName.c_str() : name.c_str(); + new FWPartialConfigSaveGUI( p.c_str() , m_configFileName.c_str(), m_configurationManager.get()); + +} + + void CmsShowMainBase::reloadConfiguration(const std::string &config) { @@ -321,6 +336,13 @@ CmsShowMainBase::reloadConfiguration(const std::string &config) m_guiManager->updateStatus(""); } + +void +CmsShowMainBase::partialLoadConfiguration(const std::string &name) +{ + new FWPartialConfigLoadGUI(name.c_str(), m_configurationManager.get(), m_eiManager.get()); +} + void CmsShowMainBase::setupAutoLoad(float x) { @@ -352,14 +374,10 @@ void CmsShowMainBase::setupConfiguration() { m_guiManager->updateStatus("Setting up configuration..."); + if(m_configurationManager->getIgnore()) { - fwLog(fwlog::kInfo) << "No configuration is loaded." << std::endl; - m_guiManager->getMainFrame()->MapSubwindows(); - m_guiManager->getMainFrame()->Layout(); - m_guiManager->getMainFrame()->MapRaised(); + fwLog(fwlog::kInfo) << "no configuration is loaded." << std::endl; m_configFileName = "newconfig.fwc"; - m_guiManager->createView("Rho Phi"); - m_guiManager->createView("Rho Z"); } else { try @@ -367,7 +385,7 @@ CmsShowMainBase::setupConfiguration() gEve->DisableRedraw(); if (m_configFileName.empty()) { - m_configurationManager->guessAndReadFromFile(m_metadataManagerPtr); + m_configFileName = m_configurationManager->guessAndReadFromFile(m_metadataManagerPtr); } else { @@ -395,16 +413,19 @@ CmsShowMainBase::setupConfiguration() << std::endl; exit(1); } + + + } + + // case configuration does not contain GUI Manager entry + if ( !m_guiManager->getMainFrame()->IsMapped()) { + + m_guiManager->getMainFrame()->MapSubwindows(); + m_guiManager->getMainFrame()->Layout(); + m_guiManager->getMainFrame()->MapRaised(); + m_guiManager->createView("Rho Phi"); + m_guiManager->createView("Rho Z"); } - /* - if(not m_configFileName.empty() ) { - //when the program quits we will want to save the configuration automatically - m_guiManager->goingToQuit_.connect( - boost::bind(&FWConfigurationManager::writeToFile, - m_configurationManager.get(), - m_configFileName)); - } - */ } @@ -457,12 +478,21 @@ CmsShowMainBase::registerPhysicsObject(const FWPhysicsObjectDesc&iItem) m_eiManager->add(iItem); } + +void +CmsShowMainBase::stopPlaying() +{ + m_isPlaying = false; + checkKeyBindingsOnPLayEventsStateChanged(); +} + void CmsShowMainBase::playForward() { m_forward = true; m_isPlaying = true; guiManager()->enableActions(kFALSE); + checkKeyBindingsOnPLayEventsStateChanged(); startAutoLoadTimer(); } @@ -473,6 +503,7 @@ CmsShowMainBase::playBackward() m_isPlaying = true; guiManager()->enableActions(kFALSE); startAutoLoadTimer(); + checkKeyBindingsOnPLayEventsStateChanged(); } void diff --git a/Fireworks/Core/src/CmsShowMainFrame.cc b/Fireworks/Core/src/CmsShowMainFrame.cc index 245a81fe90ff2..b7e9a22194d39 100644 --- a/Fireworks/Core/src/CmsShowMainFrame.cc +++ b/Fireworks/Core/src/CmsShowMainFrame.cc @@ -91,6 +91,13 @@ CmsShowMainFrame::CmsShowMainFrame(const TGWindow *p,UInt_t w,UInt_t h,FWGUIMana CSGAction *loadConfig = new CSGAction(this, cmsshow::sLoadConfig.c_str()); CSGAction *saveConfig = new CSGAction(this, cmsshow::sSaveConfig.c_str()); CSGAction *saveConfigAs = new CSGAction(this, cmsshow::sSaveConfigAs.c_str()); + + + CSGAction *loadPartialConfig = new CSGAction(this, cmsshow::sLoadPartialConfig.c_str()); + CSGAction *savePartialConfig = new CSGAction(this, cmsshow::sSavePartialConfig.c_str()); + CSGAction *savePartialConfigAs = new CSGAction(this, cmsshow::sSavePartialConfigAs.c_str()); + + CSGAction *exportImage = new CSGAction(this, cmsshow::sExportImage.c_str()); CSGAction *exportImages = new CSGAction(this, cmsshow::sExportAllImages.c_str()); CSGAction *quit = new CSGAction(this, cmsshow::sQuit.c_str()); @@ -155,9 +162,19 @@ CmsShowMainFrame::CmsShowMainFrame(const TGWindow *p,UInt_t w,UInt_t h,FWGUIMana appendData->createMenuEntry(fileMenu); searchFiles->createMenuEntry(fileMenu); //searchFiles->disable(); + + fileMenu->AddSeparator(); loadConfig->createMenuEntry(fileMenu); saveConfig->createMenuEntry(fileMenu); saveConfigAs->createMenuEntry(fileMenu); + + + TGPopupMenu* partialSaveMenu = new TGPopupMenu(gClient->GetRoot()); + fileMenu->AddPopup("Advanced Configuration", partialSaveMenu); + + loadPartialConfig->createMenuEntry(partialSaveMenu); + savePartialConfig->createMenuEntry(partialSaveMenu); + savePartialConfigAs->createMenuEntry(partialSaveMenu); fileMenu->AddSeparator(); exportImage->createMenuEntry(fileMenu); @@ -171,9 +188,14 @@ CmsShowMainFrame::CmsShowMainFrame(const TGWindow *p,UInt_t w,UInt_t h,FWGUIMana saveConfig->createShortcut(kKey_S, "CTRL", GetId()); saveConfigAs->createShortcut(kKey_S, "CTRL+SHIFT", GetId()); exportImage->createShortcut(kKey_P, "CTRL", GetId()); - exportImages->createShortcut(kKey_P, "CTRL+SHIFT", GetId()); + // comment out the followinf one, seems to get double open file dialog events on OSX + // exportImages->createShortcut(kKey_P, "CTRL+SHIFT", GetId()); quit->createShortcut(kKey_Q, "CTRL", GetId()); + loadPartialConfig->createShortcut(kKey_W, "CTRL", GetId()); + savePartialConfig->createShortcut(kKey_Y, "CTRL", GetId()); + savePartialConfigAs->createShortcut(kKey_Y, "CTRL+SHIFT", GetId()); + TGPopupMenu *editMenu = new TGPopupMenu(gClient->GetRoot()); menuBar->AddPopup("Edit", editMenu, new TGLayoutHints(kLHintsTop | kLHintsLeft, 0, 4, 2, 0)); @@ -664,6 +686,7 @@ void CmsShowMainFrame::HandleMenu(Int_t id) { } Bool_t CmsShowMainFrame::HandleKey(Event_t *event) { + if (event->fType == kGKeyPress) { const std::vector& alist = getListOfActions(); std::vector::const_iterator it_act; @@ -682,6 +705,15 @@ Bool_t CmsShowMainFrame::HandleKey(Event_t *event) { return false; } } + + // special case is --live option where Space key is grabbed + static UInt_t spacecode = gVirtualX->KeysymToKeycode((int)kKey_Space); + if (event->fCode == spacecode && event->fState == 0 ) { + if (playEventsAction()->isRunning() ) + playEventsAction()->switchMode(); + else if (playEventsBackwardsAction()->isRunning() ) + playEventsBackwardsAction()->switchMode(); + } } return kFALSE; } diff --git a/Fireworks/Core/src/FW3DViewBase.cc b/Fireworks/Core/src/FW3DViewBase.cc index 0a24dd2eb797b..7ab8061d04c97 100644 --- a/Fireworks/Core/src/FW3DViewBase.cc +++ b/Fireworks/Core/src/FW3DViewBase.cc @@ -21,8 +21,10 @@ #include "TEveManager.h" #include "TEveElement.h" #include "TEveLine.h" +#include "TEveBoxSet.h" #include "TEveScene.h" #include "TGLLogicalShape.h" +#include "TEveCalo.h" #include "Fireworks/Core/interface/FW3DViewBase.h" #include "Fireworks/Core/interface/FW3DViewGeometry.h" @@ -31,6 +33,7 @@ #include "Fireworks/Core/interface/FWViewEnergyScale.h" #include "Fireworks/Core/interface/CmsShowViewPopup.h" #include "Fireworks/Core/src/FW3DViewDistanceMeasureTool.h" +#include "Fireworks/Core/interface/FWGeometry.h" namespace { class TGLClipsiLogical : public TGLLogicalShape @@ -117,6 +120,8 @@ FW3DViewBase::FW3DViewBase(TEveWindowSlot* iParent, FWViewType::EType typeId, un m_showPixelEndcap(this, "Show Pixel Endcap", false), m_showTrackerBarrel(this, "Show Tracker Barrel", false ), m_showTrackerEndcap(this, "Show Tracker Endcap", false), + m_ecalBarrel(0), + m_showEcalBarrel(this, "Show Ecal Barrel", typeId == FWViewType::kISpy ? true : false), m_rnrStyle(this, "Render Style", 0l, 0l, 2l), m_clipParam(this, "View dependent Clip", false), m_selectable(this, "Enable Tooltips", false), @@ -149,6 +154,13 @@ FW3DViewBase::FW3DViewBase(TEveWindowSlot* iParent, FWViewType::EType typeId, un m_cameraType.addEntry(TGLViewer::kCameraOrthoXnOZ,"OrthoXnOZ"); m_cameraType.addEntry(TGLViewer::kCameraOrthoZnOY,"OrthoZnOY" ); m_cameraType.changed_.connect(boost::bind(&FW3DViewBase::setCameraType,this, _1)); + + + m_ecalBarrel = new TEveBoxSet("ecalBarrel"); + m_ecalBarrel->UseSingleColor(); + m_ecalBarrel->SetMainColor(kAzure+10); + m_ecalBarrel->SetMainTransparency(98); + geoScene()->AddElement(m_ecalBarrel); } FW3DViewBase::~FW3DViewBase() @@ -168,7 +180,8 @@ void FW3DViewBase::setContext(const fireworks::Context& context) m_showTrackerBarrel.changed_.connect(boost::bind(&FW3DViewGeometry::showTrackerBarrel,m_geometry,_1)); m_showTrackerEndcap.changed_.connect(boost::bind(&FW3DViewGeometry::showTrackerEndcap,m_geometry,_1)); m_showMuonEndcap.changed_.connect(boost::bind(&FW3DViewGeometry::showMuonEndcap,m_geometry,_1)); - + m_showEcalBarrel.changed_.connect(boost::bind(&FW3DViewBase::showEcalBarrel, this,_1)); + // don't clip event scene -- ideally, would have TGLClipNoClip in root TGLClipPlane* c=new TGLClipPlane(); c->Setup(TGLVector3(1e10,0,0), TGLVector3(-1,0,0)); @@ -182,6 +195,7 @@ void FW3DViewBase::setContext(const fireworks::Context& context) m_DMTline->SetPoint(0, 0, 0, 0); m_DMTline->SetPoint(1, 0, 0, 0); eventScene()->AddElement(m_DMTline); + showEcalBarrel(m_showEcalBarrel.value()); } void FW3DViewBase::showMuonBarrel(long x) @@ -294,6 +308,7 @@ FW3DViewBase::populateController(ViewerParameterGUI& gui) const addParam(&m_showTrackerEndcap). addParam(&m_showPixelBarrel). addParam(&m_showPixelEndcap). + addParam(&m_showEcalBarrel). separator(). addParam(&m_rnrStyle). addParam(&m_clipParam). @@ -311,3 +326,31 @@ FW3DViewBase::populateController(ViewerParameterGUI& gui) const + +void FW3DViewBase::showEcalBarrel(bool x) { + if (x && m_ecalBarrel->GetPlex()->Size() == 0) { + const FWGeometry* geom = context().getGeom(); + std::vector ids = geom->getMatchedIds(FWGeometry::Detector::Ecal, FWGeometry::SubDetector::PixelBarrel); + m_ecalBarrel->Reset(TEveBoxSet::kBT_FreeBox, true, ids.size() ); + for (std::vector::iterator it = ids.begin(); it != ids.end(); ++it) { + const float* cor = context().getGeom()->getCorners(*it); + m_ecalBarrel->AddBox(cor); + } + m_ecalBarrel->RefitPlex(); + } + + if (m_ecalBarrel->GetRnrSelf() != x) { + m_ecalBarrel->SetRnrSelf(x); + gEve->Redraw3D(); + } + + // disable enable grid in 3DView + if (typeId() == FWViewType::k3D) { + TEveElement* calo = eventScene()->FindChild("calo barrel"); + if (calo) { + TEveCalo3D* c3d = dynamic_cast(calo); + c3d->SetRnrFrame(!x, !x); + c3d->ElementChanged(); + } + } +} diff --git a/Fireworks/Core/src/FWConfiguration.cc b/Fireworks/Core/src/FWConfiguration.cc index 3bd8b81fca579..98ac21c03d3c4 100644 --- a/Fireworks/Core/src/FWConfiguration.cc +++ b/Fireworks/Core/src/FWConfiguration.cc @@ -211,7 +211,7 @@ attrEscape(std::string value) Streaming the top level configuration item will stream all its children. */ void -streamTo(std::ostream& oTo, const FWConfiguration& iConfig, const std::string &name) +FWConfiguration::streamTo(std::ostream& oTo, const FWConfiguration& iConfig, const std::string &name) { static int recursionLevel = -1; recursionLevel += 1; @@ -229,7 +229,7 @@ streamTo(std::ostream& oTo, const FWConfiguration& iConfig, const std::string &n for(FWConfiguration::KeyValues::const_iterator it = iConfig.keyValues()->begin(); it != iConfig.keyValues()->end(); ++it) { - streamTo(oTo, it->second, attrEscape(it->first)); + FWConfiguration::streamTo(oTo, it->second, attrEscape(it->first)); } } oTo << indentation << "" << std::endl; diff --git a/Fireworks/Core/src/FWConfigurationManager.cc b/Fireworks/Core/src/FWConfigurationManager.cc index c6677ce4a5631..b1e72c91f6306 100644 --- a/Fireworks/Core/src/FWConfigurationManager.cc +++ b/Fireworks/Core/src/FWConfigurationManager.cc @@ -27,7 +27,7 @@ #include "Fireworks/Core/src/SimpleSAXParser.h" #include "Fireworks/Core/interface/FWJobMetadataManager.h" #include "Fireworks/Core/interface/fwLog.h" - +#include "Fireworks/Core/interface/FWXMLConfigParser.h" // // constants, enums and typedefs @@ -122,7 +122,7 @@ FWConfigurationManager::writeToFile(const std::string& iName) const fwLog(fwlog::kInfo) << "Writing to file "<< iName.c_str() << "...\n"; fflush(stdout); - streamTo(file, top, "top"); + FWConfiguration::streamTo(file, top, "top"); } catch (std::runtime_error &e) { @@ -164,188 +164,6 @@ FWConfigurationManager::readFromOldFile(const std::string& iName) const setFrom( *config); } -void -debug_config_state_machine(const char *where, const std::string &tag, int state) -{ -#ifdef FW_CONFIG_PARSER_DEBUG - static char *debug_states[] = { - "IN_BEGIN_DOCUMENT", - "IN_PUSHED_CONFIG", - "IN_POPPED_CONFIG", - "IN_BEGIN_STRING", - "IN_STORED_STRING" - }; - - std::cerr << " " << where << " tag/data " << tag << "in state " << debug_states[state] << std::endl; -#endif -} - -/** Helper class which reads the XML configuration and constructs the - FWConfiguration classes. - - State machine for the parser can be found by cut and pasting the following - in graphviz. - - digraph { - IN_BEGIN_DOCUMENT->IN_PUSHED_CONFIG [label = "beginElement(config)"] - - IN_PUSHED_CONFIG->IN_PUSHED_CONFIG [label = "beginElement(config)"] - IN_PUSHED_CONFIG->IN_POPPED_CONFIG [label = "endElement(config)"] - IN_PUSHED_CONFIG->IN_BEGIN_STRING [label = "beginElement(string)"] - - IN_POPPED_CONFIG->IN_PUSHED_CONFIG [label = "beginElement(config)"] - IN_POPPED_CONFIG->IN_POPPED_CONFIG [label = "endElement(config)"] - IN_POPPED_CONFIG->DONE [label = "top level config popped"] - - IN_BEGIN_STRING->IN_STORED_STRING [label = "data()"]; - IN_BEGIN_STRING->IN_PUSHED_CONFIG [label = "endElement(string)"] - - IN_STORED_STRING->IN_PUSHED_CONFIG [label = "endElement(string)"] - } - */ -class FWXMLConfigParser : public SimpleSAXParser -{ - enum STATES { - IN_BEGIN_DOCUMENT, - IN_PUSHED_CONFIG, - IN_POPPED_CONFIG, - IN_BEGIN_STRING, - IN_STORED_STRING - }; - -public: - FWXMLConfigParser(std::istream &f) - : SimpleSAXParser(f), - m_state(IN_BEGIN_DOCUMENT), - m_first(0) - {} - - /** Pushes the configuration on stack eventually */ - void pushConfig(Attributes &attributes) - { - std::string name; - int version = 0; - for (size_t i = 0, e = attributes.size(); i != e; ++i) - { - Attribute &attr = attributes[i]; - if (attr.key == "name") - name = attr.value; - else if (attr.key == "version") - { - char *endptr; - version = strtol(attr.value.c_str(), &endptr, 10); - if (endptr == attr.value.c_str()) - throw ParserError("Version must be an integer."); - } - else - throw ParserError("Unexpected attribute " + attr.key); - } - m_configs.push_back(std::make_pair(name, new FWConfiguration(version))); - } - - - /** Executes any transaction in the state machine which happens when the - xml parser finds an new element. - */ - virtual void startElement(const std::string &tag, Attributes &attributes) override - { - debug_config_state_machine("start", tag, m_state); - if (m_state == IN_BEGIN_DOCUMENT) - { - if (tag != "config") - throw ParserError("Expecting toplevel tag"); - pushConfig(attributes); - m_first.reset(m_configs.back().second); - m_state = IN_PUSHED_CONFIG; - } - else if (m_state == IN_PUSHED_CONFIG) - { - if (tag == "config") - pushConfig(attributes); - else if (tag == "string") - m_state = IN_BEGIN_STRING; - else - throw ParserError("Unexpected element " + tag); - } - else if (m_state == IN_POPPED_CONFIG) - { - if (tag != "config") - throw ParserError("Unexpected element " + tag); - pushConfig(attributes); - m_state = IN_PUSHED_CONFIG; - } - else - throw ParserError("Wrong opening tag found " + tag); - } - - /** Executes any transaction in the state machine which happens when the - xml parser closes an element. - - Notice that we need to do addKeyValue on endElement (and carry around - the FWConfigutation name) because of the "copy by value" - policy of addKeyValue addition which would add empty - FWConfiguration objects if done on startElement. - */ - virtual void endElement(const std::string &tag) override - { - debug_config_state_machine("end", tag, m_state); - if (m_state == IN_PUSHED_CONFIG || m_state == IN_POPPED_CONFIG) - { - if (tag != "config") - throw ParserError("Wrong closing tag found " + tag); - - FWConfiguration *current = m_configs.back().second; - std::string key = m_configs.back().first; - m_configs.pop_back(); - if (!m_configs.empty()) - m_configs.back().second->addKeyValue(key, *current); - m_state = IN_POPPED_CONFIG; - } - else if (m_state == IN_BEGIN_STRING && tag == "string") - { - m_configs.back().second->addValue(""); - m_state = IN_PUSHED_CONFIG; - } - else if (m_state == IN_STORED_STRING && tag == "string") - m_state = IN_PUSHED_CONFIG; - else - throw ParserError("Wrong closing tag found " + tag); - } - - /** Executes any transaction in the state machine which happens when - the xml parser finds some data (i.e. text) between tags - This is mainly used to handle element contents - but also whitespace between tags. - */ - virtual void data(const std::string &data) override - { - debug_config_state_machine("data", data, m_state); - // We ignore whitespace but complain about any text which is not - // in the tag. - if (m_state == IN_BEGIN_STRING) - { - m_configs.back().second->addValue(data); - m_state = IN_STORED_STRING; - } - else if (strspn(data.c_str(), " \t\n") != data.size()) - throw ParserError("Unexpected text " + data); - } - - /** The parsed configuration. Notice that the parser owns it and destroys - it when destroyed. - */ - FWConfiguration *config(void) - { - return m_first.get(); - } - -private: - std::vector > m_configs; - enum STATES m_state; - std::auto_ptr m_first; - // unsigned int m_currentConfigVersion; - std::string m_currentConfigName; -}; /** Reads the configuration specified in @a iName and creates the internal representation in terms of FWConfigutation objects. @@ -373,7 +191,7 @@ FWConfigurationManager::readFromFile(const std::string& iName) const setFrom(*parser.config()); } -void +std::string FWConfigurationManager::guessAndReadFromFile( FWJobMetadataManager* dataMng) const { struct CMatch { @@ -432,6 +250,8 @@ FWConfigurationManager::guessAndReadFromFile( FWJobMetadataManager* dataMng) con std::sort(clist.begin(), clist.end()); fwLog(fwlog::kInfo) << "Loading configuration file " << clist.back().file << std::endl; setFrom(*(clist.back().cfg)); + + return clist.back().file; } // diff --git a/Fireworks/Core/src/FWGUIManager.cc b/Fireworks/Core/src/FWGUIManager.cc index 622aade384e53..8de537514281c 100644 --- a/Fireworks/Core/src/FWGUIManager.cc +++ b/Fireworks/Core/src/FWGUIManager.cc @@ -10,7 +10,7 @@ // Created: Mon Feb 11 11:06:40 EST 2008 -// + // system include files #include @@ -81,10 +81,10 @@ #include "Fireworks/Core/src/FWModelContextMenuHandler.h" #include "Fireworks/Core/interface/fwLog.h" - #include "FWCore/Common/interface/EventBase.h" + // constants, enums and typedefs // // @@ -95,6 +95,8 @@ FWGUIManager* FWGUIManager::m_guiManager = 0; // // constructors and destructor // + + FWGUIManager::FWGUIManager(fireworks::Context* ctx, const FWViewManagerManager* iVMMgr, FWNavigatorBase* navigator): @@ -167,8 +169,11 @@ FWGUIManager::FWGUIManager(fireworks::Context* ctx, getAction(cmsshow::sExportImage)->activated.connect(sigc::mem_fun(*this, &FWGUIManager::exportImageOfMainView)); getAction(cmsshow::sExportAllImages)->activated.connect(sigc::mem_fun(*this, &FWGUIManager::exportImagesOfAllViews)); getAction(cmsshow::sLoadConfig)->activated.connect(sigc::mem_fun(*this, &FWGUIManager::promptForLoadConfigurationFile)); + getAction(cmsshow::sLoadPartialConfig)->activated.connect(sigc::mem_fun(*this, &FWGUIManager::promptForPartialLoadConfigurationFile)); getAction(cmsshow::sSaveConfig)->activated.connect(writeToPresentConfigurationFile_); + getAction(cmsshow::sSavePartialConfig)->activated.connect(sigc::mem_fun(this, &FWGUIManager::savePartialToConfigurationFile)); getAction(cmsshow::sSaveConfigAs)->activated.connect(sigc::mem_fun(*this,&FWGUIManager::promptForSaveConfigurationFile)); + getAction(cmsshow::sSavePartialConfigAs)->activated.connect(sigc::mem_fun(*this,&FWGUIManager::promptForPartialSaveConfigurationFile)); getAction(cmsshow::sShowEventDisplayInsp)->activated.connect(boost::bind( &FWGUIManager::showEDIFrame,this,-1)); getAction(cmsshow::sShowMainViewCtl)->activated.connect(sigc::mem_fun(*m_guiManager, &FWGUIManager::showViewPopup)); getAction(cmsshow::sShowObjInsp)->activated.connect(sigc::mem_fun(*m_guiManager, &FWGUIManager::showModelPopup)); @@ -823,6 +828,20 @@ FWGUIManager::promptForLoadConfigurationFile() loadFromConfigurationFile_(name); } + +void +FWGUIManager::promptForPartialLoadConfigurationFile() +{ + std::string name; + if (!promptForConfigurationFile(name, kFDOpen)) + return; + + + loadPartialFromConfigurationFile_(name); + // +} + + /** Emits the signal which requests to save the current configuration in the file picked up in the dialog. */ @@ -832,9 +851,26 @@ FWGUIManager::promptForSaveConfigurationFile() std::string name; if (!promptForConfigurationFile(name, kFDSave)) return; + writeToConfigurationFile_(name); } +void +FWGUIManager::promptForPartialSaveConfigurationFile() +{ + std::string name; + if (!promptForConfigurationFile(name, kFDSave)) + return; + + writePartialToConfigurationFile_(name); +} + +void +FWGUIManager::savePartialToConfigurationFile() +{ + writePartialToConfigurationFile_("current"); +} + void FWGUIManager::exportImageOfMainView() { diff --git a/Fireworks/Core/src/FWISpyView.cc b/Fireworks/Core/src/FWISpyView.cc index a7483b6178c26..de046d40ca39f 100644 --- a/Fireworks/Core/src/FWISpyView.cc +++ b/Fireworks/Core/src/FWISpyView.cc @@ -17,7 +17,6 @@ #include "TGLViewer.h" #include "Fireworks/Core/interface/CmsShowViewPopup.h" #include "Fireworks/Core/interface/FWISpyView.h" -#include "Fireworks/Core/interface/FWGeometry.h" #include "Fireworks/Core/interface/Context.h" #include "TEveBoxSet.h" #include "TEveScene.h" @@ -36,15 +35,8 @@ // constructors and destructor // FWISpyView::FWISpyView(TEveWindowSlot* slot, FWViewType::EType typeId, unsigned int version): - FW3DViewBase(slot, typeId, version), - m_ecalBarrel(0), - m_showEcalBarrel(this, "Show Ecal Barrel", true ) + FW3DViewBase(slot, typeId, version) { - m_ecalBarrel = new TEveBoxSet("ecalBarrel"); - m_ecalBarrel->UseSingleColor(); - m_ecalBarrel->SetMainColor(kAzure+10); - m_ecalBarrel->SetMainTransparency(98); - geoScene()->AddElement(m_ecalBarrel); } @@ -61,36 +53,12 @@ FWISpyView::~FWISpyView() void FWISpyView::setContext(const fireworks::Context& x) { FW3DViewBase::setContext(x); - m_showEcalBarrel.changed_.connect(boost::bind(&FWISpyView::showEcalBarrel, this,_1)); - - showEcalBarrel(m_showEcalBarrel.value()); - } -void FWISpyView::showEcalBarrel(bool x) { - if (x && m_ecalBarrel->GetPlex()->Size() == 0) { - const FWGeometry* geom = context().getGeom(); - std::vector ids = geom->getMatchedIds(FWGeometry::Detector::Ecal, FWGeometry::SubDetector::PixelBarrel); - m_ecalBarrel->Reset(TEveBoxSet::kBT_FreeBox, true, ids.size() ); - for (std::vector::iterator it = ids.begin(); it != ids.end(); ++it) { - const float* cor = context().getGeom()->getCorners(*it); - m_ecalBarrel->AddBox(cor); - } - m_ecalBarrel->RefitPlex(); - } - - if (m_ecalBarrel->GetRnrSelf() != x) { - m_ecalBarrel->SetRnrSelf(x); - gEve->Redraw3D(); - } -} void FWISpyView::populateController(ViewerParameterGUI& gui) const { FW3DViewBase::populateController(gui); - - gui.requestTab("Detector").separator(). - addParam(&m_showEcalBarrel); } diff --git a/Fireworks/Core/src/FWPartialConfig.cc b/Fireworks/Core/src/FWPartialConfig.cc new file mode 100644 index 0000000000000..9120c5b7940de --- /dev/null +++ b/Fireworks/Core/src/FWPartialConfig.cc @@ -0,0 +1,238 @@ +#include +#include +#include "Fireworks/Core/interface/FWPartialConfig.h" +#include "TGButton.h" +#include "TEveManager.h" +#include "TGString.h" +#include "TGLabel.h" +#include "TSystem.h" +#include "TROOT.h" + +#include "Fireworks/Core/src/SimpleSAXParser.h" +#include "Fireworks/Core/interface/FWXMLConfigParser.h" +#include "Fireworks/Core/interface/FWEventItemsManager.h" +#include "Fireworks/Core/interface/FWGUIManager.h" +#include "Fireworks/Core/interface/CmsShowMainFrame.h" +#include "Fireworks/Core/interface/FWConfigurationManager.h" +#include "Fireworks/Core/interface/fwLog.h" + +namespace { +struct MyNameMap { + std::vector< std::pair > names = { { "GUI", "Windows" }, { "CommonPreferences", "Colors" }, { "EventNavigator" , "EventFilters" }, { "EventItems" , "Collections" } }; + + std::string realName(std::string btnName) + { + for (std::vector< std::pair >::iterator i = names.begin(); i!= names.end(); ++i) { + if (i->second == btnName) + return i->first; + } + return btnName; + } + + + std::string btnName(const std::string& rlName) + { + + for (std::vector< std::pair >::iterator i = names.begin(); i!= names.end(); ++i) { + if (i->first == rlName) + return i->second; + } + return rlName; + } +}; + + MyNameMap nmm; +} + +FWPartialConfigGUI::FWPartialConfigGUI( const char* path, FWConfigurationManager* iCfg): + TGTransientFrame(gClient->GetRoot(), FWGUIManager::getGUIManager()->getMainFrame(), 200, 140), m_cfgMng(iCfg) +{ + if (path) { + std::ifstream g(path); + FWXMLConfigParser parser(g); + parser.parse(); + parser.config()->swap(m_origConfig); + } + else { + FWConfiguration curr; + m_cfgMng->to(curr); + curr.swap(m_origConfig); + } + + TGVerticalFrame* vf = new TGVerticalFrame(this); + AddFrame(vf, new TGLayoutHints(kLHintsNormal, 2, 2, 4, 4)); + + // can do a cast to non-const since we own the configuration + FWConfiguration::KeyValues* kv = (FWConfiguration::KeyValues*)m_origConfig.keyValues(); + std::sort(kv->begin(), kv->end(), + [](const std::pair& lhs, const std::pair& rhs) -> bool { + return nmm.btnName(lhs.first) < nmm.btnName(rhs.first); } ); + + for(FWConfiguration::KeyValues::const_iterator it = m_origConfig.keyValues()->begin(); it != m_origConfig.keyValues()->end(); ++it) { + if ( it->second.keyValues()) { + std::string nb = nmm.btnName(it->first); + TGCheckButton* cb = new TGCheckButton(vf, nb.c_str()); + vf->AddFrame(cb); + + m_entries.push_back(cb); + } + } +} + +void FWPartialConfigGUI::Cancel() +{ + // AMT Is this eniugh. Should there be a destroy ? + UnmapWindow(); +} + +//--------------------------------------------------------------------- +//--------------------------------------------------------------------- +//--------------------------------------------------------------------- +//--------------------------------------------------------------------- + +FWPartialConfigLoadGUI::FWPartialConfigLoadGUI( const char* path, FWConfigurationManager* iCfg, FWEventItemsManager* iEiMng): + FWPartialConfigGUI(path, iCfg), m_eiMng(iEiMng) +{ + TGHorizontalFrame* hf = new TGHorizontalFrame(this); + AddFrame(hf, new TGLayoutHints( kLHintsRight| kLHintsBottom, 1, 1, 2, 4)); + TGTextButton* load = new TGTextButton(hf, " Load "); + load->Connect("Clicked()", "FWPartialConfigLoadGUI", this, "Load()"); + hf->AddFrame(load, new TGLayoutHints(kLHintsExpandX, 2, 2, 0, 0)); + TGTextButton* cancel = new TGTextButton(hf, " Cancel "); + cancel->Connect("Clicked()", "FWPartialConfigGUI", this, "Cancel()"); + hf->AddFrame(cancel, new TGLayoutHints(kLHintsExpandX, 2, 2, 0, 0)); + + SetWindowName("Load Config"); + MapSubwindows(); + Layout(); + MapWindow(); +} + +FWPartialConfigLoadGUI::~FWPartialConfigLoadGUI() +{ +} + +void FWPartialConfigLoadGUI::Load() +{ + bool resetViews = true; + bool resetEI = true; + + FWConfiguration::KeyValues* kv = (FWConfiguration::KeyValues*)m_origConfig.keyValues(); + + for (auto i = m_entries.begin(); i != m_entries.end(); i++) { + if (!((*i)->IsOn())) { + std::string key = nmm.realName((*i)->GetText()->GetString()); + if (key == "EventItems") resetEI = false; + if (key == "GUI") resetViews = false; + + for(FWConfiguration::KeyValues::iterator it = kv->begin(); it != kv->end(); ++it) + { + if ( key.compare(it->first) == 0) { + kv->erase(it); + break; + } + } + } + } + + if (resetEI) + m_eiMng->clearItems(); + + if (resetViews) + FWGUIManager::getGUIManager()->subviewDestroyAll(); + + gEve->DisableRedraw(); + m_cfgMng ->setFrom(m_origConfig); + gEve->EnableRedraw(); + + UnmapWindow(); +} + +//--------------------------------------------------------------------- +//--------------------------------------------------------------------- +//--------------------------------------------------------------------- +//--------------------------------------------------------------------- + +FWPartialConfigSaveGUI::FWPartialConfigSaveGUI( const char* path_out, const char* path_in, FWConfigurationManager* iCfg): + FWPartialConfigGUI(0, iCfg), m_outFileName(path_out), m_currFileName(path_in) +{ + TGHorizontalFrame* hf = new TGHorizontalFrame(this); + AddFrame(hf, new TGLayoutHints( kLHintsRight| kLHintsBottom, 1, 1, 2, 4)); + + TGTextButton* write = new TGTextButton(hf, " Write "); + write->Connect("Clicked()", "FWPartialConfigSaveGUI", this, "Write()"); + hf->AddFrame(write, new TGLayoutHints(kLHintsExpandX, 2, 2, 0, 0)); + + TGTextButton* cancel = new TGTextButton(hf, " Cancel "); + cancel->Connect("Clicked()", "FWPartialConfigGUI", this, "Cancel()"); + hf->AddFrame(cancel, new TGLayoutHints(kLHintsExpandX, 2, 2, 0, 0)); + + AddFrame(new TGLabel(this, Form("Output file: %s", gSystem->BaseName(path_out))), new TGLayoutHints(kLHintsLeft, 8,2,3,3)); + + SetWindowName("Save Config"); + + MapSubwindows(); + Layout(); + MapWindow(); +} + + +void +FWPartialConfigSaveGUI::Write() +{ + FWConfiguration destination; + { + m_currFileName = gSystem->Which(TROOT::GetMacroPath(), m_currFileName.c_str(), kReadPermission); + // printf("going to parse m_currFileName %s\n", m_currFileName.c_str()); + std::ifstream g(m_currFileName.c_str()); + if (g.peek() == (int) '<') { + FWXMLConfigParser parser(g); + parser.parse(); + parser.config()->swap(destination); + // printf("parsed %s ......... \n",m_currFileName.c_str() ); + } + } + + FWConfiguration curr; + m_cfgMng->to(curr); + + FWConfiguration::KeyValues* cur_kv = (FWConfiguration::KeyValues*)m_origConfig.keyValues(); + FWConfiguration::KeyValues* old_kv = (FWConfiguration::KeyValues*)destination.keyValues(); + + for (auto i = m_entries.begin(); i != m_entries.end(); i++) { + if ((*i)->IsOn()) { + std::string key = nmm.realName((*i)->GetText()->GetString()); + // printf("ON check key %s\n", key.c_str()); + for(FWConfiguration::KeyValues::iterator it = cur_kv->begin(); it != cur_kv->end(); ++it) + { + if ( key.compare(it->first) == 0) { + bool replace = false; + if (old_kv) { + for(FWConfiguration::KeyValues::iterator oldit = old_kv->begin(); oldit != old_kv->end(); ++oldit) { + if ( key.compare(oldit->first) == 0) { + replace = true; + oldit->second.swap(it->second); + break; + } + } + } + + if (!replace) + destination.addKeyValue(it->first, it->second); + + break; + } + } + } + } + + // Dump content in the file + std::ofstream file(m_outFileName.c_str()); + if(not file) { + fwLog(fwlog::kError) << "FWPartialConfigSaveGUI::Write, can't open output file.!\n"; + return; + } + fwLog(fwlog::kInfo) << "Writing configuration to " << m_outFileName << std::endl; + FWConfiguration::streamTo(file, destination, "top"); + UnmapWindow(); +} diff --git a/Fireworks/Core/src/FWProxyBuilderConfiguration.cc b/Fireworks/Core/src/FWProxyBuilderConfiguration.cc index 7ad9c2baa5139..58feca44fce40 100644 --- a/Fireworks/Core/src/FWProxyBuilderConfiguration.cc +++ b/Fireworks/Core/src/FWProxyBuilderConfiguration.cc @@ -97,6 +97,12 @@ FWProxyBuilderConfiguration::populateFrame(TGCompositeFrame* settersFrame) template FWGenericParameter* FWProxyBuilderConfiguration::assertParam(const std::string& name, T def ) { + for ( const_iterator i = begin(); i != end(); ++i) { + if ((*i)->name() == name) { + return 0; + } + } + FWGenericParameter* mode = new FWGenericParameter(this, name, def); // std::cout << "FWProxyBuilderConfiguration::getVarParameter(). No parameter with name " << name << std::endl; @@ -112,6 +118,12 @@ template FWGenericParameter* FWProxyBuilderConfiguration::assertPar template FWGenericParameterWithRange* FWProxyBuilderConfiguration::assertParam(const std::string& name, T def, T min, T max ) { + for ( const_iterator i = begin(); i != end(); ++i) { + if ((*i)->name() == name) { + return 0; + } + } + FWGenericParameterWithRange* mode = new FWGenericParameterWithRange(this, name, def, min, max); // std::cout << "FWProxyBuilderConfiguration::getVarParameter(). No parameter with name " << name << std::endl; diff --git a/Fireworks/Core/src/classes.h b/Fireworks/Core/src/classes.h index ecd360af8e477..4ca510bc104a3 100644 --- a/Fireworks/Core/src/classes.h +++ b/Fireworks/Core/src/classes.h @@ -5,7 +5,6 @@ #include "Fireworks/Core/interface/FWDisplayProperties.h" #include "Fireworks/Core/interface/FWGeometry.h" #include "Fireworks/Core/interface/TEveElementIter.h" -// #include "Fireworks/Core/interface/FWGeometryTable.h" #include "Fireworks/Core/interface/FWGUIManager.h" #include "Fireworks/Core/interface/FWDetailViewManager.h" #include "Fireworks/Core/interface/FWEveViewManager.h" @@ -32,7 +31,6 @@ #include "Fireworks/Core/src/FWEveDigitSetScalableMarker.h" #include "Fireworks/Core/src/FW3DViewDistanceMeasureTool.h" - #include "Fireworks/Core/src/CSGConnector.h" #include "Fireworks/Core/interface/FWIntValueListenerBase.h" #include "Fireworks/Core/interface/FWSummaryManager.h" @@ -67,6 +65,8 @@ #include "Fireworks/Core/src/FWEveDetectorGeo.h" #include "Fireworks/Core/src/FWGeoTopNodeGL.h" +#include "Fireworks/Core/interface/FWPartialConfig.h" + namespace Fireworks_Core { struct Fireworks_Core { //add 'dummy' Wrapper variable for each class type you put into the Event diff --git a/Fireworks/Core/src/classes_def.xml b/Fireworks/Core/src/classes_def.xml index b16f438d83a01..8867821d6f3cc 100644 --- a/Fireworks/Core/src/classes_def.xml +++ b/Fireworks/Core/src/classes_def.xml @@ -36,7 +36,6 @@ - @@ -71,5 +70,7 @@ - + + + diff --git a/Fireworks/Core/test/unittest_fwconfiguration.cc b/Fireworks/Core/test/unittest_fwconfiguration.cc index 14b4bb47e781d..aac433ca99950 100644 --- a/Fireworks/Core/test/unittest_fwconfiguration.cc +++ b/Fireworks/Core/test/unittest_fwconfiguration.cc @@ -94,7 +94,7 @@ BOOST_AUTO_TEST_CASE( fwconfiguration ) BOOST_CHECK(found->value()==kValue); BOOST_CHECK_THROW(config.valueForKey("blah"), std::runtime_error); - streamTo(std::cout, topConfig, "top"); + FWConfiguration::streamTo(std::cout, topConfig, "top"); //Test manager std::auto_ptr pConf(new Conf() ); diff --git a/Fireworks/Core/test/unittest_parameters.cc b/Fireworks/Core/test/unittest_parameters.cc index 4507e86be8625..ad881451138c7 100644 --- a/Fireworks/Core/test/unittest_parameters.cc +++ b/Fireworks/Core/test/unittest_parameters.cc @@ -132,7 +132,7 @@ BOOST_AUTO_TEST_CASE( parameters ) FWConfiguration ctConf; ct.m_comp.addTo(ctConf); - streamTo(std::cout, ctConf, "top"); + FWConfiguration::streamTo(std::cout, ctConf, "top"); ct.m_d1.set(0); ct.m_d2.set(1); diff --git a/Fireworks/FWInterface/src/FWFFLooper.cc b/Fireworks/FWInterface/src/FWFFLooper.cc index a27916e3f91c4..8a4dde93ac59c 100644 --- a/Fireworks/FWInterface/src/FWFFLooper.cc +++ b/Fireworks/FWInterface/src/FWFFLooper.cc @@ -283,7 +283,7 @@ FWFFLooper::autoLoadNewEvent() else { m_autoReload = false; - setIsPlaying(false); + CmsShowMainBase::stopPlaying(); guiManager()->enableActions(); guiManager()->getMainFrame()->enableComplexNavigation(false); } @@ -294,7 +294,7 @@ FWFFLooper::stopPlaying() { stopAutoLoadTimer(); m_autoReload = false; - setIsPlaying(false); + CmsShowMainBase::stopPlaying(); guiManager()->enableActions(); guiManager()->getMainFrame()->enableComplexNavigation(false); checkPosition(); diff --git a/Fireworks/Muons/interface/FWMuonBuilder.h b/Fireworks/Muons/interface/FWMuonBuilder.h index e45514328b299..3d724c01846aa 100644 --- a/Fireworks/Muons/interface/FWMuonBuilder.h +++ b/Fireworks/Muons/interface/FWMuonBuilder.h @@ -37,6 +37,7 @@ class FWMuonBuilder bool showEndcap, bool onlyTracks = false); + void setLineWidth(int w) {m_lineWidth = w;} private: FWMuonBuilder(const FWMuonBuilder&); // stop default @@ -45,6 +46,7 @@ class FWMuonBuilder void calculateField(const reco::Muon& iData, FWMagField* field); // ---------- member data -------------------------------- + int m_lineWidth; }; #endif diff --git a/Fireworks/Muons/plugins/FWMuonProxyBuilder.cc b/Fireworks/Muons/plugins/FWMuonProxyBuilder.cc index e5cef2a3d5cf1..97aba9acbf786 100644 --- a/Fireworks/Muons/plugins/FWMuonProxyBuilder.cc +++ b/Fireworks/Muons/plugins/FWMuonProxyBuilder.cc @@ -9,8 +9,11 @@ // Original Author: Chris Jones // Created: Thu Dec 4 19:28:07 EST 2008 // +#include "TEveTrack.h" #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h" +#include "Fireworks/Core/interface/FWProxyBuilderConfiguration.h" +#include "Fireworks/Core/interface/FWEventItem.h" #include "Fireworks/Muons/interface/FWMuonBuilder.h" #include "DataFormats/MuonReco/interface/Muon.h" @@ -20,6 +23,8 @@ class FWMuonProxyBuilder : public FWSimpleProxyBuilderTemplate FWMuonProxyBuilder( void ) {} virtual ~FWMuonProxyBuilder( void ) {} + virtual void setItem(const FWEventItem* iItem); + REGISTER_PROXYBUILDER_METHODS(); private: @@ -38,11 +43,24 @@ class FWMuonProxyBuilder : public FWSimpleProxyBuilderTemplate mutable FWMuonBuilder m_builder; }; + +void +FWMuonProxyBuilder::setItem(const FWEventItem* iItem) +{ + FWProxyBuilderBase::setItem(iItem); + + if (iItem) { + iItem->getConfig()->assertParam("LineWidth", long(1), long(1), long(4)); + } +} + void FWMuonProxyBuilder::build( const reco::Muon& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* ) { - m_builder.buildMuon( this, &iData, &oItemHolder, true, false ); + int width = item()->getConfig()->value("LineWidth"); + m_builder.setLineWidth(width); + m_builder.buildMuon( this, &iData, &oItemHolder, true, false ); increaseComponentTransparency( iIndex, &oItemHolder, "Chamber", 60 ); } diff --git a/Fireworks/Muons/plugins/FWMuonRhoPhiProxyBuilder.cc b/Fireworks/Muons/plugins/FWMuonRhoPhiProxyBuilder.cc index 19b181b4b555e..c354498b60b02 100644 --- a/Fireworks/Muons/plugins/FWMuonRhoPhiProxyBuilder.cc +++ b/Fireworks/Muons/plugins/FWMuonRhoPhiProxyBuilder.cc @@ -6,6 +6,8 @@ // #include "Fireworks/Core/interface/FWSimpleProxyBuilderTemplate.h" +#include "Fireworks/Core/interface/FWProxyBuilderConfiguration.h" +#include "Fireworks/Core/interface/FWEventItem.h" #include "Fireworks/Muons/interface/FWMuonBuilder.h" #include "DataFormats/MuonReco/interface/Muon.h" @@ -15,6 +17,8 @@ class FWMuonRhoPhiProxyBuilder : public FWSimpleProxyBuilderTemplate FWMuonRhoPhiProxyBuilder( void ) {} virtual ~FWMuonRhoPhiProxyBuilder( void ) {} + virtual void setItem(const FWEventItem* iItem); + REGISTER_PROXYBUILDER_METHODS(); private: @@ -32,10 +36,23 @@ class FWMuonRhoPhiProxyBuilder : public FWSimpleProxyBuilderTemplate mutable FWMuonBuilder m_builder; }; +void +FWMuonRhoPhiProxyBuilder::setItem(const FWEventItem* iItem) +{ + FWProxyBuilderBase::setItem(iItem); + + if (iItem) { + iItem->getConfig()->assertParam("LineWidth", long(1), long(1), long(4)); + } +} + void FWMuonRhoPhiProxyBuilder::build( const reco::Muon& iData, unsigned int iIndex, TEveElement& oItemHolder, const FWViewContext* ) { + int width = item()->getConfig()->value("LineWidth"); + m_builder.setLineWidth(width); + // To build in RhoPhi we should simply disable the Endcap drawing // by passing a false flag to a muon builder: m_builder.buildMuon( this, &iData, &oItemHolder, false, false ); diff --git a/Fireworks/Muons/src/FWMuonBuilder.cc b/Fireworks/Muons/src/FWMuonBuilder.cc index ce5d81d1ca9c5..3c16aeafcfda2 100644 --- a/Fireworks/Muons/src/FWMuonBuilder.cc +++ b/Fireworks/Muons/src/FWMuonBuilder.cc @@ -184,7 +184,7 @@ buggyMuon( const reco::Muon* muon, // // constructors and destructor // -FWMuonBuilder::FWMuonBuilder() +FWMuonBuilder::FWMuonBuilder():m_lineWidth(1) { } @@ -250,6 +250,7 @@ FWMuonBuilder::buildMuon( FWProxyBuilderBase* pb, pb->context().getMuonTrackPropagator(), getRecoTrajectoryPoints( muon, pb->item())); trk->MakeTrack(); + trk->SetLineWidth(m_lineWidth); pb->setupAddElement( trk, tList ); if( ! tracksOnly ) addMatchInformation( &(*muon), pb, tList, showEndcap ); @@ -282,6 +283,7 @@ FWMuonBuilder::buildMuon( FWProxyBuilderBase* pb, pb->context().getMuonTrackPropagator(), extraPoints ); trk->MakeTrack(); + trk->SetLineWidth(m_lineWidth); pb->setupAddElement( trk, tList ); return; } @@ -298,6 +300,7 @@ FWMuonBuilder::buildMuon( FWProxyBuilderBase* pb, { TEveTrack* trk = fireworks::prepareTrack( *( muon->outerTrack()), pb->context().getMuonTrackPropagator()); trk->MakeTrack(); + trk->SetLineWidth(m_lineWidth); pb->setupAddElement( trk, tList ); return; } @@ -306,5 +309,6 @@ FWMuonBuilder::buildMuon( FWProxyBuilderBase* pb, // show it anyway. TEveTrack* trk = fireworks::prepareCandidate( *muon, pb->context().getMuonTrackPropagator()); trk->MakeTrack(); + trk->SetLineWidth(m_lineWidth); pb->setupAddElement( trk, tList ); }