ATLAS Offline Software
Loading...
Searching...
No Matches
Trk::EventCnvSuperTool Class Reference

Tool to handle TP conversions for Tracking EDM. More...

#include <EventCnvSuperTool.h>

Inheritance diagram for Trk::EventCnvSuperTool:
Collaboration diagram for Trk::EventCnvSuperTool:

Public Member Functions

virtual ~EventCnvSuperTool ()
virtual StatusCode initialize () override
virtual StatusCode finalize () override
virtual const Trk::ITrkEventCnvTool * getCnvTool (const Identifier &id) const override
virtual const Trk::Surface * getSurface (const Identifier &id) const override
 From passed Identifier.
virtual void recreateRIO_OnTrack (RIO_OnTrack *RoT) const override
 Take the passed RoT and recreate it (i.e.
virtual void prepareRIO_OnTrack (RIO_OnTrack *Rot) const override
 Take the passed RoT and prepare the PRD ElementLink for writing to disc.
virtual void prepareRIO_OnTrackLink (const RIO_OnTrack *Rot, ELKey_t &key, ELIndex_t &index) const override
 Take the passed RoT and return the EL components to write to disc.
virtual bool canHandleInDet () const override
virtual bool canHandleMuonSpectrometer () const override
virtual int maxNumberOfErrors () const override
virtual bool noGeometry () const override
virtual bool doTrackOverlay () const override

Private Attributes

ToolHandle< Trk::ITrkEventCnvTool > m_idCnvTool {this, "IdCnvTool", "InDet::InDetEventCnvTool/InDetEventCnvTool", "Tool used to handle ID RoTs etc"}
 Tool used to handle ID RoTs etc.
ToolHandle< Trk::ITrkEventCnvTool > m_muonCnvTool {this, "MuonCnvTool", "Muon::MuonEventCnvTool/MuonEventCnvTool", "Tool used to handle Muon RoTs etc"}
 Tool used to handle Muon RoTs etc.
const AtlasDetectorID * m_detID = nullptr
bool m_haveIdCnvTool = false
 Flag set in intialise, letting us know whether the tool has been found.
bool m_haveMuonCnvTool = false
 Flag set in intialise, letting us know whether the tool has been found.
Gaudi::Property< bool > m_doMuons
Gaudi::Property< bool > m_doID
Gaudi::Property< bool > m_doTrackOverlay
std::atomic_int m_errCount = 0
 Current number of ERROR/WARNING messages sent to output.
Gaudi::Property< int > m_maxErrCount

Detailed Description

Tool to handle TP conversions for Tracking EDM.

This tool has sub tools that do the detector-specific conversions

Definition at line 26 of file EventCnvSuperTool.h.

Constructor & Destructor Documentation

◆ ~EventCnvSuperTool()

Trk::EventCnvSuperTool::~EventCnvSuperTool ( )
virtual

Definition at line 16 of file EventCnvSuperTool.cxx.

16 {
18 ATH_MSG_WARNING("Suppressed " << (m_errCount - m_maxErrCount)
19 << " warning or error messages");
20}
#define ATH_MSG_WARNING(x,...)
std::atomic_int m_errCount
Current number of ERROR/WARNING messages sent to output.
Gaudi::Property< int > m_maxErrCount

Member Function Documentation

◆ canHandleInDet()

virtual bool Trk::EventCnvSuperTool::canHandleInDet ( ) const
inlineoverridevirtual

Definition at line 54 of file EventCnvSuperTool.h.

54{ return m_haveIdCnvTool;}
bool m_haveIdCnvTool
Flag set in intialise, letting us know whether the tool has been found.

◆ canHandleMuonSpectrometer()

virtual bool Trk::EventCnvSuperTool::canHandleMuonSpectrometer ( ) const
inlineoverridevirtual

Definition at line 55 of file EventCnvSuperTool.h.

55{ return m_haveMuonCnvTool;}
bool m_haveMuonCnvTool
Flag set in intialise, letting us know whether the tool has been found.

◆ doTrackOverlay()

virtual bool Trk::EventCnvSuperTool::doTrackOverlay ( ) const
inlineoverridevirtual

Definition at line 60 of file EventCnvSuperTool.h.

60{return m_doTrackOverlay;}
Gaudi::Property< bool > m_doTrackOverlay

◆ finalize()

StatusCode Trk::EventCnvSuperTool::finalize ( )
overridevirtual

Definition at line 77 of file EventCnvSuperTool.cxx.

77 {
78 msg() << "Finalize().";
79 if (m_errCount > 0)
80 msg() << " Tried to print " << m_errCount
81 << " error/warning messages (with maximum permissable = "
82 << m_maxErrCount << ")";
83 msg() << endmsg;
84 return StatusCode::SUCCESS;
85}
#define endmsg
MsgStream & msg
Definition testRead.cxx:32

◆ getCnvTool()

const Trk::ITrkEventCnvTool * Trk::EventCnvSuperTool::getCnvTool ( const Identifier & id) const
overridevirtual

Definition at line 87 of file EventCnvSuperTool.cxx.

88 {
89 if (m_detID == nullptr)
90 return nullptr;
91
92 if (m_detID->is_indet(id)) {
93 if (m_haveIdCnvTool) {
94 return &(*m_idCnvTool);
95 } else {
96 if ((m_errCount++) < m_maxErrCount)
97 ATH_MSG_WARNING("ID RIO_OnTrack, but have no ID cnv tool!");
98 return nullptr;
99 }
100 } else {
101 if (m_detID->is_muon(id)) {
102 if (m_haveMuonCnvTool) {
103 return &(*m_muonCnvTool);
104 } else {
105 if ((m_errCount++) < m_maxErrCount)
107 "Muon RIO_OnTrack, but have no muon cnv tool. Cannot set check "
108 "RoT.");
109 return nullptr;
110 }
111 }
112 }
113
114 if ((m_errCount++) < m_maxErrCount) {
115 std::string ident = m_detID->show_to_string(id);
116 ATH_MSG_WARNING("Unknown Identifier: (" << ident << "), that is (" << id
117 << ")");
118 }
119 return nullptr;
120}
const AtlasDetectorID * m_detID
@ ident
Definition HitInfo.h:77

