ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
TrigAFPToFHypoAlg Class Reference

#include <TrigAFPToFHypoAlg.h>

Inheritance diagram for TrigAFPToFHypoAlg:
Collaboration diagram for TrigAFPToFHypoAlg:

Public Member Functions

 TrigAFPToFHypoAlg (const std::string &name, ISvcLocator *pSvcLocator)
 
virtual StatusCode initialize () override
 
virtual StatusCode execute (const EventContext &context) const override
 

Private Attributes

SG::ReadHandleKey< xAOD::VertexContainerm_inputIdVtxKey {this, "VertexContainer", "HLT_IDVertex_FS", "ID vertex collection"}
 
SG::ReadHandleKey< xAOD::AFPVertexContainerm_inputAfpVtxKey {this, "AFPVertexContainer", "HLT_AFPVertex", "AFP ToF vertex collection"}
 
ToolHandleArray< TrigAFPToFHypoToolm_hypoTools {this, "HypoTools", {}}
 
ToolHandle< GenericMonitoringToolm_monTool { this, "MonTool", "", "Monitor tool for TrigAFPToFHypo" }
 

Detailed Description

Definition at line 24 of file TrigAFPToFHypoAlg.h.

Constructor & Destructor Documentation

◆ TrigAFPToFHypoAlg()

TrigAFPToFHypoAlg::TrigAFPToFHypoAlg ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 9 of file TrigAFPToFHypoAlg.cxx.

9  :
10  ::HypoBase(name, pSvcLocator)
11 {
12 }

Member Function Documentation

◆ execute()

StatusCode TrigAFPToFHypoAlg::execute ( const EventContext &  context) const
overridevirtual

Definition at line 24 of file TrigAFPToFHypoAlg.cxx.

