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

Retrieves all InDet::TRT_DriftCircle objects. More...

#include <TRTRetriever.h>

Inheritance diagram for JiveXML::TRTRetriever:
Collaboration diagram for JiveXML::TRTRetriever:

Public Member Functions

 TRTRetriever (const std::string &type, const std::string &name, const IInterface *parent)
 Standard Constructor.
virtual StatusCode retrieve (ToolHandle< IFormatTool > &FormatTool)
 Retrieve all the data.
virtual std::string dataTypeName () const
 Return the name of the data type.
virtual StatusCode initialize ()
 initialize only geo model tool
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 ToolHandle< IInDetGeoModelToolm_geo {this,"GeoModelTool","JiveXML::InDetGeoModelTool/InDetGeoModelTool",""}
 A tool handle to the geo model tool.
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_TRTDriftCircleCollKey { this, "TRTClusters", "TRT_DriftCircles", "Container name for TRT Drift Circles" }
 The StoreGate key for the TRT Cluster collection to retrieve.
bool m_useTRTTruthMap = false
 The StoreGate key for the TRT MultiTruthMap with the track associations.
SG::ReadHandleKey< PRD_MultiTruthCollectionm_TRTTruthMapKey { this, "TRT_TruthMap", "PRD_MultiTruthTRT", "Container name for PRD Multi-truth TRT MAP" }
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 InDet::TRT_DriftCircle objects.

  • Properties
    • TRTClusters: The StoreGate key for the TRT Cluster collection to retrieve.
  • TRT_TruthMap:
  • Retrieved Data
    • id : unique identifier of the drift circle
    • rhoz : \(\rho\) (for barrel) or \(z\) (for endcap) coordinate of the hit
    • phi : \(\phi\) coordinate of the hit
    • driftR : the drift radius
    • threshold : wether the hit passed the high threshold or not
    • numBarcodes : number of associated truth tracks
    • barcodes : barcodes of the associated truth tracks
    • sub : the barrel/endcap subdetector in which the drift circle is
    • noise : wether the hit is flagged as noise
    • timeOverThreshold : time over threshold of the hit
    • bitPattern : the status word of the drift circle

Definition at line 43 of file TRTRetriever.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

◆ TRTRetriever()

