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,
91 event.getByLabel(
"onia2MuMuPatTrkTrk", collAll);
95 std::vector<const pat::Muon*> collMuSel;
100 std::vector<const pat::CompositeCandidate*> collSelGG;
101 std::vector<const pat::CompositeCandidate*> collSelGT;
102 std::vector<const pat::CompositeCandidate*> collSelTT;
104 for (std::vector<pat::CompositeCandidate>::const_iterator it = collAll->begin(); it != collAll->end(); ++it) {
115 collSelGG.push_back(
cand);
122 collSelGT.push_back(
cand);
128 collSelGT.push_back(
cand);
135 collSelTT.push_back(
cand);
142 std::vector<reco::Track>
tracks;
143 if (!collSelGG.empty()) {
145 const pat::Muon* muon1 =
dynamic_cast<const pat::Muon*
>(collSelGG[0]->daughter(
"muon1"));
146 const pat::Muon* muon2 =
dynamic_cast<const pat::Muon*
>(collSelGG[0]->daughter(
"muon2"));
150 collMuSel.push_back(muon1);
151 collMuSel.push_back(muon2);
153 }
else if (collSelGG.empty() && !collSelGT.empty()) {
155 const pat::Muon* muon1 =
dynamic_cast<const pat::Muon*
>(collSelGT[0]->daughter(
"muon1"));
156 const pat::Muon* muon2 =
dynamic_cast<const pat::Muon*
>(collSelGT[0]->daughter(
"muon2"));
160 collMuSel.push_back(muon1);
161 collMuSel.push_back(muon2);
163 }
else if (collSelGG.empty() && collSelGT.empty() && !collSelTT.empty()) {
165 const pat::Muon* muon1 =
dynamic_cast<const pat::Muon*
>(collSelTT[0]->daughter(
"muon1"));
166 const pat::Muon* muon2 =
dynamic_cast<const pat::Muon*
>(collSelTT[0]->daughter(
"muon2"));
170 collMuSel.push_back(muon1);
171 collMuSel.push_back(muon2);
175 std::cout <<
"ERROR strange number of muons selected by onia cuts!" << std::endl;
179 }
else if ((muonType_ < 4 && muonType_ >= 0) ||
muonType_ >= 10) {
180 std::vector<reco::Track>
tracks;
210 std::vector<reco::Track>
tracks;
238 const std::vector<const pat::Muon*>& collMuSel,
239 std::vector<GenMuonPair>& genPair,
244 for (std::vector<pat::CompositeCandidate>::const_iterator it = collAll->begin(); it != collAll->end(); ++it) {
248 genPatParticles.push_back(*genJpsi.
get());
252 if (collMuSel.size() == 2) {
255 bool isMuMatched = (genMu1.
isAvailable() && genMu2.
isAvailable() && genMu1->pdgId() * genMu2->pdgId() == -169);
257 genPatParticles.push_back(*genMu1.
get());
258 genPatParticles.push_back(*genMu2.
get());
261 if (genMu1->mother() !=
nullptr) {
262 motherId = genMu1->mother()->pdgId();
264 if (genMu1->pdgId() == 13)
270 plotter->fillGen(genPatParticles,
true);
273 std::cout <<
"Found genParticles in PAT" << std::endl;
275 std::cout <<
"No recomuon selected so no access to generated info" << std::endl;
281 std::cout <<
"No recomuon selected so no access to generated info" << std::endl;
287 std::cout <<
"genParticles:" << std::endl;
289 std::cout << genPair.back().mu1 <<
" , " << genPair.back().mu2 << std::endl;
294 std::vector<GenMuonPair>& genPair,
295 std::vector<std::pair<lorentzVector, lorentzVector> >& simPair,
303 bool ifHepMC =
false;
317 std::cout <<
"Found genParticles" << std::endl;
320 <<
"non generation info and speedup true!!!!!!!!!!!!" << std::endl;
326 std::cout <<
"genParticles:" << std::endl;
327 std::cout << genPair.back().mu1 <<
" , " << genPair.back().mu2 << std::endl;
335 std::vector<std::pair<lorentzVector, lorentzVector> >& simPair,
338 bool simTracksFound =
false;
344 simTracksFound =
true;
348 std::cout <<
"SimTracks not existent" << std::endl;
350 if (!simTracksFound) {
359 for (HepMC::GenEvent::particle_const_iterator
part = Evt->particles_begin();
part != Evt->particles_end();
part++) {
360 if (
std::abs((*part)->pdg_id()) == 13 && (*part)->status() == 1) {
361 bool fromRes =
false;
362 unsigned int motherPdgId = 0;
363 for (HepMC::GenVertex::particle_iterator mother = (*part)->production_vertex()->particles_begin(HepMC::ancestors);
364 mother != (*part)->production_vertex()->particles_end(HepMC::ancestors);
366 motherPdgId = (*mother)->pdg_id();
371 if (motherPdgId == 13 && (*mother)->status() == 3)
374 for (
int ires = 0; ires < 6; ++ires) {
381 if ((*part)->pdg_id() == 13) {
384 (*part)->momentum().px(), (*part)->momentum().py(), (*part)->momentum().pz(), (*part)->momentum().e()));
387 (*part)->momentum().px(), (*part)->momentum().py(), (*part)->momentum().pz(), (*part)->momentum().e()));
409 bool fromRes =
false;
410 unsigned int motherPdgId =
part->mother()->pdgId();
412 std::cout <<
"Found a muon with mother: " << motherPdgId << std::endl;
414 for (
int ires = 0; ires < 6; ++ires) {
427 std::cout <<
"fromRes = true, motherPdgId = " << motherPdgId << std::endl;
430 if (
part->pdgId() == 13) {
431 if (status1Muon->
p4().pt() != 0)
436 std::cout <<
"Found a genMuon - : " << muFromRes.
mu1 << std::endl;
440 if (status1Muon->
p4().pt() != 0)
445 std::cout <<
"Found a genMuon + : " << muFromRes.
mu2 << std::endl;
459 std::pair<lorentzVector, lorentzVector> simMuFromRes;
462 if (
std::abs((*simTrack).type()) == 13) {
464 if ((*simTrack).genpartIndex() > 0) {
467 for (HepMC::GenVertex::particle_iterator mother =
gp->production_vertex()->particles_begin(HepMC::ancestors);
468 mother !=
gp->production_vertex()->particles_end(HepMC::ancestors);
470 bool fromRes =
false;
471 unsigned int motherPdgId = (*mother)->pdg_id();
472 for (
int ires = 0; ires < 6; ++ires) {
477 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) ...
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.
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.
void selectSimulatedMuons(const edm::Event &event, const bool ifHepMC, edm::Handle< edm::HepMCProduct > evtMC, std::vector< std::pair< lorentzVector, lorentzVector > > &simPair, MuScleFitPlotter *plotter)
bool isTrackerMuon() const override
reco::Particle::LorentzVector lorentzVector
static const unsigned int motherPdgIdArray[6]
const edm::InputTag muonLabel_
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
virtual int pdgId() const =0
PDG identifier.
auto const & tracks
cannot be loose
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) ...
const edm::InputTag simTracksCollectionName_
T const * get() const
Returns C++ pointer to the item.
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.
Log< level::Warning, false > LogWarning
const reco::Candidate * getStatus3Muon(const reco::Candidate *status3Muon)
const std::vector< int > resfind_
Analysis-level muon class.
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