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 Attributes
JetCorrectorDBWriter Class Reference
Inheritance diagram for JetCorrectorDBWriter:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

virtual void analyze (const edm::Event &, const edm::EventSetup &) override
 
virtual void beginJob () override
 
virtual void endJob () override
 
 JetCorrectorDBWriter (const edm::ParameterSet &)
 
 ~JetCorrectorDBWriter ()
 
- 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 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 &)
 
- 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

Definition at line 18 of file JetCorrectorDBWriter.cc.

Constructor & Destructor Documentation

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

Definition at line 36 of file JetCorrectorDBWriter.cc.

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

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

Definition at line 25 of file JetCorrectorDBWriter.cc.

25 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 23 of file JetCorrectorDBWriter.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 46 of file JetCorrectorDBWriter.cc.

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

47 {
48 // std::string path("CondFormats/JetMETObjects/data/");
49 
51  std::cout << "Starting to import payload " << payloadTag << " from text files." << std::endl;
52  for ( int i = 0; i < JetCorrectorParametersCollection::N_LEVELS; ++i ) {
53 
54  std::string append("_");
55  std::string ilev = JetCorrectorParametersCollection::findLabel( static_cast<JetCorrectorParametersCollection::Level_t>(i) );
56  append += ilev;
57  append += "_";
58  append += algo;
59  append += ".txt";
61  try {
63  std::cout << "Opened file " << inputTxtFile << std::endl;
64  // create the parameter object from file
65  std::vector<std::string> sections;
66  JetCorrectorParametersCollection::getSections(fip.fullPath(), sections );
67  if ( sections.size() == 0 ) {
68  payload->push_back( i, JetCorrectorParameters(fip.fullPath(),"") );
69  }
70  else {
71  for ( std::vector<std::string>::const_iterator isectbegin = sections.begin(), isectend = sections.end(), isect = isectbegin;
72  isect != isectend; ++isect ) {
73  payload->push_back( i, JetCorrectorParameters(fip.fullPath(),*isect), ilev + "_" + *isect );
74  std::cout << "Added " << ilev + "_" + *isect << " to record " << i << std::endl;
75  }
76  }
77  std::cout << "Added record " << i << std::endl;
78  }
79  catch(edm::Exception ex) {
80  std::cout << "Did not find JEC file " << inputTxtFile << std::endl;
81  }
82 
83  }
84 
85  std::cout << "Opening PoolDBOutputService" << std::endl;
86 
87  // now write it into the DB
89  if (s.isAvailable())
90  {
91  std::cout << "Setting up payload tag " << payloadTag << std::endl;
92  if (s->isNewTagRequest(payloadTag))
94  else
96  }
97  std::cout << "Wrote in CondDB payload label: " << payloadTag << std::endl;
98 }
int i
Definition: DBlmapReader.cc:9
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:46
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)
tuple cout
Definition: gather_cfg.py:121
virtual void JetCorrectorDBWriter::endJob ( void  )
inlineoverridevirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 24 of file JetCorrectorDBWriter.cc.

24 {}

Member Data Documentation

std::string JetCorrectorDBWriter::algo
private

Definition at line 29 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().

std::string JetCorrectorDBWriter::era
private

Definition at line 28 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().

std::string JetCorrectorDBWriter::inputTxtFile
private

Definition at line 31 of file JetCorrectorDBWriter.cc.

Referenced by beginJob().

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

Definition at line 32 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().