CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Private Attributes
JetCorrectorDBWriter Class Reference
Inheritance diagram for JetCorrectorDBWriter:
edm::one::EDAnalyzer<> edm::one::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
void beginJob () override
 
void endJob () override
 
 JetCorrectorDBWriter (const edm::ParameterSet &)
 
 ~JetCorrectorDBWriter () override
 
- Public Member Functions inherited from edm::one::EDAnalyzer<>
 EDAnalyzer ()=default
 
 EDAnalyzer (const EDAnalyzer &)=delete
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
const EDAnalyzeroperator= (const EDAnalyzer &)=delete
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDAnalyzerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, 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::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

std::string algo
 
std::string era
 
std::string inputTxtFile
 
std::string path
 
std::string payloadTag
 

Additional Inherited Members

- Public Types inherited from edm::one::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::one::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< B > consumes (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 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<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
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

Definition at line 18 of file JetCorrectorDBWriter.cc.

Constructor & Destructor Documentation

JetCorrectorDBWriter::JetCorrectorDBWriter ( const edm::ParameterSet pSet)

Definition at line 35 of file JetCorrectorDBWriter.cc.

References algo, era, edm::ParameterSet::getUntrackedParameter(), path, payloadTag, and AlCaHLTBitMon_QueryRunRegistry::string.

35  {
36  era = pSet.getUntrackedParameter<std::string>("era");
37  algo = pSet.getUntrackedParameter<std::string>("algo");
38  path = pSet.getUntrackedParameter<std::string>("path");
39  //payloadTag = "JetCorrectorParametersCollection_"+era+"_"+algo;
40  payloadTag = algo;
41 }
T getUntrackedParameter(std::string const &, T const &) const
JetCorrectorDBWriter::~JetCorrectorDBWriter ( )
inlineoverride

Definition at line 24 of file JetCorrectorDBWriter.cc.

24 {}

Member Function Documentation

void JetCorrectorDBWriter::analyze ( const edm::Event ,
const edm::EventSetup  
)
inlineoverridevirtual

Implements edm::one::EDAnalyzerBase.

Definition at line 22 of file JetCorrectorDBWriter.cc.

22 {}
void JetCorrectorDBWriter::beginJob ( void  )
overridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 44 of file JetCorrectorDBWriter.cc.

References algo, bitset_utilities::append(), cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, era, JetCorrectorParametersCollection::findLabel(), edm::FileInPath::fullPath(), JetCorrectorParametersCollection::getSections(), mps_fire::i, inputTxtFile, edm::Service< T >::isAvailable(), JetCorrectorParametersCollection::N_LEVELS, path, jetCorrFactors_cfi::payload, payloadTag, JetCorrectorParametersCollection::push_back(), alignCSCRings::s, AlCaHLTBitMon_QueryRunRegistry::string, and cond::service::PoolDBOutputService::writeOneIOV().

44  {
45  // std::string path("CondFormats/JetMETObjects/data/");
46 
48  std::cout << "Starting to import payload " << payloadTag << " from text files." << std::endl;
49  for (int i = 0; i < JetCorrectorParametersCollection::N_LEVELS; ++i) {
50  std::string append("_");
51  std::string ilev =
52  JetCorrectorParametersCollection::findLabel(static_cast<JetCorrectorParametersCollection::Level_t>(i));
53  append += ilev;
54  append += "_";
55  append += algo;
56  append += ".txt";
58  try {
60  std::cout << "Opened file " << inputTxtFile << std::endl;
61  // create the parameter object from file
62  std::vector<std::string> sections;
63  JetCorrectorParametersCollection::getSections(fip.fullPath(), sections);
64  if (sections.empty()) {
65  payload.push_back(i, JetCorrectorParameters(fip.fullPath(), ""));
66  } else {
67  for (std::vector<std::string>::const_iterator isectbegin = sections.begin(),
68  isectend = sections.end(),
69  isect = isectbegin;
70  isect != isectend;
71  ++isect) {
72  payload.push_back(i, JetCorrectorParameters(fip.fullPath(), *isect), ilev + "_" + *isect);
73  std::cout << "Added " << ilev + "_" + *isect << " to record " << i << std::endl;
74  }
75  }
76  std::cout << "Added record " << i << std::endl;
77  } catch (edm::Exception const&) {
78  std::cout << "Did not find JEC file " << inputTxtFile << std::endl;
79  }
80  }
81 
82  std::cout << "Opening PoolDBOutputService" << std::endl;
83 
84  // now write it into the DB
86  if (s.isAvailable()) {
87  std::cout << "Setting up payload tag " << payloadTag << std::endl;
88  s->writeOneIOV(payload, s->beginOfTime(), payloadTag);
89  }
90  std::cout << "Wrote in CondDB payload label: " << payloadTag << std::endl;
91 }
static std::string findLabel(key_type k)
void push_back(key_type i, value_type const &j, label_type const &flav="")
boost::dynamic_bitset append(const boost::dynamic_bitset<> &bs1, const boost::dynamic_bitset<> &bs2)
this method takes two bitsets bs1 and bs2 and returns result of bs2 appended to the end of bs1 ...
bool isAvailable() const
Definition: Service.h:40
Hash writeOneIOV(const T &payload, Time_t time, const std::string &recordName)
static void getSections(std::string inputFile, std::vector< std::string > &outputs)
tuple cout
Definition: gather_cfg.py:144
void JetCorrectorDBWriter::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::one::EDAnalyzerBase.

Definition at line 23 of file JetCorrectorDBWriter.cc.

23 {}

Member Data Documentation

std::string JetCorrectorDBWriter::algo
private

Definition at line 28 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().

std::string JetCorrectorDBWriter::era
private

Definition at line 27 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().

std::string JetCorrectorDBWriter::inputTxtFile
private

Definition at line 30 of file JetCorrectorDBWriter.cc.

Referenced by beginJob().

std::string JetCorrectorDBWriter::path
private
std::string JetCorrectorDBWriter::payloadTag
private

Definition at line 31 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().