CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
AlignmentGlobalTrackSelector Class Reference

#include <AlignmentGlobalTrackSelector.h>

Public Types

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

Public Member Functions

 AlignmentGlobalTrackSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 constructor More...
 
Tracks select (const Tracks &tracks, const edm::Event &iEvent, const edm::EventSetup &eSetup)
 select tracks More...
 
bool useThisFilter ()
 returns if any of the Filters is used. More...
 
 ~AlignmentGlobalTrackSelector ()
 destructor More...
 

Private Member Functions

Tracks checkIsolation (const Tracks &cands, const edm::Event &iEvent) const
 returns only isolated tracks in [cands] More...
 
Tracks checkJetCount (const Tracks &cands, const edm::Event &iEvent) const
 returns [tracks] if there are less than theMaxCount Jets with theMinJetPt and an empty set if not More...
 
Tracks findMuons (const Tracks &tracks, const edm::Event &iEvent) const
 filter for Tracks that match the Track of a global Muon More...
 
Tracks matchTracks (const Tracks &src, const Tracks &comp) const
 matches [src] with [comp] returns collection with matching Tracks coming from [src] More...
 
void printTracks (const Tracks &col) const
 print Information on Track-Collection More...
 

Private Attributes

edm::ParameterSet theConf
 private data members More...
 
bool theGMFilterSwitch
 
bool theIsoFilterSwitch
 
bool theJetCountFilterSwitch
 
edm::EDGetTokenT< reco::CaloJetCollectiontheJetCountToken
 
edm::EDGetTokenT< reco::CaloJetCollectiontheJetIsoToken
 
int theMaxJetCount
 
double theMaxJetPt
 
double theMaxTrackDeltaR
 
int theMinGlobalMuonCount
 
int theMinIsolatedCount
 
double theMinJetDeltaR
 
double theMinJetPt
 
edm::EDGetTokenT< reco::MuonCollectiontheMuonToken
 

Detailed Description

Definition at line 17 of file AlignmentGlobalTrackSelector.h.

Member Typedef Documentation

Definition at line 22 of file AlignmentGlobalTrackSelector.h.

Constructor & Destructor Documentation

AlignmentGlobalTrackSelector::AlignmentGlobalTrackSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)

constructor

Definition at line 29 of file AlignmentGlobalTrackSelector.cc.

References edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), LogDebug, theGMFilterSwitch, theIsoFilterSwitch, theJetCountFilterSwitch, theJetCountToken, theJetIsoToken, theMaxJetCount, theMaxJetPt, theMaxTrackDeltaR, theMinGlobalMuonCount, theMinIsolatedCount, theMinJetDeltaR, theMinJetPt, and theMuonToken.

