00001
00002 #ifndef INDETTRACKSELECTIONTOOL_INDETTRACKSELECTIONTOOL_H
00003 #define INDETTRACKSELECTIONTOOL_INDETTRACKSELECTIONTOOL_H
00004
00005
00006 #include "InDetTrackSelectionTool/IInDetTrackSelectionTool.h"
00007
00008
00009 #include "AsgTools/AsgTool.h"
00010 #ifndef XAOD_ANALYSIS
00011 #include "GaudiKernel/ToolHandle.h"
00012 #include "GaudiKernel/ServiceHandle.h"
00013 #include "TrkToolInterfaces/ITrackSummaryTool.h"
00014 #include "TrkExInterfaces/IExtrapolator.h"
00015 #endif
00016
00017 #include <map>
00018 #include <limits>
00019
00020 namespace InDet {
00021
00022
00023 class TrackAccessor;
00024 class TrackCut;
00025
00028 class InDetTrackSelectionTool :
00029 public virtual IInDetTrackSelectionTool,
00030 public asg::AsgTool {
00031
00032 friend class TrackCut;
00033
00035 ASG_TOOL_CLASS2( InDetTrackSelectionTool,
00036 IAsgSelectionTool,
00037 InDet::IInDetTrackSelectionTool )
00038
00039 public:
00041 InDetTrackSelectionTool( const std::string& name, const std::string& cutLevel = "" );
00042
00043
00044
00045 ~InDetTrackSelectionTool();
00046
00049
00051 virtual StatusCode initialize() override;
00053 virtual StatusCode finalize() override;
00054
00056
00059
00061 virtual const Root::TAccept& getTAccept() const override;
00062
00064 virtual const Root::TAccept& accept( const xAOD::IParticle* ) const override;
00065
00067
00070
00072 virtual const Root::TAccept& accept( const xAOD::TrackParticle& track,
00073 const xAOD::Vertex* vertex = nullptr ) const override;
00074
00075 #ifndef XAOD_ANALYSIS
00076 virtual const Root::TAccept& accept( const Trk::Track& track,
00077 const Trk::Vertex* vertex = nullptr ) const override;
00078 #endif
00079
00081
00082 virtual void setCutLevel( InDet::CutLevel level, Bool_t overwrite = true ) override
00083 __attribute__ ((deprecated("For consistency with the athena interface, the cut level is best set through the \"CutLevel\" property.")));
00084
00085 private:
00086 bool m_isInitialized = false;
00087 mutable bool m_warnInit = false;
00088
00089
00090 void setCutLevelPrivate( InDet::CutLevel level, Bool_t overwrite = true );
00091
00092 std::unordered_map< std::string, std::shared_ptr<TrackAccessor> > m_trackAccessors;
00093
00094
00095 std::map< std::string, std::vector< std::unique_ptr<TrackCut> > > m_trackCuts;
00096
00097 mutable ULong64_t m_numTracksProcessed = 0;
00098 mutable ULong64_t m_numTracksPassed = 0;
00099 mutable std::vector<ULong64_t> m_numTracksPassedCuts;
00100
00101 constexpr static Double_t LOCAL_MAX_DOUBLE = 1.0e16;
00102 constexpr static Int_t LOCAL_MAX_INT = std::numeric_limits<Int_t>::max();
00103
00104 Double_t m_minPt = -1.;
00105 Double_t m_maxAbsEta = LOCAL_MAX_DOUBLE;
00106 Double_t m_maxZ0SinTheta = LOCAL_MAX_DOUBLE;
00107 Double_t m_maxZ0 = LOCAL_MAX_DOUBLE;
00108 Double_t m_maxD0 = LOCAL_MAX_DOUBLE;
00109 Double_t m_maxSigmaD0 = LOCAL_MAX_DOUBLE;
00110 Double_t m_maxSigmaZ0 = LOCAL_MAX_DOUBLE;
00111 Double_t m_maxSigmaZ0SinTheta = LOCAL_MAX_DOUBLE;
00112 Double_t m_maxD0overSigmaD0 = LOCAL_MAX_DOUBLE;
00113 Double_t m_maxZ0overSigmaZ0 = LOCAL_MAX_DOUBLE;
00114 Double_t m_maxZ0SinThetaoverSigmaZ0SinTheta = LOCAL_MAX_DOUBLE;
00115 Int_t m_minNInnermostLayerHits = -1;
00116 Int_t m_minNNextToInnermostLayerHits = -1;
00117 Int_t m_minNBothInnermostLayersHits = -1;
00118 Int_t m_maxNInnermostLayerSharedHits = LOCAL_MAX_INT;
00119 Int_t m_useMinBiasInnermostLayersCut = 0;
00120 Int_t m_minNSiHits = -1;
00121 Int_t m_maxNSiSharedHits = LOCAL_MAX_INT;
00122 Int_t m_minNSiHitsIfSiSharedHits = -1;
00123 Int_t m_maxNSiHoles = LOCAL_MAX_INT;
00124 Int_t m_minNPixelHits = -1;
00125 Int_t m_maxNPixelSharedHits = LOCAL_MAX_INT;
00126 Int_t m_maxNPixelHoles = LOCAL_MAX_INT;
00127 Double_t m_minEtaForStrictNSiHitsCut = LOCAL_MAX_DOUBLE;
00128 Int_t m_minNSiHitsAboveEtaCutoff = -1;
00129 Bool_t m_maxOneSharedModule = false;
00130 Bool_t m_useEtaDependentMaxChiSq = false;
00131 Double_t m_minP = -1.;
00132 Int_t m_minNSiHitsPhysical = -1;
00133 Int_t m_minNPixelHitsPhysical = -1;
00134 Int_t m_minNSctHitsPhysical = -1;
00135 Int_t m_minNSctHits = -1;
00136 Int_t m_maxNSctSharedHits = LOCAL_MAX_INT;
00137 Int_t m_maxNSctHoles = LOCAL_MAX_INT;
00138 Int_t m_maxNSctDoubleHoles = LOCAL_MAX_INT;
00139 Double_t m_maxTrtEtaAcceptance = LOCAL_MAX_DOUBLE;
00140 Double_t m_maxEtaForTrtHitCuts = -1.;
00141 Int_t m_minNTrtHits = -1;
00142 Int_t m_minNTrtHitsPlusOutliers = -1;
00143 Int_t m_minNTrtHighThresholdHits = -1;
00144 Int_t m_minNTrtHighThresholdHitsPlusOutliers = -1;
00145 Double_t m_maxTrtHighEFraction = LOCAL_MAX_DOUBLE;
00146 Double_t m_maxTrtHighEFractionWithOutliers = LOCAL_MAX_DOUBLE;
00147 Double_t m_maxTrtOutlierFraction = LOCAL_MAX_DOUBLE;
00148 Double_t m_maxChiSq = LOCAL_MAX_DOUBLE;
00149 Double_t m_maxChiSqperNdf = LOCAL_MAX_DOUBLE;
00150 Double_t m_minProb = -1.;
00151 Double_t m_minPtForProbCut = LOCAL_MAX_DOUBLE;
00152 Double_t m_minProbAbovePtCutoff = -1.;
00153 Int_t m_minNUsedHitsdEdx = -1;
00154 Int_t m_minNOverflowHitsdEdx = -1;
00155 Bool_t m_eProbHTonlyForXe = false;
00156 Double_t m_minEProbabilityHT = -1.;
00157 Int_t m_useExperimentalInnermostLayersCut = false;
00158 #ifndef XAOD_ANALYSIS
00159 Int_t m_minNSiHitsMod = -1;
00160 Int_t m_minNSiHitsModTop = -1;
00161 Int_t m_minNSiHitsModBottom = -1;
00162 #endif
00163 std::vector< Double_t > m_vecEtaCutoffsForSiHitsCut;
00164 std::vector< Int_t > m_vecMinNSiHitsAboveEta;
00165 std::vector< Double_t > m_vecEtaCutoffsForPtCut;
00166 std::vector< Double_t > m_vecMinPtAboveEta;
00167
00168 std::vector< Double_t > m_vecPtCutoffsForSctHitsCut;
00169 std::vector< Int_t > m_vecMinNSctHitsAbovePt;
00170
00172 mutable Root::TAccept m_accept;
00173
00174
00175
00176 std::string m_cutLevel;
00177
00178
00179 static const std::unordered_map<std::string, CutLevel> s_mapCutLevel;
00180
00181 #ifndef XAOD_ANALYSIS
00182 Bool_t m_initTrkTools = false;
00183 Bool_t m_trackSumToolAvailable = false;
00184 ToolHandle<Trk::ITrackSummaryTool> m_trackSumTool;
00185 ToolHandle<Trk::IExtrapolator> m_extrapolator;
00186
00187 #endif // XAOD_ANALYSIS
00188
00189 };
00190
00191 }
00192
00193 #endif // INDETTRACKSELECTIONTOOL_INDETTRACKSELECTIONTOOL_H