ATLAS Offline Software
Public Member Functions | Private Attributes | List of all members
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

 EventCnvSuperTool (const std::string &t, const std::string &n, const IInterface *p)
 
virtual ~EventCnvSuperTool ()
 
virtual StatusCode initialize () override
 
virtual StatusCode finalize () override
 
virtual const Trk::ITrkEventCnvToolgetCnvTool (const Identifier &id) const override
 
virtual const Trk::SurfacegetSurface (const Identifier &id) const override
 From passed Identifier. More...
 
virtual void recreateRIO_OnTrack (RIO_OnTrack *RoT) const override
 Take the passed RoT and recreate it (i.e. More...
 
virtual void prepareRIO_OnTrack (RIO_OnTrack *Rot) const override
 Take the passed RoT and prepare the PRD ElementLink for writing to disc. More...
 
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. More...
 
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::ITrkEventCnvToolm_idCnvTool {this, "IdCnvTool", "InDet::InDetEventCnvTool/InDetEventCnvTool", "Tool used to handle ID RoTs etc"}
 Tool used to handle ID RoTs etc. More...
 
ToolHandle< Trk::ITrkEventCnvToolm_muonCnvTool {this, "MuonCnvTool", "Muon::MuonEventCnvTool/MuonEventCnvTool", "Tool used to handle Muon RoTs etc"}
 Tool used to handle Muon RoTs etc. More...
 
const AtlasDetectorIDm_detID
 
bool m_haveIdCnvTool
 Flag set in intialise, letting us know whether the tool has been found. More...
 
bool m_haveMuonCnvTool
 Flag set in intialise, letting us know whether the tool has been found. More...
 
bool m_doMuons
 Property deciding whether to attempt Muon conversions. More...
 
bool m_doID
 Property deciding whether to attempt ID conversions. More...
 
bool m_doTrackOverlay
 Property for whether track overlay is being used, in which case different PRD containers are used by the converters. More...
 
std::atomic_int m_errCount
 Current number of ERROR/WARNING messages sent to output. More...
 
int m_maxErrCount
 Maximum number of permissable ERROR/WARNING messages sent to output. More...
 

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 ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 16 of file EventCnvSuperTool.cxx.

19  : base_class(t, n, p),
20  m_detID(nullptr),
21  m_haveIdCnvTool(false), // Will be set to true on retrieval
22  m_haveMuonCnvTool(false), // Will be set to true on retrieval
23  m_doMuons(true),
24  m_doID(true),
25  m_doTrackOverlay(false),
26  m_errCount(0),
27  m_maxErrCount(10) {
28  declareProperty("DoMuons", m_doMuons,
29  "If true (default), attempt to retrieve Muon helper tool and "
30  "convert Muon objects.");
31  declareProperty("DoID", m_doID,
32  "If true (default), attempt to retrieve Inner Detector "
33  "helper tool and convert ID objects.");
34  declareProperty("DoTrackOverlay", m_doTrackOverlay,
35  "If true, ID on-track conversion tools will look for "
36  "background PRD collections");
37  declareProperty("MaxErrorCount", m_maxErrCount,
38  "Maximum number of errors that will be reported");
39 }

◆ ~EventCnvSuperTool()

Trk::EventCnvSuperTool::~EventCnvSuperTool ( )
virtual

Definition at line 41 of file EventCnvSuperTool.cxx.

41  {
43  ATH_MSG_WARNING("Suppressed " << (m_errCount - m_maxErrCount)
44  << " WARNING or ERROR messages");
45 }

Member Function Documentation

◆ canHandleInDet()

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

Definition at line 56 of file EventCnvSuperTool.h.

56 { return m_haveIdCnvTool;}

◆ canHandleMuonSpectrometer()

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

Definition at line 57 of file EventCnvSuperTool.h.

57 { return m_haveMuonCnvTool;}

◆ doTrackOverlay()

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

Definition at line 62 of file EventCnvSuperTool.h.

62 {return m_doTrackOverlay;}

◆ finalize()

StatusCode Trk::EventCnvSuperTool::finalize ( )
overridevirtual

Definition at line 102 of file EventCnvSuperTool.cxx.

102  {
103  msg() << "Finalize().";
104  if (m_errCount > 0)
105  msg() << " Tried to print " << m_errCount
106  << " ERROR/WARNING messages (with maximum permissable = "
107  << m_maxErrCount << ")";
108  msg() << endmsg;
109  return StatusCode::SUCCESS;
110 }

◆ getCnvTool()

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

Definition at line 112 of file EventCnvSuperTool.cxx.

113  {
114  if (m_detID == nullptr)
115  return nullptr;
116 
117  if (m_detID->is_indet(id)) {
118  if (m_haveIdCnvTool) {
119  return &(*m_idCnvTool);
120  } else {
121  if ((m_errCount++) < m_maxErrCount)
122  ATH_MSG_WARNING("ID RIO_OnTrack, but have no ID cnv tool!");
123  return nullptr;
124  }
125  } else {
126  if (m_detID->is_muon(id)) {
127  if (m_haveMuonCnvTool) {
128  return &(*m_muonCnvTool);
129  } else {
130  if ((m_errCount++) < m_maxErrCount)
132  "Muon RIO_OnTrack, but have no muon cnv tool. Cannot set check "
133  "RoT.");
134  return nullptr;
135  }
136  }
137  }
138 
139  if ((m_errCount++) < m_maxErrCount) {
140  std::string ident = m_detID->show_to_string(id);
141  ATH_MSG_WARNING("Unknown Identifier: (" << ident << "), that is (" << id
142  << ")");
143  }
144  return nullptr;
145 }

