23 #include <Math/DistFunc.h>
32 usePFCandMatching_(cfg.getUntrackedParameter<bool>(
"usePFCandMatching",
true)),
33 trkMatchPtMin_(cfg.getUntrackedParameter<double>(
"trkMatchPtMin", 10.0)),
34 trkCompPtMin_(cfg.getUntrackedParameter<double>(
"trkCompPtMin", 35.0)),
35 trkEtaMax_(cfg.getUntrackedParameter<double>(
"trkEtaMax", 2.4)),
36 towerPtMin_(cfg.getUntrackedParameter<double>(
"towerPtMin", 5.0)),
37 matchConeRadius_(cfg.getUntrackedParameter<double>(
"matchConeRadius", 0.087)),
38 keepAllTracks_(cfg.getUntrackedParameter<bool>(
"keepAllTracks",
true)),
39 copyExtras_(cfg.getUntrackedParameter<bool>(
"copyExtras",
true)),
40 copyTrajectories_(cfg.getUntrackedParameter<bool>(
"copyTrajectories",
true)),
41 qualityToSet_(cfg.getParameter<std::
string>(
"qualityToSet")),
42 qualityToSkip_(cfg.getParameter<std::
string>(
"qualityToSkip")),
43 qualityToMatch_(cfg.getParameter<std::
string>(
"qualityToMatch")),
44 minimumQuality_(cfg.getParameter<std::
string>(
"minimumQuality")),
45 resetQuality_(cfg.getUntrackedParameter<bool>(
"resetQuality",
true)),
46 passMuons_(cfg.getUntrackedParameter<bool>(
"passMuons",
true)),
47 passElectrons_(cfg.getUntrackedParameter<bool>(
"passElectrons",
false)),
48 funcDeltaRTowerMatch_(cfg.getParameter<std::
string>(
"funcDeltaRTowerMatch")),
49 funcCaloComp_(cfg.getParameter<std::
string>(
"funcCaloComp")) {
51 produces<reco::TrackCollection>().setBranchAlias(alias +
"Tracks");
53 produces<reco::TrackExtraCollection>().setBranchAlias(alias +
"TrackExtras");
54 produces<TrackingRecHitCollection>().setBranchAlias(alias +
"RecHits");
57 produces<std::vector<Trajectory>>().setBranchAlias(alias +
"Trajectories");
58 produces<TrajTrackAssociationCollection>().setBranchAlias(alias +
"TrajectoryTrackAssociations");
85 selTracks_ = std::make_unique<TrackCollection>();
89 selHits_ = std::make_unique<TrackingRecHitCollection>();
100 bool isPFThere =
false;
101 bool isTowerThere =
false;
109 for (
TI ti = hSrcTrack->begin(), ed = hSrcTrack->end(); ti != ed; ++ti, ++current) {
145 auto const firstHitIndex =
selHits_->size();
147 selHits_->push_back((*hit)->clone());
162 selTrajs_ = std::make_unique<std::vector<Trajectory>>();
164 selTTAss_ = std::make_unique<TrajTrackAssociationCollection>();
165 for (
size_t i = 0,
n = hTraj->size();
i <
n; ++
i) {
168 if (match != hTTAss->end()) {
170 short oldKey =
static_cast<short>(trkRef.
key());
203 double trkPt = trk.
pt();
209 unsigned int trackKey = ti - hSrcTrack->begin();
234 throw cms::Exception(
"Undefined case in HICaloCompatibleTrackSelector")
235 <<
"Undefined case in HICaloCompatibleTrackSelector";
260 if (caloEt > 0 && matchDr > matchConeRadius_pt)
277 double sum_ecal = 0.0, sum_hcal = 0.0;
284 for (
CI ci = pfCandidates->begin(); ci != pfCandidates->end(); ++ci) {
298 if (it == candTrackRefKey) {
324 switch (elements[indexInBlock].
type()) {
327 sum_ecal += clusterRef->energy() / cosh(clusterRef->eta());
333 sum_hcal += clusterRef->energy() / cosh(clusterRef->eta());
349 return sum_ecal + sum_hcal;
359 for (
unsigned int i = 0;
i < towers->size(); ++
i) {
361 double pt = tower.
pt();
const edm::RefToBase< TrajectorySeed > & seedRef() const
edm::EDGetTokenT< CaloTowerCollection > srcTower_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
reco::TrackCollection::const_iterator TI
double pt() const final
transverse momentum
friend struct const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::unique_ptr< TrackingRecHitCollection > selHits_
std::vector< Track > TrackCollection
collection of Tracks
bool innerOk() const
return true if the innermost hit is valid
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
std::string qualityToSet_
key_type key() const
Accessor for product key.
std::string qualityToMatch_
const math::XYZPoint & outerPosition() const
position of the outermost hit
edm::EDGetTokenT< reco::TrackCollection > srcTracks_
source collection label
edm::EDGetTokenT< std::vector< Trajectory > > srcTrackTrajs_
std::string qualityToSkip_
reco::TrackRef trackRef() const
const math::XYZPoint & innerPosition() const
position of the innermost hit
TrackingRecHitRefProd rHits_
reco::PFCandidateCollection::const_iterator CI
std::unique_ptr< std::vector< Trajectory > > selTrajs_
edm::RefProd< std::vector< Trajectory > > rTrajectories_
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
double pt() const
track transverse momentum
std::string minimumQuality_
void produce(edm::Event &evt, const edm::EventSetup &es) override
process one event
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
bool selectByTowers(TI ti, const edm::Handle< TrackCollection > hSrcTrack, const edm::Handle< CaloTowerCollection > towers, bool isTowerThere)
reco::TrackRefProd rTracks_
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
std::vector< reco::TrackRef > trackRefs_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCands_
RefProd< PROD > getRefBeforePut()
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
std::unique_ptr< TrajTrackAssociationCollection > selTTAss_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
static TrackQuality qualityByName(const std::string &name)
double matchPFCandToTrack(const edm::Handle< PFCandidateCollection > &pfCandidates, unsigned it, double trkPt)
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
bool outerOk() const
return true if the outermost hit is valid
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
T getParameter(std::string const &) const
std::string funcCaloComp_
bool isSelected(const std::vector< L1HPSPFTauQualityCut > &qualityCuts, const l1t::PFCandidate &pfCand, float_t primaryVertexZ)
bool quality(const TrackQuality) const
Track quality.
static std::string const emptyString("")
Particle reconstructed by the particle flow algorithm.
reco::TrackExtraRefProd rTrackExtras_
std::unique_ptr< reco::TrackExtraCollection > selTrackExtras_
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
std::unique_ptr< reco::TrackCollection > selTracks_
storage
const TrackResiduals & residuals() const
get the residuals
bool selectByPFCands(TI ti, const edm::Handle< TrackCollection > hSrcTrack, const edm::Handle< PFCandidateCollection > pfCandidates, bool isPFThere)
void matchByDrAllowReuse(const reco::Track &trk, const edm::Handle< CaloTowerCollection > &towers, double &bestdr, double &bestpt)
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
std::string funcDeltaRTowerMatch_
virtual ParticleType particleId() const
bool copyTrajectories_
copy also trajectories and trajectory->track associations
const ElementsInBlocks & elementsInBlocks() const
~HICaloCompatibleTrackSelector() override
destructor
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
edm::EDGetTokenT< TrajTrackAssociationCollection > srcTrackTrajAssoc_
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
double eta() const final
momentum pseudorapidity