CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
reco::modules::HICaloCompatibleTrackSelector Class Reference

#include <HICaloCompatibleTrackSelector.h>

Inheritance diagram for reco::modules::HICaloCompatibleTrackSelector:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HICaloCompatibleTrackSelector (const edm::ParameterSet &cfg)
 constructor More...
 
virtual ~HICaloCompatibleTrackSelector ()
 destructor More...
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

typedef
reco::PFCandidateCollection::const_iterator 
CI
 
typedef math::XYZPoint Point
 
typedef
reco::TrackCollection::const_iterator 
TI
 

Private Member Functions

void matchByDrAllowReuse (const reco::Track &trk, const edm::Handle< CaloTowerCollection > &towers, double &bestdr, double &bestpt)
 
double matchPFCandToTrack (const edm::Handle< PFCandidateCollection > &pfCandidates, unsigned it, double trkPt)
 
void produce (edm::Event &evt, const edm::EventSetup &es)
 process one event More...
 
bool selectByPFCands (TI ti, const edm::Handle< TrackCollection > hSrcTrack, const edm::Handle< PFCandidateCollection > pfCandidates, bool isPFThere)
 
bool selectByTowers (TI ti, const edm::Handle< TrackCollection > hSrcTrack, const edm::Handle< CaloTowerCollection > towers, bool isTowerThere)
 

Private Attributes

bool applyPtDepCut_
 
bool copyExtras_
 copy only the tracks, not extras and rechits (for AOD) More...
 
bool copyTrajectories_
 copy also trajectories and trajectory->track associations More...
 
TF1 * fCaloComp
 
TF1 * fDeltaRTowerMatch
 
std::string funcCaloComp_
 
std::string funcDeltaRTowerMatch_
 
bool keepAllTracks_
 
double matchConeRadius_
 
std::string minimumQuality_
 
bool passElectrons_
 
bool passMuons_
 
std::string qualityToMatch_
 
std::string qualityToSet_
 
std::string qualityToSkip_
 
bool resetQuality_
 
TrackingRecHitRefProd rHits_
 
reco::TrackExtraRefProd rTrackExtras_
 
reco::TrackRefProd rTracks_
 
edm::RefProd< std::vector
< Trajectory > > 
rTrajectories_
 
std::auto_ptr
< TrackingRecHitCollection
selHits_
 
std::auto_ptr
< reco::TrackExtraCollection
selTrackExtras_
 
std::auto_ptr
< reco::TrackCollection
selTracks_
 storage More...
 
std::auto_ptr< std::vector
< const Trajectory * > > 
selTrajPtrs_
 
std::auto_ptr< std::vector
< Trajectory > > 
selTrajs_
 
std::auto_ptr
< TrajTrackAssociationCollection
selTTAss_
 
edm::EDGetTokenT
< reco::PFCandidateCollection
srcPFCands_
 
edm::EDGetTokenT
< CaloTowerCollection
srcTower_
 
edm::EDGetTokenT
< reco::TrackCollection
srcTracks_
 source collection label More...
 
edm::EDGetTokenT
< TrajTrackAssociationCollection
srcTrackTrajAssoc_
 
edm::EDGetTokenT< std::vector
< Trajectory > > 
srcTrackTrajs_
 
double towerPtMin_
 
std::vector< reco::TrackReftrackRefs_
 
double trkCompPtMin_
 
double trkEtaMax_
 
double trkMatchPtMin_
 
bool usePFCandMatching_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 48 of file HICaloCompatibleTrackSelector.h.

Member Typedef Documentation

typedef reco::PFCandidateCollection::const_iterator reco::modules::HICaloCompatibleTrackSelector::CI
private

Definition at line 58 of file HICaloCompatibleTrackSelector.h.

Definition at line 57 of file HICaloCompatibleTrackSelector.h.

typedef reco::TrackCollection::const_iterator reco::modules::HICaloCompatibleTrackSelector::TI
private

Definition at line 59 of file HICaloCompatibleTrackSelector.h.

Constructor & Destructor Documentation

HICaloCompatibleTrackSelector::HICaloCompatibleTrackSelector ( const edm::ParameterSet cfg)
explicit

constructor

Definition at line 31 of file HICaloCompatibleTrackSelector.cc.

References HLT_25ns14e33_v1_cff::alias, copyExtras_, copyTrajectories_, fCaloComp, fDeltaRTowerMatch, funcCaloComp_, funcDeltaRTowerMatch_, edm::ParameterSet::getParameter(), srcTrackTrajAssoc_, srcTrackTrajs_, and AlCaHLTBitMon_QueryRunRegistry::string.

31  :
32  srcTracks_(consumes<TrackCollection>(cfg.getParameter<edm::InputTag>("srcTracks"))),
33  srcPFCands_(consumes<PFCandidateCollection>(cfg.getParameter<edm::InputTag>("srcPFCands"))),
34  srcTower_(consumes<CaloTowerCollection>(cfg.getParameter<edm::InputTag>("srcTower"))),
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"))
53 {
54  std::string alias( cfg.getParameter<std::string>( "@module_label" ) );
55  produces<reco::TrackCollection>().setBranchAlias( alias + "Tracks");
56  if (copyExtras_) {
57  produces<reco::TrackExtraCollection>().setBranchAlias( alias + "TrackExtras");
58  produces<TrackingRecHitCollection>().setBranchAlias( alias + "RecHits");
59  }
60  if (copyTrajectories_) {
61  produces< std::vector<Trajectory> >().setBranchAlias( alias + "Trajectories");
62  produces< TrajTrackAssociationCollection >().setBranchAlias( alias + "TrajectoryTrackAssociations");
63  srcTrackTrajs_ = (consumes<std::vector<Trajectory> >(cfg.getParameter<edm::InputTag>("srcTracks")));
64  srcTrackTrajAssoc_ = (consumes<TrajTrackAssociationCollection>(cfg.getParameter<edm::InputTag>("srcTracks")));
65  }
66 
67  // pt dependence of delta R matching requirement
68  fDeltaRTowerMatch = new TF1("fDeltaRTowerMatch",funcDeltaRTowerMatch_.c_str(),0,200);
69  // pt dependance of calo compatibility, i.e., minimum sum Calo Et vs. track pT
70  fCaloComp = new TF1("fCaloComp",funcCaloComp_.c_str(),0,200); // a parameterization of pt dependent cut
71 
72 
73 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< CaloTowerCollection > srcTower_
edm::EDGetTokenT< reco::TrackCollection > srcTracks_
source collection label
edm::EDGetTokenT< std::vector< Trajectory > > srcTrackTrajs_
bool copyExtras_
copy only the tracks, not extras and rechits (for AOD)
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCands_
bool copyTrajectories_
copy also trajectories and trajectory-&gt;track associations
edm::EDGetTokenT< TrajTrackAssociationCollection > srcTrackTrajAssoc_
HICaloCompatibleTrackSelector::~HICaloCompatibleTrackSelector ( )
virtual

destructor

Definition at line 75 of file HICaloCompatibleTrackSelector.cc.

75  {
76 }

Member Function Documentation

void HICaloCompatibleTrackSelector::matchByDrAllowReuse ( const reco::Track trk,
const edm::Handle< CaloTowerCollection > &  towers,
double &  bestdr,
double &  bestpt 
)
private

Definition at line 359 of file HICaloCompatibleTrackSelector.cc.

References reco::deltaR(), reco::LeafCandidate::eta(), i, EnergyCorrector::pt, reco::LeafCandidate::pt(), towerPtMin_, and trkEtaMax_.

Referenced by selectByTowers().

360 {
361  // loop over towers
362  bestdr=1e10;
363  bestpt=0.;
364  for(unsigned int i = 0; i < towers->size(); ++i){
365  const CaloTower & tower= (*towers)[i];
366  double pt = tower.pt();
367  if (pt<towerPtMin_) continue;
368  if (fabs(tower.eta())>trkEtaMax_) continue;
369  double dr = reco::deltaR(tower,trk);
370  if (dr<bestdr) {
371  bestdr = dr;
372  bestpt = pt;
373  }
374  }
375 }
int i
Definition: DBlmapReader.cc:9
double deltaR(const T1 &t1, const T2 &t2)
Definition: deltaR.h:48
virtual double eta() const
momentum pseudorapidity
virtual double pt() const
transverse momentum
double HICaloCompatibleTrackSelector::matchPFCandToTrack ( const edm::Handle< PFCandidateCollection > &  pfCandidates,
unsigned  it,
double  trkPt 
)
private

Definition at line 272 of file HICaloCompatibleTrackSelector.cc.

References reco::PFCandidate::e, reco::PFBlockElement::ECAL, bookConverter::elements, reco::PFCandidate::elementsInBlocks(), reco::PFCandidate::h, reco::PFBlockElement::HCAL, cuy::ib, edm::Ref< C, T, F >::key(), reco::PFCandidate::mu, reco::PFCandidate::particleId(), passElectrons_, passMuons_, reco::PFBlockElement::TRACK, reco::PFCandidate::trackRef(), and trkMatchPtMin_.

Referenced by selectByPFCands().

273 {
274 
275  // This function returns the sum of the calo energy in the block containing the track
276  // There is another piece of information which could be useful which is the pT assigned to the charged hadron by PF
277 
278 
279  double sum_ecal=0.0, sum_hcal=0.0;
280 
281  int candType = 0;
282  reco::PFCandidate matchedCand;
283 
284  // loop over the PFCandidates until you find the one whose trackRef points to the track
285 
286  for( CI ci = pfCandidates->begin(); ci!=pfCandidates->end(); ++ci) {
287 
288  const reco::PFCandidate& cand = *ci;
289 
290  int type = cand.particleId();
291 
292  // only charged hadrons and leptons can be asscociated with a track
293  if(!(type == PFCandidate::h || //type1
294  type == PFCandidate::e || //type2
295  type == PFCandidate::mu //type3
296  )
297  ) continue;
298 
299 
300  unsigned candTrackRefKey = cand.trackRef().key();
301 
302  if(it==candTrackRefKey) {
303  matchedCand = cand;
304  candType = type;
305  break;
306  }
307  }
308  // take all muons as compatible, extend to electrons when validataed
309  if(passMuons_ && candType==3) return 9999.;
310  if(passElectrons_ && candType==2) return 9999.;
311 
312  if(trkPt < trkMatchPtMin_ ) return 0.;
313 
314  if(candType>0){
315 
316  // Now that we found the matched PF candidate, loop over the elements in the block summing the calo Et
317  for(unsigned ib=0; ib<matchedCand.elementsInBlocks().size(); ib++) {
318 
319  PFBlockRef blockRef = matchedCand.elementsInBlocks()[ib].first;
320 
321  unsigned indexInBlock = matchedCand.elementsInBlocks()[ib].second;
322  const edm::OwnVector< reco::PFBlockElement>& elements = (*blockRef).elements();
323 
324  //This tells you what type of element it is:
325  //cout<<" block type"<<elements[indexInBlock].type()<<endl;
326 
327  switch (elements[indexInBlock].type()) {
328 
329  case PFBlockElement::ECAL: {
330  reco::PFClusterRef clusterRef = elements[indexInBlock].clusterRef();
331  sum_ecal += clusterRef->energy()/cosh(clusterRef->eta());
332  break;
333  }
334 
335  case PFBlockElement::HCAL: {
336  reco::PFClusterRef clusterRef = elements[indexInBlock].clusterRef();
337  sum_hcal += clusterRef->energy()/cosh(clusterRef->eta());
338  break;
339  }
340  case PFBlockElement::TRACK: {
341  //Do nothing since track are not normally linked to other tracks
342  break;
343  }
344  default:
345  break;
346  }
347 
348  // We could also add in the PS, HO, ..
349 
350  } // end of elementsInBlocks()
351  } // end of isCandFound
352 
353 
354 
355  return sum_ecal+sum_hcal;
356 
357 }
type
Definition: HCALResponse.h:21
int ib
Definition: cuy.py:660
key_type key() const
Accessor for product key.
Definition: Ref.h:264
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:433
dictionary elements
reco::PFCandidateCollection::const_iterator CI
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
virtual ParticleType particleId() const
Definition: PFCandidate.h:373
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:682
void HICaloCompatibleTrackSelector::produce ( edm::Event evt,
const edm::EventSetup es 
)
privatevirtual

process one event

Implements edm::EDProducer.

Definition at line 79 of file HICaloCompatibleTrackSelector.cc.

References edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > >::const_iterator, copyExtras_, copyTrajectories_, cond::rpcobimon::current, edm::friendlyname::emptyString(), edm::Event::getByToken(), edm::Event::getRefBeforePut(), i, reco::Track::innerDetId(), reco::Track::innerMomentum(), reco::Track::innerOk(), reco::Track::innerPosition(), reco::Track::innerStateCovariance(), keepAllTracks_, edm::Ref< C, T, F >::key(), LogDebug, match(), gen::n, reco::Track::outerDetId(), reco::Track::outerMomentum(), reco::Track::outerOk(), reco::Track::outerPosition(), reco::Track::outerStateCovariance(), reco::tau::pfCandidates(), edm::Event::put(), reco::TrackBase::qualityByName(), qualityToSet_, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), dt_dqm_sourceclient_common_cff::reco, reco::Track::residuals(), rHits_, rTrackExtras_, rTracks_, rTrajectories_, reco::Track::seedDirection(), reco::Track::seedRef(), selectByPFCands(), selectByTowers(), selHits_, selTrackExtras_, selTracks_, selTrajs_, selTTAss_, reco::TrackExtraBase::setHits(), reco::TrackExtra::setResiduals(), srcPFCands_, srcTower_, srcTracks_, srcTrackTrajAssoc_, srcTrackTrajs_, HLT_25ns14e33_v1_cff::towers, trackRefs_, trkMatchPtMin_, and usePFCandMatching_.

