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.

References submitPVResolutionJobs::count, MillePedeFileConverter_cfg::e, l1ctLayer2EG_cff::id, and l1tGTMenu_BTagSeeds_cff::os.

Referenced by loadFFTJetInterpolationTable().

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 }

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

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

Referenced by parseFFTJetScaleCalculator().

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";
52  throw cms::Exception("FFTJetBadConfig", os.str());
53  }
54 
55  std::unique_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 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
bool verbose
static void dumpArchiveMetadata(gs::StringArchive &ar, std::ostream &os)