29  :
30  theGMFilterSwitch(cfg.getParameter<bool>("applyGlobalMuonFilter")),
31  theIsoFilterSwitch(cfg.getParameter<bool>("applyIsolationtest")),
32  theJetCountFilterSwitch(cfg.getParameter<bool>("applyJetCountFilter"))
33 {
35  LogDebug("Alignment") << "> applying global Trackfilter ...";
36 
37  if (theGMFilterSwitch) {
38  edm::InputTag theMuonSource = cfg.getParameter<InputTag>("muonSource");
39  theMuonToken = iC.consumes<reco::MuonCollection>(theMuonSource);
40  theMaxTrackDeltaR =cfg.getParameter<double>("maxTrackDeltaR");
41  theMinGlobalMuonCount = cfg.getParameter<int>("minGlobalMuonCount");
42  LogDebug("Alignment") << "> GlobalMuonFilter : source, maxTrackDeltaR, min. Count : "
43  << theMuonSource << " , "
44  << theMaxTrackDeltaR << " , "
46  }
47 
48  if (theIsoFilterSwitch) {
49  edm::InputTag theJetIsoSource = cfg.getParameter<InputTag>("jetIsoSource");
50  theJetIsoToken = iC.consumes<reco::CaloJetCollection>(theJetIsoSource);
51  theMaxJetPt = cfg.getParameter<double>("maxJetPt");
52  theMinJetDeltaR = cfg.getParameter<double>("minJetDeltaR");
53  theMinIsolatedCount = cfg.getParameter<int>("minIsolatedCount");
54  LogDebug("Alignment") << "> Isolationtest : source, maxJetPt, minJetDeltaR, min. Count: "
55  << theJetIsoSource << " , "
56  << theMaxJetPt << " ,"
57  << theMinJetDeltaR << " ,"
59  }
60 
62  edm::InputTag theJetCountSource = cfg.getParameter<InputTag>("jetCountSource");
63  theJetCountToken = iC.consumes<reco::CaloJetCollection>(theJetCountSource);
64  theMinJetPt = cfg.getParameter<double>("minJetPt");
65  theMaxJetCount = cfg.getParameter<int>("maxJetCount");
66  LogDebug("Alignment") << "> JetCountFilter : source, minJetPt, maxJetCount : "
67  << theJetCountSource << " , "
68  << theMinJetPt << " ,"
69  << theMaxJetCount;
70  }
71 }
#define LogDebug(id)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::CaloJetCollection > theJetCountToken
std::vector< Muon > MuonCollection
collection of Muon objects
Definition: MuonFwd.h:9
edm::EDGetTokenT< reco::MuonCollection > theMuonToken
edm::EDGetTokenT< reco::CaloJetCollection > theJetIsoToken
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects
AlignmentGlobalTrackSelector::~AlignmentGlobalTrackSelector ( )

destructor

Definition at line 74 of file AlignmentGlobalTrackSelector.cc.

75 {}

Member Function Documentation

AlignmentGlobalTrackSelector::Tracks AlignmentGlobalTrackSelector::checkIsolation ( const Tracks cands,
const edm::Event iEvent 
) const
private

returns only isolated tracks in [cands]

Definition at line 136 of file AlignmentGlobalTrackSelector.cc.

References deltaR(), edm::Event::getByToken(), GlobalTrackerMuonAlignment_cfi::isolated, edm::HandleBase::isValid(), fwrapper::jets, mps_fire::result, theJetIsoToken, theMaxJetPt, theMinIsolatedCount, and theMinJetDeltaR.

Referenced by select().

