PandaTree
SecondaryVertex.h
1 #ifndef PandaTree_Objects_SecondaryVertex_h
2 #define PandaTree_Objects_SecondaryVertex_h
3 #include "Constants.h"
4 #include "ParticleM.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 #include "PFCandBase.h"
10 
11 namespace panda {
12 
13  class SecondaryVertex : public ParticleM {
14  public:
15  struct datastore : public ParticleM::datastore {
17  ~datastore() { deallocate(); }
18 
19  Float_t* x{0};
20  Float_t* y{0};
21  Float_t* z{0};
22  UShort_t* ntrk{0};
23  Float_t* ndof{0};
24  Float_t* chi2{0};
25  ContainerBase const* daughtersContainer_{0};
26  std::vector<std::vector<Short_t>>* daughters_{0};
27  Float_t* significance{0};
28  Float_t* vtx3DVal{0};
29  Float_t* vtx3DeVal{0};
30 
31  void allocate(UInt_t n) override;
32  void deallocate() override;
33  void setStatus(TTree&, TString const&, utils::BranchList const&) override;
34  utils::BranchList getStatus(TTree&, TString const&) const override;
35  utils::BranchList getBranchNames(TString const& = "") const override;
36  void setAddress(TTree&, TString const&, utils::BranchList const& = {"*"}, Bool_t setStatus = kTRUE) override;
37  void book(TTree&, TString const&, utils::BranchList const& = {"*"}, Bool_t dynamic = kTRUE) override;
38  void releaseTree(TTree&, TString const&) override;
39  void resizeVectors_(UInt_t) override;
40  };
41 
44 
45  typedef ParticleM base_type;
46 
47  SecondaryVertex(char const* name = "");
49  SecondaryVertex(datastore&, UInt_t idx);
50  ~SecondaryVertex();
51  SecondaryVertex& operator=(SecondaryVertex const&);
52 
53  static char const* typeName() { return "SecondaryVertex"; }
54 
55  void print(std::ostream& = std::cout, UInt_t level = 1) const override;
56  void dump(std::ostream& = std::cout) const override;
57 
58  TVector3 position() const { return TVector3(x, y, z); }
59  double normChi2() const { return ndof != 0. ? chi2 / ndof : chi2 * 1.e+6; }
60 
61  Float_t& x;
62  Float_t& y;
63  Float_t& z;
64  UShort_t& ntrk;
65  Float_t& ndof;
66  Float_t& chi2;
67  RefVector<PFCandBase> daughters;
68  Float_t& significance;
69  Float_t& vtx3DVal;
70  Float_t& vtx3DeVal;
71 
72  /* BEGIN CUSTOM SecondaryVertex.h.classdef */
73  /* END CUSTOM */
74 
75  static utils::BranchList getListOfBranches();
76 
77  void destructor(Bool_t recursive = kFALSE);
78 
79  protected:
81 
82  void doBook_(TTree&, TString const&, utils::BranchList const& = {"*"}) override;
83  void doInit_() override;
84  };
85 
90 
91  /* BEGIN CUSTOM SecondaryVertex.h.global */
92  /* END CUSTOM */
93 
94 }
95 
96 #endif
Base class for fixed-size containers.
Definition: ArrayBase.h:13
A reference to an element in a container.
Definition: Ref.h:20
Base class for dynamic-size containers.
Definition: CollectionBase.h:16
void resizeVectors_(UInt_t) override
Override when there are vector members.
Definition: SecondaryVertex.cc:147
Template class for fixed-size container implementations. Inherits from base_type::array_type of the e...
Definition: Array.h:20
List of branch names.
Definition: IOUtils.h:64
void print(std::ostream &=std::cout, UInt_t level=1) const override
Print the object content.
Definition: SecondaryVertex.cc:297
Definition: SecondaryVertex.h:13
Base class for all containers.
Definition: ContainerBase.h:18
Definition: ParticleM.h:13
Definition: SecondaryVertex.h:15
void dump(std::ostream &=std::cout) const override
Dump the object content.
Definition: SecondaryVertex.cc:305
Definition: ParticleM.h:15
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