80 {
81  using namespace std;
82  using namespace edm;
83  using namespace reco;
84 
85  LogDebug("HICaloCompatibleTrackSelector")<<"min pt for selection = "<< trkMatchPtMin_<<endl;
86 
87 
88  Handle<TrackCollection> hSrcTrack;
92 
93  evt.getByToken(srcTracks_,hSrcTrack);
94 
95  selTracks_ = auto_ptr<TrackCollection>(new TrackCollection());
97  if (copyExtras_) {
98  selTrackExtras_ = auto_ptr<TrackExtraCollection>(new TrackExtraCollection());
99  selHits_ = auto_ptr<TrackingRecHitCollection>(new TrackingRecHitCollection());
102  }
103 
104 
105  if (copyTrajectories_) trackRefs_.resize(hSrcTrack->size());
106 
107 
110 
111  bool isPFThere = false;
112  bool isTowerThere = false;
113 
114  if(usePFCandMatching_) isPFThere = evt.getByToken(srcPFCands_, pfCandidates);
115  else isTowerThere = evt.getByToken(srcTower_, towers);
116 
117  size_t current = 0;
118  for (TI ti = hSrcTrack->begin(), ed = hSrcTrack->end(); ti != ed; ++ti, ++current) {
119 
120 
121  const reco::Track& trk = *ti;
122 
123  bool isSelected;
124  if(usePFCandMatching_) isSelected = selectByPFCands(ti, hSrcTrack, pfCandidates, isPFThere);
125  else isSelected = selectByTowers(ti, hSrcTrack, towers, isTowerThere);
126 
127  if(!keepAllTracks_ && !isSelected) continue;
128 
129  // Add all tracks to output collection, the rest of the code only sets the quality bit
130  selTracks_->push_back( reco::Track( trk ) ); // clone and store
131 
132 
133  if(isSelected) selTracks_->back().setQuality(reco::TrackBase::qualityByName(qualityToSet_.c_str()));
134 
135 
136  if (copyExtras_) {
137  // TrackExtras
138  selTrackExtras_->push_back( TrackExtra( trk.outerPosition(), trk.outerMomentum(), trk.outerOk(),
139  trk.innerPosition(), trk.innerMomentum(), trk.innerOk(),
140  trk.outerStateCovariance(), trk.outerDetId(),
141  trk.innerStateCovariance(), trk.innerDetId(),
142  trk.seedDirection(), trk.seedRef() ) );
143  selTracks_->back().setExtra( TrackExtraRef( rTrackExtras_, selTrackExtras_->size() - 1) );
144  TrackExtra & tx = selTrackExtras_->back();
145  tx.setResiduals(trk.residuals());
146  // TrackingRecHits
147  auto const firstHitIndex = selHits_->size();
148  for( trackingRecHit_iterator hit = trk.recHitsBegin(); hit != trk.recHitsEnd(); ++ hit ) {
149  selHits_->push_back( (*hit)->clone() );
150  }
151  tx.setHits( rHits_, firstHitIndex, selHits_->size() - firstHitIndex );
152  }
153  if (copyTrajectories_) {
154  trackRefs_[current] = TrackRef(rTracks_, selTracks_->size() - 1);
155  }
156 
157 
158  } // close track loop
159 
160  if ( copyTrajectories_ ) {
163  evt.getByToken(srcTrackTrajs_, hTTAss);
164  evt.getByToken(srcTrackTrajAssoc_, hTraj);
165  selTrajs_ = auto_ptr< vector<Trajectory> >(new vector<Trajectory>());
166  rTrajectories_ = evt.getRefBeforePut< vector<Trajectory> >();
167  selTTAss_ = auto_ptr< TrajTrackAssociationCollection >(new TrajTrackAssociationCollection());
168  for (size_t i = 0, n = hTraj->size(); i < n; ++i) {
169  Ref< vector<Trajectory> > trajRef(hTraj, i);
171  if (match != hTTAss->end()) {
172  const Ref<TrackCollection> &trkRef = match->val;
173  short oldKey = static_cast<short>(trkRef.key());
174  if (trackRefs_[oldKey].isNonnull()) {
175  selTrajs_->push_back( Trajectory(*trajRef) );
176  selTTAss_->insert ( Ref< vector<Trajectory> >(rTrajectories_, selTrajs_->size() - 1), trackRefs_[oldKey] );
177  }
178  }
179  }
180  }
181 
182  static const string emptyString;
183  evt.put(selTracks_);
184  if (copyExtras_ ) {
185  evt.put(selTrackExtras_);
186  evt.put(selHits_);
187  }
188  if ( copyTrajectories_ ) {
189  evt.put(selTrajs_);
190  evt.put(selTTAss_);
191  }
192 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
edm::EDGetTokenT< CaloTowerCollection > srcTower_
std::auto_ptr< TrackingRecHitCollection > selHits_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:464
void setHits(TrackingRecHitRefProd const &prod, unsigned firstH, unsigned int nH)
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
bool innerOk() const
return true if the innermost hit is valid
Definition: Track.h:50
edm::Ref< TrackExtraCollection > TrackExtraRef
persistent reference to a TrackExtra
Definition: TrackExtraFwd.h:17
key_type key() const
Accessor for product key.
Definition: Ref.h:264
const math::XYZPoint & outerPosition() const
position of the outermost hit
Definition: Track.h:65
std::auto_ptr< reco::TrackExtraCollection > selTrackExtras_
edm::EDGetTokenT< reco::TrackCollection > srcTracks_
source collection label
edm::EDGetTokenT< std::vector< Trajectory > > srcTrackTrajs_
std::vector< PFCandidatePtr > pfCandidates(const PFJet &jet, int particleId, bool sort=true)
const math::XYZPoint & innerPosition() const
position of the innermost hit
Definition: Track.h:55
std::auto_ptr< std::vector< Trajectory > > selTrajs_
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:120
CovarianceMatrix outerStateCovariance() const
outermost trajectory state curvilinear errors
Definition: Track.h:75
unsigned int outerDetId() const
DetId of the detector on which surface the outermost state is located.
Definition: Track.h:94
bool selectByTowers(TI ti, const edm::Handle< TrackCollection > hSrcTrack, const edm::Handle< CaloTowerCollection > towers, bool isTowerThere)
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.
Definition: Track.h:104
edm::AssociationMap< edm::OneToOne< std::vector< Trajectory >, reco::TrackCollection, unsigned short > > TrajTrackAssociationCollection
edm::EDGetTokenT< reco::PFCandidateCollection > srcPFCands_
RefProd< PROD > getRefBeforePut()
Definition: Event.h:140
std::vector< TrackExtra > TrackExtraCollection
collection of TrackExtra objects
Definition: TrackExtraFwd.h:11
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
edm::RefToBase< TrajectorySeed > seedRef() const
Definition: Track.h:213
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:123
const math::XYZVector & outerMomentum() const
momentum vector at the outermost hit position
Definition: Track.h:70
bool outerOk() const
return true if the outermost hit is valid
Definition: Track.h:45
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:20
CovarianceMatrix innerStateCovariance() const
innermost trajectory state curvilinear errors
Definition: Track.h:80
static std::string const emptyString("")
const math::XYZVector & innerMomentum() const
momentum vector at the innermost hit position
Definition: Track.h:60
std::auto_ptr< reco::TrackCollection > selTracks_
storage
std::auto_ptr< TrajTrackAssociationCollection > selTTAss_
const TrackResiduals & residuals() const
Definition: Track.h:220
bool selectByPFCands(TI ti, const edm::Handle< TrackCollection > hSrcTrack, const edm::Handle< PFCandidateCollection > pfCandidates, bool isPFThere)
PropagationDirection seedDirection() const
direction of how the hits were sorted in the original seed
Definition: Track.h:204
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
bool copyTrajectories_
copy also trajectories and trajectory-&gt;track associations
unsigned int innerDetId() const
DetId of the detector on which surface the innermost state is located.
Definition: Track.h:99
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.
Definition: Track.h:109
void setResiduals(const TrackResiduals &r)
set the residuals
Definition: TrackExtra.h:179
bool HICaloCompatibleTrackSelector::selectByPFCands ( TI  ti,
const edm::Handle< TrackCollection hSrcTrack,
const edm::Handle< PFCandidateCollection pfCandidates,
bool  isPFThere 
)
private

Definition at line 197 of file HICaloCompatibleTrackSelector.cc.

References Exception, fCaloComp, matchPFCandToTrack(), minimumQuality_, reco::TrackBase::pt(), reco::TrackBase::quality(), reco::TrackBase::qualityByName(), qualityToMatch_, qualityToSkip_, trkCompPtMin_, and usePFCandMatching_.

Referenced by produce().

198 {
199 
200  const reco::Track& trk = *ti;
201 
202  // If it passes this quality threshold or is under the minimum match pT, automatically save it
204  return true;
205  }
207  return false;
208  }
209  else
210  {
211 
212  double trkPt = trk.pt();
213  //if(trkPt < trkMatchPtMin_ ) return false;
214 
215  double caloEt = 0.0;
216  if(usePFCandMatching_){
217  if(isPFThere){
218  unsigned int trackKey = ti - hSrcTrack->begin();
219  caloEt = matchPFCandToTrack(pfCandidates, trackKey, trkPt);
220  }
221  }
222 
223  // Set quality bit based on calo matching
224  if(!(caloEt>0.)) return false;
225 
226 
227  if(trkPt<=trkCompPtMin_){
229  else return false;
230  }
231  else{
232  // loose cuts are implied in selectors, make configurable?
233  float compPt = (fCaloComp->Eval(trkPt)!=fCaloComp->Eval(trkPt)) ? 0 : fCaloComp->Eval(trkPt); // protect agains NaN
234  if(caloEt>compPt) return true;
235  else return false;
236  }
237  } // else above trkMatchPtMin_
238 
239  throw cms::Exception("Undefined case in HICaloCompatibleTrackSelector") << "Undefined case in HICaloCompatibleTrackSelector";
240 }
double pt() const
track transverse momentum
Definition: TrackBase.h:608
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:123
double matchPFCandToTrack(const edm::Handle< PFCandidateCollection > &pfCandidates, unsigned it, double trkPt)
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:497
bool HICaloCompatibleTrackSelector::selectByTowers ( TI  ti,
const edm::Handle< TrackCollection hSrcTrack,
const edm::Handle< CaloTowerCollection towers,
bool  isTowerThere 
)
private