◆ getSurface()

const Trk::Surface * Trk::EventCnvSuperTool::getSurface ( const Identifier & id) const
overridevirtual

From passed Identifier.

Definition at line 122 of file EventCnvSuperTool.cxx.

123 {
124 const Surface* surface = nullptr;
125 const Trk::ITrkEventCnvTool* cnvTool = getCnvTool(id);
126 if (cnvTool != nullptr) {
127 const TrkDetElementBase* detEl = cnvTool->getDetectorElement(id);
128 if (detEl != nullptr)
129 surface = &(detEl->surface(id));
130 else if ((m_errCount++) < m_maxErrCount)
131 ATH_MSG_WARNING("getSurface: could not get detector element from id:"
132 << id << " Returning 0.");
133 } else {
134 if ((m_errCount++) < m_maxErrCount)
136 "getSurface: could not get cnv tool for Identifier:" << id);
137 }
138 return surface;
139}
virtual const Trk::ITrkEventCnvTool * getCnvTool(const Identifier &id) const override
virtual const Trk::TrkDetElementBase * getDetectorElement(const Identifier &id, const IdentifierHash &idHash) const =0
Returns the detectorElement associated with this Identifier & Hash.

◆ initialize()

StatusCode Trk::EventCnvSuperTool::initialize ( )
overridevirtual

Definition at line 22 of file EventCnvSuperTool.cxx.

