Commit e7f7667a authored by Christian Limbach's avatar Christian Limbach Committed by Graeme Stewart
Browse files

tag fix for PFOs with nan in 4-mom (PanTauAlgs-00-05-16)

parent 9cb31d66
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// Alg_SeedBuilder.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
#ifndef PANTAU_ALG_SEEDBUILDER_H
#define PANTAU_ALG_SEEDBUILDER_H
// Gaudi includes
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/MsgStream.h"
#include "GaudiKernel/ToolHandle.h"
// C++ includes
#include <string>
#include <map>
#include <vector>
// PanTau includes
#include "PanTauAlgs/Tool_InformationStore.h"
#include "PanTauAlgs/Tool_TauConstituentGetter.h"
#include "PanTauAlgs/Tool_TauConstituentSelector.h"
#include "PanTauAlgs/Tool_FeatureExtractor.h"
#include "PanTauAlgs/Tool_DecayModeDeterminator.h"
#include "PanTauAlgs/Tool_FourMomentumCalculator.h"
#include "PanTauAlgs/Tool_DetailsArranger.h"
#include "PanTauEvent/PanTauSeedContainer.h"
class StoreGateSvc;
namespace PanTau
{
/** @class Alg_SeedBuilder
@author Peter Wienemann <peter.wienemann@cern.ch>
@author Sebastian Fleischmann <Sebastian.Fleischmann@cern.ch>
@author Robindra Prabhu <robindra.prabhu@cern.ch>
@author Christian Limbach <limbach@physik.uni-bonn.de>
*/
class Alg_SeedBuilder : public AthAlgorithm
{
public:
Alg_SeedBuilder(const std::string& name, ISvcLocator* pSvcLocator);
~Alg_SeedBuilder();
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
private:
mutable MsgStream m_log;
StoreGateSvc* m_sgSvc;
std::string m_Name_InputAlg;
//Tools used in seed building
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
ToolHandle<PanTau::ITool_TauConstituentGetter> m_Tool_TauConstituentGetter;
ToolHandle<PanTau::ITool_TauConstituentSelector> m_Tool_TauConstituentSelector;
ToolHandle<PanTau::ITool_FeatureExtractor> m_Tool_FeatureExtractor;
//Tools used in seed finalizing
ToolHandle<PanTau::ITool_DecayModeDeterminator> m_Tool_DecayModeDeterminator;
ToolHandle<PanTau::ITool_FourMomentumCalculator> m_Tool_FourMomentumCalculator;
ToolHandle<PanTau::ITool_DetailsArranger> m_Tool_DetailsArranger;
std::vector<double> m_Config_PtBins;
double m_Config_MinPt;
double m_Config_MaxPt;
void fillDefaultValuesToTau(xAOD::TauJet* tauJet);
}; //end class
} // end of namespace
#endif
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PANTAU_RUNTIMEMONITORING_H
#define PANTAU_RUNTIMEMONITORING_H
#include <vector>
#include <string>
#include <map>
#include <iostream>
#include "TH1F.h"
#include "TString.h"
#include "GaudiKernel/ITHistSvc.h"
namespace PanTau {
typedef std::map<std::string, TH1F*> HistMap;
class RunTimeMonitoring {
private:
bool m_IsActivated; //if this is false, functions may be called but not executed
//not ideal, but maybe better than have an if statement in SeedBuilder in front of every call to m_RTH...
ITHistSvc* m_THistSvc; //this is not owned by this class (externally created and passed)
HistMap m_HistMap;
void CreateHist1D(std::string Name, std::string xTitle, int nBins, double MinBin, double MaxBin);
public:
RunTimeMonitoring( bool isActive);
RunTimeMonitoring( const RunTimeMonitoring& other );
~RunTimeMonitoring();
RunTimeMonitoring operator=( RunTimeMonitoring rhs );
void SetTHistSvcLink(ITHistSvc* histSvc);
void CreateHist1DMap(
std::vector<std::string> Names,
std::vector<std::string> xTitles,
std::vector<int> nBins,
std::vector<double> MinBins,
std::vector<double> MaxBins
);
bool RegisterHistos();
//call this for variables that are not added via AddFooBarVariable(...)
void FillHisto(std::string itsName, double fillValue);
};
}
#endif
\ No newline at end of file
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// Header file for class TauImpactParameterExtractionTool
///////////////////////////////////////////////////////////////////
// (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Tool to store information needed in PanTau Algorithms
///////////////////////////////////////////////////////////////////
// limbach@physik.uni-bonn.de
///////////////////////////////////////////////////////////////////
#ifndef PANTAUALGS_TOOL_DECAYMODEDETERMINATOR_H
#define PANTAUALGS_TOOL_DECAYMODEDETERMINATOR_H
//! C++
#include <vector>
#include <string>
//! Gaudi
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
//! PanTau
#include "PanTauInterfaces/ITool_DecayModeDeterminator.h"
#include "PanTauInterfaces/ITool_ModeDiscriminator.h"
#include "PanTauInterfaces/ITool_InformationStore.h"
class StoreGateSvc;
namespace PanTau {
class PanTauSeed;
}
namespace PanTau {
/** @class Tool_DecayModeDeterminator
Tool to store information needed in PanTau Algorithms
@author Christian Limbach (limbach@physik.uni-bonn.de)
*/
class Tool_DecayModeDeterminator : public AthAlgTool, virtual public PanTau::ITool_DecayModeDeterminator {
public:
enum DecayModeTest {
t_1p0n_vs_1p1n,
t_1p1n_vs_1pXn,
t_3p0n_vs_3pXn,
t_UnknownTest,
t_nTests
};
Tool_DecayModeDeterminator(const std::string&,const std::string&,const IInterface*);
virtual ~Tool_DecayModeDeterminator ();
virtual StatusCode initialize();
// virtual StatusCode finalize ();
virtual StatusCode determineDecayMode(PanTau::PanTauSeed* inSeed) const;
private:
StoreGateSvc* m_sgSvc;
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;
//configurables to be retrieved from information store
//variable prefix for the decay mode
std::string m_varTypeName_Prefix_Basic;
//cut values for CellBased
double m_BDTCutValue_R10X_CellBased;
double m_BDTCutValue_R11X_CellBased;
double m_BDTCutValue_R110_CellBased;
double m_BDTCutValue_R1XX_CellBased;
double m_BDTCutValue_R30X_CellBased;
double m_BDTCutValue_R3XX_CellBased;
//cut values for eflowRec
double m_BDTCutValue_R10X_eflowRec;
double m_BDTCutValue_R11X_eflowRec;
double m_BDTCutValue_R110_eflowRec;
double m_BDTCutValue_R1XX_eflowRec;
double m_BDTCutValue_R30X_eflowRec;
double m_BDTCutValue_R3XX_eflowRec;
};
} // end of namespace PanTau
#endif // PANTAUALGS_TAUIMPACTPARAMETEREXTRACTIONTOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// Header file for class Tool_DetailsArranger
///////////////////////////////////////////////////////////////////
// (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Tool for PID of TauSeeds
///////////////////////////////////////////////////////////////////
// sebastian.fleischmann@cern.ch
///////////////////////////////////////////////////////////////////
#ifndef PANTAUALGS_TOOL_DETAILSARRANGER_H
#define PANTAUALGS_TOOL_DETAILSARRANGER_H
#include <string>
#include <vector>
//! Gaudi
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
//! xAOD EDM
#include "xAODTau/TauJet.h"
// #include "xAODTau/TauDefs.h"
//! PanTau
#include "PanTauInterfaces/ITool_DetailsArranger.h"
#include "PanTauInterfaces/ITool_InformationStore.h"
namespace PanTau {
class PanTauSeed;
class PanTauDetails;
}
namespace Analysis {
class TauDetailsContainer;
}
class StoreGateSvc;
namespace PanTau {
/** @class Tool_DetailsArranger
Tool for PID of Tau Seeds
@author Sebastian Fleischmann
@author Christian Limbach <limbach@physik.uni-bonn.de>
*/
class Tool_DetailsArranger : public AthAlgTool, virtual public PanTau::ITool_DetailsArranger {
public:
enum PanTauDetailsType {
t_Int,
t_Float,
t_NTypes
};
Tool_DetailsArranger(const std::string&,const std::string&,const IInterface*);
virtual ~Tool_DetailsArranger ();
virtual StatusCode initialize();
// virtual StatusCode finalize();
virtual StatusCode arrangeDetails(PanTau::PanTauSeed* inSeed);//, Analysis::TauDetailsContainer* detailsCont);
protected:
StoreGateSvc* m_sgSvc;
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
void addPanTauDetailToTauJet(PanTauSeed* inSeed,
std::string featName,
xAOD::TauJetParameters::PanTauDetails detailEnum,
PanTauDetailsType detailType) const;
void arrangeScalarDetail(PanTau::PanTauDetails* targetDetails, std::string featName, int featEnumFromPanTauDetails) const;
void arrangeVectorDetail(PanTau::PanTauDetails* targetDetails, std::string featName, int featEnumFromPanTauDetails) const;
void arrangePFOLinks(PanTau::PanTauSeed* inSeed, xAOD::TauJet* tauJet);
std::vector<unsigned int> helper_IndicesOfNeutralsToBePi0( std::vector< ElementLink<xAOD::PFOContainer> > neutralPFOLinks, int nMaxPi0s);
int helper_CopyNeutralsAndSetPi0(xAOD::TauJet* tauJet, int nMaxPi0s, bool isSpecialCase_1pXnTo1p1n);
bool m_expectInvalidFeatures;
std::string m_varTypeName_Sum;
std::string m_varTypeName_Ratio;
std::string m_varTypeName_EtInRing;
std::string m_varTypeName_Isolation;
std::string m_varTypeName_Num;
std::string m_varTypeName_Mean;
std::string m_varTypeName_StdDev;
std::string m_varTypeName_HLV;
std::string m_varTypeName_Angle;
std::string m_varTypeName_DeltaR;
std::string m_varTypeName_JetMoment;
std::string m_varTypeName_Combined;
std::string m_varTypeName_JetShape;
std::string m_varTypeName_ImpactParams;
std::string m_varTypeName_Basic;
std::string m_varTypeName_PID;
std::string m_varTypeName_Shots;
};
} // end of namespace PanTau
#endif // PANTAUALGS_TAUDISCRIMINANTTOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// Header file for class Tool_FeatureExtractor
///////////////////////////////////////////////////////////////////
// (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Tool to extract jet features from tau seeds
///////////////////////////////////////////////////////////////////
// sebastian.fleischmann@cern.ch
///////////////////////////////////////////////////////////////////
#ifndef PANTAUALGS_TOOL_FEATUREEXTRACTOR_H
#define PANTAUALGS_TOOL_FEATUREEXTRACTOR_H
#include <string>
#include <map>
#include <vector>
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
// PanTau
#include "PanTauInterfaces/ITool_FeatureExtractor.h"
#include "PanTauInterfaces/ITool_HelperFunctions.h"
#include "PanTauInterfaces/ITool_InformationStore.h"
#include "PanTauEvent/TauConstituent.h"
#include "PanTauEvent/TauFeature.h"
namespace Trk{
class ITrackToVertexIPEstimator;
}
namespace PanTau {
/** @class Tool_FeatureExtractor
Tool to extract jet features from tau seeds.
@author Christian Limbach
@author Sebastian Fleischmann
*/
class Tool_FeatureExtractor : public AthAlgTool, virtual public PanTau::ITool_FeatureExtractor {
public:
Tool_FeatureExtractor(const std::string&,const std::string&,const IInterface*);
// virtual ~Tool_FeatureExtractor ();
virtual StatusCode initialize();
// virtual StatusCode finalize ();
//get the features for an input seed
virtual StatusCode calculateFeatures(PanTau::PanTauSeed* inSeed);
void Log10();
protected:
//handle to the helper function
ToolHandle<PanTau::ITool_HelperFunctions> m_Tool_HelperFunctions;
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
ToolHandle<Trk::ITrackToVertexIPEstimator> m_Tool_TrackToVertexIPEstimator;
//map containing different methods to calc seed et
std::map<std::string, double> m_Variants_SeedEt;
//Function to calculate basic features
StatusCode calculateBasicFeatures(PanTau::PanTauSeed* inSeed);
//Function to calculate features for one set of constituents
StatusCode calculateFeatures(PanTau::PanTauSeed* inSeed,
int tauConstituentType);
//Function to add the 4 momenta of the tau constituents to the features
StatusCode addConstituentMomenta(PanTau::PanTauSeed* inSeed);
//Function to calculate features based on two sets of constituents
StatusCode addCombinedFeatures(PanTau::PanTauSeed* inSeed);
//Function to calculate generic jet features
StatusCode addGenericJetFeatures(PanTau::PanTauSeed* inSeed) const;
//Function to add impact parameter features
StatusCode addImpactParameterFeatures(PanTau::PanTauSeed* inSeed) const;
//Function to fill the m_Variants_SeedEt member
void fillVariantsSeedEt(std::vector<PanTau::TauConstituent*> tauConstituents);
//helper function to fill the m_Variants_SeedEt map
void addFeatureWrtSeedEnergy(PanTau::TauFeature* targetMap,
std::string featName,
double numerator,
std::map<std::string, double>* denominatorMap) const;
int m_Config_UseEmptySeeds;
//! Helper members m_Config_CellBased_EtaBinned_Pi0MVACut_3prong
std::vector<double> m_Config_CellBased_BinEdges_Eta;
std::vector<double> m_Config_CellBased_EtaBinned_Pi0MVACut_1prong;
std::vector<double> m_Config_CellBased_EtaBinned_Pi0MVACut_3prong;
//make these configured via python! (super trick ;))
static const std::string varTypeName_Sum() {return "Sum";}
static const std::string varTypeName_Ratio() {return "Ratio";}
static const std::string varTypeName_EtInRing() {return "EtInRing";}
static const std::string varTypeName_Isolation() {return "Isolation";}
static const std::string varTypeName_Num() {return "Num";}
static const std::string varTypeName_Mean() {return "Mean";}
static const std::string varTypeName_StdDev() {return "StdDev";}
static const std::string varTypeName_HLV() {return "HLV";}
static const std::string varTypeName_Angle() {return "Angle";}
static const std::string varTypeName_DeltaR() {return "DeltaR";}
static const std::string varTypeName_JetMoment() {return "JetMoment";}
static const std::string varTypeName_Combined() {return "Combined";}
static const std::string varTypeName_JetShape() {return "JetShape";}
static const std::string varTypeName_ImpactParams() {return "ImpactParams";}
static const std::string varTypeName_Basic() {return "Basic";}
static const std::string varTypeName_PID() {return "PID";}
static const std::string varTypeName_Shots() {return "Shots";}
std::string m_varTypeName_Sum;
std::string m_varTypeName_Ratio;
std::string m_varTypeName_EtInRing;
std::string m_varTypeName_Isolation;
std::string m_varTypeName_Num;
std::string m_varTypeName_Mean;
std::string m_varTypeName_StdDev;
std::string m_varTypeName_HLV;
std::string m_varTypeName_Angle;
std::string m_varTypeName_DeltaR;
std::string m_varTypeName_JetMoment;
std::string m_varTypeName_Combined;
std::string m_varTypeName_JetShape;
std::string m_varTypeName_ImpactParams;
std::string m_varTypeName_Basic;
std::string m_varTypeName_PID;
};
} // end of namespace PanTau
#endif // PANTAUALGS_TOOL_FEATUREEXTRACTOR_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// Header file for class TauImpactParameterExtractionTool
///////////////////////////////////////////////////////////////////
// (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Tool to store information needed in PanTau Algorithms
///////////////////////////////////////////////////////////////////
// limbach@physik.uni-bonn.de
///////////////////////////////////////////////////////////////////
#ifndef PANTAUALGS_TOOL_FOURMOMENTUMCALCULATOR_H
#define PANTAUALGS_TOOL_FOURMOMENTUMCALCULATOR_H
//! C++
#include <map>
#include <string>
//! Gaudi
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
//! PanTau
#include "PanTauInterfaces/ITool_FourMomentumCalculator.h"
#include "PanTauInterfaces/ITool_InformationStore.h"
class eflowObjectContainer;
class StoreGateSvc;
namespace PanTau {
class PanTauSeed;
}
namespace PanTau {
/** @class Tool_FourMomentumCalculator
Tool to store information needed in PanTau Algorithms
@author Christian Limbach (limbach@physik.uni-bonn.de)
*/
class Tool_FourMomentumCalculator : public AthAlgTool, virtual public PanTau::ITool_FourMomentumCalculator {
public:
Tool_FourMomentumCalculator(const std::string&,const std::string&,const IInterface*);
virtual ~Tool_FourMomentumCalculator ();
virtual StatusCode initialize();
// virtual StatusCode finalize ();
virtual StatusCode calculateFourMomentum(PanTau::PanTauSeed* inSeed) const;
private:
StoreGateSvc* m_sgSvc;
ToolHandle<PanTau::ITool_InformationStore> m_Tool_InformationStore;
std::string m_varTypeName_Basic;
};
} // end of namespace PanTau
#endif // PANTAUALGS_TAUIMPACTPARAMETEREXTRACTIONTOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef PANTAUALGS_TOOL_HELPERFUNCTIONS
#define PANTAUALGS_TOOL_HELPERFUNCTIONS
#include "AthenaBaseComps/AthAlgTool.h"
#include "NavFourMom/INavigable4MomentumCollection.h"