From d2006a7e8fc641335d4be5db552dfdbe6b350efd Mon Sep 17 00:00:00 2001 From: Justin Griffiths <justin.adam.griffiths@cern.ch> Date: Mon, 9 May 2016 19:40:58 +0200 Subject: [PATCH] turn off old pantau (tauRec-05-00-04-04) * adapt to changes of CaloClusterMaker * tag tauRec-05-00-04 --- Reconstruction/tauRec/CMakeLists.txt | 37 +++++++++++++ .../tauRec/python/TauAlgorithmsHolder.py | 40 +++++++++++++- .../tauRec/python/TauRecAODBuilder.py | 55 +++++++------------ Reconstruction/tauRec/python/TauRecBuilder.py | 24 +++++++- Reconstruction/tauRec/python/tauRecFlags.py | 16 +++++- .../Pi0ClusterMaker_Crakow_jobOptions.py | 1 - .../share/Pi0ClusterMaker_jobOptions.py | 4 +- .../tauRec/share/tauRecAOD_config.py | 28 ---------- Reconstruction/tauRec/share/tauRec_config.py | 10 ++-- 9 files changed, 137 insertions(+), 78 deletions(-) create mode 100644 Reconstruction/tauRec/CMakeLists.txt diff --git a/Reconstruction/tauRec/CMakeLists.txt b/Reconstruction/tauRec/CMakeLists.txt new file mode 100644 index 00000000000..7af9cac286c --- /dev/null +++ b/Reconstruction/tauRec/CMakeLists.txt @@ -0,0 +1,37 @@ +################################################################################ +# Package: tauRec +################################################################################ + +# Declare the package name: +atlas_subdir( tauRec ) + +# Declare the package's dependencies: +atlas_depends_on_subdirs( PUBLIC + Control/AthenaBaseComps + Control/AthenaKernel + GaudiKernel + PhysicsAnalysis/AnalysisCommon/ParticleEvent + Reconstruction/tauRecTools + PRIVATE + Reconstruction/tauEvent ) + +# External dependencies: +find_package( ROOT COMPONENTS TMVA Core Tree MathCore Hist RIO pthread ) + +# Component(s) in the package: +atlas_add_library( tauRecLib + src/*.cxx + PUBLIC_HEADERS tauRec + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel ParticleEvent tauRecToolsLib + PRIVATE_LINK_LIBRARIES tauEvent ) + +atlas_add_component( tauRec + src/components/*.cxx + INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} + LINK_LIBRARIES ${ROOT_LIBRARIES} AthenaBaseComps AthenaKernel GaudiKernel ParticleEvent tauRecToolsLib tauEvent tauRecLib ) + +# Install files from the package: +atlas_install_python_modules( python/*.py ) +atlas_install_joboptions( share/*.py ) + diff --git a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py index fd8c10fa472..6c5ae8fc08b 100644 --- a/Reconstruction/tauRec/python/TauAlgorithmsHolder.py +++ b/Reconstruction/tauRec/python/TauAlgorithmsHolder.py @@ -300,9 +300,9 @@ def getIDPileUpCorrection(): return cached_instances[_name] from tauRecTools.tauRecToolsConf import TauIDPileupCorrection - IDPileUpCorrection = TauIDPileupCorrection(name = _name, \ - calibrationFile1Prong = "pileupForOfflineID_1p.root", \ - calibrationFile3Prong = "pileupForOfflineID_3p.root", \ + IDPileUpCorrection = TauIDPileupCorrection(name = _name, + calibrationFile1Prong = "TF2pileupForOfflineID_1p.root", + calibrationFile3Prong = "TF2pileupForOfflineID_3p.root", useMu = True) cached_instances[_name] = IDPileUpCorrection @@ -722,8 +722,42 @@ def getTauGenericPi0Cone(): #end + +######################################################################## +# MvaTESVariableDecorator +def getMvaTESVariableDecorator(): + _name = sPrefix + 'MvaTESVariableDecorator' + from tauRecTools.tauRecToolsConf import MvaTESVariableDecorator + MvaTESVariableDecorator = MvaTESVariableDecorator(name = _name) + cached_instances[_name] = MvaTESVariableDecorator + return MvaTESVariableDecorator + +######################################################################## +# MvaTESEvaluator +def getMvaTESEvaluator(): + _name = sPrefix + 'MvaTESEvaluator' + from tauRecTools.tauRecToolsConf import MvaTESEvaluator + MvaTESEvaluator = MvaTESEvaluator(name = _name, + WeightFileName = 'LC.pantau.interpolPt250GeV_mediumTaus_BDTG.weights.xml') + cached_instances[_name] = MvaTESEvaluator + return MvaTESEvaluator + +######################################################################## +# CombinedP4FromRecoTaus +def getCombinedP4FromRecoTaus(): + _name = sPrefix + 'CombinedP4FromRecoTaus' + from tauRecTools.tauRecToolsConf import CombinedP4FromRecoTaus + CombinedP4FromRecoTaus = CombinedP4FromRecoTaus(name = _name, + WeightFileName = 'CombinedP4CalibWeightsFile.root') + cached_instances[_name] = CombinedP4FromRecoTaus + return CombinedP4FromRecoTaus + + + """ obsolete methods + + ######################################################################## # Tau Origin Cell Correction Tool def getTauCellCorrection(): diff --git a/Reconstruction/tauRec/python/TauRecAODBuilder.py b/Reconstruction/tauRec/python/TauRecAODBuilder.py index a2350a1eefd..db3d3106bb6 100644 --- a/Reconstruction/tauRec/python/TauRecAODBuilder.py +++ b/Reconstruction/tauRec/python/TauRecAODBuilder.py @@ -83,44 +83,27 @@ class TauRecAODProcessor ( TauRecConfigured ) : ## ATTENTION ################################################################################## # running these tau tools on AODs will lead to inconsistency with standard tau reconstruction ############################################################################################### - if InDetFlags.doVertexFinding(): - tools.append(taualgs.getTauVertexFinder(doUseTJVA=True)) - tools.append(taualgs.getTauAxis()) ##needed to set correct variables for energy calibration - #tools.append(taualgs.getTauTrackFinder()) - tools.append(taualgs.getEnergyCalibrationLC(correctEnergy=True, correctAxis=False, postfix='_onlyEnergy')) - - tools.append(taualgs.getTauTrackFilter()) #TauTrackFilter - tools.append(taualgs.getTauGenericPi0Cone()) #TauGenericPi0Cone - - # Run the conversion tagger if flagged to do so - import tauRec.TauConversionAlgorithms - from tauRec.tauRecFlags import jobproperties - if jobproperties.tauRecFlags.useNewPIDBasedConvFinder(): - tools.append(tauRec.TauConversionAlgorithms.getTauConversionTaggerTool()) - else: - #Need to run together, they will select either PID or vertex based on another flag - tools.append(tauRec.TauConversionAlgorithms.getPhotonConversionTool()) - tools.append(tauRec.TauConversionAlgorithms.getTauConversionFinderTool()) - pass - - - #this tool cannot recreate a 2nd vertex w/o ESD style tracks - #tools.append(taualgs.getTauVertexVariables()) - tools.append(taualgs.getTauCommonCalcVars()) - tools.append(taualgs.getTauSubstructure()) - - #tools.append(taualgs.getPi0ClusterScaler()) #TauPi0ClusterScaler - tools.append(taualgs.getPi0ScoreCalculator()) #TauPi0ScoreCalculator - #tools.append(taualgs.getPi0Selector()) #TauPi0Selector - - tools.append(taualgs.getEnergyCalibrationLC(correctEnergy=False, correctAxis=True, postfix='_onlyAxis')) - + tools.append(taualgs.getMvaTESVariableDecorator()) + tools.append(taualgs.getMvaTESEvaluator()) + tools.append(taualgs.getCombinedP4FromRecoTaus()) tools.append(taualgs.getIDPileUpCorrection()) - - # for testing purpose - #tools.append(taualgs.getTauTestDump()) - + # TauDiscriminant: + from tauRec.tauRecFlags import tauFlags + if tauFlags.doRunTauDiscriminant() : + import TauDiscriminant.TauDiscriGetter as tauDisc + tauDiscTools=tauDisc.getTauDiscriminantTools(mlog) + if len(tauDiscTools)==0: + try: import DOESNOTEXIST + except Exception: + mlog.error("No TauDiscriminantTools appended") + print traceback.format_exc() + return False + pass + tools+=tauDiscTools + pass + + TauRecConfigured.AddToolsToToolSvc(self, tools) self.TauProcessorHandle().Tools = tools diff --git a/Reconstruction/tauRec/python/TauRecBuilder.py b/Reconstruction/tauRec/python/TauRecBuilder.py index 716eb25a24c..3a44fa09286 100644 --- a/Reconstruction/tauRec/python/TauRecBuilder.py +++ b/Reconstruction/tauRec/python/TauRecBuilder.py @@ -50,6 +50,7 @@ class TauRecCoreBuilder ( TauRecConfigured ) : self.do_TJVA = doTJVA TauRecConfigured.__init__(self, name) + def configure(self): mlog = logging.getLogger ('TauCoreBuilder.py::configure:') @@ -131,6 +132,8 @@ class TauRecCoreBuilder ( TauRecConfigured ) : #tools.append(taualgs.getContainerLock()) + from tauRec.tauRecFlags import tauFlags + tools+=tauFlags.tauRecToolsDevToolList() TauRecConfigured.AddToolsToToolSvc(self, tools) self.TauBuilderToolHandle().Tools = tools @@ -270,14 +273,33 @@ class TauRecVariablesProcessor ( TauRecConfigured ) : # SWITCHED OFF SELECTOR< SINCE NO CHARGED PFOS AVAILABLE ATM tools.append(taualgs.getPi0Selector()) tools.append(taualgs.getEnergyCalibrationLC(correctEnergy=False, correctAxis=True, postfix='_onlyAxis')) + tools.append(taualgs.getMvaTESVariableDecorator()) + tools.append(taualgs.getMvaTESEvaluator()) tools.append(taualgs.getIDPileUpCorrection()) # ## for testing purpose #tools.append(taualgs.getTauTestDump()) # + + # TauDiscriminant: + from tauRec.tauRecFlags import tauFlags + if tauFlags.doRunTauDiscriminant() : + import TauDiscriminant.TauDiscriGetter as tauDisc + tauDiscTools=tauDisc.getTauDiscriminantTools(mlog) + if len(tauDiscTools)==0: + try: import DOESNOTEXIST + except Exception: + mlog.error("No TauDiscriminantTools appended") + print traceback.format_exc() + return False + pass + tools+=tauDiscTools + pass + + + tools+=tauFlags.tauRecToolsDevToolListProcessor() ## lock tau containers -> must be the last tau tool!! #tools.append(taualgs.getContainerLock()) - TauRecConfigured.AddToolsToToolSvc(self, tools) self.TauProcessorToolHandle().Tools = tools diff --git a/Reconstruction/tauRec/python/tauRecFlags.py b/Reconstruction/tauRec/python/tauRecFlags.py index 7baef7b711e..df221ed9613 100644 --- a/Reconstruction/tauRec/python/tauRecFlags.py +++ b/Reconstruction/tauRec/python/tauRecFlags.py @@ -37,6 +37,20 @@ class tauRecSeedMaxEta(JobProperty): statusOn=True allowedTypes=['float'] StoredValue=2.5 + +class tauRecToolsDevToolList(JobProperty): + """ add extra devTools to TauBuilderTool + """ + statusOn=True + allowedTypes=[[]] + StoredValue=[] + +class tauRecToolsDevToolListProcessor(JobProperty): + """ add extra devTools TauProcessorTool + """ + statusOn=True + allowedTypes=[[]] + StoredValue=[] class doRunTauDiscriminant(JobProperty): """ switch for TauDiscriminant running @@ -126,7 +140,7 @@ class tauRecFlags(JobPropertyContainer): jobproperties.add_Container(tauRecFlags) # I want always the following flags in the Rec container -_list_tau=[Enabled,doTauRec,tauRecSeedMaxEta,doRunTauDiscriminant,useVertexBasedConvFinder,useNewPIDBasedConvFinder,doPanTau,doPi0,pi0EtCuts,pi0MVACuts_1prong,pi0MVACuts_mprong,shotPtCut_1Photon,shotPtCut_2Photons,useOldVertexFitterAPI] +_list_tau=[Enabled,doTauRec,tauRecSeedMaxEta,tauRecToolsDevToolList,tauRecToolsDevToolListProcessor,doRunTauDiscriminant,useVertexBasedConvFinder,useNewPIDBasedConvFinder,doPanTau,doPi0,pi0EtCuts,pi0MVACuts_1prong,pi0MVACuts_mprong,shotPtCut_1Photon,shotPtCut_2Photons,useOldVertexFitterAPI] for j in _list_tau: jobproperties.tauRecFlags.add_JobProperty(j) del _list_tau diff --git a/Reconstruction/tauRec/share/Pi0ClusterMaker_Crakow_jobOptions.py b/Reconstruction/tauRec/share/Pi0ClusterMaker_Crakow_jobOptions.py index d6ab9bd268f..d5e8559f635 100644 --- a/Reconstruction/tauRec/share/Pi0ClusterMaker_Crakow_jobOptions.py +++ b/Reconstruction/tauRec/share/Pi0ClusterMaker_Crakow_jobOptions.py @@ -57,7 +57,6 @@ TopoSplitterForTaus.RestrictHECIWandFCalNeighbors = False TopoMomentsForTaus = CaloClusterMomentsMaker ("TopoMomentsForTaus") TopoMomentsForTaus.MaxAxisAngle = 30*deg -TopoMomentsForTaus.OutputLevel = INFO TopoMomentsForTaus.MomentsNames = [ "FIRST_PHI" ,"FIRST_ETA" diff --git a/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py b/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py index 61ac0e6c337..83cfb6d58e7 100644 --- a/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py +++ b/Reconstruction/tauRec/share/Pi0ClusterMaker_jobOptions.py @@ -285,9 +285,7 @@ if jobproperties.CaloTopoClusterFlags.doTopoClusterLocalCalib(): OOCCalib.getFullName(), OOCPi0Calib.getFullName(), DMCalib.getFullName()] - CaloTopoForTausMaker.KeepCorrectionToolAndContainerNames += [ - LocalCalib.getFullName(),"CaloTopoForTausMaker"] - # CaloTopoForTausMaker.KeepEachCorrection=True + CaloTopoForTausMaker += LocalCalib CaloTopoForTausMaker += OOCCalib CaloTopoForTausMaker += OOCPi0Calib diff --git a/Reconstruction/tauRec/share/tauRecAOD_config.py b/Reconstruction/tauRec/share/tauRecAOD_config.py index 8e77b52110c..4ac1b314a14 100644 --- a/Reconstruction/tauRec/share/tauRecAOD_config.py +++ b/Reconstruction/tauRec/share/tauRecAOD_config.py @@ -38,34 +38,6 @@ if rec.readAOD() : print traceback.format_exc() treatException("Could not set up merged tauRec. Switched off !") - if not _tauFail: - # commenting out for now, so we can reactivate possibly later - # call eflowRec in tau mode now - #if recAlgs.doEFlow(): - # try: - # include("eflowRec/eflowRec_config_DC14_Tau.py") - # except Exception: - # treatException("could not setup eflowRec") - - #jobproperties.tauRecFlags.doPanTau=False - # call PanTau now - # if jobproperties.tauRecFlags.doPanTau(): - # try: - # include("PanTauAnalysis/JobOptions_Main_PanTau.py") - # except Exception: - # treatException("Could not setup PanTau") - # jobproperties.tauRecFlags.doPanTau = False - - # call TauDiscriminant - if jobproperties.tauRecFlags.doRunTauDiscriminant(): - try: - include("TauDiscriminant/TauDiscri_jobOptions.py" ) - except Exception: - treatException("Could not set up TauDiscriminant. Switched off !") - - # if _tauFail and jobproperties.tauRecFlags.doTauRec(): - # jobproperties.tauRecFlags.doTauRec=False - # del _tauFail else: if jobproperties.tauRecFlags.doTauRec(): jobproperties.tauRecFlags.doTauRec=False diff --git a/Reconstruction/tauRec/share/tauRec_config.py b/Reconstruction/tauRec/share/tauRec_config.py index b2fade26b26..1d18c9cd1ea 100644 --- a/Reconstruction/tauRec/share/tauRec_config.py +++ b/Reconstruction/tauRec/share/tauRec_config.py @@ -57,11 +57,11 @@ if jobproperties.tauRecFlags.doTauRec() and ( rec.readESD() or ( DetFlags.haveR jobproperties.tauRecFlags.doPanTau = False # call TauDiscriminant - if jobproperties.tauRecFlags.doRunTauDiscriminant(): - try: - include("TauDiscriminant/TauDiscri_jobOptions.py" ) - except Exception: - treatException("Could not set up TauDiscriminant. Switched off !") + # if jobproperties.tauRecFlags.doRunTauDiscriminant(): + # try: + # include("TauDiscriminant/TauDiscri_jobOptions.py" ) + # except Exception: + # treatException("Could not set up TauDiscriminant. Switched off !") # call DiTauRec if jobproperties.DiTauRecFlags.doDiTauRec(): -- GitLab