3 Author: Evan K. Friis, UC Davis (friis@physics.ucdavis.edu)
5 Define the MVA configurations (ie TaNC) to be used in training/testing
7 - which algorithms (shrinkingConePFTauDecayModeProducer, etc)
8 Define locations of train/test ROOT files
15 Project_Area = os.environ[
"CMSSW_BASE"]
17 print "$CMSSW_BASE enviroment variable not set! Please run eval `scramv1 ru -[c]sh`"
20 import FWCore.ParameterSet.Config
as cms
36 MVACollections[
'TaNC'] = TaNC.value()
48 IsolationCutForTraining =
"Alt$(ChargedOutlierPt[0], 0) < 1.0 && Alt$(NeutralOutlierPt[0], 0) < 1.5"
51 myTauAlgorithms = [
"shrinkingConePFTauDecayModeProducer"]
61 WeightByIndividualDecayMode =
False
65 ExcludePrepassAndPrefail =
False
69 RequireLeadPionPt = 5.0
70 LeadPionRequirementString =
"( (MainTrackPt > %f && MainTrackAngle < 0.1) || (Alt$(TrackPt[0],0) > %f && Alt$(TrackAngle[0], 20) < 0.1) || (Alt$(PiZeroPt[0], 0) > %f && Alt$(PiZeroAngle[0], 20) < 0.1) )" % (RequireLeadPionPt,RequireLeadPionPt,RequireLeadPionPt)
73 Example of multiple algorithms
74 myTauAlgorithms = ["pfTauDecayModeHighEfficiency",
75 "pfTauDecayModeInsideOut"]
79 TauTagToolsWorkingDirectory = os.path.join(Project_Area,
"src/RecoTauTag/TauTagTools")
80 SignalRootDir = os.path.join(TauTagToolsWorkingDirectory,
"test",
"ztt")
81 BackgroundRootDir = os.path.join(TauTagToolsWorkingDirectory,
"test",
"qcd")
85 SignalFileTrainingGlob =
"%s/*[012356789].root" % SignalRootDir
86 BackgroundFileTrainingGlob =
"%s/*[012356789].root" % BackgroundRootDir
90 SignalFileTestingGlob =
"%s/*4.root" % SignalRootDir
91 BackgroundFileTestingGlob =
"%s/*4.root" % BackgroundRootDir
98 return os.path.join(TauTagToolsWorkingDirectory,
"test",
"TrainDir_%s_%s" % (computerName, anAlgo),
"%s.mva" % computerName)
102 for name, mvaCollection
in MVACollections.iteritems():
103 for _mva
in mvaCollection:
104 name = _mva.computerName.value()
105 if not name
in listOfMVANames:
106 listOfMVANames[name] = _mva
109 for name, _mva
in listOfMVANames.iteritems():
110 myModules.append(_mva)
112 SignalTrainFiles = glob.glob(SignalFileTrainingGlob)
113 BackgroundTrainFiles = glob.glob(BackgroundFileTrainingGlob)
115 SignalTestingFiles = glob.glob(SignalFileTestingGlob)
116 BackgroundTestingFiles = glob.glob(BackgroundFileTestingGlob)
120 if not len(SignalTrainFiles)
or not len(BackgroundTrainFiles)
or not len(SignalTestingFiles)
or not len(BackgroundTestingFiles):
121 raise IOError,
"The signal/background root file training/testing file list is empty! Check the SignalFileTrainingGlob etc. in MVASteering.py"
124 for aModule
in myModules:
125 computerName = aModule.computerName.value()
126 xmlFileLoc = os.path.join(TauTagToolsWorkingDirectory,
"xml",
"%s.xml" % computerName)
127 if not os.path.exists(xmlFileLoc):
128 raise IOError,
"Can't find xml configuration file for %s - please check that %s exists!" % (computerName, xmlFileLoc)
130 if not os.path.exists(SignalRootDir):
131 raise IOError,
"Signal root file directory (%s) does not exist! Have you created the MVA raw training data?" % SignalRootDir
132 if not os.path.exists(BackgroundRootDir):
133 raise IOError,
"Background root file directory (%s) does not exist! Have you created the MVA raw training data?" % BackgroundRootDir
def EverythingInItsRightPlace
def GetTrainingFile
DO NOT MODIFY BELOW THIS LINE (experts only) #############.