ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
InDet::TRT_TrackTimingTool Class Reference

#include <TRT_TrackTimingTool.h>

Inheritance diagram for InDet::TRT_TrackTimingTool:
Collaboration diagram for InDet::TRT_TrackTimingTool:

Public Member Functions

 TRT_TrackTimingTool (const std::string &, const std::string &, const IInterface *)
 
virtual ~TRT_TrackTimingTool ()
 default destructor More...
 
virtual StatusCode initialize ()
 standard Athena-Algorithm method More...
 
virtual StatusCode finalize ()
 standard Athena-Algorithm method More...
 
virtual std::vector< Trk::SpaceTimePoint * > timeMeasurements (const Trk::Track &trk, const Trk::SegmentCollection *sgmColl=0) const
 returns time measurements for a given track. More...
 
virtual std::vector< Trk::SpaceTimePoint * > timeMeasurements (const Trk::TrackParticleBase &trk) const
 returns time measurements for a given track particle (base). More...
 
virtual std::vector< Trk::SpaceTimePoint * > timeMeasurements (std::vector< const Trk::Segment * > segments) const
 return time measurements for a vector of segments - mainly aimed at MS and tagged segments. More...
 
float getTrackTimeFromDriftRadius (const Trk::Track *track, int &nHits) const
 calculate the time from drift radius - when RDO hits are not available - for running on AODs More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce (T &h)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

float etaCorrection (const Trk::Track &track) const
 eta-dependent corrections, called if m_doEtaCorrection == true More...
 
void trackInformation (const Trk::Track &track, Amg::Vector3D &position, int &nTRTdriftCircles, int &nMissingRDOs, int &nMissingTrackParameters, int &nUsedHits) const
 get basic track info to know which function needs to be called, and calculate the position More...
 
void debugMissingMeasurements (const Trk::Track &trk) const
 private debugging function for commissioning phase More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Private Attributes

ToolHandle< Trk::ITrackFitterm_ITrackFitter
 tools - this is the tool that actually does the work More...
 
ToolHandle< InDet::IInDetCosmicsEventPhaseToolm_eventPhaseTool
 
ToolHandle< ITRT_CalDbToolm_caldbtool
 TRT Calibration DB tool. More...
 
bool m_doEtaCorrection
 
bool m_debug
 
SG::ReadHandleKey< xAOD::EventInfom_EventInfoKey
 Current event. More...
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Definition at line 49 of file TRT_TrackTimingTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ TRT_TrackTimingTool()

InDet::TRT_TrackTimingTool::TRT_TrackTimingTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 22 of file TRT_TrackTimingTool.cxx.

24  :
25  AthAlgTool(t, n, p), m_ITrackFitter("Trk::GlobalChi2Fitter/InDetTrackFitter"), m_eventPhaseTool(), m_caldbtool(
26  "TRT_CalDbTool", this), m_doEtaCorrection(true), m_debug(false) {
27  declareInterface<ITRT_TrackTimingTool>(this);
28  declareInterface<Trk::ITrackTimingTool>(this);
29 
30  // retrieve properties from job options
31  declareProperty("FitterTool", m_ITrackFitter);
32  declareProperty("EventPhaseTool", m_eventPhaseTool);
33  declareProperty("TRTCalDbTool", m_caldbtool);
34  declareProperty("DoEtaCorrection", m_doEtaCorrection);
35  declareProperty("DebugMissingMeasurement", m_debug);
36  declareProperty("EventInfoKey", m_EventInfoKey = "ByteStreamEventInfo");
37 }

◆ ~TRT_TrackTimingTool()

InDet::TRT_TrackTimingTool::~TRT_TrackTimingTool ( )
virtual

default destructor

Definition at line 41 of file TRT_TrackTimingTool.cxx.

41 {}

Member Function Documentation

◆ debugMissingMeasurements()

void InDet::TRT_TrackTimingTool::debugMissingMeasurements ( const Trk::Track trk) const
private

private debugging function for commissioning phase

Definition at line 276 of file TRT_TrackTimingTool.cxx.