25 {
26  ATH_MSG_DEBUG("TrigAFPToFHypoAlg::execute()");
27 
28  // Create the input and output decision containers
29  SG::ReadHandle<DecisionContainer> inputDecisionsHandle(decisionInput(), context);
30  SG::WriteHandle<DecisionContainer> outputDecisionsHandle = createAndStore(decisionOutput(), context );
31 
32  // Jet vertex container
34  ATH_CHECK(idVtxHandle.isValid());
35 
36  // AFP ToF vertex container
38  ATH_CHECK(afpVtxHandle.isValid());
39 
40  // monitor reason for skipping hypo tool
41  auto skipHypoTool = Monitored::Scalar<int>("skipHypoTool", 0);
42 
43  // vertex handle error checking
44  if (!afpVtxHandle.isValid()) {
45  ATH_MSG_DEBUG("AFP vertex handle invalid");
46  skipHypoTool = 1;
47  }
48  if (!idVtxHandle.isValid()) {
49  ATH_MSG_DEBUG("ID vertex handle invalid");
50  skipHypoTool = 2;
51  }
52 
53  // check vertex handle size
54  if (afpVtxHandle->size() == 0) {
55  ATH_MSG_DEBUG("No AFP vertices");
56  skipHypoTool = 3;
57  }
58  if (idVtxHandle->size() == 0) {
59  ATH_MSG_DEBUG("No ID vertices");
60  skipHypoTool = 4;
61  }
62 
63  // check if the only vertex has tracks (exclude 0 AFP vertices)
64  if (skipHypoTool != 3 && idVtxHandle->size() == 1 && idVtxHandle->at(0)->vxTrackAtVertexAvailable() == false) {
65  ATH_MSG_DEBUG("The only ID vertex has no tracks");
66  skipHypoTool = 5;
67  }
68 
69  // monitor number of vertices
70  auto n_afp_vertex = Monitored::Scalar<size_t>("afp_vtx_count", 0);
71  auto n_id_vertex = Monitored::Scalar<size_t>("id_vtx_count", 0);
72 
73  // loop over AFP vertices
74  for (size_t i = 0; i < afpVtxHandle->size(); ++i) {
75  const xAOD::AFPVertex* afpVtx = afpVtxHandle->at(i);
76  // if hypo tool is not skipped, print vertex information
77  if (skipHypoTool == 0) ATH_MSG_DEBUG("AFP vertex [" << i << "] z position: " << afpVtx->position());
78  auto afp_vtx_z = Monitored::Scalar<float>("afp_vtx_z", afpVtx->position());
79  Monitored::fill(m_monTool, afp_vtx_z);
80  n_afp_vertex += 1;
81  }
82  Monitored::fill(m_monTool, n_afp_vertex);
83 
84  // loop over ID vertices
85  for (size_t i = 0; i < idVtxHandle->size(); ++i) {
86  const xAOD::Vertex* idVtx = idVtxHandle->at(i);
87  // if hypo tool is not skipped, print vertex information
88  if (skipHypoTool == 0) ATH_MSG_DEBUG("ID vertex [" << i << "] z position: " << idVtx->z()
89  << " chi2: " << idVtx->chiSquared()
90  << " ndof: " << idVtx->numberDoF());
91  // skip dummy vertex
92  if (idVtx->vxTrackAtVertexAvailable() == false) continue;
93  if (idVtx->nTrackParticles() == 0) continue;
94 
95  auto id_vtx_z = Monitored::Scalar<float>("id_vtx_z", idVtx->z());
96  Monitored::fill(m_monTool, id_vtx_z);
97  n_id_vertex += 1;
98  }
99  Monitored::fill(m_monTool,n_id_vertex);
100 
101  // Vector of structs to pass to hypo tool
102  std::vector<TrigAFPToFHypoTool::AFPToFHypoToolInfo> hypoToolInput;
103 
104  // monitor the reason for skipping the hypo tool
105  Monitored::fill(m_monTool, skipHypoTool);
106 
107  if (skipHypoTool != 0)
108  {
109  ATH_MSG_DEBUG("Skipping hypo tool");
110  }
111  else
112  {
113  for (size_t i = 0; i < inputDecisionsHandle->size(); ++i) {
114  const Decision* previousDecision = inputDecisionsHandle->at(i);
115 
116  const xAOD::AFPVertex* afpVtx = afpVtxHandle->at(0);
117  const xAOD::Vertex* idVtx = idVtxHandle->at(0);
118 
119  // monitor delta z between vertices
120  auto delta_z = Monitored::Scalar<float>("delta_z", afpVtx->position() - idVtx->z());
121  Monitored::fill(m_monTool, delta_z);
122 
123  // Create an output Decision Object to track this object in the trigger navigation.
124  Decision* outputDecision = newDecisionIn(outputDecisionsHandle.ptr(), hypoAlgNodeName());
125 
126  // We link this 'outputDecision' to its parent, 'inputDecision'
127  linkToPrevious(outputDecision, previousDecision, context);
128 
129  // We attach the "feature" ElementLink which associates the DecisionObject with the AFP vertex
130  outputDecision->setObjectLink(featureString(), ElementLink<xAOD::AFPVertexContainer>(*afpVtxHandle, i, context));
131 
132  // We collect the set of chains which were active on this inputDecision coming in to this Step.
133  DecisionIDContainer inputPassingChains;
134  decisionIDs(previousDecision, inputPassingChains);
135 
136  hypoToolInput.emplace_back(inputPassingChains, afpVtx, idVtx, outputDecision);
137  }
138  }
139 
140  // Each individual chain has its own HypoTool, we loop over them and give them the hypoToolInput to discriminate over
141  for (const auto &tool : m_hypoTools) {
142  ATH_CHECK(tool->decide(hypoToolInput));
143  }
144 
145  // Performs some runtime-checks.
146  ATH_CHECK( hypoBaseOutputProcessing(outputDecisionsHandle) );
147 
148  return StatusCode::SUCCESS;
149 }

◆ initialize()

StatusCode TrigAFPToFHypoAlg::initialize ( )
overridevirtual

Definition at line 14 of file TrigAFPToFHypoAlg.cxx.

15 {
16  ATH_MSG_DEBUG("TrigAFPToFHypoAlg::initialize()");
17  ATH_CHECK(m_inputIdVtxKey.initialize()); //ID vertex
18  ATH_CHECK(m_inputAfpVtxKey.initialize()); //ToF vertex
19  ATH_CHECK(m_hypoTools.retrieve());
20  if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
21  return StatusCode::SUCCESS;
22 }

Member Data Documentation

◆ m_hypoTools

ToolHandleArray<TrigAFPToFHypoTool> TrigAFPToFHypoAlg::m_hypoTools {this, "HypoTools", {}}
private

Definition at line 35 of file TrigAFPToFHypoAlg.h.

◆ m_inputAfpVtxKey

SG::ReadHandleKey<xAOD::AFPVertexContainer> TrigAFPToFHypoAlg::m_inputAfpVtxKey {this, "AFPVertexContainer", "HLT_AFPVertex", "AFP ToF vertex collection"}
private

Definition at line 34 of file TrigAFPToFHypoAlg.h.

◆ m_inputIdVtxKey

