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 25 of file TRTRetriever.cxx.

25 :
26 AthAlgTool(type,name,parent)
27 {
28 //Declare the interface
29 declareInterface<IDataRetriever>(this);
30
31 //And properties
32 declareProperty("TRTTruthMap" , m_TRTTruthMapKey = "PRD_MultiTruthTRT");
33 }
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 35 of file TRTRetriever.cxx.

35 {
36 ATH_CHECK( m_geo.retrieve() );
37 ATH_CHECK( m_TRTDriftCircleCollKey.initialize() );
38 m_useTRTTruthMap = !m_TRTTruthMapKey.key().empty();
40 return StatusCode::SUCCESS;
41 }
#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 43 of file TRTRetriever.cxx.

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