276  {
277  int checkNTRThits(0), missingMeasurement(0), noTRT_DriftCircle(0), missingPrepRawData(0), invalidHits(0),
278  missingTrackPar(0);
279 
280  for (Trk::TrackStateOnSurface const* state : *track.trackStateOnSurfaces()) {
281  Trk::MeasurementBase const* mesb = state->measurementOnTrack();
282  if (!mesb || !state->type(Trk::TrackStateOnSurface::Measurement)) {
283  missingMeasurement++;
284  continue;
285  }
286 
287  InDet::TRT_DriftCircleOnTrack const* trtcirc = dynamic_cast<InDet::TRT_DriftCircleOnTrack const*>(mesb);
288  if (!trtcirc) {
289  noTRT_DriftCircle++;
290  continue;
291  }
292 
293  InDet::TRT_DriftCircle const* rawhit = trtcirc->prepRawData();
294  if (!rawhit) {
295  missingPrepRawData++;
296  continue;
297  }
298  if (!rawhit->driftTimeValid() || rawhit->firstBinHigh()) {
299  invalidHits++;
300  continue;
301  }
302  Trk::TrackParameters const* tparp = state->trackParameters();
303  if (!tparp) {
304  missingTrackPar++;
305  continue;
306  }
307 
308  checkNTRThits++;
309 
310  ATH_MSG_INFO(
311  "debugMissingMeasurements: TRT hit " << checkNTRThits << ", raw drift time: " << rawhit->rawDriftTime() << " ns, track R: " <<
312  tparp->parameters()[Trk::driftRadius] << " mm.");
313  }
314 
315  ATH_MSG_INFO("debugMissingMeasurements: N valid hits: " << checkNTRThits << ", missing MeasurementBase / Measurement: " << missingMeasurement
316  << ", missing TRT_DriftCircleOnTrack: " << noTRT_DriftCircle << ", missingPrepRawData: " << missingPrepRawData
317  << ", invalid LE or TE: " << invalidHits << ", missing track parameters: " <<
318  missingTrackPar);
319 
320  return;
321 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ etaCorrection()

float InDet::TRT_TrackTimingTool::etaCorrection ( const Trk::Track track) const
private

eta-dependent corrections, called if m_doEtaCorrection == true

Definition at line 217 of file TRT_TrackTimingTool.cxx.

217  {
218  const float correctionLargeEta = -0.31; // ns
219 
220  const Trk::Perigee* trackPar = track.perigeeParameters();
221 
222  if (!trackPar) {
223  ATH_MSG_WARNING("missing perigee parameters, can not make eta correction");
224  return 0.;
225  }
226 
227  double eta = trackPar->eta();
228  float correction = (1.3 * eta * eta - 1.9) * eta * eta;
229  if (std::abs(eta) > 1. && correction > correctionLargeEta) correction = correctionLargeEta;
230 
231  ATH_MSG_DEBUG("eta correction: " << correction << " ns at eta = " << eta);
232 
233  return correction;
234 }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode InDet::TRT_TrackTimingTool::finalize ( )
virtual

standard Athena-Algorithm method

Definition at line 67 of file TRT_TrackTimingTool.cxx.

67  {
69 
70  return sc;
71 }

◆ getTrackTimeFromDriftRadius()

float InDet::TRT_TrackTimingTool::getTrackTimeFromDriftRadius ( const Trk::Track track,
int &  nHits 
) const

calculate the time from drift radius - when RDO hits are not available - for running on AODs

Definition at line 175 of file TRT_TrackTimingTool.cxx.

175  {
176  float time = 0.;
177 
178  nHits = 0;
179 
180  for (const Trk::TrackStateOnSurface* state : *track->trackStateOnSurfaces()) {
181  Trk::MeasurementBase const* mesb = state->measurementOnTrack();
182  if (!mesb || !state->type(Trk::TrackStateOnSurface::Measurement)) continue;
183 
184  InDet::TRT_DriftCircleOnTrack const* trtcirc = dynamic_cast<InDet::TRT_DriftCircleOnTrack const*>(mesb);
185  if (!trtcirc) continue;
186 
187  Trk::TrackParameters const* tparp = state->trackParameters();
188  if (!tparp) continue;
189 
190  float driftR = trtcirc->localParameters()[Trk::driftRadius];
191  if (std::abs(driftR) < 0.000001) continue; // driftR == 0 => measurement not available, could be anything
192  if (std::abs(driftR) > 2.) continue;
193 
194  float trackR = tparp->parameters()[Trk::driftRadius];
195 
196  Identifier id = trtcirc->identify();
197  const TRTCond::RtRelation* rtRelation = m_caldbtool->getRtRelation(id);
198  if (not rtRelation) {
199  ATH_MSG_WARNING("Rt relation pointer is null!");
200  continue;
201  }
202  float driftT = rtRelation->drifttime(std::abs(driftR));
203  float trackT = rtRelation->drifttime(std::abs(trackR));
204 
205 
206  time += driftT - trackT;
207  nHits++;
208  }
209 
210  if (nHits > 0) time /= (float) nHits;
211 
212  return time;
213 }

◆ initialize()

StatusCode InDet::TRT_TrackTimingTool::initialize ( )
virtual

standard Athena-Algorithm method

Definition at line 46 of file TRT_TrackTimingTool.cxx.

46  {
48 
49  if (sc.isFailure()) return sc;
50 
51  // retrieve fitter
52  if (m_ITrackFitter.retrieve().isFailure()) {
53  msg(MSG::FATAL) << "Failed to retrieve tool " << m_ITrackFitter << endmsg;
54  return StatusCode::FAILURE;
55  } else msg(MSG::INFO) << "Retrieved tool " << m_ITrackFitter << endmsg;
56 
58 
59 
60  ATH_MSG_INFO("InDet::TRT_TrackTimingTool::initialize() successful in " << name() << ", do eta correction: " <<
61  (m_doEtaCorrection ? "true" : "false"));
62  return StatusCode::SUCCESS;
63 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

const InterfaceID & InDet::ITRT_TrackTimingTool::interfaceID ( )
inlinestaticinherited

Definition at line 35 of file ITRT_TrackTimingTool.h.

35  {
36  return IID_ITRT_TrackTimingTool;
37  }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ timeMeasurements() [1/3]

std::vector< Trk::SpaceTimePoint * > InDet::TRT_TrackTimingTool::timeMeasurements ( const Trk::Track track,
const Trk::SegmentCollection segments = 0 
) const
virtual

returns time measurements for a given track.

Implementations in the Calo, ID and Muon spectrometer in dedicated tools

Parameters
trackinput track
Returns
vector of time measurement pointers

Implements Trk::ITrackTimingTool.

Definition at line 73 of file TRT_TrackTimingTool.cxx.

75  {
76  if (sgmColl != nullptr) {
77  ATH_MSG_INFO("TRT_TrackTimingTool::timeMeasurements called with SegmentCollection != 0");
78  }
79 
80  std::vector<Trk::SpaceTimePoint*> timeMeasurementsVector;
81  // need to use constructor: SpaceTimePoint(const GlobalPosition& position, const float& t, const float& t_error, const
82  // float& weight);
83 
84  // Useless test; compiler can assume it's false and optimize it away.
85  // Tests for null must be done on pointers, not references
86  // (which by definition cannot be null).
87  //if (&track==0) return timeMeasurementsVector; // this function should not have been called in the first place
88 
89  float time = 0.;
90  Amg::Vector3D position(0., 0., 0.);
91 
92  // info about track
93  int nTRTdriftCircles(0), nMissingRDOs(0), nMissingTrackParameters(0), nUsedHits(0);
94  trackInformation(track, position, nTRTdriftCircles, nMissingRDOs, nMissingTrackParameters, nUsedHits);
95 
97  "trackInformation: " << nTRTdriftCircles << ", " << nMissingRDOs << ", " << nMissingTrackParameters << " slimmed? " <<
98  (track.info().trackProperties(Trk::TrackInfo::SlimmedTrack)));
99 
100  if (!nTRTdriftCircles) return timeMeasurementsVector; // no TRT hits for this track, can not do anything
101 
102  Trk::Track* newtrack = nullptr;
103  if (nMissingTrackParameters) { // need to re-fit the track to get the track parameters
104  newtrack = (m_ITrackFitter->fit(Gaudi::Hive::currentContext(),track,
105  false, track.info().particleHypothesis())).release();
106 
107  if (newtrack == nullptr) {
108  ATH_MSG_INFO("fit to unslim track has failed, giving up.");
109  return timeMeasurementsVector;
110  }
111  }
112 
113  const Trk::Track* track_ptr = (newtrack != nullptr) ? newtrack : &track;
114 
115  // there are TRT hits, and track parameters, use the tool to calculate the time
116  ATH_MSG_DEBUG("timeMeasurements(): diagnosed that track has all information already.");
117 
118  if (!nMissingRDOs) {
119  time = m_eventPhaseTool->findPhase(track_ptr);
120  } else {
121  time = getTrackTimeFromDriftRadius(track_ptr, nUsedHits);
122  }
123 
124 
125  if (m_doEtaCorrection && time != 0.) time -= etaCorrection(*track_ptr);
126 
127 
128 
129 // assign estimated constant conservative error for now
130  float error = 1.; // units ns
131 
132 // use default weight of 1.; 0. if the time measurement is invalid
133  float weight = (time == 0.) ? 0. : 0.02 * nUsedHits;
134 
135  ATH_MSG_DEBUG("TRT_TrackTimingTool::timeMeasurements: TRT track with " << nTRTdriftCircles << " hits, track time = "
136  << time << " ns, position: " << position << ", error: " << error << ", weight: " << weight <<
137  ".");
138 
139  if (time != 0.) { // add measurement only if valid
140  Trk::SpaceTimePoint* timeMeasurement = new Trk::SpaceTimePoint(position, time, error, weight, Trk::TrackState::TRT);
141 
142  timeMeasurementsVector.push_back(timeMeasurement);
143  } else {
144  ATH_MSG_INFO("TRT_TrackTimingTool::timeMeasurement not available");
146  }
147 
148 
149  if (newtrack) delete newtrack;
150 
151  return timeMeasurementsVector;
152 }

◆ timeMeasurements() [2/3]

std::vector< Trk::SpaceTimePoint * > InDet::TRT_TrackTimingTool::timeMeasurements ( const Trk::TrackParticleBase trackParticle) const
virtual

returns time measurements for a given track particle (base).

Implementations in the Calo, ID and Muon spectrometer in dedicated tools

Parameters
trackParticleinput track particle base
Returns
vector of time measurement pointers

Implements Trk::ITrackTimingTool.

Definition at line 157 of file TRT_TrackTimingTool.cxx.

158 {
159  if (tpb.originalTrack() == nullptr) {
160  std::vector<Trk::SpaceTimePoint*> v;
161  return v;
162  }
163  return timeMeasurements(*tpb.originalTrack());
164 }

◆ timeMeasurements() [3/3]

std::vector< Trk::SpaceTimePoint * > InDet::TRT_TrackTimingTool::timeMeasurements ( std::vector< const Trk::Segment * >  segments) const
virtual

return time measurements for a vector of segments - mainly aimed at MS and tagged segments.

Not all detectors will implement this interface !

Parameters
segmentsinput vector of segments
Returns
vector of time measurment pointers

Implements Trk::ITrackTimingTool.

Definition at line 167 of file TRT_TrackTimingTool.cxx.

168  {
169  std::vector<Trk::SpaceTimePoint*> v;
170  return v;
171 }

◆ trackInformation()

void InDet::TRT_TrackTimingTool::trackInformation ( const Trk::Track track,
Amg::Vector3D position,
int &  nTRTdriftCircles,
int &  nMissingRDOs,
int &  nMissingTrackParameters,
int &  nUsedHits 
) const
private

get basic track info to know which function needs to be called, and calculate the position

Definition at line 238 of file TRT_TrackTimingTool.cxx.

240  {
241  // define position as center-of-gravity for all TRT hits on track
242  Amg::Vector3D GlobalPositionSum(0., 0., 0.);
243 
244  for (const Trk::TrackStateOnSurface* state : *track.trackStateOnSurfaces()) {
245  Trk::MeasurementBase const* mesb = state->measurementOnTrack();
246  if (!mesb || !state->type(Trk::TrackStateOnSurface::Measurement)) continue;
247 
248  InDet::TRT_DriftCircleOnTrack const* trtcirc = dynamic_cast<InDet::TRT_DriftCircleOnTrack const*>(mesb);
249  if (!trtcirc) continue;
250 
251  nTRTdriftCircles++;
252 
253  GlobalPositionSum += trtcirc->globalPosition();
254 
255  if (!state->trackParameters()) nMissingTrackParameters++;
256 
257  InDet::TRT_DriftCircle const* rawhit = trtcirc->prepRawData();
258  if (!rawhit) {
259  nMissingRDOs++;
260  continue;
261  }
262  if (!rawhit->driftTimeValid() || rawhit->firstBinHigh()) continue;
263  nUsedHits++; // this is the N of hits that will potentially be used for the track time calculation
264 
265 // if ( !(state->trackParameters()) ) continue;
266  }
267 
268  if (nTRTdriftCircles) GlobalPositionSum /= (double) nTRTdriftCircles;
269  position = GlobalPositionSum;
270 
271  return;
272 }

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_caldbtool

ToolHandle<ITRT_CalDbTool> InDet::TRT_TrackTimingTool::m_caldbtool
private

TRT Calibration DB tool.

Definition at line 75 of file TRT_TrackTimingTool.h.

◆ m_debug

bool InDet::TRT_TrackTimingTool::m_debug
private

Definition at line 78 of file TRT_TrackTimingTool.h.

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doEtaCorrection

bool InDet::TRT_TrackTimingTool::m_doEtaCorrection
private

Definition at line 77 of file TRT_TrackTimingTool.h.

◆ m_EventInfoKey

SG::ReadHandleKey<xAOD::EventInfo> InDet::TRT_TrackTimingTool::m_EventInfoKey
private

Current event.

Definition at line 79 of file TRT_TrackTimingTool.h.

◆ m_eventPhaseTool

ToolHandle<InDet::IInDetCosmicsEventPhaseTool> InDet::TRT_TrackTimingTool::m_eventPhaseTool
private

Definition at line 73 of file TRT_TrackTimingTool.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_ITrackFitter

ToolHandle<Trk::ITrackFitter> InDet::TRT_TrackTimingTool::m_ITrackFitter
private

tools - this is the tool that actually does the work

Definition at line 72 of file TRT_TrackTimingTool.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
Trk::SpaceTimePoint
SpaceTimePoint.
Definition: SpaceTimePoint.h:26
python.tests.PyTestsLib.finalize
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Definition: PyTestsLib.py:50
InDet::TRT_DriftCircleOnTrack::prepRawData
virtual const TRT_DriftCircle * prepRawData() const override final
returns the PrepRawData - is a TRT_DriftCircle in this scope
Definition: TRT_DriftCircleOnTrack.h:202
InDet::TRT_TrackTimingTool::m_doEtaCorrection
bool m_doEtaCorrection
Definition: TRT_TrackTimingTool.h:77
Trk::TrackState::TRT
@ TRT
Definition: TrackStateDefs.h:30
InDet::TRT_TrackTimingTool::m_eventPhaseTool
ToolHandle< InDet::IInDetCosmicsEventPhaseTool > m_eventPhaseTool
Definition: TRT_TrackTimingTool.h:73
python.Constants.FATAL
int FATAL
Definition: Control/AthenaCommon/python/Constants.py:19
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Trk::Track
The ATLAS Track class.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/Track.h:73
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
InDet::TRT_TrackTimingTool::trackInformation
void trackInformation(const Trk::Track &track, Amg::Vector3D &position, int &nTRTdriftCircles, int &nMissingRDOs, int &nMissingTrackParameters, int &nUsedHits) const
get basic track info to know which function needs to be called, and calculate the position
Definition: TRT_TrackTimingTool.cxx:238
Trk::ParametersT
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
Definition: EMErrorDetail.h:25
initialize
void initialize()
Definition: run_EoverP.cxx:894
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
const
bool const RAWDATA *ch2 const
Definition: LArRodBlockPhysicsV0.cxx:560
InDet::TRT_DriftCircleOnTrack
Definition: TRT_DriftCircleOnTrack.h:53
InDet::TRT_DriftCircle
Definition: TRT_DriftCircle.h:32
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
dqt_zlumi_pandas.weight
int weight
Definition: dqt_zlumi_pandas.py:189
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:27
InDet::TRT_TrackTimingTool::m_caldbtool
ToolHandle< ITRT_CalDbTool > m_caldbtool
TRT Calibration DB tool.
Definition: TRT_TrackTimingTool.h:75
tools.zlumi_mc_cf.correction
def correction(mu, runmode, campaign, run=None)
Definition: zlumi_mc_cf.py:4
Trk::TrackInfo::SlimmedTrack
@ SlimmedTrack
A slimmed track.
Definition: Tracking/TrkEvent/TrkTrack/TrkTrack/TrackInfo.h:87
TRTCond::RtRelation
Definition: RtRelation.h:27
InDet::TRT_TrackTimingTool::debugMissingMeasurements
void debugMissingMeasurements(const Trk::Track &trk) const
private debugging function for commissioning phase
Definition: TRT_TrackTimingTool.cxx:276
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
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
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Trk::driftRadius
@ driftRadius
trt, straws
Definition: ParamDefs.h:53
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
Trk::ParametersBase
Definition: ParametersBase.h:55
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
InDet::TRT_TrackTimingTool::timeMeasurements
virtual std::vector< Trk::SpaceTimePoint * > timeMeasurements(const Trk::Track &trk, const Trk::SegmentCollection *sgmColl=0) const
returns time measurements for a given track.
Definition: TRT_TrackTimingTool.cxx:73
InDet::TRT_TrackTimingTool::m_ITrackFitter
ToolHandle< Trk::ITrackFitter > m_ITrackFitter
tools - this is the tool that actually does the work
Definition: TRT_TrackTimingTool.h:72
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
Trk::MeasurementBase
Definition: MeasurementBase.h:58
InDet::TRT_TrackTimingTool::m_EventInfoKey
SG::ReadHandleKey< xAOD::EventInfo > m_EventInfoKey
Current event.
Definition: TRT_TrackTimingTool.h:79
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
Trk::TrackStateOnSurface
represents the track state (measurement, material, fit parameters and quality) at a surface.
Definition: TrackStateOnSurface.h:71
python.EventInfoMgtInit.release
release
Definition: EventInfoMgtInit.py:24
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
InDet::TRT_TrackTimingTool::etaCorrection
float etaCorrection(const Trk::Track &track) const
eta-dependent corrections, called if m_doEtaCorrection == true
Definition: TRT_TrackTimingTool.cxx:217
Trk::MeasurementBase::localParameters
const LocalParameters & localParameters() const
Interface method to get the LocalParameters.
Definition: MeasurementBase.h:132
InDet::TRT_TrackTimingTool::getTrackTimeFromDriftRadius
float getTrackTimeFromDriftRadius(const Trk::Track *track, int &nHits) const
calculate the time from drift radius - when RDO hits are not available - for running on AODs
Definition: TRT_TrackTimingTool.cxx:175
python.PyAthena.v
v
Definition: PyAthena.py:154
a
TList * a
Definition: liststreamerinfos.cxx:10
h
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
InDet::TRT_TrackTimingTool::m_debug
bool m_debug
Definition: TRT_TrackTimingTool.h:78
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
InDet::TRT_DriftCircle::driftTimeValid
bool driftTimeValid() const
return true if the corrected drift time is OK
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
InDet::TRT_DriftCircle::rawDriftTime
double rawDriftTime() const
returns the raw driftTime
InDet::TRT_DriftCircleOnTrack::globalPosition
virtual const Amg::Vector3D & globalPosition() const override final
return the global position of this RIO_OnTrack
Definition: TRT_DriftCircleOnTrack.cxx:160
error
Definition: IImpactPoint3dEstimator.h:70
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
InDet::TRT_DriftCircle::firstBinHigh
bool firstBinHigh() const
returns true if the first bin is high
readCCLHist.float
float
Definition: readCCLHist.py:83
Trk::TrackStateOnSurface::Measurement
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
Definition: TrackStateOnSurface.h:101
fitman.k
k
Definition: fitman.py:528
Identifier
Definition: IdentifierFieldParser.cxx:14