ATLAS Offline Software
GeoGetIds.h
Go to the documentation of this file.
1 // This file's extension implies that it's C, but it's really -*- C++ -*-.
2 /*
3  * Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration.
4  */
13 #ifndef GEOMODELUTILITIES_GEOGETIDS_H
14 #define GEOMODELUTILITIES_GEOGETIDS_H
15 
18 
19 #include "GeoModelKernel/GeoNodeAction.h"
20 
21 
28 {
29 public:
30  virtual ~IGeoGetIdsAction() = default;
31  virtual void operator() (int id) = 0;
32 };
33 
34 
39 class GeoGetIds
40  : public GeoNodeAction
41 {
42 public:
43  GeoGetIds (IGeoGetIdsAction& action, int depthLimit = 1);
44  virtual void handleSerialTransformer (const GeoSerialTransformer *sT) override;
45  virtual void handleIdentifierTag (const GeoIdentifierTag *idTag) override;
46  virtual void handleSerialIdentifier(const GeoSerialIdentifier *sI) override;
47 
48 
49 private:
51  const GeoSerialIdentifier *m_serialIdentifier = nullptr;
52 };
53 
54 
58 template <class FUNCTION>
60  : public IGeoGetIdsAction
61 {
62 public:
63  GeoGetIdsAction (FUNCTION f) : m_f (f) {}
64  virtual void operator() (int id) override
65  {
66  m_f (id);
67  }
68  FUNCTION m_f;
69 };
70 
71 
72 
81 template <class FUNCTION>
82 void geoGetIds (FUNCTION f, const GeoGraphNode* node, int depthLimit = 1)
83 {
85  GeoGetIds visitor (act, depthLimit);
86  node->exec (&visitor);
87 }
88 
89 
90 #endif // not GEOMODELUTILITIES_GEOGETIDS_H
GeoGetIds::handleSerialIdentifier
virtual void handleSerialIdentifier(const GeoSerialIdentifier *sI) override
Definition: GeoGetIds.cxx:41
GeoGetIdsAction
Callback object calling a templated functional.
Definition: GeoGetIds.h:61
GeoGetIdsAction::m_f
FUNCTION m_f
Definition: GeoGetIds.h:68
IGeoGetIdsAction::operator()
virtual void operator()(int id)=0
GeoGetIds::handleIdentifierTag
virtual void handleIdentifierTag(const GeoIdentifierTag *idTag) override
Definition: GeoGetIds.cxx:34
GeoPrimitives.h
IGeoGetIdsAction
Ensure that the extensions for the Vector3D are properly loaded.
Definition: GeoGetIds.h:28
GeoGetIds::m_serialIdentifier
const GeoSerialIdentifier * m_serialIdentifier
Definition: GeoGetIds.h:51
hist_file_dump.f
f
Definition: hist_file_dump.py:135
GeoGetIds
Visitor to traverse a GeoModel graph and make a callback for each identifier found.
Definition: GeoGetIds.h:41
GeoGetIdsAction::operator()
virtual void operator()(int id) override
Definition: GeoGetIds.h:64
GeoGetIds::m_action
IGeoGetIdsAction & m_action
Definition: GeoGetIds.h:50
geoGetIds
void geoGetIds(FUNCTION f, const GeoGraphNode *node, int depthLimit=1)
Template helper for running the visitor.
Definition: GeoGetIds.h:82
GeoGetIdsAction::GeoGetIdsAction
GeoGetIdsAction(FUNCTION f)
Definition: GeoGetIds.h:63
python.CaloScaleNoiseConfig.action
action
Definition: CaloScaleNoiseConfig.py:77
GeoGetIds::GeoGetIds
GeoGetIds(IGeoGetIdsAction &action, int depthLimit=1)
Definition: GeoGetIds.cxx:15
GeoGetIds::handleSerialTransformer
virtual void handleSerialTransformer(const GeoSerialTransformer *sT) override
Definition: GeoGetIds.cxx:23
IGeoGetIdsAction::~IGeoGetIdsAction
virtual ~IGeoGetIdsAction()=default
node
Definition: memory_hooks-stdcmalloc.h:74