1 #ifndef MUSCLEFITMUONSELECTOR 2 #define MUSCLEFITMUONSELECTOR 16 #include "HepMC/GenParticle.h" 17 #include "HepMC/GenEvent.h" 33 const std::vector<int> & resfind,
34 const bool speedup,
const std::string & genParticlesName,
35 const bool compareToSimTracks,
const edm::InputTag & simTracksCollectionName,
36 const bool sherpa,
const bool debug) :
58 std::vector<GenMuonPair> & genPair,
59 std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
75 const std::vector<const pat::Muon*> & collMuSel,
76 std::vector<GenMuonPair> & genPair,
79 std::vector<GenMuonPair> & genPair,
80 std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
85 std::vector<std::pair<lorentzVector,lorentzVector> > & simPair,
92 std::vector<MuScleFitMuon>
muons;
93 typename std::vector<T>::const_iterator
track;
94 for( track = tracks.begin(); track != tracks.end(); ++
track ) {
99 Double_t hitsTk(0), hitsMuon(0), ptError(0);
100 if (
const reco::Muon* myMu = dynamic_cast<const reco::Muon*>(&(*track)) ){
101 hitsTk = myMu->innerTrack()->hitPattern().numberOfValidTrackerHits();
102 hitsMuon = myMu->innerTrack()->hitPattern().numberOfValidMuonHits();
103 ptError = myMu->innerTrack()->ptError();
105 else if (
const pat::Muon* myMu = dynamic_cast<const pat::Muon*>(&(*track)) ) {
106 hitsTk = myMu->innerTrack()->hitPattern().numberOfValidTrackerHits();
107 hitsMuon = myMu->innerTrack()->hitPattern().numberOfValidMuonHits();
108 ptError = myMu->innerTrack()->ptError();
110 else if (
const reco::Track* myMu = dynamic_cast<const reco::Track*>(&(*track))){
111 hitsTk = myMu->hitPattern().numberOfValidTrackerHits();
112 hitsMuon = myMu->hitPattern().numberOfValidMuonHits();
113 ptError = myMu->ptError();
119 std::cout<<
"[MuScleFitMuonSelector::fillMuonCollection] after MuScleFitMuon initialization"<<std::endl;
123 muons.push_back(
muon);
136 tracks.push_back(*(muon->globalTrack()));
137 else if(muon->isStandAloneMuon() &&
muonType_==2)
138 tracks.push_back(*(muon->outerTrack()));
139 else if(muon->isTrackerMuon() &&
muonType_==3)
140 tracks.push_back(*(muon->innerTrack()));
142 else if(
muonType_ == 10 && !(muon->isStandAloneMuon()) )
143 tracks.push_back(*(muon->innerTrack()));
144 else if(
muonType_ == 11 && muon->isGlobalMuon() )
145 tracks.push_back(*(muon->innerTrack()));
146 else if(
muonType_ == 13 && muon->isTrackerMuon() )
147 tracks.push_back(*(muon->innerTrack()));
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
void selectGeneratedMuons(const edm::Handle< pat::CompositeCandidateCollection > &collAll, const std::vector< const pat::Muon * > &collMuSel, std::vector< GenMuonPair > &genPair, MuScleFitPlotter *plotter)
For PATmuons the generator information is read directly from the PAT object.
std::pair< lorentzVector, lorentzVector > findSimMuFromRes(const edm::Handle< edm::HepMCProduct > &evtMC, const edm::Handle< edm::SimTrackContainer > &simTracks)
const std::string genParticlesName_
void selectMuons(const edm::Event &event, std::vector< MuScleFitMuon > &muons, std::vector< GenMuonPair > &genPair, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
Main method used to select muons of type specified by muonType_ from the collection specified by muon...
std::vector< MuScleFitMuon > fillMuonCollection(const std::vector< T > &tracks)
Template function used to convert the muon collection to a vector of reco::LeafCandidate.
bool selTrackerMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select trackerMuons.
void selectSimulatedMuons(const edm::Event &event, const bool ifHepMC, edm::Handle< edm::HepMCProduct > evtMC, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
MuScleFitMuonSelector(const edm::InputTag &muonLabel, const int muonType, const bool PATmuons, const std::vector< int > &resfind, const bool speedup, const std::string &genParticlesName, const bool compareToSimTracks, const edm::InputTag &simTracksCollectionName, const bool sherpa, const bool debug)
const bool compareToSimTracks_
static const unsigned int motherPdgIdArray[6]
const edm::InputTag muonLabel_
reco::Particle::LorentzVector lorentzVector
GenMuonPair findGenMuFromRes(const reco::GenParticleCollection *genParticles)
void selectGenSimMuons(const edm::Event &event, std::vector< GenMuonPair > &genPair, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
const edm::InputTag simTracksCollectionName_
bool selGlobalMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select globalMuons.
void takeSelectedMuonType(const T &muon, std::vector< reco::Track > &tracks)
Template function used to extract the selected muon type from the muon collection.
const reco::Candidate * getStatus3Muon(const reco::Candidate *status3Muon)
const std::vector< int > resfind_
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Analysis-level muon class.
const reco::Candidate * getStatus1Muon(const reco::Candidate *status3Muon)