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
 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
 
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 payloadTag
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- 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 17 of file JetCorrectorDBWriter.cc.

Constructor & Destructor Documentation

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

Definition at line 34 of file JetCorrectorDBWriter.cc.

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

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

Definition at line 24 of file JetCorrectorDBWriter.cc.

24 {}

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 22 of file JetCorrectorDBWriter.cc.

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

Reimplemented from edm::EDAnalyzer.

Definition at line 43 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, input, inputTxtFile, edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::isNewTagRequest(), JetCorrectorParametersCollection::N_LEVELS, cmsHarvester::path, 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 
51  std::string append("_");
52  std::string ilev = JetCorrectorParametersCollection::findLabel( static_cast<JetCorrectorParametersCollection::Level_t>(i) );
53  append += ilev;
54  append += "_";
55  append += algo;
56  append += ".txt";
58  std::ifstream input( ("../../../"+inputTxtFile).c_str() );
59  if ( input.good() ) {
61  std::cout << "Opened file " << inputTxtFile << std::endl;
62  // create the parameter object from file
63  std::vector<std::string> sections;
65  if ( sections.size() == 0 ) {
66  payload->push_back( i, JetCorrectorParameters(fip.fullPath(),"") );
67  }
68  else {
69  for ( std::vector<std::string>::const_iterator isectbegin = sections.begin(), isectend = sections.end(), isect = isectbegin;
70  isect != isectend; ++isect ) {
71  payload->push_back( i, JetCorrectorParameters(fip.fullPath(),*isect), ilev + "_" + *isect );
72  std::cout << "Added " << ilev + "_" + *isect << " to record " << i << std::endl;
73  }
74  }
75  std::cout << "Added record " << i << std::endl;
76  } else {
77  std::cout << "Did not find JEC file " << inputTxtFile << std::endl;
78  }
79 
80  }
81 
82  std::cout << "Opening PoolDBOutputService" << std::endl;
83 
84  // now write it into the DB
86  if (s.isAvailable())
87  {
88  std::cout << "Setting up payload tag " << payloadTag << std::endl;
89  if (s->isNewTagRequest(payloadTag))
91  else
93  }
94  std::cout << "Wrote in CondDB payload label: " << payloadTag << std::endl;
95 }
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="")
static std::string const input
Definition: EdmProvDump.cc:44
void appendSinceTime(T *payloadObj, cond::Time_t sinceTime, const std::string &recordName, bool withlogging=false)
tuple path
else: Piece not in the list, fine.
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 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 29 of file JetCorrectorDBWriter.cc.

Referenced by beginJob().

std::string JetCorrectorDBWriter::payloadTag
private

Definition at line 30 of file JetCorrectorDBWriter.cc.

Referenced by beginJob(), and JetCorrectorDBWriter().