diff --git a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.cxx b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.cxx index e221059c3f57b9469493154e1e6f1beafa206ae7..74be325e7f6a564ddc1a1f417b3da900e82ece18 100644 --- a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.cxx @@ -103,7 +103,7 @@ namespace JetTagDQA{ } // util function to fill the tagger discriminant related histograms - void BTaggingValidationPlots::fillDiscriminantHistograms(const std::string& tagger_name, const double& discriminant_value, const std::map<std::string, double>& working_points, const int& truth_label, std::map<std::string, TH1*>::const_iterator hist_iter, std::map<std::string, int>::const_iterator label_iter, const bool& pass_nTracksCut, const double& jet_pT, const double& jet_Lxy, const bool& onZprime){ + void BTaggingValidationPlots::fillDiscriminantHistograms(const std::string& tagger_name, const double& discriminant_value, const std::map<std::string, double>& working_points, const int& truth_label, std::map<std::string, TH1*>::const_iterator hist_iter, std::map<std::string, int>::const_iterator label_iter, const bool& pass_nTracksCut, const double& jet_pT, const double& jet_Lxy, const bool& onZprime, const xAOD::EventInfo* event){ // check if the current histogram is to be filled with this tagger discriminant if((hist_iter->first).find(tagger_name) < 1 && (hist_iter->first).find("matched") < (hist_iter->first).length()){ // check if the current histograms is to be filled with the discrinimant and the current truth label @@ -111,11 +111,11 @@ namespace JetTagDQA{ // now fill it if it is the nTracksCut histogram if((hist_iter->first).find("_trackCuts") < (hist_iter->first).length()){ - if(pass_nTracksCut) (hist_iter->second)->Fill(discriminant_value); + if(pass_nTracksCut) (hist_iter->second)->Fill(discriminant_value, event->beamSpotWeight()); } // else fill it without the nTracksCut else{ - (hist_iter->second)->Fill(discriminant_value); + (hist_iter->second)->Fill(discriminant_value, event->beamSpotWeight()); } } // if it's not to be filled with the discriminant it's the jet pT with discriminant cut selection @@ -126,9 +126,9 @@ namespace JetTagDQA{ if(truth_label == label_iter->second && discriminant_value > working_points_iter->second){ // check if we're on a Zprime sample) if((hist_iter->first).find("Zprime") < (hist_iter->first).length()){ - if(onZprime) (hist_iter->second)->Fill(jet_pT/GeV); + if(onZprime) (hist_iter->second)->Fill(jet_pT/GeV, event->beamSpotWeight()); } else { - if(!onZprime) (hist_iter->second)->Fill(jet_pT/GeV); + if(!onZprime) (hist_iter->second)->Fill(jet_pT/GeV, event->beamSpotWeight()); } } } @@ -139,7 +139,7 @@ namespace JetTagDQA{ // check if the current histogram is the right one if((hist_iter->first).find(working_points_iter->first) < (hist_iter->first).length() && (hist_iter->first).find("_"+label_iter->first+"_") < (hist_iter->first).length()){ if(truth_label == label_iter->second && discriminant_value > working_points_iter->second){ - (hist_iter->second)->Fill(jet_Lxy); + (hist_iter->second)->Fill(jet_Lxy, event->beamSpotWeight()); } } } @@ -182,25 +182,25 @@ namespace JetTagDQA{ template <class T> - void BTaggingValidationPlots::fillHistoWithTruthCases(T value, TH1* histo_incl, TH1* histo_b, TH1* histo_c, TH1* histo_l, TH1* histo_muon, const int& truth_label, const bool& has_muon){ + void BTaggingValidationPlots::fillHistoWithTruthCases(T value, TH1* histo_incl, TH1* histo_b, TH1* histo_c, TH1* histo_l, TH1* histo_muon, const int& truth_label, const bool& has_muon, const xAOD::EventInfo* event){ // the inclusive ones in any case - histo_incl -> Fill( value ); + histo_incl -> Fill( value, event->beamSpotWeight() ); // truth cases if(!m_isData && truth_label == 5) { - histo_b -> Fill( value ); + histo_b -> Fill( value, event->beamSpotWeight() ); } else if(!m_isData && truth_label == 4) { - histo_c -> Fill( value ); + histo_c -> Fill( value, event->beamSpotWeight() ); } else if(!m_isData && truth_label == 0) { - histo_l -> Fill( value ); + histo_l -> Fill( value, event->beamSpotWeight() ); } // muon if(has_muon) { - histo_muon -> Fill( value ); + histo_muon -> Fill( value, event->beamSpotWeight() ); } } @@ -777,52 +777,52 @@ namespace JetTagDQA{ // a fill method for the multiplicities - void BTaggingValidationPlots::fillMultiplicities(const unsigned int& nJets, const unsigned int& nTracks, const int& nPrimVtx, const unsigned int& nTracksPrimVtx, const unsigned int& nJetsWithMuon, const unsigned int& nJetsWithSV, std::map<std::string, int>& nJetsThatPassedWPCuts){ - m_nJets->Fill(nJets); - m_nTracks->Fill(nTracks); - m_nPrimVtx->Fill(nPrimVtx); - m_nTracksPrimVtx->Fill(nTracksPrimVtx); - m_nJetsWithMuon->Fill(nJetsWithMuon); - m_nJetsWithSV->Fill(nJetsWithSV); + void BTaggingValidationPlots::fillMultiplicities(const unsigned int& nJets, const unsigned int& nTracks, const int& nPrimVtx, const unsigned int& nTracksPrimVtx, const unsigned int& nJetsWithMuon, const unsigned int& nJetsWithSV, std::map<std::string, int>& nJetsThatPassedWPCuts, const xAOD::EventInfo* event){ + m_nJets->Fill(nJets, event->beamSpotWeight()); + m_nTracks->Fill(nTracks, event->beamSpotWeight()); + m_nPrimVtx->Fill(nPrimVtx, event->beamSpotWeight()); + m_nTracksPrimVtx->Fill(nTracksPrimVtx, event->beamSpotWeight()); + m_nJetsWithMuon->Fill(nJetsWithMuon, event->beamSpotWeight()); + m_nJetsWithSV->Fill(nJetsWithSV, event->beamSpotWeight()); double fracJetsWithMuon = static_cast<double>(nJetsWithMuon) / nJets; double fracJetsWithSV = static_cast<double>(nJetsWithSV) / nJets; - m_fracJetsWithMuon->Fill(fracJetsWithMuon); - m_fracJetsWithSV->Fill(fracJetsWithSV); + m_fracJetsWithMuon->Fill(fracJetsWithMuon, event->beamSpotWeight()); + m_fracJetsWithSV->Fill(fracJetsWithSV, event->beamSpotWeight()); - fillNJetsThatPassedWPCutsHistos(nJetsThatPassedWPCuts); + fillNJetsThatPassedWPCutsHistos(nJetsThatPassedWPCuts, event); } // a fill method for the PV variables - void BTaggingValidationPlots::fillPVVariables(const double& PV_x, const double& PV_y, const double& PV_z){ - m_PV_x->Fill(PV_x); - m_PV_y->Fill(PV_y); - m_PV_z->Fill(PV_z); + void BTaggingValidationPlots::fillPVVariables(const double& PV_x, const double& PV_y, const double& PV_z, const xAOD::EventInfo* event){ + m_PV_x->Fill(PV_x, event->beamSpotWeight()); + m_PV_y->Fill(PV_y, event->beamSpotWeight()); + m_PV_z->Fill(PV_z, event->beamSpotWeight()); } // a fill method for the jet kinematic vars - void BTaggingValidationPlots::fillJetKinVars(const xAOD::Jet* jet, const int& truth_label, const bool& onZprime){ + void BTaggingValidationPlots::fillJetKinVars(const xAOD::Jet* jet, const int& truth_label, const bool& onZprime, const xAOD::EventInfo* event){ TH1* dummy = nullptr; // jet kin vars // pT if(onZprime){ - BTaggingValidationPlots::fillHistoWithTruthCases(jet->pt()/GeV, m_jet_pt_Zprime, m_jet_pt_Zprime_b, m_jet_pt_Zprime_c, m_jet_pt_Zprime_l, dummy, truth_label, false); - m_jet_e_Zprime->Fill(jet->e()/GeV); + BTaggingValidationPlots::fillHistoWithTruthCases(jet->pt()/GeV, m_jet_pt_Zprime, m_jet_pt_Zprime_b, m_jet_pt_Zprime_c, m_jet_pt_Zprime_l, dummy, truth_label, false, event); + m_jet_e_Zprime->Fill(jet->e()/GeV, event->beamSpotWeight()); } else { - BTaggingValidationPlots::fillHistoWithTruthCases(jet->pt()/GeV, m_jet_pt, m_jet_pt_b, m_jet_pt_c, m_jet_pt_l, dummy, truth_label, false); - m_jet_e->Fill(jet->e()/GeV); + BTaggingValidationPlots::fillHistoWithTruthCases(jet->pt()/GeV, m_jet_pt, m_jet_pt_b, m_jet_pt_c, m_jet_pt_l, dummy, truth_label, false, event); + m_jet_e->Fill(jet->e()/GeV, event->beamSpotWeight()); } // eta and phi - BTaggingValidationPlots::fillHistoWithTruthCases(jet->eta(), m_jet_eta, m_jet_eta_b, m_jet_eta_c, m_jet_eta_l, dummy, truth_label, false); - m_jet_phi->Fill(jet->phi()); + BTaggingValidationPlots::fillHistoWithTruthCases(jet->eta(), m_jet_eta, m_jet_eta_b, m_jet_eta_c, m_jet_eta_l, dummy, truth_label, false, event); + m_jet_phi->Fill(jet->phi(), event->beamSpotWeight()); // fill the truth label - m_truthLabel->Fill(truth_label); + m_truthLabel->Fill(truth_label, event->beamSpotWeight()); } // a fill method for variables that have no other home - void BTaggingValidationPlots::fillOther(const xAOD::Jet* jet, const xAOD::BTagging* btag, bool& contains_muon, double& jet_Lxy, const int& truth_label){ + void BTaggingValidationPlots::fillOther(const xAOD::Jet* jet, const xAOD::BTagging* btag, bool& contains_muon, double& jet_Lxy, const int& truth_label, const xAOD::EventInfo* event){ // Lxy: take value of B hadron for b jets, of C hadron for c jets and the SV1 Lxy value for light jets double Lxy(-1); @@ -838,10 +838,10 @@ namespace JetTagDQA{ if(BHadrons.size() >= 1){ // get the Lxy Lxy = BHadrons[0]->decayVtx()->perp(); - m_Truth_Lxy_b ->Fill(Lxy); + m_Truth_Lxy_b ->Fill(Lxy, event->beamSpotWeight()); // get the deltaR wrt to the jet axis double dR = jet->p4().DeltaR(BHadrons[0]->p4()); - m_deltaR_truthBHadron_jet_b->Fill(dR); + m_deltaR_truthBHadron_jet_b->Fill(dR, event->beamSpotWeight()); } } @@ -855,10 +855,10 @@ namespace JetTagDQA{ if(CHadrons.size() >= 1){ // get the Lxy Lxy = CHadrons[0]->decayVtx()->perp(); - m_Truth_Lxy_c ->Fill(Lxy); + m_Truth_Lxy_c ->Fill(Lxy, event->beamSpotWeight()); // get the deltaR wrt to the jet axis double dR = jet->p4().DeltaR(CHadrons[0]->p4()); - m_deltaR_truthCHadron_jet_c->Fill(dR); + m_deltaR_truthCHadron_jet_c->Fill(dR, event->beamSpotWeight()); } } @@ -879,7 +879,7 @@ namespace JetTagDQA{ if ( muon != 0 ) { has_muon = true; double muon_pT_frac = muon->pt() / jet->pt(); - m_muon_pT_frac->Fill(muon_pT_frac); + m_muon_pT_frac->Fill(muon_pT_frac, event->beamSpotWeight()); } } // fill contains_muon for the caller of this function @@ -888,7 +888,7 @@ namespace JetTagDQA{ // a fill method for track related vars - void BTaggingValidationPlots::fillTrackVariables(const xAOD::Jet* jet, const xAOD::BTagging* btag, const xAOD::Vertex *myVertex, std::map<const xAOD::TrackParticle*, int> track_truth_associations, const bool& has_muon, const int& truth_label, int& num_HF_tracks_in_jet){ + void BTaggingValidationPlots::fillTrackVariables(const xAOD::Jet* jet, const xAOD::BTagging* btag, const xAOD::Vertex *myVertex, std::map<const xAOD::TrackParticle*, int> track_truth_associations, const bool& has_muon, const int& truth_label, int& num_HF_tracks_in_jet, const xAOD::EventInfo* event){ // get the jet TLorentzVector TLorentzVector jet_tlv; @@ -984,69 +984,69 @@ namespace JetTagDQA{ int nsharedSCTHits = getTrackHits(*track, xAOD::numberOfSCTSharedHits); // fill the histogram - BTaggingValidationPlots::fillHistoWithTruthCases(d0, m_track_d0_incl, m_track_d0_b, m_track_d0_c, m_track_d0_u, m_track_d0_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(z0, m_track_z0_incl, m_track_z0_b, m_track_z0_c, m_track_z0_u, m_track_z0_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(d0/sigma_d0, m_track_sigd0_incl, m_track_sigd0_b, m_track_sigd0_c, m_track_sigd0_u, m_track_sigd0_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(z0/sigma_z0, m_track_sigz0_incl, m_track_sigz0_b, m_track_sigz0_c, m_track_sigz0_u, m_track_sigz0_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(pT_frac, m_track_pT_frac_incl, m_track_pT_frac_b, m_track_pT_frac_c, m_track_pT_frac_u, m_track_pT_frac_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(DeltaR_jet_track, m_DeltaR_jet_track_incl, m_DeltaR_jet_track_b, m_DeltaR_jet_track_c, m_DeltaR_jet_track_u, m_DeltaR_jet_track_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nInnHits, m_nInnHits_incl, m_nInnHits_b, m_nInnHits_c, m_nInnHits_u, m_nInnHits_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nNextToInnHits, m_nNextToInnHits_incl, m_nNextToInnHits_b, m_nNextToInnHits_c, m_nNextToInnHits_u, m_nNextToInnHits_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nBLHits, m_nBLHits_incl, m_nBLHits_b, m_nBLHits_c, m_nBLHits_u, m_nBLHits_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nsharedBLHits, m_nsharedBLHits_incl, m_nsharedBLHits_b, m_nsharedBLHits_c, m_nsharedBLHits_u, m_nsharedBLHits_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nsplitBLHits, m_nsplitBLHits_incl, m_nsplitBLHits_b, m_nsplitBLHits_c, m_nsplitBLHits_u, m_nsplitBLHits_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nPixHits, m_nPixHits_incl, m_nPixHits_b, m_nPixHits_c, m_nPixHits_u, m_nPixHits_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nPixHoles, m_nPixHoles_incl, m_nPixHoles_b, m_nPixHoles_c, m_nPixHoles_u, m_nPixHoles_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nsharedPixHits, m_nsharedPixHits_incl, m_nsharedPixHits_b, m_nsharedPixHits_c, m_nsharedPixHits_u, m_nsharedPixHits_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nsplitPixHits, m_nsplitPixHits_incl, m_nsplitPixHits_b, m_nsplitPixHits_c, m_nsplitPixHits_u, m_nsplitPixHits_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nSCTHits, m_nSCTHits_incl, m_nSCTHits_b, m_nSCTHits_c, m_nSCTHits_u, m_nSCTHits_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nSCTHoles, m_nSCTHoles_incl, m_nSCTHoles_b, m_nSCTHoles_c, m_nSCTHoles_u, m_nSCTHoles_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nsharedSCTHits, m_nsharedSCTHits_incl, m_nsharedSCTHits_b, m_nsharedSCTHits_c, m_nsharedSCTHits_u, m_nsharedSCTHits_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(d0, m_track_d0_incl, m_track_d0_b, m_track_d0_c, m_track_d0_u, m_track_d0_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(z0, m_track_z0_incl, m_track_z0_b, m_track_z0_c, m_track_z0_u, m_track_z0_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(d0/sigma_d0, m_track_sigd0_incl, m_track_sigd0_b, m_track_sigd0_c, m_track_sigd0_u, m_track_sigd0_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(z0/sigma_z0, m_track_sigz0_incl, m_track_sigz0_b, m_track_sigz0_c, m_track_sigz0_u, m_track_sigz0_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(pT_frac, m_track_pT_frac_incl, m_track_pT_frac_b, m_track_pT_frac_c, m_track_pT_frac_u, m_track_pT_frac_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(DeltaR_jet_track, m_DeltaR_jet_track_incl, m_DeltaR_jet_track_b, m_DeltaR_jet_track_c, m_DeltaR_jet_track_u, m_DeltaR_jet_track_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nInnHits, m_nInnHits_incl, m_nInnHits_b, m_nInnHits_c, m_nInnHits_u, m_nInnHits_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nNextToInnHits, m_nNextToInnHits_incl, m_nNextToInnHits_b, m_nNextToInnHits_c, m_nNextToInnHits_u, m_nNextToInnHits_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nBLHits, m_nBLHits_incl, m_nBLHits_b, m_nBLHits_c, m_nBLHits_u, m_nBLHits_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nsharedBLHits, m_nsharedBLHits_incl, m_nsharedBLHits_b, m_nsharedBLHits_c, m_nsharedBLHits_u, m_nsharedBLHits_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nsplitBLHits, m_nsplitBLHits_incl, m_nsplitBLHits_b, m_nsplitBLHits_c, m_nsplitBLHits_u, m_nsplitBLHits_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nPixHits, m_nPixHits_incl, m_nPixHits_b, m_nPixHits_c, m_nPixHits_u, m_nPixHits_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nPixHoles, m_nPixHoles_incl, m_nPixHoles_b, m_nPixHoles_c, m_nPixHoles_u, m_nPixHoles_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nsharedPixHits, m_nsharedPixHits_incl, m_nsharedPixHits_b, m_nsharedPixHits_c, m_nsharedPixHits_u, m_nsharedPixHits_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nsplitPixHits, m_nsplitPixHits_incl, m_nsplitPixHits_b, m_nsplitPixHits_c, m_nsplitPixHits_u, m_nsplitPixHits_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nSCTHits, m_nSCTHits_incl, m_nSCTHits_b, m_nSCTHits_c, m_nSCTHits_u, m_nSCTHits_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nSCTHoles, m_nSCTHoles_incl, m_nSCTHoles_b, m_nSCTHoles_c, m_nSCTHoles_u, m_nSCTHoles_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nsharedSCTHits, m_nsharedSCTHits_incl, m_nsharedSCTHits_b, m_nsharedSCTHits_c, m_nsharedSCTHits_u, m_nsharedSCTHits_muon, truth_label, has_muon, event); } // end loop over tracks // store the number of tracks var - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_perJet, m_numTracks_perJet_incl, m_numTracks_perJet_b, m_numTracks_perJet_c, m_numTracks_perJet_u, m_numTracks_perJet_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_perJet, m_numTracks_perJet_incl, m_numTracks_perJet_b, m_numTracks_perJet_c, m_numTracks_perJet_u, m_numTracks_perJet_muon, truth_label, has_muon, event); if(!m_isData){ num_HF_tracks_in_jet = numTracks_fromB + numTracks_fromC; - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromB, m_numTracks_B_incl, m_numTracks_B_b, m_numTracks_B_c, m_numTracks_B_u, m_numTracks_B_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromC, m_numTracks_C_incl, m_numTracks_C_b, m_numTracks_C_c, m_numTracks_C_u, m_numTracks_C_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromFragmentation, m_numTracks_Fragmentation_incl, m_numTracks_Fragmentation_b, m_numTracks_Fragmentation_c, m_numTracks_Fragmentation_u, m_numTracks_Fragmentation_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromSecondaries, m_numTracks_Secondaries_incl, m_numTracks_Secondaries_b, m_numTracks_Secondaries_c, m_numTracks_Secondaries_u, m_numTracks_Secondaries_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromPileup, m_numTracks_Pileup_incl, m_numTracks_Pileup_b, m_numTracks_Pileup_c, m_numTracks_Pileup_u, m_numTracks_Pileup_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromFake, m_numTracks_Fake_incl, m_numTracks_Fake_b, m_numTracks_Fake_c, m_numTracks_Fake_u, m_numTracks_Fake_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromB, m_numTracks_B_incl, m_numTracks_B_b, m_numTracks_B_c, m_numTracks_B_u, m_numTracks_B_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromC, m_numTracks_C_incl, m_numTracks_C_b, m_numTracks_C_c, m_numTracks_C_u, m_numTracks_C_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromFragmentation, m_numTracks_Fragmentation_incl, m_numTracks_Fragmentation_b, m_numTracks_Fragmentation_c, m_numTracks_Fragmentation_u, m_numTracks_Fragmentation_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromSecondaries, m_numTracks_Secondaries_incl, m_numTracks_Secondaries_b, m_numTracks_Secondaries_c, m_numTracks_Secondaries_u, m_numTracks_Secondaries_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromPileup, m_numTracks_Pileup_incl, m_numTracks_Pileup_b, m_numTracks_Pileup_c, m_numTracks_Pileup_u, m_numTracks_Pileup_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_fromFake, m_numTracks_Fake_incl, m_numTracks_Fake_b, m_numTracks_Fake_c, m_numTracks_Fake_u, m_numTracks_Fake_muon, truth_label, has_muon, event); if(m_detailLevel > 10){ - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_KshortDecay, m_numTracks_Secondaries_KshortDecay_incl, m_numTracks_Secondaries_KshortDecay_b, m_numTracks_Secondaries_KshortDecay_c, m_numTracks_Secondaries_KshortDecay_u, m_numTracks_Secondaries_KshortDecay_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_LambdaDecay, m_numTracks_Secondaries_LambdaDecay_incl, m_numTracks_Secondaries_LambdaDecay_b, m_numTracks_Secondaries_LambdaDecay_c, m_numTracks_Secondaries_LambdaDecay_u, m_numTracks_Secondaries_LambdaDecay_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_GammaConversion, m_numTracks_Secondaries_GammaConversion_incl, m_numTracks_Secondaries_GammaConversion_b, m_numTracks_Secondaries_GammaConversion_c, m_numTracks_Secondaries_GammaConversion_u, m_numTracks_Secondaries_GammaConversion_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_OtherDecay, m_numTracks_Secondaries_OtherDecay_incl, m_numTracks_Secondaries_OtherDecay_b, m_numTracks_Secondaries_OtherDecay_c, m_numTracks_Secondaries_OtherDecay_u, m_numTracks_Secondaries_OtherDecay_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_HadronicInteraction, m_numTracks_Secondaries_HadronicInteraction_incl, m_numTracks_Secondaries_HadronicInteraction_b, m_numTracks_Secondaries_HadronicInteraction_c, m_numTracks_Secondaries_HadronicInteraction_u, m_numTracks_Secondaries_HadronicInteraction_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_OtherSecondary, m_numTracks_Secondaries_OtherSecondary_incl, m_numTracks_Secondaries_OtherSecondary_b, m_numTracks_Secondaries_OtherSecondary_c, m_numTracks_Secondaries_OtherSecondary_u, m_numTracks_Secondaries_OtherSecondary_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_OtherOrigin, m_numTracks_OtherOrigin_incl, m_numTracks_OtherOrigin_b, m_numTracks_OtherOrigin_c, m_numTracks_OtherOrigin_u, m_numTracks_OtherOrigin_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_KshortDecay, m_numTracks_Secondaries_KshortDecay_incl, m_numTracks_Secondaries_KshortDecay_b, m_numTracks_Secondaries_KshortDecay_c, m_numTracks_Secondaries_KshortDecay_u, m_numTracks_Secondaries_KshortDecay_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_LambdaDecay, m_numTracks_Secondaries_LambdaDecay_incl, m_numTracks_Secondaries_LambdaDecay_b, m_numTracks_Secondaries_LambdaDecay_c, m_numTracks_Secondaries_LambdaDecay_u, m_numTracks_Secondaries_LambdaDecay_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_GammaConversion, m_numTracks_Secondaries_GammaConversion_incl, m_numTracks_Secondaries_GammaConversion_b, m_numTracks_Secondaries_GammaConversion_c, m_numTracks_Secondaries_GammaConversion_u, m_numTracks_Secondaries_GammaConversion_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_OtherDecay, m_numTracks_Secondaries_OtherDecay_incl, m_numTracks_Secondaries_OtherDecay_b, m_numTracks_Secondaries_OtherDecay_c, m_numTracks_Secondaries_OtherDecay_u, m_numTracks_Secondaries_OtherDecay_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_HadronicInteraction, m_numTracks_Secondaries_HadronicInteraction_incl, m_numTracks_Secondaries_HadronicInteraction_b, m_numTracks_Secondaries_HadronicInteraction_c, m_numTracks_Secondaries_HadronicInteraction_u, m_numTracks_Secondaries_HadronicInteraction_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_Secondaries_OtherSecondary, m_numTracks_Secondaries_OtherSecondary_incl, m_numTracks_Secondaries_OtherSecondary_b, m_numTracks_Secondaries_OtherSecondary_c, m_numTracks_Secondaries_OtherSecondary_u, m_numTracks_Secondaries_OtherSecondary_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(numTracks_OtherOrigin, m_numTracks_OtherOrigin_incl, m_numTracks_OtherOrigin_b, m_numTracks_OtherOrigin_c, m_numTracks_OtherOrigin_u, m_numTracks_OtherOrigin_muon, truth_label, has_muon, event); } } - m_numTracks_perJet_vs_pT_incl ->Fill(jet->pt()/GeV, numTracks_perJet); + m_numTracks_perJet_vs_pT_incl ->Fill(jet->pt()/GeV, numTracks_perJet, event->beamSpotWeight()); if(!m_isData && truth_label == 5) { - m_numTracks_perJet_vs_pT_b ->Fill(jet->pt()/GeV, numTracks_perJet); + m_numTracks_perJet_vs_pT_b ->Fill(jet->pt()/GeV, numTracks_perJet, event->beamSpotWeight()); } else if(!m_isData && truth_label == 4) { - m_numTracks_perJet_vs_pT_c ->Fill(jet->pt()/GeV, numTracks_perJet); + m_numTracks_perJet_vs_pT_c ->Fill(jet->pt()/GeV, numTracks_perJet, event->beamSpotWeight()); } else if(!m_isData && truth_label == 0) { - m_numTracks_perJet_vs_pT_u ->Fill(jet->pt()/GeV, numTracks_perJet); + m_numTracks_perJet_vs_pT_u ->Fill(jet->pt()/GeV, numTracks_perJet, event->beamSpotWeight()); } if(has_muon) { - m_numTracks_perJet_vs_pT_muon ->Fill(jet->pt()/GeV, numTracks_perJet); + m_numTracks_perJet_vs_pT_muon ->Fill(jet->pt()/GeV, numTracks_perJet, event->beamSpotWeight()); } } // a fill method for SV related vars - void BTaggingValidationPlots::fillSVVariables(const xAOD::Jet* jet, const xAOD::BTagging* btag, std::map<const xAOD::TrackParticle*, int> track_truth_associations, const bool& has_muon, const int& truth_label, const int& num_HF_tracks_in_jet, bool& contains_SV){ + void BTaggingValidationPlots::fillSVVariables(const xAOD::Jet* jet, const xAOD::BTagging* btag, std::map<const xAOD::TrackParticle*, int> track_truth_associations, const bool& has_muon, const int& truth_label, const int& num_HF_tracks_in_jet, bool& contains_SV, const xAOD::EventInfo* event){ // SV1 // SV1 mass of the SV @@ -1322,87 +1322,87 @@ namespace JetTagDQA{ // get the average purity double JetFitter_purity = std::accumulate(JetFitter_purity_perVertex.begin(), JetFitter_purity_perVertex.end(), 0.) / JetFitter_purity_perVertex.size(); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_masssvx/GeV, m_SV1_masssvx_incl, m_SV1_masssvx_b, m_SV1_masssvx_c, m_SV1_masssvx_l, m_SV1_masssvx_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_N2Tpair, m_SV1_N2Tpair_incl, m_SV1_N2Tpair_b, m_SV1_N2Tpair_c, m_SV1_N2Tpair_l, m_SV1_N2Tpair_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_efracsvx, m_SV1_efracsvx_incl, m_SV1_efracsvx_b, m_SV1_efracsvx_c, m_SV1_efracsvx_l, m_SV1_efracsvx_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_deltaR, m_SV1_deltaR_incl, m_SV1_deltaR_b, m_SV1_deltaR_c, m_SV1_deltaR_l, m_SV1_deltaR_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_significance3d, m_SV1_significance3d_incl, m_SV1_significance3d_b, m_SV1_significance3d_c, m_SV1_significance3d_l, m_SV1_significance3d_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_energyTrkInJet/GeV, m_SV1_energyTrkInJet_incl, m_SV1_energyTrkInJet_b, m_SV1_energyTrkInJet_c, m_SV1_energyTrkInJet_l, m_SV1_energyTrkInJet_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_NGTinSvx, m_SV1_NGTinSvx_incl, m_SV1_NGTinSvx_b, m_SV1_NGTinSvx_c, m_SV1_NGTinSvx_l, m_SV1_NGTinSvx_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_Lxy, m_SV1_Lxy_incl, m_SV1_Lxy_b, m_SV1_Lxy_c, m_SV1_Lxy_l, m_SV1_Lxy_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_vertex.size(), m_SV1_numSVs_incl, m_SV1_numSVs_b, m_SV1_numSVs_c, m_SV1_numSVs_l, m_SV1_numSVs_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_masssvx/GeV, m_SV1_masssvx_incl, m_SV1_masssvx_b, m_SV1_masssvx_c, m_SV1_masssvx_l, m_SV1_masssvx_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_N2Tpair, m_SV1_N2Tpair_incl, m_SV1_N2Tpair_b, m_SV1_N2Tpair_c, m_SV1_N2Tpair_l, m_SV1_N2Tpair_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_efracsvx, m_SV1_efracsvx_incl, m_SV1_efracsvx_b, m_SV1_efracsvx_c, m_SV1_efracsvx_l, m_SV1_efracsvx_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_deltaR, m_SV1_deltaR_incl, m_SV1_deltaR_b, m_SV1_deltaR_c, m_SV1_deltaR_l, m_SV1_deltaR_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_significance3d, m_SV1_significance3d_incl, m_SV1_significance3d_b, m_SV1_significance3d_c, m_SV1_significance3d_l, m_SV1_significance3d_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_energyTrkInJet/GeV, m_SV1_energyTrkInJet_incl, m_SV1_energyTrkInJet_b, m_SV1_energyTrkInJet_c, m_SV1_energyTrkInJet_l, m_SV1_energyTrkInJet_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_NGTinSvx, m_SV1_NGTinSvx_incl, m_SV1_NGTinSvx_b, m_SV1_NGTinSvx_c, m_SV1_NGTinSvx_l, m_SV1_NGTinSvx_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_Lxy, m_SV1_Lxy_incl, m_SV1_Lxy_b, m_SV1_Lxy_c, m_SV1_Lxy_l, m_SV1_Lxy_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_vertex.size(), m_SV1_numSVs_incl, m_SV1_numSVs_b, m_SV1_numSVs_c, m_SV1_numSVs_l, m_SV1_numSVs_muon, truth_label, has_muon, event); if(!m_isData){ - BTaggingValidationPlots::fillHistoWithTruthCases( SV1_frac_HF_tracks_in_jet, m_SV1_fracHFTracksInJet_incl, m_SV1_fracHFTracksInJet_b, m_SV1_fracHFTracksInJet_c, m_SV1_fracHFTracksInJet_l, m_SV1_fracHFTracksInJet_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases( SV1_purity, m_SV1_purity_incl, m_SV1_purity_b, m_SV1_purity_c, m_SV1_purity_l, m_SV1_purity_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromB, m_SV1_fracTracks_fromB_incl, m_SV1_fracTracks_fromB_b, m_SV1_fracTracks_fromB_c, m_SV1_fracTracks_fromB_l, m_SV1_fracTracks_fromB_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromC, m_SV1_fracTracks_fromC_incl, m_SV1_fracTracks_fromC_b, m_SV1_fracTracks_fromC_c, m_SV1_fracTracks_fromC_l, m_SV1_fracTracks_fromC_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromFragmentation, m_SV1_fracTracks_fromFragmentation_incl, m_SV1_fracTracks_fromFragmentation_b, m_SV1_fracTracks_fromFragmentation_c, m_SV1_fracTracks_fromFragmentation_l, m_SV1_fracTracks_fromFragmentation_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromSecondaries, m_SV1_fracTracks_fromSecondaries_incl, m_SV1_fracTracks_fromSecondaries_b, m_SV1_fracTracks_fromSecondaries_c, m_SV1_fracTracks_fromSecondaries_l, m_SV1_fracTracks_fromSecondaries_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromPileup, m_SV1_fracTracks_fromPileup_incl, m_SV1_fracTracks_fromPileup_b, m_SV1_fracTracks_fromPileup_c, m_SV1_fracTracks_fromPileup_l, m_SV1_fracTracks_fromPileup_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromFake, m_SV1_fracTracks_fromFake_incl, m_SV1_fracTracks_fromFake_b, m_SV1_fracTracks_fromFake_c, m_SV1_fracTracks_fromFake_l, m_SV1_fracTracks_fromFake_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases( SV1_frac_HF_tracks_in_jet, m_SV1_fracHFTracksInJet_incl, m_SV1_fracHFTracksInJet_b, m_SV1_fracHFTracksInJet_c, m_SV1_fracHFTracksInJet_l, m_SV1_fracHFTracksInJet_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases( SV1_purity, m_SV1_purity_incl, m_SV1_purity_b, m_SV1_purity_c, m_SV1_purity_l, m_SV1_purity_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromB, m_SV1_fracTracks_fromB_incl, m_SV1_fracTracks_fromB_b, m_SV1_fracTracks_fromB_c, m_SV1_fracTracks_fromB_l, m_SV1_fracTracks_fromB_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromC, m_SV1_fracTracks_fromC_incl, m_SV1_fracTracks_fromC_b, m_SV1_fracTracks_fromC_c, m_SV1_fracTracks_fromC_l, m_SV1_fracTracks_fromC_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromFragmentation, m_SV1_fracTracks_fromFragmentation_incl, m_SV1_fracTracks_fromFragmentation_b, m_SV1_fracTracks_fromFragmentation_c, m_SV1_fracTracks_fromFragmentation_l, m_SV1_fracTracks_fromFragmentation_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromSecondaries, m_SV1_fracTracks_fromSecondaries_incl, m_SV1_fracTracks_fromSecondaries_b, m_SV1_fracTracks_fromSecondaries_c, m_SV1_fracTracks_fromSecondaries_l, m_SV1_fracTracks_fromSecondaries_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromPileup, m_SV1_fracTracks_fromPileup_incl, m_SV1_fracTracks_fromPileup_b, m_SV1_fracTracks_fromPileup_c, m_SV1_fracTracks_fromPileup_l, m_SV1_fracTracks_fromPileup_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases( SV1_fracTracks_fromFake, m_SV1_fracTracks_fromFake_incl, m_SV1_fracTracks_fromFake_b, m_SV1_fracTracks_fromFake_c, m_SV1_fracTracks_fromFake_l, m_SV1_fracTracks_fromFake_muon, truth_label, has_muon, event); if(m_detailLevel > 10){ - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_KshortDecay, m_SV1_fracTracks_Secondaries_KshortDecay_incl, m_SV1_fracTracks_Secondaries_KshortDecay_b, m_SV1_fracTracks_Secondaries_KshortDecay_c, m_SV1_fracTracks_Secondaries_KshortDecay_u, m_SV1_fracTracks_Secondaries_KshortDecay_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_LambdaDecay, m_SV1_fracTracks_Secondaries_LambdaDecay_incl, m_SV1_fracTracks_Secondaries_LambdaDecay_b, m_SV1_fracTracks_Secondaries_LambdaDecay_c, m_SV1_fracTracks_Secondaries_LambdaDecay_u, m_SV1_fracTracks_Secondaries_LambdaDecay_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_GammaConversion, m_SV1_fracTracks_Secondaries_GammaConversion_incl, m_SV1_fracTracks_Secondaries_GammaConversion_b, m_SV1_fracTracks_Secondaries_GammaConversion_c, m_SV1_fracTracks_Secondaries_GammaConversion_u, m_SV1_fracTracks_Secondaries_GammaConversion_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_OtherDecay, m_SV1_fracTracks_Secondaries_OtherDecay_incl, m_SV1_fracTracks_Secondaries_OtherDecay_b, m_SV1_fracTracks_Secondaries_OtherDecay_c, m_SV1_fracTracks_Secondaries_OtherDecay_u, m_SV1_fracTracks_Secondaries_OtherDecay_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_HadronicInteraction, m_SV1_fracTracks_Secondaries_HadronicInteraction_incl, m_SV1_fracTracks_Secondaries_HadronicInteraction_b, m_SV1_fracTracks_Secondaries_HadronicInteraction_c, m_SV1_fracTracks_Secondaries_HadronicInteraction_u, m_SV1_fracTracks_Secondaries_HadronicInteraction_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_OtherSecondary, m_SV1_fracTracks_Secondaries_OtherSecondary_incl, m_SV1_fracTracks_Secondaries_OtherSecondary_b, m_SV1_fracTracks_Secondaries_OtherSecondary_c, m_SV1_fracTracks_Secondaries_OtherSecondary_u, m_SV1_fracTracks_Secondaries_OtherSecondary_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_OtherOrigin, m_SV1_fracTracks_OtherOrigin_incl, m_SV1_fracTracks_OtherOrigin_b, m_SV1_fracTracks_OtherOrigin_c, m_SV1_fracTracks_OtherOrigin_u, m_SV1_fracTracks_OtherOrigin_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_KshortDecay, m_SV1_fracTracks_Secondaries_KshortDecay_incl, m_SV1_fracTracks_Secondaries_KshortDecay_b, m_SV1_fracTracks_Secondaries_KshortDecay_c, m_SV1_fracTracks_Secondaries_KshortDecay_u, m_SV1_fracTracks_Secondaries_KshortDecay_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_LambdaDecay, m_SV1_fracTracks_Secondaries_LambdaDecay_incl, m_SV1_fracTracks_Secondaries_LambdaDecay_b, m_SV1_fracTracks_Secondaries_LambdaDecay_c, m_SV1_fracTracks_Secondaries_LambdaDecay_u, m_SV1_fracTracks_Secondaries_LambdaDecay_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_GammaConversion, m_SV1_fracTracks_Secondaries_GammaConversion_incl, m_SV1_fracTracks_Secondaries_GammaConversion_b, m_SV1_fracTracks_Secondaries_GammaConversion_c, m_SV1_fracTracks_Secondaries_GammaConversion_u, m_SV1_fracTracks_Secondaries_GammaConversion_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_OtherDecay, m_SV1_fracTracks_Secondaries_OtherDecay_incl, m_SV1_fracTracks_Secondaries_OtherDecay_b, m_SV1_fracTracks_Secondaries_OtherDecay_c, m_SV1_fracTracks_Secondaries_OtherDecay_u, m_SV1_fracTracks_Secondaries_OtherDecay_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_HadronicInteraction, m_SV1_fracTracks_Secondaries_HadronicInteraction_incl, m_SV1_fracTracks_Secondaries_HadronicInteraction_b, m_SV1_fracTracks_Secondaries_HadronicInteraction_c, m_SV1_fracTracks_Secondaries_HadronicInteraction_u, m_SV1_fracTracks_Secondaries_HadronicInteraction_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_Secondaries_OtherSecondary, m_SV1_fracTracks_Secondaries_OtherSecondary_incl, m_SV1_fracTracks_Secondaries_OtherSecondary_b, m_SV1_fracTracks_Secondaries_OtherSecondary_c, m_SV1_fracTracks_Secondaries_OtherSecondary_u, m_SV1_fracTracks_Secondaries_OtherSecondary_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(SV1_fracTracks_OtherOrigin, m_SV1_fracTracks_OtherOrigin_incl, m_SV1_fracTracks_OtherOrigin_b, m_SV1_fracTracks_OtherOrigin_c, m_SV1_fracTracks_OtherOrigin_u, m_SV1_fracTracks_OtherOrigin_muon, truth_label, has_muon, event); } } - BTaggingValidationPlots::fillHistoWithTruthCases(MSV_nvsec, m_MSV_nvsec_incl, m_MSV_nvsec_b, m_MSV_nvsec_c, m_MSV_nvsec_l, m_MSV_nvsec_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(MSV_N2Tpair, m_MSV_N2Tpair_incl, m_MSV_N2Tpair_b, m_MSV_N2Tpair_c, m_MSV_N2Tpair_l, m_MSV_N2Tpair_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(MSV_energyTrkInJet/GeV, m_MSV_energyTrkInJet_incl, m_MSV_energyTrkInJet_b, m_MSV_energyTrkInJet_c, m_MSV_energyTrkInJet_l, m_MSV_energyTrkInJet_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(MSV_normdist, m_MSV_normdist_incl, m_MSV_normdist_b, m_MSV_normdist_c, m_MSV_normdist_l, m_MSV_normdist_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(MSV_nvsec, m_MSV_nvsec_incl, m_MSV_nvsec_b, m_MSV_nvsec_c, m_MSV_nvsec_l, m_MSV_nvsec_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(MSV_N2Tpair, m_MSV_N2Tpair_incl, m_MSV_N2Tpair_b, m_MSV_N2Tpair_c, m_MSV_N2Tpair_l, m_MSV_N2Tpair_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(MSV_energyTrkInJet/GeV, m_MSV_energyTrkInJet_incl, m_MSV_energyTrkInJet_b, m_MSV_energyTrkInJet_c, m_MSV_energyTrkInJet_l, m_MSV_energyTrkInJet_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(MSV_normdist, m_MSV_normdist_incl, m_MSV_normdist_b, m_MSV_normdist_c, m_MSV_normdist_l, m_MSV_normdist_muon, truth_label, has_muon, event); if(!m_isData){ - BTaggingValidationPlots::fillHistoWithTruthCases(MSV_purity, m_MSV_purity_incl, m_MSV_purity_b, m_MSV_purity_c, m_MSV_purity_l, m_MSV_purity_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(MSV_purity, m_MSV_purity_incl, m_MSV_purity_b, m_MSV_purity_c, m_MSV_purity_l, m_MSV_purity_muon, truth_label, has_muon, event); } - BTaggingValidationPlots::fillHistoWithTruthCases(MSV_p4_sum_tracks_mass/GeV, m_MSV_vtx_mass_incl, m_MSV_vtx_mass_b, m_MSV_vtx_mass_c, m_MSV_vtx_mass_l, m_MSV_vtx_mass_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_N2Tpair, m_JetFitter_N2Tpair_incl, m_JetFitter_N2Tpair_b, m_JetFitter_N2Tpair_c, m_JetFitter_N2Tpair_l, m_JetFitter_N2Tpair_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_nVTX, m_JetFitter_nVTX_incl, m_JetFitter_nVTX_b, m_JetFitter_nVTX_c, m_JetFitter_nVTX_l, m_JetFitter_nVTX_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_nSingleTracks, m_JetFitter_nSingleTracks_incl, m_JetFitter_nSingleTracks_b, m_JetFitter_nSingleTracks_c, m_JetFitter_nSingleTracks_l, m_JetFitter_nSingleTracks_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_nTracksAtVtx, m_JetFitter_nTracksAtVtx_incl, m_JetFitter_nTracksAtVtx_b, m_JetFitter_nTracksAtVtx_c, m_JetFitter_nTracksAtVtx_l, m_JetFitter_nTracksAtVtx_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_mass/GeV, m_JetFitter_mass_incl, m_JetFitter_mass_b, m_JetFitter_mass_c, m_JetFitter_mass_l, m_JetFitter_mass_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_energyFraction, m_JetFitter_energyFraction_incl, m_JetFitter_energyFraction_b, m_JetFitter_energyFraction_c, m_JetFitter_energyFraction_l, m_JetFitter_energyFraction_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_significance3d, m_JetFitter_significance3d_incl, m_JetFitter_significance3d_b, m_JetFitter_significance3d_c, m_JetFitter_significance3d_l, m_JetFitter_significance3d_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(MSV_p4_sum_tracks_mass/GeV, m_MSV_vtx_mass_incl, m_MSV_vtx_mass_b, m_MSV_vtx_mass_c, m_MSV_vtx_mass_l, m_MSV_vtx_mass_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_N2Tpair, m_JetFitter_N2Tpair_incl, m_JetFitter_N2Tpair_b, m_JetFitter_N2Tpair_c, m_JetFitter_N2Tpair_l, m_JetFitter_N2Tpair_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_nVTX, m_JetFitter_nVTX_incl, m_JetFitter_nVTX_b, m_JetFitter_nVTX_c, m_JetFitter_nVTX_l, m_JetFitter_nVTX_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_nSingleTracks, m_JetFitter_nSingleTracks_incl, m_JetFitter_nSingleTracks_b, m_JetFitter_nSingleTracks_c, m_JetFitter_nSingleTracks_l, m_JetFitter_nSingleTracks_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_nTracksAtVtx, m_JetFitter_nTracksAtVtx_incl, m_JetFitter_nTracksAtVtx_b, m_JetFitter_nTracksAtVtx_c, m_JetFitter_nTracksAtVtx_l, m_JetFitter_nTracksAtVtx_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_mass/GeV, m_JetFitter_mass_incl, m_JetFitter_mass_b, m_JetFitter_mass_c, m_JetFitter_mass_l, m_JetFitter_mass_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_energyFraction, m_JetFitter_energyFraction_incl, m_JetFitter_energyFraction_b, m_JetFitter_energyFraction_c, m_JetFitter_energyFraction_l, m_JetFitter_energyFraction_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_significance3d, m_JetFitter_significance3d_incl, m_JetFitter_significance3d_b, m_JetFitter_significance3d_c, m_JetFitter_significance3d_l, m_JetFitter_significance3d_muon, truth_label, has_muon, event); if(!m_isData){ - BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_purity, m_JetFitter_purity_incl, m_JetFitter_purity_b, m_JetFitter_purity_c, m_JetFitter_purity_l, m_JetFitter_purity_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(JetFitter_purity, m_JetFitter_purity_incl, m_JetFitter_purity_b, m_JetFitter_purity_c, m_JetFitter_purity_l, m_JetFitter_purity_muon, truth_label, has_muon, event); } // // fill the SV varaibles for the different jet labels if(!m_isData && truth_label == 5) { // vs pT and vs eta - m_SV1_masssvx_vs_pT_b->Fill(jet->pt()/GeV, SV1_masssvx/GeV); - m_SV1_masssvx_vs_eta_b->Fill(jet->eta(), SV1_masssvx/GeV); - m_SV1_N2Tpair_vs_pT_b->Fill(jet->pt()/GeV, SV1_N2Tpair); - m_SV1_N2Tpair_vs_eta_b->Fill(jet->eta(), SV1_N2Tpair); - m_SV1_efracsvx_vs_pT_b->Fill(jet->pt()/GeV, SV1_efracsvx); - m_SV1_efracsvx_vs_eta_b->Fill(jet->eta(), SV1_efracsvx); - m_SV1_deltaR_vs_pT_b->Fill(jet->pt()/GeV, SV1_deltaR); - m_SV1_deltaR_vs_eta_b->Fill(jet->eta(), SV1_deltaR); + m_SV1_masssvx_vs_pT_b->Fill(jet->pt()/GeV, SV1_masssvx/GeV), event->beamSpotWeight(); + m_SV1_masssvx_vs_eta_b->Fill(jet->eta(), SV1_masssvx/GeV, event->beamSpotWeight()); + m_SV1_N2Tpair_vs_pT_b->Fill(jet->pt()/GeV, SV1_N2Tpair, event->beamSpotWeight()); + m_SV1_N2Tpair_vs_eta_b->Fill(jet->eta(), SV1_N2Tpair, event->beamSpotWeight()); + m_SV1_efracsvx_vs_pT_b->Fill(jet->pt()/GeV, SV1_efracsvx, event->beamSpotWeight()); + m_SV1_efracsvx_vs_eta_b->Fill(jet->eta(), SV1_efracsvx, event->beamSpotWeight()); + m_SV1_deltaR_vs_pT_b->Fill(jet->pt()/GeV, SV1_deltaR, event->beamSpotWeight()); + m_SV1_deltaR_vs_eta_b->Fill(jet->eta(), SV1_deltaR, event->beamSpotWeight()); } else if(!m_isData && truth_label == 4) { // vs pT and vs eta - m_SV1_masssvx_vs_pT_c->Fill(jet->pt()/GeV, SV1_masssvx/GeV); - m_SV1_masssvx_vs_eta_c->Fill(jet->eta(), SV1_masssvx/GeV); - m_SV1_N2Tpair_vs_pT_c->Fill(jet->pt()/GeV, SV1_N2Tpair); - m_SV1_N2Tpair_vs_eta_c->Fill(jet->eta(), SV1_N2Tpair); - m_SV1_efracsvx_vs_pT_c->Fill(jet->pt()/GeV, SV1_efracsvx); - m_SV1_efracsvx_vs_eta_c->Fill(jet->eta(), SV1_efracsvx); - m_SV1_deltaR_vs_pT_c->Fill(jet->pt()/GeV, SV1_deltaR); - m_SV1_deltaR_vs_eta_c->Fill(jet->eta(), SV1_deltaR); + m_SV1_masssvx_vs_pT_c->Fill(jet->pt()/GeV, SV1_masssvx/GeV, event->beamSpotWeight()); + m_SV1_masssvx_vs_eta_c->Fill(jet->eta(), SV1_masssvx/GeV, event->beamSpotWeight()); + m_SV1_N2Tpair_vs_pT_c->Fill(jet->pt()/GeV, SV1_N2Tpair, event->beamSpotWeight()); + m_SV1_N2Tpair_vs_eta_c->Fill(jet->eta(), SV1_N2Tpair, event->beamSpotWeight()); + m_SV1_efracsvx_vs_pT_c->Fill(jet->pt()/GeV, SV1_efracsvx, event->beamSpotWeight()); + m_SV1_efracsvx_vs_eta_c->Fill(jet->eta(), SV1_efracsvx, event->beamSpotWeight()); + m_SV1_deltaR_vs_pT_c->Fill(jet->pt()/GeV, SV1_deltaR, event->beamSpotWeight()); + m_SV1_deltaR_vs_eta_c->Fill(jet->eta(), SV1_deltaR, event->beamSpotWeight()); } else if(!m_isData && truth_label == 0) { // vs pT and vs eta - m_SV1_masssvx_vs_pT_l->Fill(jet->pt()/GeV, SV1_masssvx/GeV); - m_SV1_masssvx_vs_eta_l->Fill(jet->eta(), SV1_masssvx/GeV); - m_SV1_N2Tpair_vs_pT_l->Fill(jet->pt()/GeV, SV1_N2Tpair); - m_SV1_N2Tpair_vs_eta_l->Fill(jet->eta(), SV1_N2Tpair); - m_SV1_efracsvx_vs_pT_l->Fill(jet->pt()/GeV, SV1_efracsvx); - m_SV1_efracsvx_vs_eta_l->Fill(jet->eta(), SV1_efracsvx); - m_SV1_deltaR_vs_pT_l->Fill(jet->pt()/GeV, SV1_deltaR); - m_SV1_deltaR_vs_eta_l->Fill(jet->eta(), SV1_deltaR); + m_SV1_masssvx_vs_pT_l->Fill(jet->pt()/GeV, SV1_masssvx/GeV, event->beamSpotWeight()); + m_SV1_masssvx_vs_eta_l->Fill(jet->eta(), SV1_masssvx/GeV, event->beamSpotWeight()); + m_SV1_N2Tpair_vs_pT_l->Fill(jet->pt()/GeV, SV1_N2Tpair, event->beamSpotWeight()); + m_SV1_N2Tpair_vs_eta_l->Fill(jet->eta(), SV1_N2Tpair, event->beamSpotWeight()); + m_SV1_efracsvx_vs_pT_l->Fill(jet->pt()/GeV, SV1_efracsvx, event->beamSpotWeight()); + m_SV1_efracsvx_vs_eta_l->Fill(jet->eta(), SV1_efracsvx, event->beamSpotWeight()); + m_SV1_deltaR_vs_pT_l->Fill(jet->pt()/GeV, SV1_deltaR, event->beamSpotWeight()); + m_SV1_deltaR_vs_eta_l->Fill(jet->eta(), SV1_deltaR, event->beamSpotWeight()); } @@ -1411,7 +1411,7 @@ namespace JetTagDQA{ // a fill method for discriminant related vars - void BTaggingValidationPlots::fillDiscriminantVariables(const xAOD::BTagging* btag, const xAOD::Jet* jet, const double& jet_Lxy, const int& truth_label, const bool& has_muon, const bool& onZprime, std::map<std::string, int>& nJetsThatPassedWPCuts){ + void BTaggingValidationPlots::fillDiscriminantVariables(const xAOD::BTagging* btag, const xAOD::Jet* jet, const double& jet_Lxy, const int& truth_label, const bool& has_muon, const bool& onZprime, std::map<std::string, int>& nJetsThatPassedWPCuts, const xAOD::EventInfo* event){ //// IPxD variables @@ -1420,10 +1420,10 @@ namespace JetTagDQA{ std::vector<int> IP2D_gradeOfTracks = btag->auxdata<std::vector<int> >("IP2D_gradeOfTracks"); // loop over the elements (i.e. tracks) and fill the histogram for( unsigned int i=0; i<IP3D_gradeOfTracks.size(); i++){ - BTaggingValidationPlots::fillHistoWithTruthCases(IP3D_gradeOfTracks.at(i), m_IP3D_gradeOfTracks_incl, m_IP3D_gradeOfTracks_b, m_IP3D_gradeOfTracks_c, m_IP3D_gradeOfTracks_l, m_IP3D_gradeOfTracks_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(IP3D_gradeOfTracks.at(i), m_IP3D_gradeOfTracks_incl, m_IP3D_gradeOfTracks_b, m_IP3D_gradeOfTracks_c, m_IP3D_gradeOfTracks_l, m_IP3D_gradeOfTracks_muon, truth_label, has_muon, event); } for( unsigned int i=0; i<IP2D_gradeOfTracks.size(); i++){ - BTaggingValidationPlots::fillHistoWithTruthCases(IP2D_gradeOfTracks.at(i), m_IP2D_gradeOfTracks_incl, m_IP2D_gradeOfTracks_b, m_IP2D_gradeOfTracks_c, m_IP2D_gradeOfTracks_l, m_IP2D_gradeOfTracks_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(IP2D_gradeOfTracks.at(i), m_IP2D_gradeOfTracks_incl, m_IP2D_gradeOfTracks_b, m_IP2D_gradeOfTracks_c, m_IP2D_gradeOfTracks_l, m_IP2D_gradeOfTracks_muon, truth_label, has_muon, event); } // d0, z0 and significances @@ -1432,10 +1432,10 @@ namespace JetTagDQA{ std::vector<float> tmpD0sig = btag->auxdata<std::vector<float> >("IP3D_sigD0wrtPVofTracks"); std::vector<float> tmpZ0sig = btag->auxdata<std::vector<float> >("IP3D_sigZ0wrtPVofTracks"); // loop over the elements (i.e. tracks) and fill the histogram - for( unsigned int i=0; i<tmpD0 .size(); i++) m_tmpD0 ->Fill(tmpD0.at(i)); - for( unsigned int i=0; i<tmpZ0 .size(); i++) m_tmpZ0 ->Fill(tmpZ0.at(i)); - for( unsigned int i=0; i<tmpD0sig.size(); i++) m_tmpD0sig->Fill(tmpD0sig.at(i)); - for( unsigned int i=0; i<tmpZ0sig.size(); i++) m_tmpZ0sig->Fill(tmpZ0sig.at(i)); + for( unsigned int i=0; i<tmpD0 .size(); i++) m_tmpD0 ->Fill(tmpD0.at(i), event->beamSpotWeight()); + for( unsigned int i=0; i<tmpZ0 .size(); i++) m_tmpZ0 ->Fill(tmpZ0.at(i), event->beamSpotWeight()); + for( unsigned int i=0; i<tmpD0sig.size(); i++) m_tmpD0sig->Fill(tmpD0sig.at(i), event->beamSpotWeight()); + for( unsigned int i=0; i<tmpZ0sig.size(); i++) m_tmpZ0sig->Fill(tmpZ0sig.at(i), event->beamSpotWeight()); // weight b and weight u of tracks // IP3D @@ -1448,13 +1448,13 @@ namespace JetTagDQA{ std::vector<float> IP2D_weightUofTracks = btag->auxdata<std::vector<float> >("IP2D_weightUofTracks"); // loop over the elements (i.e. tracks) and fill the histogram // IP3D - for( unsigned int i=0; i<IP3D_weightBofTracks.size(); i++) m_IP3D_weightBofTracks->Fill(IP3D_weightBofTracks.at(i)); - for( unsigned int i=0; i<IP3D_weightCofTracks.size(); i++) m_IP3D_weightCofTracks->Fill(IP3D_weightCofTracks.at(i)); - for( unsigned int i=0; i<IP3D_weightUofTracks.size(); i++) m_IP3D_weightUofTracks->Fill(IP3D_weightUofTracks.at(i)); + for( unsigned int i=0; i<IP3D_weightBofTracks.size(); i++) m_IP3D_weightBofTracks->Fill(IP3D_weightBofTracks.at(i), event->beamSpotWeight()); + for( unsigned int i=0; i<IP3D_weightCofTracks.size(); i++) m_IP3D_weightCofTracks->Fill(IP3D_weightCofTracks.at(i), event->beamSpotWeight()); + for( unsigned int i=0; i<IP3D_weightUofTracks.size(); i++) m_IP3D_weightUofTracks->Fill(IP3D_weightUofTracks.at(i), event->beamSpotWeight()); // IP2D - for( unsigned int i=0; i<IP2D_weightBofTracks.size(); i++) m_IP2D_weightBofTracks->Fill(IP2D_weightBofTracks.at(i)); - for( unsigned int i=0; i<IP2D_weightCofTracks.size(); i++) m_IP2D_weightCofTracks->Fill(IP2D_weightCofTracks.at(i)); - for( unsigned int i=0; i<IP2D_weightUofTracks.size(); i++) m_IP2D_weightUofTracks->Fill(IP2D_weightUofTracks.at(i)); + for( unsigned int i=0; i<IP2D_weightBofTracks.size(); i++) m_IP2D_weightBofTracks->Fill(IP2D_weightBofTracks.at(i), event->beamSpotWeight()); + for( unsigned int i=0; i<IP2D_weightCofTracks.size(); i++) m_IP2D_weightCofTracks->Fill(IP2D_weightCofTracks.at(i), event->beamSpotWeight()); + for( unsigned int i=0; i<IP2D_weightUofTracks.size(); i++) m_IP2D_weightUofTracks->Fill(IP2D_weightUofTracks.at(i), event->beamSpotWeight()); // number of IP2D & IP3D tracks @@ -1465,13 +1465,13 @@ namespace JetTagDQA{ try{ nIP3DTracks = btag->nIP3D_TrackParticles(); } catch(std::exception& exception){ nIP3DTracks = -1; } - BTaggingValidationPlots::fillHistoWithTruthCases(nIP2DTracks, m_IP2D_nTracks_incl, m_IP2D_nTracks_b, m_IP2D_nTracks_c, m_IP2D_nTracks_l, m_IP2D_nTracks_muon, truth_label, has_muon); - BTaggingValidationPlots::fillHistoWithTruthCases(nIP3DTracks, m_IP3D_nTracks_incl, m_IP3D_nTracks_b, m_IP3D_nTracks_c, m_IP3D_nTracks_l, m_IP3D_nTracks_muon, truth_label, has_muon); + BTaggingValidationPlots::fillHistoWithTruthCases(nIP2DTracks, m_IP2D_nTracks_incl, m_IP2D_nTracks_b, m_IP2D_nTracks_c, m_IP2D_nTracks_l, m_IP2D_nTracks_muon, truth_label, has_muon, event); + BTaggingValidationPlots::fillHistoWithTruthCases(nIP3DTracks, m_IP3D_nTracks_incl, m_IP3D_nTracks_b, m_IP3D_nTracks_c, m_IP3D_nTracks_l, m_IP3D_nTracks_muon, truth_label, has_muon, event); // pb, pu, pc - m_IP3D_pb->Fill(btag->IP3D_pb()); - m_IP3D_pc->Fill(btag->IP3D_pc()); - m_IP3D_pu->Fill(btag->IP3D_pu()); + m_IP3D_pb->Fill(btag->IP3D_pb(), event->beamSpotWeight()); + m_IP3D_pc->Fill(btag->IP3D_pc(), event->beamSpotWeight()); + m_IP3D_pu->Fill(btag->IP3D_pu(), event->beamSpotWeight()); //// RNNIP variables @@ -1484,9 +1484,9 @@ namespace JetTagDQA{ catch(std::exception& exception){ RNNIP_pu = -1; } try{ RNNIP_pc = btag->auxdata<ftagfloat_t>("rnnip_pc"); } catch(std::exception& exception){ RNNIP_pc = -1; } - m_RNNIP_pb->Fill(RNNIP_pb); - m_RNNIP_pu->Fill(RNNIP_pu); - m_RNNIP_pc->Fill(RNNIP_pc); + m_RNNIP_pb->Fill(RNNIP_pb, event->beamSpotWeight()); + m_RNNIP_pu->Fill(RNNIP_pu, event->beamSpotWeight()); + m_RNNIP_pc->Fill(RNNIP_pc, event->beamSpotWeight()); double weight_RNNIP = log( RNNIP_pb / ( RNNIP_pc * m_RNNIP_fc + RNNIP_pu * (1-m_RNNIP_fc) ) ); @@ -1499,13 +1499,13 @@ namespace JetTagDQA{ // catch(std::exception& exception){ nGTinSvx0 = -1; } try{ btag->taggerInfo(nGTinSV1, xAOD::SV1_NGTinSvx); } catch(std::exception& exception){ nGTinSV1 = -1; } - // m_SV0_NGTinSvx->Fill(nGTinSvx0); - BTaggingValidationPlots::fillHistoWithTruthCases(nGTinSV1, m_nGTinSV1_incl, m_nGTinSV1_b, m_nGTinSV1_c, m_nGTinSV1_l, m_nGTinSV1_muon, truth_label, has_muon); + // m_SV0_NGTinSvx->Fill(nGTinSvx0, event->beamSpotWeight()); + BTaggingValidationPlots::fillHistoWithTruthCases(nGTinSV1, m_nGTinSV1_incl, m_nGTinSV1_b, m_nGTinSV1_c, m_nGTinSV1_l, m_nGTinSV1_muon, truth_label, has_muon, event); // pb, pu, pc - m_SV1_pb->Fill(btag->SV1_pb()); - m_SV1_pc->Fill(btag->SV1_pc()); - m_SV1_pu->Fill(btag->SV1_pu()); + m_SV1_pb->Fill(btag->SV1_pb(), event->beamSpotWeight()); + m_SV1_pc->Fill(btag->SV1_pc(), event->beamSpotWeight()); + m_SV1_pu->Fill(btag->SV1_pu(), event->beamSpotWeight()); //// high level tagger variables @@ -1518,9 +1518,9 @@ namespace JetTagDQA{ double DL1_pb = btag->auxdata<ftagfloat_t>("DL1_pb"); double DL1_pc = btag->auxdata<ftagfloat_t>("DL1_pc"); double DL1_pu = btag->auxdata<ftagfloat_t>("DL1_pu"); - m_DL1_pb->Fill(DL1_pb); - m_DL1_pu->Fill(DL1_pu); - m_DL1_pc->Fill(DL1_pc); + m_DL1_pb->Fill(DL1_pb, event->beamSpotWeight()); + m_DL1_pu->Fill(DL1_pu, event->beamSpotWeight()); + m_DL1_pc->Fill(DL1_pc, event->beamSpotWeight()); double DL1r_pb, DL1r_pu, DL1r_pc; try{ DL1r_pb = btag->auxdata<ftagfloat_t>("DL1r_pb"); } @@ -1529,9 +1529,9 @@ namespace JetTagDQA{ catch(std::exception& exception){ DL1r_pu = -1; } try{ DL1r_pc = btag->auxdata<ftagfloat_t>("DL1r_pc"); } catch(std::exception& exception){ DL1r_pc = -1; } - m_DL1r_pb->Fill(DL1r_pb); - m_DL1r_pu->Fill(DL1r_pu); - m_DL1r_pc->Fill(DL1r_pc); + m_DL1r_pb->Fill(DL1r_pb, event->beamSpotWeight()); + m_DL1r_pu->Fill(DL1r_pu, event->beamSpotWeight()); + m_DL1r_pc->Fill(DL1r_pc, event->beamSpotWeight()); // calculate the DL1 discriminant value double weight_DL1 = log( DL1_pb / ( DL1_pc * m_DL1_fc + DL1_pu * (1-m_DL1_fc) ) ); @@ -1545,36 +1545,36 @@ namespace JetTagDQA{ // IP3D bool pass_nTracksCut_IP3D = nIP3DTracks > 0; - BTaggingValidationPlots::fillDiscriminantHistograms("IP3D_", btag->IP3D_loglikelihoodratio(), m_IP3D_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_IP3D, jet->pt(), jet_Lxy, onZprime); + BTaggingValidationPlots::fillDiscriminantHistograms("IP3D_", btag->IP3D_loglikelihoodratio(), m_IP3D_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_IP3D, jet->pt(), jet_Lxy, onZprime, event); // IP2D bool pass_nTracksCut_IP2D = nIP2DTracks > 0; - BTaggingValidationPlots::fillDiscriminantHistograms("IP2D_", btag->IP2D_loglikelihoodratio(), m_IP2D_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_IP2D, jet->pt(), jet_Lxy, onZprime); + BTaggingValidationPlots::fillDiscriminantHistograms("IP2D_", btag->IP2D_loglikelihoodratio(), m_IP2D_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_IP2D, jet->pt(), jet_Lxy, onZprime, event); // RNNIP bool pass_nTracksCut_RNNIP = nIP3DTracks > 0; - BTaggingValidationPlots::fillDiscriminantHistograms("RNNIP_", weight_RNNIP, m_RNNIP_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_RNNIP, jet->pt(), jet_Lxy, onZprime); + BTaggingValidationPlots::fillDiscriminantHistograms("RNNIP_", weight_RNNIP, m_RNNIP_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_RNNIP, jet->pt(), jet_Lxy, onZprime, event); // SV1 bool pass_nTracksCut_SV1 = nGTinSV1 > 0; - BTaggingValidationPlots::fillDiscriminantHistograms("SV1_", btag->SV1_loglikelihoodratio(), m_SV1_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_SV1, jet->pt(), jet_Lxy, onZprime); + BTaggingValidationPlots::fillDiscriminantHistograms("SV1_", btag->SV1_loglikelihoodratio(), m_SV1_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_SV1, jet->pt(), jet_Lxy, onZprime, event); // IP3DSV1 bool pass_nTracksCut_IP3DSV1 = nGTinSV1 > 0 && nIP3DTracks > 0; - BTaggingValidationPlots::fillDiscriminantHistograms("IP3DSV1_", btag->SV1plusIP3D_discriminant(), m_IP3DSV1_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_IP3DSV1, jet->pt(), jet_Lxy, onZprime); + BTaggingValidationPlots::fillDiscriminantHistograms("IP3DSV1_", btag->SV1plusIP3D_discriminant(), m_IP3DSV1_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_IP3DSV1, jet->pt(), jet_Lxy, onZprime, event); // JetFitter bool pass_nTracksCut_JetFitter = nGTinSV1 > 0 && nIP3DTracks > 0; - BTaggingValidationPlots::fillDiscriminantHistograms("JetFitter_", btag->JetFitter_loglikelihoodratio(), m_JetFitter_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_JetFitter, jet->pt(), jet_Lxy, onZprime); + BTaggingValidationPlots::fillDiscriminantHistograms("JetFitter_", btag->JetFitter_loglikelihoodratio(), m_JetFitter_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_JetFitter, jet->pt(), jet_Lxy, onZprime, event); // MV taggers bool pass_nTracksCut_MV = nGTinSV1 > 0 && nIP3DTracks > 0; - BTaggingValidationPlots::fillDiscriminantHistograms("MV2c10_", weight_MV2c10, m_MV2c10_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_MV, jet->pt(), jet_Lxy, onZprime); + BTaggingValidationPlots::fillDiscriminantHistograms("MV2c10_", weight_MV2c10, m_MV2c10_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_MV, jet->pt(), jet_Lxy, onZprime, event); // DL1 taggers bool pass_nTracksCut_DL1 = nGTinSV1 > 0 && nIP3DTracks > 0; - BTaggingValidationPlots::fillDiscriminantHistograms("DL1_", weight_DL1, m_DL1_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_DL1, jet->pt(), jet_Lxy, onZprime); - BTaggingValidationPlots::fillDiscriminantHistograms("DL1r_", weight_DL1r, m_DL1r_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_DL1, jet->pt(), jet_Lxy, onZprime); + BTaggingValidationPlots::fillDiscriminantHistograms("DL1_", weight_DL1, m_DL1_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_DL1, jet->pt(), jet_Lxy, onZprime, event); + BTaggingValidationPlots::fillDiscriminantHistograms("DL1r_", weight_DL1r, m_DL1r_workingPoints, truth_label, hist_iter, label_iter, pass_nTracksCut_DL1, jet->pt(), jet_Lxy, onZprime, event); } } } @@ -1685,7 +1685,7 @@ namespace JetTagDQA{ } } - void BTaggingValidationPlots::fillNJetsThatPassedWPCutsHistos(std::map<std::string, int>& nJetsThatPassedWPCuts){ + void BTaggingValidationPlots::fillNJetsThatPassedWPCutsHistos(std::map<std::string, int>& nJetsThatPassedWPCuts, const xAOD::EventInfo* event){ // loop over the taggers for(std::vector<std::string>::const_iterator tag_iter = m_taggers.begin(); tag_iter != m_taggers.end(); ++tag_iter){ // get the right working points @@ -1703,7 +1703,7 @@ namespace JetTagDQA{ for(std::map<std::string, double>::const_iterator working_points_iter = workingPoints.begin(); working_points_iter != workingPoints.end(); ++working_points_iter){ std::string name = "nJetsThatPassedWPCuts_" + *tag_iter + "_" + working_points_iter->first; // fill the histo - m_nJetsThatPassedWPCutsHistos.at(name)->Fill( nJetsThatPassedWPCuts.at(name) ); + m_nJetsThatPassedWPCutsHistos.at(name)->Fill( nJetsThatPassedWPCuts.at(name), event->beamSpotWeight() ); } } } diff --git a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.h b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.h index 3dae44a66c6dbb3dc5b466217c7c454d2e95ffa6..2d2a02bde09f5437f3b68f159a75eaf77908e2c7 100644 --- a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.h +++ b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/BTaggingValidationPlots.h @@ -17,6 +17,7 @@ #include "xAODMuon/Muon.h" #include "xAODMuon/MuonContainer.h" //#include "GAFlavourLabel.h" +#include "xAODEventInfo/EventInfo.h" #include "InDetTrackSystematicsTools/InDetTrackTruthOriginDefs.h" @@ -29,18 +30,18 @@ namespace JetTagDQA{ BTaggingValidationPlots(PlotBase* pParent, std::string sDir, std::string sParticleType); // fill methods - void fillJetKinVars(const xAOD::Jet* jet, const int& truth_label, const bool& onZprime); - void fillDiscriminantVariables(const xAOD::BTagging* btag, const xAOD::Jet* jet, const double& jet_Lxy, const int& truth_label, const bool& has_muon, const bool& onZprime, std::map<std::string, int>& nJetsThatPassedWPCuts); - void fillMultiplicities(const unsigned int& nJets, const unsigned int& nTracks, const int& nPrimVtx, const unsigned int& nTracksPrimVtx, const unsigned int& nJetsWithMuon, const unsigned int& nJetsWithSV, std::map<std::string, int>& nJetsThatPassedWPCuts); - void fillPVVariables(const double& PV_x, const double& PV_y, const double& PV_z); - void fillOther(const xAOD::Jet* jet, const xAOD::BTagging* btag, bool& contains_muon, double& jet_Lxy, const int& truth_label); - void fillTrackVariables(const xAOD::Jet* jet, const xAOD::BTagging* btag, const xAOD::Vertex *myVertex, std::map<const xAOD::TrackParticle*, int> track_truth_associations, const bool& contains_muon, const int& truth_label, int& num_HF_tracks_in_jet); - void fillSVVariables(const xAOD::Jet* jet, const xAOD::BTagging* btag, std::map<const xAOD::TrackParticle*, int> track_truth_associations, const bool& contains_muon, const int& truth_label, const int& num_HF_tracks_in_jet, bool& contains_SV); + void fillJetKinVars(const xAOD::Jet* jet, const int& truth_label, const bool& onZprime, const xAOD::EventInfo* event); + void fillDiscriminantVariables(const xAOD::BTagging* btag, const xAOD::Jet* jet, const double& jet_Lxy, const int& truth_label, const bool& has_muon, const bool& onZprime, std::map<std::string, int>& nJetsThatPassedWPCuts, const xAOD::EventInfo* event); + void fillMultiplicities(const unsigned int& nJets, const unsigned int& nTracks, const int& nPrimVtx, const unsigned int& nTracksPrimVtx, const unsigned int& nJetsWithMuon, const unsigned int& nJetsWithSV, std::map<std::string, int>& nJetsThatPassedWPCuts, const xAOD::EventInfo* event); + void fillPVVariables(const double& PV_x, const double& PV_y, const double& PV_z, const xAOD::EventInfo* event); + void fillOther(const xAOD::Jet* jet, const xAOD::BTagging* btag, bool& contains_muon, double& jet_Lxy, const int& truth_label, const xAOD::EventInfo* event); + void fillTrackVariables(const xAOD::Jet* jet, const xAOD::BTagging* btag, const xAOD::Vertex *myVertex, std::map<const xAOD::TrackParticle*, int> track_truth_associations, const bool& contains_muon, const int& truth_label, int& num_HF_tracks_in_jet, const xAOD::EventInfo* event); + void fillSVVariables(const xAOD::Jet* jet, const xAOD::BTagging* btag, std::map<const xAOD::TrackParticle*, int> track_truth_associations, const bool& contains_muon, const int& truth_label, const int& num_HF_tracks_in_jet, bool& contains_SV, const xAOD::EventInfo* event); void bookNJetsThatPassedWPCutsHistos(); void initializeNJetsThatPassedWPCutsMap(std::map<std::string, int>& nJetsThatPassedWPCuts); void updateNJetsThatPassedWPCutsMap(std::map<std::string, int>& nJetsThatPassedWPCuts, const double& discr_IP3D, const double& discr_IP2D, const double& discr_RNNIP, const double& discr_SV1, const double& discr_IP3DSV1, const double& discr_JetFitter, const double& discr_MV2c10, const double& discr_DL1, const double& discr_DL1r); - void fillNJetsThatPassedWPCutsHistos(std::map<std::string, int>& nJetsThatPassedWPCuts); + void fillNJetsThatPassedWPCutsHistos(std::map<std::string, int>& nJetsThatPassedWPCuts, const xAOD::EventInfo* event); void makeEfficiencyVsPtPlot(TH1* hReco, TProfile* pEff); void makeEfficiencyPlot(TH1* hReco, TProfile* pEff); @@ -642,10 +643,10 @@ namespace JetTagDQA{ TH1* bookHistogram(std::string histo_name, std::string var_name, std::string part = "", std::string prefix = ""); TProfile* bookProfile(std::string histo_name, std::string var_name, std::string part = "", std::string prefix = ""); int getTrackHits(const xAOD::TrackParticle& part, xAOD::SummaryType info); - void fillDiscriminantHistograms(const std::string& tagger_name, const double& discriminant_value, const std::map<std::string, double>& working_points, const int& truth_label, std::map<std::string, TH1*>::const_iterator hist_iter, std::map<std::string, int>::const_iterator label_iter, const bool& pass_nTracksCut, const double& jet_pT, const double& jet_Lxy, const bool& onZprime); + void fillDiscriminantHistograms(const std::string& tagger_name, const double& discriminant_value, const std::map<std::string, double>& working_points, const int& truth_label, std::map<std::string, TH1*>::const_iterator hist_iter, std::map<std::string, int>::const_iterator label_iter, const bool& pass_nTracksCut, const double& jet_pT, const double& jet_Lxy, const bool& onZprime, const xAOD::EventInfo* event); void bookDiscriminantVsPTAndLxyHistograms(const std::string& tagger_name, const std::map<std::string, double>& workingPoints, const bool& isOldTagger, std::map<std::string, int>::const_iterator label_iter, const std::string& m_sParticleType); template <class T> - void fillHistoWithTruthCases(T value, TH1* histo_incl, TH1* histo_b, TH1* histo_c, TH1* histo_l, TH1* histo_muon, const int& truth_label, const bool& has_muon); + void fillHistoWithTruthCases(T value, TH1* histo_incl, TH1* histo_b, TH1* histo_c, TH1* histo_l, TH1* histo_muon, const int& truth_label, const bool& has_muon, const xAOD::EventInfo* event); }; diff --git a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/PhysValBTag.cxx b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/PhysValBTag.cxx index 16b068ae5a5d2f72b80072c1bd361f5138aebdc7..bd90b848cdd2a8fa935f711907999bbda3bd8ede 100644 --- a/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/PhysValBTag.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagValidation/JetTagDQA/src/PhysValBTag.cxx @@ -153,12 +153,14 @@ namespace JetTagDQA { ++m_nevents; //std::cout << "Number of proccessed events = " << m_nevents << std::endl; + // event info + const xAOD::EventInfo* event(0); + ATH_CHECK(evtStore()->retrieve(event, "EventInfo")); + // determine if the sample is ttbar or Zprime (on the first event, where the jetPtCut is still initial -1) if(m_jetPtCut < 0){ // get the DSID - const xAOD::EventInfo* eventInfo(0); - ATH_CHECK(evtStore()->retrieve(eventInfo, "EventInfo")); - int dsid = eventInfo->mcChannelNumber(); + int dsid = event->mcChannelNumber(); // check if it is a ttbar or Zprime sample if(dsid == 410000){ @@ -249,14 +251,14 @@ namespace JetTagDQA { } // fill the jet related histograms - (plot_i->second).fillJetKinVars(jet, truth_label, m_onZprime); + (plot_i->second).fillJetKinVars(jet, truth_label, m_onZprime, event); // fill the jet, btag & vertex related plots if (btag){ // fill other variables bool contains_muon; double jet_Lxy = -1; - (plot_i->second).fillOther(jet, btag, contains_muon, jet_Lxy, truth_label); + (plot_i->second).fillOther(jet, btag, contains_muon, jet_Lxy, truth_label, event); if(contains_muon) nJets_containing_moun++; // get the track to truth associations @@ -264,20 +266,20 @@ namespace JetTagDQA { // fill track related variables int num_HF_tracks_in_jet; - (plot_i->second).fillTrackVariables(jet, btag, myVertex, track_truth_associations, contains_muon, truth_label, num_HF_tracks_in_jet); + (plot_i->second).fillTrackVariables(jet, btag, myVertex, track_truth_associations, contains_muon, truth_label, num_HF_tracks_in_jet, event); // fill SV related vars bool contains_SV; - (plot_i->second).fillSVVariables(jet, btag, track_truth_associations, contains_muon, truth_label, num_HF_tracks_in_jet, contains_SV); + (plot_i->second).fillSVVariables(jet, btag, track_truth_associations, contains_muon, truth_label, num_HF_tracks_in_jet, contains_SV, event); if(contains_SV) nJets_containing_SV++; // fill discriminant related vars - (plot_i->second).fillDiscriminantVariables(btag, jet, jet_Lxy, truth_label, contains_muon, m_onZprime, nJetsThatPassedWPCuts); + (plot_i->second).fillDiscriminantVariables(btag, jet, jet_Lxy, truth_label, contains_muon, m_onZprime, nJetsThatPassedWPCuts, event); } } // fill multiplicities - (plot_i->second).fillMultiplicities(nJets_withCut, tracks->size(), npv, myVertex->nTrackParticles(), nJets_containing_moun, nJets_containing_SV, nJetsThatPassedWPCuts); + (plot_i->second).fillMultiplicities(nJets_withCut, tracks->size(), npv, myVertex->nTrackParticles(), nJets_containing_moun, nJets_containing_SV, nJetsThatPassedWPCuts, event); // fill PV variables - (plot_i->second).fillPVVariables(m_PV_x, m_PV_y, m_PV_z); + (plot_i->second).fillPVVariables(m_PV_x, m_PV_y, m_PV_z, event); }