SG::ReadHandleKey< xAOD::VertexContainer > TrigAFPToFHypoAlg::m_inputIdVtxKey {this, "VertexContainer", "HLT_IDVertex_FS", "ID vertex collection"}
private

Definition at line 33 of file TrigAFPToFHypoAlg.h.

◆ m_monTool

ToolHandle<GenericMonitoringTool> TrigAFPToFHypoAlg::m_monTool { this, "MonTool", "", "Monitor tool for TrigAFPToFHypo" }
private

Definition at line 38 of file TrigAFPToFHypoAlg.h.


The documentation for this class was generated from the following files:
xAOD::Vertex_v1::nTrackParticles
size_t nTrackParticles() const
Get the number of tracks associated with this vertex.
Definition: Vertex_v1.cxx:270
TrigAFPToFHypoAlg::m_inputAfpVtxKey
SG::ReadHandleKey< xAOD::AFPVertexContainer > m_inputAfpVtxKey
Definition: TrigAFPToFHypoAlg.h:34
TrigAFPToFHypoAlg::m_inputIdVtxKey
SG::ReadHandleKey< xAOD::VertexContainer > m_inputIdVtxKey
Definition: TrigAFPToFHypoAlg.h:33
TrigCompositeUtils::newDecisionIn
Decision * newDecisionIn(DecisionContainer *dc, const std::string &name)
Helper method to create a Decision object, place it in the container and return a pointer to it.
Definition: TrigCompositeUtilsRoot.cxx:46
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
xAOD::AFPVertex_v1::position
float position() const
Vertex position .
TrigCompositeUtils::hypoAlgNodeName
const std::string & hypoAlgNodeName()
Definition: TrigCompositeUtilsRoot.cxx:906
TrigCompositeUtils::createAndStore
SG::WriteHandle< DecisionContainer > createAndStore(const SG::WriteHandleKey< DecisionContainer > &key, const EventContext &ctx)
Creates and right away records the DecisionContainer with the key.
Definition: TrigCompositeUtilsRoot.cxx:30
TrigAFPToFHypoAlg::m_monTool
ToolHandle< GenericMonitoringTool > m_monTool
Definition: TrigAFPToFHypoAlg.h:38
lumiFormat.i
int i
Definition: lumiFormat.py:92
xAOD::TrigComposite_v1::setObjectLink
bool setObjectLink(const std::string &name, const ElementLink< CONTAINER > &link)
Set the link to an object.
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
xAOD::Vertex_v1::z
float z() const
Returns the z position.
xAOD::TrigComposite_v1
Class used to describe composite objects in the HLT.
Definition: TrigComposite_v1.h:52
TrigAFPToFHypoAlg::m_hypoTools
ToolHandleArray< TrigAFPToFHypoTool > m_hypoTools
Definition: TrigAFPToFHypoAlg.h:35
Monitored::fill
void fill(const ToolHandle< GenericMonitoringTool > &tool, T &&... variables)
Definition: MonitoredGroup.h:122
TrigCompositeUtils::featureString
const std::string & featureString()
Definition: TrigCompositeUtilsRoot.cxx:886
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
AtlCoolConsole.tool
tool
Definition: AtlCoolConsole.py:453
xAOD::Vertex_v1::numberDoF
float numberDoF() const
Returns the number of degrees of freedom of the vertex fit as float.
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
TrigCompositeUtils::linkToPrevious
void linkToPrevious(Decision *d, const std::string &previousCollectionKey, size_t previousIndex)
Links to the previous object, location of previous 'seed' decision supplied by hand.
Definition: TrigCompositeUtilsRoot.cxx:139
TrigCompositeUtils::DecisionIDContainer
std::set< DecisionID > DecisionIDContainer
Definition: TrigComposite_v1.h:28
xAOD::Vertex_v1::chiSquared
float chiSquared() const
Returns the of the vertex fit as float.
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
TrigCompositeUtils::decisionIDs
void decisionIDs(const Decision *d, DecisionIDContainer &destination)
Extracts DecisionIDs stored in the Decision object.
Definition: TrigCompositeUtilsRoot.cxx:67
Monitored::Scalar
Declare a monitored scalar variable.
Definition: MonitoredScalar.h:34
xAOD::AFPVertex_v1
Class representing a vertex reconstructed in AFP.
Definition: AFPVertex_v1.h:41
xAOD::Vertex_v1::vxTrackAtVertexAvailable
bool vxTrackAtVertexAvailable() const
Check if VxTrackAtVertices are attached to the object.
Definition: Vertex_v1.cxx:209