158 auto outPtrTrks = std::make_unique<std::vector<reco::Track>>();
159 auto outPtrTrksAsCands = std::make_unique<std::vector<pat::PackedCandidate>>();
160 auto outPtrEleTrksAsCands = std::make_unique<std::vector<pat::PackedCandidate>>();
167 for (
unsigned int ic = 0, nc = cands->size(); ic < nc; ++ic) {
171 if (cand.
pdgId() == 11)
173 else if (cand.
pdgId() == -11)
175 else if ((*pf2pc)[
r]->numberOfHits() > 0)
183 for (
const auto& secVert : *vertices) {
184 for (
auto trkIt = secVert.tracks_begin(); trkIt != secVert.tracks_end(); trkIt++) {
189 for (
const auto& v0 : *kshorts) {
190 for (
size_t dIdx = 0; dIdx < v0.numberOfDaughters(); dIdx++) {
196 for (
const auto& v0 : *lambdas) {
197 double protonCharge = 0;
198 for (
size_t dIdx = 0; dIdx < v0.numberOfDaughters(); dIdx++) {
202 protonCharge += v0.daughter(dIdx)->charge() * v0.daughter(dIdx)->momentum().mag2();
208 for (
unsigned int trkIndx = 0; trkIndx < tracks->size(); trkIndx++) {
214 trk->px(), trk->py(), trk->pz(),
sqrt(trk->momentum().mag2() + 0.01947995518));
220 std::vector<int> mapping(tracks->size(), -1);
222 for (
unsigned int trkIndx = 0; trkIndx < tracks->size(); trkIndx++) {
225 outPtrTrks->emplace_back(*trk);
227 std::pair<int, pat::PackedCandidate::PVAssociationQuality> pvAsso =
associateTrkToVtx(*pvOrigs, trk);
231 }
else if (!pvs->empty()) {
234 addPackedCandidate(*outPtrTrksAsCands, trk,
pv, pvRefProd, trkStatus[trkIndx], pvAsso.second, muons);
238 mapping[trkIndx] = lostTrkIndx;
243 std::pair<int, pat::PackedCandidate::PVAssociationQuality> pvAsso =
associateTrkToVtx(*pvOrigs, trk);
247 }
else if (!pvs->empty()) {
250 addPackedCandidate(*outPtrEleTrksAsCands, trk,
pv, pvRefProd, trkStatus[trkIndx], pvAsso.second, muons);
255 iEvent.
put(
std::move(outPtrEleTrksAsCands),
"eleTracks");
257 auto tk2pc = std::make_unique<edm::Association<pat::PackedCandidateCollection>>(oh);
259 tk2pcFiller.insert(tracks, mapping.begin(), mapping.end());
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
bool isNonnull() const
Checks for non-null.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
auto const & tracks
cannot be loose
key_type key() const
Accessor for product key.
ProductID id() const
Accessor for product ID.
reco::TrackRef trackRef() const
int pdgId() const final
PDG identifier.
XYZTLorentzVectorD XYZTLorentzVector
Lorentz vector with cylindrical internal representation using pseudorapidity.
const edm::EDGetTokenT< reco::PFCandidateCollection > cands_
const edm::EDGetTokenT< reco::MuonCollection > muons_
tuple key
prepare the HTCondor submission files and eventually submit them
const edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > lambdas_
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
std::pair< int, pat::PackedCandidate::PVAssociationQuality > associateTrkToVtx(const reco::VertexCollection &vertices, const reco::TrackRef &trk) const
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > map_
void addPackedCandidate(std::vector< pat::PackedCandidate > &cands, const reco::TrackRef &trk, const reco::VertexRef &pvSlimmed, const reco::VertexRefProd &pvSlimmedColl, const TrkStatus &trkStatus, const pat::PackedCandidate::PVAssociationQuality &pvAssocQuality, edm::Handle< reco::MuonCollection > muons) const
bool passTrkCuts(const reco::Track &tr) const
const edm::EDGetTokenT< reco::TrackCollection > tracks_
const edm::EDGetTokenT< reco::VertexCollection > vertices_
const edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > kshorts_
Particle reconstructed by the particle flow algorithm.
const edm::EDGetTokenT< reco::VertexCollection > pv_
int charge() const final
electric charge
const edm::EDGetTokenT< reco::VertexCollection > pvOrigs_