6 from string
import Template
8 stripDiscName =
lambda x: (x.split(
'/')[-1]).
split(
'Eff')[0]
11 [
'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByDecayModeFinding/DecayModeFindingEff%s',
12 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByLooseChargedIsolation/LooseChargedIsolationEff%s',
13 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr/LooseCombinedIsolationDBSumPtCorrEff%s'],
14 [
'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr/MediumCombinedIsolationDBSumPtCorrEff%s',
15 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr/TightCombinedIsolationDBSumPtCorrEff%s',
16 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByVLooseCombinedIsolationDBSumPtCorr/VLooseCombinedIsolationDBSumPtCorrEff%s'],
19 muonrejplots = [
'RecoTauV/standardValidation/hpsPFTauProducerRealMuonsData_hpsPFTauDiscriminationByLooseMuonRejection/LooseMuonRejectionEff%s',
20 'RecoTauV/standardValidation/hpsPFTauProducerRealMuonsData_hpsPFTauDiscriminationByMediumMuonRejection/MediumMuonRejectionEff%s',
21 'RecoTauV/standardValidation/hpsPFTauProducerRealMuonsData_hpsPFTauDiscriminationByTightMuonRejection/TightMuonRejectionEff%s']
24 [
'RecoTauV/standardValidation/hpsPFTauProducerRealElectronsData_hpsPFTauDiscriminationByLooseElectronRejection/LooseElectronRejectionEff%s',
25 'RecoTauV/standardValidation/hpsPFTauProducerRealElectronsData_hpsPFTauDiscriminationByMVAElectronRejection/MVAElectronRejectionEff%s',],
26 [
'RecoTauV/standardValidation/hpsPFTauProducerRealElectronsData_hpsPFTauDiscriminationByMediumElectronRejection/MediumElectronRejectionEff%s',
27 'RecoTauV/standardValidation/hpsPFTauProducerRealElectronsData_hpsPFTauDiscriminationByTightElectronRejection/TightElectronRejectionEff%s']
30 variables = {
'a':
'pt',
'b':
'pileup',
'c':
'eta',
'd':
'phi'}
32 datasetNames = {
'RealData' :
'QCD Jets',
'RealMuonsData' :
'muons from Z',
'RealElectronsData' :
'electrons from Z'}
34 outputFileString =
'def shiftpftaulayout(i, p, *rows): i["00 Shift/Tau/" + p] = DQMItem(layout=rows)\n\n%s' 35 stdFill=Template(
'shiftpftaulayout(\n\tdqmitems,\n\t"$locpath",\n\t$rows\n\t)')
38 rows = [[{
'path': plot % (dataType,var),
'description':
'%s fake rate from %s' % (
stripDiscName(plot), datasetNames[dataType]),
'draw': {
'drawopts':
"e"}}
for plot
in row]
for row
in defaultPlots]
39 strow =
',\n\t'.
join([row.__repr__()
for row
in rows])
40 return stdFill.substitute(locpath=locpath,rows=strow)
43 rows = [{
'path': plot % var,
'description':
'%s fake rate' % (
stripDiscName(plot)),
'draw': {
'drawopts':
"e"}}
for plot
in muonrejplots]
44 return stdFill.substitute(locpath=locpath,rows=rows.__repr__())
47 rows = [[{
'path': plot % var,
'description':
'%s fake rate' % (
stripDiscName(plot)),
'draw': {
'drawopts':
"e"}}
for plot
in row]
for row
in elerejplots]
48 strow =
',\n\t'.
join([row.__repr__()
for row
in rows])
49 return stdFill.substitute(locpath=locpath,rows=strow)
54 toAdd = [
defaults(
'SingleMu/00%s - Fake rate from muons vs %s' % item,
'RealMuonsData',item[1])
for item
in variables.items() ]
55 toAdd.extend( [
muRej(
'SingleMu/01%s - Muon rejection fake rate vs %s' % item,item[1])
for item
in variables.items() ] )
56 toAdd.extend( [
defaults(
'SingleMu/02%s - Fake rate from jets vs %s' % item,
'RealData',item[1])
for item
in variables.items() ] )
61 toAdd.extend([
defaults(
'Jet/00%s - Fake rate from jets vs %s' % item,
'RealData',item[1])
for item
in variables.items() ] )
66 toAdd.extend([
defaults(
'DoubleElectron_OR_TauPlusX/00%s - Fake rate from electrons vs %s' % item,
'RealElectronsData',item[1])
for item
in variables.items() ] )
67 toAdd.extend( [
eleRej(
'DoubleElectron_OR_TauPlusX/01%s - Electron rejection fake rate vs %s' % item,item[1])
for item
in variables.items() ] )
69 layout = open(
'shift_pftau_T0_layout.py',
'w')
70 layout.write(outputFileString %
'\n'.
join(toAdd) )
76 layoutString =
'def pftaulayout(i, p, *rows): i["RecoTauV/standardValidation/Layouts/" + p] = DQMItem(layout=rows)\n\n%s' 77 stdFill=Template(
'pftaulayout(\n\tdqmitems,\n\t"$locpath",\n\t$rows\n\t)')
79 layoutDefaultPlots = [
81 [
'RecoTauV/standardValidation/hpsPFTauProducer%s_Matched/PFJetMatchingEff%s',
82 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByDecayModeFinding/DecayModeFindingEff%s'],
83 [
'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByLooseChargedIsolation/LooseChargedIsolationEff%s',
84 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr/LooseCombinedIsolationDBSumPtCorrEff%s'],
87 [
'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByLooseIsolation/LooseIsolationEff%s',
88 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByMediumCombinedIsolationDBSumPtCorr/MediumCombinedIsolationDBSumPtCorrEff%s'],
89 [
'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByTightCombinedIsolationDBSumPtCorr/TightCombinedIsolationDBSumPtCorrEff%s',
90 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByVLooseCombinedIsolationDBSumPtCorr/VLooseCombinedIsolationDBSumPtCorrEff%s'],
95 [
'RecoTauV/standardValidation/shrinkingConePFTauProducerLeadingPion%s_shrinkingConePFTauDiscriminationByECALIsolationUsingLeadingPion/ECALIsolationUsingLeadingPionEff%s',
96 'RecoTauV/standardValidation/shrinkingConePFTauProducerLeadingPion%s_shrinkingConePFTauDiscriminationByLeadingPionPtCut/LeadingPionPtCutEff%s'],
97 [
'RecoTauV/standardValidation/shrinkingConePFTauProducerLeadingPion%s_shrinkingConePFTauDiscriminationByLeadingTrackFinding/LeadingTrackFindingEff%s',
98 'RecoTauV/standardValidation/shrinkingConePFTauProducerLeadingPion%s_shrinkingConePFTauDiscriminationByTrackIsolationUsingLeadingPion/TrackIsolationUsingLeadingPionEff%s']
102 [
'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByDecayModeFinding/hpsPFTauDiscriminationByDecayModeFinding_Size_%s',
103 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByLooseChargedIsolation/hpsPFTauDiscriminationByLooseChargedIsolation_Size_%s',
104 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr/hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr_Size_%s'],
105 [
'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByDecayModeFinding/hpsPFTauDiscriminationByDecayModeFinding_SumPt_%s',
106 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByLooseChargedIsolation/hpsPFTauDiscriminationByLooseChargedIsolation_SumPt_%s',
107 'RecoTauV/standardValidation/hpsPFTauProducer%s_hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr/hpsPFTauDiscriminationByLooseCombinedIsolationDBSumPtCorr_SumPt_%s'],
113 framerows = [[[{
'path': plot % (dataType,var),
'description':
'%s fake rate from %s' % (
stripDiscName(plot), datasetNames[dataType]),
'draw': {
'drawopts':
"e"}}
for plot
in row]
for row
in frame]
for frame
in layoutDefaultPlots]
114 strows = [
',\n\t'.
join([row.__repr__()
for row
in rows])
for rows
in framerows]
115 ret = [stdFill.substitute(locpath=locpath % postfix, rows=strow)
for postfix,strow
in zip(string.letters,strows)]
116 return '\n'.
join(ret)
119 rows = [[{
'path': plot % (dataType,var),
'description':
'%s fake rate from %s' % (
stripDiscName(plot), datasetNames[dataType]),
'draw': {
'drawopts':
"e"}}
for plot
in row]
for row
in layoutscone]
120 strow =
',\n\t'.
join([row.__repr__()
for row
in rows])
121 return stdFill.substitute(locpath=locpath,rows=strow)
124 typ =
lambda x: x.split(
'_')[-2]
126 typ +=
' distribution' 127 rows = [[{
'path': plot % (dataType,var),
'description':
'%s faking taus %s of %s' % (datasetNames[dataType],typ(plot), var),
'draw': {
'drawopts':
"e"}}
for plot
in row]
for row
in layoutSizeSumpt]
128 strow =
',\n\t'.
join([row.__repr__()
for row
in rows])
129 return stdFill.substitute(locpath=locpath,rows=strow)
131 variables = {
'a%s':
'pt',
'b%s':
'pileup',
'c%s':
'eta',
'd%s':
'phi'}
132 sumVar = dict( list(
zip(string.letters,[elem
for elem
in [
'signalCands',
'isolationChargedHadrCands',
'isolationGammaCands',
'isolationNeutrHadrCands'] ])) )
138 toAdd = [
layDefaults(
'SingleMu/00%s - Fake rate from muons vs %s' % item,
'RealMuonsData',item[1])
for item
in variables.items() ]
139 toAdd.extend( [
muRej(
'SingleMu/01%s - Muon rejection fake rate vs %s' % (item[0]%
'',item[1]),item[1])
for item
in variables.items() ] )
140 toAdd.extend( [
layDefaults(
'SingleMu/02%s - Fake rate from jets vs %s' % item,
'RealData',item[1])
for item
in variables.items() ] )
141 toAdd.extend( [
sizeSumpt(
'SingleMu/03%s - Distributions of size and sumPt for %s, %s faking taus' % (item[0], item[1],datasetNames[
'RealMuonsData']),
'RealMuonsData',item[1])
for item
in sumVar.items() ] )
142 toAdd.extend( [
sizeSumpt(
'SingleMu/04%s - Distributions of size and sumPt for %s, %s faking taus' % (item[0], item[1],datasetNames[
'RealData']),
'RealData',item[1])
for item
in sumVar.items() ] )
147 toAdd.extend([
layDefaults(
'Jet/00%s - Fake rate from jets vs %s' % item,
'RealData',item[1])
for item
in variables.items() ] )
148 toAdd.extend( [
sizeSumpt(
'Jet/01%s - Distributions of size and sumPt for %s, %s faking taus' % (item[0], item[1],datasetNames[
'RealData']),
'RealData',item[1])
for item
in sumVar.items() ] )
153 toAdd.extend([
layDefaults(
'DoubleElectron_OR_TauPlusX/00%s - Fake rate from electrons vs %s' % item,
'RealElectronsData',item[1])
for item
in variables.items() ] )
154 toAdd.extend( [
eleRej(
'DoubleElectron_OR_TauPlusX/01%s - Electron rejection fake rate vs %s' % (item[0].
replace(
'%s',
''),item[1]),item[1])
for item
in variables.items() ] )
155 toAdd.extend( [
sizeSumpt(
'DoubleElectron_OR_TauPlusX/04%s - Distributions of size and sumPt for %s, %s faking taus' % (item[0], item[1],datasetNames[
'RealElectronsData']),
'RealElectronsData',item[1])
for item
in sumVar.items() ] )
157 layout = open(
'pftatau_T0_layouts.py',
'w')
158 layout.write(layoutString %
'\n'.
join(toAdd) )
ALPAKA_FN_HOST_ACC ALPAKA_FN_INLINE constexpr float zip(ConstView const &tracks, int32_t i)
def replace(string, replacements)
def sCone(locpath, dataType, var)
def defaults(locpath, dataType, var)
def layDefaults(locpath, dataType, var)
def split(sequence, size)
static std::string join(char **cmd)
def sizeSumpt(locpath, dataType, var)