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

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

29  :
30  theMuonSource("muons"),
31  theJetIsoSource("fastjet6CaloJets"),
32  theJetCountSource("fastjet6CaloJets")
33 {
34  theIsoFilterSwitch = cfg.getParameter<bool>( "applyIsolationtest" );
35  theGMFilterSwitch = cfg.getParameter<bool>( "applyGlobalMuonFilter" );
36  theJetCountFilterSwitch = cfg.getParameter<bool>( "applyJetCountFilter" );
37  if (theIsoFilterSwitch || theGMFilterSwitch || theJetCountFilterSwitch)
38  LogDebug("Alignment") << "> applying global Trackfilter ...";
39 
40  if (theGMFilterSwitch){
41  theMuonSource = cfg.getParameter<InputTag>( "muonSource" );
42  theMaxTrackDeltaR =cfg.getParameter<double>("maxTrackDeltaR");
43  theMinIsolatedCount = cfg.getParameter<int>("minIsolatedCount");
44  LogDebug("Alignment") << "> GlobalMuonFilter : source, maxTrackDeltaR, min. Count : " << theMuonSource<<" , "<<theMaxTrackDeltaR<<" , "<<theMinIsolatedCount;
45  }else{
48  }
49 
50  if (theIsoFilterSwitch ){
51  theJetIsoSource = cfg.getParameter<InputTag>( "jetIsoSource" );
52  theMaxJetPt = cfg.getParameter<double>( "maxJetPt" );
53  theMinJetDeltaR = cfg.getParameter<double>( "minJetDeltaR" );
54  theMinGlobalMuonCount = cfg.getParameter<int>( "minGlobalMuonCount" );
55  LogDebug("Alignment") << "> Isolationtest : source, maxJetPt, minJetDeltaR, min. Count: " << theJetIsoSource << " , " << theMaxJetPt<<" ," <<theMinJetDeltaR<<" ," <<theMinGlobalMuonCount;
56  }else{
57  theMaxJetPt = 0;
58  theMinJetDeltaR = 0;
60  }
61 
62  if(theJetCountFilterSwitch){
63  theJetCountSource = cfg.getParameter<InputTag>( "jetCountSource" );
64  theMinJetPt = cfg.getParameter<double>( "minJetPt" );
65  theMaxJetCount = cfg.getParameter<int>( "maxJetCount" );
66  LogDebug("Alignment") << "> JetCountFilter : source, minJetPt, maxJetCount : " << theJetCountSource << " , " << theMinJetPt<<" ," <<theMaxJetCount;
67  }
68 
69 
70 }
#define LogDebug(id)
T getParameter(std::string const &) const
AlignmentGlobalTrackSelector::~AlignmentGlobalTrackSelector ( )

destructor

Definition at line 75 of file AlignmentGlobalTrackSelector.cc.

76 {}

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

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

Referenced by select().

104 {
105  Tracks result; result.clear();
106 
108  iEvent.getByLabel(theJetIsoSource ,jets);
109  if(jets.isValid()){
110  for(Tracks::const_iterator it = cands.begin();it < cands.end();++it){
111  bool isolated = true;
112  for(reco::CaloJetCollection::const_iterator itJet = jets->begin(); itJet != jets->end() ; ++itJet)
113  isolated &= !((*itJet).pt() > theMaxJetPt && deltaR(*(*it),(*itJet)) < theMinJetDeltaR);
114 
115  if(isolated)
116  result.push_back(*it);
117  }
118  // LogDebug("Alignment") << "D Found "<<result.size()<<" isolated of "<< cands.size()<<" Tracks!";
119 
120  }else LogError("Alignment")<<"@SUB=AlignmentGlobalTrackSelector::checkIsolation"
121  <<"> could not optain jetCollection!";
122 
123  if(static_cast<int>(result.size()) < theMinIsolatedCount) result.clear();
124  return result;
125 }
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:359
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 129 of file AlignmentGlobalTrackSelector.cc.

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

Referenced by select().

130 {
131  Tracks result; result.clear();
133  iEvent.getByLabel(theJetCountSource ,jets);
134  if(jets.isValid()){
135  int jetCount = 0;
136  for(reco::CaloJetCollection::const_iterator itJet = jets->begin(); itJet != jets->end() ; ++itJet){
137  if((*itJet).pt() > theMinJetPt)
138  jetCount++;
139  }
140  if(jetCount <= theMaxJetCount)
141  result = tracks;
142  LogDebug("Alignment")<<"> found "<<jetCount<<" Jets";
143  }else LogError("Alignment")<<"@SUB=AlignmentGlobalTrackSelector::checkJetCount"
144  <<"> could not optain jetCollection!";
145  return result;
146 }
#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:359
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 150 of file AlignmentGlobalTrackSelector.cc.

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

