25 #include <Math/DistFunc.h> 35 usePFCandMatching_(cfg.getUntrackedParameter<
bool>(
"usePFCandMatching",
true)),
36 trkMatchPtMin_(cfg.getUntrackedParameter<double>(
"trkMatchPtMin",10.0)),
37 trkCompPtMin_(cfg.getUntrackedParameter<double>(
"trkCompPtMin",35.0)),
38 trkEtaMax_(cfg.getUntrackedParameter<double>(
"trkEtaMax",2.4)),
39 towerPtMin_(cfg.getUntrackedParameter<double>(
"towerPtMin",5.0)),
40 matchConeRadius_(cfg.getUntrackedParameter<double>(
"matchConeRadius",0.087)),
41 keepAllTracks_(cfg.getUntrackedParameter<
bool>(
"keepAllTracks",
true)),
42 copyExtras_(cfg.getUntrackedParameter<
bool>(
"copyExtras",
true)),
43 copyTrajectories_(cfg.getUntrackedParameter<
bool>(
"copyTrajectories",
true)),
44 qualityToSet_(cfg.getParameter<
std::
string>(
"qualityToSet")),
45 qualityToSkip_(cfg.getParameter<
std::
string>(
"qualityToSkip")),
46 qualityToMatch_(cfg.getParameter<
std::
string>(
"qualityToMatch")),
47 minimumQuality_(cfg.getParameter<
std::
string>(
"minimumQuality")),
48 resetQuality_(cfg.getUntrackedParameter<
bool>(
"resetQuality",
true)),
49 passMuons_(cfg.getUntrackedParameter<
bool>(
"passMuons",
true)),
50 passElectrons_(cfg.getUntrackedParameter<
bool>(
"passElectrons",
false)),
51 funcDeltaRTowerMatch_(cfg.getParameter<
std::
string>(
"funcDeltaRTowerMatch")),
52 funcCaloComp_(cfg.getParameter<
std::
string>(
"funcCaloComp"))
55 produces<reco::TrackCollection>().setBranchAlias( alias +
"Tracks");
57 produces<reco::TrackExtraCollection>().setBranchAlias( alias +
"TrackExtras");
58 produces<TrackingRecHitCollection>().setBranchAlias( alias +
"RecHits");
61 produces< std::vector<Trajectory> >().setBranchAlias( alias +
"Trajectories");
62 produces< TrajTrackAssociationCollection >().setBranchAlias( alias +
"TrajectoryTrackAssociations");
95 selTracks_ = std::make_unique<TrackCollection>();
99 selHits_ = std::make_unique<TrackingRecHitCollection>();
111 bool isPFThere =
false;
112 bool isTowerThere =
false;
118 for (
TI ti = hSrcTrack->begin(), ed = hSrcTrack->end(); ti != ed; ++ti, ++current) {
125 else isSelected =
selectByTowers(ti, hSrcTrack, towers, isTowerThere);
147 auto const firstHitIndex =
selHits_->size();
149 selHits_->push_back( (*hit)->clone() );
165 selTrajs_ = std::make_unique<std::vector<Trajectory>>();
167 selTTAss_ = std::make_unique<TrajTrackAssociationCollection>();
168 for (
size_t i = 0,
n = hTraj->size();
i <
n; ++
i) {
171 if (match != hTTAss->
end()) {
173 short oldKey =
static_cast<short>(trkRef.
key());
176 selTTAss_->insert (
Ref< vector<Trajectory> >(rTrajectories_,
selTrajs_->size() - 1),
trackRefs_[oldKey] );
212 double trkPt = trk.
pt();
218 unsigned int trackKey = ti - hSrcTrack->begin();
224 if(!(caloEt>0.))
return false;
234 if(caloEt>compPt)
return true;
239 throw cms::Exception(
"Undefined case in HICaloCompatibleTrackSelector") <<
"Undefined case in HICaloCompatibleTrackSelector";
263 if (caloEt>0 && matchDr>matchConeRadius_pt) caloEt=0.;
279 double sum_ecal=0.0, sum_hcal=0.0;
286 for(
CI ci = pfCandidates->begin(); ci!=pfCandidates->end(); ++ci) {
302 if(it==candTrackRefKey) {
327 switch (elements[indexInBlock].
type()) {
331 sum_ecal += clusterRef->energy()/cosh(clusterRef->eta());
337 sum_hcal += clusterRef->energy()/cosh(clusterRef->eta());
355 return sum_ecal+sum_hcal;
364 for(
unsigned int i = 0;
i < towers->
size(); ++
i){
366 double pt = tower.
pt();
const edm::RefToBase< TrajectorySeed > & seedRef() const
T getParameter(std::string const &) const
edm::EDGetTokenT< CaloTowerCollection > srcTower_
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
double eta() const final
momentum pseudorapidity
reco::TrackCollection::const_iterator TI
friend struct const_iterator
const_iterator end() const
last iterator over the map (read only)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::unique_ptr< TrackingRecHitCollection > selHits_
const_iterator find(const key_type &k) const
find element with specified reference key
std::vector< Track > TrackCollection
collection of Tracks
bool innerOk() const
return true if the innermost hit is valid
double pt() const final
transverse momentum
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_
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_
auto deltaR(const T1 &t1, const T2 &t2) -> decltype(t1.eta())
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
edm::RefProd< std::vector< Trajectory > > rTrajectories_
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
std::vector< reco::TrackRef > trackRefs_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCands_
RefProd< PROD > getRefBeforePut()
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
std::string funcCaloComp_
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.
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
edm::EDGetTokenT< TrajTrackAssociationCollection > srcTrackTrajAssoc_
trackingRecHit_iterator recHitsEnd() const
Iterator to last hit on the track.