CMS 3D CMS Logo

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

Public Types

typedef reco::TrackCollection collection
 
typedef container::const_iterator const_iterator
 
typedef std::vector< const
reco::Track * > 
container
 

Public Member Functions

const_iterator begin () const
 
const_iterator end () const
 
 HSCPTrackSelector (const edm::ParameterSet &cfg)
 
bool matchingMuon (const reco::Track *track, const edm::Handle< reco::MuonCollection > &muons)
 
void select (const edm::Handle< reco::TrackCollection > &c, const edm::Event &evt, const edm::EventSetup &)
 
size_t size () const
 

Private Attributes

edm::InputTag dedxTag_
 
double maxInnerTrackdEdx
 
double maxMuonTrackdEdx
 
unsigned int mindEdxHitsInnerTrack
 
unsigned int mindEdxHitsMuonTrack
 
double minInnerTrackdEdx
 
double minMuonTrackdEdx
 
bool thedEdxSwitch
 
edm::InputTag theMuonSource
 
container theSelectedTracks
 
double trackerTrackPtCut
 

Detailed Description

Definition at line 28 of file HSCPTrackSelectorModule.cc.

Member Typedef Documentation

Definition at line 31 of file HSCPTrackSelectorModule.cc.

typedef container::const_iterator HSCPTrackSelector::const_iterator

Definition at line 30 of file HSCPTrackSelectorModule.cc.

typedef std::vector<const reco::Track*> HSCPTrackSelector::container

Definition at line 29 of file HSCPTrackSelectorModule.cc.

Constructor & Destructor Documentation

HSCPTrackSelector::HSCPTrackSelector ( const edm::ParameterSet cfg)
inline

Definition at line 33 of file HSCPTrackSelectorModule.cc.

References dedxTag_, edm::ParameterSet::getParameter(), maxInnerTrackdEdx, maxMuonTrackdEdx, mindEdxHitsInnerTrack, mindEdxHitsMuonTrack, minInnerTrackdEdx, minMuonTrackdEdx, thedEdxSwitch, theMuonSource, and trackerTrackPtCut.

33  {
34  trackerTrackPtCut = cfg.getParameter<double>( "trackerTrackPtMin" );
35  dedxTag_ = cfg.getParameter<edm::InputTag>("InputDedx");
36  theMuonSource = cfg.getParameter<edm::InputTag>("muonSource");
37 
38  thedEdxSwitch = cfg.getParameter<bool>("usededx");
39  minInnerTrackdEdx = cfg.getParameter<double>( "InnerTrackdEdxRightMin" );
40  maxInnerTrackdEdx = cfg.getParameter<double>( "InnerTrackdEdxLeftMax" );
41  minMuonTrackdEdx = cfg.getParameter<double>( "InnerMuondEdxRightMin" );
42  maxMuonTrackdEdx = cfg.getParameter<double>( "InnerMuondEdxLeftMax" );
43  mindEdxHitsInnerTrack = cfg.getParameter<unsigned int>( "dEdxMeasurementsMinForInnerTrack" );
44  mindEdxHitsMuonTrack = cfg.getParameter<unsigned int>( "dEdxMeasurementsMinForMuonTrack" );
45  }
T getParameter(std::string const &) const

Member Function Documentation

const_iterator HSCPTrackSelector::begin ( void  ) const
inline

Definition at line 47 of file HSCPTrackSelectorModule.cc.

References theSelectedTracks.

47 { return theSelectedTracks.begin(); }
const_iterator HSCPTrackSelector::end ( void  ) const
inline

Definition at line 48 of file HSCPTrackSelectorModule.cc.

References theSelectedTracks.

Referenced by Types.LuminosityBlockRange::cppID(), and Types.EventRange::cppID().

48 { return theSelectedTracks.end(); }
bool HSCPTrackSelector::matchingMuon ( const reco::Track track,
const edm::Handle< reco::MuonCollection > &  muons 
)
inline

Definition at line 51 of file HSCPTrackSelectorModule.cc.

References reco::TrackBase::eta(), reco::TrackBase::phi(), and reco::TrackBase::pt().

Referenced by select().

51  {
52  for(reco::MuonCollection::const_iterator itMuon = muons->begin(); itMuon != muons->end(); ++itMuon){
53  const reco::Track* muonTrack = (*itMuon).get<reco::TrackRef>().get();
54  if (!muonTrack)continue;
55 
56  //matching is needed because input track collection (made for dE/dx) has been refitted w.r.t track collection used for muon reco (we should do a tight maching to find equivalent track in the other collection)
57  if(fabs(track->pt()-muonTrack->pt())<0.5 && fabs(track->eta()-muonTrack->eta())<0.02 && fabs(track->phi()-muonTrack->phi())<0.02)return true;
58  }
59  return false;
60  }
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:139
double eta() const
pseudorapidity of momentum vector
Definition: TrackBase.h:141
double pt() const
track transverse momentum
Definition: TrackBase.h:131
void HSCPTrackSelector::select ( const edm::Handle< reco::TrackCollection > &  c,
const edm::Event evt,
const edm::EventSetup  
)
inline

