CMS 3D CMS Logo

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

#include <CalibrationTrackSelector.h>

Classes

struct  ComparePt
 compare two tracks in pt (used by theNHighestPtTracks) More...
 

Public Types

typedef std::vector< const
reco::Track * > 
Tracks
 

Public Member Functions

 CalibrationTrackSelector (const edm::ParameterSet &cfg)
 constructor More...
 
Tracks select (const Tracks &tracks, const edm::Event &evt) const
 select tracks More...
 
 ~CalibrationTrackSelector ()
 destructor More...
 

Private Member Functions

Tracks basicCuts (const Tracks &tracks, const edm::Event &evt) const
 apply basic cuts on pt,eta,phi,nhit More...
 
bool detailedHitsCheck (const reco::Track *track, const edm::Event &evt) const
 checking hit requirements beyond simple number of valid hits More...
 
bool isHit2D (const TrackingRecHit &hit) const
 
bool isIsolated (const TrackingRecHit *therechit, const edm::Event &evt) const
 
bool isOkCharge (const TrackingRecHit *therechit) const
 
Tracks theNHighestPtTracks (const Tracks &tracks) const
 filter the n highest pt tracks More...
 

Private Attributes

const bool applyBasicCuts_
 
const bool applyIsolation_
 
const bool applyMultiplicityFilter_
 
const bool applyNHighestPt_
 
const bool chargeCheck_
 
const double chi2nMax_
 
const double etaMax_
 
const double etaMin_
 
const edm::InputTag matchedrecHitsTag_
 
const int maxMultiplicity_
 
const double minHitChargeStrip_
 
const double minHitIsolation_
 
const int minHitsinBPIX_
 
const int minHitsinFPIX_
 
const int minHitsinTEC_
 
const int minHitsinTIB_
 
const int minHitsinTID_
 
const int minHitsinTOB_
 
const int minMultiplicity_
 
const bool multiplicityOnInput_
 
const int nHighestPt_
 
const double nHitMax_
 
const unsigned int nHitMin2D_
 
const double nHitMin_
 
const double phiMax_
 
const double phiMin_
 
ComparePt ptComparator
 
const double ptMax_
 
const double ptMin_
 if true, cut min/maxMultiplicity on input instead of on final result More...
 
const edm::InputTag rphirecHitsTag_
 
const bool seedOnlyFromAbove_
 

Detailed Description

Definition at line 15 of file CalibrationTrackSelector.h.

Member Typedef Documentation

typedef std::vector<const reco::Track*> CalibrationTrackSelector::Tracks

Definition at line 20 of file CalibrationTrackSelector.h.

Constructor & Destructor Documentation

CalibrationTrackSelector::CalibrationTrackSelector ( const edm::ParameterSet cfg)

constructor

Definition at line 25 of file CalibrationTrackSelector.cc.

References applyBasicCuts_, applyIsolation_, applyMultiplicityFilter_, applyNHighestPt_, chargeCheck_, chi2nMax_, etaMax_, etaMin_, maxMultiplicity_, minHitChargeStrip_, minHitIsolation_, minHitsinBPIX_, minHitsinFPIX_, minHitsinTEC_, minHitsinTIB_, minHitsinTID_, minHitsinTOB_, minMultiplicity_, multiplicityOnInput_, nHighestPt_, nHitMax_, nHitMin2D_, nHitMin_, phiMax_, phiMin_, ptMax_, and ptMin_.

