Example #1
0
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;

}
void DiElectronAnalyser::analyse(const EventPtr event, const ElectronCollection electrons) {
	histMan_->setCurrentHistogramFolder(histogramFolder_);

	weight_ = event->weight() * prescale_ * scale_;
	if (electrons.size() == 2) {
		ElectronPointer leadingElectron = electrons.front();
		ElectronPointer secondElectron = electrons.at(1);
		//both
		histMan_->H1D_BJetBinned("diLepton_Mass")->Fill(leadingElectron->invariantMass(secondElectron), weight_);
		histMan_->H1D_BJetBinned("diLepton_DeltaR")->Fill(leadingElectron->deltaR(secondElectron), weight_);
		//lead
		histMan_->H1D_BJetBinned("LeadLepton_Pt")->Fill(leadingElectron->pt(), weight_);
		histMan_->H1D_BJetBinned("LeadLepton_Eta")->Fill(leadingElectron->eta(), weight_);
		histMan_->H1D_BJetBinned("LeadLepton_AbsEta")->Fill(abs(leadingElectron->eta()), weight_);
		histMan_->H1D_BJetBinned("LeadLepton_Phi")->Fill(leadingElectron->phi(), weight_);
		histMan_->H1D_BJetBinned("LeadLepton_RelIso")->Fill(leadingElectron->pfRelativeIsolationRhoCorrected(), weight_);
		histMan_->H1D_BJetBinned("LeadLepton_HadOverEM")->Fill(leadingElectron->HadOverEm(), weight_);
		histMan_->H1D_BJetBinned("LeadLepton_dB")->Fill(leadingElectron->d0_wrtBeamSpot(), weight_);
		//second
		histMan_->H1D_BJetBinned("SecondLepton_Pt")->Fill(secondElectron->pt(), weight_);
		histMan_->H1D_BJetBinned("SecondLepton_Eta")->Fill(secondElectron->eta(), weight_);
		histMan_->H1D_BJetBinned("SecondLepton_AbsEta")->Fill(abs(secondElectron->eta()), weight_);
		histMan_->H1D_BJetBinned("SecondLepton_Phi")->Fill(secondElectron->phi(), weight_);
		histMan_->H1D_BJetBinned("SecondLepton_RelIso")->Fill(secondElectron->pfRelativeIsolationRhoCorrected(), weight_);
		histMan_->H1D_BJetBinned("SecondLepton_HadOverEM")->Fill(secondElectron->HadOverEm(), weight_);
		histMan_->H1D_BJetBinned("SecondLepton_dB")->Fill(secondElectron->d0_wrtBeamSpot(), weight_);

	}
}
void ElectronAnalyser::analyse(const EventPtr event) {
	histMan_->setCurrentHistogramFolder(histogramFolder_);
	weight_ = event->weight() * prescale_ * scale_;
	const ElectronCollection electrons = event->Electrons();

	if (singleElectronOnly_)
		return;
	histMan_->H1D("Number_Of_Electrons")->Fill(electrons.size(), weight_);
	for (unsigned int index = 0; index < electrons.size(); ++index) {
		const ElectronPointer electron(electrons.at(index));

		histMan_->H1D("All_Electron_Pt")->Fill(electron->pt(), weight_);
		histMan_->H1D("All_Electron_Eta")->Fill(electron->eta(), weight_);
		histMan_->H1D("All_Electron_AbsEta")->Fill(fabs(electron->eta()), weight_);
		histMan_->H1D("All_Electron_Phi")->Fill(electron->phi(), weight_);
		histMan_->H1D("All_Electron_pfIsolation_03_deltaBeta")->Fill(electron->PFRelIso03DeltaBeta(), weight_);

		histMan_->H1D("All_Electron_sigma_ietaieta")->Fill(electron->sigmaIEtaIEta(), weight_);
		histMan_->H1D("All_Electron_dPhi_in")->Fill(electron->dPhiIn(), weight_);
		histMan_->H1D("All_Electron_dEta_in")->Fill(electron->dEtaIn(), weight_);
		histMan_->H1D("All_Electron_HadOverEM")->Fill(electron->HadOverEm(), weight_);
		histMan_->H1D("All_Electron_mvaTrigV0")->Fill(electron->mvaTrigV0(), weight_);
		histMan_->H1D("All_Electron_mvaNonTrigV0")->Fill(electron->mvaNonTrigV0(), weight_);
		histMan_->H1D("All_Electron_dB")->Fill(electron->d0(), weight_);
	}
}
Example #4
0
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 ElectronAnalyser::analyseElectron(const ElectronPointer electron, double weight) {
	histMan_->setCurrentHistogramFolder(histogramFolder_);
	weight_ = weight * prescale_ * scale_;

	if (!singleElectronOnly_)
		return;

	histMan_->H1D("electron_eta")->Fill(electron->eta(), weight_);
	histMan_->H1D("electron_AbsEta")->Fill(fabs(electron->eta()), weight_);
	histMan_->H1D("electron_pfIsolation_03_deltaBeta")->Fill(electron->PFRelIso03DeltaBeta(), weight_);

	if (!ttbarPlusMETAnalysisSetup_) {
		histMan_->H1D("electron_pT")->Fill(electron->pt(), weight_);
		histMan_->H1D("electron_phi")->Fill(electron->phi(), weight_);

		histMan_->H1D("electron_sigma_ietaieta")->Fill(electron->sigmaIEtaIEta(), weight_);
		histMan_->H1D("electron_dPhi_in")->Fill(electron->dPhiIn(), weight_);
		histMan_->H1D("electron_dEta_in")->Fill(electron->dEtaIn(), weight_);
		histMan_->H1D("electron_HadOverEM")->Fill(electron->HadOverEm(), weight_);
		histMan_->H1D("electron_mvaTrigV0")->Fill(electron->mvaTrigV0(), weight_);
		histMan_->H1D("electron_mvaNonTrigV0")->Fill(electron->mvaNonTrigV0(), weight_);
		histMan_->H1D("electron_dB")->Fill(electron->d0(), weight_);
	}

	treeMan_->setCurrentFolder(histogramFolder_);
	treeMan_->Fill("EventWeight", weight_ );

	treeMan_->Fill("pt", electron->pt() );
	treeMan_->Fill("eta", electron->eta() );	
	treeMan_->Fill("etaSC", electron->superClusterEta() );
	treeMan_->Fill("relIso_03_deltaBeta", electron->PFRelIso03DeltaBeta() );

	double efficiencyCorrection = electron->getEfficiencyCorrection( 0 );	
	treeMan_->Fill("ElectronEfficiencyCorrection", efficiencyCorrection);

}
bool HLTriggerQCDAnalyser::passesTriggerAnalysisSelection(const EventPtr event) const {
	const ElectronCollection electrons(event->Electrons());
	const JetCollection jets(event->Jets());
	if (electrons.size() == 0 || jets.size() < 3)
		return false;

	unsigned int nElectrons(0);
	for (unsigned int index = 0; index < electrons.size(); ++index) {
		const ElectronPointer electron(electrons.at(index));
		if (fabs(electron->eta()) < 2.5 && electron->pt() > 20)
			++nElectrons;
		//if more than 2 electrons passing the selection of > 20GeV, reject event
	}
	const ElectronPointer mostEnergeticElectron(electrons.front());
	//clean jets against electron
	JetCollection cleanedJets;

	for (unsigned int index = 0; index < jets.size(); ++index) {
		const JetPointer jet(jets.at(index));
		if (!jet->isWithinDeltaR(0.3, mostEnergeticElectron))
			cleanedJets.push_back(jet);
	}

	unsigned int nCleanedJetsAbove30GeV(0), nCleanedJetsAbove45GeV(0);
	for (unsigned int index = 0; index < cleanedJets.size(); ++index) {
		const JetPointer jet(cleanedJets.at(index));
		if (jet->pt() > 45.)
			++nCleanedJetsAbove45GeV;
		if (jet->pt() > 30.)
			++nCleanedJetsAbove30GeV;
	}

	return nElectrons == 1
			&& (nCleanedJetsAbove45GeV >= 3
					|| (nCleanedJetsAbove45GeV >= 2 && nCleanedJetsAbove30GeV >= 3 && event->runnumber() >= 194270));
}