CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
JetCorrectorDBWriter Class Reference
Inheritance diagram for JetCorrectorDBWriter:
edm::EDAnalyzer 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::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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (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::vector< ModuleDescription const * > &modules, 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
 
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::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 wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- 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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
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

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  
)
inlineoverride

Definition at line 22 of file JetCorrectorDBWriter.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 44 of file JetCorrectorDBWriter.cc.

References algo, mps_setup::append, cond::service::PoolDBOutputService::appendSinceTime(), cond::service::PoolDBOutputService::beginOfTime(), gather_cfg::cout, cond::service::PoolDBOutputService::createNewIOV(), DEFINE_FWK_MODULE, cond::service::PoolDBOutputService::endOfTime(), era, JetCorrectorParametersCollection::findLabel(), edm::FileInPath::fullPath(), JetCorrectorParametersCollection::getSections(), mps_fire::i, inputTxtFile, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), JetCorrectorParametersCollection::N_LEVELS, path, jets_cff::payload, payloadTag, JetCorrectorParametersCollection::push_back(), alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

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;
90  else
92  }
93  std::cout << "Wrote in CondDB payload label: " << payloadTag << std::endl;
94 }
static std::string findLabel(key_type k)
void push_back(key_type i, value_type const &j, label_type const &flav="")
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
bool isNewTagRequest(const std::string &recordName)
bool isAvailable() const
Definition: Service.h:40
void createNewIOV(T *firstPayloadObj, cond::Time_t firstSinceTime, cond::Time_t firstTillTime, const std::string &recordName, bool withlogging=false)
static void getSections(std::string inputFile, std::vector< std::string > &outputs)
void JetCorrectorDBWriter::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

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().