Definition at line 244 of file HICaloCompatibleTrackSelector.cc.

References fDeltaRTowerMatch, matchByDrAllowReuse(), reco::TrackBase::pt(), reco::TrackBase::quality(), reco::TrackBase::qualityByName(), qualityToMatch_, qualityToSkip_, trkCompPtMin_, and trkMatchPtMin_.

Referenced by produce().

245 {
246 
247  // Not up to date! use PF towers instead
248 
249  const reco::Track& trk = *ti;
250 
251  // If it passes the high purity cuts, then consider it confirmed
253  return true;
254  }
255  else{
256  if(trk.pt() < trkMatchPtMin_ || !trk.quality(reco::TrackBase::qualityByName(qualityToMatch_))) return false;
257 
258  double caloEt = 0.0;
259  if(isTowerThere){
260  double matchDr;
261  matchByDrAllowReuse(trk,towers,matchDr,caloEt);
262  float matchConeRadius_pt = (fDeltaRTowerMatch->Eval(trk.pt())!=fDeltaRTowerMatch->Eval(trk.pt())) ? 0 : fDeltaRTowerMatch->Eval(trk.pt()); // protect agains NaN
263  if (caloEt>0 && matchDr>matchConeRadius_pt) caloEt=0.;
264  }
265 
266  if(trk.pt()<trkCompPtMin_||caloEt>0.75*(trk.pt()-trkCompPtMin_)) return true;
267  else return false;
268  }
269 }
double pt() const
track transverse momentum
Definition: TrackBase.h:608
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:123
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:497
void matchByDrAllowReuse(const reco::Track &trk, const edm::Handle< CaloTowerCollection > &towers, double &bestdr, double &bestpt)

