1 #ifndef MuonTools_MuDigiBaseProducer_h 2 #define MuonTools_MuDigiBaseProducer_h 21 template <
class DETECTOR_T,
class DIGI_T>
30 std::vector<std::unique_ptr<Variable<DETECTOR_T>>>
detIdVars_;
41 std::unique_ptr<Variable<DETECTOR_T>> detVarPtr;
44 detVarPtr =
std::move(std::make_unique<IntDetVar>(
name, varCfg));
45 }
else if (
type ==
"uint") {
46 detVarPtr =
std::move(std::make_unique<UIntDetVar>(
name, varCfg));
47 }
else if (
type ==
"int16") {
48 detVarPtr =
std::move(std::make_unique<Int16DetVar>(
name, varCfg));
49 }
else if (
type ==
"uint8") {
50 detVarPtr =
std::move(std::make_unique<UInt8DetVar>(
name, varCfg));
65 edm::Comment comType{
"the c++ type of the branch in the flat table"};
66 edm::Comment comPrecision{
"the precision with which to store the value in the flat table"};
68 variable.add<
std::string>(
"expr")->setComment(
"a function to define the content of the branch in the flat table");
69 variable.add<
std::string>(
"doc")->setComment(
"few words description of the branch content");
70 variable.addUntracked<
bool>(
"lazyEval")->setComment(
"set to True if the type read from the Event is unknown");
73 edm::allowedValues<std::string>(
"int",
"uint",
"int16",
"uint8"));
77 variables.setComment(
"a parameters set to define all variable taken form detId to fill the flat table");
89 std::vector<const DIGI_T *> digis;
90 std::vector<const DETECTOR_T *> detIds;
91 std::list<DETECTOR_T> detIdObjs;
94 auto detIdIt =
prod->begin();
95 auto detIdEnd =
prod->end();
97 for (; detIdIt != detIdEnd; ++detIdIt) {
99 detIdObjs.push_back(
detId);
100 std::fill_n(std::back_inserter(detIds),
range.second -
range.first, &detIdObjs.back());
105 auto table = std::make_unique<nanoaod::FlatTable>(digis.size(), this->
name_,
false, this->
extension_);
107 for (
const auto &
var : this->
vars_) {
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
T getParameter(std::string const &) const
std::unique_ptr< nanoaod::FlatTable > fillTable(const edm::Event &iEvent, const edm::Handle< COLLECTION > &prod) const override
constexpr char const * varNames[]
MuDigiBaseProducer(edm::ParameterSet const ¶ms)
~MuDigiBaseProducer() override
std::vector< std::unique_ptr< Variable< DIGI_T > > > vars_
std::vector< std::unique_ptr< Variable< DETECTOR_T > > > detIdVars_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
static edm::ParameterSetDescription baseDescriptions()
A container for a generic type of digis indexed by some index, implemented with a map<IndexType...