13
13
#include " DataFormats/Candidate/interface/iterator_imp_specific.h"
14
14
15
15
#include " DataFormats/Math/interface/PtEtaPhiMass.h"
16
+ #include " DataFormats/GeometryVector/interface/GlobalVector.h"
17
+
16
18
17
19
namespace reco {
18
20
@@ -33,6 +35,9 @@ namespace reco {
33
35
34
36
typedef unsigned int index;
35
37
38
+ static double magd (GlobalVector v) { return std::sqrt (double (v.x ())*double (v.x ()) + double (v.y ())*double (v.y ()) + double (v.z ())*double (v.z ()) );}
39
+ static double dmass (GlobalVector v, double e) { double m2 = e*e-magd (v); return m2>0 ? std::sqrt (m2) : 0 ;}
40
+
36
41
// / default constructor
37
42
LeafCandidate () :
38
43
qx3_ (0 ), pt_(0 ), eta_(0 ), phi_(0 ), mass_(0 ),
@@ -65,19 +70,39 @@ namespace reco {
65
70
LeafCandidate ( Charge q, const LorentzVector & p4, const Point & vtx = Point ( 0 , 0 , 0 ),
66
71
int pdgId = 0 , int status = 0 , bool integerCharge = true ) :
67
72
qx3_ ( q ), pt_( p4.pt() ), eta_( p4.eta() ), phi_( p4.phi() ), mass_( p4.mass() ),
68
- vertex_ ( vtx ), pdgId_( pdgId ), status_( status ),
69
- cachePolarFixed_ ( false ), cacheCartesianFixed_( false ) {
73
+ vertex_ ( vtx ), pdgId_( pdgId ), status_( status ), p4Cartesian_(p4),
74
+ cachePolarFixed_ ( false ), cacheCartesianFixed_( true ) {
70
75
if ( integerCharge ) qx3_ *= 3 ;
71
76
}
72
77
// / constructor from values
73
78
LeafCandidate ( Charge q, const PolarLorentzVector & p4, const Point & vtx = Point ( 0 , 0 , 0 ),
74
79
int pdgId = 0 , int status = 0 , bool integerCharge = true ) :
75
80
qx3_ ( q ), pt_( p4.pt() ), eta_( p4.eta() ), phi_( p4.phi() ), mass_( p4.mass() ),
76
- vertex_ ( vtx ), pdgId_( pdgId ), status_( status ),
77
- cachePolarFixed_ ( false ), cacheCartesianFixed_( false ){
81
+ vertex_ ( vtx ), pdgId_( pdgId ), status_( status ), p4Polar_(p4),
82
+ cachePolarFixed_ ( true ), cacheCartesianFixed_( false ){
78
83
if ( integerCharge ) qx3_ *= 3 ;
79
84
}
80
85
86
+ // / constructor from values
87
+ LeafCandidate ( Charge q, const GlobalVector & p3, float iEnergy, bool massless, const Point & vtx = Point ( 0 , 0 , 0 ),
88
+ int pdgId = 0 , int status = 0 , bool integerCharge = true ) :
89
+ qx3_ ( q ), pt_( p3.perp() ), eta_( p3.eta() ), phi_( p3.phi() ), mass_(massless ? 0 . : dmass(p3,iEnergy) ),
90
+ vertex_ ( vtx ), pdgId_( pdgId ), status_( status ), p4Polar_(pt_,eta_,phi_,mass_), p4Cartesian_(p3.x(),p3.y(),p3.z(), massless ? magd(p3) : iEnergy),
91
+ cachePolarFixed_( true ), cacheCartesianFixed_( true ) {
92
+ if ( integerCharge ) qx3_ *= 3 ;
93
+ }
94
+
95
+
96
+ // / constructor from values
97
+ LeafCandidate ( Charge q, const GlobalVector & p3, float iEnergy, float imass, const Point & vtx = Point ( 0 , 0 , 0 ),
98
+ int pdgId = 0, int status = 0, bool integerCharge = true ) :
99
+ qx3_( q ), pt_( p3.perp() ), eta_( p3.eta() ), phi_( p3.phi() ), mass_(imass),
100
+ vertex_( vtx ), pdgId_( pdgId ), status_( status ), p4Polar_(pt_,eta_,phi_,mass_), p4Cartesian_(p3.x(),p3.y(),p3.z(), iEnergy),
101
+ cachePolarFixed_( true ), cacheCartesianFixed_( true ) {
102
+ if ( integerCharge ) qx3_ *= 3 ;
103
+ }
104
+
105
+
81
106
// / destructor
82
107
virtual ~LeafCandidate ();
83
108
// / first daughter const_iterator
@@ -133,7 +158,7 @@ namespace reco {
133
158
// / energy
134
159
virtual double energy () const GCC11_FINAL { cacheCartesian (); return p4Cartesian_.E (); }
135
160
// / transverse energy
136
- virtual double et () const GCC11_FINAL { cachePolar (); return p4Polar_.Et (); }
161
+ virtual double et () const GCC11_FINAL { cachePolar (); return (pt_<= 0 ) ? 0 : p4Polar_.Et (); }
137
162
// / mass
138
163
virtual float mass () const GCC11_FINAL { return mass_; }
139
164
// / mass squared
0 commit comments