ATLAS Offline Software
Loading...
Searching...
No Matches
PESA::T2TrackBeamSpotTool Class Reference

#include <T2TrackBeamSpotTool.h>

Inheritance diagram for PESA::T2TrackBeamSpotTool:
Collaboration diagram for PESA::T2TrackBeamSpotTool:

Public Types

using TrackData = T2BSTrackFilterTool::TrackData

Public Member Functions

 T2TrackBeamSpotTool (const std::string &type, const std::string &name, const IInterface *parent)
 ~T2TrackBeamSpotTool ()=default
StatusCode initialize () final
void updateBS (const TrackCollection &tracks, EventIDBase const &eventID) const
 Update beam spot data with new track information.
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

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

void updateBS (std::vector< const Trk::Track * > &&tracks, unsigned bcid) const
 Update beam spot data with new track information.
void updateBS (std::vector< TrackData > &&tracks) const
 Update beam spot data with new track information.
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T, V, H > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey>

Private Attributes

bool m_doLeastSquares
bool m_doLogLikelihood
double m_beamSizeLS
ToolHandle< T2BSTrackFilterToolm_trackFilterTool {this, "TrackFilter", "PESA::T2BSTrackFilterTool/T2BSTrackFilterTool" }
ToolHandle< GenericMonitoringToolm_monTool {this, "MonTool", "", "Monitoring tool"}
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

Definition at line 27 of file T2TrackBeamSpotTool.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ TrackData

Constructor & Destructor Documentation

◆ T2TrackBeamSpotTool()

T2TrackBeamSpotTool::T2TrackBeamSpotTool ( const std::string & type,
const std::string & name,
const IInterface * parent )

Definition at line 113 of file T2TrackBeamSpotTool.cxx.

114 : AthAlgTool(type, name, parent)
115{
116 declareProperty("doLeastSquares", m_doLeastSquares = true);
117 declareProperty("doLogLikelihood", m_doLogLikelihood = true);
118 declareProperty("beamSizeLS", m_beamSizeLS = 0.01*mm);
119}
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ ~T2TrackBeamSpotTool()

PESA::T2TrackBeamSpotTool::~T2TrackBeamSpotTool ( )
default

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

◆ initialize()

StatusCode T2TrackBeamSpotTool::initialize ( )
final

Definition at line 121 of file T2TrackBeamSpotTool.cxx.

122{
123 ATH_MSG_INFO("Initialising T2TrackBeamSpotTool tool");
124
125 // Retrieve tools
126 ATH_CHECK(m_trackFilterTool.retrieve());
127 if (!m_monTool.empty()) ATH_CHECK(m_monTool.retrieve());
128
129 return StatusCode::SUCCESS;
130}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_INFO(x)
ToolHandle< T2BSTrackFilterTool > m_trackFilterTool
ToolHandle< GenericMonitoringTool > m_monTool

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

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

◆ updateBS() [1/3]

void T2TrackBeamSpotTool::updateBS ( const TrackCollection & tracks,
EventIDBase const & eventID ) const

Update beam spot data with new track information.

Parameter provides a lists of tracks.

Definition at line 132 of file T2TrackBeamSpotTool.cxx.

133{
134 //Select tracks
135 auto selectedTracks = m_trackFilterTool->filter(tracks);
136
137 std::vector<TrackData> bsTracks;
138 bool has_bs = m_trackFilterTool->updateBS(selectedTracks, eventID.lumi_block(),
139 eventID.bunch_crossing_id(), &bsTracks);
140
141 // when beamspot is known we can call actual update methods
142 if (has_bs) {
143 if (not bsTracks.empty()) {
144 updateBS(std::move(bsTracks));
145 } else {
146 updateBS(m_trackFilterTool->filterBS(selectedTracks), eventID.bunch_crossing_id());
147 }
148 }
149}
void updateBS(const TrackCollection &tracks, EventIDBase const &eventID) const
Update beam spot data with new track information.

◆ updateBS() [2/3]

void T2TrackBeamSpotTool::updateBS ( std::vector< const Trk::Track * > && tracks,
unsigned bcid ) const
private

Update beam spot data with new track information.

Parameter provides a lists of tracks.

Definition at line 151 of file T2TrackBeamSpotTool.cxx.