25  :
26  applyBasicCuts_( cfg.getParameter<bool>( "applyBasicCuts" ) ),
27  applyNHighestPt_( cfg.getParameter<bool>( "applyNHighestPt" ) ),
28  applyMultiplicityFilter_( cfg.getParameter<bool>( "applyMultiplicityFilter" ) ),
29  seedOnlyFromAbove_( cfg.getParameter<int>( "seedOnlyFrom" ) ),
30  applyIsolation_( cfg.getParameter<bool>( "applyIsolationCut" ) ),
31  chargeCheck_( cfg.getParameter<bool>( "applyChargeCheck" ) ),
32  nHighestPt_( cfg.getParameter<int>( "nHighestPt" ) ),
33  minMultiplicity_ ( cfg.getParameter<int>( "minMultiplicity" ) ),
34  maxMultiplicity_ ( cfg.getParameter<int>( "maxMultiplicity" ) ),
35  multiplicityOnInput_ ( cfg.getParameter<bool>( "multiplicityOnInput" ) ),
36  ptMin_( cfg.getParameter<double>( "ptMin" ) ),
37  ptMax_( cfg.getParameter<double>( "ptMax" ) ),
38  etaMin_( cfg.getParameter<double>( "etaMin" ) ),
39  etaMax_( cfg.getParameter<double>( "etaMax" ) ),
40  phiMin_( cfg.getParameter<double>( "phiMin" ) ),
41  phiMax_( cfg.getParameter<double>( "phiMax" ) ),
42  nHitMin_( cfg.getParameter<double>( "nHitMin" ) ),
43  nHitMax_( cfg.getParameter<double>( "nHitMax" ) ),
44  chi2nMax_( cfg.getParameter<double>( "chi2nMax" ) ),
45  minHitChargeStrip_( cfg.getParameter<double>( "minHitChargeStrip" ) ),
46  minHitIsolation_( cfg.getParameter<double>( "minHitIsolation" ) ),
47  rphirecHitsTag_( cfg.getParameter<edm::InputTag>("rphirecHits") ),
48  matchedrecHitsTag_( cfg.getParameter<edm::InputTag>("matchedrecHits") ),
49  nHitMin2D_( cfg.getParameter<unsigned int>( "nHitMin2D" ) ),
50  // Ugly to use the same getParameter 6 times, but this allows const cut variables...
51  minHitsinTIB_(cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTIB" ) ),
52  minHitsinTOB_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTOB" ) ),
53  minHitsinTID_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTID" ) ),
54  minHitsinTEC_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inTEC" ) ),
55  minHitsinBPIX_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inBPIX" ) ),
56  minHitsinFPIX_ (cfg.getParameter<edm::ParameterSet>( "minHitsPerSubDet" ).getParameter<int>( "inFPIX" ) )
57 {
58 
59  if (applyBasicCuts_)
60  edm::LogInfo("CalibrationTrackSelector")
61  << "applying basic track cuts ..."
62  << "\nptmin,ptmax: " << ptMin_ << "," << ptMax_
63  << "\netamin,etamax: " << etaMin_ << "," << etaMax_
64  << "\nphimin,phimax: " << phiMin_ << "," << phiMax_
65  << "\nnhitmin,nhitmax: " << nHitMin_ << "," << nHitMax_
66  << "\nnhitmin2D: " << nHitMin2D_
67  << "\nchi2nmax: " << chi2nMax_;
68 
69  if (applyNHighestPt_)
70  edm::LogInfo("CalibrationTrackSelector")
71  << "filter N tracks with highest Pt N=" << nHighestPt_;
72 
74  edm::LogInfo("CalibrationTrackSelector")
75  << "apply multiplicity filter N>= " << minMultiplicity_ << "and N<= " << maxMultiplicity_
76  << " on " << (multiplicityOnInput_ ? "input" : "output");
77 
78  if (applyIsolation_)
79  edm::LogInfo("CalibrationTrackSelector")
80  << "only retain tracks isolated at least by " << minHitIsolation_ <<
81  " cm from other rechits";
82 
83  if (chargeCheck_)
84  edm::LogInfo("CalibrationTrackSelector")
85  << "only retain hits with at least " << minHitChargeStrip_ <<
86  " ADC counts of total cluster charge";
87 
88  edm::LogInfo("CalibrationTrackSelector")
89  << "Minimum number of hits in TIB/TID/TOB/TEC/BPIX/FPIX = "
90  << minHitsinTIB_ << "/" << minHitsinTID_ << "/" << minHitsinTOB_
91  << "/" << minHitsinTEC_ << "/" << minHitsinBPIX_ << "/" << minHitsinFPIX_;
92 
93 }
T getParameter(std::string const &) const
const edm::InputTag matchedrecHitsTag_
const edm::InputTag rphirecHitsTag_
const double ptMin_
if true, cut min/maxMultiplicity on input instead of on final result
CalibrationTrackSelector::~CalibrationTrackSelector ( )

destructor

Definition at line 97 of file CalibrationTrackSelector.cc.

98 {}

Member Function Documentation

CalibrationTrackSelector::Tracks CalibrationTrackSelector::basicCuts ( const Tracks tracks,
const edm::Event evt 
) const
private

apply basic cuts on pt,eta,phi,nhit

Definition at line 137 of file CalibrationTrackSelector.cc.

References chi2nMax_, detailedHitsCheck(), eta(), reco::TrackBase::eta(), etaMax_, etaMin_, nHitMax_, nHitMin_, reco::TrackBase::normalizedChi2(), reco::TrackBase::numberOfValidHits(), phi, reco::TrackBase::phi(), phiMax_, phiMin_, EnergyCorrector::pt, reco::TrackBase::pt(), ptMax_, ptMin_, and query::result.

Referenced by select().

138 {
139  Tracks result;
140 
141  for (Tracks::const_iterator it=tracks.begin(); it != tracks.end(); ++it) {
142  const reco::Track* trackp=*it;
143  float pt=trackp->pt();
144  float eta=trackp->eta();
145  float phi=trackp->phi();
146  int nhit = trackp->numberOfValidHits();
147  float chi2n = trackp->normalizedChi2();
148 
149  // edm::LogDebug("CalibrationTrackSelector") << " pt,eta,phi,nhit: "
150  // <<pt<<","<<eta<<","<<phi<<","<<nhit;
151 
152  if (pt>ptMin_ && pt<ptMax_
153  && eta>etaMin_ && eta<etaMax_
154  && phi>phiMin_ && phi<phiMax_
155  && nhit>=nHitMin_ && nhit<=nHitMax_
156  && chi2n<chi2nMax_) {
157  if (this->detailedHitsCheck(trackp, evt)) result.push_back(trackp);
158  }
159  }
160 
161  return result;
162 }
std::vector< const reco::Track * > Tracks
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:514
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:598
T eta() const
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:604
bool detailedHitsCheck(const reco::Track *track, const edm::Event &evt) const
checking hit requirements beyond simple number of valid hits
double pt() const
track transverse momentum
Definition: TrackBase.h:574
tuple result
Definition: query.py:137
unsigned short numberOfValidHits() const
number of valid hits found
Definition: TrackBase.h:773
const double ptMin_
if true, cut min/maxMultiplicity on input instead of on final result
tuple tracks
Definition: testEve_cfg.py:39
Definition: DDAxes.h:10
bool CalibrationTrackSelector::detailedHitsCheck ( const reco::Track track,
const edm::Event evt 
) const
private

checking hit requirements beyond simple number of valid hits

Definition at line 166 of file CalibrationTrackSelector.cc.

References applyIsolation_, chargeCheck_, isHit2D(), isIsolated(), isOkCharge(), kBPIX, kFPIX, minHitsinBPIX_, minHitsinFPIX_, minHitsinTEC_, minHitsinTIB_, minHitsinTID_, minHitsinTOB_, nHitMin2D_, reco::Track::recHitsBegin(), reco::Track::recHitsEnd(), seedOnlyFromAbove_, StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, and DetId::Tracker.

Referenced by basicCuts().

167 {
168  // checking hit requirements beyond simple number of valid hits
169 
172  || applyIsolation_) { // any detailed hit cut is active, so have to check
173 
174  int nhitinTIB = 0, nhitinTOB = 0, nhitinTID = 0;
175  int nhitinTEC = 0, nhitinBPIX = 0, nhitinFPIX = 0;
176  unsigned int nHit2D = 0;
177  unsigned int thishit = 0;
178 
179  for (trackingRecHit_iterator iHit = trackp->recHitsBegin(); iHit != trackp->recHitsEnd(); ++iHit) {
180 
181  thishit++;
182  int type = (*iHit)->geographicalId().subdetId();
183 
184  // *** thishit == 1 means last hit in CTF ***
185  // (FIXME: assumption might change or not be valid for all tracking algorthms)
186  // ==> for cosmics
187  // seedOnlyFrom = 1 is TIB-TOB-TEC tracks only
188  // seedOnlyFrom = 2 is TOB-TEC tracks only
189  if (seedOnlyFromAbove_ == 1 && thishit == 1 && (type == int(StripSubdetector::TOB) || type == int(StripSubdetector::TEC))) return false;
190 
191  if (seedOnlyFromAbove_ == 2 && thishit == 1 && type == int(StripSubdetector::TIB)) return false;
192 
193  if (!(*iHit)->isValid()) continue; // only real hits count as in trackp->numberOfValidHits()
194  const DetId detId((*iHit)->geographicalId());
195  if (detId.det() != DetId::Tracker) {
196  edm::LogError("DetectorMismatch") << "@SUB=CalibrationTrackSelector::detailedHitsCheck"
197  << "DetId.det() != DetId::Tracker (=" << DetId::Tracker
198  << "), but " << detId.det() << ".";
199  }
200  const TrackingRecHit* therechit = (*iHit);
201  if (chargeCheck_ && !(this->isOkCharge(therechit))) return false;
202  if (applyIsolation_ && (!this->isIsolated(therechit, evt))) return false;
203  if (StripSubdetector::TIB == detId.subdetId()) ++nhitinTIB;
204  else if (StripSubdetector::TOB == detId.subdetId()) ++nhitinTOB;
205  else if (StripSubdetector::TID == detId.subdetId()) ++nhitinTID;
206  else if (StripSubdetector::TEC == detId.subdetId()) ++nhitinTEC;
207  else if ( kBPIX == detId.subdetId()) ++nhitinBPIX;
208  else if ( kFPIX == detId.subdetId()) ++nhitinFPIX;
209  // Do not call isHit2D(..) if already enough 2D hits for performance reason:
210  if (nHit2D < nHitMin2D_ && this->isHit2D(**iHit)) ++nHit2D;
211  } // end loop on hits
212  return (nhitinTIB >= minHitsinTIB_ && nhitinTOB >= minHitsinTOB_
213  && nhitinTID >= minHitsinTID_ && nhitinTEC >= minHitsinTEC_
214  && nhitinBPIX >= minHitsinBPIX_ && nhitinFPIX >= minHitsinFPIX_
215  && nHit2D >= nHitMin2D_);
216  } else { // no cuts set, so we are just fine and can avoid loop on hits
217  return true;
218  }
219 }
type
Definition: HCALResponse.h:21
const int kFPIX
bool isIsolated(const TrackingRecHit *therechit, const edm::Event &evt) const
bool isOkCharge(const TrackingRecHit *therechit) const
Definition: DetId.h:18
bool isHit2D(const TrackingRecHit &hit) const
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection
const int kBPIX
bool CalibrationTrackSelector::isHit2D ( const TrackingRecHit hit) const
private

