diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/CMakeLists.txt b/PhysicsAnalysis/JetTagging/JetTagMonitoring/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..01a4062431c221299954a104992861d3103db353 --- /dev/null +++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/CMakeLists.txt @@ -0,0 +1,39 @@ +################################################################################ +# Package: JetTagMonitoring +################################################################################ + +# Declare the package name: +atlas_subdir( JetTagMonitoring ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaMonitoring + Event/xAOD/xAODJet + InnerDetector/InDetConditions/InDetConditionsSummaryService + Reconstruction/RecoTools/ITrackToVertex + PRIVATE + Event/xAOD/xAODBTagging + Event/xAOD/xAODEventInfo + Event/xAOD/xAODTracking + GaudiKernel + LArCalorimeter/LArRecEvent + PhysicsAnalysis/JetTagging/JetTagTools + Tools/LWHists + Tracking/TrkEvent/TrkParticleBase + Tracking/TrkEvent/VxSecVertex + Tracking/TrkVertexFitter/TrkVertexFitterInterfaces ) + +# External dependencies: +find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_component( JetTagMonitoring + src/*.cxx + src/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaMonitoringLib xAODJet ITrackToVertex xAODBTagging xAODEventInfo xAODTracking GaudiKernel LArRecEvent JetTagToolsLib LWHists TrkParticleBase VxSecVertex TrkVertexFitterInterfaces ) + +# Install files from the package: +atlas_install_headers( JetTagMonitoring ) +atlas_install_joboptions( share/*.py ) + diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h b/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h index 1d3e541348e004ca04a1175b2bfe1df2db5ff1c0..c9da12d542f918160679ea96654dc9608c1625f8 100755 --- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h +++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/JetTagMonitoring/JetTagMonitoring.h @@ -90,6 +90,7 @@ private: void fillDetailedHistograms(const xAOD::Jet *jet, Jet_t quality); void fillTrackInJetHistograms(const xAOD::Jet *jet); void fillBadTrackBits(const std::bitset<17> failedCuts, double eta, double phi); + void fillEffHist(TH1 * h_passed, TH1 * h_all, TH1F_LW * effHist); //void fillBadZone(int zone, double w); bool isGoodJet(const xAOD::Jet *jet); @@ -204,6 +205,15 @@ private: TH1F_LW* m_tag_mv2c20_w_phi14_21 = nullptr; TH1F_LW* m_tag_mv2c20_w_phi21_28 = nullptr; TH1F_LW* m_tag_mv2c20_w_phi28 = nullptr; + TH1F_LW* m_tag_mv2c20_w_phi_sum85OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_phi_sum77OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_phi_sum70OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_phi_sum50OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_phi_sumAll = nullptr; + TH1F_LW* m_tag_mv2c20_w_phi_frac85OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_phi_frac77OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_phi_frac70OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_phi_frac50OP = nullptr; TH1F_LW* m_tag_mv2c20_w_sj = nullptr; TH1F_LW* m_tag_mv2c20_w_sj_pT10_20 = nullptr; TH1F_LW* m_tag_mv2c20_w_sj_pT20_50 = nullptr; @@ -220,6 +230,15 @@ private: TH1F_LW* m_tag_mv2c20_w_sj_phi14_21 = nullptr; TH1F_LW* m_tag_mv2c20_w_sj_phi21_28 = nullptr; TH1F_LW* m_tag_mv2c20_w_sj_phi28 = nullptr; + TH1F_LW* m_tag_mv2c20_w_sj_phi_sum85OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_sj_phi_sum77OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_sj_phi_sum70OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_sj_phi_sum50OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_sj_phi_sumAll = nullptr; + TH1F_LW* m_tag_mv2c20_w_sj_phi_frac85OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_sj_phi_frac77OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_sj_phi_frac70OP = nullptr; + TH1F_LW* m_tag_mv2c20_w_sj_phi_frac50OP = nullptr; /** @brief To monitor number of Jets. */ TH1F_LW* m_jet_n = nullptr; /** @brief To monitor number of TrackParticles. */ diff --git a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx index d462c40845a41ae146f6d9c5ebdf9124e6b5241e..8fb7634cbec9b147a07e653eca3cf150577e507f 100755 --- a/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx +++ b/PhysicsAnalysis/JetTagging/JetTagMonitoring/src/JetTagMonitoring.cxx @@ -32,6 +32,7 @@ #include "TH1F.h" #include "TH2F.h" #include "TMath.h" +#include "TEfficiency.h" #include <vector> #include <string> @@ -272,6 +273,16 @@ StatusCode JetTagMonitoring::bookHistograms() { registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi21_28 = TH1F_LW::create("tag_MV2c20_w_phi21_28","Combined weight MV2c20 (quality jet), jet |phi| = [2.1,2.8]" ,100,-1.,1.)); registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi28 = TH1F_LW::create("tag_MV2c20_w_phi28","Combined weight MV2c20 (quality jet), jet |phi| > 2.8" ,100,-1.,1.)); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi_sum85OP = TH1F_LW::create("tag_MV2c20_w_phi_sum85OP","Sum weight MV2c20 > 85% OP (quality jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi_sum77OP = TH1F_LW::create("tag_MV2c20_w_phi_sum77OP","Sum weight MV2c20 > 77% OP (quality jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi_sum70OP = TH1F_LW::create("tag_MV2c20_w_phi_sum70OP","Sum weight MV2c20 > 70% OP (quality jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi_sum50OP = TH1F_LW::create("tag_MV2c20_w_phi_sum50OP","Sum weight MV2c20 > 50% OP (quality jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi_sumAll = TH1F_LW::create("tag_MV2c20_w_phi_sumAll" ,"Sum weight MV2c20 All (quality jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi_frac85OP = TH1F_LW::create("tag_MV2c20_w_phi_frac85OP","Frac weight MV2c20 > 85% OP (quality jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi_frac77OP = TH1F_LW::create("tag_MV2c20_w_phi_frac77OP","Frac weight MV2c20 > 77% OP (quality jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi_frac70OP = TH1F_LW::create("tag_MV2c20_w_phi_frac70OP","Frac weight MV2c20 > 70% OP (quality jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_phi_frac50OP = TH1F_LW::create("tag_MV2c20_w_phi_frac50OP","Frac weight MV2c20 > 50% OP (quality jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_sv1ip3d_w_sj = TH1F_LW::create("tag_SV1IP3D_w_sj","Combined weight SV1IP3D (suspect jet)",100,-10.,10.)); registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj = TH1F_LW::create("tag_MV2c20_w_sj","Combined weight MV2c20 (suspect jet)",100,-1.,1.)); @@ -293,6 +304,16 @@ StatusCode JetTagMonitoring::bookHistograms() { registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi21_28 = TH1F_LW::create("tag_MV2c20_w_sj_phi21_28","Combined weight MV2c20 (suspect jet), jet |phi| = [2.1,2.8]" ,100,-1.,1.)); registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi28 = TH1F_LW::create("tag_MV2c20_w_sj_phi28","Combined weight MV2c20 (suspect jet), jet |phi| > 2.8" ,100,-1.,1.)); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi_sum85OP = TH1F_LW::create("tag_MV2c20_w_sj_phi_sum85OP","Sum weight MV2c20 > 85% OP (suspect jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi_sum77OP = TH1F_LW::create("tag_MV2c20_w_sj_phi_sum77OP","Sum weight MV2c20 > 77% OP (suspect jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi_sum70OP = TH1F_LW::create("tag_MV2c20_w_sj_phi_sum70OP","Sum weight MV2c20 > 70% OP (suspect jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi_sum50OP = TH1F_LW::create("tag_MV2c20_w_sj_phi_sum50OP","Sum weight MV2c20 > 50% OP (suspect jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi_sumAll = TH1F_LW::create("tag_MV2c20_w_sj_phi_sumAll" ,"Sum weight MV2c20 All (suspect jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi_frac85OP = TH1F_LW::create("tag_MV2c20_w_sj_phi_frac85OP","Frac weight MV2c20 > 85% OP (suspect jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi_frac77OP = TH1F_LW::create("tag_MV2c20_w_sj_phi_frac77OP","Frac weight MV2c20 > 77% OP (suspect jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi_frac70OP = TH1F_LW::create("tag_MV2c20_w_sj_phi_frac70OP","Frac weight MV2c20 > 70% OP (suspect jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_tag_mv2c20_w_sj_phi_frac50OP = TH1F_LW::create("tag_MV2c20_w_sj_phi_frac50OP","Frac weight MV2c20 > 50% OP (suspect jet)" ,14,-TMath::Pi(),TMath::Pi())); + registerHist(*m_monGr_shift, m_jet_n = TH1F_LW::create("jet_n","number of jets",20,0.,20.)); registerHist(*m_monGr_shift, m_global_nPrimVtx = TH1F_LW::create("global_nPrimVtx","# primary vertex",30,0.,30.)); @@ -743,6 +764,25 @@ JetTagMonitoring::Jet_t JetTagMonitoring::applyQualityCuts(const xAOD::Jet *jet) } +void JetTagMonitoring::fillEffHist(TH1 * h_passed, TH1 * h_all, TH1F_LW * effHist) { + + if ( TEfficiency::CheckConsistency(*h_passed, *h_all) ) { + + TEfficiency * eff = new TEfficiency(*h_passed, *h_all); + eff->SetStatisticOption(TEfficiency::kBJeffrey); + + for (int i = 1; i <= h_all->GetNbinsX(); ++i) { + effHist->SetBinContent( i , eff->GetEfficiency(i) ); + effHist->SetBinError( i , (eff->GetEfficiencyErrorUp(i) + eff->GetEfficiencyErrorLow(i))/2. ); + } + + delete eff; + + } + +} + + StatusCode JetTagMonitoring::procHistograms() { ATH_MSG_DEBUG("in procHistograms()"); @@ -751,6 +791,29 @@ StatusCode JetTagMonitoring::procHistograms() { if ( m_histogramsCreated && (endOfRun || AthenaMonManager::environment() == AthenaMonManager::online) ) { m_track_selector_eff->getROOTHist()->Divide(m_track_selector_all->getROOTHist(),m_tracks_all_2D->getROOTHist()); + + TH1 * qualityJets_sum85OP = m_tag_mv2c20_w_phi_sum85OP->getROOTHistBase(); + TH1 * qualityJets_sum77OP = m_tag_mv2c20_w_phi_sum77OP->getROOTHistBase(); + TH1 * qualityJets_sum70OP = m_tag_mv2c20_w_phi_sum70OP->getROOTHistBase(); + TH1 * qualityJets_sum50OP = m_tag_mv2c20_w_phi_sum50OP->getROOTHistBase(); + TH1 * qualityJets_sumAll = m_tag_mv2c20_w_phi_sumAll->getROOTHistBase(); + + fillEffHist(qualityJets_sum85OP, qualityJets_sumAll, m_tag_mv2c20_w_phi_frac85OP); + fillEffHist(qualityJets_sum77OP, qualityJets_sumAll, m_tag_mv2c20_w_phi_frac77OP); + fillEffHist(qualityJets_sum70OP, qualityJets_sumAll, m_tag_mv2c20_w_phi_frac70OP); + fillEffHist(qualityJets_sum50OP, qualityJets_sumAll, m_tag_mv2c20_w_phi_frac50OP); + + TH1 * suspectJets_sum85OP = m_tag_mv2c20_w_sj_phi_sum85OP->getROOTHistBase(); + TH1 * suspectJets_sum77OP = m_tag_mv2c20_w_sj_phi_sum77OP->getROOTHistBase(); + TH1 * suspectJets_sum70OP = m_tag_mv2c20_w_sj_phi_sum70OP->getROOTHistBase(); + TH1 * suspectJets_sum50OP = m_tag_mv2c20_w_sj_phi_sum50OP->getROOTHistBase(); + TH1 * suspectJets_sumAll = m_tag_mv2c20_w_sj_phi_sumAll->getROOTHistBase(); + + fillEffHist(suspectJets_sum85OP, suspectJets_sumAll, m_tag_mv2c20_w_sj_phi_frac85OP); + fillEffHist(suspectJets_sum77OP, suspectJets_sumAll, m_tag_mv2c20_w_sj_phi_frac77OP); + fillEffHist(suspectJets_sum70OP, suspectJets_sumAll, m_tag_mv2c20_w_sj_phi_frac70OP); + fillEffHist(suspectJets_sum50OP, suspectJets_sumAll, m_tag_mv2c20_w_sj_phi_frac50OP); + } ATH_MSG_DEBUG("Exiting from procHistograms()"); return StatusCode::SUCCESS; @@ -1004,7 +1067,7 @@ void JetTagMonitoring::fillBadTrackBits(const std::bitset<17> failedCuts, double if ( failedCuts[nHitSct] == 0 ) m_tracks_nHitSct_2D->Fill(eta, phi, 1.); if ( failedCuts[nHitSi] == 0 ) m_tracks_nHitSi_2D->Fill(eta, phi, 1.); if ( failedCuts[nHitTrt] == 0 ) m_tracks_nHitTrt_2D->Fill(eta, phi, 1.); - if ( failedCuts[nHitTrtHighE] == 0 ) m_tracks_nHitTrtHighE_2D->Fill(eta, phi, 1.); + if ( failedCuts[nHitTrtHighE] == 0 ) m_tracks_nHitTrtHighE_2D->Fill(eta, phi, 1.); if ( failedCuts[fitChi2] == 0 ) m_tracks_fitChi2_2D->Fill(eta, phi, 1.); if ( failedCuts[fitProb] == 0 ) m_tracks_fitProb_2D->Fill(eta, phi, 1.); if ( failedCuts[fitChi2OnNdfMax] == 0 ) m_tracks_fitChi2OnNdfMax_2D->Fill(eta, phi, 1.); @@ -1062,6 +1125,12 @@ void JetTagMonitoring::fillGoodJetHistos(const xAOD::Jet *jet) { else if ( fabs(jet->phi()) > 0.7 ) m_tag_mv2c20_w_phi07_14->Fill(mv2c20); else m_tag_mv2c20_w_phi0_07->Fill(mv2c20); + if ( mv2c20 > -0.7887 ) m_tag_mv2c20_w_phi_sum85OP->Fill(jet->phi()); + if ( mv2c20 > -0.4434 ) m_tag_mv2c20_w_phi_sum77OP->Fill(jet->phi()); + if ( mv2c20 > -0.0436 ) m_tag_mv2c20_w_phi_sum70OP->Fill(jet->phi()); + if ( mv2c20 > 0.7535 ) m_tag_mv2c20_w_phi_sum50OP->Fill(jet->phi()); + m_tag_mv2c20_w_phi_sumAll->Fill(jet->phi()); + return; } @@ -1137,6 +1206,12 @@ void JetTagMonitoring::fillSuspectJetHistos(const xAOD::Jet *jet) { else if ( fabs(jet->phi()) > 0.7 ) m_tag_mv2c20_w_sj_phi07_14->Fill(mv2c20); else m_tag_mv2c20_w_sj_phi0_07->Fill(mv2c20); + if ( mv2c20 > -0.7887 ) m_tag_mv2c20_w_sj_phi_sum85OP->Fill(jet->phi()); + if ( mv2c20 > -0.4434 ) m_tag_mv2c20_w_sj_phi_sum77OP->Fill(jet->phi()); + if ( mv2c20 > -0.0436 ) m_tag_mv2c20_w_sj_phi_sum70OP->Fill(jet->phi()); + if ( mv2c20 > 0.7535 ) m_tag_mv2c20_w_sj_phi_sum50OP->Fill(jet->phi()); + m_tag_mv2c20_w_sj_phi_sumAll->Fill(jet->phi()); + return; }