CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::StorableMultivariateFunctor
loadFFTJetInterpolationTable (const edm::ParameterSet &ps, gs::StringArchive &ar, const bool verbose)
 

Function Documentation

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

Definition at line 11 of file loadFFTJetInterpolationTable.cc.

References prof2calltree::count, and alignCSCRings::e.

Referenced by loadFFTJetInterpolationTable().

12 {
13  const unsigned long long idSmall = ar.smallestId();
14  if (!idSmall)
15  os << "!!! No records in the archive !!!" << std::endl;
16  else
17  {
18  const unsigned long long idLarge = ar.largestId();
19  unsigned long long count = 0;
20  for (unsigned long long id = idSmall; id <= idLarge; ++id)
21  if (ar.itemExists(id))
22  {
23  CPP11_shared_ptr<const gs::CatalogEntry> e =
24  ar.catalogEntry(id);
25  os << '\n';
26  e->humanReadable(os);
27  ++count;
28  }
29  os << '\n' << count << " records in the archive" << std::endl;
30  }
31 }
std::unique_ptr<npstat::StorableMultivariateFunctor> loadFFTJetInterpolationTable ( const edm::ParameterSet ps,
gs::StringArchive &  ar,
const bool  verbose 
)

Definition at line 35 of file loadFFTJetInterpolationTable.cc.

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

Referenced by parseFFTJetScaleCalculator().

37 {
38  gs::SearchSpecifier nameSearch(ps.getParameter<std::string>("name"),
39  ps.getParameter<bool>("nameIsRegex"));
40  gs::SearchSpecifier categorySearch(ps.getParameter<std::string>("category"),
41  ps.getParameter<bool>("categoryIsRegex"));
42  gs::Reference<npstat::StorableMultivariateFunctor> ref(
43  ar, nameSearch, categorySearch);
44 
45  // Require that we get a unique item for this search
46  if (!ref.unique())
47  {
48  std::ostringstream os;
49  os << "Error in loadFFTJetInterpolationTable: table with name \""
50  << nameSearch.pattern() << "\" ";
51  if (nameSearch.useRegex())
52  os << "(regex) ";
53  os << "and category \""
54  << categorySearch.pattern() << "\" ";
55  if (categorySearch.useRegex())
56  os << "(regex) ";
57  os << "is not ";
58  if (ref.empty())
59  os << "found";
60  else
61  os << "unique";
62  os << " in the archive. Archive contents are:\n";
63  dumpArchiveMetadata(ar, os);
64  throw cms::Exception("FFTJetBadConfig", os.str());
65  }
66 
67  CPP11_auto_ptr<npstat::StorableMultivariateFunctor> p = ref.get(0);
68  if (verbose)
69  {
70  std::cout << "In loadFFTJetInterpolationTable: loaded table with metadata"
71  << std::endl;
72  CPP11_shared_ptr<const gs::CatalogEntry> e = ref.indexedCatalogEntry(0);
73  e->humanReadable(std::cout);
74  std::cout << std::endl;
75  std::cout << "Actual table class name is \""
76  << p->classId().name() << '"' << std::endl;
77  }
78  return p;
79 }
T getParameter(std::string const &) const
tuple cout
Definition: gather_cfg.py:121
static void dumpArchiveMetadata(gs::StringArchive &ar, std::ostream &os)