Commit ea74c03a authored by Justin Griffiths's avatar Justin Griffiths Committed by Graeme Stewart
Browse files

add weights (PanTauAlgs-01-00-05)


Former-commit-id: d0fcc5b0
parent 88eedd51
......@@ -24,6 +24,7 @@ atlas_depends_on_subdirs( PUBLIC
Event/xAOD/xAODTracking
Reconstruction/Particle
Reconstruction/eflowEvent
Reconstruction/MVAUtils
Reconstruction/tauEvent
Reconstruction/tauRecTools
Tools/PathResolver
......@@ -33,7 +34,7 @@ atlas_depends_on_subdirs( PUBLIC
# External dependencies:
find_package( CLHEP )
find_package( Eigen )
find_package( ROOT COMPONENTS MathCore MathMore Matrix TMVA Core Tree Hist RIO pthread Minuit Minuit2 Physics HistPainter Rint )
find_package( ROOT COMPONENTS MathCore MathMore Matrix Core Tree Hist RIO pthread Minuit Minuit2 Physics HistPainter Rint )
# tag ROOTBasicLibs was not recognized in automatic conversion in cmt2cmake
......@@ -43,10 +44,10 @@ atlas_add_component( PanTauAlgs
Root/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps NavFourMom xAODPFlow xAODTau xAODParticleEvent GaudiKernel CaloEvent AthenaKernel DataModel StoreGateLib SGtests GeoPrimitives FourMom FourMomUtils xAODTracking Particle eflowEvent tauEvent tauRecToolsLib PathResolver VxVertex TrkVertexFitterInterfaces )
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps NavFourMom xAODPFlow xAODTau xAODParticleEvent GaudiKernel CaloEvent AthenaKernel DataModel StoreGateLib SGtests GeoPrimitives FourMom FourMomUtils xAODTracking Particle eflowEvent MVAUtils tauEvent tauRecToolsLib PathResolver VxVertex TrkVertexFitterInterfaces )
# Install files from the package:
atlas_install_headers( PanTauAlgs )
atlas_install_runtime( data/weights/*.xml )
atlas_install_runtime( data/weights/* )
atlas_install_python_modules( python/*.py )
......@@ -12,6 +12,7 @@
#include <iostream>
#include "AsgTools/AsgMessaging.h"
#include "AsgTools/ToolHandle.h"
#include "xAODTau/TauJet.h"
#include "xAODPFlow/PFO.h"
......@@ -63,6 +64,20 @@ namespace PanTau {
virtual std::vector<double> calcFWMoments(std::vector<TauConstituent2*>* tauConstituents, bool& calcIsValid) const;
virtual std::vector<double> calcSphericity(std::vector<TauConstituent2*>* tauConstituents, bool& calcIsValid) const;
#ifdef XAOD_ANALYSIS
template<class T>
static StatusCode bindToolHandle( ToolHandle<T>& handle, std::string tool_name){
T* tool = dynamic_cast<T*> (asg::ToolStore::get(tool_name));
if(!tool->isInitialized())
if (tool->initialize().isFailure())
return StatusCode::FAILURE;
handle = ToolHandle<T>(tool);
return StatusCode::SUCCESS;
}
#else
template<class T>
static StatusCode bindToolHandle( ToolHandle<T>& , std::string){return StatusCode::SUCCESS;}
#endif
std::string getName() const
{
......
......@@ -37,7 +37,25 @@ namespace PanTau {
class ITool_InformationStore : virtual public asg::IAsgTool {
ASG_TOOL_INTERFACE(ITool_InformationStore)
public:
virtual bool isInitialized() = 0;
typedef std::map<std::string, std::string> MapString;
typedef std::map<std::string, std::vector<std::string> > MapVecString;
typedef std::map<std::string, int> MapInt;
typedef std::map<std::string, double> MapDouble;
typedef std::map<std::string, std::vector<double> > MapVecDouble;
#ifdef XAOD_ANALYSIS
virtual inline void setMapString( MapString&v ) = 0 ;
virtual inline void setMapVecString( MapVecString&v ) = 0 ;
virtual inline void setMapInt( MapInt &v ) = 0 ;
virtual inline void setMapDouble( MapDouble &v ) = 0 ;
virtual inline void setMapVecDouble( MapVecDouble &v ) = 0 ;
#endif
//virtual StatusCode updateInformation(std::string inputAlg) = 0;
virtual StatusCode getInfo_Int(std::string varName, int& value) = 0;
virtual StatusCode getInfo_Double(std::string varName, double& value) = 0;
......
......@@ -46,6 +46,8 @@ namespace PanTau {
ASG_TOOL_INTERFACE(ITool_InputConverter)
public:
virtual bool isInitialized() = 0;
//PFO Converter (r19+)
virtual StatusCode ConvertToTauConstituent2(xAOD::PFO* pfo,
......
......@@ -28,6 +28,7 @@ namespace PanTau {
public:
virtual bool isInitialized() = 0;
//virtual double getModeLikeliness(PanTau::PanTauSeed2* inSeed, bool& wasSuccessful) = 0;
virtual double getResponse(PanTau::PanTauSeed2* inSeed, bool& isOK) = 0;
};
......
......@@ -42,6 +42,7 @@ namespace PanTau {
public:
virtual bool isInitialized() = 0;
// used in Tool_FeatureExtractor, Tool_DecayModeDeterminator and Tool_DetailsArranger:
virtual StatusCode execute(PanTau::PanTauSeed2* inSeed) = 0;
......
......@@ -34,6 +34,7 @@ namespace PanTau {
public:
virtual bool isInitialized() = 0;
virtual StatusCode GetTauConstituents(//const Analysis::TauJet*,
const xAOD::TauJet* tauJet,
std::vector<TauConstituent2*>& outputList,
......
......@@ -25,6 +25,7 @@ namespace PanTau {
ASG_TOOL_INTERFACE(ITool_TauConstituentSelector)
public:
virtual bool isInitialized() = 0;
virtual StatusCode SelectTauConstituents(std::vector<TauConstituent2*> inputList,
std::vector<TauConstituent2*>& outputList) const = 0;
protected:
......
......@@ -79,6 +79,18 @@ namespace PanTau
//Tools used in seed finalizing
ToolHandle<PanTau::ITool_PanTauTools> m_Tool_DecayModeDeterminator;
ToolHandle<PanTau::ITool_PanTauTools> m_Tool_DetailsArranger;
//Tools used in seed building
std::string m_Tool_InformationStoreName;
std::string m_Tool_TauConstituentGetterName;
std::string m_Tool_TauConstituentSelectorName;
std::string m_Tool_FeatureExtractorName;
//Tools used in seed finalizing
std::string m_Tool_DecayModeDeterminatorName;
std::string m_Tool_DetailsArrangerName;
std::vector<double> m_Config_PtBins;
double m_Config_MinPt;
......
......@@ -73,6 +73,13 @@ namespace PanTau {
ToolHandle<PanTau::ITool_ModeDiscriminator> m_Tool_ModeDiscriminator_1p0n_vs_1p1n;
ToolHandle<PanTau::ITool_ModeDiscriminator> m_Tool_ModeDiscriminator_1p1n_vs_1pXn;
ToolHandle<PanTau::ITool_ModeDiscriminator> m_Tool_ModeDiscriminator_3p0n_vs_3pXn;
std::string m_Tool_InformationStoreName;
std::string m_Tool_ModeDiscriminator_1p0n_vs_1p1nName;
std::string m_Tool_ModeDiscriminator_1p1n_vs_1pXnName;
std::string m_Tool_ModeDiscriminator_3p0n_vs_3pXnName;
//configurables to be retrieved from information store
......@@ -87,7 +94,10 @@ namespace PanTau {
double m_BDTCutValue_R1XX_CellBased;
double m_BDTCutValue_R30X_CellBased;
double m_BDTCutValue_R3XX_CellBased;
bool m_init=false;
public:
inline bool isInitialized(){return m_init;}
};
......
......@@ -76,6 +76,7 @@ namespace PanTau {
StoreGateSvc* m_sgSvc;
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
std::string m_Tool_InformationStoreName;
void addPanTauDetailToTauJet(PanTauSeed2* inSeed,
std::string featName,
......@@ -131,6 +132,10 @@ namespace PanTau {
std::string m_varTypeName_Basic;
std::string m_varTypeName_PID;
std::string m_varTypeName_Shots;
bool m_init=false;
public:
inline bool isInitialized(){return m_init;}
};
} // end of namespace PanTau
......
......@@ -61,6 +61,7 @@ namespace PanTau {
//handle to the helper function
PanTau::HelperFunctions m_HelperFunctions;
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
std::string m_Tool_InformationStoreName;
//ToolHandle<Reco::ITrackToVertex> m_trackToVertexTool;
//map containing different methods to calc seed et
......@@ -138,6 +139,10 @@ namespace PanTau {
std::string m_varTypeName_ImpactParams;
std::string m_varTypeName_Basic;
std::string m_varTypeName_PID;
bool m_init=false;
public:
inline bool isInitialized(){return m_init;}
};
} // end of namespace PanTau
......
......@@ -37,19 +37,23 @@ namespace PanTau {
ASG_TOOL_CLASS1(Tool_InformationStore, PanTau::ITool_InformationStore)
typedef std::map<std::string, std::string> MapString;
typedef std::map<std::string, std::vector<std::string> > MapVecString;
typedef std::map<std::string, int> MapInt;
typedef std::map<std::string, double> MapDouble;
typedef std::map<std::string, std::vector<double> > MapVecDouble;
public:
#ifdef XAOD_ANALYSIS
inline void setMapString( MapString&v ){ m_Infos_String = v; }
inline void setMapVecString( MapVecString&v ){ m_Infos_VecString = v; }
inline void setMapInt( MapInt &v ){ m_Infos_Int = v; }
inline void setMapDouble( MapDouble &v ){ m_Infos_Double = v; }
inline void setMapVecDouble( MapVecDouble &v ){ m_Infos_VecDouble = v; }
#endif
Tool_InformationStore(const std::string &name);
virtual ~Tool_InformationStore ();
virtual void ABRDefaultInit();
virtual StatusCode initialize();
// virtual StatusCode finalize ();
......@@ -76,6 +80,10 @@ namespace PanTau {
std::string m_Name_Container_eflowRec;
std::string m_Name_Container_TauRec;
std::string m_Name_Container_Tracks;
bool m_init=false;
public:
inline bool isInitialized(){return m_init;}
};
......
......@@ -52,7 +52,7 @@ namespace PanTau {
//member variables
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
std::string m_Tool_InformationStoreName;//optional
virtual bool passesPreselectionEnergy(double itsEnergy) const;
......@@ -66,6 +66,10 @@ namespace PanTau {
std::vector<double> m_Config_CellBased_EtaBinned_Pi0MVACut_1prong;
std::vector<double> m_Config_CellBased_EtaBinned_Pi0MVACut_3prong;
bool m_init=false;
public:
inline bool isInitialized(){return m_init;}
}; //end class ConstituentGetter
......
......@@ -28,10 +28,7 @@
#include <vector>
#include <string>
namespace TMVA{
class Reader;
}
#include "MVAUtils/BDT.h"
namespace PanTau {
class PanTauSeed2;
......@@ -68,15 +65,20 @@ namespace PanTau {
std::string m_Name_InputAlg;
std::string m_Name_ModeCase;
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
std::string m_Tool_InformationStoreName;
PanTau::HelperFunctions m_HelperFunctions;
std::vector<TMVA::Reader*> m_TMVA_ReaderList;
std::vector<MVAUtils::BDT*> m_MVABDT_List;
std::vector<double> m_BinEdges_Pt;
std::string m_ReaderOption;
std::string m_MethodName;
std::vector<std::string> m_List_BDTVariableNames;
std::vector<float> m_List_BDTVariableValues;
std::vector<float*> m_List_BDTVariableValues;
std::vector<double> m_List_BDTVariableDefaultValues;
bool m_init=false;
public:
inline bool isInitialized(){return m_init;}
};
} // end of namespace PanTau
......
......@@ -59,7 +59,14 @@ class Tool_TauConstituentGetter : public asg::AsgTool, virtual public PanTau::IT
PanTau::HelperFunctions m_HelperFunctions;
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
ToolHandle<PanTau::ITool_InputConverter> m_Tool_InputConverter;
std::string m_Tool_InformationStoreName;
std::string m_Tool_InputConverterName;
bool m_init=false;
public:
inline bool isInitialized(){return m_init;}
}; //end class ConstituentGetter
......
......@@ -53,6 +53,7 @@ class Tool_TauConstituentSelector : public asg::AsgTool, virtual public PanTau::
//member variables
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
std::string m_Tool_InformationStoreName;
double m_MaxEta;
std::vector<double> m_BinEdges_Eta;
......@@ -63,6 +64,10 @@ class Tool_TauConstituentSelector : public asg::AsgTool, virtual public PanTau::
std::vector<double> m_Selection_OutChrg_EtaBinned_EtCut;
std::vector<double> m_Selection_NeutLowA_EtaBinned_EtCut;
std::vector<double> m_Selection_NeutLowB_EtaBinned_EtCut;
bool m_init=false;
public:
inline bool isInitialized(){return m_init;}
}; //end class ConstituentGetter
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#include "PanTauAlgs/PanTauProcessor.h"
#include "PanTauAlgs/Tool_DecayModeDeterminator.h"
#include "PanTauAlgs/Tool_DetailsArranger.h"
#include "PanTauAlgs/Tool_FeatureExtractor.h"
#include "PanTauAlgs/Tool_InformationStore.h"
#include "PanTauAlgs/Tool_InputConverter.h"
#include "PanTauAlgs/Tool_ModeDiscriminator.h"
#include "PanTauAlgs/Tool_TauConstituentGetter.h"
#include "PanTauAlgs/Tool_TauConstituentSelector.h"
REGISTER_TOOL( PanTau::PanTauProcessor )
REGISTER_TOOL( PanTau::Tool_DecayModeDeterminator )
REGISTER_TOOL( PanTau::Tool_DetailsArranger )
REGISTER_TOOL( PanTau::Tool_FeatureExtractor )
REGISTER_TOOL( PanTau::Tool_InformationStore )
REGISTER_TOOL( PanTau::Tool_InputConverter )
REGISTER_TOOL( PanTau::Tool_ModeDiscriminator )
REGISTER_TOOL( PanTau::Tool_TauConstituentGetter )
REGISTER_TOOL( PanTau::Tool_TauConstituentSelector )
......@@ -21,6 +21,7 @@
#include "PanTauAlgs/Tool_InformationStore.h"
#include "PanTauAlgs/TauConstituent.h"
#include "PanTauAlgs/HelperFunctions.h"
#include "PanTauAlgs/PanTauSeed.h"
......@@ -49,6 +50,14 @@ PanTau::PanTauProcessor::PanTauProcessor(const std::string& name)
declareProperty("Tool_FeatureExtractor", m_Tool_FeatureExtractor, "Tool handle to Tool_FeatureExtractor");
declareProperty("Tool_DecayModeDeterminator", m_Tool_DecayModeDeterminator, "Tool handle to Tool_DecayModeDeterminator");
declareProperty("Tool_DetailsArranger", m_Tool_DetailsArranger, "Tool handle to Tool_DetailsArranger");
declareProperty("Tool_InformationStoreName", m_Tool_InformationStoreName="", "Tool handle to Tool_InformationStore");
declareProperty("Tool_TauConstituentGetterName", m_Tool_TauConstituentGetterName="", "Tool handle to Tool_TauConstituentGetter");
declareProperty("Tool_TauConstituentSelectorName", m_Tool_TauConstituentSelectorName="", "Tool handle to Tool_TauConstituentSelector");
declareProperty("Tool_FeatureExtractorName", m_Tool_FeatureExtractorName="", "Tool handle to Tool_FeatureExtractor");
declareProperty("Tool_DecayModeDeterminatorName", m_Tool_DecayModeDeterminatorName="", "Tool handle to Tool_DecayModeDeterminator");
declareProperty("Tool_DetailsArrangerName", m_Tool_DetailsArrangerName="", "Tool handle to Tool_DetailsArranger");
}
......@@ -68,6 +77,15 @@ StatusCode PanTau::PanTauProcessor::initialize() {
ATH_MSG_INFO(name() << " initialize()");
// retrieve StoreGate Service and the tools
ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_InformationStore, m_Tool_InformationStoreName ) );
ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_TauConstituentGetter, m_Tool_TauConstituentGetterName ) );
ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_TauConstituentSelector, m_Tool_TauConstituentSelectorName ) );
ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_FeatureExtractor, m_Tool_FeatureExtractorName ) );
ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_DecayModeDeterminator, m_Tool_DecayModeDeterminatorName ) );
ATH_CHECK( HelperFunctions::bindToolHandle( m_Tool_DetailsArranger, m_Tool_DetailsArrangerName ) );
// retrieve StoreGate Service and the tools
ATH_CHECK( m_Tool_InformationStore.retrieve() );
ATH_CHECK( m_Tool_TauConstituentGetter.retrieve() );
......@@ -129,6 +147,7 @@ StatusCode PanTau::PanTauProcessor::execute(xAOD::TauJet& pTau) {
fillDefaultValuesToTau(curTauJet);
//keep track of the technical quality of the pantau seed to be created
std::vector<int> pantauSeed_TechnicalQuality = std::vector<int>((unsigned int)PanTau::PanTauSeed2::t_nTechnicalQualities, 0);
......@@ -144,6 +163,7 @@ StatusCode PanTau::PanTauProcessor::execute(xAOD::TauJet& pTau) {
//these vectors will be owned by the PanTauSeed2 object.
std::vector<TauConstituent2*> l_List_TauConstituents = std::vector<TauConstituent2*>(0);
std::vector<TauConstituent2*> l_List_SelectedTauConstituents = std::vector<TauConstituent2*>(0);
if(pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_NoValidInputTau) == 0) {
// Get the constituents for the current tau
......@@ -153,7 +173,6 @@ StatusCode PanTau::PanTauProcessor::execute(xAOD::TauJet& pTau) {
ATH_MSG_DEBUG("Seed has no associated constituents!");
}
// Call the TauConstituentSelector tool to throw out bad constituents
ATH_CHECK(m_Tool_TauConstituentSelector->SelectTauConstituents(l_List_TauConstituents, l_List_SelectedTauConstituents) );
if(l_List_SelectedTauConstituents.size() == 0) {
......@@ -184,7 +203,7 @@ StatusCode PanTau::PanTauProcessor::execute(xAOD::TauJet& pTau) {
//check for the pT flag
double tauJet_pT = curTauJet->ptIntermediateAxis();
if(tauJet_pT < m_Config_MinPt || tauJet_pT > m_Config_MaxPt) {
if(tauJet_pT < m_Config_MinPt || tauJet_pT > m_Config_MaxPt) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_BadPtValue) = 1;
}
......
......@@ -7,6 +7,7 @@
#include "PanTauAlgs/Tool_DecayModeDeterminator.h"
#include "PanTauAlgs/PanTauSeed.h"
#include "PanTauAlgs/HelperFunctions.h"
#include "PanTauAlgs/TauClassificationTypes.h"
#include "xAODTau/TauDefs.h"
......@@ -26,6 +27,12 @@ PanTau::Tool_DecayModeDeterminator::Tool_DecayModeDeterminator(
declareProperty("Tool_ModeDiscriminator_1p0n_vs_1p1n", m_Tool_ModeDiscriminator_1p0n_vs_1p1n, "Handle to the ModeDiscriminator tool for 1p0n_vs_1p1n");
declareProperty("Tool_ModeDiscriminator_1p1n_vs_1pXn", m_Tool_ModeDiscriminator_1p1n_vs_1pXn, "Handle to the ModeDiscriminator tool for 1p1n_vs_1pXn");
declareProperty("Tool_ModeDiscriminator_3p0n_vs_3pXn", m_Tool_ModeDiscriminator_3p0n_vs_3pXn, "Handle to the ModeDiscriminator tool for 3p0n_vs_3pXn");
declareProperty("Tool_InformationStoreName", m_Tool_InformationStoreName="", "Tool handle to the information store tool");
declareProperty("Tool_ModeDiscriminator_1p0n_vs_1p1nName", m_Tool_ModeDiscriminator_1p0n_vs_1p1nName="", "Handle to the ModeDiscriminator tool for 1p0n_vs_1p1n");
declareProperty("Tool_ModeDiscriminator_1p1n_vs_1pXnName", m_Tool_ModeDiscriminator_1p1n_vs_1pXnName="", "Handle to the ModeDiscriminator tool for 1p1n_vs_1pXn");
declareProperty("Tool_ModeDiscriminator_3p0n_vs_3pXnName", m_Tool_ModeDiscriminator_3p0n_vs_3pXnName="", "Handle to the ModeDiscriminator tool for 3p0n_vs_3pXn");
}
......@@ -37,7 +44,13 @@ PanTau::Tool_DecayModeDeterminator::~Tool_DecayModeDeterminator() {
StatusCode PanTau::Tool_DecayModeDeterminator::initialize() {
ATH_MSG_INFO( name() << " initialize()" );
m_init=true;
ATH_CHECK( HelperFunctions::bindToolHandle(m_Tool_InformationStore, m_Tool_InformationStoreName) );
ATH_CHECK( HelperFunctions::bindToolHandle(m_Tool_ModeDiscriminator_1p0n_vs_1p1n, m_Tool_ModeDiscriminator_1p0n_vs_1p1nName) );
ATH_CHECK( HelperFunctions::bindToolHandle(m_Tool_ModeDiscriminator_1p1n_vs_1pXn, m_Tool_ModeDiscriminator_1p1n_vs_1pXnName) );
ATH_CHECK( HelperFunctions::bindToolHandle(m_Tool_ModeDiscriminator_3p0n_vs_3pXn, m_Tool_ModeDiscriminator_3p0n_vs_3pXnName) );
//get the discri tools
ATH_CHECK(m_Tool_ModeDiscriminator_1p0n_vs_1p1n.retrieve());
ATH_CHECK(m_Tool_ModeDiscriminator_1p1n_vs_1pXn.retrieve());
......@@ -80,7 +93,8 @@ StatusCode PanTau::Tool_DecayModeDeterminator::execute(PanTau::PanTauSeed2* inSe
bool noValidInput = inSeed->isOfTechnicalQuality(PanTau::PanTauSeed2::t_NoValidInputTau);
bool noAnyConstituents = inSeed->isOfTechnicalQuality(PanTau::PanTauSeed2::t_NoConstituentsAtAll);
bool noSelConstituents = inSeed->isOfTechnicalQuality(PanTau::PanTauSeed2::t_NoSelectedConstituents);
bool invalidForDecayMode = (noValidInput || noAnyConstituents || noSelConstituents);
bool badPt = inSeed->isOfTechnicalQuality(PanTau::PanTauSeed2::t_BadPtValue);
bool invalidForDecayMode = (noValidInput || noAnyConstituents || noSelConstituents || badPt);
if(invalidForDecayMode) {
ATH_MSG_DEBUG("Seed has no constituents assigned and/or input seed has no substructure info - use NotSet mode for this");
features->addFeature(inAlgName + "_" + m_varTypeName_Prefix_Basic + "_RecoMode_PanTau", xAOD::TauJetParameters::Mode_NotSet);
......
Markdown is supported
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