◆ getSurface()

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

From passed Identifier.

Definition at line 147 of file EventCnvSuperTool.cxx.

148  {
149  const Surface* surface = nullptr;
150  const Trk::ITrkEventCnvTool* cnvTool = getCnvTool(id);
151  if (cnvTool != nullptr) {
152  const TrkDetElementBase* detEl = cnvTool->getDetectorElement(id);
153  if (detEl != nullptr)
154  surface = &(detEl->surface(id));
155  else if ((m_errCount++) < m_maxErrCount)
156  ATH_MSG_WARNING("getSurface: could not get detector element from id:"
157  << id << " Returning 0.");
158  } else {
159  if ((m_errCount++) < m_maxErrCount)
161  "getSurface: could not get cnv tool for Identifier:" << id);
162  }
163  return surface;
164 }

◆ initialize()

StatusCode Trk::EventCnvSuperTool::initialize ( )
overridevirtual

Definition at line 47 of file EventCnvSuperTool.cxx.

47  {
48  // Try to get AtlasID
49  StatusCode sc = detStore()->retrieve(m_detID, "AtlasID");
50  if (sc.isFailure()) {
51  ATH_MSG_WARNING("Could not get AtlasDetectorID ");
52  }
53 
54  if (!m_doID && !m_doMuons) {
56  "This tool has been configured without either Muons or ID, and so "
57  "can't do anything. Problems likely.");
58  }
59 
60  // Now try to get the tools
61  if (m_doID && !m_idCnvTool.empty()) {
62  if (m_idCnvTool.retrieve().isFailure()) {
64  "Failed to retrieve InDet helper tool "
65  << m_idCnvTool
66  << ". Will not be able to recreate ID Surfaces / Det Elements.");
67  m_doID = false;
68  } else {
69  ATH_MSG_VERBOSE("Retrieved tool " << m_idCnvTool);
70  m_haveIdCnvTool = true;
71  }
72  } else {
73  m_idCnvTool.setTypeAndName("");
74  }
75 
76  if (m_doMuons && !m_muonCnvTool.empty()) {
77  if (m_muonCnvTool.retrieve().isFailure()) {
79  "Failed to retrieve Muon helper tool "
80  << m_muonCnvTool
81  << ". Will not be able to recreate ID Surfaces / Det Elements.");
82  m_doMuons = false;
83  } else {
84  ATH_MSG_VERBOSE("Retrieved tool " << m_muonCnvTool);
85  m_haveMuonCnvTool = true;
86  }
87  } else {
88  m_muonCnvTool.setTypeAndName("");
89  }
90 
91  // Print an extra warning if neither tool found.
94  "Failed to retrieve either and InDet or a Muon tool. Will not be able "
95  "to recreate surfaces / detector elements.");
96  m_maxErrCount = 0; // No point in further WARNINGs
97  }
98 
99  return StatusCode::SUCCESS;
100 }

