CMS 3D CMS Logo

loadFFTJetInterpolationTable.cc
Go to the documentation of this file.
1 #include <iostream>
2 #include <sstream>
3 
4 #include "Alignment/Geners/interface/Reference.hh"
5 
9 
10 static void dumpArchiveMetadata(gs::StringArchive& ar, std::ostream& os) {
11  const unsigned long long idSmall = ar.smallestId();
12  if (!idSmall)
13  os << "!!! No records in the archive !!!" << std::endl;
14  else {
15  const unsigned long long idLarge = ar.largestId();
16  unsigned long long count = 0;
17  for (unsigned long long id = idSmall; id <= idLarge; ++id)
18  if (ar.itemExists(id)) {
19  std::shared_ptr<const gs::CatalogEntry> e = ar.catalogEntry(id);
20  os << '\n';
21  e->humanReadable(os);
22  ++count;
23  }
24  os << '\n' << count << " records in the archive" << std::endl;
25  }
26 }
27 
28 CPP11_auto_ptr<npstat::StorableMultivariateFunctor> loadFFTJetInterpolationTable(const edm::ParameterSet& ps,
29  gs::StringArchive& ar,
30  const bool verbose) {
31  gs::SearchSpecifier nameSearch(ps.getParameter<std::string>("name"), ps.getParameter<bool>("nameIsRegex"));
32  gs::SearchSpecifier categorySearch(ps.getParameter<std::string>("category"),
33  ps.getParameter<bool>("categoryIsRegex"));
34  gs::Reference<npstat::StorableMultivariateFunctor> ref(ar, nameSearch, categorySearch);
35 
36  // Require that we get a unique item for this search
37  if (!ref.unique()) {
38  std::ostringstream os;
39  os << "Error in loadFFTJetInterpolationTable: table with name \"" << nameSearch.pattern() << "\" ";
40  if (nameSearch.useRegex())
41  os << "(regex) ";
42  os << "and category \"" << categorySearch.pattern() << "\" ";
43  if (categorySearch.useRegex())
44  os << "(regex) ";
45  os << "is not ";
46  if (ref.empty())
47  os << "found";
48  else
49  os << "unique";
50  os << " in the archive. Archive contents are:\n";
51  dumpArchiveMetadata(ar, os);
52  throw cms::Exception("FFTJetBadConfig", os.str());
53  }
54 
55  CPP11_auto_ptr<npstat::StorableMultivariateFunctor> p = ref.get(0);
56  if (verbose) {
57  std::cout << "In loadFFTJetInterpolationTable: loaded table with metadata" << std::endl;
58  std::shared_ptr<const gs::CatalogEntry> e = ref.indexedCatalogEntry(0);
59  e->humanReadable(std::cout);
60  std::cout << std::endl;
61  std::cout << "Actual table class name is \"" << p->classId().name() << '"' << std::endl;
62  }
63  return p;
64 }
loadFFTJetInterpolationTable.h
AlCaHLTBitMon_ParallelJobs.p
p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
gather_cfg.cout
cout
Definition: gather_cfg.py:144
dumpArchiveMetadata
static void dumpArchiveMetadata(gs::StringArchive &ar, std::ostream &os)
Definition: loadFFTJetInterpolationTable.cc:10
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
verbose
static constexpr int verbose
Definition: HLTExoticaSubAnalysis.cc:25
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:47
loadFFTJetInterpolationTable
std::unique_ptr< npstat::StorableMultivariateFunctor > loadFFTJetInterpolationTable(const edm::ParameterSet &ps, gs::StringArchive &ar, const bool verbose)
Definition: loadFFTJetInterpolationTable.cc:28
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
Exception
Definition: hltDiff.cc:245
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
Exception.h
ParameterSet.h
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37