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 16 Project_Area = os.environ[
"CMSSW_BASE"]
18 print "$CMSSW_BASE enviroment variable not set! Please run eval `scramv1 ru -[c]sh`" 21 import FWCore.ParameterSet.Config
as cms
37 MVACollections[
'TaNC'] = TaNC.value()
49 IsolationCutForTraining =
"Alt$(ChargedOutlierPt[0], 0) < 1.0 && Alt$(NeutralOutlierPt[0], 0) < 1.5" 52 myTauAlgorithms = [
"shrinkingConePFTauDecayModeProducer"]
62 WeightByIndividualDecayMode =
False 66 ExcludePrepassAndPrefail =
False 70 RequireLeadPionPt = 5.0
71 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)
74 Example of multiple algorithms 75 myTauAlgorithms = ["pfTauDecayModeHighEfficiency", 76 "pfTauDecayModeInsideOut"] 80 TauTagToolsWorkingDirectory = os.path.join(Project_Area,
"src/RecoTauTag/TauTagTools")
81 SignalRootDir = os.path.join(TauTagToolsWorkingDirectory,
"test",
"ztt")
82 BackgroundRootDir = os.path.join(TauTagToolsWorkingDirectory,
"test",
"qcd")
86 SignalFileTrainingGlob =
"%s/*[012356789].root" % SignalRootDir
87 BackgroundFileTrainingGlob =
"%s/*[012356789].root" % BackgroundRootDir
91 SignalFileTestingGlob =
"%s/*4.root" % SignalRootDir
92 BackgroundFileTestingGlob =
"%s/*4.root" % BackgroundRootDir
99 return os.path.join(TauTagToolsWorkingDirectory,
"test",
"TrainDir_%s_%s" % (computerName, anAlgo),
"%s.mva" % computerName)
103 for name, mvaCollection
in six.iteritems(MVACollections):
104 for _mva
in mvaCollection:
105 name = _mva.computerName.value()
106 if not name
in listOfMVANames:
107 listOfMVANames[name] = _mva
110 for name, _mva
in six.iteritems(listOfMVANames):
111 myModules.append(_mva)
113 SignalTrainFiles = glob.glob(SignalFileTrainingGlob)
114 BackgroundTrainFiles = glob.glob(BackgroundFileTrainingGlob)
116 SignalTestingFiles = glob.glob(SignalFileTestingGlob)
117 BackgroundTestingFiles = glob.glob(BackgroundFileTestingGlob)
121 if not len(SignalTrainFiles)
or not len(BackgroundTrainFiles)
or not len(SignalTestingFiles)
or not len(BackgroundTestingFiles):
122 raise IOError(
"The signal/background root file training/testing file list is empty! Check the SignalFileTrainingGlob etc. in MVASteering.py")
125 for aModule
in myModules:
126 computerName = aModule.computerName.value()
127 xmlFileLoc = os.path.join(TauTagToolsWorkingDirectory,
"xml",
"%s.xml" % computerName)
128 if not os.path.exists(xmlFileLoc):
129 raise IOError(
"Can't find xml configuration file for %s - please check that %s exists!" % (computerName, xmlFileLoc))
131 if not os.path.exists(SignalRootDir):
132 raise IOError(
"Signal root file directory (%s) does not exist! Have you created the MVA raw training data?" % SignalRootDir)
133 if not os.path.exists(BackgroundRootDir):
134 raise IOError(
"Background root file directory (%s) does not exist! Have you created the MVA raw training data?" % BackgroundRootDir)
def GetTrainingFile(computerName, anAlgo)
DO NOT MODIFY BELOW THIS LINE (experts only) #############.
def EverythingInItsRightPlace()