diff --git a/Reconstruction/Jet/JetCalibTools/CMakeLists.txt b/Reconstruction/Jet/JetCalibTools/CMakeLists.txt index 1484263caadddface1ecfe0710eb8166bf8139bc..d7b483712852feefcf8739f25090a777a7c72f1d 100644 --- a/Reconstruction/Jet/JetCalibTools/CMakeLists.txt +++ b/Reconstruction/Jet/JetCalibTools/CMakeLists.txt @@ -1,4 +1,4 @@ -# $Id: CMakeLists.txt 778391 2016-10-14 00:23:00Z krasznaa $ +# $Id: CMakeLists.txt 789330 2016-12-12 17:07:48Z khoo $ ################################################################################ # Package: JetCalibTools ################################################################################ @@ -27,6 +27,7 @@ atlas_depends_on_subdirs( PRIVATE Event/xAOD/xAODMuon Tools/PathResolver + PhysicsAnalysis/POOLRootAccess ${extra_deps} ) # External dependencies: @@ -59,4 +60,11 @@ if( XAOD_STANDALONE ) INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEventInfo xAODJet xAODEventShape xAODCore xAODRootAccess JetCalibToolsLib ) +else() + atlas_add_executable( JetCalibTools_Example + util/JetCalibTools_Example.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AsgTools xAODEventInfo xAODJet + xAODEventShape xAODCore POOLRootAccess xAODRootAccess JetCalibToolsLib ) endif() + diff --git a/Reconstruction/Jet/JetCalibTools/JetCalibTools/JetCalibrationTool.h b/Reconstruction/Jet/JetCalibTools/JetCalibTools/JetCalibrationTool.h index 82bcc14d3842119edc2f487ed3d99fccf82c569d..08b4277a807746e633398ae1704eb435992217f4 100644 --- a/Reconstruction/Jet/JetCalibTools/JetCalibTools/JetCalibrationTool.h +++ b/Reconstruction/Jet/JetCalibTools/JetCalibTools/JetCalibrationTool.h @@ -46,9 +46,6 @@ class JetCalibrationTool public: - // Default constructor: - JetCalibrationTool(); - /// Constructor with parameters: JetCalibrationTool(const std::string& name); diff --git a/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx b/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx index bfbd50d8e5ad3334d6c86dedf3ff4af64f6b44cd..9d377c109649295db347f1a23a5826d4db3090bf 100644 --- a/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx +++ b/Reconstruction/Jet/JetCalibTools/Root/JetCalibrationTool.cxx @@ -31,7 +31,6 @@ JetCalibrationTool::JetCalibrationTool(const std::string& name) declareProperty( "IsData", m_isData = true ); declareProperty( "ConfigDir", m_dir = "JetCalibTools/CalibrationConfigs/" ); declareProperty( "EventInfoName", m_eInfoName = "EventInfo"); - declareProperty( "DoSetDetectorEta", m_doSetDetectorEta=true); } @@ -83,7 +82,7 @@ StatusCode JetCalibrationTool::initializeTool(const std::string& name) { } if ( config.EqualTo("") || !config ) { ATH_MSG_FATAL("No configuration file specified."); return StatusCode::FAILURE; } - m_calibAreaTag.insert(0,"CalibArea-00-04-73/"); // Hard-coding the CalibArea tag + m_calibAreaTag.insert(0,"CalibArea-00-04-76/"); // Hard-coding the CalibArea tag if(calibSeq.Contains("DEV")){ m_devMode = true; ATH_MSG_WARNING("Dev Mode is ON!!! \n\n"); @@ -114,8 +113,9 @@ StatusCode JetCalibrationTool::initializeTool(const std::string& name) { //Set the default units to MeV, user can override by calling setUnitsGeV(true) setUnitsGeV(false); - // Origin-corrected clusters? (true for rel21 and/or 2.5.X) + // Settings for R21/2.5.X m_originCorrectedClusters = m_globalConfig->GetValue("OriginCorrectedClusters",false); + m_doSetDetectorEta = m_globalConfig->GetValue("SetDetectorEta",true); //Make sure the residual correction is turned on if requested, protect against applying it without the jet area subtraction if ( !calibSeq.Contains("JetArea") && !calibSeq.Contains("Residual") ) { @@ -393,31 +393,23 @@ StatusCode JetCalibrationTool::initializeEvent(JetEventInfo& jetEventInfo) const //Should be determined using EventShape object, use hard coded values if EventShape doesn't exist double rho=0; const xAOD::EventShape * eventShape = 0; - //std::string rhoKey = m_jetScale == EM ? "Kt4EMTopoEventShape" : "Kt4LCTopoEventShape"; - static unsigned int eventShapeWarnings = 0; if ( m_doJetArea && evtStore()->contains<xAOD::EventShape>(m_rhoKey) ) { ATH_MSG_VERBOSE(" Found event density container " << m_rhoKey); if ( evtStore()->retrieve(eventShape, m_rhoKey).isFailure() || !eventShape ) { ATH_MSG_VERBOSE(" Event shape container not found."); - ++eventShapeWarnings; - rho = ( m_jetScale == EM || m_jetScale == PFLOW ? 6000. : 12000.); - if ( eventShapeWarnings < 20 ) - ATH_MSG_WARNING("Could not retrieve xAOD::EventShape from evtStore, using hard-coded value, rho = " << rho/m_GeV << " GeV."); + ATH_MSG_FATAL("Could not retrieve xAOD::EventShape from evtStore."); + return StatusCode::FAILURE; } else if ( !eventShape->getDensity( xAOD::EventShape::Density, rho ) ) { ATH_MSG_VERBOSE(" Event density not found in container."); - ++eventShapeWarnings; - rho = ( m_jetScale == EM || m_jetScale == PFLOW ? 6000. : 12000.); - if ( eventShapeWarnings < 20 ) - ATH_MSG_WARNING("Could not retrieve xAOD::EventShape::Density from xAOD::EventShape, using hard-coded value, rho = " << rho/m_GeV << " GeV."); + ATH_MSG_FATAL("Could not retrieve xAOD::EventShape::Density from xAOD::EventShape."); + return StatusCode::FAILURE; } else { ATH_MSG_VERBOSE(" Event density retrieved."); } } else if ( m_doJetArea && !evtStore()->contains<xAOD::EventShape>(m_rhoKey) ) { ATH_MSG_VERBOSE(" Rho container not found: " << m_rhoKey); - ++eventShapeWarnings; - rho = ( m_jetScale == EM ? 6000. : 12000.); - if ( eventShapeWarnings < 20 ) - ATH_MSG_WARNING("Could not retrieve xAOD::EventShape from evtStore, using hard-coded value, rho = " << rho/m_GeV << " GeV."); + ATH_MSG_FATAL("Could not retrieve xAOD::EventShape from evtStore."); + return StatusCode::FAILURE; } jetEventInfo.setRho(rho); ATH_MSG_VERBOSE(" Rho = " << 0.001*rho << " GeV"); diff --git a/Reconstruction/Jet/JetCalibTools/cmt/requirements b/Reconstruction/Jet/JetCalibTools/cmt/requirements index 603fdf3f4a76f8603ed538d3329ef2a6dcf1f42e..80bb8c7bfced8eff730e65354064c241f80147f8 100644 --- a/Reconstruction/Jet/JetCalibTools/cmt/requirements +++ b/Reconstruction/Jet/JetCalibTools/cmt/requirements @@ -17,16 +17,26 @@ use JetInterface JetInterface-* Reconstruction/Jet private use GaudiInterface GaudiInterface-* External use xAODMuon xAODMuon-* Event/xAOD -use PathResolver PathResolver-* Tools +use PathResolver PathResolver-* Tools +use xAODRootAccess xAODRootAccess-* Control end_private -library JetCalibTools *.cxx ../Root/*.cxx -s=components *.cxx -apply_pattern component_library +#library JetCalibTools *.cxx ../Root/*.cxx -s=components *.cxx +#apply_pattern component_library -#apply_pattern dual_use_library files="*.cxx ../Root/*.cxx" +apply_pattern dual_use_library files="*.cxx ../Root/*.cxx" apply_pattern declare_calib files="-s=../share *" +private apply_pattern generic_declare_for_link files="../data/CalibrationConfigs/*.config" kind=calib prefix=share/JetCalibTools/CalibrationConfigs name=CalibrationConfigs apply_pattern generic_declare_for_link files="../data/CalibrationFactors/*.config ../data/CalibrationFactors/*.root" kind=calib prefix=share/JetCalibTools/CalibrationFactors name=CalibrationFactors apply_pattern generic_declare_for_link files="../data/InsituCalibration/*.root" kind=calib prefix=share/JetCalibTools/InsituCalibration name=InsituCalibration + +use_if tag=AthAnalysisBase pkg=POOLRootAccess ver=POOLRootAccess-* root=PhysicsAnalysis +use_if tag=AthAnalysisBase pkg=StoreGate ver=StoreGate-* root=Control +use_if tag=AthAnalysisBase pkg=xAODCore ver=xAODCore-* root=Event/xAOD + +application JetCalibTools_Example ../util/JetCalibTools_Example.cxx +macro_append JetCalibTools_Example_dependencies " JetCalibToolsLib " +end_private \ No newline at end of file diff --git a/Reconstruction/Jet/JetCalibTools/util/JetCalibTools_Example.cxx b/Reconstruction/Jet/JetCalibTools/util/JetCalibTools_Example.cxx index 2e7a31376ac696f24cd9325a652c102f67f76872..a076834f9999c0265815b30054db04dc9c826a6e 100644 --- a/Reconstruction/Jet/JetCalibTools/util/JetCalibTools_Example.cxx +++ b/Reconstruction/Jet/JetCalibTools/util/JetCalibTools_Example.cxx @@ -12,9 +12,6 @@ * 1 14/03/16 First Version J. Bossio (jbossios@cern.ch) * \************************************************************************/ -// This will only run in RootCore -#ifdef ROOTCORE - // System include(s): #include <memory> @@ -24,13 +21,19 @@ // ROOT #include "TFile.h" +#ifdef XAOD_STANDALONE +#include "xAODRootAccess/Init.h" +#include "xAODRootAccess/TEvent.h" +#include "xAODRootAccess/TStore.h" +#else +#include "POOLRootAccess/TEvent.h" +#include "StoreGate/StoreGateSvc.h" +#endif + //xAOD EDM classes #include "xAODEventInfo/EventInfo.h" #include "xAODJet/JetContainer.h" #include "xAODEventShape/EventShape.h" -#include "xAODRootAccess/Init.h" -#include "xAODRootAccess/TEvent.h" -#include "xAODRootAccess/TStore.h" #include "xAODRootAccess/tools/Message.h" #include "xAODRootAccess/tools/ReturnCheck.h" #include "xAODCore/tools/IOStats.h" @@ -124,7 +127,6 @@ int main(int argc, char* argv[]){ // Set up the job for xAOD access: static const char* APP_NAME = "JetCalibTools_Example"; - RETURN_CHECK( APP_NAME, xAOD::Init() ); //-------------------- // Opening input file @@ -132,12 +134,14 @@ int main(int argc, char* argv[]){ std::unique_ptr< TFile > ifile( TFile::Open( sample.c_str(), "READ" ) ); // Create a TEvent object. +#ifdef XAOD_STANDALONE + RETURN_CHECK( APP_NAME, xAOD::Init() ); xAOD::TEvent event( xAOD::TEvent::kClassAccess ); +#else // Athena "Store" is the same StoreGate used by the TEvent + POOL::TEvent event( POOL::TEvent::kClassAccess ); +#endif RETURN_CHECK( APP_NAME, event.readFrom( ifile.get() ) ); - // Create a transient object store. Needed for the tools. - xAOD::TStore store; - //---------------------------------- // Initialization of JetCalibTools //---------------------------------- @@ -201,5 +205,3 @@ int main(int argc, char* argv[]){ return 0; } - -#endif