◆ maxNumberOfErrors()

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

Definition at line 58 of file EventCnvSuperTool.h.

58 { return m_maxErrCount;}

◆ noGeometry()

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

Definition at line 60 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 181 of file EventCnvSuperTool.cxx.

181  {
182  const Trk::ITrkEventCnvTool* cnvTool = getCnvTool(RoT->identify());
183  if (cnvTool != nullptr) {
184  cnvTool->prepareRIO_OnTrack(RoT);
185  } else {
186  if ((m_errCount++) < m_maxErrCount)
187  msg() << "prepareRIO_OnTrack could not find appropriate tool to prepare: "
188  << *RoT << std::endl;
189  }
190 }

◆ 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 192 of file EventCnvSuperTool.cxx.

194  {
195  const Trk::ITrkEventCnvTool* cnvTool = getCnvTool(RoT->identify());
196  if (cnvTool != nullptr) {
197  cnvTool->prepareRIO_OnTrackLink(RoT, key, index);
198  } else {
199  if ((m_errCount++) < m_maxErrCount)
200  msg() << "prepareRIO_OnTrack could not find appropriate tool to prepare: "
201  << *RoT << std::endl;
202  }
203 }

◆ 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 166 of file EventCnvSuperTool.cxx.

166  {
167  using namespace std;
168  const Trk::ITrkEventCnvTool* cnvTool = getCnvTool(RoT->identify());
169  if (cnvTool != nullptr) {
170  cnvTool->recreateRIO_OnTrack(RoT);
171  } else {
172  const type_info& info = typeid(*RoT);
173  if ((m_errCount++) < m_maxErrCount)
175  "recreateRIO_OnTrack: could not get cnv tool. Returning without "
176  "correctly filling ROT of type: "
177  << info.name());
178  }
179 }

Member Data Documentation

◆ m_detID

const AtlasDetectorID* Trk::EventCnvSuperTool::m_detID
private

Definition at line 67 of file EventCnvSuperTool.h.

◆ m_doID

bool Trk::EventCnvSuperTool::m_doID
private

Property deciding whether to attempt ID conversions.

Definition at line 73 of file EventCnvSuperTool.h.

◆ m_doMuons

bool Trk::EventCnvSuperTool::m_doMuons
private

Property deciding whether to attempt Muon conversions.

Definition at line 72 of file EventCnvSuperTool.h.

◆ m_doTrackOverlay

bool Trk::EventCnvSuperTool::m_doTrackOverlay
private

Property for whether track overlay is being used, in which case different PRD containers are used by the converters.

Definition at line 75 of file EventCnvSuperTool.h.

◆ m_errCount

std::atomic_int Trk::EventCnvSuperTool::m_errCount
mutableprivate

Current number of ERROR/WARNING messages sent to output.

Definition at line 77 of file EventCnvSuperTool.h.

◆ m_haveIdCnvTool

bool Trk::EventCnvSuperTool::m_haveIdCnvTool
private

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

Definition at line 69 of file EventCnvSuperTool.h.

◆ m_haveMuonCnvTool

bool Trk::EventCnvSuperTool::m_haveMuonCnvTool
private

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

Definition at line 70 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 65 of file EventCnvSuperTool.h.

◆ m_maxErrCount

int Trk::EventCnvSuperTool::m_maxErrCount
private

Maximum number of permissable ERROR/WARNING messages sent to output.

Definition at line 78 of file EventCnvSuperTool.h.

