PandaTree
Vertex.h
1 #ifndef PandaTree_Objects_Vertex_h
2 #define PandaTree_Objects_Vertex_h
3 #include "Constants.h"
4 #include "../../Framework/interface/Element.h"
5 #include "../../Framework/interface/Array.h"
6 #include "../../Framework/interface/Collection.h"
7 #include "../../Framework/interface/Ref.h"
8 #include "../../Framework/interface/RefVector.h"
9 
10 namespace panda {
11 
12  class Vertex : public Element {
13  public:
14  struct datastore : public Element::datastore {
16  ~datastore() { deallocate(); }
17 
18  Float_t* x{0};
19  Float_t* y{0};
20  Float_t* z{0};
21 
22  void allocate(UInt_t n) override;
23  void deallocate() override;
24  void setStatus(TTree&, TString const&, utils::BranchList const&) override;
25  utils::BranchList getStatus(TTree&, TString const&) const override;
26  utils::BranchList getBranchNames(TString const& = "") const override;
27  void setAddress(TTree&, TString const&, utils::BranchList const& = {"*"}, Bool_t setStatus = kTRUE) override;
28  void book(TTree&, TString const&, utils::BranchList const& = {"*"}, Bool_t dynamic = kTRUE) override;
29  void releaseTree(TTree&, TString const&) override;
30  void resizeVectors_(UInt_t) override;
31  };
32 
33  typedef Array<Vertex> array_type;
35 
36  typedef Element base_type;
37 
38  Vertex(char const* name = "");
39  Vertex(Vertex const&);
40  Vertex(datastore&, UInt_t idx);
41  ~Vertex();
42  Vertex& operator=(Vertex const&);
43 
44  static char const* typeName() { return "Vertex"; }
45 
46  void print(std::ostream& = std::cout, UInt_t level = 1) const override;
47  void dump(std::ostream& = std::cout) const override;
48 
49  TVector3 position() const { return TVector3(x, y, z); }
50 
51  Float_t& x;
52  Float_t& y;
53  Float_t& z;
54 
55  /* BEGIN CUSTOM Vertex.h.classdef */
56  /* END CUSTOM */
57 
58  static utils::BranchList getListOfBranches();
59 
60  void destructor(Bool_t recursive = kFALSE);
61 
62  protected:
63  Vertex(ArrayBase*);
64 
65  void doBook_(TTree&, TString const&, utils::BranchList const& = {"*"}) override;
66  void doInit_() override;
67  };
68 
69  typedef Array<Vertex> VertexArray;
71  typedef Ref<Vertex> VertexRef;
73 
74  /* BEGIN CUSTOM Vertex.h.global */
75  /* END CUSTOM */
76 
77 }
78 
79 #endif
Base class for fixed-size containers.
Definition: ArrayBase.h:13
A reference to an element in a container.
Definition: Ref.h:20
Definition: Vertex.h:12
Base class for dynamic-size containers.
Definition: CollectionBase.h:16
Template class for fixed-size container implementations. Inherits from base_type::array_type of the e...
Definition: Array.h:20
Definition: Vertex.h:14
List of branch names.
Definition: IOUtils.h:64
Definition: Element.h:45
void resizeVectors_(UInt_t) override
Override when there are vector members.
Definition: Vertex.cc:90
Template class for dynamic-size container implementations. Inherits from base_type::collection_type o...
Definition: Collection.h:19
void dump(std::ostream &=std::cout) const override
Dump the object content.
Definition: Vertex.cc:189
void print(std::ostream &=std::cout, UInt_t level=1) const override
Print the object content.
Definition: Vertex.cc:181
Base class for elements of containers.
Definition: Element.h:32
Definition: Array.h:11
A vector of references to elements in a container.
Definition: RefVector.h:18