Member Data Documentation

bool reco::modules::HICaloCompatibleTrackSelector::applyPtDepCut_
private

Definition at line 79 of file HICaloCompatibleTrackSelector.h.

bool reco::modules::HICaloCompatibleTrackSelector::copyExtras_
private

copy only the tracks, not extras and rechits (for AOD)

Definition at line 89 of file HICaloCompatibleTrackSelector.h.

Referenced by HICaloCompatibleTrackSelector(), and produce().

bool reco::modules::HICaloCompatibleTrackSelector::copyTrajectories_
private

copy also trajectories and trajectory->track associations

Definition at line 91 of file HICaloCompatibleTrackSelector.h.

Referenced by HICaloCompatibleTrackSelector(), and produce().

TF1 * reco::modules::HICaloCompatibleTrackSelector::fCaloComp
private
TF1* reco::modules::HICaloCompatibleTrackSelector::fDeltaRTowerMatch
private
std::string reco::modules::HICaloCompatibleTrackSelector::funcCaloComp_
private

Definition at line 104 of file HICaloCompatibleTrackSelector.h.

Referenced by HICaloCompatibleTrackSelector().

std::string reco::modules::HICaloCompatibleTrackSelector::funcDeltaRTowerMatch_
private

Definition at line 103 of file HICaloCompatibleTrackSelector.h.