Definition at line 223 of file CalibrationTrackSelector.cc.

References TrackingRecHit::dimension(), TrackingRecHit::geographicalId(), kBPIX, kFPIX, and DetId::Tracker.

Referenced by detailedHitsCheck().

224 {
225  if (hit.dimension() < 2) {
226  return false; // some (muon...) stuff really has RecHit1D
227  } else {
228  const DetId detId(hit.geographicalId());
229  if (detId.det() == DetId::Tracker) {
230  if (detId.subdetId() == kBPIX || detId.subdetId() == kFPIX) {
231  return true; // pixel is always 2D
232  } else { // should be SiStrip now
233  if (dynamic_cast<const SiStripRecHit2D*>(&hit)) return false; // normal hit
234  else if (dynamic_cast<const SiStripMatchedRecHit2D*>(&hit)) return true; // matched is 2D
235  else if (dynamic_cast<const ProjectedSiStripRecHit2D*>(&hit)) return false; // crazy hit...
236  else {
237  edm::LogError("UnkownType") << "@SUB=CalibrationTrackSelector::isHit2D"
238  << "Tracker hit not in pixel and neither SiStripRecHit2D nor "
239  << "SiStripMatchedRecHit2D nor ProjectedSiStripRecHit2D.";
240  return false;
241  }
242  }
243  } else { // not tracker??
244  edm::LogWarning("DetectorMismatch") << "@SUB=CalibrationTrackSelector::isHit2D"
245  << "Hit not in tracker with 'official' dimension >=2.";
246  return true; // dimension() >= 2 so accept that...
247  }
248  }
249  // never reached...
250 }
virtual int dimension() const =0
const int kFPIX
Definition: DetId.h:18
DetId geographicalId() const
const int kBPIX
bool CalibrationTrackSelector::isIsolated ( const TrackingRecHit therechit,
const edm::Event evt 
) const
private

