Commit 35c103fc authored by Scott Snyder's avatar Scott Snyder Committed by Graeme Stewart
Browse files

Fix cmt warnings. (JetCalibTools-00-04-19)

        * Tagging JetCalibTools-00-04-19.
	* cmt/requirements: Fix cmt warnings.

2014-12-08 Joe Taenzer <joseph.taenzer@cern.ch>
        JetCalibTools-00-04-18
        * OriginCorrected/PileupCorrected attributes are now ints
	  trigger aux store doesn't allow bools :(

2014-12-08 Joe Taenzer <joseph.taenzer@cern.ch>
        JetCalibTools-00-04-17
	* OriginCorrected and PileupCorrected attributes are set to false before calibration
	  if they aren't already written to the jet

2014-12-08 Joe Taenzer <joseph.taenzer@cern.ch>
	JetCalibTools-00-04-16
	* Reverted changes from tag 04-15 -- Origin removed from momentum state names
	* Added new jet attributes: OriginCorrected, PileupCorrected
	  Used to track if the origin and pileup corrections have been applied

...
(Long ChangeLog diff - truncated)
parent f27f11c1
......@@ -28,7 +28,7 @@ class JetPileupCorrection
public:
JetPileupCorrection();
JetPileupCorrection(const std::string& name);
JetPileupCorrection(const std::string& name, TEnv * config, TString jetAlgo, bool doResidual, bool isData);
JetPileupCorrection(const std::string& name, TEnv * config, TString jetAlgo, bool doResidual, bool doOrigin, bool isData);
virtual ~JetPileupCorrection();
//virtual bool initializeTool(const std::string& name, TEnv * config, TString jetAlgo, bool doResidual, bool isData);
......@@ -41,6 +41,7 @@ class JetPileupCorrection
TEnv * m_config;
TString m_jetAlgo;
bool m_doResidual;
bool m_doOrigin;
bool m_isData;
bool m_useFull4vectorArea;
......
......@@ -57,13 +57,14 @@ public:
TString config = "",
TString calibSeq = "JetArea_Offset_AbsoluteEtaJES_Insitu",
bool isData = true,
TString dir = "");
TString rhoKey = "auto",
TString dir = "JetCalibTools/CalibrationConfigs/");
/// Destructor:
virtual ~JetCalibrationTool();
enum jetScale { EM, LC };
enum jetScale { EM, LC, PFLOW };
// Initialize the tool (default, assumes private members were set in the constructor)
virtual StatusCode initializeTool(const std::string& name);
......@@ -100,6 +101,7 @@ private:
std::string m_config;
std::string m_calibSeq;
bool m_isData;
std::string m_rhoKey;
std::string m_dir;
//TEnv to hold the global text config
......@@ -109,6 +111,7 @@ private:
jetScale m_jetScale;
bool m_doJetArea;
bool m_doResidual;
bool m_doOrigin;
//Class objects for each calibration step
std::vector<JetCalibrationToolBase*> m_calibClasses;
......
......@@ -20,7 +20,7 @@
#include <TKey.h>
#include "xAODMuon/MuonSegment.h"
#include "xAODMuon/MuonSegmentContainer.h"
#include "JetCalibTools/CalibrationMethods/GlobalSequentialCorrection.h"
#include "PathResolver/PathResolver.h"
......@@ -199,7 +199,11 @@ double GlobalSequentialCorrection::getPunchThroughResponse(double E, double eta_
for (uint i=0; i<m_punchThroughEtaBins.size()-1; ++i) {
if(eta_det >= m_punchThroughEtaBins[i] && eta_det < m_punchThroughEtaBins[i+1]) etabin = i;
}
if(etabin<0) ATH_MSG_WARNING("There was a problem determining the eta bin to use for the punch through correction.");
if(etabin<0) {
ATH_MSG_WARNING("There was a problem determining the eta bin to use for the punch through correction.");
//this could probably be improved, but to avoid a seg fault...
return 1;
}
double PunchThroughResponse = readPtJetPropertyHisto(E,log(Nsegments),m_respFactorsPunchThrough[etabin]);
if ( PunchThroughResponse > 1 ) return 1;
return PunchThroughResponse;
......@@ -276,8 +280,12 @@ StatusCode GlobalSequentialCorrection::calibrateImpl(xAOD::Jet& jet, JetEventInf
//vector<float> that holds the trackWIDTH variable calculated with tracks of pT > 1 GeV for different primary vertices
std::vector<float> trackWIDTH = jet.getAttribute<std::vector<float> >("TrackWidthPt1000");
//vector<const MuonSegment* > that holds the ghost associated muon segments behind each jet
std::vector<const xAOD::MuonSegment*> vecMuonSegments = jet.getAttribute<std::vector<const xAOD::MuonSegment*> >("GhostMuonSegment");
int Nsegments = vecMuonSegments.size();
int Nsegments = 0;
std::vector<const xAOD::MuonSegment*> vecMuonSegments;
if ( jet.getAssociatedObjects("GhostMuonSegment", vecMuonSegments) )
Nsegments = vecMuonSegments.size();
else
ATH_MSG_WARNING("Couldn't retrieve GhostMuonSegment jet associated object, punch through correction won't be applied");
xAOD::JetFourMom_t jetStartP4;
ATH_CHECK( setStartP4(jet) );
......
......@@ -7,12 +7,12 @@
InsituDataCorrection::InsituDataCorrection()
: asg::AsgTool( "InsituDataCorrection::InsituDataCorrection" ), JetCalibrationToolBase::JetCalibrationToolBase(),
m_config(NULL), m_insituCorr(NULL)
m_config(NULL), m_jetAlgo(""), m_insituCorr(NULL)
{ }
InsituDataCorrection::InsituDataCorrection(const std::string& name)
: asg::AsgTool( name ), JetCalibrationToolBase::JetCalibrationToolBase( name ),
m_config(NULL), m_insituCorr(NULL)
m_config(NULL), m_jetAlgo(""), m_insituCorr(NULL)
{ }
InsituDataCorrection::InsituDataCorrection(const std::string& name, TEnv * config, TString jetAlgo)
......
......@@ -20,39 +20,41 @@
//Default constructor -- likely to be used by Athena based analyses
JetCalibrationTool::JetCalibrationTool()
: asg::AsgTool( "JetCalibrationTool::JetCalibrationTool" ), JetCalibrationToolBase::JetCalibrationToolBase(),
m_jetAlgo(""), m_config(""), m_calibSeq(""), m_isData(true), m_dir(""), m_globalConfig(NULL),
m_doJetArea(true), m_doResidual(true),
m_jetAlgo(""), m_config(""), m_calibSeq(""), m_isData(true), m_rhoKey(""), m_dir(""), m_globalConfig(NULL),
m_doJetArea(true), m_doResidual(true), m_doOrigin(true),
m_jetPileupCorr(NULL), m_etaJESCorr(NULL), m_globalSequentialCorr(NULL), m_insituDataCorr(NULL)
{
declareProperty( "JetCollection", m_jetAlgo = "AntiKt4LCTopo" );
declareProperty( "RhoKey", m_rhoKey = "auto" );
declareProperty( "ConfigFile", m_config = "" );
declareProperty( "CalibSequence", m_calibSeq = "JetArea_Residual_AbsoluteEtaJES_Insitu" );
declareProperty( "IsData", m_isData = true );
declareProperty( "ConfigDir", m_dir = "" );
declareProperty( "ConfigDir", m_dir = "JetCalibTools/CalibrationConfigs/" );
}
JetCalibrationTool::JetCalibrationTool(const std::string& name)
: asg::AsgTool( name ), JetCalibrationToolBase::JetCalibrationToolBase( name ),
m_jetAlgo(""), m_config(""), m_calibSeq(""), m_isData(true), m_dir(""), m_globalConfig(NULL),
m_doJetArea(true), m_doResidual(true),
m_jetAlgo(""), m_config(""), m_calibSeq(""), m_isData(true), m_rhoKey("auto"), m_dir(""), m_globalConfig(NULL),
m_doJetArea(true), m_doResidual(true), m_doOrigin(true),
m_jetPileupCorr(NULL), m_etaJESCorr(NULL), m_globalSequentialCorr(NULL), m_insituDataCorr(NULL)
{
declareProperty( "JetCollection", m_jetAlgo = "AntiKt4LCTopo" );
declareProperty( "RhoKey", m_rhoKey = "auto" );
declareProperty( "ConfigFile", m_config = "" );
declareProperty( "CalibSequence", m_calibSeq = "JetArea_Offset_AbsoluteEtaJES_Insitu" );
declareProperty( "IsData", m_isData = true );
declareProperty( "ConfigDir", m_dir = "" );
declareProperty( "ConfigDir", m_dir = "JetCalibTools/CalibrationConfigs/" );
}
//Contructor for Root based analyses
JetCalibrationTool::JetCalibrationTool(const std::string& name, TString jetAlgo, TString config, TString calibSeq, bool isData, TString dir)
JetCalibrationTool::JetCalibrationTool(const std::string& name, TString jetAlgo, TString config, TString calibSeq, bool isData, TString rhoKey, TString dir)
: asg::AsgTool( name ),
m_jetAlgo(jetAlgo), m_config(config), m_calibSeq(calibSeq), m_isData(isData), m_dir(dir), m_globalConfig(NULL),
m_doJetArea(true), m_doResidual(true),
m_jetAlgo(jetAlgo), m_config(config), m_calibSeq(calibSeq), m_isData(isData), m_rhoKey(rhoKey), m_dir(dir), m_globalConfig(NULL),
m_doJetArea(true), m_doResidual(true), m_doOrigin(true),
m_jetPileupCorr(NULL), m_etaJESCorr(NULL), m_globalSequentialCorr(NULL), m_insituDataCorr(NULL)
{
......@@ -106,7 +108,8 @@ StatusCode JetCalibrationTool::initializeTool(const std::string& name) {
}
if ( config.EqualTo("") || !config ) { ATH_MSG_FATAL("No configuration file specified."); return StatusCode::FAILURE; }
TString fn = PathResolverFindCalibFile(m_config);
std::string configPath=m_dir+m_config;
TString fn = PathResolverFindCalibFile(configPath);
ATH_MSG_INFO(" Reading global JES settings from:\n " << m_config << "\n");
ATH_MSG_INFO(" resolved in :\n " << fn << "\n\n");
......@@ -119,23 +122,35 @@ StatusCode JetCalibrationTool::initializeTool(const std::string& name) {
//Make sure that one of the standard jet collections is being used
if ( jetAlgo.Contains("EM") ) m_jetScale = EM;
else if ( jetAlgo.Contains("LC") ) m_jetScale = LC;
else if ( jetAlgo.Contains("PFlow") ) m_jetScale = PFLOW;
else { ATH_MSG_FATAL("jetAlgo " << jetAlgo << " not recognized."); return StatusCode::FAILURE; }
//Set the default units to MeV, user can override by calling setUnitsGeV(true)
setUnitsGeV(false);
//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") ) {
m_doJetArea = true;
m_doResidual = 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") ) {
m_doJetArea = false;
m_doResidual = false;
} else if ( calibSeq.Contains("JetArea") && !calibSeq.Contains("Residual") ) {
m_doJetArea = true;
if ( m_rhoKey.compare("auto") == 0 ) {
if ( m_jetScale == EM ) m_rhoKey = "Kt4EMTopoEventShape";
else if ( m_jetScale == LC ) m_rhoKey = "Kt4LCTopoEventShape";
else if ( m_jetScale == PFLOW ) m_rhoKey = "EMPFlowEventShape";
}
m_doResidual = false;
} else if ( calibSeq.Contains("Residual") && !calibSeq.Contains("JetArea") ) {
} else if ( !calibSeq.Contains("JetArea") && calibSeq.Contains("Residual") ) {
ATH_MSG_FATAL("JetCalibrationTool::initializeTool : You are trying to initialize JetCalibTools with the jet area correction turned off and the residual offset correction turned on. This is inconsistent. Aborting.");
return StatusCode::FAILURE;
if ( m_rhoKey.compare("auto") == 0 ) {
if ( m_jetScale == EM ) m_rhoKey = "Kt4EMTopoEventShape";
else if ( m_jetScale == LC ) m_rhoKey = "Kt4LCTopoEventShape";
else if ( m_jetScale == PFLOW ) m_rhoKey = "EMPFlowEventShape";
}
return StatusCode::SUCCESS;
}
if ( !calibSeq.Contains("Origin") ) m_doOrigin = false;
//Protect against the in-situ calibration being requested when isData is false
if ( calibSeq.Contains("Insitu") && !m_isData ) {
ATH_MSG_FATAL("JetCalibrationTool::initializeTool : calibSeq string contains Insitu with isData set to false. Can't apply in-situ correction to MC!!");
......@@ -146,7 +161,7 @@ StatusCode JetCalibrationTool::initializeTool(const std::string& name) {
//Initialize derived classes for applying the requested calibrations and add them to a vector
std::vector<TString> vecCalibSeq = JetCalibUtils::Vectorize(calibSeq,"_");
for ( unsigned int i=0; i<vecCalibSeq.size(); ++i) {
if ( vecCalibSeq[i].EqualTo("Residual") ) continue;
if ( vecCalibSeq[i].EqualTo("Residual") || vecCalibSeq[i].EqualTo("Origin") ) continue;
ATH_CHECK( getCalibClass(name,vecCalibSeq[i]) );
}
......@@ -163,7 +178,7 @@ StatusCode JetCalibrationTool::getCalibClass(const std::string&name, TString cal
if ( calibration.Contains("JetArea") ) {
ATH_MSG_INFO(" Initializing pileup correction.");
suffix="_Pileup";
m_jetPileupCorr = new JetPileupCorrection(name+suffix,m_globalConfig,jetAlgo,m_doResidual,m_isData);
m_jetPileupCorr = new JetPileupCorrection(name+suffix,m_globalConfig,jetAlgo,m_doResidual,m_doOrigin,m_isData);
if( m_jetPileupCorr->initializeTool(name+suffix).isFailure() ) {
ATH_MSG_FATAL("Couldn't initialize the pileup correction. Aborting");
return StatusCode::FAILURE;
......@@ -299,27 +314,27 @@ 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";
//std::string rhoKey = m_jetScale == EM ? "Kt4EMTopoEventShape" : "Kt4LCTopoEventShape";
static unsigned int eventShapeWarnings = 0;
if ( m_doJetArea && evtStore()->contains<xAOD::EventShape>(rhoKey) ) {
ATH_MSG_VERBOSE(" Found event density container " << rhoKey);
if ( evtStore()->retrieve(eventShape, rhoKey).isFailure() || !eventShape ) {
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 ? 6000. : 12000.);
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.");
} else if ( !eventShape->getDensity( xAOD::EventShape::Density, rho ) ) {
ATH_MSG_VERBOSE(" Event density not found in container.");
++eventShapeWarnings;
rho = ( m_jetScale == EM ? 6000. : 12000.);
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.");
} else {
ATH_MSG_VERBOSE(" Event density retrieved.");
}
} else if ( m_doJetArea && !evtStore()->contains<xAOD::EventShape>(rhoKey) ) {
ATH_MSG_VERBOSE(" Rho container not found: " << rhoKey);
} 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 )
......@@ -335,9 +350,9 @@ StatusCode JetCalibrationTool::initializeEvent(JetEventInfo& jetEventInfo) const
if ( evtStore()->retrieve(eventObj,"EventInfo").isFailure() || !eventObj ) {
++eventInfoWarnings;
if ( eventInfoWarnings < 20 )
ATH_MSG_WARNING(" JetCalibrationTool::initializeEvent : Failed to retrieve event information.");
ATH_MSG_ERROR(" JetCalibrationTool::initializeEvent : Failed to retrieve event information.");
jetEventInfo.setMu(0); //Hard coded value mu = 0 in case of failure (to prevent seg faults later).
return StatusCode::FAILURE;
return StatusCode::SUCCESS; //error is recoverable, so return SUCCESS
}
jetEventInfo.setMu( eventObj->averageInteractionsPerCrossing() );
......@@ -352,9 +367,9 @@ StatusCode JetCalibrationTool::initializeEvent(JetEventInfo& jetEventInfo) const
if ( evtStore()->retrieve(vertices,"PrimaryVertices").isFailure() || !vertices ) {
++vertexContainerWarnings;
if ( vertexContainerWarnings < 20 )
ATH_MSG_WARNING(" JetCalibrationTool::initializeEvent : Failed to retrieve primary vertices.");
jetEventInfo.setNPV(1); //Hard coded value NPV = 1 in case of failure (to prevent seg faults later).
return StatusCode::FAILURE;
ATH_MSG_ERROR(" JetCalibrationTool::initializeEvent : Failed to retrieve primary vertices.");
jetEventInfo.setNPV(0); //Hard coded value NPV = 0 in case of failure (to prevent seg faults later).
return StatusCode::SUCCESS; //error is recoverable, so return SUCCESS
}
int eventNPV = 0;
......@@ -370,6 +385,14 @@ StatusCode JetCalibrationTool::initializeEvent(JetEventInfo& jetEventInfo) const
}
StatusCode JetCalibrationTool::calibrateImpl(xAOD::Jet& jet, JetEventInfo& jetEventInfo) const {
//Check for OriginCorrected and PileupCorrected attributes, assume they are false if not found
int tmp = 0; //temporary int for checking getAttribute
if ( !jet.getAttribute<int>("OriginCorrected",tmp) )
jet.setAttribute<int>("OriginCorrected",false);
if ( !jet.getAttribute<int>("PileupCorrected",tmp) )
jet.setAttribute<int>("PileupCorrected",false);
ATH_MSG_VERBOSE("Calibrating jet " << jet.index());
xAOD::JetFourMom_t jetconstitP4 = jet.getAttribute<xAOD::JetFourMom_t>("JetConstitScaleMomentum");
jet.setAttribute<float>("DetectorEta",jetconstitP4.eta()); //saving constituent scale eta for later use
......
......@@ -6,19 +6,19 @@
JetPileupCorrection::JetPileupCorrection()
: asg::AsgTool( "JetPileupCorrection::JetPileupCorrection" ), JetCalibrationToolBase::JetCalibrationToolBase(),
m_config(NULL), m_jetAlgo(""), m_doResidual(false), m_isData(false),
m_config(NULL), m_jetAlgo(""), m_doResidual(false), m_doOrigin(false), m_isData(false),
m_useFull4vectorArea(false), m_residualOffsetCorr(NULL)
{ }
JetPileupCorrection::JetPileupCorrection(const std::string& name)
: asg::AsgTool( name ), JetCalibrationToolBase::JetCalibrationToolBase( name ),
m_config(NULL), m_jetAlgo(""), m_doResidual(false), m_isData(false),
m_config(NULL), m_jetAlgo(""), m_doResidual(false), m_doOrigin(false), m_isData(false),
m_useFull4vectorArea(false), m_residualOffsetCorr(NULL)
{ }
JetPileupCorrection::JetPileupCorrection(const std::string& name, TEnv * config, TString jetAlgo, bool doResidual, bool isData)
JetPileupCorrection::JetPileupCorrection(const std::string& name, TEnv * config, TString jetAlgo, bool doResidual, bool doOrigin, bool isData)
: asg::AsgTool( name ), JetCalibrationToolBase::JetCalibrationToolBase( name ),
m_config(config), m_jetAlgo(jetAlgo), m_doResidual(doResidual), m_isData(isData),
m_config(config), m_jetAlgo(jetAlgo), m_doResidual(doResidual), m_doOrigin(doOrigin), m_isData(isData),
m_useFull4vectorArea(false), m_residualOffsetCorr(NULL)
{ }
......@@ -52,7 +52,7 @@ StatusCode JetPileupCorrection::initializeTool(const std::string& name) {
ATH_MSG_WARNING("JetPileupCorrection::initializeTool : WARNING!! You have requested the 4 vector jet area correction and the residual offset correction. This configuration is not currently supported, the residual offset correction will be deactivated.");
return StatusCode::SUCCESS;
} else if ( !m_doResidual && !m_useFull4vectorArea ) {
ATH_MSG_WARNING("JetPileupCorrection::initializeTool : WARNING!! You have requested the transverse jet area correction without the residual offset correction. This configuration is not recommended.");
ATH_MSG_VERBOSE("JetPileupCorrection::initializeTool : You have requested the transverse jet area correction without the residual offset correction. This configuration is not recommended.");
return StatusCode::SUCCESS;
} else {
return StatusCode::SUCCESS;
......@@ -87,6 +87,8 @@ StatusCode JetPileupCorrection::calibrateImpl(xAOD::Jet& jet, JetEventInfo& jetE
ATH_MSG_VERBOSE(" Applying area-subtraction calibration to jet " << jet.index() << " with pT = " << 0.001*jet.pt() << " GeV");
//subtract rho * the jet area from the jet
xAOD::JetFourMom_t calibP4 = jetStartP4 - rho*jetareaP4;
//Attribute to track if a jet has received the pileup subtraction (always true if this code was run)
jet.setAttribute<int>("PileupCorrected",true);
//Transfer calibrated jet properties to the Jet object
jet.setAttribute<xAOD::JetFourMom_t>("JetPileupScaleMomentum",calibP4);
jet.setJetP4( calibP4 );
......@@ -105,8 +107,28 @@ StatusCode JetPileupCorrection::calibrateImpl(xAOD::Jet& jet, JetEventInfo& jetE
//Set the jet pT to 10 MeV if the pT is negative after the jet area and residual offset corrections
const double pileup_SF = pT_offset >= 0 ? pT_offset / pT_det : 0.01*m_GeV/pT_det;
xAOD::JetFourMom_t calibP4 = jetStartP4*pileup_SF;
xAOD::JetFourMom_t calibP4;
if ( m_doOrigin ) {
xAOD::JetFourMom_t jetOriginP4;
static unsigned int originWarnings = 0;
if ( jet.getAttribute<xAOD::JetFourMom_t>("JetOriginConstitScaleMomentum",jetOriginP4) )
calibP4 = jetOriginP4*pileup_SF;
else {
if ( originWarnings < 20 ) {
ATH_MSG_WARNING("Could not retrieve JetOriginConstitScaleMomentum jet attribute, origin correction will not be applied.");
++originWarnings;
}
calibP4 = jetStartP4*pileup_SF;
}
} else
calibP4 = jetStartP4*pileup_SF;
//Attribute to track if a jet has received the origin correction
jet.setAttribute<int>("OriginCorrected",m_doOrigin);
//Attribute to track if a jet has received the pileup subtraction (always true if this code was run)
jet.setAttribute<int>("PileupCorrected",true);
//Transfer calibrated jet properties to the Jet object
jet.setAttribute<xAOD::JetFourMom_t>("JetPileupScaleMomentum",calibP4);
jet.setJetP4( calibP4 );
......@@ -115,7 +137,26 @@ StatusCode JetPileupCorrection::calibrateImpl(xAOD::Jet& jet, JetEventInfo& jetE
ATH_MSG_VERBOSE(" Applying postive-only area-subtraction calibration to jet " << jet.index() << " with pT = " << 0.001*jet.pt() << " GeV");
//Set the jet pT to 10 MeV if the pT or energy is negative after the jet area correction
const double area_SF = (pT_det-rho*jetareaP4.pt()<=0 || E_det-rho*jetareaP4.e()<=0) ? 10/pT_det : (pT_det-rho*jetareaP4.pt())/pT_det;
xAOD::JetFourMom_t calibP4 = jetStartP4*area_SF;
xAOD::JetFourMom_t calibP4;
if ( m_doOrigin ) {
xAOD::JetFourMom_t jetOriginP4;
static unsigned int originWarnings = 0;
if ( jet.getAttribute<xAOD::JetFourMom_t>("JetOriginConstitScaleMomentum",jetOriginP4) )
calibP4 = jetOriginP4*area_SF;
else {
if ( originWarnings < 20 ) {
ATH_MSG_WARNING("Could not retrieve JetOriginConstitScaleMomentum jet attribute, origin correction will not be applied.");
++originWarnings;
}
calibP4 = jetStartP4*area_SF;
}
} else
calibP4 = jetStartP4*area_SF;
//Attribute to track if a jet has received the origin correction
jet.setAttribute<int>("OriginCorrected",m_doOrigin);
//Attribute to track if a jet has received the pileup subtraction (always true if this code was run)
jet.setAttribute<int>("PileupCorrected",true);
//Transfer calibrated jet properties to the Jet object
jet.setAttribute<xAOD::JetFourMom_t>("JetPileupScaleMomentum",calibP4);
......
......@@ -25,6 +25,6 @@ apply_pattern component_library
#apply_pattern dual_use_library files="*.cxx ../Root/*.cxx"
apply_pattern generic_declare_for_link files="../data/CalibrationConfigs/*.config" prefix=share/JetCalibTools/CalibrationConfigs name=CalibrationConfigs
apply_pattern generic_declare_for_link files="../data/CalibrationFactors/*.config" prefix=share/JetCalibTools/CalibrationFactors name=CalibrationFactors
apply_pattern generic_declare_for_link files="../data/InsituCalibration/*.root" prefix=share/JetCalibTools/InsituCalibration name=InsituCalibration
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
#
# Settings for Rel 17 jet areas + residual offset + absolute EtaJES + GSC Jet calibration
#
# Config file author: Joe Taenzer, Dec 15, 2012
#
#####################
# ----------------
# 1. Absolute JES
# The file with the absolute JES factors
AbsoluteJES.CalibFile: JetCalibTools/CalibrationFactors/AbsoluteJES_Rel17.2_AreaSubtracted_1_AFII.config
AbsoluteJES.Description: JES for release 17.2, derived November 2012 with Jet Areas, for application to Data12 and MC12
# How low in ET do we extrapolate along the calibration curve ?
AntiKt4TopoEM.MinPtForETAJES: 10
AntiKt4LCTopo.MinPtForETAJES: 15
AntiKt6TopoEM.MinPtForETAJES: 15
AntiKt6LCTopo.MinPtForETAJES: 20
# Which method should be used to extend the calibration curve past the minimum ET ?
# 0 = calibation curve is frozen at minimum ET
# 1 = slope of calibration curve is frozen at minimum ET (recommended)
# 2 = order 2 polynomial is used to extend the calibration curve
LowPtJESExtrapolationMethod: 1
LowPtJESExtrapolationMinimumResponse: 0.25
# ----------------
# 2. Pile-up correction
# What offset correction to apply
OffsetCorrection.Name: OffsetMC12Nov2012
# What residual jet-area offset correction to apply
ResidualOffsetCorrection.Name: ResidualOffsetMC12Nov2012
# These corrections should correspond to the
# conditions of the absolute JES calibration
OffsetCorrection.DefaultMuRef: 0
OffsetCorrection.DefaultNPVRef: 1
# additional config files to include
ResidualOffset.CalibFile: JetCalibTools/CalibrationFactors/MCBasedOffset_Nov2012.config
# mu-scale factor used (only for MC)
MuScaleFactor: 1.09
# should the beam-spot correction be applied (only for MC)
ApplyNPVBeamspotCorrection: 1
# Set this to 1 to apply full 4-vector area correction
ApplyFullJetArea4MomentumCorrection: 0
# ----------------
# 4. Global sequential calibration
ApplyGSCCorrection: true
GSCFactorsFile: JetCalibTools/CalibrationFactors/GSC_factors_AFII_March2014.root
#Order of GSC correction is Tile0->EM3->nTrk->trackWIDTH->PunchThrough, use the GSCDepth flag to control the last correction applied
#Acceptable values for the GSC Depth flag are: "Tile0", "EM3", "nTrk", "trackWIDTH", "PunchThrough", or "Full" (equivalent to "PunchThrough")
GSCDepth: Full
PunchThroughEtaBins: 0.0 1.3 1.9 2.7
######################
#
# Settings for Rel 17 jet areas + residual offset + absolute EtaJES + GSC Jet calibration
#
# Config file author: Joe Taenzer, Dec 15, 2012
#
#####################
# ----------------
# 1. Absolute JES
# The file with the absolute JES factors
AbsoluteJES.CalibFile: JetCalibTools/CalibrationFactors/AbsoluteJES_Rel17.2_AreaSubtracted_1.config
AbsoluteJES.Description: JES for release 17.2, derived November 2012 with Jet Areas, for application to Data12 and MC12
# How low in ET do we extrapolate along the calibration curve ?
AntiKt4TopoEM.MinPtForETAJES: 10
AntiKt4LCTopo.MinPtForETAJES: 10
AntiKt6TopoEM.MinPtForETAJES: 15
AntiKt6LCTopo.MinPtForETAJES: 20
# Which method should be used to extend the calibration curve past the minimum ET ?
# 0 = calibation curve is frozen at minimum ET
# 1 = slope of calibration curve is frozen at minimum ET (recommended)
# 2 = order 2 polynomial is used to extend the calibration curve
LowPtJESExtrapolationMethod: 1
LowPtJESExtrapolationMinimumResponse: 0.25
# ----------------
# 2. Pile-up correction
# What offset correction to apply
OffsetCorrection.Name: OffsetMC12Nov2012
# What residual jet-area offset correction to apply
ResidualOffsetCorrection.Name: ResidualOffsetMC12Nov2012
# These corrections should correspond to the
# conditions of the absolute JES calibration
OffsetCorrection.DefaultMuRef: 0
OffsetCorrection.DefaultNPVRef: 1
# additional config files to include
ResidualOffset.CalibFile: JetCalibTools/CalibrationFactors/MCBasedOffset_Nov2012.config
# mu-scale factor used (only for MC)
MuScaleFactor: 1.09
# should the beam-spot correction be applied (only for MC)
ApplyNPVBeamspotCorrection: 1
# Set this to 1 to apply full 4-vector area correction
ApplyFullJetArea4MomentumCorrection: 0
# ----------------
# 4. Global sequential calibration
ApplyGSCCorrection: true
GSCFactorsFile: JetCalibTools/CalibrationFactors/GSC_factors_March2014.root
#Order of GSC correction is Tile0->EM3->nTrk->trackWIDTH->PunchThrough, use the GSCDepth flag to control the last correction applied
#Acceptable values for the GSC Depth flag are: "Tile0", "EM3", "nTrk", "trackWIDTH", "PunchThrough", or "Full" (equivalent to "PunchThrough")
GSCDepth: Full
PunchThroughEtaBins: 0.0 1.3 1.9 2.7
######################
# Relative JES correction applied to data only to correct for features not captured by MC
InsituCalibrationFile: JetCalibTools/InsituCalibration/InsituCalibration_October02_2014.root
InsituCalibrationDescription: Close to final eta-intecalibration for 2012 dataset, other in-situ histograms are filled with 1
# eta-intercalibration from dijet events
RelativeInsituCalibrationHistogram: JETALGO_EtaInterCalibration
# absolute scale from Z+jet, gamma+jet and multijet balance
AbsoluteInsituCalibrationHistogram: JETALGO_InsituCalib
####################
#
# Config file for xAOD trigger jet calibration
#
# Config file author: Joe Taenzer, November 29th 2014
#
#####################
# ----------------
# 1. Absolute JES