CMS 3D CMS Logo

FIPConfiguration.cc
Go to the documentation of this file.
2 
3 #include <cstddef>
4 #include <iostream>
5 #include <memory>
6 
9 #include "xercesc/util/XercesVersion.hpp"
10 
11 class DDCompactView;
12 
13 using namespace XERCES_CPP_NAMESPACE;
14 
15 FIPConfiguration::FIPConfiguration(DDCompactView& cpv) : configHandler_(cpv), cpv_(cpv) {}
16 
18 
19 const std::vector<std::string>& FIPConfiguration::getFileList(void) const { return files_; }
20 
21 const std::vector<std::string>& FIPConfiguration::getURLList(void) const { return urls_; }
22 
24 
26 
28  std::cout << "File List:" << std::endl;
29  std::cout << " number of files=" << files_.size() << std::endl;
30  for (const auto& file : files_)
31  std::cout << file << std::endl;
32 }
33 
34 //-----------------------------------------------------------------------
35 // Here the Xerces parser is used to process the content of the
36 // configuration file.
37 //-----------------------------------------------------------------------
38 
40  std::string absoluteFileName(filename);
41  if (!fullPath) {
43  // config file
44  absoluteFileName = fp.fullPath();
45  }
46 
47  // Set the parser to use the handler for the configuration file.
48  // This makes sure the Parser is initialized and gets a handle to it.
49  DDLParser ddlp(cpv_);
50  ddlp.getXMLParser()->setContentHandler(&configHandler_);
51  ddlp.getXMLParser()->parse(absoluteFileName.c_str());
52  const std::vector<std::string>& vURLs = configHandler_.getURLs();
53  const std::vector<std::string>& vFiles = configHandler_.getFileNames();
54  size_t maxInd = vFiles.size();
55  size_t ind = 0;
56  // ea. file listed in the config
57  for (; ind < maxInd; ++ind) {
58  edm::FileInPath fp(vURLs[ind] + "/" + vFiles[ind]);
59  // std::cout << "FileInPath says..." << fp.fullPath() << std::endl;
60  files_.emplace_back(fp.fullPath());
61  urls_.emplace_back("");
62  }
63 
64  // std::vector<std::string> fnames = configHandler_.getFileNames();
65  // std::cout << "there are " << fnames.size() << " files." << std::endl;
66  // for (size_t i = 0; i < fnames.size(); ++i)
67  // std::cout << "url=" << configHandler_.getURLs()[i] << " file=" << configHandler_.getFileNames()[i] << std::endl;
68  return 0;
69 }
70 
DDLSAX2ConfigHandler::getSchemaLocation
const std::string getSchemaLocation() const
Definition: DDLSAX2ConfigHandler.cc:60
contentValuesFiles.fullPath
fullPath
Definition: contentValuesFiles.py:64
gather_cfg.cout
cout
Definition: gather_cfg.py:144
FIPConfiguration::files_
std::vector< std::string > files_
Definition: FIPConfiguration.h:58
personalPlayback.fp
fp
Definition: personalPlayback.py:523
FIPConfiguration::~FIPConfiguration
~FIPConfiguration() override
Definition: FIPConfiguration.cc:17
DDLParser.h
FileInPath.h
edm::FileInPath
Definition: FileInPath.h:64
DDLParser::getXMLParser
SAX2XMLReader * getXMLParser()
Get the SAX2Parser from the DDLParser. USE WITH CAUTION. Set your own handler, etc.
Definition: DDLParser.cc:51
FIPConfiguration::doValidation
bool doValidation() const override
Return whether Validation should be on or off and where the DDL SchemaLocation is.
Definition: FIPConfiguration.cc:23
DDCompactView
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
FIPConfiguration::getSchemaLocation
std::string getSchemaLocation() const override
Return the designation for where to look for the schema.
Definition: FIPConfiguration.cc:25
XERCES_CPP_NAMESPACE
Definition: XmlConfigParser.h:12
corrVsCorr.filename
filename
Definition: corrVsCorr.py:123
DDLSAX2ConfigHandler::doValidation
const bool doValidation() const
Definition: DDLSAX2ConfigHandler.cc:62
FIPConfiguration::getURLList
const std::vector< std::string > & getURLList(void) const override
Return a list of urls as a std::vector of strings.
Definition: FIPConfiguration.cc:21
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FIPConfiguration::configHandler_
DDLSAX2ConfigHandler configHandler_
Definition: FIPConfiguration.h:57
DDLParser
DDLParser is the main class of Detector Description Language Parser.
Definition: DDLParser.h:63
FIPConfiguration::urls_
std::vector< std::string > urls_
Definition: FIPConfiguration.h:59
FrontierConditions_GlobalTag_cff.file
file
Definition: FrontierConditions_GlobalTag_cff.py:13
DDLSAX2ConfigHandler::getFileNames
const std::vector< std::string > & getFileNames() const
Definition: DDLSAX2ConfigHandler.cc:56
FIPConfiguration::readConfig
int readConfig(const std::string &filename) override
Read in the configuration file.
Definition: FIPConfiguration.cc:71
FIPConfiguration::getFileList
const std::vector< std::string > & getFileList(void) const override
Return a list of files as a std::vector of strings.
Definition: FIPConfiguration.cc:19
DDLSAX2ConfigHandler::getURLs
const std::vector< std::string > & getURLs() const
Definition: DDLSAX2ConfigHandler.cc:58
FIPConfiguration::FIPConfiguration
FIPConfiguration(DDCompactView &cpv)
Definition: FIPConfiguration.cc:15
FIPConfiguration.h
FIPConfiguration::cpv_
DDCompactView & cpv_
Definition: FIPConfiguration.h:60
FIPConfiguration::dumpFileList
void dumpFileList(void) const override
Print out the list of files.
Definition: FIPConfiguration.cc:27