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 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)
 constructor More...
 
Tracks select (const Tracks &tracks, const edm::Event &iEvent)
 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::InputTag theJetCountSource
 
edm::InputTag theJetIsoSource
 
int theMaxJetCount
 
double theMaxJetPt
 
double theMaxTrackDeltaR
 
int theMinGlobalMuonCount
 
int theMinIsolatedCount
 
double theMinJetDeltaR
 
double theMinJetPt
 
edm::InputTag theMuonSource
 

Detailed Description

Definition at line 14 of file AlignmentGlobalTrackSelector.h.

Member Typedef Documentation

Definition at line 19 of file AlignmentGlobalTrackSelector.h.

Constructor & Destructor Documentation

AlignmentGlobalTrackSelector::AlignmentGlobalTrackSelector ( const edm::ParameterSet cfg)

constructor

Definition at line 28 of file AlignmentGlobalTrackSelector.cc.

References edm::ParameterSet::getParameter(), LogDebug, theGMFilterSwitch, theIsoFilterSwitch, theJetCountFilterSwitch, theJetCountSource, theJetIsoSource, theMaxJetCount, theMaxJetPt, theMaxTrackDeltaR, theMinGlobalMuonCount, theMinIsolatedCount, theMinJetDeltaR, theMinJetPt, and theMuonSource.

28  :
29  theGMFilterSwitch(cfg.getParameter<bool>("applyGlobalMuonFilter")),
30  theIsoFilterSwitch(cfg.getParameter<bool>("applyIsolationtest")),
31  theJetCountFilterSwitch(cfg.getParameter<bool>("applyJetCountFilter")),
32  theMuonSource("muons"),
33  theJetIsoSource("fastjet6CaloJets"),
34  theJetCountSource("fastjet6CaloJets")
35 {
37  LogDebug("Alignment") << "> applying global Trackfilter ...";
38 
39  if (theGMFilterSwitch) {
40  theMuonSource = cfg.getParameter<InputTag>("muonSource");
41  theMaxTrackDeltaR =cfg.getParameter<double>("maxTrackDeltaR");
42  theMinGlobalMuonCount = cfg.getParameter<int>("minGlobalMuonCount");
43  LogDebug("Alignment") << "> GlobalMuonFilter : source, maxTrackDeltaR, min. Count : "
44  << theMuonSource << " , "
45  << theMaxTrackDeltaR << " , "
47  }
48 
49  if (theIsoFilterSwitch) {
50  theJetIsoSource = cfg.getParameter<InputTag>("jetIsoSource");
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  theJetCountSource = cfg.getParameter<InputTag>("jetCountSource");
63  theMinJetPt = cfg.getParameter<double>("minJetPt");
64  theMaxJetCount = cfg.getParameter<int>("maxJetCount");
65  LogDebug("Alignment") << "> JetCountFilter : source, minJetPt, maxJetCount : "
66  << theJetCountSource << " , "
67  << theMinJetPt << " ,"
68  << theMaxJetCount;
69  }
70 }
#define LogDebug(id)
T getParameter(std::string const &) const
AlignmentGlobalTrackSelector::~AlignmentGlobalTrackSelector ( )

destructor

Definition at line 73 of file AlignmentGlobalTrackSelector.cc.

74 {}

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 135 of file AlignmentGlobalTrackSelector.cc.

References deltaR(), edm::Event::getByLabel(), edm::HandleBase::isValid(), fwrapper::jets, query::result, theJetIsoSource, theMaxJetPt, theMinIsolatedCount, and theMinJetDeltaR.

Referenced by select().

136 {
137  Tracks result; result.clear();
138 
140  iEvent.getByLabel(theJetIsoSource, jets);
141 
142  if (jets.isValid()) {
143  for (Tracks::const_iterator it = cands.begin();
144  it!=cands.end();
145  ++it) {
146  bool isolated = true;
147  for (reco::CaloJetCollection::const_iterator itJet = jets->begin();
148  itJet!=jets->end();
149  ++itJet)
150  isolated &= !((*itJet).pt() > theMaxJetPt && deltaR(*(*it),(*itJet)) < theMinJetDeltaR);
151 
152  if (isolated)
153  result.push_back(*it);
154  }
155  // LogDebug("Alignment") << "D Found "<<result.size()<<" isolated of "<< cands.size()<<" Tracks!";
156 
157  } else
158  LogError("Alignment")<< "@SUB=AlignmentGlobalTrackSelector::checkIsolation"
159  << "> could not optain jetCollection!";
160 
161  if (static_cast<int>(result.size()) < theMinIsolatedCount) result.clear();
162 
163  return result;
164 }
std::vector< const reco::Track * > Tracks
vector< PseudoJet > jets
tuple result
Definition: query.py:137
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
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 168 of file AlignmentGlobalTrackSelector.cc.

References edm::Event::getByLabel(), edm::HandleBase::isValid(), fwrapper::jets, LogDebug, query::result, theJetCountSource, theMaxJetCount, theMinJetPt, and testEve_cfg::tracks.

Referenced by select().