Definition at line 64 of file HSCPTrackSelectorModule.cc.

References dedxTag_, edm::Event::getByLabel(), i, reco::isMuon(), edm::HandleBase::isValid(), matchingMuon(), maxInnerTrackdEdx, maxMuonTrackdEdx, mindEdxHitsInnerTrack, mindEdxHitsMuonTrack, minInnerTrackdEdx, minMuonTrackdEdx, patZpeak::muons, thedEdxSwitch, theMuonSource, theSelectedTracks, and trackerTrackPtCut.

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(), and Vispa.Views.AbstractView.AbstractView::restoreSelection().

64  {
66  if(thedEdxSwitch){evt.getByLabel(dedxTag_, dEdxTrackHandle); }
67 
69  evt.getByLabel(theMuonSource, muons);
70 
71  //Loop on all Tracks
72  theSelectedTracks.clear();
73  for(size_t i=0; i<c->size(); i++){
74  reco::TrackRef trkRef = reco::TrackRef(c, i);
75 
76  double dedx=0; unsigned int dedxHit=0; if(thedEdxSwitch){dedx=dEdxTrackHandle->get(i).dEdx(); dedxHit=dEdxTrackHandle->get(i).numberOfMeasurements();} //DIRTY WAY OF ACCESSING DEDX
77  bool isMuon=muons.isValid() && matchingMuon(& *trkRef, muons);
78  //printf("muon tracks %i --> pt=%6.2f eta=%+6.2f phi=%+6.2f dEdx=%f\n", (int)isMuon, trkRef->pt(), trkRef->eta(), trkRef->phi(), dedx);
79 
80  if(isMuon){
81  if(thedEdxSwitch && (dedxHit<mindEdxHitsMuonTrack || (dedx>minMuonTrackdEdx && dedx<maxMuonTrackdEdx)) ){continue;}
82  theSelectedTracks.push_back(& * trkRef );
83  }else{
84  if(trkRef->pt()<trackerTrackPtCut)continue;
85  if(thedEdxSwitch && (dedxHit<mindEdxHitsInnerTrack || (dedx>minInnerTrackdEdx && dedx<maxInnerTrackdEdx)) )continue;
86  theSelectedTracks.push_back(& * trkRef );
87  }
88  }
89 
90  //debug printout
91 // for (container::const_iterator it=theSelectedTracks.begin(); it != theSelectedTracks.end(); ++it) {
92 // printf("Selected tracks %i --> pt=%6.2f eta=%+6.2f phi=%+6.2f - isMuon=%i\n", (int)(it-theSelectedTracks.begin()), (*it)->pt(), (*it)->eta(), (*it)->phi(), matchingMuon(*it, theSelectedMuonTracks));
93 // }
94  }
int i
Definition: DBlmapReader.cc:9
bool isMuon(const Candidate &part)
Definition: pdgIdUtils.h:11
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
edm::Ref< TrackCollection > TrackRef
persistent reference to a Track
Definition: TrackFwd.h:14
bool matchingMuon(const reco::Track *track, const edm::Handle< reco::MuonCollection > &muons)
tuple muons
Definition: patZpeak.py:38
size_t HSCPTrackSelector::size ( void  ) const
inline

Definition at line 49 of file HSCPTrackSelectorModule.cc.

References theSelectedTracks.

49 { return theSelectedTracks.size(); }

Member Data Documentation

edm::InputTag HSCPTrackSelector::dedxTag_
private

Definition at line 105 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().

double HSCPTrackSelector::maxInnerTrackdEdx
private

Definition at line 100 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().

double HSCPTrackSelector::maxMuonTrackdEdx
private

Definition at line 102 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().

unsigned int HSCPTrackSelector::mindEdxHitsInnerTrack
private

Definition at line 103 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().

unsigned int HSCPTrackSelector::mindEdxHitsMuonTrack
private

Definition at line 104 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().

double HSCPTrackSelector::minInnerTrackdEdx
private

Definition at line 99 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().

double HSCPTrackSelector::minMuonTrackdEdx
private

Definition at line 101 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().

bool HSCPTrackSelector::thedEdxSwitch
private

Definition at line 107 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().

edm::InputTag HSCPTrackSelector::theMuonSource
private

Definition at line 106 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().

container HSCPTrackSelector::theSelectedTracks
private

Definition at line 97 of file HSCPTrackSelectorModule.cc.

Referenced by begin(), end(), select(), and size().

double HSCPTrackSelector::trackerTrackPtCut
private

Definition at line 98 of file HSCPTrackSelectorModule.cc.

Referenced by HSCPTrackSelector(), and select().