JiveXML::TRTRetriever::TRTRetriever ( 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 24 of file TRTRetriever.cxx.

24 :
25 AthAlgTool(type,name,parent)
26 {
27 //Declare the interface
28 declareInterface<IDataRetriever>(this);
29
30 //And properties
31 declareProperty("TRTTruthMap" , m_TRTTruthMapKey = "PRD_MultiTruthTRT");
32 }
AthAlgTool()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
SG::ReadHandleKey< PRD_MultiTruthCollection > m_TRTTruthMapKey

Member Function Documentation

◆ dataTypeName()

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

Return the name of the data type.

Implements JiveXML::IDataRetriever.

Definition at line 55 of file TRTRetriever.h.

55{ return "TRT"; };

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

initialize only geo model tool

Definition at line 34 of file TRTRetriever.cxx.

34 {
35 ATH_CHECK( m_geo.retrieve() );
36 ATH_CHECK( m_TRTDriftCircleCollKey.initialize() );
37 m_useTRTTruthMap = !m_TRTTruthMapKey.key().empty();
39 return StatusCode::SUCCESS;
40 }
#define ATH_CHECK
Evaluate an expression and check for errors.
bool m_useTRTTruthMap
The StoreGate key for the TRT MultiTruthMap with the track associations.
SG::ReadHandleKey< InDet::TRT_DriftCircleContainer > m_TRTDriftCircleCollKey
The StoreGate key for the TRT Cluster collection to retrieve.
const ToolHandle< IInDetGeoModelTool > m_geo
A tool handle to the geo model tool.

◆ 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::TRTRetriever::retrieve ( ToolHandle< IFormatTool > & FormatTool)
virtual

Retrieve all the data.

NOTE: to get rhoz and phi, obtain DetectorElement and then change to hashid - faster

Finally, get the associated truth particles, if there are

Implements JiveXML::IDataRetriever.

Definition at line 42 of file TRTRetriever.cxx.

42 {
43 //be verbose
44 ATH_MSG_DEBUG( "Retrieving " << dataTypeName() );
45
46 //First try to retrieve the DriftCircleContainer
47 SG::ReadHandle<InDet::TRT_DriftCircleContainer> DriftCircleContainer( m_TRTDriftCircleCollKey );
48 if ( !DriftCircleContainer.isValid() ) {
49 ATH_MSG_DEBUG( "Unable to retrieve TRT_DriftCircleContainer with name " << m_TRTDriftCircleCollKey.key() );
50 return StatusCode::RECOVERABLE;
51 }
52
53 //Also try to obtain the truth container
54 SG::ReadHandle<PRD_MultiTruthCollection> TRTMultiTruthMap;
55 if ( m_useTRTTruthMap ) {
56 TRTMultiTruthMap = SG::makeHandle(m_TRTTruthMapKey);
57 if ( !TRTMultiTruthMap.isValid() ){
58 //Only warn if this container is not available
59 ATH_MSG_DEBUG( "Unable to retrieve PRD_MultiTruthCollection with name " << m_TRTTruthMapKey.key() );
60 }
61 }
62
63 //Get total size of all all drift circles in all collections
64 unsigned long NDriftCircleTotal = 0;
65 //Loop over collections in container
66 for (const auto DriftCircleColl : *DriftCircleContainer)
67 NDriftCircleTotal += DriftCircleColl->size();
68
69 //be verbose
70 ATH_MSG_VERBOSE( "Reserving space for " << NDriftCircleTotal << " entries" );
71
72 //Rerserve space in the map
73 DataVect rhoz; rhoz.reserve(NDriftCircleTotal);
74 DataVect phi; phi.reserve(NDriftCircleTotal);
75 DataVect driftR; driftR.reserve(NDriftCircleTotal);
76 DataVect threshold; threshold.reserve(NDriftCircleTotal);
77 DataVect ident; ident.reserve(NDriftCircleTotal);
78 DataVect sub; sub.reserve(NDriftCircleTotal);
79 DataVect noise; noise.reserve(NDriftCircleTotal);
80 DataVect timeOverThreshold; timeOverThreshold.reserve(NDriftCircleTotal);
81 DataVect bitPattern; bitPattern.reserve(NDriftCircleTotal);
82 DataVect numBarcodes; numBarcodes.reserve(NDriftCircleTotal);
83 DataVect barcodes; barcodes.reserve(NDriftCircleTotal); //< on average less than one, so this should be enough
84
85 //Now loop over container to retrieve the data
86 for (const auto DriftCircleColl : *DriftCircleContainer) {
87
89 for (const auto driftcircle : *DriftCircleColl){
90
91 //Get the drift cirlce itself and its unique identifier
92
93 //In verbose mode, print out drift circle information
94 ATH_MSG_VERBOSE( "Retrieving information from " << (*driftcircle) );
95
96 Identifier id = driftcircle->identify();
97
98 //Check if it is valid
99 if (! id.is_valid()) {
100 ATH_MSG_DEBUG( "Ignoring TRT_DriftCircle with invalid identifier " << id );
101 continue;
102 }
103
104 //Store the identifier
105 ident.push_back(DataType(id.get_compact()));
106
111 const InDetDD::TRT_BaseElement* element = m_geo->TRTGeoManager()->getElement(m_geo->TRTIDHelper()->layer_id(id));
112
113 //get global coord of straw
114 Amg::Vector3D global = element->strawTransform(m_geo->TRTIDHelper()->straw(id))*Amg::Vector3D(0.,0.,0.);
115
116 //store the phi value
117 phi.push_back(DataType( (global.phi()<0) ? global.phi() + 2*M_PI : global.phi()));
118
119 //store rho for barrel and z for endcap
121 rhoz.push_back(DataType(global.perp()*CLHEP::mm/CLHEP::cm));
122 else if (element->type()==InDetDD::TRT_BaseElement::ENDCAP)
123 rhoz.push_back(DataType(global.z()*CLHEP::mm/CLHEP::cm));
124 else
125 ATH_MSG_VERBOSE( "Unknown TRT base element of type " << element->type() );
126
127 //Store local position parameters
128 driftR.push_back(DataType((driftcircle->localPosition())[Trk::driftRadius]*CLHEP::mm/CLHEP::cm));
129
130 //Get subdetector number
131 switch ( m_geo->TRTIDHelper()->barrel_ec(id) ) {
132 case -2 : sub.push_back(DataType( 0 )); break;
133 case -1 : sub.push_back(DataType( 1 )); break;
134 case 1 : sub.push_back(DataType( 2 )); break;
135 case 2 : sub.push_back(DataType( 3 )); break;
136 default : sub.push_back(DataType(-1 ));
137 }
138
139 //Store threshold related parameters
140 threshold.push_back(DataType(driftcircle->highLevel()));
141 timeOverThreshold.push_back(DataType(driftcircle->timeOverThreshold()));
142 noise.push_back(DataType(driftcircle->isNoise()));
143 bitPattern.push_back(DataType(driftcircle->getWord()));
144
148 if ( !m_useTRTTruthMap || !TRTMultiTruthMap.isValid() ) continue;
149
150 //Count number of barcodes we get
151 int NBarcodes = 0;
152 //Loop over associated truth tracks with same id
153 using iter = PRD_MultiTruthCollection::const_iterator;
154 std::pair<iter,iter> equalIDRange = TRTMultiTruthMap->equal_range(id);
155 for ( iter TRTMultiTruthMapItr = equalIDRange.first; TRTMultiTruthMapItr != equalIDRange.second; ++TRTMultiTruthMapItr){
156 NBarcodes++;
157 barcodes.push_back(DataType(TRTMultiTruthMapItr->second.barcode()));
158 }
159 numBarcodes.push_back(DataType(NBarcodes));
160 } //loop over collection
161 }//loop over container
162
163 //Add everything to our data map
165 dataMap["rhoz"]=rhoz;
166 dataMap["phi"]=phi;
167 dataMap["driftR"]=driftR;
168 dataMap["threshold"]=threshold;
169 dataMap["id"]=ident;
170 dataMap["sub"]=sub;
171 dataMap["noise"]=noise;
172 dataMap["timeOverThreshold"]=timeOverThreshold;
173 dataMap["bitPattern"]=bitPattern;
174
175 //Only write truth association tags if we processed truth
176 if ( numBarcodes.size() > 0 ){
177 //Add barcodes counter
178 dataMap["numBarcodes"]=numBarcodes;
179 // Compute the "multiple" for barcodes and put the vector in the map.
180 std::string bctag = "barcodes multiple=\""+DataType(barcodes.size()/double(numBarcodes.size())).toString()+"\"";
181 dataMap[bctag]=barcodes;
182 }
183
184 //be verbose
185 ATH_MSG_DEBUG( dataTypeName() << ": " << rhoz.size() );
186
187 //forward data to formating tool and return
188 return FormatTool->AddToEvent(dataTypeName(), "", &dataMap);
189 }
#define M_PI
Scalar phi() const
phi method
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_DEBUG(x)
OFFLINE_FRAGMENTS_NAMESPACE::PointerType DataType
virtual TRT_BaseElement::Type type() const =0
Type information: returns BARREL or ENDCAP.
const Amg::Transform3D & strawTransform(unsigned int straw) const
Straw transform - fast access in array, in Tracking frame: Amg.
virtual std::string dataTypeName() const
Return the name of the data type.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
double timeOverThreshold(unsigned int m_word)
Eigen::Matrix< double, 3, 1 > Vector3D
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
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
@ ident
Definition HitInfo.h:77
@ driftRadius
trt, straws
Definition ParamDefs.h:53
barcodes(beg, end, sz)
Definition Dumpers.py:2831

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

const ToolHandle<IInDetGeoModelTool> JiveXML::TRTRetriever::m_geo {this,"GeoModelTool","JiveXML::InDetGeoModelTool/InDetGeoModelTool",""}
private

A tool handle to the geo model tool.

Definition at line 63 of file TRTRetriever.h.

64{this,"GeoModelTool","JiveXML::InDetGeoModelTool/InDetGeoModelTool",""};

◆ m_TRTDriftCircleCollKey

SG::ReadHandleKey<InDet::TRT_DriftCircleContainer> JiveXML::TRTRetriever::m_TRTDriftCircleCollKey { this, "TRTClusters", "TRT_DriftCircles", "Container name for TRT Drift Circles" }
private

The StoreGate key for the TRT Cluster collection to retrieve.

Definition at line 67 of file TRTRetriever.h.

67{ this, "TRTClusters", "TRT_DriftCircles", "Container name for TRT Drift Circles" };

◆ m_TRTTruthMapKey

SG::ReadHandleKey<PRD_MultiTruthCollection> JiveXML::TRTRetriever::m_TRTTruthMapKey { this, "TRT_TruthMap", "PRD_MultiTruthTRT", "Container name for PRD Multi-truth TRT MAP" }
private

Definition at line 70 of file TRTRetriever.h.

70{ this, "TRT_TruthMap", "PRD_MultiTruthTRT", "Container name for PRD Multi-truth TRT MAP" };

◆ m_useTRTTruthMap

bool JiveXML::TRTRetriever::m_useTRTTruthMap = false
private

The StoreGate key for the TRT MultiTruthMap with the track associations.

Definition at line 69 of file TRTRetriever.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: