CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
FFTJetCorrectorDBReader Class Reference

#include <JetMETCorrections/FFTJetModules/plugins/FFTJetCorrectorDBReader.cc>

Inheritance diagram for FFTJetCorrectorDBReader:
edm::stream::EDAnalyzer<> edm::stream::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 FFTJetCorrectorDBReader (const edm::ParameterSet &)
 
 FFTJetCorrectorDBReader ()=delete
 
 FFTJetCorrectorDBReader (const FFTJetCorrectorDBReader &)=delete
 
FFTJetCorrectorDBReaderoperator= (const FFTJetCorrectorDBReader &)=delete
 
 ~FFTJetCorrectorDBReader () override
 
- Public Member Functions inherited from edm::stream::EDAnalyzer<>
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
- Public Member Functions inherited from edm::stream::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
 EDAnalyzerBase (const EDAnalyzerBase &)=delete
 
ModuleDescription const & moduleDescription () const
 
const EDAnalyzerBaseoperator= (const EDAnalyzerBase &)=delete
 
 ~EDAnalyzerBase () override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESResolverIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESResolverIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProductResolverIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 

Private Attributes

FFTJetCorrectorParametersLoader esLoader
 
bool isArchiveCompressed
 
std::string outputFile
 
bool printAsString
 
bool readArchive
 
std::string record
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDAnalyzer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 
- Public Types inherited from edm::stream::EDAnalyzerBase
typedef EDAnalyzerAdaptorBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::stream::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Detailed Description

Description: writes a blob from a file into a database

Implementation: [Notes on implementation]

Definition at line 45 of file FFTJetCorrectorDBReader.cc.

Constructor & Destructor Documentation

◆ FFTJetCorrectorDBReader() [1/3]

FFTJetCorrectorDBReader::FFTJetCorrectorDBReader ( const edm::ParameterSet ps)
explicit

Definition at line 65 of file FFTJetCorrectorDBReader.cc.

References DefaultFFTJetRcdMapper< DataType >::acquireToken(), edm::EDConsumerBase::consumesCollector(), esLoader, and record.

69  init_param(bool, readArchive),
72 }
void acquireToken(const std::string &record, edm::ConsumesCollector iC)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
FFTJetCorrectorParametersLoader esLoader
#define init_param(type, varname)

◆ FFTJetCorrectorDBReader() [2/3]

FFTJetCorrectorDBReader::FFTJetCorrectorDBReader ( )
delete

◆ FFTJetCorrectorDBReader() [3/3]

FFTJetCorrectorDBReader::FFTJetCorrectorDBReader ( const FFTJetCorrectorDBReader )
delete

◆ ~FFTJetCorrectorDBReader()

FFTJetCorrectorDBReader::~FFTJetCorrectorDBReader ( )
inlineoverride

Definition at line 51 of file FFTJetCorrectorDBReader.cc.

51 {}

Member Function Documentation

◆ analyze()

void FFTJetCorrectorDBReader::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::stream::EDAnalyzerBase.

Definition at line 74 of file FFTJetCorrectorDBReader.cc.

References submitPVResolutionJobs::count, gather_cfg::cout, MillePedeFileConverter_cfg::e, FFTJetCorrectorParameters::empty(), esLoader, FFTJetCorrectorParameters::getBuffer(), l1ctLayer2EG_cff::id, isArchiveCompressed, FFTJetCorrectorParameters::length(), DefaultFFTJetRcdMapper< DataType >::load(), haddnano::of, outputFile, printAsString, readArchive, record, and FFTJetCorrectorParameters::str().

74  {
76 
78  std::cout << "++++ FFTJetCorrectorDBReader: info for record \"" << record << '"' << std::endl;
79 
80  if (printAsString)
81  std::cout << "++++ String rep: \"" << JetCorParams->str() << '"' << std::endl;
82  else if (readArchive) {
83  CPP11_auto_ptr<gs::StringArchive> par;
84 
85  {
86  std::istringstream is(JetCorParams->str());
88  par = gs::read_compressed_item<gs::StringArchive>(is);
89  else
90  par = gs::read_item<gs::StringArchive>(is);
91  }
92 
93  const unsigned long long idSmall = par->smallestId();
94  if (!idSmall)
95  std::cout << "++++ No valid records in the archive" << std::endl;
96  else {
97  std::cout << "++++ Archive metadata begins" << std::endl;
98  const unsigned long long idLarge = par->largestId();
99  unsigned long long count = 0;
100  for (unsigned long long id = idSmall; id <= idLarge; ++id)
101  if (par->itemExists(id)) {
102  std::shared_ptr<const gs::CatalogEntry> e = par->catalogEntry(id);
103  std::cout << '\n';
104  e->humanReadable(std::cout);
105  ++count;
106  }
107  std::cout << "\n++++ Archive metadata ends, " << count << " items total" << std::endl;
108  }
109  }
110 
111  if (!outputFile.empty()) {
112  std::ofstream of(outputFile.c_str(), std::ios_base::binary);
113  if (!of.is_open())
114  throw cms::Exception("InvalidArgument") << "Failed to open file \"" << outputFile << '"' << std::endl;
115  if (!JetCorParams->empty()) {
116  of.write(JetCorParams->getBuffer(), JetCorParams->length());
117  if (of.fail())
118  throw cms::Exception("SystemError")
119  << "Output stream failure while writing file \"" << outputFile << '"' << std::endl;
120  }
121  }
122 }
edm::ESHandle< DataType > load(const std::string &record, const edm::EventSetup &iSetup) const
const std::string & str() const
FFTJetCorrectorParametersLoader esLoader

◆ operator=()

FFTJetCorrectorDBReader& FFTJetCorrectorDBReader::operator= ( const FFTJetCorrectorDBReader )
delete

Member Data Documentation

◆ esLoader

FFTJetCorrectorParametersLoader FFTJetCorrectorDBReader::esLoader
private

Definition at line 62 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze(), and FFTJetCorrectorDBReader().

◆ isArchiveCompressed

bool FFTJetCorrectorDBReader::isArchiveCompressed
private

Definition at line 60 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

◆ outputFile

std::string FFTJetCorrectorDBReader::outputFile
private

Definition at line 57 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

◆ printAsString

bool FFTJetCorrectorDBReader::printAsString
private

Definition at line 58 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

◆ readArchive

bool FFTJetCorrectorDBReader::readArchive
private

Definition at line 59 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

◆ record

std::string FFTJetCorrectorDBReader::record
private

Definition at line 56 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze(), and FFTJetCorrectorDBReader().