Referenced by HICaloCompatibleTrackSelector().

bool reco::modules::HICaloCompatibleTrackSelector::keepAllTracks_
private

Definition at line 87 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

double reco::modules::HICaloCompatibleTrackSelector::matchConeRadius_
private

Definition at line 85 of file HICaloCompatibleTrackSelector.h.

std::string reco::modules::HICaloCompatibleTrackSelector::minimumQuality_
private

Definition at line 96 of file HICaloCompatibleTrackSelector.h.

Referenced by selectByPFCands().

bool reco::modules::HICaloCompatibleTrackSelector::passElectrons_
private

Definition at line 100 of file HICaloCompatibleTrackSelector.h.

Referenced by matchPFCandToTrack().

bool reco::modules::HICaloCompatibleTrackSelector::passMuons_
private

Definition at line 99 of file HICaloCompatibleTrackSelector.h.

Referenced by matchPFCandToTrack().

std::string reco::modules::HICaloCompatibleTrackSelector::qualityToMatch_
private

Definition at line 95 of file HICaloCompatibleTrackSelector.h.

Referenced by selectByPFCands(), and selectByTowers().

std::string reco::modules::HICaloCompatibleTrackSelector::qualityToSet_
private

Definition at line 93 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

std::string reco::modules::HICaloCompatibleTrackSelector::qualityToSkip_
private

