CMS 3D CMS Logo

Functions
loadFFTJetInterpolationTable.cc File Reference
#include <iostream>
#include <sstream>
#include "Alignment/Geners/interface/Reference.hh"
#include "JetMETCorrections/FFTJetObjects/interface/loadFFTJetInterpolationTable.h"
#include "FWCore/ParameterSet/interface/ParameterSet.h"
#include "FWCore/Utilities/interface/Exception.h"

Go to the source code of this file.

Functions

static void dumpArchiveMetadata (gs::StringArchive &ar, std::ostream &os)
 
std::unique_ptr< npstat::StorableMultivariateFunctorloadFFTJetInterpolationTable (const edm::ParameterSet &ps, gs::StringArchive &ar, const bool verbose)
 

Function Documentation

◆ dumpArchiveMetadata()

static void dumpArchiveMetadata ( gs::StringArchive &  ar,
std::ostream &  os 
)
static

Definition at line 10 of file loadFFTJetInterpolationTable.cc.

10  {
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 }

References submitPVResolutionJobs::count, MillePedeFileConverter_cfg::e, and triggerObjects_cff::id.

Referenced by loadFFTJetInterpolationTable().

◆ loadFFTJetInterpolationTable()

std::unique_ptr<npstat::StorableMultivariateFunctor> loadFFTJetInterpolationTable ( const edm::ParameterSet ps,
gs::StringArchive &  ar,
const bool  verbose 
)

Definition at line 28 of file loadFFTJetInterpolationTable.cc.

30  {
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 }

References gather_cfg::cout, dumpArchiveMetadata(), MillePedeFileConverter_cfg::e, Exception, edm::ParameterSet::getParameter(), AlCaHLTBitMon_ParallelJobs::p, AlCaHLTBitMon_QueryRunRegistry::string, and verbose.

Referenced by parseFFTJetScaleCalculator().

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_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
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
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37