void TTbar_plus_X_analyser::muPlusJetsSignalAnalysis(const EventPtr event) { if ( event->PassesMuonTriggerAndSelectionNoB() ){ BTagEffAnalyserMuPlusJetsRefSelection_->analyse(event); fillCommonTreesNoBSelection( event, SelectionCriteria::MuonPlusJetsReference, histogramFolder_ + "/MuPlusJets/Ref selection NoBSelection" ); } if ( event->PassesMuonTriggerAndSelection() ) { fillCommonTrees( event, SelectionCriteria::MuonPlusJetsReference, histogramFolder_ + "/MuPlusJets/Ref selection" ); } }
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); } }
void UnfoldingRecoAnalyser::analyse(const EventPtr event) { weight_ = event->weight(); treeMan_->setCurrentFolder(histogramFolder_); treeMan_->Fill("EventWeight", event->weight()); double centralLHEWeight = event->centralLHEWeight(); for ( unsigned int unc_i = 0; unc_i < event->generatorSystematicWeights().size(); ++unc_i ) { double weight = event->generatorSystematicWeights().at( unc_i ) / centralLHEWeight; int weightID = event->generatorSystematicWeightsID().at( unc_i ); // cout << to_string(unc_i) << " " << weightID << " " << weight/centralLHEWeight << endl; // string uncString = to_string(unc_i); if ( weightID >= 1001 && weightID <= 1009 ) { treeMan_->Fill( "muFmuRWeight_" + to_string(weightID-1001), weight); } else if ( weightID >= 2001 && weightID <= 2100 ) { treeMan_->Fill( "pdfWeight_" + to_string(weightID-2001), weight); } else if ( weightID == 2101 || weightID == 2102 ) { treeMan_->Fill( "alphaSWeight_" + to_string(weightID-2101), weight); } } treeMan_->setCurrentFolder(histogramFolder_); int selectionCriteria = -1; if ( event->PassesElectronTriggerAndSelection() ) selectionCriteria = SelectionCriteria::ElectronPlusJetsReference; else if ( event->PassesMuonTriggerAndSelection() ) selectionCriteria = SelectionCriteria::MuonPlusJetsReference; if ( event->PassesElectronTriggerAndSelection() && event->PassesMuonTriggerAndSelection() ) { cout << "-------------> This should not happen <-------------" << endl; } // Store selection flags first treeMan_->Fill("passSelection",selectionCriteria); if ( !( event->PassesMuonTriggerAndSelection() || event->PassesElectronTriggerAndSelection() )) return; const JetCollection jets(event->CleanedJets()); const JetCollection bjets(event->CleanedBJets()); const LeptonPointer signalLepton = event->getSignalLepton( selectionCriteria ); METAlgorithm::value metType = (METAlgorithm::value) 0; const METPointer met(event->MET(metType)); treeMan_->Fill("MET",met->et()); treeMan_->Fill("HT",Event::HT(jets)); treeMan_->Fill("ST",Event::ST(jets,signalLepton,met)); treeMan_->Fill("WPT",Event::WPT(signalLepton,met)); treeMan_->Fill("MT",Event::MT(signalLepton,met)); treeMan_->Fill("leptonPt", signalLepton->pt() ); treeMan_->Fill("leptonEta", signalLepton->eta() ); treeMan_->Fill("leptonCharge", signalLepton->charge() ); // Get lepton scale factor if ( event->PassesMuonTriggerAndSelection() ) { const MuonPointer signalMuon(boost::static_pointer_cast<Muon>(signalLepton)); double efficiencyCorrection = signalMuon->getEfficiencyCorrection( 0 ); treeMan_->Fill("LeptonEfficiencyCorrection", efficiencyCorrection); treeMan_->Fill("LeptonEfficiencyCorrectionUp", signalMuon->getEfficiencyCorrection( 1 )); treeMan_->Fill("LeptonEfficiencyCorrectionDown", signalMuon->getEfficiencyCorrection( -1 )); } else if ( event->PassesElectronTriggerAndSelection() ) { const ElectronPointer signalElectron(boost::static_pointer_cast<Electron>(signalLepton)); double efficiencyCorrection = signalElectron->getEfficiencyCorrection( 0 ); treeMan_->Fill("LeptonEfficiencyCorrection", efficiencyCorrection); treeMan_->Fill("LeptonEfficiencyCorrectionUp", signalElectron->getEfficiencyCorrection( 1 )); treeMan_->Fill("LeptonEfficiencyCorrectionDown", signalElectron->getEfficiencyCorrection( -1 )); } treeMan_->Fill("PUWeight", event->PileUpWeight() ); treeMan_->Fill("PUWeight_up", event->PileUpWeight(1) ); treeMan_->Fill("PUWeight_down", event->PileUpWeight(-1) ); treeMan_->Fill("BJetWeight",event->BJetWeight()); treeMan_->Fill("LightJetUpWeight",event->LightJetUpWeight()); treeMan_->Fill("LightJetDownWeight",event->LightJetDownWeight()); treeMan_->Fill("BJetUpWeight",event->BJetUpWeight()); treeMan_->Fill("BJetDownWeight",event->BJetDownWeight()); // MET Uncertainties for ( unsigned int unc_i = 0; unc_i < met->getAllMETUncertainties().size(); ++unc_i ) { METPointer METForUnc_i = met->getMETForUncertainty( unc_i ); treeMan_->Fill("MET_METUncertainties",METForUnc_i->et()); treeMan_->Fill("ST_METUncertainties",Event::ST(jets, signalLepton, METForUnc_i)); treeMan_->Fill("WPT_METUncertainties",Event::WPT(signalLepton, METForUnc_i)); } for (unsigned int index = 0; index < bjets.size(); ++index) { treeMan_->Fill("bPt", bjets.at(index)->pt() ); treeMan_->Fill("bEta", bjets.at(index)->eta() ); } for (unsigned int index = 0; index < jets.size(); ++index) { treeMan_->Fill("jetPt", jets.at(index)->pt() ); treeMan_->Fill("jetEta", jets.at(index)->eta() ); treeMan_->Fill("jetParton", jets.at(index)->ttbar_decay_parton() ); } BAT::TtbarHypothesis topHypothesis = event->ttbarHypothesis(); if ( topHypothesis.isValid() && topHypothesis.isPhysical() ) { treeMan_->Fill("lepTopPt",topHypothesis.leptonicTop->pt()); treeMan_->Fill("hadTopPt",topHypothesis.hadronicTop->pt()); treeMan_->Fill("lepTopRap",topHypothesis.leptonicTop->rapidity()); treeMan_->Fill("hadTopRap",topHypothesis.hadronicTop->rapidity()); treeMan_->Fill("ttbarPt",topHypothesis.resonance->pt()); treeMan_->Fill("ttbarM",topHypothesis.resonance->mass()); treeMan_->Fill("ttbarRap",topHypothesis.resonance->rapidity()); } unsigned int numberOfJets(event->NJets(jets)); unsigned int numberOfBJets(event->NJets(bjets)); treeMan_->Fill("NJets", numberOfJets ); treeMan_->Fill("NBJets", numberOfBJets ); }