◆ 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 66 of file EventCnvSuperTool.h.


The documentation for this class was generated from the following files:
grepfile.info
info
Definition: grepfile.py:38
index
Definition: index.py:1
Trk::EventCnvSuperTool::m_doMuons
bool m_doMuons
Property deciding whether to attempt Muon conversions.
Definition: EventCnvSuperTool.h:72
Trk::EventCnvSuperTool::getCnvTool
virtual const Trk::ITrkEventCnvTool * getCnvTool(const Identifier &id) const override
Definition: EventCnvSuperTool.cxx:112
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
Trk::EventCnvSuperTool::m_errCount
std::atomic_int m_errCount
Current number of ERROR/WARNING messages sent to output.
Definition: EventCnvSuperTool.h:77
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
Trk::EventCnvSuperTool::m_haveIdCnvTool
bool m_haveIdCnvTool
Flag set in intialise, letting us know whether the tool has been found.
Definition: EventCnvSuperTool.h:69
Trk::EventCnvSuperTool::m_muonCnvTool
ToolHandle< Trk::ITrkEventCnvTool > m_muonCnvTool
Tool used to handle Muon RoTs etc.
Definition: EventCnvSuperTool.h:66
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
Trk::ITrkEventCnvTool::prepareRIO_OnTrack
virtual void prepareRIO_OnTrack(Trk::RIO_OnTrack *rot) const =0
Take the passed RoT and prepare the PRD ElementLink for writing to disk.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::ITrkEventCnvTool
Definition: ITrkEventCnvTool.h:31
Trk::EventCnvSuperTool::m_detID
const AtlasDetectorID * m_detID
Definition: EventCnvSuperTool.h:67
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
Trk::EventCnvSuperTool::m_idCnvTool
ToolHandle< Trk::ITrkEventCnvTool > m_idCnvTool
Tool used to handle ID RoTs etc.
Definition: EventCnvSuperTool.h:65
AtlasDetectorID::is_indet
bool is_indet(Identifier id) const
Definition: AtlasDetectorID.h:683
TRT::Hit::ident
@ ident
Definition: HitInfo.h:77
Trk::ITrkEventCnvTool::recreateRIO_OnTrack
virtual void recreateRIO_OnTrack(Trk::RIO_OnTrack *RoT) const =0
Take the passed RoT and recreate it (i.e.
Trk::EventCnvSuperTool::m_haveMuonCnvTool
bool m_haveMuonCnvTool
Flag set in intialise, letting us know whether the tool has been found.
Definition: EventCnvSuperTool.h:70
AtlasDetectorID::is_muon
bool is_muon(Identifier id) const
Definition: AtlasDetectorID.h:701
AtlasDetectorID::show_to_string
std::string show_to_string(Identifier id, const IdContext *context=0, char sep='.') const
or provide the printout in string form
Definition: AtlasDetectorID.cxx:574
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
Trk::ITrkEventCnvTool::getDetectorElement
virtual const Trk::TrkDetElementBase * getDetectorElement(const Identifier &id, const IdentifierHash &idHash) const =0
Returns the detectorElement associated with this Identifier & Hash.
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
Trk::EventCnvSuperTool::m_doID
bool m_doID
Property deciding whether to attempt ID conversions.
Definition: EventCnvSuperTool.h:73
Trk::ITrkEventCnvTool::prepareRIO_OnTrackLink
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.
Trk::EventCnvSuperTool::m_doTrackOverlay
bool m_doTrackOverlay
Property for whether track overlay is being used, in which case different PRD containers are used by ...
Definition: EventCnvSuperTool.h:75
python.AutoConfigFlags.msg
msg
Definition: AutoConfigFlags.py:7
Trk::EventCnvSuperTool::m_maxErrCount
int m_maxErrCount
Maximum number of permissable ERROR/WARNING messages sent to output.
Definition: EventCnvSuperTool.h:78
mapkey::key
key
Definition: TElectronEfficiencyCorrectionTool.cxx:37