13 ->isPromptFinalState();
15 if (isPromptFinalState)
22 ->isPromptFinalState();
35 ->isLastCopyBeforeFSR();
44 ->isLastCopyBeforeFSR();
62 iTrack->found() > 11 && gTrack->chi2() / gTrack->ndof() < 20.0 &&
q.numberOfValidMuonHits() > 0 &&
63 iTrack->chi2() / iTrack->ndof() < 4.0 && aMuon->
muonID(
"TrackerMuonArbitrated") &&
64 aMuon->
muonID(
"TMLastStationAngTight") &&
p.pixelLayersWithMeasurement() > 1 &&
75 iTrack->found() > 11 && iTrack->chi2() / iTrack->ndof() < 4.0 && aMuon->
muonID(
"TrackerMuonArbitrated") &&
76 aMuon->
muonID(
"TMLastStationAngTight") &&
p.pixelLayersWithMeasurement() > 1 &&
86 std::vector<MuScleFitMuon>&
muons,
87 std::vector<GenMuonPair>& genPair,
88 std::vector<std::pair<lorentzVector, lorentzVector> >& simPair,
94 std::vector<const pat::Muon*> collMuSel;
99 std::vector<const pat::CompositeCandidate*> collSelGG;
100 std::vector<const pat::CompositeCandidate*> collSelGT;
101 std::vector<const pat::CompositeCandidate*> collSelTT;
103 for (std::vector<pat::CompositeCandidate>::const_iterator it = collAll->begin(); it != collAll->end(); ++it) {
114 collSelGG.push_back(
cand);
121 collSelGT.push_back(
cand);
127 collSelGT.push_back(
cand);
134 collSelTT.push_back(
cand);
141 std::vector<reco::Track>
tracks;
142 if (!collSelGG.empty()) {
144 const pat::Muon* muon1 =
dynamic_cast<const pat::Muon*
>(collSelGG[0]->daughter(
"muon1"));
145 const pat::Muon* muon2 =
dynamic_cast<const pat::Muon*
>(collSelGG[0]->daughter(
"muon2"));
149 collMuSel.push_back(muon1);
150 collMuSel.push_back(muon2);
152 }
else if (collSelGG.empty() && !collSelGT.empty()) {
154 const pat::Muon* muon1 =
dynamic_cast<const pat::Muon*
>(collSelGT[0]->daughter(
"muon1"));
155 const pat::Muon* muon2 =
dynamic_cast<const pat::Muon*
>(collSelGT[0]->daughter(
"muon2"));
159 collMuSel.push_back(muon1);
160 collMuSel.push_back(muon2);
162 }
else if (collSelGG.empty() && collSelGT.empty() && !collSelTT.empty()) {
164 const pat::Muon* muon1 =
dynamic_cast<const pat::Muon*
>(collSelTT[0]->daughter(
"muon1"));
165 const pat::Muon* muon2 =
dynamic_cast<const pat::Muon*
>(collSelTT[0]->daughter(
"muon2"));
169 collMuSel.push_back(muon1);
170 collMuSel.push_back(muon2);
174 std::cout <<
"ERROR strange number of muons selected by onia cuts!" << std::endl;
178 }
else if ((muonType_ < 4 && muonType_ >= 0) ||
muonType_ >= 10) {
179 std::vector<reco::Track>
tracks;
206 std::vector<reco::Track>
tracks;
233 const std::vector<const pat::Muon*>& collMuSel,
234 std::vector<GenMuonPair>& genPair,
239 for (std::vector<pat::CompositeCandidate>::const_iterator it = collAll->begin(); it != collAll->end(); ++it) {
243 genPatParticles.push_back(*genJpsi.
get());
247 if (collMuSel.size() == 2) {
250 bool isMuMatched = (genMu1.
isAvailable() && genMu2.
isAvailable() && genMu1->pdgId() * genMu2->pdgId() == -169);
252 genPatParticles.push_back(*genMu1.
get());
253 genPatParticles.push_back(*genMu2.
get());
256 if (genMu1->mother() !=
nullptr) {
257 motherId = genMu1->mother()->pdgId();
259 if (genMu1->pdgId() == 13)
265 plotter->fillGen(genPatParticles,
true);
268 std::cout <<
"Found genParticles in PAT" << std::endl;
270 std::cout <<
"No recomuon selected so no access to generated info" << std::endl;
276 std::cout <<
"No recomuon selected so no access to generated info" << std::endl;
282 std::cout <<
"genParticles:" << std::endl;
284 std::cout << genPair.back().mu1 <<
" , " << genPair.back().mu2 << std::endl;
289 std::vector<GenMuonPair>& genPair,
290 std::vector<std::pair<lorentzVector, lorentzVector> >& simPair,
298 bool ifHepMC =
false;
309 std::cout <<
"Found genParticles" << std::endl;
312 <<
"non generation info and speedup true!!!!!!!!!!!!" << std::endl;
318 std::cout <<
"genParticles:" << std::endl;
319 std::cout << genPair.back().mu1 <<
" , " << genPair.back().mu2 << std::endl;
327 std::vector<std::pair<lorentzVector, lorentzVector> >& simPair,
330 bool simTracksFound =
false;
335 simTracksFound =
true;
339 std::cout <<
"SimTracks not existent" << std::endl;
341 if (!simTracksFound) {
350 for (HepMC::GenEvent::particle_const_iterator
part = Evt->particles_begin();
part != Evt->particles_end();
part++) {
351 if (
std::abs((*part)->pdg_id()) == 13 && (*part)->status() == 1) {
352 bool fromRes =
false;
353 unsigned int motherPdgId = 0;
354 for (HepMC::GenVertex::particle_iterator mother = (*part)->production_vertex()->particles_begin(HepMC::ancestors);
355 mother != (*part)->production_vertex()->particles_end(HepMC::ancestors);
357 motherPdgId = (*mother)->pdg_id();
362 if (motherPdgId == 13 && (*mother)->status() == 3)
365 for (
int ires = 0; ires < 6; ++ires) {
372 if ((*part)->pdg_id() == 13) {
375 (*part)->momentum().px(), (*part)->momentum().py(), (*part)->momentum().pz(), (*part)->momentum().e()));
378 (*part)->momentum().px(), (*part)->momentum().py(), (*part)->momentum().pz(), (*part)->momentum().e()));
400 bool fromRes =
false;
401 unsigned int motherPdgId =
part->mother()->pdgId();
403 std::cout <<
"Found a muon with mother: " << motherPdgId << std::endl;
405 for (
int ires = 0; ires < 6; ++ires) {
418 std::cout <<
"fromRes = true, motherPdgId = " << motherPdgId << std::endl;
421 if (
part->pdgId() == 13) {
422 if (status1Muon->
p4().pt() != 0)
427 std::cout <<
"Found a genMuon - : " << muFromRes.
mu1 << std::endl;
431 if (status1Muon->
p4().pt() != 0)
436 std::cout <<
"Found a genMuon + : " << muFromRes.
mu2 << std::endl;
450 std::pair<lorentzVector, lorentzVector> simMuFromRes;
453 if (
std::abs((*simTrack).type()) == 13) {
455 if ((*simTrack).genpartIndex() > 0) {
458 for (HepMC::GenVertex::particle_iterator mother =
gp->production_vertex()->particles_begin(HepMC::ancestors);
459 mother !=
gp->production_vertex()->particles_end(HepMC::ancestors);
461 bool fromRes =
false;
462 unsigned int motherPdgId = (*mother)->pdg_id();
463 for (
int ires = 0; ires < 6; ++ires) {
468 if (
gp->pdg_id() == 13)
Analysis-level particle class.
std::vector< GenParticle > GenParticleCollection
collection of GenParticles
std::pair< lorentzVector, lorentzVector > findSimMuFromRes(const edm::Handle< edm::HepMCProduct > &evtMC, const edm::Handle< edm::SimTrackContainer > &simTracks)
virtual const Candidate * daughter(size_type i) const =0
return daughter at a given position, i = 0, ... numberOfDaughters() - 1 (read only mode) ...
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.
T const * product() const
bool selTrackerMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select trackerMuons.
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.
const edm::EDGetTokenT< edm::HepMCProduct > evtMCToken_
void selectSimulatedMuons(const edm::Event &event, const bool ifHepMC, edm::Handle< edm::HepMCProduct > evtMC, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
const edm::EDGetTokenT< reco::CaloMuonCollection > caloMuonToken_
const edm::EDGetTokenT< reco::GenParticleCollection > genParticleToken_
bool isTrackerMuon() const override
const edm::EDGetTokenT< pat::MuonCollection > patMuonToken_
reco::Particle::LorentzVector lorentzVector
static const unsigned int motherPdgIdArray[6]
virtual size_type numberOfDaughters() const =0
number of daughters
Abs< T >::type abs(const T &t)
bool isMatched(TrackingRecHit const &hit)
const HepMC::GenEvent * GetEvent() const
const edm::EDGetTokenT< edm::SimTrackContainer > simTrackToken_
virtual int pdgId() const =0
PDG identifier.
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)
reco::TrackRef globalTrack() const override
reference to Track reconstructed in both tracked and muon detector (reimplemented from reco::Muon) ...
reco::TrackRef innerTrack() const override
reference to Track reconstructed in the tracker only (reimplemented from reco::Muon) ...
T const * get() const
Returns C++ pointer to the item.
bool selGlobalMuon(const pat::Muon *aMuon)
Apply the Onia cuts to select globalMuons.
const edm::EDGetTokenT< reco::MuonCollection > recoMuonToken_
void takeSelectedMuonType(const T &muon, std::vector< reco::Track > &tracks)
Template function used to extract the selected muon type from the muon collection.
Log< level::Warning, false > LogWarning
const reco::Candidate * getStatus3Muon(const reco::Candidate *status3Muon)
const edm::EDGetTokenT< pat::CompositeCandidateCollection > onia2MuMuToken_
const std::vector< int > resfind_
Analysis-level muon class.
const edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
bool isGlobalMuon() const override
int charge() const final
electric charge
const reco::Candidate * getStatus1Muon(const reco::Candidate *status3Muon)
bool muonID(const std::string &name) const
virtual const LorentzVector & p4() const =0
four-momentum Lorentz vector