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.

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 }

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

◆ ~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.

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 }

References HLTMuonOfflineAnalyzer_cff::destination, FrontierConditions_GlobalTag_cff::file, fwLog, g, mps_fire::i, createfilelist::int, fwlog::kError, crabWrapper::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().

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().

FWPartialConfigSaveGUI::m_outFileName
std::string m_outFileName
Definition: FWPartialConfig.h:50
FWPartialConfigGUI::m_cfgMng
FWConfigurationManager * m_cfgMng
Definition: FWPartialConfig.h:20
fwLog
#define fwLog(_level_)
Definition: fwLog.h:45
mps_fire.i
i
Definition: mps_fire.py:428
FWConfiguration::streamTo
static void streamTo(std::ostream &oTo, const FWConfiguration &iConfig, const std::string &name)
Definition: FWConfiguration.cc:196
writedatasetfile.parser
parser
Definition: writedatasetfile.py:7
FWConfiguration::KeyValues
std::vector< std::pair< std::string, FWConfiguration > > KeyValues
Definition: FWConfiguration.h:40
photonIsolationHIProducer_cfi.hf
hf
Definition: photonIsolationHIProducer_cfi.py:9
FWXMLConfigParser
Definition: FWXMLConfigParser.h:32
FWPartialConfigGUI::m_origConfig
FWConfiguration m_origConfig
Definition: FWPartialConfig.h:19
FWConfigurationManager::to
void to(FWConfiguration &) const
Definition: FWConfigurationManager.cc:86
FWPartialConfigSaveGUI::m_currFileName
std::string m_currFileName
Definition: FWPartialConfig.h:51
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FWPartialConfigGUI::FWPartialConfigGUI
FWPartialConfigGUI(const char *path, FWConfigurationManager *)
Definition: FWPartialConfig.cc:46
createfilelist.int
int
Definition: createfilelist.py:10
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
HLTMuonOfflineAnalyzer_cff.destination
destination
Definition: HLTMuonOfflineAnalyzer_cff.py:50
writeEcalDQMStatus.write
write
Definition: writeEcalDQMStatus.py:48
fwlog::kInfo
Definition: fwLog.h:35
FWPartialConfigGUI::m_entries
std::vector< TGCheckButton * > m_entries
Definition: FWPartialConfig.h:18
FWConfiguration::keyValues
const KeyValues * keyValues() const
Definition: FWConfiguration.h:51
fwlog::kError
Definition: fwLog.h:35
FWConfiguration
Definition: FWConfiguration.h:31
crabWrapper.key
key
Definition: crabWrapper.py:19
g
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
python.rootplot.root2matplotlib.replace
def replace(string, replacements)
Definition: root2matplotlib.py:444