CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
writeTauIdDiscrMVA_cfi.py
Go to the documentation of this file.
1 import FWCore.ParameterSet.Config as cms
2 
3 tauIdDiscrMVA_trainings = {
4  'tauIdMVAoldDMwoLT' : "tauIdMVAoldDMwoLT",
5  'tauIdMVAoldDMwLT' : "tauIdMVAoldDMwLT",
6  'tauIdMVAnewDMwoLT' : "tauIdMVAnewDMwoLT",
7  'tauIdMVAnewDMwLT' : "tauIdMVAnewDMwLT"
8 }
9 
10 tauIdDiscrMVA_WPs = {
11  'tauIdMVAoldDMwoLT' : {
12  'Eff90' : "oldDMwoLTEff90",
13  'Eff80' : "oldDMwoLTEff80",
14  'Eff70' : "oldDMwoLTEff70",
15  'Eff60' : "oldDMwoLTEff60",
16  'Eff50' : "oldDMwoLTEff50",
17  'Eff40' : "oldDMwoLTEff40"
18  },
19  'tauIdMVAoldDMwLT' : {
20  'Eff90' : "oldDMwLTEff90",
21  'Eff80' : "oldDMwLTEff80",
22  'Eff70' : "oldDMwLTEff70",
23  'Eff60' : "oldDMwLTEff60",
24  'Eff50' : "oldDMwLTEff50",
25  'Eff40' : "oldDMwLTEff40"
26  },
27  'tauIdMVAnewDMwoLT' : {
28  'Eff90' : "newDMwoLTEff90",
29  'Eff80' : "newDMwoLTEff80",
30  'Eff70' : "newDMwoLTEff70",
31  'Eff60' : "newDMwoLTEff60",
32  'Eff50' : "newDMwoLTEff50",
33  'Eff40' : "newDMwoLTEff40"
34  },
35  'tauIdMVAnewDMwLT' : {
36  'Eff90' : "newDMwLTEff90",
37  'Eff80' : "newDMwLTEff80",
38  'Eff70' : "newDMwLTEff70",
39  'Eff60' : "newDMwLTEff60",
40  'Eff50' : "newDMwLTEff50",
41  'Eff40' : "newDMwLTEff40"
42  }
43 }
44 
45 tauIdDiscrMVA_mvaOutput_normalizations = {
46  'tauIdMVAoldDMwoLT' : "mvaOutput_normalization_oldDMwoLT",
47  'tauIdMVAoldDMwLT' : "mvaOutput_normalization_oldDMwLT",
48  'tauIdMVAnewDMwoLT' : "mvaOutput_normalization_newDMwoLT",
49  'tauIdMVAnewDMwLT' : "mvaOutput_normalization_newDMwLT"
50 }
51 
52 
53 tauIdDiscrMVA_inputFileNames = {
54  'tauIdMVAoldDMwoLT' : {
55  'GBRForest' : "RecoTauTag/RecoTau/data/gbrDiscriminationByIsolationMVA3_oldDMwoLT.root",
56  'TGraph' : "RecoTauTag/RecoTau/data/wpDiscriminationByIsolationMVA3_oldDMwoLT.root"
57  },
58 
59  'tauIdMVAoldDMwLT' : {
60  'GBRForest' : "RecoTauTag/RecoTau/data/gbrDiscriminationByIsolationMVA3_oldDMwLT.root",
61  'TGraph' : "RecoTauTag/RecoTau/data/wpDiscriminationByIsolationMVA3_oldDMwLT.root"
62  },
63  'tauIdMVAnewDMwoLT' : {
64  'GBRForest' : "RecoTauTag/RecoTau/data/gbrDiscriminationByIsolationMVA3_newDMwoLT.root",
65  'TGraph' : "RecoTauTag/RecoTau/data/wpDiscriminationByIsolationMVA3_newDMwoLT.root"
66  },
67  'tauIdMVAnewDMwLT' : {
68  'GBRForest' : "RecoTauTag/RecoTau/data/gbrDiscriminationByIsolationMVA3_newDMwLT.root",
69  'TGraph' : "RecoTauTag/RecoTau/data/wpDiscriminationByIsolationMVA3_newDMwLT.root"
70  }
71 }
72 
73 tauIdDiscrMVA_version = "v1"
74 
75 writeTauIdDiscrMVAs = cms.EDAnalyzer("GBRForestWriter",
76  jobs = cms.VPSet()
77 )
78 writeTauIdDiscrWPs = cms.EDAnalyzer("TGraphWriter",
79  jobs = cms.VPSet()
80 )
81 writeTauIdDiscrMVAoutputNormalizations = cms.EDAnalyzer("TFormulaWriter",
82  jobs = cms.VPSet()
83 )
84 
85 for training, gbrForestName in tauIdDiscrMVA_trainings.items():
86  writeTauIdDiscrMVAs.jobs.append(
87  cms.PSet(
88  inputFileName = cms.FileInPath(tauIdDiscrMVA_inputFileNames[training]['GBRForest']),
89  inputFileType = cms.string("GBRForest"),
90  gbrForestName = cms.string(gbrForestName),
91  outputFileType = cms.string("SQLLite"),
92  outputRecord = cms.string("RecoTauTag_%s%s" % (gbrForestName, tauIdDiscrMVA_version))
93  )
94  )
95  for WP in tauIdDiscrMVA_WPs[training].keys():
96  writeTauIdDiscrWPs.jobs.append(
97  cms.PSet(
98  inputFileName = cms.FileInPath(tauIdDiscrMVA_inputFileNames[training]['TGraph']),
99  graphName = cms.string(tauIdDiscrMVA_WPs[training][WP]),
100  outputRecord = cms.string("RecoTauTag_%s%s_WP%s" % (gbrForestName, tauIdDiscrMVA_version, WP))
101  )
102  )
103  writeTauIdDiscrMVAoutputNormalizations.jobs.append(
104  cms.PSet(
105  inputFileName = cms.FileInPath(tauIdDiscrMVA_inputFileNames[training]['TGraph']),
106  formulaName = cms.string(tauIdDiscrMVA_mvaOutput_normalizations[training]),
107  outputRecord = cms.string("RecoTauTag_%s%s_mvaOutput_normalization" % (gbrForestName, tauIdDiscrMVA_version))
108  )
109  )
110 
111 writeTauIdDiscrSequence = cms.Sequence(writeTauIdDiscrMVAs + writeTauIdDiscrWPs + writeTauIdDiscrMVAoutputNormalizations)