137 {
138  Tracks result; result.clear();
139 
141  iEvent.getByToken(theJetIsoToken, jets);
142 
143  if (jets.isValid()) {
144  for (Tracks::const_iterator it = cands.begin();
145  it!=cands.end();
146  ++it) {
147  bool isolated = true;
148  for (reco::CaloJetCollection::const_iterator itJet = jets->begin();
149  itJet!=jets->end();
150  ++itJet)
151  isolated &= !((*itJet).pt() > theMaxJetPt && deltaR(*(*it),(*itJet)) < theMinJetDeltaR);
152 
153  if (isolated)
154  result.push_back(*it);
155  }
156  // LogDebug("Alignment") << "D Found "<<result.size()<<" isolated of "<< cands.size()<<" Tracks!";
157 
158  } else
159  LogError("Alignment")<< "@SUB=AlignmentGlobalTrackSelector::checkIsolation"
160  << "> could not optain jetCollection!";
161 
162  if (static_cast<int>(result.size()) < theMinIsolatedCount) result.clear();
163 
164  return result;
165 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
std::vector< const reco::Track * > Tracks
vector< PseudoJet > jets
bool isValid() const
Definition: HandleBase.h:74
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
edm::EDGetTokenT< reco::CaloJetCollection > theJetIsoToken
AlignmentGlobalTrackSelector::Tracks AlignmentGlobalTrackSelector::checkJetCount ( const Tracks cands,
const edm::Event iEvent 
) const
private

returns [tracks] if there are less than theMaxCount Jets with theMinJetPt and an empty set if not

Definition at line 169 of file AlignmentGlobalTrackSelector.cc.

References edm::Event::getByToken(), edm::HandleBase::isValid(), fwrapper::jets, LogDebug, mps_fire::result, theJetCountToken, theMaxJetCount, theMinJetPt, and l1t::tracks.

Referenced by select().

170 {
171  Tracks result; result.clear();
172 
174  iEvent.getByToken(theJetCountToken, jets);
175 
176  if (jets.isValid()) {
177  int jetCount = 0;
178  for (reco::CaloJetCollection::const_iterator itJet = jets->begin();
179  itJet!=jets->end();
180  ++itJet) {
181  if ((*itJet).pt() > theMinJetPt)
182  jetCount++;
183  }
184 
185  if (jetCount <= theMaxJetCount)
186  result = tracks;
187 
188  LogDebug("Alignment") << "> found " << jetCount << " Jets";
189  } else
190  LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::checkJetCount"
191  << "> could not optain jetCollection!";
192 
193  return result;
194 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
std::vector< const reco::Track * > Tracks
edm::EDGetTokenT< reco::CaloJetCollection > theJetCountToken
vector< PseudoJet > jets
bool isValid() const
Definition: HandleBase.h:74
AlignmentGlobalTrackSelector::Tracks AlignmentGlobalTrackSelector::findMuons ( const Tracks tracks,
const edm::Event iEvent 
) const
private

filter for Tracks that match the Track of a global Muon

Definition at line 101 of file AlignmentGlobalTrackSelector.cc.

References edm::Event::getByToken(), globalMuons_cfi::globalMuons, edm::HandleBase::isValid(), LogDebug, matchTracks(), nano_cff::muons, mps_fire::result, theMinGlobalMuonCount, and theMuonToken.

Referenced by select().

102 {
103  Tracks result;
105 
106  //fill globalMuons with muons
108  iEvent.getByToken(theMuonToken, muons);
109 
110  if (muons.isValid()) {
111  for (reco::MuonCollection::const_iterator itMuon = muons->begin();
112  itMuon != muons->end();
113  ++itMuon) {
114  const reco::Track* muonTrack = (*itMuon).get<reco::TrackRef>().get();
115  if (!muonTrack) {
116  LogDebug("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons"
117  << "Found muon without track: Standalone Muon!";
118  } else {
119  globalMuons.push_back(muonTrack);
120  }
121  }
122  } else {
123  LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons"
124  <<"> could not optain mounCollection!";
125  }
126 
127  result = this->matchTracks(tracks, globalMuons);
128 
129  if (static_cast<int>(result.size()) < theMinGlobalMuonCount) result.clear();
130 
131  return result;
132 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
std::vector< const reco::Track * > Tracks
bool isValid() const
Definition: HandleBase.h:74
edm::EDGetTokenT< reco::MuonCollection > theMuonToken
Tracks matchTracks(const Tracks &src, const Tracks &comp) const
matches [src] with [comp] returns collection with matching Tracks coming from [src] ...
AlignmentGlobalTrackSelector::Tracks AlignmentGlobalTrackSelector::matchTracks ( const Tracks src,
const Tracks comp 
) const
private

matches [src] with [comp] returns collection with matching Tracks coming from [src]

Definition at line 200 of file AlignmentGlobalTrackSelector.cc.

References deltaR(), mps_fire::i, match(), min(), mps_fire::result, and theMaxTrackDeltaR.

Referenced by findMuons().

201 {
202  Tracks result;
203  for (Tracks::const_iterator itComp = comp.begin();
204  itComp!=comp.end();
205  ++itComp) {
206  int match = -1;
207  double min = theMaxTrackDeltaR;
208  for (unsigned int i=0;i<src.size();i++) {
209  // LogDebug("Alignment") << "> Trackmatch dist: "<<deltaR(src.at(i),*itComp);
210  if(min > deltaR(*(src.at(i)),*(*itComp))){
211  min = deltaR(*(src.at(i)),*(*itComp));
212  match = static_cast<int>(i);
213  }
214  }
215  if (match > -1)
216  result.push_back(src.at(match));
217  }
218  return result;
219 }
std::vector< const reco::Track * > Tracks
T min(T a, T b)
Definition: MathUtil.h:58
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
void AlignmentGlobalTrackSelector::printTracks ( const Tracks col) const
private

print Information on Track-Collection

Definition at line 222 of file AlignmentGlobalTrackSelector.cc.

References KineDebug3::count(), and LogDebug.

223 {
224  int count = 0;
225  LogDebug("Alignment") << ">......................................";
226  for (Tracks::const_iterator it = col.begin();
227  it < col.end();
228  ++it,++count) {
229  LogDebug("Alignment")
230  << "> Track No. " << count << ": p = ("
231  << (*it)->px() << ","
232  << (*it)->py() << ","
233  << (*it)->pz() << ")\n"
234  << "> pT = "
235  << (*it)->pt() << " eta = "
236  << (*it)->eta() << " charge = "
237  << (*it)->charge();
238  }
239  LogDebug("Alignment") << ">......................................";
240 }
#define LogDebug(id)
col
Definition: cuy.py:1008
AlignmentGlobalTrackSelector::Tracks AlignmentGlobalTrackSelector::select ( const Tracks tracks,
const edm::Event iEvent,
const edm::EventSetup eSetup 
)

select tracks

Definition at line 85 of file AlignmentGlobalTrackSelector.cc.

References checkIsolation(), checkJetCount(), findMuons(), LogDebug, mps_fire::result, theGMFilterSwitch, theIsoFilterSwitch, theJetCountFilterSwitch, and l1t::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 TrackConfigSelector::select().

86 {
88 
89  if (theGMFilterSwitch) result = findMuons(result, iEvent);
90  if (theIsoFilterSwitch) result = checkIsolation(result, iEvent);
91  if (theJetCountFilterSwitch) result = checkJetCount(result, iEvent);
92  LogDebug("Alignment") << "> Global: tracks all, kept: " << tracks.size() << ", " << result.size();
93 // LogDebug("Alignment")<<"> o kept:";
94 // printTracks(result);
95 
96  return result;
97 }
#define LogDebug(id)
Tracks findMuons(const Tracks &tracks, const edm::Event &iEvent) const
filter for Tracks that match the Track of a global Muon
std::vector< const reco::Track * > Tracks
Tracks checkJetCount(const Tracks &cands, const edm::Event &iEvent) const
returns [tracks] if there are less than theMaxCount Jets with theMinJetPt and an empty set if not ...
Tracks checkIsolation(const Tracks &cands, const edm::Event &iEvent) const
returns only isolated tracks in [cands]
bool AlignmentGlobalTrackSelector::useThisFilter ( )

Member Data Documentation

edm::ParameterSet AlignmentGlobalTrackSelector::theConf
private

private data members

Definition at line 45 of file AlignmentGlobalTrackSelector.h.

bool AlignmentGlobalTrackSelector::theGMFilterSwitch
private
bool AlignmentGlobalTrackSelector::theIsoFilterSwitch
private
bool AlignmentGlobalTrackSelector::theJetCountFilterSwitch
private
edm::EDGetTokenT<reco::CaloJetCollection> AlignmentGlobalTrackSelector::theJetCountToken
private

Definition at line 64 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

edm::EDGetTokenT<reco::CaloJetCollection> AlignmentGlobalTrackSelector::theJetIsoToken
private

Definition at line 58 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

int AlignmentGlobalTrackSelector::theMaxJetCount
private

Definition at line 66 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

double AlignmentGlobalTrackSelector::theMaxJetPt
private

Definition at line 59 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMaxTrackDeltaR
private

Definition at line 54 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and matchTracks().

int AlignmentGlobalTrackSelector::theMinGlobalMuonCount
private

Definition at line 55 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and findMuons().

int AlignmentGlobalTrackSelector::theMinIsolatedCount
private

Definition at line 61 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMinJetDeltaR
private

Definition at line 60 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMinJetPt
private

Definition at line 65 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

edm::EDGetTokenT<reco::MuonCollection> AlignmentGlobalTrackSelector::theMuonToken
private

Definition at line 53 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and findMuons().