Verified Commit 52c6274d authored by Tadej Novak's avatar Tadej Novak
Browse files

Testing WIP

parent c555edf6
......@@ -4,6 +4,7 @@
atlas_subdir( AlgorithmsConfiguration )
atlas_install_data( data/* )
atlas_install_python_modules( python/*.py )
# atlas_install_joboptions( share/*_jobOptions.py )
atlas_install_scripts( share/*_eljob.py )
##################################################
# SUSYTools configuration file
##################################################
EleBaseline.Pt: 10000.
EleBaseline.Eta: 2.47
EleBaseline.Id: LooseAndBLayerLLH
EleBaseline.CrackVeto: false
EleBaseline.z0: 0.5
#
Ele.Et: 25000.
Ele.Eta: 2.47
Ele.CrackVeto: false
Ele.Iso: FCLoose
Ele.IsoHighPt: FCHighPtCaloOnly # tight iso required for electrons pt > 200 GeV
Ele.Id: TightLLH
Ele.d0sig: 5.
Ele.z0: 0.5
# ChargeIDSelector WP
Ele.CFT: None
#
MuonBaseline.Pt: 10000.
MuonBaseline.Eta: 2.7
MuonBaseline.Id: 1 # Medium
MuonBaseline.z0: 0.5
#
Muon.Pt: 25000.
Muon.Eta: 2.7
Muon.Id: 1 # Medium
Muon.Iso: Loose_VarRad
Muon.IsoHighPt: Loose_VarRad # change WP if you want
Muon.d0sig: 3.
Muon.z0: 0.5
#
MuonCosmic.z0: 1.
MuonCosmic.d0: 0.2
#
BadMuon.qoverp: 0.4
#
PhotonBaseline.Pt: 25000.
PhotonBaseline.Eta: 2.37
PhotonBaseline.Id: Tight
#
Photon.Pt: 130000.
Photon.Eta: 2.37
Photon.Id: Tight
Photon.Iso: FixedCutTight
#
Tau.Pt: 20000.
Tau.Eta: 2.5
Tau.Id: Medium
#Tau.DoTruthMatching: false
#
Jet.Pt: 20000.
Jet.Eta: 2.8
Jet.InputType: 9 # EMTopo 1, PFlow: 9. PFlow is new recommended for everything beyond Winter.
Jet.UncertConfig: rel21/Summer2019/R4_CategoryReduction_SimpleJER.config # This is the uncertainty for analyses going to perform combinations. Otherwise rel21/Summer2019/R4_SR_Scenario1_SimpleJER.conf can be used if insensitive to JES. If you are wanting to do the fullJER (with PDSmear) please use : rel21/Summer2019/R4_CategoryReduction_FullJER.config and PDSmearing below set to true).
Jet.JvtWP: Default # EMTopo recommended = Default (= Medium), PFlow recommended = Default (= Tight)
Jet.JvtPtMax: 60.0e3
Jet.JMSCalib: false
#Jet.AnalysisFile:
Jet.UncertPDsmearing: false # set this to true for pseudo-data smearing for FullJER if using the FullJER or AllJER. This will produce two version of the JET_JER systematics (differing with __1 for the non-PDSmear systematic, and __2 for the PDSmear systematic). This should be false if using SimpleJER (SUSYTools will report an error message)
#
FwdJet.doJVT: false
FwdJet.JvtEtaMin: 2.5
FwdJet.JvtWP: Tight # Tight fJVT with Tight MET / Loose fJVT with Tenacious MET
FwdJet.JvtPtMax: 120.0e3
#
Jet.LargeRcollection: AntiKt10LCTopoTrimmedPtFrac5SmallR20Jets # set to None to turn this off
Jet.LargeRuncConfig: rel21/Spring2019/R10_GlobalReduction.config # set to None to turn this off
#Jet.LargeRuncVars: pT,mass,D2Beta1 # W/Z Taggers
#Jet.LargeRuncVars: pT,Split23,Tau32WTA # Top taggers
#
Jet.WtaggerConfig: SmoothedContainedWTagger_AntiKt10TrackCaloClusterTrimmed_MaxSignificance_3Var_MC16d_20190410.dat # set to None to turn this off
Jet.ZtaggerConfig: SmoothedContainedZTagger_AntiKt10TrackCaloClusterTrimmed_MaxSignificance_3Var_MC16d_20190410.dat # set to None to turn this off
Jet.ToptaggerConfig: JSSDNNTagger_AntiKt10LCTopoTrimmed_TopQuarkInclusive_MC16d_20190405_80Eff.dat # set to None to turn this off
#
BadJet.Cut: LooseBad
#
#master switch for btagging use in ST. If false, btagging is not used neither for jets decorations nor for OR (regardless of the options below)
Btag.enable: true
#
Btag.Tagger: DL1 # MV2c10, DL1, DL1mu, DL1rnn, MV2c10mu, MV2c10rnn, MC2cl100_MV2c100
Btag.WP: FixedCutBEff_77
#Btag.TimeStamp: # (default) 201810, 201903, or empty (but set) for older derivations
Btag.MinPt: 20000.
#
TrackJet.Coll: AntiKtVR30Rmax4Rmin02TrackJets # AntiKt2PV0TrackJets
TrackJet.Pt: 20000.
TrackJet.Eta: 2.8
BtagTrkJet.enable: true
BtagTrkJet.Tagger: MV2c10
BtagTrkJet.WP: FixedCutBEff_77
#BtagTrkJet.TimeStamp: # 201810, 201903, or (default) empty (but set) for older derivations
BtagTrkJet.MinPt: 10000.
#
# set the -999. to positive number to override default
OR.DoBoostedElectron: true
OR.BoostedElectronC1: -999.
OR.BoostedElectronC2: -999.
OR.BoostedElectronMaxConeSize: -999.
OR.DoBoostedMuon: true
OR.BoostedMuonC1: -999.
OR.BoostedMuonC2: -999.
OR.BoostedMuonMaxConeSize: -999.
OR.DoMuonJetGhostAssociation: true
OR.DoTau: false
OR.DoPhoton: false
OR.Bjet: false
OR.ElBjet: false
OR.ElEl: false
OR.ElMu: false
OR.MuBjet: false
OR.TauBjet: false
OR.MuJetApplyRelPt: false
OR.MuJetPtRatio: -999.
OR.MuJetTrkPtRatio: -999.
OR.RemoveCaloMuons: true
OR.MuJetInnerDR: -999.
OR.BtagWP: FixedCutBEff_85
OR.BJetPtUpperThres: -1
#
OR.DoFatJets: false
OR.EleFatJetDR: -999.
OR.JetFatJetDR: -999.
#
SigLep.RequireIso: true
#
MET.EleTerm: RefEle
MET.GammaTerm: RefGamma
MET.TauTerm: RefTau
MET.JetTerm: RefJet
MET.MuonTerm: Muons
MET.OutputTerm: Final
MET.JetSelection: Tight # Loose, Tight, Tighter, Tenacious
MET.RemoveOverlappingCaloTaggedMuons: true
MET.DoRemoveMuonJets: true
MET.UseGhostMuons: false
MET.DoMuonEloss: false
#
# Trigger SFs configuration
Ele.TriggerSFStringSingle: SINGLE_E_2015_e24_lhmedium_L1EM20VH_OR_e60_lhmedium_OR_e120_lhloose_2016_2018_e26_lhtight_nod0_ivarloose_OR_e60_lhmedium_nod0_OR_e140_lhloose_nod0
#
# actual Mu files have to be set in SUSYTools
PRW.ActualMu2017File: GoodRunsLists/data17_13TeV/20180619/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root
PRW.ActualMu2018File: GoodRunsLists/data18_13TeV/20190318/physics_25ns_Triggerno17e33prim.actualMu.OflLumi-13TeV-010.root
# default to None but do set to BFilter (366010-366017), CFilterBVeto (366019-366026), or CVetoBVeto (366028-366035) to remap MC16e Znunu dsid
PRW.autoconfigPRWHFFilter: None
#
StrictConfigCheck: true
......@@ -34,18 +34,22 @@ def _createCfgFlags():
acf.addFlag('Steering.EnableCutflow', False)
acf.addFlag('Steering.EnableKinematicHistograms', False)
# Systematics
acf.addFlag('Systematics.Sigma', 1)
acf.addFlag('Systematics.Regex', '.*')
# Muons
acf.addFlag('MuonBaseline.Pt', 7 * GeV)
acf.addFlag('MuonBaseline.Eta', 2.5)
acf.addFlag('MuonBaseline.Id', 2) # Loose
acf.addFlag('MuonBaseline.Pt', 10 * GeV)
acf.addFlag('MuonBaseline.Eta', 2.7)
acf.addFlag('MuonBaseline.Id', 1) # Loose
acf.addFlag('MuonBaseline.Iso', 'NonIso')
acf.addFlag('MuonBaseline.d0sig', 3.)
acf.addFlag('MuonBaseline.z0', 0.5)
acf.addFlag('Muon.Pt', 7 * GeV)
acf.addFlag('Muon.Eta', 2.5)
acf.addFlag('Muon.Pt', 25 * GeV)
acf.addFlag('Muon.Eta', 2.7)
acf.addFlag('Muon.Id', 1) # Medium
acf.addFlag('Muon.Iso', 'NonIso')
acf.addFlag('Muon.Iso', 'Loose_VarRad')
acf.addFlag('Muon.d0sig', 3.)
acf.addFlag('Muon.z0', 0.5)
......
......@@ -19,7 +19,7 @@ def commonSequenceList(flags):
sequences.append(pileupSequence)
from MuonAnalysisAlgorithms.MuonAnalysisSequence import makeMuonAnalysisSequence
muonSequence = makeMuonAnalysisSequence (flags, 'Medium.NonIso')
muonSequence = makeMuonAnalysisSequence (flags, 'Muon', ptSelectionOutput=True)
muonSequence.configure( inputName = 'Muons',
outputName = 'AnalysisMuons_%SYS%' )
sequences.append(muonSequence)
......@@ -27,23 +27,9 @@ def commonSequenceList(flags):
return sequences
def commonNtuplesOutput(flags):
def commonNtuplesOutput(flags, susy=False):
"""Create common ntuples output."""
branches = []
# Without systematics
# branches += makeEventOutputBranches(dataType, config)
# branches += makeJetOutputBranches(dataType, config)
# branches += makeElectronOutputBranches(dataType, config, configSignal)
branches += makeMuonOutputBranches(flags)
# branches += makeTauOutputBranches(dataType, config, configSignal)
# branches += makeMetOutputBranches()
# With systematics
# branches += makeEventOutputBranchesSys(dataType, config)
# branches += makeJetOutputBranchesSys(dataType, config)
# branches += makeElectronOutputBranchesSys(dataType, config)
branches += makeMuonOutputBranchesSys(flags)
# branches += makeTauOutputBranchesSys(dataType, config)
# branches += makeMetOutputBranchesSys()
branches = commonBranches(flags, susy=susy)
# Add a tree
algs = []
......@@ -70,16 +56,37 @@ def commonNtuplesOutput(flags):
return algs
def commonBranches(flags, susy=False):
branches = []
# Without systematics
# branches += makeEventOutputBranches(dataType, config)
# branches += makeJetOutputBranches(dataType, config)
# branches += makeElectronOutputBranches(dataType, config, configSignal)
branches += makeMuonOutputBranches(flags, 'STCalibMuons' if susy else 'AnalysisMuons')
# branches += makeTauOutputBranches(dataType, config, configSignal)
# branches += makeMetOutputBranches()
# With systematics
# branches += makeEventOutputBranchesSys(dataType, config)
# branches += makeJetOutputBranchesSys(dataType, config)
# branches += makeElectronOutputBranchesSys(dataType, config)
branches += makeMuonOutputBranchesSys(flags, 'STCalibMuons' if susy else 'AnalysisMuons')
# branches += makeTauOutputBranchesSys(dataType, config)
# branches += makeMetOutputBranchesSys()
return branches
def prependContainerName(list, name):
return [name + '_' + s for s in list]
def makeMuonOutputBranches(flags, container='AnalysisMuons'):
prefix = 'NOSYS' if 'ST' not in container else container
# Base variables
branches = [
'NOSYS.eta -> mu_eta',
'NOSYS.phi -> mu_phi',
'NOSYS.charge -> mu_charge',
prefix + '.eta -> mu_eta',
prefix + '.phi -> mu_phi',
prefix + '.charge -> mu_charge',
]
# TODO: trigger matching
......@@ -99,15 +106,27 @@ def makeMuonOutputBranches(flags, container='AnalysisMuons'):
# ]
# set the final output container
return prependContainerName(branches, container)
if 'ST' in container:
return branches
else:
return prependContainerName(branches, container)
def makeMuonOutputBranchesSys(flags, container='AnalysisMuons'):
# Base variables
branches = [
'%SYS%.pt -> mu_pt_%SYS%',
'%SYS%.is_bad -> mu_isBadMuon_%SYS%',
]
prefix = 'NOSYS' if 'ST' not in container else container
prefix_sys = '%SYS%' if 'ST' not in container else container
if 'ST' in container:
branches = [
prefix_sys + '.pt -> mu_pt_NOSYS',
# prefix_sys + '.is_bad -> mu_isBadMuon_NOSYS',
]
else:
branches = [
prefix_sys + '.pt -> mu_pt_%SYS%',
# prefix_sys + '.is_bad -> mu_isBadMuon_%SYS%',
]
# TODO: final selection
# branches.append('NOSYS.mu_selected_%SYS% -> mu_selected_%SYS%')
......@@ -158,4 +177,7 @@ def makeMuonOutputBranchesSys(flags, container='AnalysisMuons'):
# branches.append('%s.muon_effData_%s_NOSYS -> mu_effData_Trig_%s_%s' % ('%SYS%', trigwp, trigwp, '%SYS%'))
# set the final output container
return prependContainerName(branches, container)
if 'ST' in container:
return branches
else:
return prependContainerName(branches, container)
......@@ -30,9 +30,10 @@ ROOT.xAOD.Init().ignore()
dataType = options.data_type
inputfile = {"data": 'ASG_TEST_FILE_DATA',
"mc": 'ASG_TEST_FILE_MC',
"afii": 'ASG_TEST_FILE_MC_AFII'}
inputfile = {"data": '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.data18_p4016.PHYSVAL.pool.root',
"mc": '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.FS_mc16e_p4017.PHYSVAL.pool.root',
"afii": '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.AFII_mc16e_p4017.PHYSVAL.pool.root',
}
if dataType not in ["data", "mc", "afii"] :
raise ValueError ("invalid data type: " + dataType)
......@@ -43,7 +44,7 @@ import os
sh = ROOT.SH.SampleHandler()
sh.setMetaString( 'nc_tree', 'CollectionTree' )
sample = ROOT.SH.SampleLocal (dataType)
sample.add (os.getenv (inputfile[dataType]))
sample.add (inputfile[dataType])
sh.add (sample)
sh.printContent()
......@@ -55,11 +56,13 @@ job.options().setDouble( ROOT.EL.Job.optMaxEvents, 100 )
# Configure the sequence
from AlgorithmsConfiguration.AnalysisConfigFlags import ConfigFlags as flags
flags.Input.DataType = dataType
flags.Systematics.Sigma = 0
# Set up the systematics loader/handler algorithm:
from AnaAlgorithm.DualUseConfig import createAlgorithm
sysLoader = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' )
sysLoader.sigmaRecommended = 1
sysLoader.sigmaRecommended = flags.Systematics.Sigma
sysLoader.systematicsRegex = flags.Systematics.Regex
job.algsAdd( sysLoader )
# Setup steered sequence
......
#!/usr/bin/env python
#
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
#
# @author Tadej Novak
from __future__ import print_function
# Read the submission directory as a command line argument. You can
# extend the list of arguments with your private ones later on.
import optparse
parser = optparse.OptionParser()
parser.add_option( '-d', '--data-type', dest = 'data_type',
action = 'store', type = 'string', default = 'mc',
help = 'Type of data to run over. Valid options are data, mc, afii' )
parser.add_option( '-s', '--submission-dir', dest = 'submission_dir',
action = 'store', type = 'string', default = 'SUSYDir',
help = 'Submission directory for EventLoop' )
parser.add_option( '-u', '--unit-test', dest='unit_test',
action = 'store_true', default = False,
help = 'Run the job in "unit test mode"' )
( options, args ) = parser.parse_args()
# Set up (Py)ROOT.
import ROOT
ROOT.xAOD.Init().ignore()
# ideally we'd run over all of them, but we don't have a mechanism to
# configure per-sample right now
dataType = options.data_type
inputfile = {"data": '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.data18_p4016.PHYSVAL.pool.root',
"mc": '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.FS_mc16e_p4017.PHYSVAL.pool.root',
"afii": '/cvmfs/atlas-nightlies.cern.ch/repo/data/data-art/SUSYTools/DAOD_PHYSVAL.mc16_13TeV.410470.AFII_mc16e_p4017.PHYSVAL.pool.root',
}
if dataType not in ["data", "mc", "afii"] :
raise ValueError ("invalid data type: " + dataType)
# Set up the sample handler object. See comments from the C++ macro
# for the details about these lines.
import os
sh = ROOT.SH.SampleHandler()
sh.setMetaString( 'nc_tree', 'CollectionTree' )
sample = ROOT.SH.SampleLocal (dataType)
sample.add (inputfile[dataType])
sh.add (sample)
sh.printContent()
# Create an EventLoop job.
job = ROOT.EL.Job()
job.sampleHandler( sh )
job.options().setDouble( ROOT.EL.Job.optMaxEvents, 100 )
# Create the algorithm's configuration. Note that we'll be able to add
# algorithm property settings here later on.
from AnaAlgorithm.AnaAlgorithmConfig import AnaAlgorithmConfig
config = AnaAlgorithmConfig( 'SUSYToolsAlg' )
config.STConfigFile = 'AlgorithmsConfiguration/test_SUSYTools_Default.conf'
config.DoSyst = False
config.DataSource = 1
config.PRWLumiCalc = []
config.UsePRWAutoconfig = True
if dataType != "data" :
config.mcChannel = 410470
# Running over '18-like periods
config.mcCampaign = "mc16e"
config.PRWLumiCalc = [
"/cvmfs/atlas.cern.ch/repo/sw/database/GroupData/GoodRunsLists/data18_13TeV/20181111/ilumicalc_histograms_None_348885-364292_OflLumi-13TeV-001.root"
]
if dataType == "afii":
config.DataSource = 2
elif dataType== "data":
config.DataSource = 0
job.algsAdd( config )
# Output
from AnaAlgorithm.DualUseConfig import createAlgorithm
sysLoader = createAlgorithm( 'CP::SysListLoaderAlg', 'SysLoaderAlg' )
sysLoader.sigmaRecommended = 0
job.algsAdd( sysLoader )
from AlgorithmsConfiguration.AnalysisConfigFlags import ConfigFlags as flags
from AlgorithmsConfiguration.Steering import commonNtuplesOutput
for alg in commonNtuplesOutput(flags, True):
job.algsAdd(alg)
# Set up an output file for the job:
job.outputAdd( ROOT.EL.OutputStream( 'ANALYSIS' ) )
# Find the right output directory:
submitDir = options.submission_dir
if options.unit_test:
import os
import tempfile
submitDir = tempfile.mkdtemp( prefix = 'configurationTest_', dir = os.getcwd() )
os.rmdir( submitDir )
pass
# Run the job using the direct driver.
driver = ROOT.EL.DirectDriver()
driver.submit( job, submitDir )
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment