Commit 99738316 authored by Pierre Antoine Delsart's avatar Pierre Antoine Delsart Committed by Graeme Stewart
Browse files

'adapt to new event shape objects' (JetRec-02-04-05)

2014-10-17    <delsart@localhost>
	* adapt to new event shape objects :
	* python/JetRecFlags.py : eventShapeTools default value ['lc','em']
	* share/JetRec_jobOptions.py : save EventShape objects
	* python/JetRecUtils.py : adapt retrieveAODList to EventShape objects
	* tag JetRec-02-04-05

2014-10-10    <delsart@localhost>

	* python/JetRecCalibrationFinder.py : adapted to PathResolver in
	JetCalibTools
	* tag JetRec-02-04-04

2014-10-10 David Adams
	* JetRec-02-04-03
	* See ATLJETMET-10.
	* python/JetRecStandardTools.py: Add definition of modifier showerdec.
	* share/RunJetRec.py: Add showerdec to the modifiers for topo jets.
	* share/test_RunJetRec.py: Add display of the showerdec moments.
...
(Long ChangeLog diff - truncated)
parent 5636eab1
......@@ -111,6 +111,7 @@ private:
ToolHandleArray<IJetModifier> m_modifiers;
bool m_trigger;
int m_timer;
bool m_shallowCopy;
// Cached state.
int m_initCount;
......
......@@ -15,6 +15,7 @@
#include "AsgTools/ToolHandleArray.h"
#include "AsgTools/AsgTool.h"
#include "EventShapeInterface/IEventShapeTool.h"
#include "JetInterface/IJetExecuteTool.h"
#include "TStopwatch.h"
......@@ -38,7 +39,7 @@ public:
// Finalization. Write summary report.
StatusCode finalize();
// Lop over tools.
// Loop over tools.
int execute() const;
// Display the configuration.
......@@ -47,12 +48,14 @@ public:
private:
// Properties.
ToolHandleArray<IEventShapeTool> m_evstools;
ToolHandleArray<IJetExecuteTool> m_exetools;
int m_timer;
// Clocks.
mutable unsigned int m_nevt;
mutable TStopwatch m_clock;
mutable std::vector<TStopwatch> m_evsclocks;
mutable std::vector<TStopwatch> m_execlocks;
};
......
......@@ -14,6 +14,10 @@
#include <fstream>
//#include "AthenaKernel/errorcheck.h"
#include "xAODCore/ShallowCopy.h"
#include "JetEDM/FastJetLink.h"
#include "xAODJet/Jet_PseudoJet.icc"
typedef ToolHandleArray<IPseudoJetGetter> PseudoJetGetterArray;
typedef ToolHandleArray<IJetModifier> ModifierArray;
......@@ -24,14 +28,33 @@ using std::setprecision;
using xAOD::JetContainer;
using xAOD::Jet;
namespace {
// void deepCopyJets( const xAOD::JetContainer & jetsin, xAOD::JetContainer & jetsout){
// }
xAOD::JetContainer* shallowCopyJets( const xAOD::JetContainer& jetsin){
xAOD::JetContainer & shallowcopy = *(xAOD:: shallowCopyContainer( jetsin).first);
for (size_t i=0;i<shallowcopy.size(); i++) {
const fastjet::PseudoJet * pseudoJ = jetsin[i]->getPseudoJet();
if( pseudoJ ) shallowcopy[i]->setPseudoJet(pseudoJ);
}
return &shallowcopy;
}
}
//**********************************************************************
JetRecTool::JetRecTool(std::string myname)
: AsgTool(myname), m_intool(""),
m_finder(""), m_groomer(""),
m_trigger(false),
m_shallowCopy(true),
m_initCount(0),
m_find(false), m_groom(false), m_copy(false) {
m_find(false), m_groom(false), m_copy(false) {
declareProperty("OutputContainer", m_outcoll);
declareProperty("InputContainer", m_incoll);
declareProperty("InputTool", m_intool);
......@@ -41,6 +64,8 @@ JetRecTool::JetRecTool(std::string myname)
declareProperty("JetModifiers", m_modifiers);
declareProperty("Trigger", m_trigger);
declareProperty("Timer", m_timer =0);
declareProperty("ShallowCopy", m_shallowCopy =true);
}
//**********************************************************************
......@@ -74,6 +99,8 @@ StatusCode JetRecTool::initialize() {
needout = true;
}
}
m_shallowCopy &= m_copy; // m_shallowCopy is false if not copy mode
ATH_MSG_INFO("Jet reconstruction mode: " << mode);
// Check/set the input jet collection name.
if ( needinp ) {
......@@ -360,14 +387,22 @@ const JetContainer* JetRecTool::build() const {
m_actclock.Stop();
return 0;
}
pjets = new JetContainer;
if ( m_trigger ) {
ATH_MSG_DEBUG("Attaching online Aux container.");
pjets->setStore(new xAOD::JetTrigAuxContainer);
if(m_shallowCopy) {
ATH_MSG_DEBUG("Shallow-copying jets.");
pjets = shallowCopyJets(*pjetsin);
++naction;
} else {
ATH_MSG_DEBUG("Attaching offline Aux container.");
pjets->setStore(new xAOD::JetAuxContainer);
pjets = new JetContainer;
if ( m_trigger ) {
ATH_MSG_DEBUG("Attaching online Aux container.");
pjets->setStore(new xAOD::JetTrigAuxContainer);
} else {
ATH_MSG_DEBUG("Attaching offline Aux container.");
pjets->setStore(new xAOD::JetAuxContainer);
}
}
// Find jets.
if ( ! m_finder.empty() ) {
ATH_MSG_DEBUG("Finding jets.");
......@@ -382,7 +417,7 @@ const JetContainer* JetRecTool::build() const {
}
++naction;
// Copy jets.
} else if ( pjetsin != 0 ) {
} else if ( (pjetsin != 0 ) && !m_shallowCopy) {
ATH_MSG_DEBUG("Copying " << pjetsin->size() << " jets.");
#ifdef USE_BOOST_FOREACH
BOOST_FOREACH(const Jet* poldjet, *pjetsin) {
......@@ -440,6 +475,9 @@ int JetRecTool::execute() const {
}
if ( m_trigger ) {
return record<xAOD::JetTrigAuxContainer>(pjets);
}
if (m_shallowCopy) {
return record<xAOD::ShallowAuxContainer>(pjets);
}
return record<xAOD::JetAuxContainer>(pjets);
}
......
......@@ -21,6 +21,7 @@ using std::fixed;
JetToolRunner::JetToolRunner(const std::string& myname)
: AsgTool(myname) {
declareProperty("Tools", m_exetools);
declareProperty("EventShapeTools", m_evstools);
declareProperty("Timer", m_timer =0);
}
......@@ -30,9 +31,13 @@ StatusCode JetToolRunner::initialize() {
StatusCode sc;
ATH_MSG_INFO("Initializing " << name() << "...");
ATH_MSG_INFO("Retrieving tools...");
sc = m_evstools.retrieve();
if ( ! sc.isSuccess() ) {
ATH_MSG_ERROR("Eventshape tool retrieval failed.");
}
sc = m_exetools.retrieve();
if ( ! sc.isSuccess() ) {
ATH_MSG_ERROR("Tool retrieval failed.");
ATH_MSG_ERROR("Execute tool retrieval failed.");
}
ATH_MSG_INFO("Tool retrieval completed.");
unsigned int ntool = m_exetools.size();
......@@ -43,6 +48,14 @@ StatusCode JetToolRunner::initialize() {
m_exetools[itool]->print();
m_execlocks[itool].Reset();
}
unsigned int nevstool = m_evstools.size();
ATH_MSG_INFO(" Tool count: " << nevstool);
m_evsclocks.resize(nevstool);
for ( unsigned int itool=0; itool<nevstool; ++itool ) {
ATH_MSG_INFO(" " << m_evstools[itool]->name());
m_evstools[itool]->print();
m_evsclocks[itool].Reset();
}
m_nevt = 0;
m_clock.Reset();
return StatusCode::SUCCESS;
......@@ -66,8 +79,27 @@ StatusCode JetToolRunner::finalize() {
ATH_MSG_INFO(" Avg. CPU/wall time: " << actime << "/" << awtime << " sec");
}
if ( m_timer > 1 && m_nevt > 0 ) {
unsigned int nevstool = m_exetools.size();
ATH_MSG_INFO(" CPU/wall time [s] for " << nevstool << " event shape tools:");
for ( unsigned int itool=0; itool<nevstool+1; ++itool ) {
string tname = "TOTAL";
#ifdef USE_BOOST_AUTO
BOOST_AUTO(pclock, &m_clock);
#else
TStopwatch* pclock = &m_clock;
#endif
if ( itool < nevstool ) {
pclock = &m_evsclocks[itool];
tname = m_evstools[itool]->name();
if ( tname.substr(0,8) == "ToolSvc." ) tname = tname.substr(8);
}
double tctime = pclock->CpuTime()/double(m_nevt);
double twtime = pclock->RealTime()/double(m_nevt);
ATH_MSG_INFO(" " << setw(50) << tname
<< fixed << setprecision(3) << setw(10) << tctime
<< fixed << setprecision(3) << setw(10) << twtime);
}
unsigned int ntool = m_exetools.size();
ATH_MSG_INFO(" CPU/wall time [s] for " << ntool << " tools:");
for ( unsigned int itool=0; itool<ntool+1; ++itool ) {
string tname = "TOTAL";
#ifdef USE_BOOST_AUTO
......@@ -95,10 +127,25 @@ StatusCode JetToolRunner::finalize() {
int JetToolRunner::execute() const {
if ( m_timer > 0 ) m_clock.Start(false);
ATH_MSG_VERBOSE("Executing " << name() << "...");
// Loop over tools.
string line = "---------------------------------------------------";
// Loop over event shape tools.
unsigned int nevstool = m_evstools.size();
ATH_MSG_DEBUG("Looping over " << nevstool << " event shape tools.");
if ( nevstool ) ATH_MSG_DEBUG(line);
for ( unsigned int itool=0; itool<nevstool; ++itool ) {
ToolHandle<IEventShapeTool> htool = m_evstools[itool];
ATH_MSG_DEBUG("Executing tool " << htool->name());
ATH_MSG_VERBOSE("Retrieving tool with IEventShapeTool interface.");
if ( m_timer > 1 ) m_evsclocks[itool].Start(false);
StatusCode sc = htool->fillEventShape();
if ( m_timer > 1 ) m_evsclocks[itool].Stop();
if ( ! sc.isSuccess() ) ATH_MSG_INFO("Events shape tool returned error.");
else ATH_MSG_DEBUG("Tool execution succeeded");
ATH_MSG_DEBUG(line);
}
// Loop over execute tools.
unsigned int ntool = m_exetools.size();
ATH_MSG_DEBUG("Looping over " << ntool << " jet execute tools.");
string line = "---------------------------------------------------";
if ( ntool ) ATH_MSG_DEBUG(line);
for ( unsigned int itool=0; itool<ntool; ++itool ) {
ToolHandle<IJetExecuteTool> htool = m_exetools[itool];
......@@ -107,7 +154,6 @@ int JetToolRunner::execute() const {
if ( m_timer > 1 ) m_execlocks[itool].Start(false);
int jstat = htool->execute();
if ( m_timer > 1 ) m_execlocks[itool].Stop();
ATH_MSG_VERBOSE("Tool retrieved.");
if ( jstat != 0 ) ATH_MSG_INFO("Tool returned error " << jstat);
else ATH_MSG_DEBUG("Tool execution succeeded");
ATH_MSG_DEBUG(line);
......@@ -123,7 +169,13 @@ int JetToolRunner::execute() const {
void JetToolRunner::print() const {
ATH_MSG_INFO("Properties for JetToolRunner " << name());
ATH_MSG_INFO(" Tool list has " << m_exetools.size() << " entries:");
ATH_MSG_INFO(" Event Shape tool list has " << m_evstools.size() << " entries:");
for ( ToolHandleArray<IEventShapeTool>::const_iterator itoo=m_evstools.begin();
itoo!=m_evstools.end(); ++itoo ) {
ToolHandle<IEventShapeTool> htool = *itoo;
ATH_MSG_INFO(" " << htool->name());
}
ATH_MSG_INFO(" Execute tool list has " << m_exetools.size() << " entries:");
for ( ToolHandleArray<IJetExecuteTool>::const_iterator itoo=m_exetools.begin();
itoo!=m_exetools.end(); ++itoo ) {
ToolHandle<IJetExecuteTool> htool = *itoo;
......
......@@ -7,6 +7,7 @@ private
use AthenaBaseComps AthenaBaseComps-* Control
use xAODEventInfo xAODEventInfo-* Event/xAOD
use xAODTracking xAODTracking-* Event/xAOD
use xAODCore xAODCore-* Event/xAOD
public
......@@ -23,6 +24,7 @@ use JetEDM JetEDM-* Reconstruction/Jet
use JetInterface JetInterface-* Reconstruction/Jet
use AtlasFastJet AtlasFastJet-* External
use AtlasFastJetContrib AtlasFastJetContrib-* External
use EventShapeInterface EventShapeInterface-* Reconstruction/EventShapes
apply_pattern dual_use_library files="../Root/*.cxx *.cxx"
apply_pattern declare_python_modules files="*.py"
......
......@@ -25,6 +25,20 @@ if jetFlags.useTruth:
from JetRec.JetFlavorAlgs import scheduleCopyTruthParticles
scheduleCopyTruthParticles(job)
# Event shape tools.
evstools = []
for name in jetFlags.eventShapeTools():
from EventShapeTools.EventDensityConfig import configEventDensityTool
if name == "em":
jtm += configEventDensityTool("EMTopoEventShape", jtm.emget, 0.4)
evstools += [jtm.tools["EMTopoEventShape"]]
elif name == "lc":
jtm += configEventDensityTool("LCTopoEventShape", jtm.lcget, 0.4)
evstools += [jtm.tools["LCTopoEventShape"]]
else:
print myname + "Invalid event shape key: " + name
raise Exception
# Add the tool runner. It runs the jetrec tools.
rtools = []
if jetFlags.useCells():
......@@ -34,13 +48,21 @@ if jetFlags.useTracks:
rtools += [jtm.tvassoc]
rtools += jtm.jetrecs
from JetRec.JetRecConf import JetToolRunner
jtm += JetToolRunner("jetrun", Tools=rtools, Timer=jetFlags.timeJetToolRunner())
jtm += JetToolRunner("jetrun",
EventShapeTools=evstools,
Tools=rtools,
Timer=jetFlags.timeJetToolRunner()
)
jetrun = jtm.jetrun
# Add the algorithm. It runs the jetrec tools.
from JetRec.JetRecConf import JetAlgorithm
if jetFlags.separateJetAlgs():
job += JetAlgorithm("jetalg")
jetalg = job.jetalg
jetalg.Tools = [jtm.jetrun]
for t in rtools:
jalg = JetAlgorithm("jetalg"+t.name())
jalg.Tools = [t]
......
# Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
# JetRecCalibrationFinder.py
# David Adams
# September 2014
#
# Class to retrieve the calibration tool for a given jet definition
# and calibration sequence.
# Arguments:
# alg - Algorithm name: AntiKt, CamKt or Kt
# rad - Jet size parameter, e.g. 0.4
# inp - Input type: EMTopo or LCTopo
# seq - Calibration sequence as one letter for each step, e.g. "ar"
# a = Active area correction (rho*A)
# r = Pileup residual correction (i.e. using mu and NPV)
# j = JES correction (from MC)
# g = GSC correction (from MC)
# i = Insitu correction (data only)
# The calibration tool is created
class JetRecCalibrationFinder:
calibStep = {
"a":"JetArea",
"r":"Residual",
"j":"AbsoluteEtaJES",
"g":"GSC",
"i":"Insitu"
}
def find(self, alg, rad, inpin, seq):
from JetCalibTools.JetCalibToolsConf import JetCalibrationTool
from JetRec.JetRecStandard import jtm
config = "JES_Full2012dataset_Preliminary_MC14.config", # Apparently does not have the required initial P4 state name
config = "JES_Full2012dataset_Preliminary_Jan13.config"
inp = inpin
if config == "JES_Full2012dataset_Preliminary_Jan13.config":
if inp == "EMTopo": inp = "TopoEM"
configfile = 'JetCalibTools/CalibrationConfigs/' + config
myname = "JetRecCalibrationFinder:find: "
print myname + "Arguments:"
print myname + " alg: " + str(alg)
print myname + " rad: " + str(rad)
print myname + " inp: " + str(inp)
print myname + " seq: " + str(seq)
jetdefn = alg + str(int(10*rad+0.1)) + inp
print myname + "jetdefn: " + jetdefn
tname = "calib_" + jetdefn + "_" + seq
print myname + "tool name: " + tname
if not tname in jtm.tools:
# build calib tool
print myname + "Creating " + tname
try:
fullseq = [self.calibStep[l] for l in seq] # translate letters
except KeyError as err:
print myname + " ERROR Invalid sequence: " + seq
print myname + " ERROR Unknown sequence key: " + err.message
raise err
fullseq = '_'.join(fullseq) # join seq names with a '_'
print myname + " Calibration sequence: " + fullseq
jtm += JetCalibrationTool(tname, JetCollection =jetdefn, ConfigFile =configfile, CalibSequence =fullseq)
return jtm.tools[tname]
# This is the only instance of the above class that should be used to
# that should be used to fetch calibration tools.
jrcf = JetRecCalibrationFinder()
......@@ -107,6 +107,14 @@ class usePflow(JobProperty):
allowedTypes = ['bool'] # type
StoredValue = True # default value
class eventShapeTools(JobProperty):
""" List of event shape tools that should be called to calculate rho.
Allowed values are "em" and "lc".
"""
statusOn = True
allowedTypes = ['list'] # type
StoredValue = ['em', 'lc'] # default value
class useInDetTrackSelection(JobProperty):
""" If true, the InDet track selection tool is used.
"""
......@@ -143,12 +151,12 @@ class additionalTopoGetters(JobProperty):
allowedTypes = ['list'] # type
StoredValue = [] # default value
class applyCalibrationName(JobProperty):
""" Calibration applied to topo jets during jet building: none, offset or jes
class defaultCalibOpt(JobProperty):
""" Calibration applied to topo jets during jet building. See JetRecCalibrationFinder.
"""
statusOn = True
allowedTypes = ['str'] # type
StoredValue = "offset" # default value
StoredValue = "" # default value
class containerNamePrefix(JobProperty):
""" Prefix for jet collection names
......@@ -196,12 +204,13 @@ jobproperties.JetRecFlags.add_JobProperty(useTracks)
jobproperties.JetRecFlags.add_JobProperty(useInDetTrackSelection)
jobproperties.JetRecFlags.add_JobProperty(useMuonSegments)
jobproperties.JetRecFlags.add_JobProperty(usePflow)
jobproperties.JetRecFlags.add_JobProperty(eventShapeTools)
jobproperties.JetRecFlags.add_JobProperty(jetAODList)
jobproperties.JetRecFlags.add_JobProperty(useCells)
jobproperties.JetRecFlags.add_JobProperty(useCaloQualityTool)
jobproperties.JetRecFlags.add_JobProperty(skipTools)
jobproperties.JetRecFlags.add_JobProperty(additionalTopoGetters)
jobproperties.JetRecFlags.add_JobProperty(applyCalibrationName)
jobproperties.JetRecFlags.add_JobProperty(defaultCalibOpt)
jobproperties.JetRecFlags.add_JobProperty(containerNamePrefix)
jobproperties.JetRecFlags.add_JobProperty(separateJetAlgs)
jobproperties.JetRecFlags.add_JobProperty(timeJetToolRunner)
......
......@@ -12,6 +12,11 @@
# from JetRec.JetRecStandard import jtm
# jtm.addJetFinder("AntiKt4EMTopoJets", "AntiKt", 0.4, "em", "calib_topo_ungroomed")
#
myname = "JetRecStandard.py: "
print myname + "Defining standard tools"
#########################################################
# Create standard tool manager.
#########################################################
......@@ -31,6 +36,8 @@ jtm.ptminFilter = 0
# Add standard tool definitions to the tool manager.
import JetRec.JetRecStandardTools
print myname + "jetFlags.useTruth: " + str(jetFlags.useTruth())
#########################################################
# Getters
#########################################################
......@@ -138,15 +145,7 @@ if jetFlags.useTruth():
# Modifiers for calibrated topo jets.
calib_topo_ungroomed_modifiers = []
calname = jetFlags.applyCalibrationName()
if calname == "none":
calname = ""
elif calname == "offset" or calname == "jes":
if len(calname) and jetFlags.useTracks():
calib_topo_ungroomed_modifiers += ["applyCalibrationTool:" + calname]
else:
print "Invalid calibration name: ", calname
raise Exception
calib_topo_ungroomed_modifiers += ["calib"]
calib_topo_ungroomed_modifiers += topo_ungroomed_modifiers
# Modifiers for groomed jets.
......@@ -167,12 +166,12 @@ def filterout(skiptoolnames, tools):
remtoolnames += [toolname]
if keep:
outtools += [tool]
print "JetRecStandard.py: Removed tools: " + str(remtoolnames)
print myname + "Removed tools: " + str(remtoolnames)
return outtools
# Filter out skipped tools.
if len(jetFlags.skipTools()):
print "JetRecStandard.py: Tools to be skipped: " + str(jetFlags.skipTools())
print myname + "Tools to be skipped: " + str(jetFlags.skipTools())
topo_ungroomed_modifiers = filterout(jetFlags.skipTools(), topo_ungroomed_modifiers)
calib_topo_ungroomed_modifiers = filterout(jetFlags.skipTools(), calib_topo_ungroomed_modifiers)
truth_ungroomed_modifiers = filterout(jetFlags.skipTools(), truth_ungroomed_modifiers)
......
......@@ -58,6 +58,7 @@ from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import EnergyCorr
from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import CenterOfMassShapesTool
from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import JetPullTool
from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import JetChargeTool
from JetSubStructureMomentTools.JetSubStructureMomentToolsConf import ShowerDeconstructionTool
#--------------------------------------------------------------
# Track selection.
......@@ -451,3 +452,7 @@ jtm += JetPullTool("pull", UseEtaInsteadOfY=False)
# Jet charge
jtm += JetChargeTool("charge", K=1.0)
# Shower deconstruction.
jtm += ShowerDeconstructionTool("showerdec")
......@@ -13,9 +13,13 @@ def retrieveAODList():
from RecExConfig.ObjKeyStore import objKeyStore
inputcontent = objKeyStore['inputFile'].list()
esdjets = [o for o in inputcontent if 'xAOD::JetContainer_v1' in o ]
esdjets += [o for o in inputcontent if 'xAOD::JetAuxContainer_v1' in o ]
esdjets += [o for o in inputcontent if 'xAOD::JetTrigAuxContainer_v1' in o ]
typeToSave = [ 'xAOD::JetContainer_v1', 'xAOD::JetAuxContainer_v1', 'xAOD::JetTrigAuxContainer_v1' , 'xAOD::EventShape_v1', 'xAOD::EventShapeAuxInfo_v1' ]
def saveThisObject(o):
# return True if o is of a desired type
return any( o.startswith( typ ) for typ in typeToSave )
esdjets = [ o for o in inputcontent if saveThisObject(o) ]
return esdjets
......
......@@ -127,16 +127,16 @@ class JetToolManager:
return self.modifiersMap[modifiersin]
return modifiersin
# Build the list of modifiers, replacing the string "applyCalibrationTool"
# with the appropriate calibration tool.
def buildModifiers(self, modifiersin, finder, getters, altname, output):
from ApplyJetCalibration.SetupAthenaCalibration import applyCalibrationTool
# Build the list of modifiers, replacing the string "applyCalibrationTool:XXX"
# or "calib:XXX" with the appropriate calibration tool.
def buildModifiers(self, modifiersin, finder, getters, altname, output, calibOpt):
from GaudiKernel.Proxy.Configurable import ConfigurableAlgTool
from JetRec.JetRecConf import JetFinder
outmods = []
inmods = self.getModifiers(modifiersin, altname)
ncalib = 0
for mod in inmods:
print mod
print self.prefix + "Adding modifier " + str(mod)
mod1 = ""
# Split mod = mod1:mod2
if type(mod) == str:
......@@ -150,22 +150,36 @@ class JetToolManager:
if isinstance(mod, ConfigurableAlgTool):
self.msg(2, " Adding modifier " + mod.name())
outmods += [mod]
# applyCalibrationTool:opt - Applies calibration opt = "jes" (full JES) or
# "offset" (rho*A offset only)
elif mod1 == "applyCalibrationTool":
#if not isinstance(finder, JetFinder): raise TypeError
# Add jet calibration:
# calib:XXX - Applies calibration sequence XXX (see JetRecCalibrationFinder)
# using JetCalibrationTool.
elif mod1 == "calib":
ncalib += 1
alg = finder.JetAlgorithm
rad = finder.JetRadius
get = getters[0]
inp = get.Label
if mod2 == "":
mod2 = calibOpt
if mod2 == "":
print self.prefix + "ERROR: Calibration requested without option."
print self.prefix + " Add calibOpt to jet build command or to jetFlags.defaultCalibOpt"
raise Exception
self.msg(0, " Adding " + mod2 + " calibration for " + alg + " R=" + str(rad) + " " + inp)
if mod2 == "offset":
calmod = applyCalibrationTool(alg, rad, inp, onlyOffset=True)
elif mod2 == "jes":
calmod = applyCalibrationTool(alg, rad, inp)
if mod1 == "calib":
from JetRec.JetRecCalibrationFinder import jrcf
calmod = jrcf.find(alg, rad, inp, mod2)
else:
self.msg(0, "Invalid calibration type: " + mod2)
raise LookupError
print self.prefix + "WARNING: Using obsolete calibration tool."
from ApplyJetCalibration.SetupAthenaCalibration import applyCalibrationTool
if mod2 == "offset":
calmod = applyCalibrationTool(alg, rad, inp, onlyOffset=True)
elif mod2 == "jes":
calmod = applyCalibrationTool(alg, rad, inp)
else:
self.msg(0, "Invalid calibration type: " + mod2)
raise LookupError
print self.prefix + "Adding calib modifier " + str(calmod)