ATLAS Offline Software
Loading...
Searching...
No Matches
InDet::InDetFixedWindowTrackTimeTool Class Reference

#include <InDetFixedWindowTrackTimeTool.h>

Inheritance diagram for InDet::InDetFixedWindowTrackTimeTool:
Collaboration diagram for InDet::InDetFixedWindowTrackTimeTool:

Public Member Functions

 InDetFixedWindowTrackTimeTool (const std::string &, const std::string &, const IInterface *)
virtual ~InDetFixedWindowTrackTimeTool ()
 default destructor
virtual StatusCode initialize ()
 standard Athena-Algorithm method
virtual StatusCode finalize ()
 standard Athena-Algorithm method
double findPhase (const Trk::Track *track) const
 finds event phase of a track from the leading edge
double findPhase (const Trk::Segment *segment) const
 finds event phase of a segment from the leading edge
double findPhaseFromTE (const Trk::Track *track) const
 finds event phase of a track from the trailing edge
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm.
virtual StatusCode sysStart () override
 Handle START transition.
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles.
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles.
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T, V, H > &t)
void updateVHKA (Gaudi::Details::PropertyBase &)
MsgStream & msg () 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
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.

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t

Private Member Functions

Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

SG::ReadCondHandleKey< TRTCond::AverageT0m_T0ReadKey {this,"T0ReadKey","AverageT0","Average T0 in-key"}
ToolHandle< ITRT_CalDbToolm_caldbtool
 TRT Calibration DB tool.
double m_globalOffset
bool m_useNewEP
double m_windowCenter
double m_windowSize
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default)
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default)
std::vector< SG::VarHandleKeyArray * > m_vhka
bool m_varHandleArraysDeclared

Detailed Description

Author
Brett Jackson brett.nosp@m..dav.nosp@m.id.ja.nosp@m.ckso.nosp@m.n@cer.nosp@m.n.ch

This tool is essentially copy and pasted from the TRTCosmicsEventPhase algorithm.

Definition at line 35 of file InDetFixedWindowTrackTimeTool.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

◆ InDetFixedWindowTrackTimeTool()

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

Definition at line 20 of file InDetFixedWindowTrackTimeTool.cxx.

23 : AthAlgTool(t, n, p)
24 , m_caldbtool("TRT_CalDbTool", this) {
25 declareInterface<IInDetCosmicsEventPhaseTool>(this);
26 declareProperty("TRTCalDbTool", m_caldbtool);
27 declareProperty("GlobalOffset", m_globalOffset = 10.);
28 declareProperty("UseNewEP", m_useNewEP = true);
29 declareProperty("WindowCenter", m_windowCenter = -8.5);
30 declareProperty("WindowSize", m_windowSize = 7.);
31}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ToolHandle< ITRT_CalDbTool > m_caldbtool
TRT Calibration DB tool.

◆ ~InDetFixedWindowTrackTimeTool()

InDet::InDetFixedWindowTrackTimeTool::~InDetFixedWindowTrackTimeTool ( )
virtual

default destructor

Definition at line 35 of file InDetFixedWindowTrackTimeTool.cxx.

36{}

Member Function Documentation

◆ declareGaudiProperty()

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

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

Definition at line 156 of file AthCommonDataStore.h.

158 {
160 hndl.value(),
161 hndl.documentation());
162
163 }

◆ declareProperty()

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

Definition at line 145 of file AthCommonDataStore.h.

145 {
146 typedef typename SG::HandleClassifier<T>::type htype;
148 }
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>

◆ 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.

◆ evtStore()

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.

◆ 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::InDetFixedWindowTrackTimeTool::finalize ( )
virtual

standard Athena-Algorithm method

Definition at line 51 of file InDetFixedWindowTrackTimeTool.cxx.

51 {
52 return StatusCode::SUCCESS;
53}

◆ findPhase() [1/2]

double InDet::InDetFixedWindowTrackTimeTool::findPhase ( const Trk::Segment * segment) const
virtual

finds event phase of a segment from the leading edge

Implements InDet::IInDetCosmicsEventPhaseTool.

Definition at line 120 of file InDetFixedWindowTrackTimeTool.cxx.

120 {
121
122 double sum_tr = 0.;
123 double sum_goodhits = 0.;
124
125 TRTCond::RtRelation const* rtr = nullptr;
126
127 int nhits = segment->numberOfMeasurementBases();
128 for (int i = 0; i < nhits; ++i) {
129 Trk::RIO_OnTrack const* rio = dynamic_cast<Trk::RIO_OnTrack const*>(segment->measurement(i));
130
131 InDet::TRT_DriftCircleOnTrack const* trtcirc = dynamic_cast<InDet::TRT_DriftCircleOnTrack const*>(rio);
132 if (!trtcirc) continue;
133
134 InDet::TRT_DriftCircle const* rawhit = trtcirc->prepRawData();
135 if (!rawhit) continue;
136
137 if (!rawhit->lastBinHigh() && !rawhit->isNoise()) {
138 Identifier const& ident = trtcirc->identify();
139 rtr = m_caldbtool->getRtRelation(ident);
140
141 if (not rtr) {
142 ATH_MSG_WARNING("Rt relation pointer is null!");
143 return 0.;
144 }
145 double full_drifttime = rtr->drifttime(2.0);
146
147 sum_tr += rawhit->trailingEdge() * 3.125 - full_drifttime;
148
149 ATH_MSG_VERBOSE("Hit " << sum_goodhits
150 << " : " << rawhit->trailingEdge() * 3.125
151 << " fulldrifttime=" << full_drifttime);
152
153 sum_goodhits += 1;
154 } else {
155 ATH_MSG_VERBOSE("Hit has lastbin high");
156 }
157 }
158
159
160 if (sum_goodhits > 1) return sum_tr / sum_goodhits + m_globalOffset;
161
162 return 0;
163}
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
bool const RAWDATA *ch2 const
virtual const TRT_DriftCircle * prepRawData() const override final
returns the PrepRawData - is a TRT_DriftCircle in this scope
bool isNoise() const
returns true if the hit is caused by noise with a high probability.
bool lastBinHigh() const
returns true if the last bin is high
int trailingEdge() const
returns the trailing edge bin
Identifier identify() const
return the identifier -extends MeasurementBase
const MeasurementBase * measurement(unsigned int) const
returns the Trk::MeasurementBase objects depending on the integer
unsigned int numberOfMeasurementBases() const
Return the number of contained Trk::MeasurementBase (s)
@ ident
Definition HitInfo.h:77

◆ findPhase() [2/2]

double InDet::InDetFixedWindowTrackTimeTool::findPhase ( const Trk::Track * track) const
virtual

finds event phase of a track from the leading edge

Implements InDet::IInDetCosmicsEventPhaseTool.

Definition at line 58 of file InDetFixedWindowTrackTimeTool.cxx.

58 {
59 ATH_MSG_DEBUG("Finding phase...");
60
61 SG::ReadCondHandle<TRTCond::AverageT0> rhl{m_T0ReadKey};
62 const TRTCond::AverageT0* avgT0{*rhl};
63
64 TRTCond::RtRelation const* rtr = nullptr;
65
66 double timeresidualsum = 0;
67 size_t ntrthits = 0;
68
69 for (const Trk::TrackStateOnSurface* state : *track->trackStateOnSurfaces()) {
70 Trk::MeasurementBase const* mesb = state->measurementOnTrack();
71 if (!mesb
73 ) continue;
74
75 InDet::TRT_DriftCircleOnTrack const* trtcirc = dynamic_cast<InDet::TRT_DriftCircleOnTrack const*>(mesb);
76
77 if (!trtcirc) continue;
78
79 InDet::TRT_DriftCircle const* rawhit = trtcirc->prepRawData();
80 if (!rawhit) continue;
81
82 if (!rawhit->driftTimeValid()
83 || rawhit->firstBinHigh()
84 ) continue;
85
86 Identifier const& ident = trtcirc->identify();
87 double rawdrifttime = rawhit->rawDriftTime();
88
89 double t0 = m_caldbtool->getT0(ident);
90 ATH_MSG_DEBUG("T0 : " << t0);
91 rtr = m_caldbtool->getRtRelation(ident);
92
93 Trk::TrackParameters const* tparp = state->trackParameters();
94 if (!tparp) continue;
95
96 double trkdistance = tparp->parameters()[Trk::driftRadius];
97 double trkdrifttime = rtr->drifttime(std::abs(trkdistance));
98 double timeresidual = rawdrifttime - t0 + avgT0->get() - trkdrifttime;
99
100 ATH_MSG_DEBUG("trkdistance=" << trkdistance
101 << " trkdrifttime=" << trkdrifttime
102 << " timeresidual=" << timeresidual
103 << " rawdrifttime=" << rawdrifttime);
104
105 if (std::abs(timeresidual - m_windowCenter) < m_windowSize
106 && std::abs(trkdistance) < 2.8) {
107 timeresidualsum += timeresidual;
108 ++ntrthits;
109 }
110 }
111
112 ATH_MSG_DEBUG("timeresidualsum = " << timeresidualsum);
113 ATH_MSG_DEBUG("ntrtrhits = " << ntrthits);
114
115 if (ntrthits > 1) return timeresidualsum / ntrthits + m_globalOffset;
116
117 return 0.;
118}
#define ATH_MSG_DEBUG(x)
static Double_t t0
SG::ReadCondHandleKey< TRTCond::AverageT0 > m_T0ReadKey
bool driftTimeValid() const
return true if the corrected drift time is OK
bool firstBinHigh() const
returns true if the first bin is high
double rawDriftTime() const
returns the raw driftTime
double get() const
Definition AverageT0.h:19
virtual float drifttime(float radius) const =0
drifttime for given radius
@ Measurement
This is a measurement, and will at least contain a Trk::MeasurementBase.
@ driftRadius
trt, straws
Definition ParamDefs.h:53
ParametersBase< TrackParametersDim, Charged > TrackParameters

