CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FWPartialConfigSaveGUI Class Reference

#include <FWPartialConfig.h>

Inheritance diagram for FWPartialConfigSaveGUI:
FWPartialConfigGUI

Public Member Functions

 FWPartialConfigSaveGUI (const char *path_out, const char *path_in, FWConfigurationManager *)
 
void WriteConfig ()
 
 ~FWPartialConfigSaveGUI () override
 
- Public Member Functions inherited from FWPartialConfigGUI
void Cancel ()
 
 FWPartialConfigGUI (const char *path, FWConfigurationManager *)
 
 ~FWPartialConfigGUI () override
 

Private Member Functions

 ClassDefOverride (FWPartialConfigSaveGUI, 0)
 

Private Attributes

std::string m_currFileName
 
std::string m_outFileName
 

Additional Inherited Members

- Protected Member Functions inherited from FWPartialConfigGUI
 ClassDefOverride (FWPartialConfigGUI, 0)
 
- Protected Attributes inherited from FWPartialConfigGUI
FWConfigurationManagerm_cfgMng
 
std::vector< TGCheckButton * > m_entries
 
FWConfiguration m_origConfig
 

Detailed Description

Definition at line 42 of file FWPartialConfig.h.

Constructor & Destructor Documentation

◆ FWPartialConfigSaveGUI()

FWPartialConfigSaveGUI::FWPartialConfigSaveGUI ( const char *  path_out,
const char *  path_in,
FWConfigurationManager iCfg 
)

Definition at line 154 of file FWPartialConfig.cc.

References photonIsolationHIProducer_cfi::hf, and writeEcalDQMStatus::write.

155  : FWPartialConfigGUI(nullptr, iCfg), m_outFileName(path_out), m_currFileName(path_in) {
156  TGHorizontalFrame* hf = new TGHorizontalFrame(this);
157  AddFrame(hf, new TGLayoutHints(kLHintsRight | kLHintsBottom, 1, 1, 2, 4));
158 
159  TGTextButton* write = new TGTextButton(hf, " Write ");
160  write->Connect("Clicked()", "FWPartialConfigSaveGUI", this, "WriteConfig()");
161  hf->AddFrame(write, new TGLayoutHints(kLHintsExpandX, 2, 2, 0, 0));
162 
163  TGTextButton* cancel = new TGTextButton(hf, " Cancel ");
164  cancel->Connect("Clicked()", "FWPartialConfigGUI", this, "Cancel()");
165  hf->AddFrame(cancel, new TGLayoutHints(kLHintsExpandX, 2, 2, 0, 0));
166 
167  AddFrame(new TGLabel(this, Form("Output file: %s", gSystem->BaseName(path_out))),
168  new TGLayoutHints(kLHintsLeft, 8, 2, 3, 3));
169 
170  SetWindowName("Save Config");
171 
172  MapSubwindows();
173  Layout();
174  MapWindow();
175 }
FWPartialConfigGUI(const char *path, FWConfigurationManager *)

◆ ~FWPartialConfigSaveGUI()

FWPartialConfigSaveGUI::~FWPartialConfigSaveGUI ( )
inlineoverride

Definition at line 45 of file FWPartialConfig.h.

45 {}

Member Function Documentation

◆ ClassDefOverride()

FWPartialConfigSaveGUI::ClassDefOverride ( FWPartialConfigSaveGUI  ,
 
)
private

◆ WriteConfig()

void FWPartialConfigSaveGUI::WriteConfig ( )

Definition at line 177 of file FWPartialConfig.cc.

References HLTMuonOfflineAnalyzer_cff::destination, geometryDiff::file, fwLog, g, mps_fire::i, createfilelist::int, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, fwlog::kError, submitPVResolutionJobs::key, FWConfiguration::keyValues(), fwlog::kInfo, FWPartialConfigGUI::m_cfgMng, m_currFileName, FWPartialConfigGUI::m_entries, FWPartialConfigGUI::m_origConfig, m_outFileName, writedatasetfile::parser, python.rootplot.root2matplotlib::replace(), FWConfiguration::streamTo(), AlCaHLTBitMon_QueryRunRegistry::string, and FWConfigurationManager::to().

177  {
179  {
180  m_currFileName = gSystem->Which(TROOT::GetMacroPath(), m_currFileName.c_str(), kReadPermission);
181  // printf("going to parse m_currFileName %s\n", m_currFileName.c_str());
182  std::ifstream g(m_currFileName.c_str());
183  if (g.peek() == (int)'<') {
185  parser.parse();
186  parser.config()->swap(destination);
187  // printf("parsed %s ......... \n",m_currFileName.c_str() );
188  }
189  }
190 
191  FWConfiguration curr;
192  m_cfgMng->to(curr);
193 
196 
197  for (auto i = m_entries.begin(); i != m_entries.end(); i++) {
198  if ((*i)->IsOn()) {
199  std::string key = nmm.realName((*i)->GetText()->GetString());
200  // printf("ON check key %s\n", key.c_str());
201  for (FWConfiguration::KeyValues::iterator it = cur_kv->begin(); it != cur_kv->end(); ++it) {
202  if (key == it->first) {
203  bool replace = false;
204  if (old_kv) {
205  for (FWConfiguration::KeyValues::iterator oldit = old_kv->begin(); oldit != old_kv->end(); ++oldit) {
206  if (key == oldit->first) {
207  replace = true;
208  oldit->second.swap(it->second);
209  break;
210  }
211  }
212  }
213 
214  if (!replace)
215  destination.addKeyValue(it->first, it->second);
216 
217  break;
218  }
219  }
220  }
221  }
222 
223  // Dump content in the file
224  std::ofstream file(m_outFileName.c_str());
225  if (not file) {
226  fwLog(fwlog::kError) << "FWPartialConfigSaveGUI::Write, can't open output file.!\n";
227  return;
228  }
229  fwLog(fwlog::kInfo) << "Writing configuration to " << m_outFileName << std::endl;
231  UnmapWindow();
232 }
void to(FWConfiguration &) const
FWConfigurationManager * m_cfgMng
def replace(string, replacements)
std::vector< TGCheckButton * > m_entries
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
Definition: Activities.doc:4
key
prepare the HTCondor submission files and eventually submit them
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
#define fwLog(_level_)
Definition: fwLog.h:45
FWConfiguration m_origConfig
const KeyValues * keyValues() const
static void streamTo(std::ostream &oTo, const FWConfiguration &iConfig, const std::string &name)

Member Data Documentation

◆ m_currFileName

std::string FWPartialConfigSaveGUI::m_currFileName
private

Definition at line 51 of file FWPartialConfig.h.

Referenced by WriteConfig().

◆ m_outFileName

std::string FWPartialConfigSaveGUI::m_outFileName
private

Definition at line 50 of file FWPartialConfig.h.

Referenced by WriteConfig().