Referenced by select().

151 {
152  Tracks result;
154 
155  //fill globalMuons with muons
157  iEvent.getByLabel(theMuonSource, muons);
158  if (muons.isValid()) {
159  for(reco::MuonCollection::const_iterator itMuon = muons->begin(); itMuon != muons->end();
160  ++itMuon) {
161  const reco::Track* muonTrack = (*itMuon).get<reco::TrackRef>().get();
162  if (!muonTrack) {
163  LogDebug("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons"
164  << "Found muon without track: Standalone Muon!";
165  } else {
166  globalMuons.push_back(muonTrack);
167  }
168  }
169  } else {
170  LogError("Alignment") << "@SUB=AlignmentGlobalTrackSelector::findMuons"
171  <<"> could not optain mounCollection!";
172  }
173 
174  result = this->matchTracks(tracks, globalMuons);
175 
176  if (static_cast<int>(result.size()) < theMinGlobalMuonCount) result.clear();
177 
178  return result;
179 }
#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:359
tuple tracks
Definition: testEve_cfg.py:39
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 185 of file AlignmentGlobalTrackSelector.cc.

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

Referenced by findMuons().

186 {
187  Tracks result;
188  for(Tracks::const_iterator itComp = comp.begin(); itComp < comp.end();++itComp){
189  int match = -1;
190  double min = theMaxTrackDeltaR;
191  for(unsigned int i =0; i < src.size();i++){
192  // LogDebug("Alignment") << "> Trackmatch dist: "<<deltaR(src.at(i),*itComp);
193  if(min > deltaR(*(src.at(i)),*(*itComp))){
194  min = deltaR(*(src.at(i)),*(*itComp));
195  match = static_cast<int>(i);
196  }
197  }
198  if(match > -1)
199  result.push_back(src.at(match));
200  }
201  return result;
202 }
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
tuple src
Definition: align_tpl.py:87
void AlignmentGlobalTrackSelector::printTracks ( const Tracks col) const
private

print Information on Track-Collection

Definition at line 205 of file AlignmentGlobalTrackSelector.cc.

References prof2calltree::count, and LogDebug.

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

select tracks

Definition at line 87 of file AlignmentGlobalTrackSelector.cc.

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

Referenced by python.Vispa.Views.LineDecayView.LineDecayContainer::createObject(), python.Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), python.Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), python.Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), python.Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), python.Vispa.Views.AbstractView.AbstractView::restoreSelection(), and TrackConfigSelector::select().

88 {
90 
91  if(theGMFilterSwitch) result = findMuons(result,iEvent);
92  if(theIsoFilterSwitch) result = checkIsolation(result,iEvent);
93  if(theJetCountFilterSwitch) result = checkJetCount(result,iEvent);
94  LogDebug("Alignment") << "> Global: tracks all,kept: " << tracks.size() << "," << result.size();
95 // LogDebug("Alignment")<<"> o kept:";
96 // printTracks(result);
97 
98  return result;
99 }
#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 40 of file AlignmentGlobalTrackSelector.h.

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

Definition at line 56 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

edm::InputTag AlignmentGlobalTrackSelector::theJetIsoSource
private

Definition at line 50 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

int AlignmentGlobalTrackSelector::theMaxJetCount
private

Definition at line 58 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

double AlignmentGlobalTrackSelector::theMaxJetPt
private

Definition at line 51 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMaxTrackDeltaR
private

Definition at line 53 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and matchTracks().

int AlignmentGlobalTrackSelector::theMinGlobalMuonCount
private

Definition at line 48 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and findMuons().

int AlignmentGlobalTrackSelector::theMinIsolatedCount
private

Definition at line 54 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMinJetDeltaR
private

Definition at line 52 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkIsolation().

double AlignmentGlobalTrackSelector::theMinJetPt
private

Definition at line 57 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and checkJetCount().

edm::InputTag AlignmentGlobalTrackSelector::theMuonSource
private

Definition at line 47 of file AlignmentGlobalTrackSelector.h.

Referenced by AlignmentGlobalTrackSelector(), and findMuons().