◆ findPhaseFromTE()

double InDet::InDetFixedWindowTrackTimeTool::findPhaseFromTE ( const Trk::Track * track) const
virtual

finds event phase of a track from the trailing edge

Implements InDet::IInDetCosmicsEventPhaseTool.

Definition at line 165 of file InDetFixedWindowTrackTimeTool.cxx.

165 {
166 ATH_MSG_DEBUG("Finding phase...");
167
168 SG::ReadCondHandle<TRTCond::AverageT0> rhl{m_T0ReadKey};
169 const TRTCond::AverageT0* avgT0{*rhl};
170
171 double timeresidualsum = 0;
172 size_t ntrthits = 0;
173
174 for (const Trk::TrackStateOnSurface* state : *track->trackStateOnSurfaces()) {
175 Trk::MeasurementBase const* mesb = state->measurementOnTrack();
176 if (!mesb
178 ) continue;
179
180 InDet::TRT_DriftCircleOnTrack const* trtcirc = dynamic_cast<InDet::TRT_DriftCircleOnTrack const*>(mesb);
181 if (!trtcirc) continue;
182
183 InDet::TRT_DriftCircle const* rawhit = trtcirc->prepRawData();
184 if (!rawhit) continue;
185
186 Identifier const& ident = trtcirc->identify();
187 double rawtrailingedge = rawhit->trailingEdge() * 3.125;
188
189 double t0 = m_caldbtool->getT0(ident);
190
191 ATH_MSG_DEBUG("T0 : " << t0);
192
193 double timeresidual = rawtrailingedge - t0 + avgT0->get();
194
195 ATH_MSG_DEBUG("timeresidual=" << timeresidual);
196
197 if (timeresidual < 2000) {
198 timeresidualsum += timeresidual;
199 ++ntrthits;
200 }
201 }
202
203 if (ntrthits > 1) return timeresidualsum / ntrthits + m_globalOffset;
204
205 return 0.;
206}

◆ initialize()

StatusCode InDet::InDetFixedWindowTrackTimeTool::initialize ( )
virtual

standard Athena-Algorithm method

Definition at line 41 of file InDetFixedWindowTrackTimeTool.cxx.

41 {
42 ATH_CHECK(m_caldbtool.retrieve());
43 // Read key
44 ATH_CHECK( m_T0ReadKey.initialize() );
45
46 return StatusCode::SUCCESS;
47}
#define ATH_CHECK
Evaluate an expression and check for errors.

◆ 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::IInDetCosmicsEventPhaseTool::interfaceID ( )
inlinestaticinherited

Definition at line 37 of file IInDetCosmicsEventPhaseTool.h.

38 {
40 }
static const InterfaceID IID_IInDetCosmicsEventPhaseTool("InDet::IInDetCosmicsEventPhaseTool", 1, 0)

◆ msg()

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ 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();
384 }
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)

◆ 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 {
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 asg::AsgMetadataTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and DerivationFramework::CfAthAlgTool.

◆ 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.

◆ 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) {
313 for (auto k : keys) {
314 k->setOwner(this);
315 }
316 }
317 }
std::vector< SG::VarHandleKeyArray * > m_vhka

Member Data Documentation

◆ m_caldbtool

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

TRT Calibration DB tool.

Definition at line 60 of file InDetFixedWindowTrackTimeTool.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_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_globalOffset

double InDet::InDetFixedWindowTrackTimeTool::m_globalOffset
private

Definition at line 62 of file InDetFixedWindowTrackTimeTool.h.

◆ m_T0ReadKey

SG::ReadCondHandleKey<TRTCond::AverageT0> InDet::InDetFixedWindowTrackTimeTool::m_T0ReadKey {this,"T0ReadKey","AverageT0","Average T0 in-key"}
private

Definition at line 59 of file InDetFixedWindowTrackTimeTool.h.

59{this,"T0ReadKey","AverageT0","Average T0 in-key"};

◆ m_useNewEP

bool InDet::InDetFixedWindowTrackTimeTool::m_useNewEP
private

Definition at line 63 of file InDetFixedWindowTrackTimeTool.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.

◆ m_windowCenter

double InDet::InDetFixedWindowTrackTimeTool::m_windowCenter
private

Definition at line 64 of file InDetFixedWindowTrackTimeTool.h.

◆ m_windowSize

double InDet::InDetFixedWindowTrackTimeTool::m_windowSize
private

Definition at line 65 of file InDetFixedWindowTrackTimeTool.h.


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