CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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, 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::CaloJetCollection
theJetCountToken
 
edm::EDGetTokenT
< reco::CaloJetCollection
theJetIsoToken
 
int theMaxJetCount
 
double theMaxJetPt
 
double theMaxTrackDeltaR
 
int theMinGlobalMuonCount
 
int theMinIsolatedCount
 
double theMinJetDeltaR
 
double theMinJetPt
 
edm::EDGetTokenT
< reco::MuonCollection
theMuonToken
 

Detailed Description

Definition at line 22 of file AlignmentGlobalTrackSelector.h.

Member Typedef Documentation

Definition at line 24 of file AlignmentGlobalTrackSelector.h.

Constructor & Destructor Documentation

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

constructor

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

destructor

Definition at line 65 of file AlignmentGlobalTrackSelector.cc.

65 {}

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

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

Referenced by select().

126  {
127  Tracks result;
128  result.clear();
129 
131  iEvent.getByToken(theJetIsoToken, jets);
132 
133  if (jets.isValid()) {
134  for (Tracks::const_iterator it = cands.begin(); it != cands.end(); ++it) {
135  bool isolated = true;
136  for (reco::CaloJetCollection::const_iterator itJet = jets->begin(); itJet != jets->end(); ++itJet)
137  isolated &= !((*itJet).pt() > theMaxJetPt && deltaR(*(*it), (*itJet)) < theMinJetDeltaR);
138 
139  if (isolated)
140  result.push_back(*it);
141  }
142  // LogDebug("Alignment") << "D Found "<<result.size()<<" isolated of "<< cands.size()<<" Tracks!";
143 
144  } else
145  LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::checkIsolation"
146  << "> could not optain jetCollection!";
147 
148  if (static_cast<int>(result.size()) < theMinIsolatedCount)
149  result.clear();
150 
151  return result;
152 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::vector< const reco::Track * > Tracks
Log< level::Error, false > LogError
tuple result
Definition: mps_fire.py:311
vector< PseudoJet > jets
bool isValid() const
Definition: HandleBase.h:70
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 155 of file AlignmentGlobalTrackSelector.cc.

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

Referenced by select().

156  {
157  Tracks result;
158  result.clear();
159 
161  iEvent.getByToken(theJetCountToken, jets);
162 
163  if (jets.isValid()) {
164  int jetCount = 0;
165  for (reco::CaloJetCollection::const_iterator itJet = jets->begin(); itJet != jets->end(); ++itJet) {
166  if ((*itJet).pt() > theMinJetPt)
167  jetCount++;
168  }
169 
170  if (jetCount <= theMaxJetCount)
171  result = tracks;
172 
173  LogDebug("Alignment") << "> found " << jetCount << " Jets";
174  } else
175  LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::checkJetCount"
176  << "> could not optain jetCollection!";
177 
178  return result;
179 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
auto const & tracks
cannot be loose
std::vector< const reco::Track * > Tracks
Log< level::Error, false > LogError
edm::EDGetTokenT< reco::CaloJetCollection > theJetCountToken
tuple result
Definition: mps_fire.py:311
vector< PseudoJet > jets
bool isValid() const
Definition: HandleBase.h:70
#define LogDebug(id)
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 92 of file AlignmentGlobalTrackSelector.cc.

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

Referenced by select().

93  {
94  Tracks result;
96 
97  //fill globalMuons with muons
99  iEvent.getByToken(theMuonToken, muons);
100 
101  if (muons.isValid()) {
102  for (reco::MuonCollection::const_iterator itMuon = muons->begin(); itMuon != muons->end(); ++itMuon) {
103  const reco::Track* muonTrack = (*itMuon).get<reco::TrackRef>().get();
104  if (!muonTrack) {
105  LogDebug("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons"
106  << "Found muon without track: Standalone Muon!";
107  } else {
108  globalMuons.push_back(muonTrack);
109  }
110  }
111  } else {
112  LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons"
113  << "> could not optain mounCollection!";
114  }
115 
116  result = this->matchTracks(tracks, globalMuons);
117 
118  if (static_cast<int>(result.size()) < theMinGlobalMuonCount)
119  result.clear();
120 
121  return result;
122 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
auto const & tracks
cannot be loose
std::vector< const reco::Track * > Tracks
Log< level::Error, false > LogError
tuple result
Definition: mps_fire.py:311
bool isValid() const
Definition: HandleBase.h:70
edm::EDGetTokenT< reco::MuonCollection > theMuonToken
tuple muons
Definition: patZpeak.py:41
Tracks matchTracks(const Tracks &src, const Tracks &comp) const
matches [src] with [comp] returns collection with matching Tracks coming from [src] ...
#define LogDebug(id)
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 184 of file AlignmentGlobalTrackSelector.cc.

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

Referenced by findMuons().

185  {
186  Tracks result;
187  for (Tracks::const_iterator itComp = comp.begin(); itComp != comp.end(); ++itComp) {
188  int match = -1;
189  double min = theMaxTrackDeltaR;
190  for (unsigned int i = 0; i < src.size(); i++) {
191  // LogDebug("Alignment") << "> Trackmatch dist: "<<deltaR(src.at(i),*itComp);
192  if (min > deltaR(*(src.at(i)), *(*itComp))) {
193  min = deltaR(*(src.at(i)), *(*itComp));
194  match = static_cast<int>(i);
195  }
196  }
197  if (match > -1)
198  result.push_back(src.at(match));
199  }
200  return result;
201 }
std::vector< const reco::Track * > Tracks
tuple result
Definition: mps_fire.py:311
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 204 of file AlignmentGlobalTrackSelector.cc.

References submitPVResolutionJobs::count, and LogDebug.

204  {
205  int count = 0;
206  LogDebug("Alignment") << ">......................................";
207  for (Tracks::const_iterator it = col.begin(); it < col.end(); ++it, ++count) {
208  LogDebug("Alignment") << "> Track No. " << count << ": p = (" << (*it)->px() << "," << (*it)->py() << ","
209  << (*it)->pz() << ")\n"
210  << "> pT = " << (*it)->pt() << " eta = " << (*it)->eta()
211  << " charge = " << (*it)->charge();
212  }
213  LogDebug("Alignment") << ">......................................";
214 }
int col
Definition: cuy.py:1009
#define LogDebug(id)
AlignmentGlobalTrackSelector::Tracks AlignmentGlobalTrackSelector::select ( const Tracks tracks,
const edm::Event iEvent,
const edm::EventSetup eSetup 
)

select tracks

Definition at line 73 of file AlignmentGlobalTrackSelector.cc.

References checkIsolation(), checkJetCount(), findMuons(), LogDebug, mps_fire::result, theGMFilterSwitch, theIsoFilterSwitch, theJetCountFilterSwitch, and tracks.

Referenced by TrackConfigSelector::select().

75  {
77 
79  result = findMuons(result, iEvent);
81  result = checkIsolation(result, iEvent);
83  result = checkJetCount(result, iEvent);
84  LogDebug("Alignment") << "> Global: tracks all, kept: " << tracks.size() << ", " << result.size();
85  // LogDebug("Alignment")<<"> o kept:";
86  // printTracks(result);
87 
88  return result;
89 }
Tracks findMuons(const Tracks &tracks, const edm::Event &iEvent) const
filter for Tracks that match the Track of a global Muon
auto const & tracks
cannot be loose
std::vector< const reco::Track * > Tracks
tuple result
Definition: mps_fire.py:311
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]
#define LogDebug(id)
bool AlignmentGlobalTrackSelector::useThisFilter ( )

Member Data Documentation

edm::ParameterSet AlignmentGlobalTrackSelector::theConf
private

private data members

Definition at line 46 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 65 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

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

Definition at line 59 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

int AlignmentGlobalTrackSelector::theMaxJetCount
private

Definition at line 67 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

double AlignmentGlobalTrackSelector::theMaxJetPt
private

Definition at line 60 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMaxTrackDeltaR
private

Definition at line 55 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and matchTracks().

int AlignmentGlobalTrackSelector::theMinGlobalMuonCount
private

Definition at line 56 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and findMuons().

int AlignmentGlobalTrackSelector::theMinIsolatedCount
private

Definition at line 62 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMinJetDeltaR
private

Definition at line 61 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMinJetPt
private

Definition at line 66 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

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

Definition at line 54 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and findMuons().