CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Protected Types | Protected Attributes
GlobalVariablesTableProducer Class Reference
Inheritance diagram for GlobalVariablesTableProducer:
edm::stream::EDProducer<>

Classes

class  Identity
 
class  MassSum
 
class  Max
 
class  Min
 
class  PtVectorSum
 
class  ScalarPtSum
 
class  Size
 
class  Variable
 
class  VariableT
 

Public Member Functions

 GlobalVariablesTableProducer (edm::ParameterSet const &params)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
 ~GlobalVariablesTableProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () const final
 

Protected Types

typedef VariableT< bool, uint8_t > BoolVar
 
typedef VariableT< edm::View< reco::Candidate >, float, ScalarPtSum< float, edm::View< reco::Candidate > > > CandidateScalarSumVar
 
typedef VariableT< edm::View< reco::Candidate >, int, Size< edm::View< reco::Candidate > > > CandidateSizeVar
 
typedef VariableT< edm::View< reco::Candidate >, float, MassSum< float, edm::View< reco::Candidate > > > CandidateSumMassVar
 
typedef VariableT< double, float > DoubleVar
 
typedef VariableT< float > FloatVar
 
typedef VariableT< int > IntVar
 

Protected Attributes

const bool extension_
 
const std::string name_
 
boost::ptr_vector< Variablevars_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

Detailed Description

Definition at line 11 of file GlobalVariablesTableProducer.cc.

Member Typedef Documentation

typedef VariableT<bool,uint8_t> GlobalVariablesTableProducer::BoolVar
protected

Definition at line 138 of file GlobalVariablesTableProducer.cc.

Definition at line 139 of file GlobalVariablesTableProducer.cc.

Definition at line 141 of file GlobalVariablesTableProducer.cc.

Definition at line 140 of file GlobalVariablesTableProducer.cc.

typedef VariableT<double,float> GlobalVariablesTableProducer::DoubleVar
protected

Definition at line 137 of file GlobalVariablesTableProducer.cc.

Definition at line 136 of file GlobalVariablesTableProducer.cc.

Definition at line 135 of file GlobalVariablesTableProducer.cc.

Constructor & Destructor Documentation

GlobalVariablesTableProducer::GlobalVariablesTableProducer ( edm::ParameterSet const &  params)
inline

Definition at line 14 of file GlobalVariablesTableProducer.cc.

References nanoaod::FlatTable::BoolColumn, Exception, nanoaod::FlatTable::FloatColumn, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), nanoaod::FlatTable::IntColumn, AlCaHLTBitMon_QueryRunRegistry::string, and vars_.

15  : name_(params.existsAs<std::string>("name") ? params.getParameter<std::string>("name") : ""),
16  extension_(params.existsAs<bool>("extension") ? params.getParameter<bool>("extension") : false) {
17  edm::ParameterSet const & varsPSet = params.getParameter<edm::ParameterSet>("variables");
18  for (const std::string & vname : varsPSet.getParameterNamesForType<edm::ParameterSet>()) {
19  const auto & varPSet = varsPSet.getParameter<edm::ParameterSet>(vname);
20  const std::string & type = varPSet.getParameter<std::string>("type");
21  if (type == "int") vars_.push_back(new IntVar(vname, nanoaod::FlatTable::IntColumn, varPSet, consumesCollector()));
22  else if (type == "float") vars_.push_back(new FloatVar(vname, nanoaod::FlatTable::FloatColumn, varPSet, consumesCollector()));
23  else if (type == "double") vars_.push_back(new DoubleVar(vname, nanoaod::FlatTable::FloatColumn, varPSet, consumesCollector()));
24  else if (type == "bool") vars_.push_back(new BoolVar(vname, nanoaod::FlatTable::BoolColumn, varPSet, consumesCollector()));
25  else if (type == "candidatescalarsum") vars_.push_back(new CandidateScalarSumVar(vname, nanoaod::FlatTable::FloatColumn, varPSet, consumesCollector()));
26  else if (type == "candidatesize") vars_.push_back(new CandidateSizeVar(vname, nanoaod::FlatTable::IntColumn, varPSet, consumesCollector()));
27  else if (type == "candidatesummass") vars_.push_back(new CandidateSumMassVar(vname, nanoaod::FlatTable::FloatColumn, varPSet, consumesCollector()));
28  else throw cms::Exception("Configuration", "unsupported type "+type+" for variable "+vname);
29  }
30 
31  produces<nanoaod::FlatTable>();
32  }
type
Definition: HCALResponse.h:21
T getParameter(std::string const &) const
VariableT< edm::View< reco::Candidate >, int, Size< edm::View< reco::Candidate > > > CandidateSizeVar
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:169
VariableT< edm::View< reco::Candidate >, float, ScalarPtSum< float, edm::View< reco::Candidate > > > CandidateScalarSumVar
boost::ptr_vector< Variable > vars_
VariableT< edm::View< reco::Candidate >, float, MassSum< float, edm::View< reco::Candidate > > > CandidateSumMassVar
GlobalVariablesTableProducer::~GlobalVariablesTableProducer ( )
inlineoverride

Definition at line 34 of file GlobalVariablesTableProducer.cc.

34 {}

Member Function Documentation

void GlobalVariablesTableProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
inlineoverride

Definition at line 36 of file GlobalVariablesTableProducer.cc.

References extension_, eostools::move(), name_, MillePedeFileConverter_cfg::out, edm::Event::put(), JetChargeProducer_cfi::var, and vars_.

36  {
37  auto out = std::make_unique<nanoaod::FlatTable>(1, this->name_, true, this->extension_);
38 
39  for (const auto & var : vars_) var.fill(iEvent, *out);
40 
41  iEvent.put(std::move(out));
42  }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:125
boost::ptr_vector< Variable > vars_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

const bool GlobalVariablesTableProducer::extension_
protected

Definition at line 143 of file GlobalVariablesTableProducer.cc.

Referenced by produce().

const std::string GlobalVariablesTableProducer::name_
protected

Definition at line 142 of file GlobalVariablesTableProducer.cc.

Referenced by produce().

boost::ptr_vector<Variable> GlobalVariablesTableProducer::vars_
protected

Definition at line 144 of file GlobalVariablesTableProducer.cc.

Referenced by GlobalVariablesTableProducer(), and produce().