Definition at line 304 of file CalibrationTrackSelector.cc.

References edmNew::DetSetVector< T >::data(), TrackingRecHit::geographicalId(), edm::Event::getByLabel(), BaseTrackerRecHit::localPosition(), TrackingRecHit::localPosition(), mag(), matchedrecHitsTag_, minHitIsolation_, DetId::rawId(), and rphirecHitsTag_.

Referenced by detailedHitsCheck().

305 {
306 
307  // edm::ESHandle<TrackerGeometry> tracker;
310  // es.get<TrackerDigiGeometryRecord>().get(tracker);
311  evt.getByLabel( rphirecHitsTag_, rphirecHits );
312  evt.getByLabel( matchedrecHitsTag_, matchedrecHits );
313 
316  const SiStripRecHit2DCollection& stripcollSt = *rphirecHits;
317  const SiStripMatchedRecHit2DCollection& stripcollStm = *matchedrecHits;
318 
319  DetId idet = therechit->geographicalId();
320 
321  // FIXME: instead of looping the full hit collection, we should explore the features of
322  // SiStripRecHit2DCollection::rangeRphi = rphirecHits.get(idet) and loop
323  // only from rangeRphi.first until rangeRphi.second
324  for( istripSt=stripcollSt.data().begin(); istripSt!=stripcollSt.data().end(); ++istripSt ) {
325  const SiStripRecHit2D *aHit = &*(istripSt);
326  DetId mydet1 = aHit->geographicalId();
327  if (idet.rawId() != mydet1.rawId()) continue;
328  float theDistance = ( therechit->localPosition() - aHit->localPosition() ).mag();
329  // std::cout << "theDistance1 = " << theDistance << "\n";
330  if (theDistance > 0.001 && theDistance < minHitIsolation_) return false;
331  }
332 
333  // FIXME: see above
334  for( istripStm=stripcollStm.data().begin(); istripStm!=stripcollStm.data().end(); ++istripStm ) {
335  const SiStripMatchedRecHit2D *aHit = &*(istripStm);
336  DetId mydet2 = aHit->geographicalId();
337  if (idet.rawId() != mydet2.rawId()) continue;
338  float theDistance = (therechit->localPosition() - aHit->localPosition()).mag();
339  // std::cout << "theDistance1 = " << theDistance << "\n";
340  if (theDistance > 0.001 && theDistance < minHitIsolation_) return false;
341  }
342  return true;
343 }
const edm::InputTag matchedrecHitsTag_
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
T mag() const
The vector magnitude. Equivalent to sqrt(vec.mag2())
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
data_type const * data(size_t cell) const
const edm::InputTag rphirecHitsTag_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:405
Definition: DetId.h:18
DetId geographicalId() const
virtual LocalPoint localPosition() const =0
virtual LocalPoint localPosition() const
bool CalibrationTrackSelector::isOkCharge ( const TrackingRecHit therechit) const
private

