Skip to content

Commit

Permalink
Merge pull request #32874 from gouskos/btv-svcharge-master
Browse files Browse the repository at this point in the history
Add SV charge
  • Loading branch information
cmsbuild committed Feb 19, 2021
2 parents 06ca18d + fbfe260 commit db968ce
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions PhysicsTools/NanoAOD/plugins/VertexTableProducer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ void VertexTableProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe
iEvent.getByToken(svs_, svsIn);
auto selCandSv = std::make_unique<PtrVector<reco::Candidate>>();
std::vector<float> dlen, dlenSig, pAngle, dxy, dxySig;
std::vector<int> charge;
VertexDistance3D vdist;
VertexDistanceXY vdistXY;

Expand All @@ -164,6 +165,13 @@ void VertexTableProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe
PV0, VertexState(RecoVertex::convertPos(sv.position()), RecoVertex::convertError(sv.error())));
dxy.push_back(d2d.value());
dxySig.push_back(d2d.significance());

int sum_charge = 0;
for (unsigned int id = 0; id < sv.numberOfDaughters(); ++id) {
const reco::Candidate* daughter = sv.daughter(id);
sum_charge += daughter->charge();
}
charge.push_back(sum_charge);
}
}
i++;
Expand All @@ -176,6 +184,7 @@ void VertexTableProducer::produce(edm::Event& iEvent, const edm::EventSetup& iSe
svsTable->addColumn<float>("dxy", dxy, "2D decay length in cm", 10);
svsTable->addColumn<float>("dxySig", dxySig, "2D decay length significance", 10);
svsTable->addColumn<float>("pAngle", pAngle, "pointing angle, i.e. acos(p_SV * (SV - PV)) ", 10);
svsTable->addColumn<int>("charge", charge, "sum of the charge of the SV tracks", 10);

iEvent.put(std::move(pvTable), "pv");
iEvent.put(std::move(otherPVsTable), "otherPVs");
Expand Down
1 change: 1 addition & 0 deletions PhysicsTools/NanoAOD/python/nanoDQM_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@
Plot1D('y', 'y', 20, -0.5, 0.5, 'secondary vertex Y position, in cm'),
Plot1D('z', 'z', 20, -10, 10, 'secondary vertex Z position, in cm'),
Plot1D('ntracks', 'ntracks', 11, -0.5, 10.5, 'number of tracks'),
Plot1D('charge', 'charge', 11 , -0.5, 10.5, 'sum of the charge of the SV tracks'),
)
),
SoftActivityJet = cms.PSet(
Expand Down

0 comments on commit db968ce

Please sign in to comment.