void JetAnalyser::analyse(const EventPtr event) {

    histMan_->setCurrentHistogramFolder(histogramFolder_);
    weight_ = event->weight() * prescale_ * scale_;
    const JetCollection jets = event->Jets();
    unsigned int numberOfBJets(0);

    for (unsigned int index = 0; index < jets.size(); ++index) {

        const JetPointer jet(jets.at(index));
        histMan_->H1D_BJetBinned("all_jet_pT")->Fill(jet->pt(), weight_);
        histMan_->H1D_BJetBinned("all_jet_phi")->Fill(jet->phi(), weight_);
        histMan_->H1D_BJetBinned("all_jet_eta")->Fill(jet->eta(), weight_);
        if (jet->isBJet(BtagAlgorithm::CombinedSecondaryVertex, BtagAlgorithm::MEDIUM))
            ++numberOfBJets;

        if (index < 7) {
            stringstream temp;
            temp << "jet" << (index + 1);
            string nthJet = temp.str();
            histMan_->H1D_BJetBinned(nthJet + "_pT")->Fill(jet->pt(), weight_);
            histMan_->H1D_BJetBinned(nthJet + "_phi")->Fill(jet->phi(), weight_);
            histMan_->H1D_BJetBinned(nthJet + "_eta")->Fill(jet->eta(), weight_);
        }

    }

    histMan_->H1D_BJetBinned("N_Jets")->Fill(jets.size(), weight_);
    histMan_->H1D("N_BJets")->Fill(numberOfBJets, weight_);
}
Esempio n. 2
0
void JetAnalyser::analyse(const EventPtr event) {

	histMan_->setCurrentHistogramFolder(histogramFolder_);
	treeMan_->setCurrentFolder(histogramFolder_);
	
	weight_ = event->weight() * prescale_ * scale_;
	// const JetCollection jets = event->Jets();
	const JetCollection jets(event->CleanedJets());
	const JetCollection bjets(event->CleanedBJets());

	unsigned int numberOfBJets = event->NJets(bjets);
	unsigned int numberOfJets = event->NJets(jets);

	treeMan_->Fill("NJets", numberOfJets);
	treeMan_->Fill("NBJets", numberOfBJets);

	for (unsigned int index = 0; index < jets.size(); ++index) {
		const JetPointer jet(jets.at(index));

		if (jet->pt() < 25 ) continue;

		if (index < 5) {
			stringstream temp;
			temp << "jet" << (index + 1);
			string nthJet = temp.str();

			treeMan_->Fill( nthJet + "_pt", jet->pt());
			treeMan_->Fill( nthJet + "_eta", jet->eta());
			treeMan_->Fill( nthJet + "_phi", jet->phi());
		}

		treeMan_->Fill("pt", jet->pt());
		treeMan_->Fill("eta", jet->eta());
		treeMan_->Fill("phi", jet->phi());
	}

	for (unsigned int index = 0; index < bjets.size(); ++index) {
		const JetPointer bJet(bjets.at(index));

		if ( bJet->pt() < 25 ) continue;

		treeMan_->Fill("bjet_pt", bJet->pt());
		treeMan_->Fill("bjet_eta", bJet->eta());
		treeMan_->Fill("bjet_phi", bJet->phi());
	}

	// if ( numberOfJets < 4 ) {
	// 	cout << "Fewer than 4 good cleaned jets with pt > 25 GeV : " << numberOfJets << endl;
	// 	cout << numberOfJets << " " << numberOfBJets << endl;
	// }


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

	if ( event->PassesMuonTriggerAndSelection() ) {
		const LeptonPointer signalLepton = event->getSignalLepton( SelectionCriteria::MuonPlusJetsReference );
		const MuonPointer signalMuon(boost::static_pointer_cast<Muon>(signalLepton));
		double efficiencyCorrection = event->isRealData() ? 1. : signalMuon->getEfficiencyCorrection( 0 );
		treeMan_->Fill("MuonEfficiencyCorrection", efficiencyCorrection);
	}
	else if ( event->PassesElectronTriggerAndSelection() ) {
		const LeptonPointer signalLepton = event->getSignalLepton( SelectionCriteria::ElectronPlusJetsReference );
		const ElectronPointer signalElectron(boost::static_pointer_cast<Electron>(signalLepton));
		double efficiencyCorrection = event->isRealData() ? 1. : signalElectron->getEfficiencyCorrection( 0 );	
		treeMan_->Fill("ElectronEfficiencyCorrection", efficiencyCorrection);
	}
}