Definition at line 254 of file CalibrationTrackSelector.cc.

References SiStripCluster::amplitudes(), SiStripRecHit2D::cluster(), minHitChargeStrip_, SiStripMatchedRecHit2D::monoCluster(), ProjectedSiStripRecHit2D::originalHit(), and SiStripMatchedRecHit2D::stereoCluster().

Referenced by detailedHitsCheck().

255 {
256  float charge1 = 0;
257  float charge2 = 0;
258  const SiStripMatchedRecHit2D* matchedhit = dynamic_cast<const SiStripMatchedRecHit2D*>(therechit);
259  const SiStripRecHit2D* hit = dynamic_cast<const SiStripRecHit2D*>(therechit);
260  const ProjectedSiStripRecHit2D* unmatchedhit = dynamic_cast<const ProjectedSiStripRecHit2D*>(therechit);
261 
262  if (matchedhit) {
263  const SiStripCluster & monocluster = matchedhit->monoCluster();
264  const std::vector<uint16_t> amplitudesmono( monocluster.amplitudes().begin(),
265  monocluster.amplitudes().end());
266  for(size_t ia=0; ia<amplitudesmono.size();++ia)
267  { charge1+=amplitudesmono[ia];}
268 
269  const SiStripCluster & stereocluster = matchedhit->stereoCluster();
270  const std::vector<uint16_t> amplitudesstereo( stereocluster.amplitudes().begin(),
271  stereocluster.amplitudes().end());
272  for(size_t ia=0; ia<amplitudesstereo.size();++ia)
273  {charge2+=amplitudesstereo[ia];}
274  // std::cout << "charge1 = " << charge1 << "\n";
275  // std::cout << "charge2 = " << charge2 << "\n";
276  if (charge1 < minHitChargeStrip_ || charge2 < minHitChargeStrip_) return false;
277  }
278  else if (hit) {
279 
280  const SiStripCluster* cluster = &*(hit->cluster());
281  const std::vector<uint16_t> amplitudes( cluster->amplitudes().begin(),
282  cluster->amplitudes().end());
283  for(size_t ia=0; ia<amplitudes.size();++ia)
284  {charge1+=amplitudes[ia];}
285  // std::cout << "charge1 = " << charge1 << "\n";
286  if (charge1 < minHitChargeStrip_) return false;
287  }
288  else if (unmatchedhit) {
289 
290  const SiStripRecHit2D &orighit = unmatchedhit->originalHit();
291  const SiStripCluster* origcluster = &*(orighit.cluster());
292  const std::vector<uint16_t> amplitudes( origcluster->amplitudes().begin(),
293  origcluster->amplitudes().end());
294  for(size_t ia=0; ia<amplitudes.size();++ia)
295  {charge1+=amplitudes[ia];}
296  // std::cout << "charge1 = " << charge1 << "\n";
297  if (charge1 < minHitChargeStrip_) return false;
298  }
299  return true;
300 }
SiStripCluster const & monoCluster() const
ClusterRef cluster() const
SiStripRecHit2D originalHit() const
SiStripCluster const & stereoCluster() const
const std::vector< uint8_t > & amplitudes() const
CalibrationTrackSelector::Tracks CalibrationTrackSelector::select ( const Tracks tracks,
const edm::Event evt 
) const

