42 bool passPixelTrackSel)
const;
76 srcOfflineBeamSpot_(consumes<
reco::
BeamSpot>(iConfig.getParameter<edm::
InputTag>(
"srcOfflineBeamSpot"))),
77 dzSigCut_(iConfig.getParameter<double>(
"dzSigCut")),
78 dxySigCut_(iConfig.getParameter<double>(
"dxySigCut")),
79 dzSigHP_(iConfig.getParameter<double>(
"dzSigHP")),
80 dxySigHP_(iConfig.getParameter<double>(
"dxySigHP")),
81 ptMax_(iConfig.getParameter<double>(
"ptMax")),
82 ptMin_(iConfig.getParameter<double>(
"ptMin")),
83 resetHP_(iConfig.getParameter<bool>(
"resetHP")),
84 covarianceVersion_(iConfig.getParameter<int>(
"covarianceVersion")),
85 covarianceSchema_(iConfig.getParameter<int>(
"covarianceSchema")) {
86 produces<std::vector<pat::PackedCandidate>>();
87 produces<edm::Association<pat::PackedCandidateCollection>>();
102 auto outPtrTrksAsCands = std::make_unique<std::vector<pat::PackedCandidate>>();
116 bestvzError = vtx.
zError();
121 bestvzError =
bs.z0Error();
122 bestvtx =
bs.position();
123 vtx_cov =
bs.covariance3D();
126 std::vector<int> mapping(
tracks->size(), -1);
127 int savedCandIndx = 0;
129 for (
auto const& trk : *
tracks) {
131 double dzvtx =
std::abs(trk.dz(bestvtx));
132 double dxyvtx =
std::abs(trk.dxy(bestvtx));
133 double dzerror = std::hypot(trk.dzError(), bestvzError);
134 double dxyerror = trk.dxyError(bestvtx, vtx_cov);
143 bool passSelection = (dzvtx <
dzSigHP_ * dzerror && dxyvtx <
dxySigHP_ * dxyerror);
148 mapping[trkIndx] = savedCandIndx;
152 auto tk2pc = std::make_unique<edm::Association<pat::PackedCandidateCollection>>(oh);
154 tk2pcFiller.insert(tracks, mapping.begin(), mapping.end());
163 bool passPixelTrackSel)
const {
164 const float mass = 0.13957018;
166 int id = 211 * trk.
charge();
169 cands.emplace_back(p4, trk.
vertex(), trk.
pt(), trk.
eta(), trk.
phi(),
id, pvSlimmedColl, pvSlimmed.
key());
172 if (passPixelTrackSel)
173 cands.back().setTrackHighPurity(
true);
175 cands.back().setTrackHighPurity(
false);
178 cands.back().setTrackHighPurity(
true);
180 cands.back().setTrackHighPurity(
false);
192 desc.
add<
edm::InputTag>(
"srcPrimaryVertices", {
"offlineSlimmedPrimaryVertices"});
194 ->setComment(
"use BeamSpot if empty vtx collection");
195 desc.
add<
double>(
"dzSigCut", 10.0);
196 desc.
add<
double>(
"dxySigCut", 25.0);
197 desc.
add<
double>(
"dzSigHP", 7.0)->
setComment(
"to set HighPurity flag for pixel tracks");
198 desc.
add<
double>(
"dxySigHP", 20.0)->
setComment(
"to set HighPurity flag for pixel tracks");
199 desc.
add<
double>(
"ptMax", 1.0)->
setComment(
"max pT for pixel tracks - above this will use general tracks");
200 desc.
add<
double>(
"ptMin", 0.3)->
setComment(
"min pT for pixel tracks");
201 desc.
add<
bool>(
"resetHP",
true)
202 ->setComment(
"pixel tracks do not have HP flag set. Use False if does not want to reset HP flag");
203 desc.
add<
int>(
"covarianceVersion", 0)->setComment(
"so far: 0 is Phase0, 1 is Phase1");
204 desc.
add<
int>(
"covarianceSchema", 520)->setComment(
"use less accurate schema - reduce size of collection");
void setComment(std::string const &value)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
const edm::EDGetTokenT< reco::VertexCollection > srcPrimaryVertices_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
uint16_t *__restrict__ id
const edm::EDGetTokenT< reco::TrackCollection > srcTracks_
double zError() const
error on z
#define DEFINE_FWK_MODULE(type)
std::vector< Track > TrackCollection
collection of Tracks
double phi() const
azimuthal angle of momentum vector
auto const & tracks
cannot be loose
double covariance(int i, int j) const
(i, j)-th element of error matrix, i, j = 0, ... 2
key_type key() const
Accessor for product key.
std::vector< Vertex > VertexCollection
const Point & position() const
position
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
Handle< PROD > getHandle(EDGetTokenT< PROD > token) const
ptMin_(conf.getParameter< double >("ptMin"))
const Point & vertex() const
reference point on the track. This method is DEPRECATED, please use referencePoint() instead ...
double eta() const
pseudorapidity of momentum vector
double pt() const
track transverse momentum
Abs< T >::type abs(const T &t)
bool get(ProductID const &oid, Handle< PROD > &result) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
edm::Ref< VertexCollection > VertexRef
persistent reference to a Vertex
void addPackedCandidate(std::vector< pat::PackedCandidate > &cands, const reco::Track trk, const reco::VertexRef &pvSlimmed, const reco::VertexRefProd &pvSlimmedColl, bool passPixelTrackSel) const
XYZPointD XYZPoint
point in space with cartesian internal representation
const int covarianceVersion_
bool quality(const TrackQuality) const
Track quality.
PATTracksToPackedCandidates(const edm::ParameterSet &)
int charge() const
track electric charge
const int covarianceSchema_
const edm::EDGetTokenT< reco::BeamSpot > srcOfflineBeamSpot_
math::PtEtaPhiMLorentzVector PolarLorentzVector
Lorentz vector.