30 bool passesQuality(
const reco::Track& trk,
const std::vector<reco::TrackBase::TrackQuality>& allowedQuals){
31 for(
const auto& qual : allowedQuals){
32 if(trk.
quality(qual))
return true;
95 minPt_(iConfig.getParameter<double>(
"minPt")),
96 minHits_(iConfig.getParameter<uint32_t>(
"minHits")),
97 minPixelHits_(iConfig.getParameter<uint32_t>(
"minPixelHits")) ,
104 std::vector<std::string> trkQuals(iConfig.
getParameter<std::vector<std::string> >(
"qualsToAutoAccept"));
108 std::ostringstream
msg;
109 msg<<
" PATLostTracks has a quality requirement which resolves to undefQuality. This usually means a typo and is therefore treated a config error\nquality requirements:\n ";
110 for(
const auto& trkQual : trkQuals) msg <<trkQual<<
" ";
114 produces< std::vector<reco::Track> > ();
115 produces< std::vector<pat::PackedCandidate> > (); produces< std::vector<pat::PackedCandidate> > (
"eleTracks");
116 produces< edm::Association<pat::PackedCandidateCollection> > ();
154 auto outPtrTrks = std::make_unique<std::vector<reco::Track>>();
155 auto outPtrTrksAsCands = std::make_unique<std::vector<pat::PackedCandidate>>();
156 auto outPtrEleTrksAsCands = std::make_unique<std::vector<pat::PackedCandidate>>();
163 for(
unsigned int ic=0, nc = cands->size(); ic < nc; ++ic) {
176 for(
const auto& secVert : *vertices){
177 for(
auto trkIt = secVert.tracks_begin();trkIt!=secVert.tracks_end();trkIt++){
181 for(
const auto& v0 : *kshorts){
182 for(
size_t dIdx=0;dIdx<v0.numberOfDaughters(); dIdx++){
187 for(
const auto& v0 : *lambdas){
188 for(
size_t dIdx=0;dIdx<v0.numberOfDaughters(); dIdx++){
193 std::vector<int>
mapping(tracks->size(),-1);
195 for(
unsigned int trkIndx=0; trkIndx < tracks->size(); trkIndx++){
200 outPtrTrks->emplace_back(*trk);
209 addPackedCandidate(*outPtrEleTrksAsCands, trk,
pv, pvRefProd, pvOrig, trkStatus[trkIndx], muons);
216 iEvent.
put(
std::move(outPtrEleTrksAsCands),
"eleTracks");
218 auto tk2pc = std::make_unique<edm::Association<pat::PackedCandidateCollection>>(oh);
227 const bool passTrkHits = tr.
pt() >
minPt_ &&
243 const float mass = 0.13957018;
245 int id=211*trk->charge();
251 for (
auto&
mu : *muons) {
253 id = -13 * trk->charge();
261 trk->pt(),trk->eta(),trk->phi(),
262 id,pvSlimmedColl,pvSlimmed.
key()));
265 cands.back().setTrackHighPurity(
true);
267 cands.back().setTrackHighPurity(
false);
T getParameter(std::string const &) const
int pdgId() const final
PDG identifier.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
std::vector< VertexCompositeCandidate > VertexCompositeCandidateCollection
collection of Candidate objects
void addPackedCandidate(std::vector< pat::PackedCandidate > &cands, const reco::TrackRef &trk, const reco::VertexRef &pvSlimmed, const reco::VertexRefProd &pvSlimmedColl, const reco::Vertex &pvOrig, const TrkStatus trkStatus, edm::Handle< reco::MuonCollection > muons) const
bool isNonnull() const
Checks for non-null.
const double minPtToStoreProps_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
~PATLostTracks() override
std::vector< pat::PackedCandidate > PackedCandidateCollection
std::vector< Track > TrackCollection
collection of Tracks
const int covarianceSchema_
std::vector< Vertex > VertexCollection
collection of Vertex objects
int charge() const final
electric charge
key_type key() const
Accessor for product key.
PATLostTracks(const edm::ParameterSet &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
const int covarianceVersion_
ProductID id() const
Accessor for product ID.
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
reco::TrackRef trackRef() const
const edm::EDGetTokenT< reco::PFCandidateCollection > cands_
#define DEFINE_FWK_MODULE(type)
const edm::EDGetTokenT< reco::MuonCollection > muons_
double pt() const
track transverse momentum
const edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > lambdas_
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
unsigned short numberOfValidHits() const
number of valid hits found
float trackWeight(const TREF &r) const
returns the weight with which a Track has contributed to the vertex-fit.
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
static TrackQuality qualityByName(const std::string &name)
const edm::EDGetTokenT< edm::Association< pat::PackedCandidateCollection > > map_
bool passTrkCuts(const reco::Track &tr) const
const edm::EDGetTokenT< reco::TrackCollection > tracks_
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
const edm::EDGetTokenT< reco::VertexCollection > vertices_
bool quality(const TrackQuality) const
Track quality.
const edm::EDGetTokenT< reco::VertexCompositeCandidateCollection > kshorts_
std::vector< Muon > MuonCollection
std::vector< reco::TrackBase::TrackQuality > qualsToAutoAccept_
StringCutObjectSelector< reco::Track, false > passThroughCut_
Particle reconstructed by the particle flow algorithm.
int numberOfValidPixelHits() const
const double minPixelHits_
const edm::EDGetTokenT< reco::VertexCollection > pv_
const edm::EDGetTokenT< reco::VertexCollection > pvOrigs_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.