select tracks

Definition at line 104 of file CalibrationTrackSelector.cc.

References applyBasicCuts_, applyMultiplicityFilter_, applyNHighestPt_, basicCuts(), maxMultiplicity_, minMultiplicity_, multiplicityOnInput_, query::result, theNHighestPtTracks(), and testEve_cfg::tracks.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), Vispa.Views.AbstractView.AbstractView::restoreSelection(), and SiStripCalTrackConfigSelector::select().

105 {
106 
108  (tracks.size() < static_cast<unsigned int>(minMultiplicity_)
109  || tracks.size() > static_cast<unsigned int>(maxMultiplicity_))) {
110  return Tracks(); // empty collection
111  }
112 
113  Tracks result = tracks;
114  // apply basic track cuts (if selected)
115  if (applyBasicCuts_) result= this->basicCuts(result, evt);
116 
117  // filter N tracks with highest Pt (if selected)
118  if (applyNHighestPt_) result = this->theNHighestPtTracks(result);
119 
120  // apply minimum multiplicity requirement (if selected)
122  if (result.size() < static_cast<unsigned int>(minMultiplicity_)
123  || result.size() > static_cast<unsigned int>(maxMultiplicity_) ) {
124 
125  result.clear();
126  }
127  }
128 
129  // edm::LogDebug("CalibrationTrackSelector") << "tracks all,kept: " << tracks.size() << "," << result.size();
130 
131  return result;
132 }
std::vector< const reco::Track * > Tracks
tuple result
Definition: query.py:137
tuple tracks
Definition: testEve_cfg.py:39
Tracks theNHighestPtTracks(const Tracks &tracks) const
filter the n highest pt tracks
Tracks basicCuts(const Tracks &tracks, const edm::Event &evt) const
apply basic cuts on pt,eta,phi,nhit
CalibrationTrackSelector::Tracks CalibrationTrackSelector::theNHighestPtTracks ( const Tracks tracks) const
private

filter the n highest pt tracks

Definition at line 347 of file CalibrationTrackSelector.cc.

References gen::n, nHighestPt_, ptComparator, query::result, python.multivaluedict::sort(), and testEve_cfg::tracks.

Referenced by select().

348 {
349  Tracks sortedTracks=tracks;
350  Tracks result;
351 
352  // sort in pt
353  std::sort(sortedTracks.begin(),sortedTracks.end(),ptComparator);
354 
355  // copy theTrackMult highest pt tracks to result vector
356  int n=0;
357  for (Tracks::const_iterator it=sortedTracks.begin();
358  it!=sortedTracks.end(); ++it) {
359  if (n<nHighestPt_) { result.push_back(*it); n++; }
360  }
361 
362  return result;
363 }
std::vector< const reco::Track * > Tracks
tuple result
Definition: query.py:137
tuple tracks
Definition: testEve_cfg.py:39

Member Data Documentation

const bool CalibrationTrackSelector::applyBasicCuts_
private

Definition at line 52 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and select().

const bool CalibrationTrackSelector::applyIsolation_
private

