diff --git a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetKinematicHistos.h b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetKinematicHistos.h index f5bb953285052aa364c646b04849bff5d7c7cb3d..52827d7946fcc2122bf2a2056aa9b7a667f63136 100644 --- a/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetKinematicHistos.h +++ b/Reconstruction/Jet/JetMonitoring/JetMonitoring/JetKinematicHistos.h @@ -1,7 +1,7 @@ // -*- c++ -*- /* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration + Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration */ #ifndef JETMONITORING_JETKINEMATICHISTOS_H @@ -52,7 +52,7 @@ protected: TProfile2D* m_averagePtEtaPhi; TProfile2D* m_averageE_EtaPhi; - int m_jetScale; + std::string m_jetScale; bool m_doN; bool m_doM; diff --git a/Reconstruction/Jet/JetMonitoring/Root/JetKinematicHistos.cxx b/Reconstruction/Jet/JetMonitoring/Root/JetKinematicHistos.cxx index 3701cf97a7bf7127afb6fe8bfc922b1d69895732..a69451cdc4ec78f3a71329c7ce84d9a4f6f72b94 100644 --- a/Reconstruction/Jet/JetMonitoring/Root/JetKinematicHistos.cxx +++ b/Reconstruction/Jet/JetMonitoring/Root/JetKinematicHistos.cxx @@ -15,7 +15,7 @@ JetKinematicHistos::JetKinematicHistos(const std::string &t) : JetHistoBase(t) ,m_phi(0) ,m_m(0) ,m_e(0) - , m_jetScale(xAOD::JetAssignedScaleMomentum) + ,m_jetScale("JetAssignedScaleMomentum") { declareProperty("JetScale", m_jetScale); declareProperty("PlotNJet", m_doN = false); @@ -34,12 +34,11 @@ int JetKinematicHistos::buildHistos(){ // -------------- Modify histo names/titles -------- // if we're plotting a defined scale, modify the Histo titles and names - std::map<xAOD::JetScale, std::string> scale2str( { - { xAOD::JetEMScaleMomentum , "EMScale" } , - { xAOD::JetConstitScaleMomentum , "ConstitScale" } } ); - TString scaleTag = scale2str[ (xAOD::JetScale) m_jetScale ] ; // defaults to "" + std::map<std::string, std::string> scale2str( { + { "JetEMScaleMomentum" , "EMScale" } , + { "JetConstitScaleMomentum" , "ConstitScale" } } ); + TString scaleTag = scale2str[ m_jetScale ] ; // defaults to "" - TString prefixn = scaleTag; if(prefixn != "") prefixn +="_"; // -------------- @@ -107,28 +106,31 @@ int JetKinematicHistos::fillHistosFromContainer(const xAOD::JetContainer & cont) int JetKinematicHistos::fillHistosFromJet(const xAOD::Jet &j){ - { - // m_jetScale is a property of the base tool - const xAOD::JetFourMom_t p4 = j.jetP4( (xAOD::JetScale) m_jetScale); - m_pt->Fill( p4.Pt()*toGeV ); - m_eta->Fill( p4.Eta() ); - m_phi->Fill( p4.Phi() ); - if (p4.Pt()*toGeV > 200.0){ // high eta - m_pt_high->Fill( p4.Pt()*toGeV ); - m_eta_high->Fill( p4.Eta() ); - if(m_doE) m_e_high->Fill( p4.E()*toGeV ); - if(m_doM) m_m_high->Fill( p4.M()*toGeV ); - if(m_doNConstit) m_nConstit_high->Fill( j.numConstituents() ); - } + if(m_jetScale != "JetAssignedScaleMomentum" && !j.isAvailable<float>(m_jetScale+"_pt")){ + if(m_doNConstit) m_nConstit->Fill( j.numConstituents() ); + return 0; + } - if(m_doE) m_e->Fill( p4.E()*toGeV ); - if(m_doM) m_m->Fill( p4.M()*toGeV ); - - if(m_doOccupancy) m_occupancyEtaPhi->Fill( p4.Eta(), p4.Phi() ); - if(m_doAveragePt) m_averagePtEtaPhi->Fill( p4.Eta(), p4.Phi() , p4.Pt()*toGeV); - if(m_doAverageE) m_averageE_EtaPhi->Fill( p4.Eta(), p4.Phi() , p4.E()*toGeV); + // m_jetScale is a property of the base tool + const xAOD::JetFourMom_t p4 = j.jetP4(m_jetScale); + m_pt->Fill( p4.Pt()*toGeV ); + m_eta->Fill( p4.Eta() ); + m_phi->Fill( p4.Phi() ); + if (p4.Pt()*toGeV > 200.0){ // high eta + m_pt_high->Fill( p4.Pt()*toGeV ); + m_eta_high->Fill( p4.Eta() ); + if(m_doE) m_e_high->Fill( p4.E()*toGeV ); + if(m_doM) m_m_high->Fill( p4.M()*toGeV ); + if(m_doNConstit) m_nConstit_high->Fill( j.numConstituents() ); } + if(m_doE) m_e->Fill( p4.E()*toGeV ); + if(m_doM) m_m->Fill( p4.M()*toGeV ); + + if(m_doOccupancy) m_occupancyEtaPhi->Fill( p4.Eta(), p4.Phi() ); + if(m_doAveragePt) m_averagePtEtaPhi->Fill( p4.Eta(), p4.Phi() , p4.Pt()*toGeV); + if(m_doAverageE) m_averageE_EtaPhi->Fill( p4.Eta(), p4.Phi() , p4.E()*toGeV); + if(m_doNConstit) m_nConstit->Fill( j.numConstituents() ); return 0; } diff --git a/Reconstruction/Jet/JetMonitoring/python/HIJetHistoTools.py b/Reconstruction/Jet/JetMonitoring/python/HIJetHistoTools.py index d7e8414d2ff3957b048c598bce968d4ce4de30b0..3ded33b1c54c6cacf05046ab88cae3b79682cb7d 100644 --- a/Reconstruction/Jet/JetMonitoring/python/HIJetHistoTools.py +++ b/Reconstruction/Jet/JetMonitoring/python/HIJetHistoTools.py @@ -78,8 +78,8 @@ attributeHistoManager.buildKnownTools(compactSpecification) # Jet histogramming tools jhm.addTool( JetKinematicHistos("allkinematics",PlotOccupancy=True, PlotAveragePt=True, PlotNJet=True , PlotNConstit = True) ) jhm.addTool( JetKinematicHistos("basickinematics") ) -#jhm.addTool( JetKinematicHistos("basickinematics_emscale", JetScale=0) ) -#jhm.addTool( JetKinematicHistos("basickinematics_constscale", JetScale=1) ) +#jhm.addTool( JetKinematicHistos("basickinematics_emscale", JetScale="JetEMScaleMomentum") ) +#jhm.addTool( JetKinematicHistos("basickinematics_constscale", JetScale="JetConstitScaleMomentum") ) jhm.addTool( LeadingJetsRelations("leadingjetrel", HistoDef = [ diff --git a/Reconstruction/Jet/JetMonitoring/python/JetHistoTools.py b/Reconstruction/Jet/JetMonitoring/python/JetHistoTools.py index c7f79825e06dda59620d202c9b82b665bef0c2b4..95f50d409d76e1fe5922776446842f001c15700b 100644 --- a/Reconstruction/Jet/JetMonitoring/python/JetHistoTools.py +++ b/Reconstruction/Jet/JetMonitoring/python/JetHistoTools.py @@ -182,8 +182,8 @@ attributeHistoManager.buildKnownTools(compactSpecification) # Jet histogramming tools jhm.addTool( JetKinematicHistos("allkinematics",PlotOccupancy=True, PlotAveragePt=True, PlotNJet=True , PlotNConstit = True) ) jhm.addTool( JetKinematicHistos("basickinematics") ) -jhm.addTool( JetKinematicHistos("basickinematics_emscale", JetScale=0) ) -jhm.addTool( JetKinematicHistos("basickinematics_constscale", JetScale=1) ) +jhm.addTool( JetKinematicHistos("basickinematics_emscale", JetScale="JetEMScaleMomentum") ) +jhm.addTool( JetKinematicHistos("basickinematics_constscale", JetScale="JetConstitScaleMomentum") ) jhm.addTool( LeadingJetsRelations("leadingjetrel", HistoDef = [