#include <AlignmentGlobalTrackSelector.h>
Public Types | |
typedef std::vector< const reco::Track * > | Tracks |
Public Member Functions | |
AlignmentGlobalTrackSelector (const edm::ParameterSet &cfg) | |
constructor | |
Tracks | select (const Tracks &tracks, const edm::Event &iEvent) |
select tracks | |
bool | useThisFilter () |
returns if any of the Filters is used. | |
~AlignmentGlobalTrackSelector () | |
destructor | |
Private Member Functions | |
Tracks | checkIsolation (const Tracks &cands, const edm::Event &iEvent) const |
returns only isolated tracks in [cands] | |
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 | findMuons (const Tracks &tracks, const edm::Event &iEvent) const |
filter for Tracks that match the Track of a global Muon | |
Tracks | matchTracks (const Tracks &src, const Tracks &comp) const |
matches [src] with [comp] returns collection with matching Tracks coming from [src] | |
void | printTracks (const Tracks &col) const |
print Information on Track-Collection | |
Private Attributes | |
edm::ParameterSet | theConf |
private data members | |
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 |
Definition at line 14 of file AlignmentGlobalTrackSelector.h.
typedef std::vector<const reco::Track*> AlignmentGlobalTrackSelector::Tracks |
Definition at line 19 of file AlignmentGlobalTrackSelector.h.
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.
: theGMFilterSwitch(cfg.getParameter<bool>("applyGlobalMuonFilter")), theIsoFilterSwitch(cfg.getParameter<bool>("applyIsolationtest")), theJetCountFilterSwitch(cfg.getParameter<bool>("applyJetCountFilter")), theMuonSource("muons"), theJetIsoSource("fastjet6CaloJets"), theJetCountSource("fastjet6CaloJets") { if (theGMFilterSwitch || theIsoFilterSwitch || theJetCountFilterSwitch) LogDebug("Alignment") << "> applying global Trackfilter ..."; if (theGMFilterSwitch) { theMuonSource = cfg.getParameter<InputTag>("muonSource"); theMaxTrackDeltaR =cfg.getParameter<double>("maxTrackDeltaR"); theMinGlobalMuonCount = cfg.getParameter<int>("minGlobalMuonCount"); LogDebug("Alignment") << "> GlobalMuonFilter : source, maxTrackDeltaR, min. Count : " << theMuonSource << " , " << theMaxTrackDeltaR << " , " << theMinIsolatedCount; } if (theIsoFilterSwitch) { theJetIsoSource = cfg.getParameter<InputTag>("jetIsoSource"); theMaxJetPt = cfg.getParameter<double>("maxJetPt"); theMinJetDeltaR = cfg.getParameter<double>("minJetDeltaR"); theMinIsolatedCount = cfg.getParameter<int>("minIsolatedCount"); LogDebug("Alignment") << "> Isolationtest : source, maxJetPt, minJetDeltaR, min. Count: " << theJetIsoSource << " , " << theMaxJetPt << " ," << theMinJetDeltaR << " ," << theMinGlobalMuonCount; } if (theJetCountFilterSwitch) { theJetCountSource = cfg.getParameter<InputTag>("jetCountSource"); theMinJetPt = cfg.getParameter<double>("minJetPt"); theMaxJetCount = cfg.getParameter<int>("maxJetCount"); LogDebug("Alignment") << "> JetCountFilter : source, minJetPt, maxJetCount : " << theJetCountSource << " , " << theMinJetPt << " ," << theMaxJetCount; } }
AlignmentGlobalTrackSelector::~AlignmentGlobalTrackSelector | ( | ) |
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().
{ Tracks result; result.clear(); Handle<reco::CaloJetCollection> jets; iEvent.getByLabel(theJetIsoSource, jets); if (jets.isValid()) { for (Tracks::const_iterator it = cands.begin(); it!=cands.end(); ++it) { bool isolated = true; for (reco::CaloJetCollection::const_iterator itJet = jets->begin(); itJet!=jets->end(); ++itJet) isolated &= !((*itJet).pt() > theMaxJetPt && deltaR(*(*it),(*itJet)) < theMinJetDeltaR); if (isolated) result.push_back(*it); } // LogDebug("Alignment") << "D Found "<<result.size()<<" isolated of "<< cands.size()<<" Tracks!"; } else LogError("Alignment")<< "@SUB=AlignmentGlobalTrackSelector::checkIsolation" << "> could not optain jetCollection!"; if (static_cast<int>(result.size()) < theMinIsolatedCount) result.clear(); return result; }
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().
{ Tracks result; result.clear(); Handle<reco::CaloJetCollection> jets; iEvent.getByLabel(theJetCountSource, jets); if (jets.isValid()) { int jetCount = 0; for (reco::CaloJetCollection::const_iterator itJet = jets->begin(); itJet!=jets->end(); ++itJet) { if ((*itJet).pt() > theMinJetPt) jetCount++; } if (jetCount <= theMaxJetCount) result = tracks; LogDebug("Alignment") << "> found " << jetCount << " Jets"; } else LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::checkJetCount" << "> could not optain jetCollection!"; return result; }
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().
{ Tracks result; Tracks globalMuons; //fill globalMuons with muons Handle<reco::MuonCollection> muons; iEvent.getByLabel(theMuonSource, muons); if (muons.isValid()) { for (reco::MuonCollection::const_iterator itMuon = muons->begin(); itMuon != muons->end(); ++itMuon) { const reco::Track* muonTrack = (*itMuon).get<reco::TrackRef>().get(); if (!muonTrack) { LogDebug("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons" << "Found muon without track: Standalone Muon!"; } else { globalMuons.push_back(muonTrack); } } } else { LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons" <<"> could not optain mounCollection!"; } result = this->matchTracks(tracks, globalMuons); if (static_cast<int>(result.size()) < theMinGlobalMuonCount) result.clear(); return result; }
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().
{ Tracks result; for (Tracks::const_iterator itComp = comp.begin(); itComp!=comp.end(); ++itComp) { int match = -1; double min = theMaxTrackDeltaR; for (unsigned int i=0;i<src.size();i++) { // LogDebug("Alignment") << "> Trackmatch dist: "<<deltaR(src.at(i),*itComp); if(min > deltaR(*(src.at(i)),*(*itComp))){ min = deltaR(*(src.at(i)),*(*itComp)); match = static_cast<int>(i); } } if (match > -1) result.push_back(src.at(match)); } return result; }
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.
{ int count = 0; LogDebug("Alignment") << ">......................................"; for (Tracks::const_iterator it = col.begin(); it < col.end(); ++it,++count) { LogDebug("Alignment") << "> Track No. " << count << ": p = (" << (*it)->px() << "," << (*it)->py() << "," << (*it)->pz() << ")\n" << "> pT = " << (*it)->pt() << " eta = " << (*it)->eta() << " charge = " << (*it)->charge(); } LogDebug("Alignment") << ">......................................"; }
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 TrackConfigSelector::select().
{ Tracks result = tracks; if (theGMFilterSwitch) result = findMuons(result, iEvent); if (theIsoFilterSwitch) result = checkIsolation(result, iEvent); if (theJetCountFilterSwitch) result = checkJetCount(result, iEvent); LogDebug("Alignment") << "> Global: tracks all, kept: " << tracks.size() << ", " << result.size(); // LogDebug("Alignment")<<"> o kept:"; // printTracks(result); return result; }
bool AlignmentGlobalTrackSelector::useThisFilter | ( | ) |
returns if any of the Filters is used.
Definition at line 77 of file AlignmentGlobalTrackSelector.cc.
References theGMFilterSwitch, theIsoFilterSwitch, and theJetCountFilterSwitch.
Referenced by TrackConfigSelector::TrackConfigSelector().
{ return theGMFilterSwitch || theIsoFilterSwitch|| theJetCountFilterSwitch; }
private data members
Definition at line 42 of file AlignmentGlobalTrackSelector.h.
bool AlignmentGlobalTrackSelector::theGMFilterSwitch [private] |
Definition at line 45 of file AlignmentGlobalTrackSelector.h.
Referenced by AlignmentGlobalTrackSelector(), select(), and useThisFilter().
bool AlignmentGlobalTrackSelector::theIsoFilterSwitch [private] |
Definition at line 46 of file AlignmentGlobalTrackSelector.h.
Referenced by AlignmentGlobalTrackSelector(), select(), and useThisFilter().
bool AlignmentGlobalTrackSelector::theJetCountFilterSwitch [private] |
Definition at line 47 of file AlignmentGlobalTrackSelector.h.
Referenced by AlignmentGlobalTrackSelector(), select(), and useThisFilter().
Definition at line 61 of file AlignmentGlobalTrackSelector.h.
Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().
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().
Definition at line 50 of file AlignmentGlobalTrackSelector.h.
Referenced by AlignmentGlobalTrackSelector(), and findMuons().