1 #ifndef PandaTree_Objects_Particle_h 2 #define PandaTree_Objects_Particle_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" 18 void allocate(UInt_t n)
override;
19 void deallocate()
override;
23 void setAddress(TTree&, TString
const&,
utils::BranchList const& = {
"*"}, Bool_t setStatus = kTRUE)
override;
24 void book(TTree&, TString
const&,
utils::BranchList const& = {
"*"}, Bool_t dynamic = kTRUE)
override;
25 void releaseTree(TTree&, TString
const&)
override;
38 static char const* typeName() {
return "Particle"; }
40 void print(std::ostream& = std::cout, UInt_t level = 1)
const override;
41 void dump(std::ostream& = std::cout)
const override;
43 TLorentzVector p4()
const { TLorentzVector p4; p4.SetPtEtaPhiM(pt(), eta(), phi(), m());
return p4; }
44 double e()
const {
return std::sqrt(std::pow(pt() * std::cosh(eta()), 2.) + m() * m()); }
45 double p()
const {
return pt() * std::cosh(eta()); }
46 double px()
const {
return pt() * std::cos(phi()); }
47 double py()
const {
return pt() * std::sin(phi()); }
48 double pz()
const {
return pt() * std::sinh(eta()); }
49 virtual double pt()
const = 0;
50 virtual double eta()
const = 0;
51 virtual double phi()
const = 0;
52 virtual double m()
const = 0;
53 double dEta(
Particle const& p)
const {
return eta() - p.eta(); }
54 double dPhi(
Particle const& p)
const {
return TVector2::Phi_mpi_pi(phi() - p.phi()); }
55 double dR2(
Particle const& p)
const {
double d1(dEta(p));
double d2(dPhi(p));
return d1 * d1 + d2 * d2; }
56 double dR(
Particle const& p)
const {
return std::sqrt(dR2(p)); }
57 virtual void setPtEtaPhiM(
double pt,
double eta,
double phi,
double m) = 0;
58 virtual void setXYZE(
double px,
double py,
double pz,
double e) = 0;
67 return static_cast<Particle const&
>(p1).pt() >
static_cast<Particle const&
>(p2).pt();
73 void destructor(Bool_t recursive = kFALSE);
79 void doInit_()
override;
Base class for fixed-size containers.
Definition: ArrayBase.h:13
A reference to an element in a container.
Definition: Ref.h:20
void dump(std::ostream &=std::cout) const override
Dump the object content.
Definition: Particle.cc:132
Definition: Particle.h:12
Base class for dynamic-size containers.
Definition: CollectionBase.h:16
static Bool_t PtGreater(Element const &p1, Element const &p2)
sort comparison by pt
Definition: Particle.h:66
void resizeVectors_(UInt_t) override
Override when there are vector members.
Definition: Particle.cc:65
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: Particle.cc:124
Definition: Particle.h:14
Template class for dynamic-size container implementations. Inherits from base_type::collection_type o...
Definition: Collection.h:19
Base class for elements of containers.
Definition: Element.h:32
A vector of references to elements in a container.
Definition: RefVector.h:18