Skip to content

Commit

Permalink
Properly take care of hcalFraction in copy/move constructors and assi…
Browse files Browse the repository at this point in the history
…gnment operators
  • Loading branch information
gpetruc committed Oct 30, 2015
1 parent fb8d1df commit 96830d6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions DataFormats/PatCandidates/interface/PackedCandidate.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ namespace pat {
packedCovarianceDphiDphi_(0),
packedPuppiweight_(0),
packedPuppiweightNoLepDiff_(0),
hcalFraction_(0),
p4_(new PolarLorentzVector(0,0,0,0)), p4c_( new LorentzVector(0,0,0,0)),
vertex_(new Point(0,0,0)), dphi_(0), track_(nullptr), pdgId_(0),
qualityFlags_(0), pvRefKey_(reco::VertexRef::invalidKey()),
Expand All @@ -56,6 +57,7 @@ namespace pat {
explicit PackedCandidate( const reco::Candidate & c,
const reco::VertexRefProd &pvRefProd,
reco::VertexRef::key_type pvRefKey) :
packedPuppiweight_(0), packedPuppiweightNoLepDiff_(0), hcalFraction_(0),
p4_( new PolarLorentzVector(c.pt(), c.eta(), c.phi(), c.mass())),
p4c_( new LorentzVector(*p4_)), vertex_( new Point(c.vertex())), dphi_(0),
track_(nullptr), pdgId_(c.pdgId()), qualityFlags_(0), pvRefProd_(pvRefProd),
Expand All @@ -69,6 +71,7 @@ namespace pat {
float phiAtVtx, int pdgId,
const reco::VertexRefProd &pvRefProd,
reco::VertexRef::key_type pvRefKey) :
packedPuppiweight_(0), packedPuppiweightNoLepDiff_(0), hcalFraction_(0),
p4_( new PolarLorentzVector(p4) ), p4c_( new LorentzVector(*p4_)),
vertex_( new Point(vtx) ), dphi_(reco::deltaPhi(phiAtVtx,p4_.load()->phi())),
track_(nullptr), pdgId_(pdgId),
Expand All @@ -82,6 +85,7 @@ namespace pat {
float phiAtVtx, int pdgId,
const reco::VertexRefProd &pvRefProd,
reco::VertexRef::key_type pvRefKey) :
packedPuppiweight_(0), packedPuppiweightNoLepDiff_(0), hcalFraction_(0),
p4_(new PolarLorentzVector(p4.Pt(), p4.Eta(), p4.Phi(), p4.M())),
p4c_( new LorentzVector(p4)), vertex_( new Point(vtx) ) ,
dphi_(reco::deltaPhi(phiAtVtx,p4_.load()->phi())),
Expand All @@ -106,6 +110,7 @@ namespace pat {
packedCovarianceDphiDphi_(iOther.packedCovarianceDphiDphi_),
packedPuppiweight_(iOther.packedPuppiweight_),
packedPuppiweightNoLepDiff_(iOther.packedPuppiweightNoLepDiff_),
hcalFraction_(iOther.hcalFraction_),
//Need to trigger unpacking in iOther
p4_( new PolarLorentzVector(iOther.polarP4() ) ),
p4c_( new LorentzVector(iOther.p4())), vertex_( new Point(iOther.vertex())),
Expand All @@ -131,6 +136,7 @@ namespace pat {
packedCovarianceDphiDphi_(iOther.packedCovarianceDphiDphi_),
packedPuppiweight_(iOther.packedPuppiweight_),
packedPuppiweightNoLepDiff_(iOther.packedPuppiweightNoLepDiff_),
hcalFraction_(iOther.hcalFraction_),
p4_( iOther.p4_.exchange(nullptr) ) ,
p4c_( iOther.p4c_.exchange(nullptr)), vertex_(iOther.vertex_.exchange(nullptr)),
dxy_(iOther.dxy_), dz_(iOther.dz_),dphi_(iOther.dphi_),
Expand Down Expand Up @@ -164,6 +170,7 @@ namespace pat {
packedCovarianceDphiDphi_=iOther.packedCovarianceDphiDphi_;
packedPuppiweight_=iOther.packedPuppiweight_;
packedPuppiweightNoLepDiff_=iOther.packedPuppiweightNoLepDiff_;
hcalFraction_=iOther.hcalFraction_;
//Need to trigger unpacking in iOther
if(p4_) {
*p4_ = iOther.polarP4();
Expand Down Expand Up @@ -232,6 +239,7 @@ namespace pat {
packedCovarianceDphiDphi_=iOther.packedCovarianceDphiDphi_;
packedPuppiweight_=iOther.packedPuppiweight_;
packedPuppiweightNoLepDiff_=iOther.packedPuppiweightNoLepDiff_;
hcalFraction_=iOther.hcalFraction_;
delete p4_.exchange(iOther.p4_.exchange(nullptr));
delete p4c_.exchange(iOther.p4c_.exchange(nullptr));
delete vertex_.exchange(iOther.vertex_.exchange(nullptr));
Expand Down

0 comments on commit 96830d6

Please sign in to comment.