ATLAS Offline Software
Loading...
Searching...
No Matches
JiveXML::SegmentRetriever Class Reference

Retrieves all Trk::SegmentCollection objects. More...

#include <SegmentRetriever.h>

Inheritance diagram for JiveXML::SegmentRetriever:
Collaboration diagram for JiveXML::SegmentRetriever:

Public Member Functions

 SegmentRetriever (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor.
virtual StatusCode initialize ()
virtual StatusCode retrieve (ToolHandle< IFormatTool > &FormatTool)
 Retrieve all the data.
virtual std::string dataTypeName () const
 Return the name of the data type.
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 ()
 Return the interface identifier.

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

const std::string m_typeName = "Segment"
 The data type that is generated by this retriever.
SG::ReadHandleKeyArray< Trk::SegmentCollectionm_keys {this,"SegmentCollections",{"NCB_TrackMuonSegments","TrackMuonNSWSegments","UnAssocMuonTrkSegments","TrkMuonSegments"}, "Name of the Segment containers that will be written out to the JiveXML file"}
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

Retrieves all Trk::SegmentCollection objects.

  • Properties
    • none
  • Retrieved Data
    • x,y,z: coordinates of segment starting point
    • eta,phi: segment direction
    • NHits: number of hits associated with this segment
    • hits: ID of hits associated with this segment

Definition at line 28 of file SegmentRetriever.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

◆ SegmentRetriever()

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

Standard Constructor.

This is the standard AthAlgTool constructor.

Parameters
typeAlgTool type name
nameAlgTool instance name
parentAlgTools parent owning this tool

Definition at line 21 of file SegmentRetriever.cxx.

21 :
22 AthAlgTool(type,name,parent){}
AthAlgTool()
Default constructor:

Member Function Documentation

◆ dataTypeName()

virtual std::string JiveXML::SegmentRetriever::dataTypeName ( ) const
inlinevirtual

Return the name of the data type.

Implements JiveXML::IDataRetriever.

Definition at line 42 of file SegmentRetriever.h.

42{ return m_typeName; };
const std::string m_typeName
The data type that is generated by this retriever.

◆ 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 }
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)

◆ 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 JiveXML::SegmentRetriever::initialize ( )
virtual

Definition at line 25 of file SegmentRetriever.cxx.

25 {
26 ATH_CHECK(m_keys.initialize());
27 return StatusCode::SUCCESS;
28 }
#define ATH_CHECK
Evaluate an expression and check for errors.
SG::ReadHandleKeyArray< Trk::SegmentCollection > m_keys

◆ 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 & JiveXML::IDataRetriever::interfaceID ( )
inlinestaticinherited

Return the interface identifier.

Definition at line 40 of file IDataRetriever.h.

40{ return IID_IDataRetriever; }
static const InterfaceID IID_IDataRetriever("JiveXML::IDataRetriever", 3, 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 }

◆ retrieve()

StatusCode JiveXML::SegmentRetriever::retrieve ( ToolHandle< IFormatTool > & FormatTool)
virtual

Retrieve all the data.

For each segement collections retrieve all data.

  • loop over segments in all collections
  • for each segment get basic coordinates
  • for each segment try to obtain hits and add as multiple collection
    Parameters
    FormatToolthe tool that will create formated output from the DataMap

Implements JiveXML::IDataRetriever.

Definition at line 38 of file SegmentRetriever.cxx.