Definition at line 94 of file HICaloCompatibleTrackSelector.h.

Referenced by selectByPFCands(), and selectByTowers().

bool reco::modules::HICaloCompatibleTrackSelector::resetQuality_
private

Definition at line 97 of file HICaloCompatibleTrackSelector.h.

TrackingRecHitRefProd reco::modules::HICaloCompatibleTrackSelector::rHits_
private

Definition at line 115 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

reco::TrackExtraRefProd reco::modules::HICaloCompatibleTrackSelector::rTrackExtras_
private

Definition at line 114 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

reco::TrackRefProd reco::modules::HICaloCompatibleTrackSelector::rTracks_
private

Definition at line 113 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

edm::RefProd< std::vector<Trajectory> > reco::modules::HICaloCompatibleTrackSelector::rTrajectories_
private

Definition at line 116 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

std::auto_ptr< TrackingRecHitCollection> reco::modules::HICaloCompatibleTrackSelector::selHits_
private

Definition at line 109 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

std::auto_ptr<reco::TrackExtraCollection> reco::modules::HICaloCompatibleTrackSelector::selTrackExtras_
private

Definition at line 108 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

std::auto_ptr<reco::TrackCollection> reco::modules::HICaloCompatibleTrackSelector::selTracks_
private

storage

Definition at line 107 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

std::auto_ptr< std::vector<const Trajectory *> > reco::modules::HICaloCompatibleTrackSelector::selTrajPtrs_
private

Definition at line 111 of file HICaloCompatibleTrackSelector.h.

std::auto_ptr< std::vector<Trajectory> > reco::modules::HICaloCompatibleTrackSelector::selTrajs_
private

Definition at line 110 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

std::auto_ptr< TrajTrackAssociationCollection > reco::modules::HICaloCompatibleTrackSelector::selTTAss_
private

Definition at line 112 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

edm::EDGetTokenT<reco::PFCandidateCollection> reco::modules::HICaloCompatibleTrackSelector::srcPFCands_
private

Definition at line 73 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

edm::EDGetTokenT<CaloTowerCollection> reco::modules::HICaloCompatibleTrackSelector::srcTower_
private

Definition at line 74 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

edm::EDGetTokenT<reco::TrackCollection> reco::modules::HICaloCompatibleTrackSelector::srcTracks_
private

source collection label

Definition at line 72 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

edm::EDGetTokenT<TrajTrackAssociationCollection> reco::modules::HICaloCompatibleTrackSelector::srcTrackTrajAssoc_
private

Definition at line 76 of file HICaloCompatibleTrackSelector.h.

Referenced by HICaloCompatibleTrackSelector(), and produce().

edm::EDGetTokenT<std::vector<Trajectory> > reco::modules::HICaloCompatibleTrackSelector::srcTrackTrajs_
private

Definition at line 75 of file HICaloCompatibleTrackSelector.h.

Referenced by HICaloCompatibleTrackSelector(), and produce().

double reco::modules::HICaloCompatibleTrackSelector::towerPtMin_
private

Definition at line 84 of file HICaloCompatibleTrackSelector.h.

Referenced by matchByDrAllowReuse().

std::vector<reco::TrackRef> reco::modules::HICaloCompatibleTrackSelector::trackRefs_
private

Definition at line 117 of file HICaloCompatibleTrackSelector.h.

Referenced by produce().

double reco::modules::HICaloCompatibleTrackSelector::trkCompPtMin_
private

Definition at line 82 of file HICaloCompatibleTrackSelector.h.

Referenced by selectByPFCands(), and selectByTowers().

double reco::modules::HICaloCompatibleTrackSelector::trkEtaMax_
private

Definition at line 83 of file HICaloCompatibleTrackSelector.h.

Referenced by matchByDrAllowReuse().

double reco::modules::HICaloCompatibleTrackSelector::trkMatchPtMin_
private

Definition at line 81 of file HICaloCompatibleTrackSelector.h.

Referenced by matchPFCandToTrack(), produce(), and selectByTowers().

bool reco::modules::HICaloCompatibleTrackSelector::usePFCandMatching_
private

Definition at line 80 of file HICaloCompatibleTrackSelector.h.

Referenced by produce(), and selectByPFCands().