CMS 3D CMS Logo

RNTupleFieldPtr.h
Go to the documentation of this file.
1 #ifndef PhysicsTools_NanoAOD_RNTupleFieldPtr_h
2 #define PhysicsTools_NanoAOD_RNTupleFieldPtr_h
3 
4 #include <ROOT/RNTupleModel.hxx>
5 using ROOT::Experimental::RNTupleModel;
6 
7 template <typename T>
9 public:
10  RNTupleFieldPtr() = default;
11  explicit RNTupleFieldPtr(const std::string& name, const std::string& desc, RNTupleModel& model) : m_name(name) {
12  m_field = model.MakeField<T>({m_name, desc});
13  }
14  void fill(const T& value) { *m_field = value; }
15  const std::string& getFieldName() const { return m_name; }
16 
17 private:
19  std::shared_ptr<T> m_field;
20 };
21 
22 #endif
std::string m_name
void fill(const T &value)
const std::string & getFieldName() const
RNTupleFieldPtr(const std::string &name, const std::string &desc, RNTupleModel &model)
std::shared_ptr< T > m_field
Definition: value.py:1
RNTupleFieldPtr()=default
long double T