169 {
170  Tracks result; result.clear();
171 
173  iEvent.getByLabel(theJetCountSource, jets);
174 
175  if (jets.isValid()) {
176  int jetCount = 0;
177  for (reco::CaloJetCollection::const_iterator itJet = jets->begin();
178  itJet!=jets->end();
179  ++itJet) {
180  if ((*itJet).pt() > theMinJetPt)
181  jetCount++;
182  }
183 
184  if (jetCount <= theMaxJetCount)
185  result = tracks;
186 
187  LogDebug("Alignment") << "> found " << jetCount << " Jets";
188  } else
189  LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::checkJetCount"
190  << "> could not optain jetCollection!";
191 
192  return result;
193 }
#define LogDebug(id)
std::vector< const reco::Track * > Tracks
vector< PseudoJet > jets
tuple result
Definition: query.py:137
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple tracks
Definition: testEve_cfg.py:39
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 100 of file AlignmentGlobalTrackSelector.cc.

References edm::Event::getByLabel(), globalMuons_cfi::globalMuons, edm::HandleBase::isValid(), LogDebug, matchTracks(), patZpeak::muons, query::result, theMinGlobalMuonCount, and theMuonSource.

Referenced by select().

101 {
102  Tracks result;
104 
105  //fill globalMuons with muons
107  iEvent.getByLabel(theMuonSource, muons);
108 
109  if (muons.isValid()) {
110  for (reco::MuonCollection::const_iterator itMuon = muons->begin();
111  itMuon != muons->end();
112  ++itMuon) {
113  const reco::Track* muonTrack = (*itMuon).get<reco::TrackRef>().get();
114  if (!muonTrack) {
115  LogDebug("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons"
116  << "Found muon without track: Standalone Muon!";
117  } else {
118  globalMuons.push_back(muonTrack);
119  }
120  }
121  } else {
122  LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons"
123  <<"> could not optain mounCollection!";
124  }
125 
126  result = this->matchTracks(tracks, globalMuons);
127 
128  if (static_cast<int>(result.size()) < theMinGlobalMuonCount) result.clear();
129 
130  return result;
131 }
#define LogDebug(id)
std::vector< const reco::Track * > Tracks
tuple result
Definition: query.py:137
bool isValid() const
Definition: HandleBase.h:76
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:356
tuple tracks
Definition: testEve_cfg.py:39
tuple muons
Definition: patZpeak.py:38
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 199 of file AlignmentGlobalTrackSelector.cc.

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

Referenced by findMuons().

200 {
201  Tracks result;
202  for (Tracks::const_iterator itComp = comp.begin();
203  itComp!=comp.end();
204  ++itComp) {
205  int match = -1;
206  double min = theMaxTrackDeltaR;
207  for (unsigned int i=0;i<src.size();i++) {
208  // LogDebug("Alignment") << "> Trackmatch dist: "<<deltaR(src.at(i),*itComp);
209  if(min > deltaR(*(src.at(i)),*(*itComp))){
210  min = deltaR(*(src.at(i)),*(*itComp));
211  match = static_cast<int>(i);
212  }
213  }
214  if (match > -1)
215  result.push_back(src.at(match));
216  }
217  return result;
218 }
int i
Definition: DBlmapReader.cc:9
#define min(a, b)
Definition: mlp_lapack.h:161
std::vector< const reco::Track * > Tracks
tuple result
Definition: query.py:137
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:6
void AlignmentGlobalTrackSelector::printTracks ( const Tracks col) const
private

print Information on Track-Collection

Definition at line 221 of file AlignmentGlobalTrackSelector.cc.

References prof2calltree::count, and LogDebug.

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

select tracks

Definition at line 84 of file AlignmentGlobalTrackSelector.cc.

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

85 {
87 
88  if (theGMFilterSwitch) result = findMuons(result, iEvent);
89  if (theIsoFilterSwitch) result = checkIsolation(result, iEvent);
90  if (theJetCountFilterSwitch) result = checkJetCount(result, iEvent);
91  LogDebug("Alignment") << "> Global: tracks all, kept: " << tracks.size() << ", " << result.size();
92 // LogDebug("Alignment")<<"> o kept:";
93 // printTracks(result);
94 
95  return result;
96 }
#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 ...
tuple result
Definition: query.py:137
Tracks checkIsolation(const Tracks &cands, const edm::Event &iEvent) const
returns only isolated tracks in [cands]
tuple tracks
Definition: testEve_cfg.py:39
bool AlignmentGlobalTrackSelector::useThisFilter ( )

Member Data Documentation

edm::ParameterSet AlignmentGlobalTrackSelector::theConf
private

private data members

Definition at line 42 of file AlignmentGlobalTrackSelector.h.

bool AlignmentGlobalTrackSelector::theGMFilterSwitch
private
bool AlignmentGlobalTrackSelector::theIsoFilterSwitch
private
bool AlignmentGlobalTrackSelector::theJetCountFilterSwitch
private
edm::InputTag AlignmentGlobalTrackSelector::theJetCountSource
private

Definition at line 61 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

edm::InputTag AlignmentGlobalTrackSelector::theJetIsoSource
private

Definition at line 55 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

int AlignmentGlobalTrackSelector::theMaxJetCount
private

Definition at line 63 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

double AlignmentGlobalTrackSelector::theMaxJetPt
private

Definition at line 56 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMaxTrackDeltaR
private

Definition at line 51 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and matchTracks().

int AlignmentGlobalTrackSelector::theMinGlobalMuonCount
private

Definition at line 52 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and findMuons().

int AlignmentGlobalTrackSelector::theMinIsolatedCount
private

Definition at line 58 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMinJetDeltaR
private

Definition at line 57 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMinJetPt
private

Definition at line 62 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

edm::InputTag AlignmentGlobalTrackSelector::theMuonSource
private

Definition at line 50 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and findMuons().