Commit ada5f32e authored by Quentin Buat's avatar Quentin Buat
Browse files

ftf tracktwomva

parent bde7336a
......@@ -725,7 +725,50 @@ def getTauGenericPi0Cone():
cached_instances[_name] = TauGenericPi0Cone
return TauGenericPi0Cone
#end
########################################################################
# TauGenericPi0Cone
def getTauTrackClassifier():
_name = sPrefix + 'TauTrackClassifier'
if _name in cached_instances:
return cached_instances[_name]
from AthenaCommon.AppMgr import ToolSvc
from tauRecTools.tauRecToolsConf import tauRecTools__TauTrackClassifier as TauTrackClassifier
from tauRecTools.tauRecToolsConf import tauRecTools__TrackMVABDT as TrackMVABDT
import PyUtils.RootUtils as ru
ROOT = ru.import_root()
import cppyy
cppyy.loadDictionary('xAODTau_cDict')
input_file_name = 'ftf_tracks_mva_classifier.root'
threshold = 0.5
# =========================================================================
_ftf_tracks_mva_bdt = TrackMVABDT(
name = _name + "_0",
# calibFolder='data/TrigTauRec',
calibFolder='dev/TrigTauRec/',
inTrigger=True,
InputWeightsPath=input_file_name,
Threshold=threshold,
ExpectedFlag = ROOT.xAOD.TauJetParameters.unclassified,
SignalType = ROOT.xAOD.TauJetParameters.classifiedCharged,
BackgroundType = ROOT.xAOD.TauJetParameters.classifiedIsolation)
ToolSvc += _ftf_tracks_mva_bdt
classifier = TauTrackClassifier(
name=_name,
Classifiers=[_ftf_tracks_mva_bdt])
# TauTrackContainerName=_DefaultTrigTauTrackContainer)
cached_instances[_name] = classifier
return classifier
# end
""" obsolete methods
......
......@@ -126,6 +126,7 @@ class TrigTauRecMerged_Tau2012 (TrigTauRecMerged) :
class TrigTauRecMerged_TauPreselection (TrigTauRecMerged) :
__slots__ = [ '_mytools']
def __init__(self, name = "TrigTauRecMerged_TauPreselection"):
super( TrigTauRecMerged_TauPreselection , self ).__init__( name )
......@@ -191,7 +192,54 @@ class TrigTauRecMerged_TauPreselection (TrigTauRecMerged) :
from AthenaCommon.BeamFlags import jobproperties
self.BeamType = jobproperties.Beam.beamType()
class TrigTauRecMerged_TauPreselectionMva (TrigTauRecMerged) :
__slots__ = [ '_mytools']
def __init__(self, name = "TrigTauRecMerged_TauPreselectionMva"):
super( TrigTauRecMerged_TauPreselectionMva , self ).__init__( name )
self._mytools = []
# monitoring part. To switch off do in topOption TriggerFlags.enableMonitoring = []
from TrigTauRec.TrigTauRecMonitoring import TrigTauRecValidationMonitoring, TrigTauRecOnlineMonitoring
validation = TrigTauRecValidationMonitoring()
online = TrigTauRecOnlineMonitoring()
from TrigTimeMonitor.TrigTimeHistToolConfig import TrigTimeHistToolConfig
time = TrigTimeHistToolConfig("Time")
self.AthenaMonTools = [ time, validation, online ]
import TrigTauRec.TrigTauAlgorithmsHolder as taualgs
tools = []
taualgs.setPrefix("TrigTauPreselectionMva_")
# Collection name
self.OutputCollection = "TrigTauRecPreselection"
# Only include tools needed for pre-selection
tools.append(taualgs.getJetSeedBuilder())
tools.append(taualgs.getTauAxis())
tools.append(taualgs.getTauTrackFinder(applyZ0cut=True, maxDeltaZ0=1, prefix="TrigTauPreselection_", noSelector=False))
tools.append(taualgs.getTauTrackClassifier())
tools.append(taualgs.getEnergyCalibrationLC(correctEnergy=True, correctAxis=False, postfix='_onlyEnergy'))
tools.append(taualgs.getCellVariables(cellConeSize=0.2, prefix="TrigTauPreselection_"))
tools.append(taualgs.getTauCommonCalcVars())
tools.append(taualgs.getTauSubstructure())
tools.append(taualgs.getPileUpCorrection())
for tool in tools:
tool.inTrigger = True
tool.calibFolder = 'TrigTauRec/00-11-01/'
pass
self.Tools = tools
from AthenaCommon.BeamFlags import jobproperties
self.BeamType = jobproperties.Beam.beamType()
class TrigTauRecMerged_TauFTK (TrigTauRecMerged) :
__slots__ = [ '_mytools']
def __init__(self, name = "TrigTauRecMerged_TauFTK"):
......
......@@ -68,6 +68,8 @@ class HLTTrackPreSelHypo : public HLT::HypoAlgo
bool m_relax_highpt;
double m_highpt_threshold;
bool m_mva_tracking;
int m_cutCounter;
//Monitoring: number of tracks in core region
int m_nTracksInCore;
......
......@@ -1018,7 +1018,13 @@ def setupMenu():
['tau35_perf_tracktwo_tau25_perf_tracktwo_ditauL', 'L1_TAU20IM_2TAU12IM' , ['L1_TAU20IM','L1_TAU12IM'],[PhysicsStream, 'express'], ['RATE:MultiTau','BW:Tau'], -1],
['tau35_perf_tracktwo_tau25_perf_tracktwo_ditauT', 'L1_TAU20IM_2TAU12IM' , ['L1_TAU20IM','L1_TAU12IM'],[PhysicsStream, 'express'], ['RATE:MultiTau','BW:Tau'], -1],
# Tracktwomva
['tau25_tight1_tracktwomva', 'L1_TAU12IM', [], [PhysicsStream], ['RATE:SingleTau', 'BW:Tau'], -1],
['tau25_medium1_tracktwomva', 'L1_TAU12IM', [], [PhysicsStream], ['RATE:SingleTau', 'BW:Tau'], -1],
['tau25_loose1_tracktwomva', 'L1_TAU12IM', [], [PhysicsStream], ['RATE:SingleTau', 'BW:Tau'], -1],
['tau25_perf_tracktwomva', 'L1_TAU12IM', [], [PhysicsStream], ['RATE:SingleTau', 'BW:Tau'], -1],
['tau25_idperf_tracktwomva', 'L1_TAU12IM', [], [PhysicsStream], ['RATE:SingleTau', 'BW:Tau'], -1],
['tau25_idperf_tracktwo2015', 'L1_TAU12IM', [], [PhysicsStream], ['RATE:SingleTau', 'BW:Tau'], -1],
['tau25_perf_tracktwo2015', 'L1_TAU12IM', [], [PhysicsStream], ['RATE:SingleTau', 'BW:Tau'], -1],
['tau25_medium1_tracktwo2015', 'L1_TAU12IM', [], [PhysicsStream], ['RATE:SingleTau', 'BW:Tau'], -1],
......@@ -3276,6 +3282,11 @@ ps_perform_list = [
'tau5_perf_ptonly_L1TAU8',
'tau80_medium1_calo',
'tau80_medium1_track',
'tau25_idperf_tracktwomva',
'tau25_perf_tracktwomva',
'tau25_loose1_tracktwomva',
'tau25_medium1_tracktwomva',
'tau25_tight1_tracktwomva',
'tau35_perf_ptonly_tau25_perf_ptonly_L1TAU20IM_2TAU12IM',
'2j30_boffperf_L12J15_XE55',
'2j35_boffperf_2j35_L13J25.0ETA23',
......
......@@ -271,7 +271,7 @@ TauChainParts = {
'L1item' : '',
'chainPartName': '',
'threshold' : '',
'preselection' : ['r1', 'FTK', 'FTKRefit', 'FTKNoPrec', 'calo', 'track', 'mvonly', 'ptonly', 'caloonly', 'trackonly', 'tracktwo', 'trackcalo', 'tracktwocalo','tracktwo2015'],
'preselection' : ['r1', 'FTK', 'FTKRefit', 'FTKNoPrec', 'calo', 'track', 'mvonly', 'ptonly', 'caloonly', 'trackonly', 'tracktwo', 'trackcalo', 'tracktwocalo','tracktwo2015', 'tracktwomva'],
'selection' : ['medium0','loose1', 'medium1', 'tight1', 'perf', 'perf0', 'r1medium1', 'r1perf', 'cosmic', 'kaonpi1', 'kaonpi2', 'dipion1', 'dipion1loose', 'dipion2', 'dipion3', 'dikaon', 'dikaontight', 'dikaonmass', 'dikaonmasstight', 'singlepion', 'singlepiontight', 'medium1HighptL', 'medium1HighptM', 'medium1HighptH'],
'multiplicity' : '',
'trigType' : ['tau'],
......
......@@ -28,7 +28,8 @@ from TrigTauRec.TrigTauRecConfig import (TrigTauRecMerged_Tau2012,
TrigTauRecMerged_TauCaloOnly,
TrigTauRecMerged_TauFTK,
TrigTauRecMerged_TauPrecision,
TrigTauRecMerged_TauPreselection)
TrigTauRecMerged_TauPreselection,
TrigTauRecMerged_TauPreselectionMva)
from TrigTauRec.TrigTauRecCosmicsConfig import TrigTauRecCosmics_Tau2012
from TriggerMenu.menu.HltConfig import L2EFChainDef, mergeRemovingOverlap
......@@ -211,8 +212,11 @@ class L2EFChain_tau(L2EFChainDef):
#create the TrigTauRec preselection sequence
def addTrigTauRecTauPreselectionSequence(self,threshold,selection,preselection,idperf):
# Run TrigTauRec to store pre-selected taus
recPreselection = TrigTauRecMerged_TauPreselection()
if 'mva' in preselection:
recPreselection = TrigTauRecMerged_TauPreselectionMva()
else:
recPreselection = TrigTauRecMerged_TauPreselection()
self.EFsequenceList += [[[ self.currentItem ],
[recPreselection],
self.continueChain('L2', 'storepre')]]
......@@ -300,13 +304,13 @@ class L2EFChain_tau(L2EFChainDef):
# Strategies which need calorimeter pre-selection
needsCaloPre = ['calo', 'ptonly', 'mvonly', 'caloonly',
'track', 'trackonly', 'tracktwo',
'trackcalo', 'tracktwocalo','tracktwo2015']
'trackcalo', 'tracktwocalo','tracktwo2015', 'tracktwomva']
# Strategies which need fast-track finding
needsTrackTwoPre = ['tracktwo', 'tracktwoonly', 'tracktwocalo','tracktwo2015']
needsTrackTwoPre = ['tracktwo', 'tracktwoonly', 'tracktwocalo','tracktwo2015', 'tracktwomva']
needsTrackPre = ['track', 'trackonly', 'trackcalo', 'FTK', 'FTKRefit', 'FTKNoPrec']
# Strategies which need Run-II final hypo
needsRun2Hypo = ['calo', 'ptonly', 'mvonly', 'caloonly',
'trackonly', 'track', 'tracktwo', 'tracktwocalo', 'trackcalo', 'FTK', 'FTKRefit', 'FTKNoPrec', 'tracktwo2015']
'trackonly', 'track', 'tracktwo', 'tracktwocalo', 'trackcalo', 'FTK', 'FTKRefit', 'FTKNoPrec', 'tracktwo2015', 'tracktwomva']
fastTrackingUsed = needsTrackPre + needsTrackTwoPre
#Set the default values
......@@ -338,12 +342,12 @@ class L2EFChain_tau(L2EFChainDef):
# Two step fast-tracking
if preselection in needsTrackTwoPre:
self.addTwoStepTrackingSequence(threshold,selection,preselection,idperf, trkprec)
if preselection != 'tracktwo':
self.addTwoStepTrackingSelectionSequence(threshold,selection,preselection,idperf)
if preselection in ('tracktwo', 'tracktwomva'):
self.addTrigTauRecTauPreselectionSequence(threshold,selection,preselection,idperf)
self.addTwoStepTrackingSelectionSequence(threshold,selection,preselection,idperf)
else:
self.addTrigTauRecTauPreselectionSequence(threshold,selection,preselection,idperf)
self.addTwoStepTrackingSelectionSequence(threshold,selection,preselection,idperf)
self.addTrigTauRecTauPreselectionSequence(threshold,selection,preselection,idperf)
# One step fast-tracking
if preselection in needsTrackPre:
self.addTrackingSequence(threshold,selection,preselection,idperf,trkprec)
......
......@@ -105,7 +105,7 @@ class TauHypoProvider:
theThresh = self.thresholdsEF[(criteria, int(threshold))]
currentHypo = EFTauMVHypo(currentHypoKey, theVars, theThresh)
if strategy == 'calo' or strategy =='ptonly' or strategy == 'mvonly' or strategy == 'caloonly' or strategy == 'track' or strategy == 'trackonly' or strategy == 'tracktwo' or strategy == 'trackcalo' or strategy == 'tracktwocalo' or strategy == 'tracktwo2015' or strategy == 'FTK' or strategy == 'FTKRefit' or strategy == 'FTKNoPrec':
if strategy == 'calo' or strategy =='ptonly' or strategy == 'mvonly' or strategy == 'caloonly' or strategy == 'track' or strategy == 'trackonly' or strategy == 'tracktwo' or strategy == 'trackcalo' or strategy == 'tracktwocalo' or strategy == 'tracktwo2015' or strategy == 'FTK' or strategy == 'FTKRefit' or strategy == 'FTKNoPrec' or strategy == 'tracktwomva':
# Simple implementation of 2015 pre-selection
currentHypoKey = 'l2'+part+'_tau'+threshold+'_'+criteria+'_'+strategy
......@@ -155,7 +155,7 @@ class TauHypoProvider:
theThresh = [0,3,1,0.*self.GeV,-1111,0]
currentHypo = EFTauMVHypo(currentHypoKey, theVars, theThresh)
else:
if strategy != 'tracktwo' and strategy != 'FTK' and strategy != 'FTKRefit' and strategy != 'FTKNoPrec':
if strategy != 'tracktwo' and strategy != 'FTK' and strategy != 'FTKRefit' and strategy != 'FTKNoPrec' and strategy != 'tracktwomva':
theVars = ['LowerPtCut','LowerTrackPtCut']
theThresh = [int(threshold)*self.GeV,1.*self.GeV]
currentHypo = HLTTrackTauHypo(currentHypoKey, theVars, theThresh)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment