const ElectronCollection TopPairEMuReferenceSelection::signalElectrons(const EventPtr event) const { const MuonCollection muons(goodMuons(event)); const ElectronCollection electrons(goodElectrons(event)); ElectronCollection signalElectrons; double ptMax = 0; int storeIndexA = -1; // cout << "loop for max pt, muons: " << muons.size() << "electrons: " << electrons.size() << endl; if(electrons.size() >= 1 && muons.size() >= 1){ for (unsigned int indexA = 0; indexA < electrons.size(); ++indexA) { const ElectronPointer electron(electrons.at(indexA)); for (unsigned int indexB = 0; indexB < muons.size(); ++indexB) { const MuonPointer muon(muons.at(indexB)); if((electron->charge()*muon->charge() < 0) && ((electron->pt()+muon->pt())>ptMax)){ ptMax = electron->pt()+muon->pt(); storeIndexA = indexA; } } } if(storeIndexA != -1) signalElectrons.push_back(electrons.at(storeIndexA)); } return signalElectrons; }
bool TopPairEMuReferenceSelection::isGoodMuon(const MuonPointer muon) const { bool passesEtAndEta = muon->pt() > 20 && fabs(muon->eta()) < 2.4; bool passesID = (muon->isGlobal() || muon->isTracker()) && muon->isPFMuon(); bool passesIsolation = isIsolatedMuon(muon); return passesEtAndEta && passesID && passesIsolation; }
extern void printMuon(const MuonPointer muon) { printParticle(muon); cout << "Muon Information" << endl; cout << setw(30) << "is global" << setw(30) << "PF RelIso DR=0.4" << setw(30) << "----" << endl; cout << setw(30) << muon->isGlobal() << setw(30) << muon->PFRelIso04() << setw(30) << "" << endl; }
bool TopPairMuPlusJetsReferenceSelection2011::isLooseMuon(const MuonPointer muon) const { bool passesPt = muon->pt() > 10; bool passesEta = fabs(muon->eta()) < 2.5; bool isGlobalOrTracker = muon->isGlobal() || muon->isTracker(); bool isLooselyIsolated = muon->pfRelativeIsolation(0.4) < 0.2; return passesPt && passesEta && isGlobalOrTracker && isLooselyIsolated; }
void Event::selectMuonsByQuality() { goodMuons.clear(); goodIsolatedMuons.clear(); for (unsigned int index = 0; index < allMuons.size(); ++index) { MuonPointer muon = allMuons.at(index); if (muon->isGood()) goodMuons.push_back(muon); if (muon->isGood() && muon->isIsolated()) goodIsolatedMuons.push_back(muon); if (muon->isLoose()) looseMuons.push_back(muon); } }
bool TopPairEMuReferenceSelection::passesZmassVeto(const EventPtr event) const { const ElectronCollection electrons(signalElectrons(event)); const MuonCollection muons(signalMuons(event)); ElectronCollection electronColl; MuonCollection muonColl; double ptMax = 0; int storeIndexA = -1; int storeIndexB = -1; if(electrons.size() >= 1 && muons.size() >= 1){ for (unsigned int indexA = 0; indexA < electrons.size(); ++indexA) { const ElectronPointer electron(electrons.at(indexA)); for (unsigned int indexB = 0; indexB < muons.size(); ++indexB) { const MuonPointer muon(muons.at(indexB)); if((electron->charge() == -muon->charge()) && ((electron->pt()+muon->pt())>ptMax)){ ptMax = electron->pt()+muon->pt(); storeIndexA = indexA; storeIndexB = indexB; } } if(storeIndexA != storeIndexB){ electronColl.push_back(electrons.at(storeIndexA)); muonColl.push_back(muons.at(storeIndexB)); } } } ElectronPointer electron = electronColl.front(); MuonPointer muon = muonColl.front(); double mass = 0; ParticlePointer dilepton; dilepton = ParticlePointer(new Particle(*electron + *muon)); mass = dilepton->mass(); return mass < 76 || mass > 106; }
void MuonAnalyser::analyseMuon(const MuonPointer muon, double weight) { histMan_->setCurrentHistogramFolder(histogramFolder_); weight_ = weight * prescale_ * scale_; histMan_->H1D("muon_eta")->Fill(muon->eta(), weight_); histMan_->H1D("muon_AbsEta")->Fill(fabs(muon->eta()), weight_); histMan_->H1D("muon_pfIsolation_03_DeltaBeta")->Fill(muon->PFRelIso03DeltaBeta(), weight_); histMan_->H1D("muon_pfIsolation_04_DeltaBeta")->Fill(muon->PFRelIso04DeltaBeta(), weight_); if (!ttbarPlusMETAnalysisSetup_) { histMan_->H1D("muon_pT")->Fill(muon->pt(), weight_); histMan_->H1D("muon_phi")->Fill(muon->phi(), weight_); histMan_->H1D("muon_dB")->Fill(muon->d0(), weight_); } treeMan_->setCurrentFolder(histogramFolder_); treeMan_->Fill("EventWeight", weight_ ); treeMan_->Fill("pt", muon->pt() ); treeMan_->Fill("eta", muon->eta() ); treeMan_->Fill("relIso_04_deltaBeta", muon->PFRelIso04DeltaBeta() ); }
bool TopPairEMuReferenceSelection::isLooseMuon(const MuonPointer muon) const { bool passesPt = muon->pt() > 10; bool passesEta = fabs(muon->eta()) < 2.5; bool isPFMuon = muon->isPFMuon(); bool isGlobalOrTracker = muon->isGlobal() || muon->isTracker(); bool isLooselyIsolated = muon->pfRelativeIsolation(0.4, true) < 0.2; return isPFMuon && passesPt && passesEta && isGlobalOrTracker && isLooselyIsolated; }
void MuonAnalyser::analyse(const EventPtr event) { if (singleMuonOnly_) return; histMan_->setCurrentHistogramFolder(histogramFolder_); weight_ = event->weight() * prescale_ * scale_; const MuonCollection muons = event->Muons(); histMan_->H1D("Number_Of_Muons")->Fill(muons.size(), weight_); for (unsigned int index = 0; index < muons.size(); ++index) { const MuonPointer muon(muons.at(index)); histMan_->H1D("All_Muon_Pt")->Fill(muon->pt(), weight_); histMan_->H1D("All_Muon_Eta")->Fill(muon->eta(), weight_); histMan_->H1D("All_Muon_AbsEta")->Fill(fabs(muon->eta()), weight_); histMan_->H1D("All_Muon_Phi")->Fill(muon->phi(), weight_); histMan_->H1D("All_Muon_pfIsolation_03")->Fill(muon->PFRelIso03(), weight_); histMan_->H1D("All_Muon_pfIsolation_04")->Fill(muon->PFRelIso04(), weight_); histMan_->H1D("All_Muon_dB")->Fill(muon->d0(), weight_); } }
bool TopPairEMuReferenceSelection::isGoodPhoton(const PhotonPointer photon, const EventPtr event) const { bool passesEtAndEta = photon->et() > 25 && fabs(photon->eta()) < 1.4442 && !photon->isInCrack(); bool passesSafeElectronVeto = photon->ConversionSafeElectronVeto(); bool passesHOverE = photon->SingleTowerHoE() < 0.05; // same for EE and EB // bool passesShowerShape = false; // bool passesPFChargedIso = false; bool passesPFNeutralIso = false; bool passesPFPhotonIso = false; bool passesphoSCChIso = false; // bool passesphoSCNuIso = false; // bool passesphoSCPhIso = false; if (photon->isInBarrelRegion()) { // passesShowerShape = photon->sigmaIEtaIEta() < 0.012; // passesPFChargedIso = photon->RhoCorrectedPFChargedHadronIso(event->rho()) < 2.6; passesPFNeutralIso = photon->RhoCorrectedPFNeutralHadronIso(event->rho()) < 7.5 + 0.04 * photon->pt(); //3.5 passesPFPhotonIso = photon->RhoCorrectedPFPhotonIso(event->rho()) < 5 + 0.005 * photon->pt(); //1.3 passesphoSCChIso = photon->RhoCorrectedSCChIso(event->rho()) < 5; // passesphoSCNuIso = photon->RhoCorrectedSCNuIso(event->rho()) < 3.5 + 0.04 * photon->pt(); // passesphoSCPhIso = photon->RhoCorrectedSCPhIso(event->rho()) < 1.3 + 0.005 * photon->pt(); } else if (photon->isInEndCapRegion()) { // passesShowerShape = photon->sigmaIEtaIEta() < 0.034; // passesPFChargedIso = photon->RhoCorrectedPFChargedHadronIso(event->rho()) < 2.3; passesPFNeutralIso = photon->RhoCorrectedPFNeutralHadronIso(event->rho()) < 2.9 + 0.04 * photon->pt(); passesPFPhotonIso = photon->RhoCorrectedPFPhotonIso(event->rho()) < 1.5 + 0.005 * photon->pt(); passesphoSCChIso = photon->RhoCorrectedSCChIso(event->rho()) < 2.3; // passesphoSCNuIso = photon->RhoCorrectedSCNuIso(event->rho()) < 2.9 + 0.04 * photon->pt(); // passesphoSCPhIso = photon->RhoCorrectedSCPhIso(event->rho()) < 1.5 + 0.005 * photon->pt(); } const ElectronCollection electrons(goodElectrons(event)); const MuonCollection muons(goodMuons(event)); const JetCollection jets(event->Jets());; bool passesDeltaRgammaMuons = false; for (unsigned int index = 0; index < muons.size(); ++index) { const MuonPointer muon(muons.at(index)); passesDeltaRgammaMuons = photon->deltaR(muon) > 0.3; if(photon->deltaR(muon) < 0.3) break; } bool passesDeltaRgammaElectrons = false; for (unsigned int index = 0; index < electrons.size(); ++index) { const ElectronPointer electron(electrons.at(index)); passesDeltaRgammaElectrons = photon->deltaR(electron) > 0.3; if(photon->deltaR(electron) < 0.3) break; } bool passesDeltaRgammaJets = false; for (unsigned int index = 0; index < jets.size(); ++index) { const JetPointer jet(jets.at(index)); passesDeltaRgammaJets = photon->deltaR(jet) > 0.3; } bool passesDeltaRjetsElectrons = false; for (unsigned int index = 0; index < electrons.size(); ++index) { const ElectronPointer electron(electrons.at(index)); for(unsigned int jindex = 0; jindex<jets.size(); ++jindex){ const JetPointer jet(jets[jindex]); passesDeltaRjetsElectrons = electron->deltaR(jet) > 0.3; } } bool passesDeltaRjetsMuons = false; for (unsigned int index = 0; index < muons.size(); ++index) { const MuonPointer muon(muons.at(index)); for(unsigned int jindex = 0; jindex<jets.size(); ++jindex){ const JetPointer jet(jets[jindex]); passesDeltaRjetsMuons = muon->deltaR(jet) > 0.3; } } return passesEtAndEta && passesSafeElectronVeto && passesHOverE /*&& passesShowerShape*/ && passesPFNeutralIso && passesPFPhotonIso && passesphoSCChIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRgammaJets && passesDeltaRjetsMuons && passesDeltaRjetsElectrons; }
bool TopPairEMuReferenceSelection::isNminusOnePhoton(const PhotonPointer photon, const EventPtr event, TString cut) const { const ElectronCollection electrons(goodElectrons(event)); const MuonCollection muons(goodMuons(event)); const JetCollection jets(event->Jets()); bool passesEtAndEta = photon->et() > 25 && fabs(photon->eta()) < 2.5 && !photon->isInCrack(); bool passesSafeElectronVeto = photon->ConversionSafeElectronVeto(); bool passesHOverE = photon->SingleTowerHoE() < 0.05; // same for EE and EB bool passesShowerShape = false; // bool passesPFChargedIso = false; bool passesPFNeutralIso = false; bool passesPFPhotonIso = false; bool passesphoSCChIso = false; bool backgroundShape = false; if (photon->isInBarrelRegion()) { passesShowerShape = photon->sigmaIEtaIEta() < 0.012; // passesPFChargedIso = photon->RhoCorrectedPFChargedHadronIso(event->rho()) < 2.6; passesPFNeutralIso = photon->RhoCorrectedPFNeutralHadronIso(event->rho()) < 3.5 + 0.04 * photon->pt(); passesPFPhotonIso = photon->RhoCorrectedPFPhotonIso(event->rho()) < 1.3 + 0.005 * photon->pt(); passesphoSCChIso = photon->RhoCorrectedSCChIso(event->rho()) < 20; backgroundShape = photon->sigmaIEtaIEta() > 0.012 && photon->sigmaIEtaIEta() < 0.029; } else if (photon->isInEndCapRegion()) { passesShowerShape = photon->sigmaIEtaIEta() < 0.034; // passesPFChargedIso = photon->RhoCorrectedPFChargedHadronIso(event->rho()) < 2.3; passesPFNeutralIso = photon->RhoCorrectedPFNeutralHadronIso(event->rho()) < 2.9 + 0.04 * photon->pt(); passesPFPhotonIso = photon->RhoCorrectedPFPhotonIso(event->rho()) < 1.5 + 0.005 * photon->pt(); passesphoSCChIso = photon->RhoCorrectedSCChIso(event->rho()) < 20; backgroundShape = photon->sigmaIEtaIEta() > 0.012 && photon->sigmaIEtaIEta() < 0.029; } bool passesDeltaRgammaMuons = false; for (unsigned int index = 0; index < muons.size(); ++index) { const MuonPointer muon(muons.at(index)); passesDeltaRgammaMuons = photon->deltaR(muon) > 0.5; if(photon->deltaR(muon) < 0.5) break; } bool passesDeltaRgammaElectrons = false; for (unsigned int index = 0; index < electrons.size(); ++index) { const ElectronPointer electron(electrons.at(index)); passesDeltaRgammaElectrons = photon->deltaR(electron) > 0.7; if(photon->deltaR(electron) < 0.7) break; } bool passesDeltaRgammaJets = false; for (unsigned int index = 0; index < jets.size(); ++index) { const JetPointer jet(jets.at(index)); passesDeltaRgammaJets = photon->deltaR(jet) > 0.7; } bool passesDeltaRjetsElectrons = false; for (unsigned int index = 0; index < electrons.size(); ++index) { const ElectronPointer electron(electrons.at(index)); for(unsigned int jindex = 0; jindex<jets.size(); ++jindex){ const JetPointer jet(jets[jindex]); passesDeltaRjetsElectrons = electron->deltaR(jet) > 0.5; } } bool passesDeltaRjetsMuons = false; for (unsigned int index = 0; index < muons.size(); ++index) { const MuonPointer muon(muons.at(index)); for(unsigned int jindex = 0; jindex<jets.size(); ++jindex){ const JetPointer jet(jets[jindex]); passesDeltaRjetsMuons = muon->deltaR(jet) > 0.5; } } if(cut == "passesEtAndEta") return passesSafeElectronVeto && passesHOverE && passesShowerShape && passesPFNeutralIso && passesPFPhotonIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRgammaJets && passesDeltaRjetsMuons && passesDeltaRjetsElectrons && passesphoSCChIso; else if(cut == "passesHOverE") return passesEtAndEta && passesSafeElectronVeto && passesShowerShape && passesPFNeutralIso && passesPFPhotonIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRgammaJets && passesDeltaRjetsMuons && passesDeltaRjetsElectrons && passesphoSCChIso; else if(cut == "passesShowerShape") return passesEtAndEta && passesSafeElectronVeto && passesHOverE && passesPFNeutralIso && passesPFPhotonIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRgammaJets && passesDeltaRjetsMuons && passesDeltaRjetsElectrons && passesphoSCChIso; else if(cut == "passesPFNeutralIso") return passesEtAndEta && passesSafeElectronVeto && passesHOverE && passesShowerShape && passesPFPhotonIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRgammaJets && passesDeltaRjetsMuons && passesDeltaRjetsElectrons && passesphoSCChIso; else if(cut == "passesPFPhotonIso") return passesEtAndEta && passesSafeElectronVeto && passesHOverE && passesShowerShape && passesPFNeutralIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRgammaJets && passesDeltaRjetsMuons && passesDeltaRjetsElectrons && passesphoSCChIso; else if(cut == "passesphoSCChIso") return passesEtAndEta && passesSafeElectronVeto && passesHOverE && backgroundShape && passesPFNeutralIso && passesPFPhotonIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRgammaJets && passesDeltaRjetsMuons && passesDeltaRjetsElectrons; else if(cut == "passesDeltaRgammaMuons" && cut == "passesDeltaRgammaElectrons") return passesEtAndEta && passesSafeElectronVeto && passesHOverE && passesShowerShape && passesPFNeutralIso && passesPFPhotonIso && passesDeltaRgammaJets && passesDeltaRjetsMuons && passesDeltaRjetsElectrons && passesphoSCChIso; else if(cut == "passesDeltaRjetsElectrons" && cut == "passesDeltaRjetsMuons") return passesEtAndEta && passesSafeElectronVeto && passesHOverE && passesShowerShape && passesPFNeutralIso && passesPFPhotonIso && passesDeltaRgammaJets && passesDeltaRgammaMuons && passesDeltaRgammaElectrons && passesphoSCChIso; else if(cut == "passesDeltaRgammaJets") return passesEtAndEta && passesSafeElectronVeto && passesHOverE && passesShowerShape && passesPFNeutralIso && passesPFPhotonIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRjetsMuons && passesDeltaRjetsElectrons && passesphoSCChIso; else if(cut == "backgroundShape") return passesEtAndEta && passesSafeElectronVeto && passesHOverE && passesPFNeutralIso && passesPFPhotonIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRjetsMuons && passesDeltaRjetsElectrons && passesphoSCChIso && passesDeltaRgammaJets && backgroundShape; else return passesEtAndEta && passesSafeElectronVeto && passesHOverE && passesShowerShape && passesPFNeutralIso && passesPFPhotonIso && passesDeltaRgammaElectrons && passesDeltaRgammaMuons && passesDeltaRgammaJets && passesDeltaRjetsMuons && passesDeltaRjetsElectrons && passesphoSCChIso; }
bool TopPairMuPlusJetsReferenceSelection2011::isGoodMuon(const MuonPointer muon) const { bool passesEtAndEta = muon->pt() > 26 && fabs(muon->eta()) < 2.1; bool passesD0 = fabs(muon->d0()) < 0.02; //cm bool passesDistanceToPV = fabs(muon->ZDistanceToPrimaryVertex()) < 1; bool passesID(muon->isTracker() && muon->isGlobal()); bool passesMuonQuality_1(muon->normChi2() < 10 && muon->trackerLayersWithMeasurement() > 8); bool passesMuonQuality_2(muon->numberOfValidMuonHits() > 0 && muon->pixelLayersWithMeasurement() > 0); bool passesMuonQuality_3(muon->numberOfMatchedStations() > 1); bool passesMuonQuality = passesMuonQuality_1 && passesMuonQuality_2 && passesMuonQuality_3; return passesEtAndEta && passesD0 && passesDistanceToPV && passesID && passesMuonQuality; }