CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 &)
 
virtual ~FFTJetCorrectorDBReader ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

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 &)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
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)
 

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::FFTJetCorrectorDBReader ( const edm::ParameterSet ps)
explicit
virtual FFTJetCorrectorDBReader::~FFTJetCorrectorDBReader ( )
inlinevirtual

Definition at line 49 of file FFTJetCorrectorDBReader.cc.

49 {}
FFTJetCorrectorDBReader::FFTJetCorrectorDBReader ( )
private
FFTJetCorrectorDBReader::FFTJetCorrectorDBReader ( const FFTJetCorrectorDBReader )
private

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 74 of file FFTJetCorrectorDBReader.cc.

References prof2calltree::count, gather_cfg::cout, alignCSCRings::e, StaticFFTJetRcdMapper< Mapper >::instance(), isArchiveCompressed, outputFile, printAsString, readArchive, and record.

76 {
79  iSetup, record, JetCorParams);
80 
82  std::cout << "++++ FFTJetCorrectorDBReader: info for record \""
83  << record << '"' << std::endl;
84 
85  if (printAsString)
86  std::cout << "++++ String rep: \""
87  << JetCorParams->str() << '"' << std::endl;
88  else if (readArchive)
89  {
90  CPP11_auto_ptr<gs::StringArchive> par;
91 
92  {
93  std::istringstream is(JetCorParams->str());
95  par = gs::read_compressed_item<gs::StringArchive>(is);
96  else
97  par = gs::read_item<gs::StringArchive>(is);
98  }
99 
100  const unsigned long long idSmall = par->smallestId();
101  if (!idSmall)
102  std::cout << "++++ No valid records in the archive" << std::endl;
103  else
104  {
105  std::cout << "++++ Archive metadata begins" << std::endl;
106  const unsigned long long idLarge = par->largestId();
107  unsigned long long count = 0;
108  for (unsigned long long id = idSmall; id <= idLarge; ++id)
109  if (par->itemExists(id))
110  {
111  CPP11_shared_ptr<const gs::CatalogEntry> e =
112  par->catalogEntry(id);
113  std::cout << '\n';
114  e->humanReadable(std::cout);
115  ++count;
116  }
117  std::cout << "\n++++ Archive metadata ends, "
118  << count << " items total" << std::endl;
119  }
120  }
121 
122  if (!outputFile.empty())
123  {
124  std::ofstream of(outputFile.c_str(), std::ios_base::binary);
125  if (!of.is_open())
126  throw cms::Exception("InvalidArgument")
127  << "Failed to open file \"" << outputFile << '"' << std::endl;
128  if (!JetCorParams->empty())
129  {
130  of.write(JetCorParams->getBuffer(), JetCorParams->length());
131  if (of.fail())
132  throw cms::Exception("SystemError")
133  << "Output stream failure while writing file \""
134  << outputFile << '"' << std::endl;
135  }
136  }
137 }
tuple cout
Definition: gather_cfg.py:121
static const Mapper & instance()
FFTJetCorrectorDBReader& FFTJetCorrectorDBReader::operator= ( const FFTJetCorrectorDBReader )
private

Member Data Documentation

bool FFTJetCorrectorDBReader::isArchiveCompressed
private

Definition at line 62 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

std::string FFTJetCorrectorDBReader::outputFile
private

Definition at line 59 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

bool FFTJetCorrectorDBReader::printAsString
private

Definition at line 60 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

bool FFTJetCorrectorDBReader::readArchive
private

Definition at line 61 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().

std::string FFTJetCorrectorDBReader::record
private

Definition at line 58 of file FFTJetCorrectorDBReader.cc.

Referenced by analyze().