12 bool isPromptFinalState = static_cast<const reco::GenParticle*>(tempMuon)
13 ->isPromptFinalState();
15 if (isPromptFinalState)
21 isPromptFinalState = static_cast<const reco::GenParticle*>(tempMuon)
22 ->isPromptFinalState();
34 bool lastCopy = static_cast<const reco::GenParticle*>(tempMuon)
35 ->isLastCopyBeforeFSR();
43 lastCopy = static_cast<const reco::GenParticle*>(tempMuon)
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) {
107 const pat::Muon* muon1 = dynamic_cast<const pat::Muon*>(
cand->daughter(
"muon1"));
108 const pat::Muon* muon2 = dynamic_cast<const pat::Muon*>(
cand->daughter(
"muon2"));
110 if ((muon1->
charge() * muon2->charge()) > 0)
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)
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;
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();
477 if (
gp->pdg_id() == 13)