Example of ATLASWatchMan Steering File
The
steering file below is an example; it was used to automatically generate this
Analysis Code.
In this
steering file we asks for an
analysis code which perform:
- event selection for 5 analyses, each one with its own cuts;
- custom object slection and overlap removal for 3 analyses out of five;
- perform cuts with user-defined formulas;
- fill branches with UserData, with custom user-defined formulas;
- dump several information from various POOL files containers;
- ...and we list the datasets we want to run upon, in order to make the package automatically generate the script to run the analysis code over them.
#!python
# @file: run/ATLASWatchMan_AnalysisSteeringFile_benchmarkChannels.py
# @author: Riccardo-Maria BIANCHI <rbianchi@cern.ch>
# @author: Renaud BRUNELIERE <bruneli@cern.ch>
# @purpose: a working example of the ATLASWatchMan Steering File
############################################################################
# #
# --- ATLASWatchMan --- #
# #
# Copyright (C) 2008-2009 by #
# #
# Riccardo-Maria BIANCHI #
# #
# Renaud BRUNELIERE #
# #
# (Freiburg University, Germany) #
# #
# For comments and questions: rbianchi@cern.ch, bruneli@cern.ch #
# #
############################################################################
import GaudiKernel.SystemOfUnits as Units
import ROOT
### User Global Options
outputFileName = "OutputD3PD.root" # Output ROOT file name
treeName = "D3PDTree"
printLevel = 5 # Printing level for the output analysis code: 0=Debug, 5=Minimal Info:fiufiu:
printLevelGen = 4 # Printing level for the generation of the analysis code: 0=Debug, 5=Minimal Info
outputLevelAthena = 'INFO' # Printing level while running the generated analysis code with Athena
applyObjSelection = True # Do we apply objects selection ?
applyOverlapRemoval = True # Do we apply overlap removal ?
runOnAtlfast1 = False # Do we run on Atlfast1 file ?
doSkimmingGlobal = True # Do we skim events? If True only those passing at least one channel are kept. True by default.
doEventSelectionEvenIfNotSkimming = True # Do we want to perform Event Selection even if we do not apply Skimming? Not by default
### User Channels/Analyses definitions
# you can specify channels to analyze and cuts for each channel.
channels = {
'3j1lepMediumCutsMTBigger100GeV':{'channel': 'ljjj',
'cuts': {1: {'label': 'leptonPtCutsExclusive',
'value': [20*Units.GeV]
},
2: {'label': 'electronPtVeto',
'range': [10*Units.GeV,20*Units.GeV]
},
3: {'label': 'muonPtVeto',
'range': [10*Units.GeV,20*Units.GeV]
},
4: {'label': 'jetPtCuts',
'value': [100*Units.GeV, 40*Units.GeV, 40*Units.GeV],
},
5: {'label': 'missingEtCut',
'value': 80*Units.GeV,
},
6: {'label': 'METFractionMeffCut',
'value': 0.25
},
7: {'label': 'sphericityCutCSC',
'value': 0.2,
},
8: {'label': 'jet_metDPhiCuts',
'value': [0.2, 0.2, 0.2],
},
9: {'label': 'transverseMassCut',
'value': 100*Units.GeV,
'compare': '<='
},
},
'customCuts':{'muon':{'ptMin': 20.*Units.GeV},
'electron':{'ptMin': 20.*Units.GeV},
'photon':{'applyOverlapRemoval': False},
'tau':{'applyOverlapRemoval': False},
},
},
'3j1lepMediumCutsMTSmaller100GeV':{'channel': 'ljjj',
'cuts': {1: {'label': 'leptonPtCutsExclusive',
'value': [20*Units.GeV]
},
2: {'label': 'electronPtVeto',
'range': [10*Units.GeV,20*Units.GeV]
},
3: {'label': 'muonPtVeto',
'range': [10*Units.GeV,20*Units.GeV]
},
4: {'label': 'jetPtCuts',
'value': [100*Units.GeV, 40*Units.GeV, 40*Units.GeV],
},
5: {'label': 'missingEtCut',
'value': 80*Units.GeV,
},
6: {'label': 'METFractionMeffCut',
'value': 0.25
},
7: {'label': 'sphericityCutCSC',
'value': 0.2,
},
8: {'label': 'jet_metDPhiCuts',
'value': [0.2, 0.2, 0.2],
},
9: {'label': 'transverseMassCut',
'value': 100*Units.GeV,
'compare': '>'
},
},
'customCuts':{'muon':{'ptMin': 20.*Units.GeV},
'electron':{'ptMin': 20.*Units.GeV},
'photon':{'applyOverlapRemoval': False},
'tau':{'applyOverlapRemoval': False},
},
},
'4j0lepCSC':{'channel': 'jjjj',
'cuts':{1: { 'label': 'jetPtCuts',
'value': [100*Units.GeV, 50*Units.GeV, 50*Units.GeV, 50*Units.GeV],
'custom': 'N',
},
2: {'label': 'missingEtCut',
'value': 100*Units.GeV,
},
3: { 'label': 'METFractionMeffCut',
'value': 0.2
},
4: {'label': 'sphericityCutCSC',
'value': 0.2,
},
5: {'label': 'jet_metDPhiCuts',
'value': [0.2, 0.2, 0.2],
},
6:{'label': 'electronPtVeto',
},
7:{'label': 'muonPtVeto',
},
8: {'label': 'MeffCut',
'value': 800*Units.GeV,
'custom': 'Y',
'formula': 'meff'
},
},
'customCuts':{'muon':{'ptMin': 20.*Units.GeV},
'electron':{'ptMin': 20.*Units.GeV},
'photon':{'applyOverlapRemoval': False},
'tau':{'applyOverlapRemoval': False},
},
},
'1lep': {'channel': 'l',
'cuts': {1: {'label': 'leptonPtCuts',
'value': [20*Units.GeV],
},
},
'customCuts': {'muon':{'ptMin': 5.*Units.GeV},
'electron':{'ptMin': 5.*Units.GeV},
},
},
'TestOnlyJets': {'channel': 'jjj',
'cuts': { 1:{'label': 'electronPtVeto',
'range': [20.*Units.GeV, 50.*Units.GeV],
'compare': ['<=','>='],
},
},
},
} #End of 'channels' dict
#List of AOD/DPD Collections you want to use in your analysis either :
# -> during event selection
# -> to dump information in your output D3PD
#Options are:
# - Use the 'select':True flag to go through object selection
# - The 'type' and 'name' flags are only needed if the collection has not been previously declared
collections = {'electron':{'select':True},
'muon':{'select':True},
'jet':{'select':True},
'truth_jet':{'select': True},
'track': {'type':'Rec::TrackParticleContainer','name':'TrackParticleCandidate','select': False},
'METSig':{'type':'MissingETSig','name':'METSig','select':False},
'truth': {'select': False},
'gen': {'select': False},
}
##--- D3PD branches. here you can define extra branches you want to fill.
#Default are branches from channels you have defined (e.g.met, jet, muon, ...)
userD3PDBranchesToFill = {
'meffCSC4j0lep' : {'label': 'meff4j', 'type': 'float', 'formula': 'meff'},
'sphericityCSC' : {'label': 'sphCSC', 'type': 'float', 'formula': 'sphericity'},
'TM_CSC' : {'label': 'TM_CSC', 'type': 'float', 'formula': 'transverseMass'},
}
#Those branches are the ones dumped in the output D3PD
#By default, the following variables are already predefined :
# - 4-momenta, charge, channel of ['electron','muon','photon','tau','jet','truth_jet']
# - Et, Phi of ['met','truth_met']
#If you want to add a new output variable, you have to specify :
# - 'type' of the stored-variable
# - 'method' which is called to get the variable value from object
# - Be careful, collection should be already defined in collections dict
dumpContainers = {'met':{},
'jet':{'energy_FCAL0':{'type':'float','method':'.getShape("energy_FCAL0",True)'},
'energy_FCAL1':{'type':'float','method':'.getShape("energy_FCAL1",True)'},
'energy_FCAL2':{'type':'float','method':'.getShape("energy_FCAL2",True)'}},
'electron':{'Author':{'type':'int','method':'.author()'}},
'truth':{'Pdgid':{'type':'int','method':'.pdgId()'}},
'METSig':{'L':{'type':'float','method':'.sigL()'}},
'muon': {},
}
#--- Datasets to run upon
gridUserName = 'Riccardo-MariaBianchi'
ATLASRelease = '14.2.20'
testMode = 'Y' # run the job on the Grid only on one file of the dataset
# *** Skimming ***
# For each dataset you can set or not skimming of events when writing out the output D3PD.
# If 'True' only events passing all the cuts for at least one channel are kept.
# If not specified, the default 'True' value is taken, so by default Skimming IS applied.
# Ex: 'T1_14TeV': {'name':'valid3.005200.T1_McAtNlo_Jimmy.recon.AOD.e322_a68',
# 'doSkimming': False} # --> Here we want to keep all events
#
#Please Notice: 'cloud', 'disk', 'numsubjobs' keys are now used only by Ganga grid jobs.
# 'name' is the only key needed by Panda job. (It's used by Ganga job as well, of course)
datasetsGrid = {
'T1_Atlfast2': {'name': 'mc08.105200.T1_McAtNlo_Jimmy.recon.AOD.e357_a68',
'cloud':'DE',
'disk':'UNI-FREIBURG_LOCALGROUPDISK',
'numsubjobs':10,
'doSkimming': False},
'WenuNp5_Atlfast2': {'name':'mc08.107685.AlpgenJimmyWenuNp5_pt20.recon.AOD.e368_a68',
'cloud':'US',
'numsubjobs':1,
'doSkimming': False},
}
datasetLocal = {} # ??? To be implemented! (Ric.)
#Triggers
checkTrigger = False
triggerName = ["L1_J70_XE30", "L1_J70", "L1_XE30"]
##--- User-Defined Formula
userFormula = {
'meff':
"""
meff = 0.
for i,jet in enumerate(candidates['jet']):
meff += candidates['jet'][i].pt()
meff += candidates['met'].et()
return meff
""",
'myTest':
"""
#Just a test!
if True:
print 'OK!!!!!!!!!!!!!!!!'
pass
else:
cutPassed = False
#you have to put this 'False' state somewhere in your user-defined formula
#A cut is considered 'passed' until cutPassed is not set to 'False'
return 1
""",
}
--
RiccardoMariaBianchi - 11 Mar 2009