Definition at line 53 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and detailedHitsCheck().

const bool CalibrationTrackSelector::applyMultiplicityFilter_
private

Definition at line 52 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and select().

const bool CalibrationTrackSelector::applyNHighestPt_
private

Definition at line 52 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and select().

const bool CalibrationTrackSelector::chargeCheck_
private

Definition at line 53 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and detailedHitsCheck().

const double CalibrationTrackSelector::chi2nMax_
private

Definition at line 56 of file CalibrationTrackSelector.h.

Referenced by basicCuts(), and CalibrationTrackSelector().

const double CalibrationTrackSelector::etaMax_
private

Definition at line 56 of file CalibrationTrackSelector.h.

Referenced by basicCuts(), and CalibrationTrackSelector().

const double CalibrationTrackSelector::etaMin_
private

Definition at line 56 of file CalibrationTrackSelector.h.

Referenced by basicCuts(), and CalibrationTrackSelector().

const edm::InputTag CalibrationTrackSelector::matchedrecHitsTag_
private

Definition at line 59 of file CalibrationTrackSelector.h.

Referenced by isIsolated().

const int CalibrationTrackSelector::maxMultiplicity_
private

Definition at line 54 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and select().

const double CalibrationTrackSelector::minHitChargeStrip_
private

Definition at line 57 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and isOkCharge().

const double CalibrationTrackSelector::minHitIsolation_
private

Definition at line 57 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and isIsolated().

const int CalibrationTrackSelector::minHitsinBPIX_
private

Definition at line 61 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and detailedHitsCheck().

const int CalibrationTrackSelector::minHitsinFPIX_
private

Definition at line 61 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and detailedHitsCheck().

const int CalibrationTrackSelector::minHitsinTEC_
private

Definition at line 61 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and detailedHitsCheck().

const int CalibrationTrackSelector::minHitsinTIB_
private

Definition at line 61 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and detailedHitsCheck().

const int CalibrationTrackSelector::minHitsinTID_
private

Definition at line 61 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and detailedHitsCheck().

const int CalibrationTrackSelector::minHitsinTOB_
private

Definition at line 61 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and detailedHitsCheck().

const int CalibrationTrackSelector::minMultiplicity_
private

Definition at line 54 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and select().

const bool CalibrationTrackSelector::multiplicityOnInput_
private

Definition at line 55 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and select().

const int CalibrationTrackSelector::nHighestPt_
private

Definition at line 54 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and theNHighestPtTracks().

const double CalibrationTrackSelector::nHitMax_
private

Definition at line 56 of file CalibrationTrackSelector.h.

Referenced by basicCuts(), and CalibrationTrackSelector().

const unsigned int CalibrationTrackSelector::nHitMin2D_
private

Definition at line 60 of file CalibrationTrackSelector.h.

Referenced by CalibrationTrackSelector(), and detailedHitsCheck().

const double CalibrationTrackSelector::nHitMin_
private

Definition at line 56 of file CalibrationTrackSelector.h.

Referenced by basicCuts(), and CalibrationTrackSelector().

const double CalibrationTrackSelector::phiMax_
private

Definition at line 56 of file CalibrationTrackSelector.h.

Referenced by basicCuts(), and CalibrationTrackSelector().

const double CalibrationTrackSelector::phiMin_
private

Definition at line 56 of file CalibrationTrackSelector.h.

Referenced by basicCuts(), and CalibrationTrackSelector().

ComparePt CalibrationTrackSelector::ptComparator
private

Definition at line 50 of file CalibrationTrackSelector.h.

Referenced by theNHighestPtTracks().

const double CalibrationTrackSelector::ptMax_
private

Definition at line 56 of file CalibrationTrackSelector.h.

Referenced by basicCuts(), and CalibrationTrackSelector().

const double CalibrationTrackSelector::ptMin_
private

if true, cut min/maxMultiplicity on input instead of on final result

Definition at line 56 of file CalibrationTrackSelector.h.

Referenced by basicCuts(), and CalibrationTrackSelector().

const edm::InputTag CalibrationTrackSelector::rphirecHitsTag_
private

Definition at line 58 of file CalibrationTrackSelector.h.

Referenced by isIsolated().

const bool CalibrationTrackSelector::seedOnlyFromAbove_
private

Definition at line 53 of file CalibrationTrackSelector.h.

Referenced by detailedHitsCheck().