CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Static 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
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Protected Types

typedef VariableT< bool > 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_
 
std::vector< std::unique_ptr< Variable > > vars_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Definition at line 14 of file GlobalVariablesTableProducer.cc.

Member Typedef Documentation

◆ BoolVar

Definition at line 173 of file GlobalVariablesTableProducer.cc.

◆ CandidateScalarSumVar

Definition at line 175 of file GlobalVariablesTableProducer.cc.

◆ CandidateSizeVar

Definition at line 177 of file GlobalVariablesTableProducer.cc.

◆ CandidateSumMassVar

Definition at line 176 of file GlobalVariablesTableProducer.cc.

◆ DoubleVar

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

Definition at line 172 of file GlobalVariablesTableProducer.cc.

◆ FloatVar

Definition at line 171 of file GlobalVariablesTableProducer.cc.

◆ IntVar

Definition at line 170 of file GlobalVariablesTableProducer.cc.

Constructor & Destructor Documentation

◆ GlobalVariablesTableProducer()

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

Definition at line 16 of file GlobalVariablesTableProducer.cc.

References Exception, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), submitPVValidationJobs::params, AlCaHLTBitMon_QueryRunRegistry::string, and vars_.

17  : name_(params.getParameter<std::string>("name")), extension_(params.getParameter<bool>("extension")) {
18  edm::ParameterSet const& varsPSet = params.getParameter<edm::ParameterSet>("variables");
19  for (const std::string& vname : varsPSet.getParameterNamesForType<edm::ParameterSet>()) {
20  const auto& varPSet = varsPSet.getParameter<edm::ParameterSet>(vname);
21  const std::string& type = varPSet.getParameter<std::string>("type");
22  if (type == "int")
23  vars_.push_back(std::make_unique<IntVar>(vname, varPSet, consumesCollector()));
24  else if (type == "float")
25  vars_.push_back(std::make_unique<FloatVar>(vname, varPSet, consumesCollector()));
26  else if (type == "double")
27  vars_.push_back(std::make_unique<DoubleVar>(vname, varPSet, consumesCollector()));
28  else if (type == "bool")
29  vars_.push_back(std::make_unique<BoolVar>(vname, varPSet, consumesCollector()));
30  else if (type == "candidatescalarsum")
31  vars_.push_back(std::make_unique<CandidateScalarSumVar>(vname, varPSet, consumesCollector()));
32  else if (type == "candidatesize")
33  vars_.push_back(std::make_unique<CandidateSizeVar>(vname, varPSet, consumesCollector()));
34  else if (type == "candidatesummass")
35  vars_.push_back(std::make_unique<CandidateSumMassVar>(vname, varPSet, consumesCollector()));
36  else
37  throw cms::Exception("Configuration", "unsupported type " + type + " for variable " + vname);
38  }
39 
40  produces<nanoaod::FlatTable>();
41  }
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:179
std::vector< std::unique_ptr< Variable > > vars_

◆ ~GlobalVariablesTableProducer()

GlobalVariablesTableProducer::~GlobalVariablesTableProducer ( )
inlineoverride

Definition at line 43 of file GlobalVariablesTableProducer.cc.

43 {}

Member Function Documentation

◆ fillDescriptions()

static void GlobalVariablesTableProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
inlinestatic

Definition at line 45 of file GlobalVariablesTableProducer.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, edm::RequireZeroOrMore, AlCaHLTBitMon_QueryRunRegistry::string, taus_updatedMVAIds_cff::variable, and hcalRecHitTable_cff::variables.

45  {
47  desc.add<std::string>("name", "")->setComment("name of the branch in the flat table output");
48  desc.add<bool>("extension", false)->setComment("whether or not to extend an existing same table");
51  "type", "int", true, edm::Comment("the c++ type of the branch in the flat table")),
52  edm::allowedValues<std::string>(
53  "int", "float", "double", "bool", "candidatescalarsum", "candidatesize", "candidatesummass"));
54  variable.add<edm::InputTag>("src")->setComment("input collection for the branch");
55  variable.add<std::string>("doc")->setComment("few words description of the branch content");
56  variable.add<int>("precision", -1)->setComment("precision to store the information");
58  variables.setComment("a parameters set to define variable to fill the flat table");
59  variables.addNode(
61  desc.add<edm::ParameterSetDescription>("variables", variables);
62 
63  descriptions.addWithDefaultLabel(desc);
64  }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ produce()

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

Definition at line 65 of file GlobalVariablesTableProducer.cc.

References extension_, iEvent, eostools::move(), name_, MillePedeFileConverter_cfg::out, trigObjTnPSource_cfi::var, and vars_.

65  {
66  auto out = std::make_unique<nanoaod::FlatTable>(1, this->name_, true, this->extension_);
67 
68  for (const auto& var : vars_)
69  var->fill(iEvent, *out);
70 
71  iEvent.put(std::move(out));
72  }
int iEvent
Definition: GenABIO.cc:224
std::vector< std::unique_ptr< Variable > > vars_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ extension_

const bool GlobalVariablesTableProducer::extension_
protected

Definition at line 180 of file GlobalVariablesTableProducer.cc.

Referenced by produce().

◆ name_

const std::string GlobalVariablesTableProducer::name_
protected

Definition at line 179 of file GlobalVariablesTableProducer.cc.

Referenced by produce().

◆ vars_

std::vector<std::unique_ptr<Variable> > GlobalVariablesTableProducer::vars_
protected

Definition at line 178 of file GlobalVariablesTableProducer.cc.

Referenced by GlobalVariablesTableProducer(), and produce().