22 {
23 // Try to get AtlasID
24 StatusCode sc = detStore()->retrieve(m_detID, "AtlasID");
25 if (sc.isFailure()) {
26 ATH_MSG_WARNING("Could not get AtlasDetectorID ");
27 }
28
29 if (!m_doID && !m_doMuons) {
31 "This tool has been configured without either Muons or ID, and so "
32 "can't do anything. Problems likely.");
33 }
34
35 // Now try to get the tools
36 if (m_doID && !m_idCnvTool.empty()) {
37 if (m_idCnvTool.retrieve().isFailure()) {
39 "Failed to retrieve InDet helper tool "
41 << ". Will not be able to recreate ID Surfaces / Det Elements.");
42 m_doID = false;
43 } else {
44 ATH_MSG_VERBOSE("Retrieved tool " << m_idCnvTool);
45 m_haveIdCnvTool = true;
46 }
47 } else {
48 m_idCnvTool.setTypeAndName("");
49 }
50
51 if (m_doMuons && !m_muonCnvTool.empty()) {
52 if (m_muonCnvTool.retrieve().isFailure()) {
54 "Failed to retrieve Muon helper tool "
56 << ". Will not be able to recreate ID Surfaces / Det Elements.");
57 m_doMuons = false;
58 } else {
59 ATH_MSG_VERBOSE("Retrieved tool " << m_muonCnvTool);
60 m_haveMuonCnvTool = true;
61 }
62 } else {
63 m_muonCnvTool.setTypeAndName("");
64 }
65
66 // Print an extra warning if neither tool found.
69 "Failed to retrieve either and InDet or a Muon tool. Will not be able "
70 "to recreate surfaces / detector elements.");
71 m_maxErrCount = 0; // No point in further WARNINGs
72 }
73
74 return StatusCode::SUCCESS;
75}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_VERBOSE(x,...)
static Double_t sc
ToolHandle< Trk::ITrkEventCnvTool > m_idCnvTool
Tool used to handle ID RoTs etc.
Gaudi::Property< bool > m_doID
Gaudi::Property< bool > m_doMuons
ToolHandle< Trk::ITrkEventCnvTool > m_muonCnvTool
Tool used to handle Muon RoTs etc.
::StatusCode StatusCode
StatusCode definition for legacy code.

◆ maxNumberOfErrors()

virtual int Trk::EventCnvSuperTool::maxNumberOfErrors ( ) const
inlineoverridevirtual

Definition at line 56 of file EventCnvSuperTool.h.

56{ return m_maxErrCount;}

◆ noGeometry()

virtual bool Trk::EventCnvSuperTool::noGeometry ( ) const
inlineoverridevirtual

Definition at line 58 of file EventCnvSuperTool.h.

◆ prepareRIO_OnTrack()

void Trk::EventCnvSuperTool::prepareRIO_OnTrack ( Trk::RIO_OnTrack * RoT) const
overridevirtual

Take the passed RoT and prepare the PRD ElementLink for writing to disc.

Definition at line 156 of file EventCnvSuperTool.cxx.

156 {
157 const Trk::ITrkEventCnvTool* cnvTool = getCnvTool(RoT->identify());
158 if (cnvTool != nullptr) {
159 cnvTool->prepareRIO_OnTrack(RoT);
160 } else {
161 if ((m_errCount++) < m_maxErrCount)
162 msg() << "prepareRIO_OnTrack could not find appropriate tool to prepare: "
163 << *RoT << std::endl;
164 }
165}
virtual void prepareRIO_OnTrack(Trk::RIO_OnTrack *rot) const =0
Take the passed RoT and prepare the PRD ElementLink for writing to disk.
Identifier identify() const
return the identifier -extends MeasurementBase

◆ prepareRIO_OnTrackLink()

void Trk::EventCnvSuperTool::prepareRIO_OnTrackLink ( const RIO_OnTrack * Rot,
ELKey_t & key,
ELIndex_t & index ) const
overridevirtual

Take the passed RoT and return the EL components to write to disc.

Definition at line 167 of file EventCnvSuperTool.cxx.

169 {
170 const Trk::ITrkEventCnvTool* cnvTool = getCnvTool(RoT->identify());
171 if (cnvTool != nullptr) {
172 cnvTool->prepareRIO_OnTrackLink(RoT, key, index);
173 } else {
174 if ((m_errCount++) < m_maxErrCount)
175 msg() << "prepareRIO_OnTrack could not find appropriate tool to prepare: "
176 << *RoT << std::endl;
177 }
178}
virtual void prepareRIO_OnTrackLink(const Trk::RIO_OnTrack *rot, ELKey_t &key, ELIndex_t &index) const =0
Similar, but just return the EL components rather then changing ROT.

◆ recreateRIO_OnTrack()

void Trk::EventCnvSuperTool::recreateRIO_OnTrack ( Trk::RIO_OnTrack * RoT) const
overridevirtual

Take the passed RoT and recreate it (i.e.

fill missing pointers etc)

Definition at line 141 of file EventCnvSuperTool.cxx.

141 {
142 using namespace std;
143 const Trk::ITrkEventCnvTool* cnvTool = getCnvTool(RoT->identify());
144 if (cnvTool != nullptr) {
145 cnvTool->recreateRIO_OnTrack(RoT);
146 } else {
147 const type_info& info = typeid(*RoT);
148 if ((m_errCount++) < m_maxErrCount)
150 "recreateRIO_OnTrack: could not get cnv tool. Returning without "
151 "correctly filling ROT of type: "
152 << info.name());
153 }
154}
virtual void recreateRIO_OnTrack(Trk::RIO_OnTrack *RoT) const =0
Take the passed RoT and recreate it (i.e.

Member Data Documentation

◆ m_detID

const AtlasDetectorID* Trk::EventCnvSuperTool::m_detID = nullptr
private

Definition at line 65 of file EventCnvSuperTool.h.

◆ m_doID

Gaudi::Property<bool> Trk::EventCnvSuperTool::m_doID
private
Initial value:
{this, "DoID", true,
"If true (default), attempt to retrieve Inner Detector helper tool and convert ID objects."}

Definition at line 72 of file EventCnvSuperTool.h.

72 {this, "DoID", true,
73 "If true (default), attempt to retrieve Inner Detector helper tool and convert ID objects."};

◆ m_doMuons

Gaudi::Property<bool> Trk::EventCnvSuperTool::m_doMuons
private
Initial value:
{this, "DoMuons", true,
"If true (default), attempt to retrieve Muon helper tool and convert Muon objects."}

Definition at line 70 of file EventCnvSuperTool.h.

70 {this, "DoMuons", true,
71 "If true (default), attempt to retrieve Muon helper tool and convert Muon objects."};

◆ m_doTrackOverlay

Gaudi::Property<bool> Trk::EventCnvSuperTool::m_doTrackOverlay
private
Initial value:
{this, "DoTrackOverlay", false,
"If true, ID on-track conversion tools will look for background PRD collections"}

Definition at line 75 of file EventCnvSuperTool.h.

75 {this, "DoTrackOverlay", false,
76 "If true, ID on-track conversion tools will look for background PRD collections"};

◆ m_errCount

std::atomic_int Trk::EventCnvSuperTool::m_errCount = 0
mutableprivate

Current number of ERROR/WARNING messages sent to output.

Definition at line 78 of file EventCnvSuperTool.h.

◆ m_haveIdCnvTool

bool Trk::EventCnvSuperTool::m_haveIdCnvTool = false
private

Flag set in intialise, letting us know whether the tool has been found.

Definition at line 67 of file EventCnvSuperTool.h.

◆ m_haveMuonCnvTool

bool Trk::EventCnvSuperTool::m_haveMuonCnvTool = false
private

Flag set in intialise, letting us know whether the tool has been found.

Definition at line 68 of file EventCnvSuperTool.h.

◆ m_idCnvTool

ToolHandle<Trk::ITrkEventCnvTool> Trk::EventCnvSuperTool::m_idCnvTool {this, "IdCnvTool", "InDet::InDetEventCnvTool/InDetEventCnvTool", "Tool used to handle ID RoTs etc"}
private

Tool used to handle ID RoTs etc.

Definition at line 63 of file EventCnvSuperTool.h.

63{this, "IdCnvTool", "InDet::InDetEventCnvTool/InDetEventCnvTool", "Tool used to handle ID RoTs etc"};

◆ m_maxErrCount

Gaudi::Property<int> Trk::EventCnvSuperTool::m_maxErrCount
private
Initial value:
{this, "MaxErrorCount", 10,
"Maximum number of errors that will be reported"}

Definition at line 79 of file EventCnvSuperTool.h.

79 {this, "MaxErrorCount", 10,
80 "Maximum number of errors that will be reported"};

◆ m_muonCnvTool

ToolHandle<Trk::ITrkEventCnvTool> Trk::EventCnvSuperTool::m_muonCnvTool {this, "MuonCnvTool", "Muon::MuonEventCnvTool/MuonEventCnvTool", "Tool used to handle Muon RoTs etc"}
private

Tool used to handle Muon RoTs etc.

Definition at line 64 of file EventCnvSuperTool.h.

64{this, "MuonCnvTool", "Muon::MuonEventCnvTool/MuonEventCnvTool", "Tool used to handle Muon RoTs etc"};

The documentation for this class was generated from the following files: