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::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 FFTJetCorrectorDBReader (const edm::ParameterSet &)
 
 ~FFTJetCorrectorDBReader () override
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
 ~EDAnalyzer () 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 &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > 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
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 FFTJetCorrectorDBReader ()=delete
 
 FFTJetCorrectorDBReader (const FFTJetCorrectorDBReader &)=delete
 
FFTJetCorrectorDBReaderoperator= (const FFTJetCorrectorDBReader &)=delete
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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

◆ ~FFTJetCorrectorDBReader()

FFTJetCorrectorDBReader::~FFTJetCorrectorDBReader ( )
inlineoverride

Definition at line 48 of file FFTJetCorrectorDBReader.cc.

48 {}

◆ FFTJetCorrectorDBReader() [2/3]

FFTJetCorrectorDBReader::FFTJetCorrectorDBReader ( )
privatedelete

◆ FFTJetCorrectorDBReader() [3/3]

FFTJetCorrectorDBReader::FFTJetCorrectorDBReader ( const FFTJetCorrectorDBReader )
privatedelete

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 71 of file FFTJetCorrectorDBReader.cc.

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

References submitPVResolutionJobs::count, gather_cfg::cout, MillePedeFileConverter_cfg::e, FFTJetCorrectorParameters::empty(), FFTJetCorrectorParameters::getBuffer(), triggerObjects_cff::id, StaticFFTJetRcdMapper< Mapper >::instance(), isArchiveCompressed, FFTJetCorrectorParameters::length(), outputFile, printAsString, readArchive, record, and FFTJetCorrectorParameters::str().

◆ operator=()

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

Member Data Documentation

◆ isArchiveCompressed

bool FFTJetCorrectorDBReader::isArchiveCompressed
private

Definition at line 61 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

◆ outputFile

std::string FFTJetCorrectorDBReader::outputFile
private

Definition at line 58 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

◆ printAsString

bool FFTJetCorrectorDBReader::printAsString
private

Definition at line 59 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

◆ readArchive

bool FFTJetCorrectorDBReader::readArchive
private

Definition at line 60 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

◆ record

std::string FFTJetCorrectorDBReader::record
private

Definition at line 57 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

gather_cfg.cout
cout
Definition: gather_cfg.py:144
FFTJetCorrectorDBReader::isArchiveCompressed
bool isArchiveCompressed
Definition: FFTJetCorrectorDBReader.cc:61
init_param
#define init_param(type, varname)
Definition: FFTJetCorrectorDBReader.cc:40
edm::ESHandle
Definition: DTSurvey.h:22
FFTJetCorrectorDBReader::outputFile
std::string outputFile
Definition: FFTJetCorrectorDBReader.cc:58
submitPVResolutionJobs.count
count
Definition: submitPVResolutionJobs.py:352
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
FFTJetCorrectorParameters::length
std::size_t length() const
Definition: FFTJetCorrectorParameters.h:24
FFTJetCorrectorDBReader::readArchive
bool readArchive
Definition: FFTJetCorrectorDBReader.cc:60
StaticFFTJetRcdMapper::instance
static const Mapper & instance()
Definition: FFTJetRcdMapper.h:86
FFTJetCorrectorParameters::getBuffer
const char * getBuffer() const
Definition: FFTJetCorrectorParameters.h:26
FFTJetCorrectorParameters::str
const std::string & str() const
Definition: FFTJetCorrectorParameters.h:23
FFTJetCorrectorDBReader::record
std::string record
Definition: FFTJetCorrectorDBReader.cc:57
triggerObjects_cff.id
id
Definition: triggerObjects_cff.py:29
FFTJetCorrectorDBReader::printAsString
bool printAsString
Definition: FFTJetCorrectorDBReader.cc:59
cms::Exception
Definition: Exception.h:70
FFTJetCorrectorParameters::empty
bool empty() const
Definition: FFTJetCorrectorParameters.h:25
MillePedeFileConverter_cfg.e
e
Definition: MillePedeFileConverter_cfg.py:37