diff --git a/Reconstruction/tauRec/CMakeLists.txt b/Reconstruction/tauRec/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..7af9cac286c96e70aa508e281e6494f6f3376d6d --- /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 fd8c10fa4722449c53132a7dd62ccb88dd351b1c..6c5ae8fc08b7ae4118d3f0908245a3951626cf0b 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 a2350a1eefd870896fa445089ef52f9b2fbaadd6..db3d3106bb684b14ec3107c681d712433dd2a9fe 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 716eb25a24c40108cc457b419d75122d8327a331..3a44fa092867b3bd8c27b59e825528eabb3a043c 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 7baef7b711ea96bf6545937f2265c9f68174a53f..df221ed9613f178644f50fefe52b501997d77081 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 d6ab9bd268f7e2bc8e9ba0ca5bc0d62a1a57b18b..d5e8559f635b69a0733c56981aa9224f3b2c513a 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 61ac0e6c337bd69673b38e1c42c46bc1bafa2d6f..83cfb6d58e70dd04895e13fea6fd7900024785ab 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 8e77b52110c00d6161c045e35b6feb0108cd81de..4ac1b314a148c12fab65976c2a588f355b2823a4 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 b2fade26b26d6e698ac3053a1ce5fff694174be6..1d18c9cd1ea22b99f4328e800eafc970cfaeb4f3 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():