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 Member Functions | Private Attributes
DBReader Class Reference

#include <DBReader.h>

Inheritance diagram for DBReader:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

void analyze (const edm::Event &, const edm::EventSetup &) override
 
 DBReader (const edm::ParameterSet &)
 
void initialize (const edm::EventSetup &iSetup)
 
 ~DBReader () 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
 
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 Member Functions

template<typename T >
void printParameters (const T &functionPtr)
 

Private Attributes

std::shared_ptr
< BackgroundFunction
background_
 
std::shared_ptr
< MomentumScaleCorrector
corrector_
 
std::shared_ptr
< ResolutionFunction
resolution_
 
std::string type_
 

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
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 24 of file DBReader.h.

Constructor & Destructor Documentation

DBReader::DBReader ( const edm::ParameterSet iConfig)
explicit

Definition at line 12 of file DBReader.cc.

12 : type_(iConfig.getUntrackedParameter<std::string>("Type")) {}
T getUntrackedParameter(std::string const &, T const &) const
std::string type_
Definition: DBReader.h:56
DBReader::~DBReader ( )
override

Definition at line 41 of file DBReader.cc.

41 {}

Member Function Documentation

void DBReader::analyze ( const edm::Event e,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDAnalyzer.

Definition at line 43 of file DBReader.cc.

References background_, corrector_, initialize(), printParameters(), resolution_, and type_.

43  {
44  initialize(iSetup);
45  if (type_ == "scale")
47  else if (type_ == "resolution")
49  else if (type_ == "background")
51 }
std::shared_ptr< MomentumScaleCorrector > corrector_
Definition: DBReader.h:58
std::shared_ptr< BackgroundFunction > background_
Definition: DBReader.h:60
void initialize(const edm::EventSetup &iSetup)
Definition: DBReader.cc:14
std::string type_
Definition: DBReader.h:56
void printParameters(const T &functionPtr)
Definition: DBReader.h:35
std::shared_ptr< ResolutionFunction > resolution_
Definition: DBReader.h:59
void DBReader::initialize ( const edm::EventSetup iSetup)

Definition at line 14 of file DBReader.cc.

References background_, corrector_, gather_cfg::cout, beamvalidation::exit(), edm::EventSetup::get(), edm::ESHandle< class >::product(), resolution_, and type_.

Referenced by analyze().

14  {
16  iSetup.get<MuScleFitDBobjectRcd>().get(dbObject);
17  edm::LogInfo("DBReader") << "[DBReader::analyze] End Reading MuScleFitDBobjectRcd" << std::endl;
18 
19  std::cout << "identifiers size from dbObject = " << dbObject->identifiers.size() << std::endl;
20  std::cout << "parameters size from dbObject = " << dbObject->parameters.size() << std::endl;
21  ;
22 
23  // This string is one of: scale, resolution, background.
24  // Create the corrector and set the parameters
25  if (type_ == "scale")
26  corrector_.reset(new MomentumScaleCorrector(dbObject.product()));
27  else if (type_ == "resolution")
28  resolution_.reset(new ResolutionFunction(dbObject.product()));
29  else if (type_ == "background")
30  background_.reset(new BackgroundFunction(dbObject.product()));
31  else {
32  std::cout << "Error: unrecognized type. Use one of those: 'scale', 'resolution', 'background'" << std::endl;
33  exit(1);
34  }
35 
36  // cout << "pointer = " << corrector_.get() << endl;
37 }
std::shared_ptr< MomentumScaleCorrector > corrector_
Definition: DBReader.h:58
std::shared_ptr< BackgroundFunction > background_
Definition: DBReader.h:60
std::string type_
Definition: DBReader.h:56
std::shared_ptr< ResolutionFunction > resolution_
Definition: DBReader.h:59
Log< level::Info, false > LogInfo
T const * product() const
Definition: ESHandle.h:86
T get() const
Definition: EventSetup.h:88
tuple cout
Definition: gather_cfg.py:144
template<typename T >
void DBReader::printParameters ( const T functionPtr)
inlineprivate

Definition at line 35 of file DBReader.h.

References gather_cfg::cout, and gpuClustering::id.

Referenced by analyze().

35  {
36  // Looping directly on it does not work, because it is returned by value
37  // and the iterator gets invalidated on the next line. Save it to a temporary object
38  // and iterate on it.
39  std::vector<double> parVecVec(functionPtr->parameters());
40  std::vector<double>::const_iterator parVec = parVecVec.begin();
41  std::vector<int> functionId(functionPtr->identifiers());
42  std::vector<int>::const_iterator id = functionId.begin();
43  std::cout << "total number of parameters read from database = parVecVec.size() = " << parVecVec.size() << std::endl;
44  int iFunc = 0;
45  for (; id != functionId.end(); ++id, ++iFunc) {
46  int parNum = functionPtr->function(iFunc)->parNum();
47  std::cout << "For function id = " << *id << ", with " << parNum << " parameters: " << std::endl;
48  for (int par = 0; par < parNum; ++par) {
49  std::cout << "par[" << par << "] = " << *parVec << std::endl;
50  ++parVec;
51  }
52  }
53  }
uint16_t *__restrict__ id
tuple cout
Definition: gather_cfg.py:144

Member Data Documentation

std::shared_ptr<BackgroundFunction> DBReader::background_
private

Definition at line 60 of file DBReader.h.

Referenced by analyze(), and initialize().

std::shared_ptr<MomentumScaleCorrector> DBReader::corrector_
private

Definition at line 58 of file DBReader.h.

Referenced by analyze(), and initialize().

std::shared_ptr<ResolutionFunction> DBReader::resolution_
private

Definition at line 59 of file DBReader.h.

Referenced by analyze(), and initialize().

std::string DBReader::type_
private