38 {
39
40 ATH_MSG_DEBUG("Retrieving " << dataTypeName());
41
42 for( const auto& key : m_keys ) {
43 SG::ReadHandle<Trk::SegmentCollection > cont(key);
44 if (cont.isValid()) {
45
46 //Get number of segments in this collection
47 Trk::SegmentCollection::size_type NSegs=cont.cptr()->size();
48
49 //Define the data vectors we want to fill and create space
50 DataVect x; x.reserve(NSegs);
51 DataVect y; y.reserve(NSegs);
52 DataVect z; z.reserve(NSegs);
53 DataVect phi; phi.reserve(NSegs);
54 DataVect theta; theta.reserve(NSegs);
55 DataVect numHits; numHits.reserve(NSegs);
57
58 //Loop over the segments
60 for (SegmentItr=cont.cptr()->begin(); SegmentItr!=cont.cptr()->end(); ++SegmentItr) {
61
62 //Retrieve primitive variables
63 x.emplace_back((*SegmentItr)->globalPosition().x()/10.);
64 y.emplace_back((*SegmentItr)->globalPosition().y()/10.);
65 z.emplace_back((*SegmentItr)->globalPosition().z()/10.);
66 phi.emplace_back((*SegmentItr)->localParameters()[Trk::phi]);
67 theta.emplace_back((*SegmentItr)->localParameters()[Trk::theta]);
68
69 //Count number of valid (non-null) RIO_OnTracks
70 int NRoTs = 0;
71 //Reserve space for expected number
72 hits.reserve(hits.size()+(*SegmentItr)->containedMeasurements().size());
73
74 //Loop over segment measurments
75 std::vector< const Trk::MeasurementBase * >::const_iterator measItr, measEnd;
76 measItr=(*SegmentItr)->containedMeasurements().begin();
77 measEnd=(*SegmentItr)->containedMeasurements().end();
78
79 //Now loop over measurements
80 for (; measItr!=measEnd; ++measItr) {
81
82 //dynamic_cast to RIO_OnTrack - will return NULL if not a RIO_OnTrack object
83 const Trk::RIO_OnTrack *RoT = dynamic_cast<const Trk::RIO_OnTrack*>(*measItr);
84
85 //Ignore failed dynamic_casts
86 if (!RoT) continue ;
87
88 //Add the hit
89 hits.emplace_back(RoT->identify().get_compact() );
90 //count as valid
91 NRoTs++;
92 }
93
94 //Store number of hits for this segement
95 numHits.emplace_back(NRoTs);
96 }
97
98 //Add data to our map
100 DataMap["x"] = x;
101 DataMap["y"] = y;
102 DataMap["z"] = z;
103 DataMap["phi"] = phi;
104 DataMap["theta"] = theta;
105 DataMap["numHits"] = numHits;
106
107 //Hits are stored as multiple with average size given in XML header
108 if (NSegs > 0) {
109 std::string multiple = "hits multiple=\"" + DataType( hits.size()*1./numHits.size()).toString() + "\"";
110 DataMap[multiple] = hits;
111 }
112
113 //forward data to formating tool
114 if ( FormatTool->AddToEvent(dataTypeName(), key.key(), &DataMap).isFailure())
115 return StatusCode::RECOVERABLE;
116
117 ATH_MSG_DEBUG(dataTypeName() << " collection " << key << " retrieved with " << NSegs << " entries");
118
119 }
120 else{
121 ATH_MSG_WARNING("Collection " << key << " not found in SG ");
122 }
123 }
124
125 //All collections retrieved - done
126 return StatusCode::SUCCESS;
127
128 } // retrieve
Scalar phi() const
phi method
Scalar theta() const
theta method
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
#define y
#define x
#define z
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
typename DataVectorBase< Trk::Segment >::Base::size_type size_type
Definition DataVector.h:814
value_type get_compact() const
Get the compact id.
virtual std::string dataTypeName() const
Return the name of the data type.
Identifier identify() const
return the identifier -extends MeasurementBase
std::map< std::string, DataVect > DataMap
Definition DataType.h:59
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
Definition DataType.h:58
@ theta
Definition ParamDefs.h:66
@ phi
Definition ParamDefs.h:75

◆ 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_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_keys

SG::ReadHandleKeyArray<Trk::SegmentCollection> JiveXML::SegmentRetriever::m_keys {this,"SegmentCollections",{"NCB_TrackMuonSegments","TrackMuonNSWSegments","UnAssocMuonTrkSegments","TrkMuonSegments"}, "Name of the Segment containers that will be written out to the JiveXML file"}
private

Definition at line 48 of file SegmentRetriever.h.

48{this,"SegmentCollections",{"NCB_TrackMuonSegments","TrackMuonNSWSegments","UnAssocMuonTrkSegments","TrkMuonSegments"}, "Name of the Segment containers that will be written out to the JiveXML file"};

◆ m_typeName

const std::string JiveXML::SegmentRetriever::m_typeName = "Segment"
private

The data type that is generated by this retriever.

Definition at line 46 of file SegmentRetriever.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: