ATLAS Offline Software
TrigTauRecMerged.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #ifndef TRIGTAUREC_TRIGTAURECMERGED_H
6 #define TRIGTAUREC_TRIGTAURECMERGED_H
7 
8 #include "GaudiKernel/ToolHandle.h"
9 #include "Gaudi/Parsers/Factory.h"
10 
15 
18 
21 #include "xAODJet/JetContainer.h"
24 
26 public:
27  TrigTauRecMerged(const std::string& name, ISvcLocator* pSvcLocator);
28 
29  virtual StatusCode initialize() override;
30  virtual StatusCode execute(const EventContext& ctx) const override;
31 
32 private:
33  template<class V> StatusCode deepCopy(SG::WriteHandle<DataVector<V>>& writeHandle, const DataVector<V>* oldContainer) const;
34 
35  // Error codes for calo reconstruction
36  enum TAUEFCALOMON {
47  };
48 
49  // Error codes for tracking
50  enum TAUEFTRKMON {
52  NoVtxCont=1
53  };
54 
55  // Internal tools store
56  // The sequence of tool execution goes as follows:
57  // VertexFinderTools -> CommonToolsBeforeTF -> TrackFinderTools -> CommonTools -> VertexVarsTools -> IDTools
58  const ToolHandleArray<ITauToolBase> m_commonTools {this, "CommonTools", {}, "List of ITauToolBase common tools"};
59  const ToolHandleArray<ITauToolBase> m_commonToolsBeforeTF {this, "CommonToolsBeforeTF", {}, "List of ITauToolBase common tools to execute before the Track Finder tools"};
60  const ToolHandleArray<ITauToolBase> m_vertexFinderTools {this, "VertexFinderTools", {}, "Vertex Finder tools"};
61  const ToolHandleArray<ITauToolBase> m_trackFinderTools {this, "TrackFinderTools", {}, "Track Finder tools"};
62  const ToolHandleArray<ITauToolBase> m_vertexVarsTools {this, "VertexVarsTools", {}, "Vertex Variables tools"};
63  const ToolHandleArray<ITauToolBase> m_idTools {this, "IDTools", {}, "Vertex Variables tools"};
64 
65  // Monitoring tool
66  const ToolHandle<GenericMonitoringTool> m_monTool {this, "MonTool", "", "Monitoring tool"};
67  Gaudi::Property<std::map<std::string, std::pair<std::string, std::string>>> m_monitoredIdScores {this, "MonitoredIDScores", {}, "Pairs of the TauID score and signal-transformed scores for each TauID algorithm to be monitored"};
68  std::map<std::string, std::pair<SG::AuxElement::ConstAccessor<float>, SG::AuxElement::ConstAccessor<float>>> m_monitoredIdAccessors;
69 
70  // Inputs
71  SG::ReadHandleKey<TrigRoiDescriptorCollection> m_roiInputKey {this, "InputRoIs", "", "Input RoI name"};
72  SG::ReadHandleKey<xAOD::CaloClusterContainer> m_clustersInputKey {this, "InputCaloClusterContainer", "", "Caloclusters in view"};
73  SG::ReadHandleKey<xAOD::VertexContainer> m_vertexInputKey {this, "InputVertexContainer", "", "Input vertex container"};
74  SG::ReadHandleKey<xAOD::TauJetContainer> m_tauJetInputKey {this, "InputTauJetContainer", "", "Input TauJet container"};
75  SG::ReadHandleKey<xAOD::TauTrackContainer> m_tauTrackInputKey {this, "InputTauTrackContainer", "", "Input TauTrack container" };
76 
77  // Outputs
78  SG::WriteHandleKey<xAOD::JetContainer> m_tauSeedOutputKey {this, "OutputJetSeed", "", "Output jets which are seeds for tau jets"};
79  SG::WriteHandleKey<xAOD::TauJetContainer> m_tauJetOutputKey {this, "OutputTauJetContainer", "", "Output TauJet container"};
80  SG::WriteHandleKey<xAOD::TauTrackContainer> m_tauTrackOutputKey {this, "OutputTauTrackContainer", "", "Output TauTrack container"};
81 
82  // Helper methods
83  bool doCaloReconstruction() const { return m_tauJetInputKey.key().empty() && !m_clustersInputKey.key().empty(); }
84 };
85 
86 // Function to perform deep copy on container
87 template<class V> StatusCode TrigTauRecMerged::deepCopy(SG::WriteHandle<DataVector<V>>& writeHandle, const DataVector<V>* oldContainer) const {
88  if(!writeHandle.isValid()) {
89  ATH_MSG_FATAL("Provided with an invalid write handle");
90  return StatusCode::FAILURE;
91  }
92 
93  if(oldContainer){
94  for(const V* v : *oldContainer) {
95  // Build a new object in the new container
96  writeHandle->push_back(std::make_unique<V>());
97  // Copy across the aux store
98  *writeHandle->back() = *v;
99  }
100  }
101  return StatusCode::SUCCESS;
102 }
103 
104 #endif
ReadHandleKey.h
Property holding a SG store/key/clid from which a ReadHandle is made.
TrigTauRecMerged::NoClustKey
@ NoClustKey
Definition: TrigTauRecMerged.h:41
TrigTauRecMerged::m_vertexInputKey
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexInputKey
Definition: TrigTauRecMerged.h:73
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
TrigTauRecMerged::m_monitoredIdScores
Gaudi::Property< std::map< std::string, std::pair< std::string, std::string > > > m_monitoredIdScores
Definition: TrigTauRecMerged.h:67
TrigTauRecMerged::m_clustersInputKey
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clustersInputKey
Definition: TrigTauRecMerged.h:72
TrigTauRecMerged::NoClustCont
@ NoClustCont
Definition: TrigTauRecMerged.h:40
TrigTauRecMerged::m_idTools
const ToolHandleArray< ITauToolBase > m_idTools
Definition: TrigTauRecMerged.h:63
TrigTauRecMerged::NoJetAttach
@ NoJetAttach
Definition: TrigTauRecMerged.h:43
TrigTauRecMerged::m_commonTools
const ToolHandleArray< ITauToolBase > m_commonTools
Definition: TrigTauRecMerged.h:58
TrigTauRecMerged::NoROIDescr
@ NoROIDescr
Definition: TrigTauRecMerged.h:37
TrigTauRecMerged::TrigTauRecMerged
TrigTauRecMerged(const std::string &name, ISvcLocator *pSvcLocator)
Definition: TrigTauRecMerged.cxx:33
TrigTauRecMerged::doCaloReconstruction
bool doCaloReconstruction() const
Definition: TrigTauRecMerged.h:83
TrigTauRecMerged::m_vertexFinderTools
const ToolHandleArray< ITauToolBase > m_vertexFinderTools
Definition: TrigTauRecMerged.h:60
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
TrigTauRecMerged::m_monTool
const ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigTauRecMerged.h:66
TrigTauRecMerged::m_tauTrackOutputKey
SG::WriteHandleKey< xAOD::TauTrackContainer > m_tauTrackOutputKey
Definition: TrigTauRecMerged.h:80
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
TauTrackContainer.h
SG::ReadHandleKey< TrigRoiDescriptorCollection >
TrigTauRecMerged::deepCopy
StatusCode deepCopy(SG::WriteHandle< DataVector< V >> &writeHandle, const DataVector< V > *oldContainer) const
Definition: TrigTauRecMerged.h:87
AthReentrantAlgorithm
An algorithm that can be simultaneously executed in multiple threads.
Definition: AthReentrantAlgorithm.h:83
GenericMonitoringTool.h
SG::WriteHandleKey
Property holding a SG store/key/clid from which a WriteHandle is made.
Definition: StoreGate/StoreGate/WriteHandleKey.h:40
TrigTauRecMerged::m_vertexVarsTools
const ToolHandleArray< ITauToolBase > m_vertexVarsTools
Definition: TrigTauRecMerged.h:62
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
TrigTauRecMerged::EmptyClustCont
@ EmptyClustCont
Definition: TrigTauRecMerged.h:42
TrigTauRecMerged::TAUEFCALOMON
TAUEFCALOMON
Definition: TrigTauRecMerged.h:36
TrigTauRecMerged::initialize
virtual StatusCode initialize() override
Definition: TrigTauRecMerged.cxx:40
TrigTauRecMerged::NoHLTtauAttach
@ NoHLTtauAttach
Definition: TrigTauRecMerged.h:44
TauJetContainer.h
TrigTauRecMerged
Definition: TrigTauRecMerged.h:25
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
TrigTauRecMerged::execute
virtual StatusCode execute(const EventContext &ctx) const override
Definition: TrigTauRecMerged.cxx:81
AthReentrantAlgorithm.h
WriteHandleKey.h
Property holding a SG store/key/clid from which a WriteHandle is made.
TrigTauRecMerged::m_tauJetOutputKey
SG::WriteHandleKey< xAOD::TauJetContainer > m_tauJetOutputKey
Definition: TrigTauRecMerged.h:79
TrigTauRecMerged::m_roiInputKey
SG::ReadHandleKey< TrigRoiDescriptorCollection > m_roiInputKey
Definition: TrigTauRecMerged.h:71
TrigTauRecMerged::NoHLTtauDetAttach
@ NoHLTtauDetAttach
Definition: TrigTauRecMerged.h:45
TrigTauRecMerged::NoVtxCont
@ NoVtxCont
Definition: TrigTauRecMerged.h:52
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
TrigTauRecMerged::m_trackFinderTools
const ToolHandleArray< ITauToolBase > m_trackFinderTools
Definition: TrigTauRecMerged.h:61
TrigTauRecMerged::NoCellCont
@ NoCellCont
Definition: TrigTauRecMerged.h:38
ITauToolBase.h
python.PyAthena.v
v
Definition: PyAthena.py:154
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
VertexContainer.h
TrigTauRecMerged::m_tauTrackInputKey
SG::ReadHandleKey< xAOD::TauTrackContainer > m_tauTrackInputKey
Definition: TrigTauRecMerged.h:75
JetContainer.h
TrigTauRecMerged::NoTrkCont
@ NoTrkCont
Definition: TrigTauRecMerged.h:51
TrigTauRecMerged::NoHLTtauXdetAttach
@ NoHLTtauXdetAttach
Definition: TrigTauRecMerged.h:46
TrigTauRecMerged::EmptyCellCont
@ EmptyCellCont
Definition: TrigTauRecMerged.h:39
TrigTauRecMerged::m_monitoredIdAccessors
std::map< std::string, std::pair< SG::AuxElement::ConstAccessor< float >, SG::AuxElement::ConstAccessor< float > > > m_monitoredIdAccessors
Definition: TrigTauRecMerged.h:68
TrigRoiDescriptor.h
TrigTauRecMerged::m_commonToolsBeforeTF
const ToolHandleArray< ITauToolBase > m_commonToolsBeforeTF
Definition: TrigTauRecMerged.h:59
TrigTauRecMerged::TAUEFTRKMON
TAUEFTRKMON
Definition: TrigTauRecMerged.h:50
TrigTauRecMerged::m_tauJetInputKey
SG::ReadHandleKey< xAOD::TauJetContainer > m_tauJetInputKey
Definition: TrigTauRecMerged.h:74
TrackParticleContainer.h
TrigTauRecMerged::m_tauSeedOutputKey
SG::WriteHandleKey< xAOD::JetContainer > m_tauSeedOutputKey
Definition: TrigTauRecMerged.h:78