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 &&)=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
 
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::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

Definition at line 18 of file JetCorrectorDBWriter.cc.

Constructor & Destructor Documentation

◆ JetCorrectorDBWriter()

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

Definition at line 35 of file JetCorrectorDBWriter.cc.

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 }

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

◆ ~JetCorrectorDBWriter()

JetCorrectorDBWriter::~JetCorrectorDBWriter ( )
inlineoverride

Definition at line 24 of file JetCorrectorDBWriter.cc.

24 {}

Member Function Documentation

◆ analyze()

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

Implements edm::EDAnalyzer.

Definition at line 22 of file JetCorrectorDBWriter.cc.

22 {}

◆ beginJob()

void JetCorrectorDBWriter::beginJob ( void  )
overridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 44 of file JetCorrectorDBWriter.cc.

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  if (s->isNewTagRequest(payloadTag))
89  s->createNewIOV<JetCorrectorParametersCollection>(payload, s->beginOfTime(), s->endOfTime(), payloadTag);
90  else
91  s->appendSinceTime<JetCorrectorParametersCollection>(payload, 111, payloadTag);
92  }
93  std::cout << "Wrote in CondDB payload label: " << payloadTag << std::endl;
94 }

References algo, mps_setup::append, gather_cfg::cout, era, JetCorrectorParametersCollection::findLabel(), edm::FileInPath::fullPath(), JetCorrectorParametersCollection::getSections(), mps_fire::i, inputTxtFile, JetCorrectorParametersCollection::N_LEVELS, path, jets_cff::payload, payloadTag, alignCSCRings::s, and AlCaHLTBitMon_QueryRunRegistry::string.

◆ endJob()

void JetCorrectorDBWriter::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 23 of file JetCorrectorDBWriter.cc.

23 {}

Member Data Documentation

◆ algo

std::string JetCorrectorDBWriter::algo
private

Definition at line 28 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().

◆ era

std::string JetCorrectorDBWriter::era
private

Definition at line 27 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().

◆ inputTxtFile

std::string JetCorrectorDBWriter::inputTxtFile
private

Definition at line 30 of file JetCorrectorDBWriter.cc.

Referenced by beginJob().

◆ path

std::string JetCorrectorDBWriter::path
private

◆ payloadTag

std::string JetCorrectorDBWriter::payloadTag
private

Definition at line 31 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().

JetCorrectorDBWriter::algo
std::string algo
Definition: JetCorrectorDBWriter.cc:28
mps_fire.i
i
Definition: mps_fire.py:428
JetCorrectorParametersCollection
Definition: JetCorrectorParameters.h:148
JetCorrectorDBWriter::payloadTag
std::string payloadTag
Definition: JetCorrectorDBWriter.cc:31
gather_cfg.cout
cout
Definition: gather_cfg.py:144
JetCorrectorParametersCollection::N_LEVELS
Definition: JetCorrectorParameters.h:194
JetCorrectorParametersCollection::getSections
static void getSections(std::string inputFile, std::vector< std::string > &outputs)
Definition: JetCorrectorParameters.cc:428
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::Exception
Definition: EDMException.h:77
edm::FileInPath
Definition: FileInPath.h:61
alignCSCRings.s
s
Definition: alignCSCRings.py:92
JetCorrectorDBWriter::inputTxtFile
std::string inputTxtFile
Definition: JetCorrectorDBWriter.cc:30
jets_cff.payload
payload
Definition: jets_cff.py:32
JetCorrectorDBWriter::path
std::string path
Definition: JetCorrectorDBWriter.cc:29
mps_setup.append
append
Definition: mps_setup.py:85
edm::Service< cond::service::PoolDBOutputService >
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
JetCorrectorDBWriter::era
std::string era
Definition: JetCorrectorDBWriter.cc:27
JetCorrectorParameters
Definition: JetCorrectorParameters.h:25
JetCorrectorParametersCollection::findLabel
static std::string findLabel(key_type k)
Definition: JetCorrectorParameters.cc:405