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());
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;
296 unsigned candTrackRefKey =
cand.trackRef().key();
298 if (
it == candTrackRefKey) {
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) {
bool quality(const TrackQuality) const
Track quality.
edm::EDGetTokenT< CaloTowerCollection > srcTower_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
reco::TrackCollection::const_iterator TI
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
const math::XYZPoint & outerPosition() const
position of the outermost hit
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
std::unique_ptr< TrackingRecHitCollection > selHits_
std::vector< Track > TrackCollection
collection of Tracks
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
std::string qualityToSet_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
const edm::RefToBase< TrajectorySeed > & seedRef() const
std::string qualityToMatch_
const TrackResiduals & residuals() const
get the residuals
edm::EDGetTokenT< reco::TrackCollection > srcTracks_
source collection label
key_type key() const
Accessor for product key.
edm::EDGetTokenT< std::vector< Trajectory > > srcTrackTrajs_
const_iterator find(const key_type &k) const
find element with specified reference key
std::string qualityToSkip_
const_iterator end() const
last iterator over the map (read only)
TrackingRecHitRefProd rHits_
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
double pt() const
track transverse momentum
reco::PFCandidateCollection::const_iterator CI
const ElementsInBlocks & elementsInBlocks() const
std::unique_ptr< std::vector< Trajectory > > selTrajs_
edm::RefProd< std::vector< Trajectory > > rTrajectories_
std::string minimumQuality_
void produce(edm::Event &evt, const edm::EventSetup &es) override
process one event
bool selectByTowers(TI ti, const edm::Handle< TrackCollection > hSrcTrack, const edm::Handle< CaloTowerCollection > towers, bool isTowerThere)
reco::TrackRefProd rTracks_
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
std::vector< reco::TrackRef > trackRefs_
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCands_
RefProd< PROD > getRefBeforePut()
constexpr auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
bool innerOk() const
return true if the innermost hit is valid
std::unique_ptr< TrajTrackAssociationCollection > selTTAss_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
const PropagationDirection & seedDirection() const
direction of how the hits were sorted in the original seed
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)
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
std::string funcCaloComp_
bool isSelected(const std::vector< L1HPSPFTauQualityCut > &qualityCuts, const l1t::PFCandidate &pfCand, float_t primaryVertexZ)
static std::string const emptyString("")
Particle reconstructed by the particle flow algorithm.
reco::TrackExtraRefProd rTrackExtras_
std::unique_ptr< reco::TrackExtraCollection > selTrackExtras_
std::unique_ptr< reco::TrackCollection > selTracks_
storage
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)
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
std::string funcDeltaRTowerMatch_
bool copyTrajectories_
copy also trajectories and trajectory->track associations
const math::XYZPoint & innerPosition() const
position of the innermost hit
~HICaloCompatibleTrackSelector() override
destructor
bool outerOk() const
return true if the outermost hit is valid
edm::EDGetTokenT< TrajTrackAssociationCollection > srcTrackTrajAssoc_