29 #include <Math/DistFunc.h>
36 srcTracks_(consumes<
TrackCollection>(cfg.getParameter<edm::InputTag>(
"srcTracks"))),
39 usePFCandMatching_(cfg.getUntrackedParameter<bool>(
"usePFCandMatching",
true)),
40 trkMatchPtMin_(cfg.getUntrackedParameter<double>(
"trkMatchPtMin",10.0)),
41 trkCompPtMin_(cfg.getUntrackedParameter<double>(
"trkCompPtMin",35.0)),
42 trkEtaMax_(cfg.getUntrackedParameter<double>(
"trkEtaMax",2.4)),
43 towerPtMin_(cfg.getUntrackedParameter<double>(
"towerPtMin",5.0)),
44 matchConeRadius_(cfg.getUntrackedParameter<double>(
"matchConeRadius",0.087)),
45 keepAllTracks_(cfg.getUntrackedParameter<bool>(
"keepAllTracks",
true)),
46 copyExtras_(cfg.getUntrackedParameter<bool>(
"copyExtras",
true)),
47 copyTrajectories_(cfg.getUntrackedParameter<bool>(
"copyTrajectories",
true)),
48 qualityToSet_(cfg.getParameter<std::
string>(
"qualityToSet")),
49 qualityToSkip_(cfg.getParameter<std::
string>(
"qualityToSkip")),
50 qualityToMatch_(cfg.getParameter<std::
string>(
"qualityToMatch")),
51 minimumQuality_(cfg.getParameter<std::
string>(
"minimumQuality")),
52 resetQuality_(cfg.getUntrackedParameter<bool>(
"resetQuality",
true)),
53 passMuons_(cfg.getUntrackedParameter<bool>(
"passMuons",
true)),
54 passElectrons_(cfg.getUntrackedParameter<bool>(
"passElectrons",
false)),
55 funcDeltaRTowerMatch_(cfg.getParameter<std::
string>(
"funcDeltaRTowerMatch")),
56 funcCaloComp_(cfg.getParameter<std::
string>(
"funcCaloComp"))
59 produces<reco::TrackCollection>().setBranchAlias( alias +
"Tracks");
61 produces<reco::TrackExtraCollection>().setBranchAlias( alias +
"TrackExtras");
62 produces<TrackingRecHitCollection>().setBranchAlias( alias +
"RecHits");
65 produces< std::vector<Trajectory> >().setBranchAlias( alias +
"Trajectories");
66 produces< TrajTrackAssociationCollection >().setBranchAlias( alias +
"TrajectoryTrackAssociations");
115 bool isPFThere =
false;
116 bool isTowerThere =
false;
122 for (
TI ti = hSrcTrack->begin(), ed = hSrcTrack->end(); ti != ed; ++ti, ++
current) {
129 else isSelected =
selectByTowers(ti, hSrcTrack, towers, isTowerThere);
152 selHits_->push_back( (*hit)->clone() );
168 selTrajs_ = auto_ptr< vector<Trajectory> >(
new vector<Trajectory>());
171 for (
size_t i = 0,
n = hTraj->size();
i <
n; ++
i) {
174 if (match != hTTAss->end()) {
176 short oldKey =
static_cast<short>(trkRef.
key());
215 double trkPt = trk.
pt();
221 unsigned int trackKey = ti - hSrcTrack->begin();
227 if(!(caloEt>0.))
return false;
237 if(caloEt>compPt)
return true;
242 throw cms::Exception(
"Undefined case in HICaloCompatibleTrackSelector") <<
"Undefined case in HICaloCompatibleTrackSelector";
266 if (caloEt>0 && matchDr>matchConeRadius_pt) caloEt=0.;
282 double sum_ecal=0.0, sum_hcal=0.0;
289 for(
CI ci = pfCandidates->begin(); ci!=pfCandidates->end(); ++ci) {
305 if(it==candTrackRefKey) {
330 switch (elements[indexInBlock].
type()) {
334 sum_ecal += clusterRef->energy()/cosh(clusterRef->eta());
340 sum_hcal += clusterRef->energy()/cosh(clusterRef->eta());
358 return sum_ecal+sum_hcal;
367 for(
unsigned int i = 0;
i < towers->size(); ++
i){
369 double pt = tower.
pt();
T getParameter(std::string const &) const
edm::EDGetTokenT< CaloTowerCollection > srcTower_
reco::TrackCollection::const_iterator TI
std::auto_ptr< TrackingRecHitCollection > selHits_
virtual float pt() const
transverse momentum
friend struct const_iterator
void produce(edm::Event &evt, const edm::EventSetup &es)
process one event
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::vector< Track > TrackCollection
collection of Tracks
virtual ~HICaloCompatibleTrackSelector()
destructor
bool innerOk() const
return true if the innermost hit is valid
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
std::string qualityToSet_
double deltaR(const T1 &t1, const T2 &t2)
key_type key() const
Accessor for product key.
std::string qualityToMatch_
const math::XYZPoint & outerPosition() const
position of the outermost hit
std::auto_ptr< reco::TrackExtraCollection > selTrackExtras_
edm::EDGetTokenT< reco::TrackCollection > srcTracks_
source collection label
edm::EDGetTokenT< std::vector< Trajectory > > srcTrackTrajs_
std::string qualityToSkip_
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
reco::TrackRef trackRef() const
const math::XYZPoint & innerPosition() const
position of the innermost hit
TrackingRecHitRefProd rHits_
reco::PFCandidateCollection::const_iterator CI
std::auto_ptr< std::vector< Trajectory > > selTrajs_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual float eta() const
momentum pseudorapidity
edm::Ref< TrackingRecHitCollection > TrackingRecHitRef
persistent reference to a TrackingRecHit
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
double pt() const
track transverse momentum
std::string minimumQuality_
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)
edm::RefProd< std::vector< Trajectory > > rTrajectories_
trackingRecHit_iterator recHitsBegin() const
Iterator to first hit on the track.
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
std::vector< reco::TrackRef > trackRefs_
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCands_
RefProd< PROD > getRefBeforePut()
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
edm::RefToBase< TrajectorySeed > seedRef() const
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
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.
Particle reconstructed by the particle flow algorithm.
reco::TrackExtraRefProd rTrackExtras_
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
std::auto_ptr< reco::TrackCollection > selTracks_
storage
std::auto_ptr< TrajTrackAssociationCollection > selTTAss_
const TrackResiduals & residuals() const
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)
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
volatile std::atomic< bool > shutdown_flag false
std::string funcDeltaRTowerMatch_
virtual ParticleType particleId() const
bool copyTrajectories_
copy also trajectories and trajectory->track associations
const ElementsInBlocks & elementsInBlocks() const
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.