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 10 from __future__
import print_function
17 Project_Area = os.environ[
"CMSSW_BASE"]
19 print(
"$CMSSW_BASE enviroment variable not set! Please run eval `scramv1 ru -[c]sh`")
22 import FWCore.ParameterSet.Config
as cms
38 MVACollections[
'TaNC'] = TaNC.value()
50 IsolationCutForTraining =
"Alt$(ChargedOutlierPt[0], 0) < 1.0 && Alt$(NeutralOutlierPt[0], 0) < 1.5" 53 myTauAlgorithms = [
"shrinkingConePFTauDecayModeProducer"]
63 WeightByIndividualDecayMode =
False 67 ExcludePrepassAndPrefail =
False 71 RequireLeadPionPt = 5.0
72 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)
75 Example of multiple algorithms 76 myTauAlgorithms = ["pfTauDecayModeHighEfficiency", 77 "pfTauDecayModeInsideOut"] 81 TauTagToolsWorkingDirectory = os.path.join(Project_Area,
"src/RecoTauTag/TauTagTools")
82 SignalRootDir = os.path.join(TauTagToolsWorkingDirectory,
"test",
"ztt")
83 BackgroundRootDir = os.path.join(TauTagToolsWorkingDirectory,
"test",
"qcd")
87 SignalFileTrainingGlob =
"%s/*[012356789].root" % SignalRootDir
88 BackgroundFileTrainingGlob =
"%s/*[012356789].root" % BackgroundRootDir
92 SignalFileTestingGlob =
"%s/*4.root" % SignalRootDir
93 BackgroundFileTestingGlob =
"%s/*4.root" % BackgroundRootDir
100 return os.path.join(TauTagToolsWorkingDirectory,
"test",
"TrainDir_%s_%s" % (computerName, anAlgo),
"%s.mva" % computerName)
104 for name, mvaCollection
in six.iteritems(MVACollections):
105 for _mva
in mvaCollection:
106 name = _mva.computerName.value()
107 if not name
in listOfMVANames:
108 listOfMVANames[name] = _mva
111 for name, _mva
in six.iteritems(listOfMVANames):
112 myModules.append(_mva)
114 SignalTrainFiles = glob.glob(SignalFileTrainingGlob)
115 BackgroundTrainFiles = glob.glob(BackgroundFileTrainingGlob)
117 SignalTestingFiles = glob.glob(SignalFileTestingGlob)
118 BackgroundTestingFiles = glob.glob(BackgroundFileTestingGlob)
122 if not len(SignalTrainFiles)
or not len(BackgroundTrainFiles)
or not len(SignalTestingFiles)
or not len(BackgroundTestingFiles):
123 raise IOError(
"The signal/background root file training/testing file list is empty! Check the SignalFileTrainingGlob etc. in MVASteering.py")
126 for aModule
in myModules:
127 computerName = aModule.computerName.value()
128 xmlFileLoc = os.path.join(TauTagToolsWorkingDirectory,
"xml",
"%s.xml" % computerName)
129 if not os.path.exists(xmlFileLoc):
130 raise IOError(
"Can't find xml configuration file for %s - please check that %s exists!" % (computerName, xmlFileLoc))
132 if not os.path.exists(SignalRootDir):
133 raise IOError(
"Signal root file directory (%s) does not exist! Have you created the MVA raw training data?" % SignalRootDir)
134 if not os.path.exists(BackgroundRootDir):
135 raise IOError(
"Background root file directory (%s) does not exist! Have you created the MVA raw training data?" % BackgroundRootDir)
S & print(S &os, JobReport::InputFile const &f)
def GetTrainingFile(computerName, anAlgo)
DO NOT MODIFY BELOW THIS LINE (experts only) #############.
def EverythingInItsRightPlace()