152{
153 auto timer = Monitored::Timer("TIME_updateBS");
154 if (m_doLeastSquares) {
155 ATH_MSG_DEBUG("Fill LS matrices with " << tracks.size() << " Trk::Track tracks");
156 MonitoredLSMatrices lsMatrices;
157 for (auto& track: tracks) {
158 TrackData tdata(*track->perigeeParameters(), 0, bcid);
159 lsMatrices.update(tdata, m_beamSizeLS);
160 }
161 lsMatrices.publish(m_monTool);
162 }
163 if (m_doLogLikelihood) {
164 ATH_MSG_DEBUG("Fill LL coefficients with " << tracks.size() << " Trk::Track tracks");
165 std::vector<double> poly_coeff;
166 T2TrackBSLLPoly llpoly(m_beamSizeLS);
167 for (auto& track: tracks) {
168 auto const& par = track->perigeeParameters()->parameters();
169 auto const& cov = track->perigeeParameters()->covariance();
170 llpoly.update(par[Trk::z0], par[Trk::d0], par[Trk::phi0], (*cov)(Trk::d0, Trk::d0), poly_coeff);
171 }
172 if (not poly_coeff.empty()) {
173 auto coeff = Monitored::Collection("TrackLLPolyCoeff", poly_coeff);
174 auto mon = Monitored::Group(m_monTool, coeff);
175 }
176 }
177 auto mon = Monitored::Group(m_monTool, timer);
178}
#define ATH_MSG_DEBUG(x)
T2BSTrackFilterTool::TrackData TrackData
ValuesCollection< T > Collection(std::string name, const T &collection)
Declare a monitored (double-convertible) collection.
constexpr double coeff(const unsigned l, const unsigned k)
Calculates the n-th coefficient of the legendre polynomial series.
@ phi0
Definition ParamDefs.h:65
@ d0
Definition ParamDefs.h:63
@ z0
Definition ParamDefs.h:64
timer(name, disabled=False)

◆ updateBS() [3/3]

void T2TrackBeamSpotTool::updateBS ( std::vector< TrackData > && tracks) const
private

Update beam spot data with new track information.

This method does exactly the same as above but uses different track representation. Two methods defined mostly for performance reasons to avoid conversion.

Definition at line 180 of file T2TrackBeamSpotTool.cxx.

181{
182 auto timer = Monitored::Timer("TIME_updateBS");
183 if (m_doLeastSquares) {
184 ATH_MSG_DEBUG("Fill LS matrices with " << tracks.size() << " TrackData tracks");
185 MonitoredLSMatrices lsMatrices;
186 for (auto& track: tracks) {
187 lsMatrices.update(track, m_beamSizeLS);
188 }
189 lsMatrices.publish(m_monTool);
190 }
191 if (m_doLogLikelihood) {
192 ATH_MSG_DEBUG("Fill LL coefficients with " << tracks.size() << " TrackData tracks");
193 std::vector<double> poly_coeff;
194 T2TrackBSLLPoly llpoly(m_beamSizeLS);
195 for (auto& track: tracks) {
196 llpoly.update(track.z0, track.d0, track.phi0, track.d0_var, poly_coeff);
197 }
198 auto coeff = Monitored::Collection("TrackLLPolyCoeff", poly_coeff);
199 auto mon = Monitored::Group(m_monTool, coeff);
200 }
201 auto mon = Monitored::Group(m_monTool, timer);
202}

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

double PESA::T2TrackBeamSpotTool::m_beamSizeLS
private

Definition at line 65 of file T2TrackBeamSpotTool.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_doLeastSquares

bool PESA::T2TrackBeamSpotTool::m_doLeastSquares
private

Definition at line 63 of file T2TrackBeamSpotTool.h.

◆ m_doLogLikelihood

bool PESA::T2TrackBeamSpotTool::m_doLogLikelihood
private

Definition at line 64 of file T2TrackBeamSpotTool.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_monTool

ToolHandle<GenericMonitoringTool> PESA::T2TrackBeamSpotTool::m_monTool {this, "MonTool", "", "Monitoring tool"}
private

Definition at line 68 of file T2TrackBeamSpotTool.h.

68{this, "MonTool", "", "Monitoring tool"};

◆ m_trackFilterTool

ToolHandle<T2BSTrackFilterTool> PESA::T2TrackBeamSpotTool::m_trackFilterTool {this, "TrackFilter", "PESA::T2BSTrackFilterTool/T2BSTrackFilterTool" }
private

Definition at line 67 of file T2TrackBeamSpotTool.h.

67{this, "TrackFilter", "PESA::T2BSTrackFilterTool/T2BSTrackFilterTool" };

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