13 shallowViewOutput = True,
14 enableCutflow = False ):
15 """Create a jet JVT analysis algorithm sequence
18 dataType -- The data type to run on ("data", "mc" or "afii")
19 jetCollection -- The jet container to run on
20 enableFJvt -- Whether to enable forward JVT calculations
21 globalSF -- Whether to calculate per event scale factors
22 runSelection -- Whether to run selection
23 enableCutflow -- Whether or not to dump the cutflow
26 if dataType
not in [
"data",
"mc",
"afii"] :
27 raise ValueError (
"invalid data type: " + dataType)
29 if runSelection
and not globalSF :
30 raise ValueError (
"per-event scale factors needs to be computed when doing a JVT selection")
33 assert (
not globalSF),
"SFs not yet available for NN JVT"
36 seq = AnaAlgSequence(
"JetJVTAnalysisSequence" )
40 seq.addMetaConfigDefault (
"selectionDecorNames", [])
41 seq.addMetaConfigDefault (
"selectionDecorCount", [])
44 if dataType !=
'data' and globalSF:
45 alg =
createAlgorithm(
'CP::AsgEventScaleFactorAlg',
'JvtEventScaleFactorAlg' )
46 alg.preselection = preselection +
'&&no_jvt' if preselection
else 'no_jvt'
47 alg.scaleFactorInputDecoration =
'jvt_effSF_%SYS%'
48 alg.scaleFactorOutputDecoration =
'jvt_effSF_%SYS%'
51 inputPropName = {
'jets' :
'particles' } )
54 alg =
createAlgorithm(
'CP::AsgEventScaleFactorAlg',
'ForwardJvtEventScaleFactorAlg' )
55 alg.preselection = preselection +
'&&no_fjvt' if preselection
else 'no_fjvt'
56 alg.scaleFactorInputDecoration =
'fjvt_effSF_%SYS%'
57 alg.scaleFactorOutputDecoration =
'fjvt_effSF_%SYS%'
60 inputPropName = {
'jets' :
'particles' } )
63 jvt_name =
'NNJvtPass' if runNNJvt
else 'jvt_selection'
64 seq.addMetaConfigDefault (
"selectionDecorNames", [ jvt_name,
'fjvt_selection']
if enableFJvt
else [
'jvt_selection'])
65 seq.addMetaConfigDefault (
"selectionDecorCount", [1, 1]
if enableFJvt
else [1])
69 alg =
createAlgorithm(
'CP::ObjectCutFlowHistAlg',
'JetJvtCutFlowDumperAlg' )
70 alg.histPattern =
'jet_cflow_jvt_%SYS%'
71 seq.append( alg, inputPropName = {
'jets' :
'input' },
72 dynConfig = {
'selections' :
lambda meta : meta[
"selectionDecorNames"][:]})
76 if shallowViewOutput :
77 alg =
createAlgorithm(
'CP::AsgViewFromSelectionAlg',
'JetJvtViewFromSelectionAlg' )
78 seq.append( alg, inputPropName = {
'jets' :
'input' },
79 outputPropName = {
'jets' :
'output' },
80 dynConfig = {
'selection' :
lambda meta : meta[
"selectionDecorNames"][:]} )