CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
RecoTrackSelectorBase.h
Go to the documentation of this file.
1 #ifndef CommonTools_RecoAlgos_RecoTrackSelectorBase_h
2 #define CommonTools_RecoAlgos_RecoTrackSelectorBase_h
3 
6 
12 
13 
15 public:
18  ptMin_(cfg.getParameter<double>("ptMin")),
19  minRapidity_(cfg.getParameter<double>("minRapidity")),
20  maxRapidity_(cfg.getParameter<double>("maxRapidity")),
21  tip_(cfg.getParameter<double>("tip")),
22  lip_(cfg.getParameter<double>("lip")),
23  maxChi2_(cfg.getParameter<double>("maxChi2")),
24  minHit_(cfg.getParameter<int>("minHit")),
25  minPixelHit_(cfg.getParameter<int>("minPixelHit")),
26  minLayer_(cfg.getParameter<int>("minLayer")),
27  min3DLayer_(cfg.getParameter<int>("min3DLayer")),
28  usePV_(cfg.getParameter<bool>("usePV")),
29  bsSrcToken_(iC.consumes<reco::BeamSpot>(cfg.getParameter<edm::InputTag>("beamSpot"))) {
30  if (usePV_)
32  for(const std::string& quality: cfg.getParameter<std::vector<std::string> >("quality"))
34  for(const std::string& algorithm: cfg.getParameter<std::vector<std::string> >("algorithm"))
36  }
37 
38  void init(const edm::Event& event, const edm::EventSetup& es) {
40  event.getByToken(bsSrcToken_,beamSpot);
41  vertex_ = beamSpot->position();
42  if (!usePV_) return;
44  event.getByToken(vertexToken_, hVtx);
45  if (hVtx->empty()) return;
46  vertex_ = (*hVtx)[0].position();
47  }
48 
49  bool operator()( const reco::Track & t) const {
50  bool quality_ok = true;
51  if (quality_.size()!=0) {
52  quality_ok = false;
53  for (unsigned int i = 0; i<quality_.size();++i) {
54  if (t.quality(quality_[i])){
55  quality_ok = true;
56  break;
57  }
58  }
59  }
60 
61  bool algo_ok = true;
62  if (algorithm_.size()!=0) {
63  if (std::find(algorithm_.begin(),algorithm_.end(),t.algo())==algorithm_.end()) algo_ok = false;
64  }
65  return
66  (
67  (algo_ok & quality_ok) &&
73  fabs(t.pt()) >= ptMin_ &&
74  t.eta() >= minRapidity_ && t.eta() <= maxRapidity_ &&
75  fabs(t.dxy(vertex_)) <= tip_ &&
76  fabs(t.dsz(vertex_)) <= lip_ &&
78  );
79  }
80 
81 
82 private:
83  double ptMin_;
84  double minRapidity_;
85  double maxRapidity_;
86  double tip_;
87  double lip_;
88  double maxChi2_;
89  int minHit_;
91  int minLayer_;
93  bool usePV_;
94 
97 
98  std::vector<reco::TrackBase::TrackQuality> quality_;
99  std::vector<reco::TrackBase::TrackAlgorithm> algorithm_;
100 
102 };
103 
104 #endif
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
tuple t
Definition: tree.py:139
int i
Definition: DBlmapReader.cc:9
void init(const edm::Event &event, const edm::EventSetup &es)
tuple cfg
Definition: looper.py:259
double normalizedChi2() const
chi-squared divided by n.d.o.f. (or chi-squared * 1e6 if n.d.o.f. is zero)
Definition: TrackBase.h:524
int numberOfValidHits() const
Definition: HitPattern.h:734
std::vector< Vertex > VertexCollection
collection of Vertex objects
Definition: VertexFwd.h:9
int pixelLayersWithMeasurement() const
Definition: HitPattern.cc:458
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
double dsz() const
dsz parameter (THIS IS NOT the SZ impact parameter to (0,0,0) if refPoint is far from (0...
Definition: TrackBase.h:566
int trackerLayersWithMeasurement() const
Definition: HitPattern.cc:477
reco::Track::Point vertex_
TrackAlgorithm algo() const
Definition: TrackBase.h:460
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:614
int numberOfValidStripLayersWithMonoAndStereo(uint16_t stripdet, uint16_t layer) const
Definition: HitPattern.cc:300
double pt() const
track transverse momentum
Definition: TrackBase.h:584
math::XYZPoint Point
point in the space
Definition: TrackBase.h:83
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
std::vector< reco::TrackBase::TrackQuality > quality_
RecoTrackSelectorBase(const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
static TrackQuality qualityByName(const std::string &name)
Definition: TrackBase.cc:123
const HitPattern & hitPattern() const
Access the hit pattern, indicating in which Tracker layers the track has hits.
Definition: TrackBase.h:421
bool operator()(const reco::Track &t) const
edm::EDGetTokenT< reco::VertexCollection > vertexToken_
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:473
std::vector< reco::TrackBase::TrackAlgorithm > algorithm_
edm::EDGetTokenT< reco::BeamSpot > bsSrcToken_
static TrackAlgorithm algoByName(const std::string &name)
Definition: TrackBase.cc:135
int numberOfValidPixelHits() const
Definition: HitPattern.h:749
double dxy() const
dxy parameter. (This is the transverse impact parameter w.r.t. to (0,0,0) ONLY if refPoint is close t...
Definition: TrackBase.h:554