Skip to content
Snippets Groups Projects
Commit 15eb65e7 authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

Merge branch 'R22_PanTauCleanup' into 'master'

PanTau code cleanup

See merge request atlas/athena!38487
parents 72206200 53572118
6 merge requests!58791DataQualityConfigurations: Modify L1Calo config for web display,!46784MuonCondInterface: Enable thread-safety checking.,!46776Updated LArMonitoring config file for WD to match new files produced using MT,!45405updated ART test cron job,!42417Draft: DIRE and VINCIA Base Fragments for Pythia 8.3,!38487PanTau code cleanup
Showing
with 332 additions and 446 deletions
################################################################################
# Package: PanTauAlgs
################################################################################
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( PanTauAlgs )
......@@ -10,7 +8,7 @@ if( NOT XAOD_ANALYSIS )
find_package( CLHEP )
endif()
find_package( Eigen )
find_package( ROOT COMPONENTS MathMore Matrix Core Tree Hist RIO pthread Minuit Minuit2 Physics HistPainter Rint )
find_package( ROOT COMPONENTS MathMore Matrix Core Tree Hist RIO pthread Rint )
atlas_add_root_dictionary( PanTauAlgs PanTauAlgsCintDict
ROOT_HEADERS
......@@ -44,8 +42,8 @@ if( NOT XAOD_STANDALONE )
Root/*.cxx
src/components/*.cxx ${PanTauAlgsCintDict}
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 StoreGateLib SGtests GeoPrimitives FourMom FourMomUtils xAODTracking Particle eflowEvent MVAUtils tauEvent tauRecToolsLib PathResolver VxVertex TrkVertexFitterInterfaces )
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} ${EIGEN_LIBRARIES} AthenaBaseComps xAODPFlow xAODTau xAODParticleEvent GaudiKernel AthenaKernel StoreGateLib FourMom xAODTracking Particle eflowEvent MVAUtils tauRecToolsLib PathResolver )
endif()
# Install files from the package:
atlas_install_python_modules( python/*.py )
atlas_install_python_modules( python/*.py POST_BUILD_CMD ${ATLAS_FLAKE8} )
......@@ -7,18 +7,16 @@
#include <string>
#include <iostream>
#include <vector>
#include "AsgMessaging/AsgMessaging.h"
#include "AsgTools/ToolHandle.h"
#include "xAODTau/TauJet.h"
#include "xAODPFlow/PFO.h"
class TLorentzVector;
class TVector3;
namespace PanTau {
class TauConstituent2;
class TauConstituent;
}
class TVector3;
......@@ -37,12 +35,8 @@ namespace PanTau {
virtual ~HelperFunctions () {};
virtual void dumpFourMomentum(TLorentzVector FourMom) const;
virtual void dumpTauConstituent2(PanTau::TauConstituent2* tauConstituent) const;
TauConstituent2* getNeutralConstWithLargestAngle(TLorentzVector charged,
std::vector<PanTau::TauConstituent2*> neutral);
TauConstituent* getNeutralConstWithLargestAngle(TLorentzVector charged,
std::vector<PanTau::TauConstituent*> neutral);
virtual std::string convertNumberToString(double x) const;
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PANTAUALGS_ITOOL_DETAILSARRANGER_H
......@@ -9,12 +9,10 @@
#include "xAODParticleEvent/ParticleContainer.h"
//class Jet;
namespace PanTau {
class PanTauSeed2;
class PanTauSeed;
}
namespace PanTau {
/** @class ITool_DetailsArranger
......@@ -30,9 +28,10 @@ namespace PanTau {
public:
virtual bool isInitialized() = 0;
virtual StatusCode execute(PanTau::PanTauSeed2* inSeed, xAOD::ParticleContainer& pi0Container) = 0;
virtual StatusCode execute(PanTau::PanTauSeed* inSeed, xAOD::ParticleContainer& pi0Container) = 0;
};
}
#endif // PANTAUALGS_ITAUDISCRIMINANTTOOL_H
......@@ -5,27 +5,21 @@
#ifndef PANTAUALGS_ITOOL_INPUTCONVERTER_H
#define PANTAUALGS_ITOOL_INPUTCONVERTER_H
// Gaudi
#include "AsgTools/IAsgTool.h"
#include <string>
//! xAOD EDM
#include "xAODPFlow/PFO.h"
#include "xAODTau/TauJet.h"
namespace PanTau{
class TauConstituent2;
class TauConstituent;
}
namespace Rec {
class TrackParticle;
}
namespace PanTau {
/** @class ITool_InputConverter
......@@ -43,8 +37,8 @@ namespace PanTau {
virtual bool isInitialized() = 0;
//PFO Converter (r19+)
virtual StatusCode ConvertToTauConstituent2(xAOD::PFO* pfo,
PanTau::TauConstituent2* &tauConstituent,
virtual StatusCode ConvertToTauConstituent(xAOD::PFO* pfo,
PanTau::TauConstituent* &tauConstituent,
const xAOD::TauJet* tauJet) const = 0;
};
......
......@@ -7,13 +7,10 @@
#include "AsgTools/IAsgTool.h"
//class Jet;
namespace PanTau {
class PanTauSeed2;
class PanTauSeed;
}
namespace PanTau {
/** @class ITool_ModeDiscriminator
......@@ -29,7 +26,7 @@ namespace PanTau {
public:
virtual bool isInitialized() = 0;
virtual double getResponse(PanTau::PanTauSeed2* inSeed, bool& isOK) = 0;
virtual double getResponse(PanTau::PanTauSeed* inSeed, bool& isOK) = 0;
};
}
......
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PANTAUALGS_ITOOL_PANTAUTOOLS_H
......@@ -17,9 +17,9 @@
namespace PanTau {
class TauFeature2;
class PanTauSeed2;
class TauConstituent2;
class TauFeature;
class PanTauSeed;
class TauConstituent;
}
......@@ -44,7 +44,7 @@ namespace PanTau {
virtual bool isInitialized() = 0;
// used in Tool_FeatureExtractor, Tool_DecayModeDeterminator and Tool_DetailsArranger:
virtual StatusCode execute(PanTau::PanTauSeed2* inSeed) = 0;
virtual StatusCode execute(PanTau::PanTauSeed* inSeed) = 0;
};
......
......@@ -5,13 +5,12 @@
#ifndef PANTAUALGS_ITOOL_TAUCONSTITUENTGETTER_H
#define PANTAUALGS_ITOOL_TAUCONSTITUENTGETTER_H
// Gaudi
#include "AsgTools/IAsgTool.h"
#include <string>
namespace PanTau{
class TauConstituent2;
class TauConstituent;
}
#include "xAODTau/TauJet.h"
......@@ -33,7 +32,7 @@ namespace PanTau {
virtual bool isInitialized() = 0;
virtual StatusCode GetTauConstituents(const xAOD::TauJet* tauJet,
std::vector<TauConstituent2*>& outputList,
std::vector<TauConstituent*>& outputList,
std::string algName) const = 0;
};
......
......@@ -5,7 +5,6 @@
#ifndef PANTAUALGS_ITOOL_TAUCONSTITUENTSELECTOR_H
#define PANTAUALGS_ITOOL_TAUCONSTITUENTSELECTOR_H
// Gaudi
#include "AsgTools/IAsgTool.h"
#include <vector>
......@@ -26,8 +25,8 @@ namespace PanTau {
public:
virtual bool isInitialized() = 0;
virtual StatusCode SelectTauConstituents(std::vector<TauConstituent2*> inputList,
std::vector<TauConstituent2*>& outputList) const = 0;
virtual StatusCode SelectTauConstituents(std::vector<TauConstituent*> inputList,
std::vector<TauConstituent*>& outputList) const = 0;
};
}
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PANTAUALGS_PANTAUSEED_H
......@@ -21,7 +21,7 @@ namespace PanTau {
class PanTauSeed2 : public xAOD::IParticle {
class PanTauSeed : public xAOD::IParticle {
// IParticle implementation as in
// http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Event/xAOD/xAODEgamma/xAODEgamma/versions/Egamma_v1.h
// http://acode-browser.usatlas.bnl.gov/lxr/source/atlas/Event/xAOD/xAODEgamma/Root/Egamma_v1.cxx
......@@ -58,10 +58,10 @@ namespace PanTau {
static int getDecayMode(int nCharged, int nNeutral);
static std::string getDecayModeName(int decayMode);
PanTauSeed2();
~PanTauSeed2();
PanTauSeed2(const PanTauSeed2& seed);
PanTauSeed2& operator=(const PanTauSeed2& seed);
PanTauSeed();
~PanTauSeed();
PanTauSeed(const PanTauSeed& seed);
PanTauSeed& operator=(const PanTauSeed& seed);
/// @name xAOD::IParticle functions
......@@ -114,35 +114,35 @@ namespace PanTau {
/** Main constructor to be used */
PanTauSeed2( std::string nameInputAlgorithm,
const xAOD::TauJet* tauJet,
std::vector<PanTau::TauConstituent2*> tauConstituents,
std::vector<PanTau::TauConstituent2*> tauConstituentsWithUnselected,
std::vector<int> pantauSeed_TechnicalQuality
);
PanTauSeed( std::string nameInputAlgorithm,
const xAOD::TauJet* tauJet,
std::vector<PanTau::TauConstituent*> tauConstituents,
std::vector<PanTau::TauConstituent*> tauConstituentsWithUnselected,
std::vector<int> pantauSeed_TechnicalQuality
);
/** Constructor for invalid seeds */
PanTauSeed2( std::string nameInputAlgorithm,
PanTauSeed( std::string nameInputAlgorithm,
const xAOD::TauJet* tauJet,
std::vector<int> pantauSeed_TechnicalQuality
);
std::string getNameInputAlgorithm() const;
const xAOD::TauJet* getTauJet() const;
PanTau::TauFeature2* getFeatures() const;
PanTau::TauFeature* getFeatures() const;
TLorentzVector getProtoMomentumCore() const;
TLorentzVector getProtoMomentumWide() const;
bool getIsValidSeed() const;
std::vector<int> getTechnicalQuality() const;
bool isOfTechnicalQuality(int pantauSeed_TechnicalQuality) const;
std::vector< std::vector<PanTau::TauConstituent2*> > getConstituents() const;
std::vector<PanTau::TauConstituent2*> getConstituentsAsList_Core() const;
std::vector<PanTau::TauConstituent2*> getConstituentsAsList_Wide() const;
std::vector<PanTau::TauConstituent2*> getConstituentsAsList_All() const;
std::vector< std::vector<PanTau::TauConstituent*> > getConstituents() const;
std::vector<PanTau::TauConstituent*> getConstituentsAsList_Core() const;
std::vector<PanTau::TauConstituent*> getConstituentsAsList_Wide() const;
std::vector<PanTau::TauConstituent*> getConstituentsAsList_All() const;
std::vector<PanTau::TauConstituent2*> getConstituentsOfType(int tauConstituent_Type, bool& foundit);
std::vector<PanTau::TauConstituent*> getConstituentsOfType(int tauConstituent_Type, bool& foundit);
int getNumberOfConstituentsOfType(int tauConstituent_Type);
TLorentzVector getSubsystemHLV(int tauConstituent_Type, bool& foundit);
......@@ -177,12 +177,12 @@ namespace PanTau {
//place to store which input alg created this pantauseed: eflowRec, CellBased, ClusterBased..
std::string m_NameInputAlgorithm;
//pointer to the TauJet this PanTauSeed2 was build from (pointer not owned by PanTauSeed)
//pointer to the TauJet this PanTauSeed was build from (pointer not owned by PanTauSeed)
const xAOD::TauJet* m_TauJet;
//for each type of tauConstituent, a list of constituents (of that type)
// the TauConstituent2 objects are owned by PanTauSeed2 (this class), so they need to be deleted in the destructor
std::vector< std::vector<PanTau::TauConstituent2*> > m_Constituents;
// the TauConstituent objects are owned by PanTauSeed (this class), so they need to be deleted in the destructor
std::vector< std::vector<PanTau::TauConstituent*> > m_Constituents;
//the momentum as calculated by using all constituents added to this seed
TLorentzVector m_ProtoMomentum_Wide;
......@@ -197,13 +197,13 @@ namespace PanTau {
std::vector< TLorentzVector > m_TypeHLVs;
//also store constituents as flat list for easier access later on
std::vector<PanTau::TauConstituent2*> m_ConstituentsList_Core; //only objects in core region
std::vector<PanTau::TauConstituent2*> m_ConstituentsList_Wide; //objects out of core region up to 0.4
std::vector<PanTau::TauConstituent2*> m_ConstituentsList_AllSelected; //all selected objects for this seed
std::vector<PanTau::TauConstituent*> m_ConstituentsList_Core; //only objects in core region
std::vector<PanTau::TauConstituent*> m_ConstituentsList_Wide; //objects out of core region up to 0.4
std::vector<PanTau::TauConstituent*> m_ConstituentsList_AllSelected; //all selected objects for this seed
//for memory reasons:
// pass list of selected AND unselected pfos to seed, which will take ownership
std::vector<PanTau::TauConstituent2*> m_ConstituentsList_All; //all objects for this seed, selected and unselected
std::vector<PanTau::TauConstituent*> m_ConstituentsList_All; //all objects for this seed, selected and unselected
//the decay mode
int m_DecayMode_BySubAlg;
......@@ -214,7 +214,7 @@ namespace PanTau {
//! is set)
//the features of this pantauseed
PanTau::TauFeature2* m_Features;
PanTau::TauFeature* m_Features;
};
......@@ -226,23 +226,23 @@ namespace PanTau {
} //end name space pantau
inline std::string PanTau::PanTauSeed2::getNameInputAlgorithm() const {return m_NameInputAlgorithm;}
inline const xAOD::TauJet* PanTau::PanTauSeed2::getTauJet() const {return m_TauJet;}
inline PanTau::TauFeature2* PanTau::PanTauSeed2::getFeatures() const {return m_Features;}
inline TLorentzVector PanTau::PanTauSeed2::getProtoMomentumWide() const {return m_ProtoMomentum_Wide;}
inline TLorentzVector PanTau::PanTauSeed2::getProtoMomentumCore() const {return m_ProtoMomentum_Core;}
inline std::vector< std::vector<PanTau::TauConstituent2*> > PanTau::PanTauSeed2::getConstituents() const {return m_Constituents;}
inline std::vector<PanTau::TauConstituent2*> PanTau::PanTauSeed2::getConstituentsAsList_Core() const {return m_ConstituentsList_Core;}
inline std::vector<PanTau::TauConstituent2*> PanTau::PanTauSeed2::getConstituentsAsList_Wide() const {return m_ConstituentsList_Wide;}
inline std::vector<PanTau::TauConstituent2*> PanTau::PanTauSeed2::getConstituentsAsList_All() const {return m_ConstituentsList_All;}
inline TLorentzVector PanTau::PanTauSeed2::getFinalMomentum() const {return m_FinalMomentum;}
inline int PanTau::PanTauSeed2::getDecayModeBySubAlg() const {return m_DecayMode_BySubAlg;}
inline int PanTau::PanTauSeed2::getDecayModeByPanTau() const {return m_DecayMode_ByPanTau;}
inline bool PanTau::PanTauSeed2::getIsValidSeed() const {return m_IsValidSeed;}
inline std::vector<int> PanTau::PanTauSeed2::getTechnicalQuality() const {return m_TechnicalQuality;}
inline void PanTau::PanTauSeed2::setFinalMomentum(TLorentzVector finalMom) {m_FinalMomentum = finalMom;}
inline void PanTau::PanTauSeed2::setDecayModeByPanTau(int decayModePanTau) {m_DecayMode_ByPanTau = decayModePanTau;}
inline std::string PanTau::PanTauSeed::getNameInputAlgorithm() const {return m_NameInputAlgorithm;}
inline const xAOD::TauJet* PanTau::PanTauSeed::getTauJet() const {return m_TauJet;}
inline PanTau::TauFeature* PanTau::PanTauSeed::getFeatures() const {return m_Features;}
inline TLorentzVector PanTau::PanTauSeed::getProtoMomentumWide() const {return m_ProtoMomentum_Wide;}
inline TLorentzVector PanTau::PanTauSeed::getProtoMomentumCore() const {return m_ProtoMomentum_Core;}
inline std::vector< std::vector<PanTau::TauConstituent*> > PanTau::PanTauSeed::getConstituents() const {return m_Constituents;}
inline std::vector<PanTau::TauConstituent*> PanTau::PanTauSeed::getConstituentsAsList_Core() const {return m_ConstituentsList_Core;}
inline std::vector<PanTau::TauConstituent*> PanTau::PanTauSeed::getConstituentsAsList_Wide() const {return m_ConstituentsList_Wide;}
inline std::vector<PanTau::TauConstituent*> PanTau::PanTauSeed::getConstituentsAsList_All() const {return m_ConstituentsList_All;}
inline TLorentzVector PanTau::PanTauSeed::getFinalMomentum() const {return m_FinalMomentum;}
inline int PanTau::PanTauSeed::getDecayModeBySubAlg() const {return m_DecayMode_BySubAlg;}
inline int PanTau::PanTauSeed::getDecayModeByPanTau() const {return m_DecayMode_ByPanTau;}
inline bool PanTau::PanTauSeed::getIsValidSeed() const {return m_IsValidSeed;}
inline std::vector<int> PanTau::PanTauSeed::getTechnicalQuality() const {return m_TechnicalQuality;}
inline void PanTau::PanTauSeed::setFinalMomentum(TLorentzVector finalMom) {m_FinalMomentum = finalMom;}
inline void PanTau::PanTauSeed::setDecayModeByPanTau(int decayModePanTau) {m_DecayMode_ByPanTau = decayModePanTau;}
inline static void PanTau::SetP4EEtaPhiM(TLorentzVector& hlv, double e, double eta, double phi, double m ){
......
/*
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
......@@ -27,7 +27,7 @@ namespace PanTau {
*/
class TauConstituent2 : public xAOD::IParticle {
class TauConstituent : public xAOD::IParticle {
public:
......@@ -60,7 +60,7 @@ namespace PanTau {
static double DefaultCharge() {return -47111337;}
static std::string AllConstituentsName() {return "All";}
static std::string getTypeName(PanTau::TauConstituent2::Type aType);
static std::string getTypeName(PanTau::TauConstituent::Type aType);
static bool isNeutralType(int tauConstituentType);
static bool isCoreType(int tauConstituentType);
......@@ -68,14 +68,14 @@ namespace PanTau {
/** Default Constructor for POOL. Do not use! */
TauConstituent2();
TauConstituent();
/**
* @param itsMomentum The P4EEtaPhiM of this particle
* @param itsType The type of this particle using this class' enumeration
* @param itsBDTValue If a BDT was used ot ID this particle, provide the BDT response
*/
TauConstituent2(TLorentzVector itsMomentum,
TauConstituent(TLorentzVector itsMomentum,
int itsCharge,
std::vector<int> itsType,
double itsBDTValue,
......@@ -83,14 +83,14 @@ namespace PanTau {
/** Destructor */
virtual ~TauConstituent2();
virtual ~TauConstituent();
/** Copy Constructor */
TauConstituent2(const TauConstituent2& tauConst);
TauConstituent(const TauConstituent& tauConst);
/** Assignment operator */
TauConstituent2& operator=(const TauConstituent2& tauConst);
TauConstituent& operator=(const TauConstituent& tauConst);
/// @name xAOD::IParticle functions
/// These are already virtual due to IParticle
......@@ -141,19 +141,19 @@ namespace PanTau {
//no setter functions needed as all properties are set in constructor
void removeTypeFlag(TauConstituent2::Type aType);
void removeTypeFlag(TauConstituent::Type aType);
//Getter functions
std::vector<std::string> getTypeName() const;
std::string getTypeNameString() const;
std::vector<int> getTypeFlags() const;
bool isOfType(TauConstituent2::Type aType) const;
bool isOfType(TauConstituent::Type aType) const;
double getBDTValue() const;
int getCharge() const;
xAOD::PFO* getPFO() const;
void addShot(TauConstituent2* shot);
std::vector<TauConstituent2*> getShots();
void addShot(TauConstituent* shot);
std::vector<TauConstituent*> getShots();
unsigned int getNShots();
void setNPhotonsInShot(int nPhotons);
......@@ -179,7 +179,7 @@ namespace PanTau {
xAOD::PFO* m_PFOLink;
// the constituents in there are owned by this! delete them!
std::vector<TauConstituent2*> m_Shots;
std::vector<TauConstituent*> m_Shots;
int m_nPhotonsInShot;
......
......@@ -17,7 +17,7 @@ namespace PanTau {
@author Sebastian.Fleischmann@cern.ch
*/
class TauFeature2 {
class TauFeature {
typedef std::map<std::string, double> FeatureMap;
typedef FeatureMap::iterator FeatureMapIter;
......@@ -28,10 +28,10 @@ typedef VectorFeatureMap::const_iterator VectorFeatureMapConstIter;
public:
/** Default constructor */
TauFeature2();
TauFeature();
/** Destructor */
virtual ~TauFeature2();
virtual ~TauFeature();
/** returns the value of the feature given by its name*/
double value(const std::string& ItsName, bool& isValid) const;
......@@ -56,7 +56,7 @@ public:
int nVecValues() const;
void add(PanTau::TauFeature2* otherFeatures);
void add(PanTau::TauFeature* otherFeatures);
void addFeaturesFromMap(std::map<std::string, double>, std::string prefix);
......@@ -69,7 +69,6 @@ protected:
};
}
#endif // PANTAUALGSTAUFEATURE_H
......@@ -5,21 +5,17 @@
#ifndef PANTAUALGS_TOOL_DECAYMODEDETERMINATOR_H
#define PANTAUALGS_TOOL_DECAYMODEDETERMINATOR_H
//! C++
#include <vector>
#include <string>
//! Gaudi
#include "AsgTools/AsgTool.h"
#include "AsgTools/ToolHandle.h"
//! PanTau
#include "PanTauAlgs/ITool_PanTauTools.h"
#include "PanTauAlgs/ITool_ModeDiscriminator.h"
#include "PanTauAlgs/ITool_InformationStore.h"
namespace PanTau {
class PanTauSeed2;
class PanTauSeed;
}
......@@ -48,24 +44,21 @@ namespace PanTau {
virtual StatusCode initialize();
virtual StatusCode execute(PanTau::PanTauSeed2* inSeed);
virtual StatusCode execute(PanTau::PanTauSeed* inSeed);
private:
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
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
//variable prefix for the decay mode
......
......@@ -8,23 +8,18 @@
#include <string>
#include <vector>
//! ASG
#include "AsgTools/AsgTool.h"
#include "AsgTools/ToolHandle.h"
//! xAOD EDM
#include "xAODTau/TauJet.h"
#include "xAODParticleEvent/ParticleContainer.h"
//! PanTau
#include "PanTauAlgs/ITool_DetailsArranger.h"
#include "PanTauAlgs/ITool_InformationStore.h"
#include "PanTauAlgs/TauConstituent.h"
#include "xAODParticleEvent/ParticleContainer.h"
namespace PanTau {
class PanTauSeed2;
class PanTauSeed;
class PanTauDetails;
}
......@@ -52,21 +47,21 @@ namespace PanTau {
virtual StatusCode initialize();
virtual StatusCode execute(PanTau::PanTauSeed2* inSeed, xAOD::ParticleContainer& pi0Container);
virtual StatusCode execute(PanTau::PanTauSeed* inSeed, xAOD::ParticleContainer& pi0Container);
protected:
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
std::string m_Tool_InformationStoreName;
void addPanTauDetailToTauJet(PanTauSeed2* inSeed,
void addPanTauDetailToTauJet(PanTauSeed* inSeed,
std::string featName,
xAOD::TauJetParameters::PanTauDetails detailEnum,
PanTauDetailsType detailType) const;
StatusCode arrangePFOLinks(PanTau::PanTauSeed2* inSeed, xAOD::TauJet* tauJet, xAOD::ParticleContainer& pi0Container);
StatusCode arrangePFOLinks(PanTau::PanTauSeed* inSeed, xAOD::TauJet* tauJet, xAOD::ParticleContainer& pi0Container);
void SetHLVTau(PanTau::PanTauSeed2* inSeed, xAOD::TauJet* tauJet, std::string inputAlg, std::string varTypeName_Basic);
void SetHLVTau(PanTau::PanTauSeed* inSeed, xAOD::TauJet* tauJet, std::string inputAlg, std::string varTypeName_Basic);
std::vector< ElementLink< xAOD::PFOContainer > > PreselectNeutralLinks(std::vector< ElementLink<xAOD::PFOContainer> > neutralPFOLinks, xAOD::TauJet* tauJet);
......@@ -78,7 +73,7 @@ namespace PanTau {
void SetNeutralConstituentVectorMasses(std::vector< ElementLink<xAOD::PFOContainer> > neutralPFOLinks, double mass);
std::vector< ElementLink< xAOD::PFOContainer > > CollectConstituentsAsPFOLinks( PanTau::PanTauSeed2* inSeed, std::vector< ElementLink< xAOD::PFOContainer > > cellbased_neutralPFOLinks, PanTau::TauConstituent2::Type type );
std::vector< ElementLink< xAOD::PFOContainer > > CollectConstituentsAsPFOLinks( PanTau::PanTauSeed* inSeed, std::vector< ElementLink< xAOD::PFOContainer > > cellbased_neutralPFOLinks, PanTau::TauConstituent::Type type );
void createPi0Vectors(xAOD::TauJet* tauJet, std::vector<TLorentzVector>& vPi0s, std::vector< std::vector< ElementLink<xAOD::PFOContainer> > > &vec_pi0pfos);
......
......@@ -37,7 +37,7 @@ namespace PanTau {
virtual StatusCode initialize();
//get the features for an input seed
virtual StatusCode execute(PanTau::PanTauSeed2* inSeed);
virtual StatusCode execute(PanTau::PanTauSeed* inSeed);
void Log10();
protected:
......@@ -51,27 +51,27 @@ namespace PanTau {
std::map<std::string, double> m_Variants_SeedEt;
//Function to calculate basic features
StatusCode calculateBasicFeatures(PanTau::PanTauSeed2* inSeed);
StatusCode calculateBasicFeatures(PanTau::PanTauSeed* inSeed);
//Function to calculate features for one set of constituents
StatusCode calculateFeatures(PanTau::PanTauSeed2* inSeed,
StatusCode calculateFeatures(PanTau::PanTauSeed* inSeed,
int tauConstituentType);
//Function to add the 4 momenta of the tau constituents to the features
StatusCode addConstituentMomenta(PanTau::PanTauSeed2* inSeed);
StatusCode addConstituentMomenta(PanTau::PanTauSeed* inSeed);
//Function to calculate features based on two sets of constituents
StatusCode addCombinedFeatures(PanTau::PanTauSeed2* inSeed);
StatusCode addCombinedFeatures(PanTau::PanTauSeed* inSeed);
//Function to add impact parameter features
StatusCode addImpactParameterFeatures(PanTau::PanTauSeed2* inSeed) const;
StatusCode addImpactParameterFeatures(PanTau::PanTauSeed* inSeed) const;
//Function to fill the m_Variants_SeedEt member
void fillVariantsSeedEt(std::vector<PanTau::TauConstituent2*> tauConstituents);
void fillVariantsSeedEt(std::vector<PanTau::TauConstituent*> tauConstituents);
//helper function to fill the m_Variants_SeedEt map
void addFeatureWrtSeedEnergy(PanTau::TauFeature2* targetMap,
void addFeatureWrtSeedEnergy(PanTau::TauFeature* targetMap,
std::string featName,
double numerator,
std::map<std::string, double>* denominatorMap) const;
......
......@@ -9,14 +9,12 @@
#include <vector>
#include <string>
//! ASG
#include "AsgTools/AsgTool.h"
#include "AsgTools/ToolHandle.h"
#include "PanTauAlgs/ITool_InformationStore.h"
#include "PanTauAlgs/ITool_InputConverter.h"
//! xAOD EDM
#include "xAODPFlow/PFO.h"
#include "xAODTau/TauJet.h"
#include "xAODPFlow/PFODefs.h"
......@@ -26,7 +24,7 @@ namespace Rec {
}
namespace PanTau {
class TauConstituent2;
class TauConstituent;
}
......@@ -43,8 +41,8 @@ namespace PanTau {
virtual StatusCode initialize();
virtual StatusCode ConvertToTauConstituent2(xAOD::PFO* pfo,
PanTau::TauConstituent2* &tauConstituent,
virtual StatusCode ConvertToTauConstituent(xAOD::PFO* pfo,
PanTau::TauConstituent* &tauConstituent,
const xAOD::TauJet* tauJet) const;
protected:
......@@ -75,6 +73,4 @@ namespace PanTau {
}//end namespace PanTau
#endif // PANTAUALGS_TOOL_INPUTCONVERTER
......@@ -21,7 +21,7 @@
#include "MVAUtils/BDT.h"
namespace PanTau {
class PanTauSeed2;
class PanTauSeed;
}
......@@ -46,11 +46,11 @@ namespace PanTau {
virtual StatusCode finalize ();
virtual double getResponse(PanTau::PanTauSeed2* inSeed, bool& isOK);
virtual double getResponse(PanTau::PanTauSeed* inSeed, bool& isOK);
private:
void updateReaderVariables(PanTau::PanTauSeed2* inSeed);
void updateReaderVariables(PanTau::PanTauSeed* inSeed);
std::string m_calib_path; //<! cvmfs folder for data files
std::string m_Name_InputAlg;
......
......@@ -9,7 +9,6 @@
#include <vector>
#include <string>
//! ASG
#include "AsgTools/AsgTool.h"
#include "AsgTools/ToolHandle.h"
......@@ -18,17 +17,13 @@
#include "PanTauAlgs/ITool_TauConstituentGetter.h"
#include "PanTauAlgs/ITool_InputConverter.h"
//! xAOD EDM
#include "xAODTau/TauJet.h"
namespace PanTau {
class TauConstituent2;
class TauConstituent;
}
namespace PanTau {
class Tool_TauConstituentGetter : public asg::AsgTool, virtual public PanTau::ITool_TauConstituentGetter {
......@@ -43,7 +38,7 @@ class Tool_TauConstituentGetter : public asg::AsgTool, virtual public PanTau::IT
virtual StatusCode initialize();
virtual StatusCode GetTauConstituents(const xAOD::TauJet* tauJet,
std::vector<TauConstituent2*>& outputList,
std::vector<TauConstituent*>& outputList,
std::string algName) const;
......@@ -64,10 +59,7 @@ class Tool_TauConstituentGetter : public asg::AsgTool, virtual public PanTau::IT
}; //end class ConstituentGetter
}//end namespace PanTau
#endif // PANTAUALGS_TOOL_TAUCONSTITUENTGETTER
......@@ -33,21 +33,21 @@ class Tool_TauConstituentSelector : public asg::AsgTool, virtual public PanTau::
virtual StatusCode initialize();
virtual StatusCode SelectTauConstituents( std::vector<TauConstituent2*> inputList,
std::vector<TauConstituent2*>& outputList) const;
virtual StatusCode SelectTauConstituents( std::vector<TauConstituent*> inputList,
std::vector<TauConstituent*>& outputList) const;
protected:
virtual bool passesSelection_NeutralConstituent(TauConstituent2* tauConstituent) const;
virtual bool passesSelection_Pi0NeutConstituent(TauConstituent2* tauConstituent) const;
virtual bool passesSelection_ChargedConstituent(TauConstituent2* tauConstituent) const;
virtual bool passesSelection_OutNeutConstituent(TauConstituent2* TauConstituent) const;
virtual bool passesSelection_OutChrgConstituent(TauConstituent2* TauConstituent) const;
virtual bool passesSelection_NeutLowAConstituent(TauConstituent2* TauConstituent) const;
virtual bool passesSelection_NeutLowBConstituent(TauConstituent2* TauConstituent) const;
virtual bool passesSelection_NeutralConstituent(TauConstituent* tauConstituent) const;
virtual bool passesSelection_Pi0NeutConstituent(TauConstituent* tauConstituent) const;
virtual bool passesSelection_ChargedConstituent(TauConstituent* tauConstituent) const;
virtual bool passesSelection_OutNeutConstituent(TauConstituent* TauConstituent) const;
virtual bool passesSelection_OutChrgConstituent(TauConstituent* TauConstituent) const;
virtual bool passesSelection_NeutLowAConstituent(TauConstituent* TauConstituent) const;
virtual bool passesSelection_NeutLowBConstituent(TauConstituent* TauConstituent) const;
virtual double getEtCut(double eta, PanTau::TauConstituent2::Type constituentType) const;
virtual double getEtCut(double eta, PanTau::TauConstituent::Type constituentType) const;
//member variables
......
......@@ -2,149 +2,112 @@
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
//! PanTau includes
#include "PanTauAlgs/HelperFunctions.h"
#include "PanTauAlgs/TauConstituent.h"
#include "xAODPFlow/PFO.h"
#include "xAODTau/TauJet.h"
#include "xAODTracking/Vertex.h"
#include "xAODTracking/VertexContainer.h"
//! ROOT includes
#include "Math/SpecFuncMathMore.h"
#include "TMath.h"
#include "TRandom.h"
#include "TLorentzVector.h"
#include "TVector3.h"
#include "TMatrixDSym.h"
#include "TVectorD.h"
#include "TMatrixDSymEigen.h"
#include <vector>
#include <sstream>
#include <vector>
#include <cmath>
void PanTau::HelperFunctions::dumpFourMomentum(TLorentzVector FourMom) const {
ATH_MSG_DEBUG("\t\tFourMomentum: Pt, Eta, Phi, M: " << FourMom.Pt() << " / " << FourMom.Eta() << " / " << FourMom.Phi() << " / " << FourMom.M());
return;
}
void PanTau::HelperFunctions::dumpTauConstituent2(PanTau::TauConstituent2* tauConstituent) const {
TLorentzVector tlv_TauConst = tauConstituent->p4();
ATH_MSG_DEBUG("\t\tTauConstituent2 has charge " << tauConstituent->getCharge() << " and types " << tauConstituent->getTypeNameString() << " with BDT Value " << tauConstituent->getBDTValue());
ATH_MSG_DEBUG("\t\tTauConstituent2 has pT, Eta, Phi, m: " << tlv_TauConst.Perp() << " / " << tlv_TauConst.Eta() << " / " << tlv_TauConst.Phi() << " / " << tlv_TauConst.M());
return;
}
PanTau::TauConstituent2* PanTau::HelperFunctions::getNeutralConstWithLargestAngle( TLorentzVector charged,
std::vector<PanTau::TauConstituent2*> neutral) {
ATH_MSG_DEBUG("getNeutralConstWithLargestAngle");
if(neutral.size() == 0) return 0;
//loop through neutrals to find the one with largest angle
unsigned int idx_Neutral = -1;
double angle_Neutral = -1.;
for(unsigned int iNeut=0; iNeut<neutral.size(); iNeut++) {
TLorentzVector tlv_CurNeut = neutral[iNeut]->p4();
double angle = charged.Angle(tlv_CurNeut.Vect());
if(angle > angle_Neutral) {
angle_Neutral = angle;
idx_Neutral = iNeut;
}
}//end loop neutrals ());
PanTau::TauConstituent* PanTau::HelperFunctions::getNeutralConstWithLargestAngle(TLorentzVector charged,
std::vector<PanTau::TauConstituent*> neutral) {
if(neutral.size() == 0) return 0;
//loop through neutrals to find the one with largest angle
unsigned int idx_Neutral = -1;
double angle_Neutral = -1.;
for(unsigned int iNeut=0; iNeut<neutral.size(); iNeut++) {
TLorentzVector tlv_CurNeut = neutral[iNeut]->p4();
double angle = charged.Angle(tlv_CurNeut.Vect());
if(angle > angle_Neutral) {
angle_Neutral = angle;
idx_Neutral = iNeut;
}
}//end loop neutrals
return neutral[idx_Neutral];
return neutral[idx_Neutral];
}
std::string PanTau::HelperFunctions::convertNumberToString(double x) const {
std::stringstream tmpStream;
tmpStream << x;
return tmpStream.str();
std::stringstream tmpStream;
tmpStream << x;
return tmpStream.str();
}
int PanTau::HelperFunctions::getBinIndex(std::vector<double> binEdges, double value) const {
int resBin = -1;
for(unsigned int i=0; i<binEdges.size()-1; i++) {
double lowerEdge = binEdges[i];
double upperEdge = binEdges[i+1];
if(lowerEdge <= value && value < upperEdge) resBin = i;
}
if(resBin == -1) {
ATH_MSG_WARNING("Could not find matching bin for value " << value << " in these bin edges:");
for(unsigned int i=0; i<binEdges.size(); i++) ATH_MSG_WARNING("\tbin edge " << i << ": " << binEdges[i]);
}
return resBin;
int resBin = -1;
for(unsigned int i=0; i<binEdges.size()-1; i++) {
double lowerEdge = binEdges[i];
double upperEdge = binEdges[i+1];
if(lowerEdge <= value && value < upperEdge) resBin = i;
}
if(resBin == -1) {
ATH_MSG_WARNING("Could not find matching bin for value " << value << " in these bin edges:");
for(unsigned int i=0; i<binEdges.size(); i++) ATH_MSG_WARNING("\tbin edge " << i << ": " << binEdges[i]);
}
return resBin;
}
double PanTau::HelperFunctions::stddev(double sumOfSquares, double sumOfValues, int numConsts) const {
// calculate standard deviations according to:
// sigma^2 = (sum_i x_i^2) / N - ((sum_i x_i)/N)^2 (biased maximum-likelihood estimate)
// directly set sigma^2 to 0 in case of N=1, otherwise numerical effects may yield very small negative sigma^2
if(numConsts == 1) return 0;
double a = sumOfSquares / ((double)numConsts);
double b = sumOfValues / ((double)numConsts);
double stdDev = a - b*b;
if(stdDev < 0.) stdDev = 0;
return sqrt(stdDev);
// calculate standard deviations according to:
// sigma^2 = (sum_i x_i^2) / N - ((sum_i x_i)/N)^2 (biased maximum-likelihood estimate)
// directly set sigma^2 to 0 in case of N=1, otherwise numerical effects may yield very small negative sigma^2
if(numConsts == 1) return 0;
double a = sumOfSquares / ((double)numConsts);
double b = sumOfValues / ((double)numConsts);
double stdDev = a - b*b;
if(stdDev < 0.) stdDev = 0;
return std::sqrt(stdDev);
}
double PanTau::HelperFunctions::deltaRprime(const TVector3& vec1, const TVector3& vec2) const {
const double a = vec1.DeltaPhi(vec2);
const double b = vec1.Theta() - vec2.Theta();
double dRprime = sqrt(a*a + b*b);
return dRprime;
const double a = vec1.DeltaPhi(vec2);
const double b = vec1.Theta() - vec2.Theta();
double dRprime = std::sqrt(a*a + b*b);
return dRprime;
}
int PanTau::HelperFunctions::iPow(int man, int exp) const {
int ans = 1;
for (int k = 0; k < exp; k++) {
ans = ans * man;
}
return ans;
int ans = 1;
for (int k = 0; k < exp; k++) {
ans = ans * man;
}
return ans;
}
double PanTau::HelperFunctions::ulAngle(double x, double y) const {
Double_t ulangl = 0;
Double_t r = TMath::Sqrt(x * x + y * y);
if (r < 1.0E-20) {
return ulangl;
}
if (TMath::Abs(x) / r < 0.8) {
ulangl = sign(TMath::ACos(x / r), y);
} else {
ulangl = TMath::ASin(y / r);
if (x < 0. && ulangl >= 0.) {
ulangl = TMath::Pi() - ulangl;
} else if (x < 0.) {
ulangl = -TMath::Pi() - ulangl;
}
}
Double_t ulangl = 0;
Double_t r = std::sqrt(x * x + y * y);
if (r < 1.0E-20) {
return ulangl;
}
if (TMath::Abs(x) / r < 0.8) {
ulangl = sign(TMath::ACos(x / r), y);
} else {
ulangl = TMath::ASin(y / r);
if (x < 0. && ulangl >= 0.) {
ulangl = TMath::Pi() - ulangl;
} else if (x < 0.) {
ulangl = -TMath::Pi() - ulangl;
}
}
return ulangl;
}
double PanTau::HelperFunctions::sign(double a, double b) const {
if (b < 0) {
return -TMath::Abs(a);
} else {
return TMath::Abs(a);
}
if (b < 0) {
return -std::abs(a);
} else {
return std::abs(a);
}
}
......@@ -2,29 +2,19 @@
Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
*/
//! C++ includes
#include <string>
#include "PanTauAlgs/PanTauProcessor.h"
//! xAOD physics objects includes
#include "xAODTau/TauJet.h"
#include "xAODParticleEvent/Particle.h"
#include "xAODParticleEvent/ParticleContainer.h"
#include "xAODParticleEvent/ParticleAuxContainer.h"
//! PanTau includes
#include "PanTauAlgs/Tool_InformationStore.h"
#include "PanTauAlgs/TauConstituent.h"
#include "PanTauAlgs/HelperFunctions.h"
#include "PanTauAlgs/PanTauSeed.h"
#include "xAODTau/TauJet.h"
#include "xAODParticleEvent/Particle.h"
#include "xAODParticleEvent/ParticleContainer.h"
#include <string>
/// //////////////////////////////////////////////////////////
/// Constructor
/// //////////////////////////////////////////////////////////
PanTau::PanTauProcessor::PanTauProcessor(const std::string& name)
: TauRecToolBase(name),
m_Name_InputAlg(""),
......@@ -38,195 +28,173 @@ PanTau::PanTauProcessor::PanTauProcessor(const std::string& name)
m_Tool_DetailsArranger("PanTau::Tool_DetailsArranger/Tool_DetailsArranger", this)
{
//Connect python variables to member functions...
declareProperty("Name_InputAlg", m_Name_InputAlg, "Name of input algorithm for this instance");
declareProperty("Tool_InformationStore", m_Tool_InformationStore, "Tool handle to Tool_InformationStore");
declareProperty("Tool_TauConstituentGetter", m_Tool_TauConstituentGetter, "Tool handle to Tool_TauConstituentGetter");
declareProperty("Tool_TauConstituentSelector", m_Tool_TauConstituentSelector, "Tool handle to Tool_TauConstituentSelector");
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");
//Connect python variables to member functions...
declareProperty("Name_InputAlg", m_Name_InputAlg, "Name of input algorithm for this instance");
declareProperty("Tool_InformationStore", m_Tool_InformationStore, "Tool handle to Tool_InformationStore");
declareProperty("Tool_TauConstituentGetter", m_Tool_TauConstituentGetter, "Tool handle to Tool_TauConstituentGetter");
declareProperty("Tool_TauConstituentSelector", m_Tool_TauConstituentSelector, "Tool handle to Tool_TauConstituentSelector");
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");
}
/// //////////////////////////////////////////////////////////
/// Destructor
/// //////////////////////////////////////////////////////////
PanTau::PanTauProcessor::~PanTauProcessor() {
}
/// //////////////////////////////////////////////////////////
/// Initialize
/// //////////////////////////////////////////////////////////
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() );
ATH_CHECK( m_Tool_TauConstituentSelector.retrieve() );
ATH_CHECK( m_Tool_FeatureExtractor.retrieve() );
ATH_CHECK( m_Tool_DecayModeDeterminator.retrieve() );
ATH_CHECK( m_Tool_DetailsArranger.retrieve() );
ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("ModeDiscriminator_BinEdges_Pt", m_Config_PtBins) );
m_Config_MinPt = m_Config_PtBins.front();
m_Config_MaxPt = m_Config_PtBins.back();
return StatusCode::SUCCESS;
}//end of 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() );
ATH_CHECK( m_Tool_TauConstituentSelector.retrieve() );
ATH_CHECK( m_Tool_FeatureExtractor.retrieve() );
ATH_CHECK( m_Tool_DecayModeDeterminator.retrieve() );
ATH_CHECK( m_Tool_DetailsArranger.retrieve() );
ATH_CHECK( m_Tool_InformationStore->getInfo_VecDouble("ModeDiscriminator_BinEdges_Pt", m_Config_PtBins) );
m_Config_MinPt = m_Config_PtBins.front();
m_Config_MaxPt = m_Config_PtBins.back();
return StatusCode::SUCCESS;
}
/// //////////////////////////////////////////////////////////
/// Finalize
/// //////////////////////////////////////////////////////////
StatusCode PanTau::PanTauProcessor::finalize() {
return StatusCode::SUCCESS;
}//end finalize
return StatusCode::SUCCESS;
}
/// //////////////////////////////////////////////////////////
/// Execute
/// //////////////////////////////////////////////////////////
StatusCode PanTau::PanTauProcessor::executePanTau(xAOD::TauJet& pTau, xAOD::ParticleContainer& pi0Container) {
StatusCode PanTau::PanTauProcessor::executePanTau(xAOD::TauJet& pTau, xAOD::ParticleContainer& pi0Container) {
//get the current TauJet
xAOD::TauJet* curTauJet = &pTau;
ATH_MSG_DEBUG("===> Tau: ");
//check for null pointer
if(curTauJet == 0) {
ATH_MSG_WARNING("Pointer to xAOD::TauJet is 0!");
return StatusCode::FAILURE;
}
//get the current TauJet
xAOD::TauJet* curTauJet = &pTau;
fillDefaultValuesToTau(curTauJet);
//check for null pointer
if(curTauJet == 0) {
ATH_MSG_WARNING("Pointer to xAOD::TauJet is 0!");
return StatusCode::FAILURE;
}
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);
//Only process taus with 1 <= ntracks <= 5:
int numTrack = curTauJet->nTracks();
if(numTrack == 0 || numTrack > 5) {
ATH_MSG_DEBUG("Flagging tau for algorithm " << m_Name_InputAlg << " as invalid, because numTrack is " << numTrack);
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_NoValidInputTau) = 1;
}
//keep track of the technical quality of the pantau seed to be created
std::vector<int> pantauSeed_TechnicalQuality = std::vector<int>((unsigned int)PanTau::PanTauSeed::t_nTechnicalQualities, 0);
// if there is substructure info available, get constituents, perform selection and recombination
//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);
//Only process taus with 1 <= ntracks <= 5:
int numTrack = curTauJet->nTracks();
if(numTrack == 0 || numTrack > 5) {
ATH_MSG_DEBUG("Flagging tau for algorithm " << m_Name_InputAlg << " as invalid, because numTrack is " << numTrack);
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed::t_NoValidInputTau) = 1;
}
// if there is substructure info available, get constituents, perform selection and recombination
//these vectors will be owned by the PanTauSeed object.
std::vector<TauConstituent*> l_List_TauConstituents = std::vector<TauConstituent*>(0);
std::vector<TauConstituent*> l_List_SelectedTauConstituents = std::vector<TauConstituent*>(0);
if(pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_NoValidInputTau) == 0) {
// Get the constituents for the current tau
ATH_CHECK( m_Tool_TauConstituentGetter->GetTauConstituents(curTauJet, l_List_TauConstituents, m_Name_InputAlg) );
if(l_List_TauConstituents.size() == 0) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_NoConstituentsAtAll) = 1;
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) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_NoSelectedConstituents) = 1;
ATH_MSG_DEBUG("Seed has no associated constituents that pass selection!");
}
//check if there are core objects in the selected constituents
bool hasCoreConstituents = false;
for(unsigned int iConst=0; iConst<l_List_SelectedTauConstituents.size(); iConst++) {
PanTau::TauConstituent2* curConst = l_List_SelectedTauConstituents.at(iConst);
if(curConst->isOfType(PanTau::TauConstituent2::t_Charged) == true) {hasCoreConstituents = true; break;};
if(curConst->isOfType(PanTau::TauConstituent2::t_Neutral) == true) {hasCoreConstituents = true; break;};
if(curConst->isOfType(PanTau::TauConstituent2::t_Pi0Neut) == true) {hasCoreConstituents = true; break;};
}
if(pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed::t_NoValidInputTau) == 0) {
// Get the constituents for the current tau
ATH_CHECK( m_Tool_TauConstituentGetter->GetTauConstituents(curTauJet, l_List_TauConstituents, m_Name_InputAlg) );
if(l_List_TauConstituents.size() == 0) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed::t_NoConstituentsAtAll) = 1;
ATH_MSG_DEBUG("Seed has no associated constituents!");
}
if(hasCoreConstituents == false) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_NoSelectedConstituents) = 1; //use this flag at the moment as a quick hack
}
// 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) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed::t_NoSelectedConstituents) = 1;
ATH_MSG_DEBUG("Seed has no associated constituents that pass selection!");
}
//check if there are core objects in the selected constituents
bool hasCoreConstituents = false;
for(unsigned int iConst=0; iConst<l_List_SelectedTauConstituents.size(); iConst++) {
PanTau::TauConstituent* curConst = l_List_SelectedTauConstituents.at(iConst);
if(curConst->isOfType(PanTau::TauConstituent::t_Charged) == true) {hasCoreConstituents = true; break;};
if(curConst->isOfType(PanTau::TauConstituent::t_Neutral) == true) {hasCoreConstituents = true; break;};
if(curConst->isOfType(PanTau::TauConstituent::t_Pi0Neut) == true) {hasCoreConstituents = true; break;};
}
if(hasCoreConstituents == false) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed::t_NoSelectedConstituents) = 1; //use this flag at the moment as a quick hack
}
}
//to be consistent, taus without substructure algs run on them also have no constituents
if(pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_NoValidInputTau) == 1) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_NoConstituentsAtAll) = 1;
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_NoSelectedConstituents) = 1;
}
//check for the pT flag
double tauJet_pT = curTauJet->ptIntermediateAxis();
if(tauJet_pT < m_Config_MinPt || tauJet_pT > m_Config_MaxPt) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed2::t_BadPtValue) = 1;
}
// Now build the PanTauSeed2 with the new Constituents
PanTau::PanTauSeed2* curPanTauSeed = new PanTau::PanTauSeed2(m_Name_InputAlg,
//to be consistent, taus without substructure algs run on them also have no constituents
if(pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed::t_NoValidInputTau) == 1) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed::t_NoConstituentsAtAll) = 1;
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed::t_NoSelectedConstituents) = 1;
}
//check for the pT flag
double tauJet_pT = curTauJet->ptIntermediateAxis();
if(tauJet_pT < m_Config_MinPt || tauJet_pT > m_Config_MaxPt) {
pantauSeed_TechnicalQuality.at((int)PanTau::PanTauSeed::t_BadPtValue) = 1;
}
// Now build the PanTauSeed with the new Constituents
PanTau::PanTauSeed* curPanTauSeed = new PanTau::PanTauSeed(m_Name_InputAlg,
curTauJet,
l_List_SelectedTauConstituents,
l_List_TauConstituents, pantauSeed_TechnicalQuality);
curPanTauSeed->makePrivateStore();
// Get the features for this PanTauSeed
ATH_CHECK(m_Tool_FeatureExtractor->execute(curPanTauSeed) );
// Seed finalizing:
// 1. Pass the seed to the decay mode determination tool
// 2. Pass the seed to the DetailsArranger tool to calculate the four momentum and add the details to tauJet
// 1. call decay mode determinator for this seed
ATH_CHECK( m_Tool_DecayModeDeterminator->execute(curPanTauSeed) );
// 2. calculate the four momentum and link the details to the tauJet
ATH_CHECK( m_Tool_DetailsArranger->execute(curPanTauSeed, pi0Container) );
delete curPanTauSeed;
return StatusCode::SUCCESS;
}//end of execute
l_List_TauConstituents,
pantauSeed_TechnicalQuality);
curPanTauSeed->makePrivateStore();
// Get the features for this PanTauSeed
ATH_CHECK(m_Tool_FeatureExtractor->execute(curPanTauSeed) );
// Seed finalizing:
// 1. Pass the seed to the decay mode determination tool
// 2. Pass the seed to the DetailsArranger tool to calculate the four momentum and add the details to tauJet
// 1. call decay mode determinator for this seed
ATH_CHECK( m_Tool_DecayModeDeterminator->execute(curPanTauSeed) );
// 2. calculate the four momentum and link the details to the tauJet
ATH_CHECK( m_Tool_DetailsArranger->execute(curPanTauSeed, pi0Container) );
delete curPanTauSeed;
return StatusCode::SUCCESS;
}
void PanTau::PanTauProcessor::fillDefaultValuesToTau(xAOD::TauJet* tauJet) {
//default four momentum set to previous calibration state: TauEnergyScale
TLorentzVector defaultP4 = tauJet->p4();
tauJet->setP4(xAOD::TauJetParameters::PanTauCellBased, defaultP4.Pt(), defaultP4.Eta(), defaultP4.Phi(), defaultP4.M());
//default four momentum set to previous calibration state: TauEnergyScale
TLorentzVector defaultP4 = tauJet->p4();
tauJet->setP4(xAOD::TauJetParameters::PanTauCellBased, defaultP4.Pt(), defaultP4.Eta(), defaultP4.Phi(), defaultP4.M());
//charged
std::vector< ElementLink< xAOD::PFOContainer > > chrgPFOLinks = tauJet->protoChargedPFOLinks();
tauJet->setChargedPFOLinks(chrgPFOLinks);
//charged
std::vector< ElementLink< xAOD::PFOContainer > > chrgPFOLinks = tauJet->protoChargedPFOLinks();
tauJet->setChargedPFOLinks(chrgPFOLinks);
//pi0
std::vector< ElementLink< xAOD::PFOContainer > > pi0PFOLinks = tauJet->protoPi0PFOLinks();
tauJet->setPi0PFOLinks(pi0PFOLinks);
//pi0
std::vector< ElementLink< xAOD::PFOContainer > > pi0PFOLinks = tauJet->protoPi0PFOLinks();
tauJet->setPi0PFOLinks(pi0PFOLinks);
//neutrals
std::vector< ElementLink< xAOD::PFOContainer > > neutralPFOLinks = tauJet->protoNeutralPFOLinks();
tauJet->setNeutralPFOLinks(neutralPFOLinks);
//neutrals
std::vector< ElementLink< xAOD::PFOContainer > > neutralPFOLinks = tauJet->protoNeutralPFOLinks();
tauJet->setNeutralPFOLinks(neutralPFOLinks);
return;
return;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment