ATLAS Offline Software
Loading...
Searching...
No Matches
ReadTRT_DetectorElements Class Reference

Algorithm to demonstrate access to TRT detector elements, printing out parameters of specific straws. More...

#include <ReadTRT_DetectorElements.h>

Inheritance diagram for ReadTRT_DetectorElements:
Collaboration diagram for ReadTRT_DetectorElements:

Public Member Functions

 ReadTRT_DetectorElements (const std::string &name, ISvcLocator *pSvcLocator)
 Default Algorithm constructor with parameters.
StatusCode initialize ()
StatusCode execute ()
StatusCode finalize ()
void printAllElements ()
void printBarrelStraw (const InDetDD::TRT_BarrelElement *element, const unsigned int strawNum)
void printEndcapStraw (const InDetDD::TRT_EndcapElement *element, const unsigned int strawNum)
void printStraw (const InDetDD::TRT_BaseElement *element, const unsigned int strawNum)
void compareBarrelStraw (const InDetDD::TRT_BarrelElement *element, const unsigned int strawNum)
void compareEndcapStraw (const InDetDD::TRT_EndcapElement *element, const unsigned int strawNum)
bool comparePos (const Amg::Vector3D &p1, const Amg::Vector3D &p2, const double err)
virtual StatusCode sysInitialize () override
 Override sysInitialize.
virtual const DataObjIDColl & extraOutputDeps () const override
 Return the list of extra output dependencies.
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 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

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

Private Attributes

std::string m_managerName
bool m_doInit
bool m_doExec
const InDetDD::TRT_DetectorManagerm_manager
const TRT_IDm_idHelper
double m_maxdiff
bool m_first
DataObjIDColl m_extendedExtraObjects
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

Algorithm to demonstrate access to TRT detector elements, printing out parameters of specific straws.

Definition at line 39 of file ReadTRT_DetectorElements.h.

Member Typedef Documentation

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ ReadTRT_DetectorElements()

ReadTRT_DetectorElements::ReadTRT_DetectorElements ( const std::string & name,
ISvcLocator * pSvcLocator )

Default Algorithm constructor with parameters.

Definition at line 33 of file ReadTRT_DetectorElements.cxx.

33 :
34 AthAlgorithm(name, pSvcLocator),
35 m_managerName("TRT"),
36 m_manager(nullptr),
37 m_idHelper(nullptr),
38 m_maxdiff(0),
39 m_first(true)
40{
41 // Get parameter values from jobOptions file
42 declareProperty("ManagerName", m_managerName);
43 declareProperty("DoInitialize", m_doInit = true);
44 declareProperty("DoExecute", m_doExec = false);
45}
AthAlgorithm()
Default constructor:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const InDetDD::TRT_DetectorManager * m_manager

Member Function Documentation

◆ compareBarrelStraw()

void ReadTRT_DetectorElements::compareBarrelStraw ( const InDetDD::TRT_BarrelElement * element,
const unsigned int strawNum )

Definition at line 351 of file ReadTRT_DetectorElements.cxx.

351 {
352 if (strawNum >= element->nStraws()) {
353 cout << "Straw number out of range:" << strawNum << " >= " << element->nStraws() << endl;
354 return;
355 }
356
357 double x = element->strawXPos(strawNum);
358 double y = element->strawYPos(strawNum);
359 double z = element->strawZPos(strawNum);
360
361 Amg::Transform3D transform = element->strawTransform(strawNum);
362 Amg::Vector3D strawPos = transform * origin;
363
364 if (!comparePos(strawPos, Amg::Vector3D(x,y,z), 1e-9)) {
365 cout << "Straw Positions DIFFER !!!!!" << endl;
366 printStraw(element, strawNum);
367 printBarrelStraw(element, strawNum);
368 }
369}
#define y
#define x
#define z
double strawXPos(unsigned int i) const
Get X Position: DEPRECATED.
double strawZPos(unsigned int i) const
Get Z Position: (active center) DEPRECATED.
double strawYPos(unsigned int i) const
Get Y Position: DEPRECATED.
unsigned int nStraws() const
Number of straws in the element.
const Amg::Transform3D & strawTransform(unsigned int straw) const
Straw transform - fast access in array, in Tracking frame: Amg.
void printStraw(const InDetDD::TRT_BaseElement *element, const unsigned int strawNum)
void printBarrelStraw(const InDetDD::TRT_BarrelElement *element, const unsigned int strawNum)
bool comparePos(const Amg::Vector3D &p1, const Amg::Vector3D &p2, const double err)
Eigen::Affine3d Transform3D
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Eigen::Matrix< double, 3, 1 > Vector3D

◆ compareEndcapStraw()

void ReadTRT_DetectorElements::compareEndcapStraw ( const InDetDD::TRT_EndcapElement * element,
const unsigned int strawNum )

Definition at line 372 of file ReadTRT_DetectorElements.cxx.

372 {
373 if (strawNum >= element->getDescriptor()->nStraws()) {
374 cout << "Straw number out of range:" << strawNum << " >= " << element->getDescriptor()->nStraws() << endl;
375 return;
376 }
377 double phiStart = element->getDescriptor()->startPhi();
378 double pitch = element->getDescriptor()->strawPitch();
379 double phi = phiStart + strawNum*pitch;
380 double r = element->getDescriptor()->innerRadius() + 0.5 * element->getDescriptor()->strawLength();
381 double z = (element->transform() * origin).z();
382
383 Amg::Transform3D transform = element->strawTransform(strawNum);
384 Amg::Vector3D strawPos = transform * origin;
385
386 if (!comparePos(strawPos, Amg::Vector3D(r*cos(phi), r*sin(phi), z), 1e-5)) {
387 cout << "Straw Positions DIFFER !!!!!" << endl;
388 printStraw(element, strawNum);
389 printEndcapStraw(element, strawNum);
390 }
391}
Scalar phi() const
phi method
virtual const Amg::Transform3D & transform() const override final
Element Surface: Get Transform of element in Tracking frame: Amg.
double & strawPitch()
The straw pitch (angular!
double & startPhi()
The starting phi (angular!
unsigned int & nStraws()
The number of straws in a module:
double & innerRadius()
The inner radius:
const TRT_EndcapDescriptor * getDescriptor() const
Returns a pointer to a descriptor, giving common information on module construction.
void printEndcapStraw(const InDetDD::TRT_EndcapElement *element, const unsigned int strawNum)
int r
Definition globals.cxx:22

◆ comparePos()

bool ReadTRT_DetectorElements::comparePos ( const Amg::Vector3D & p1,
const Amg::Vector3D & p2,
const double err )

Definition at line 395 of file ReadTRT_DetectorElements.cxx.

395 {
396 for (int i = 0; i < 3; i++) {
397 double diff = std::abs(p1[i] - p2[i]);
398 m_maxdiff = std::max(diff,m_maxdiff);
399 if (diff > err) return false;
400 }
401 return true;
402}
void diff(const Jet &rJet1, const Jet &rJet2, std::map< std::string, double > varDiff)
Difference between jets - Non-Class function required by trigger.
Definition Jet.cxx:631

◆ declareGaudiProperty()

Gaudi::Details::PropertyBase & AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::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< Algorithm > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

◆ execute()

StatusCode ReadTRT_DetectorElements::execute ( )

Definition at line 70 of file ReadTRT_DetectorElements.cxx.

70 {
71 msg(MSG::INFO) << "execute()" << endmsg;
72 // Only print out on first event
73 if (m_first && m_doExec) {
74 m_first = false;
76 }
77 return StatusCode::SUCCESS;
78}
#define endmsg
MsgStream & msg() const

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< Algorithm > >::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

◆ extraOutputDeps()

const DataObjIDColl & AthAlgorithm::extraOutputDeps ( ) const
overridevirtualinherited

Return the list of extra output dependencies.

This list is extended to include symlinks implied by inheritance relations.

Definition at line 50 of file AthAlgorithm.cxx.

51{
52 // If we didn't find any symlinks to add, just return the collection
53 // from the base class. Otherwise, return the extended collection.
54 if (!m_extendedExtraObjects.empty()) {
56 }
57 return Algorithm::extraOutputDeps();
58}
DataObjIDColl m_extendedExtraObjects

◆ finalize()

StatusCode ReadTRT_DetectorElements::finalize ( )

Definition at line 270 of file ReadTRT_DetectorElements.cxx.

270 {
271 msg(MSG::INFO) << "finalize()" << endmsg;
272 return StatusCode::SUCCESS;
273}

◆ initialize()

StatusCode ReadTRT_DetectorElements::initialize ( )

Definition at line 49 of file ReadTRT_DetectorElements.cxx.

49 {
50 msg(MSG::INFO) << "initialize()" << endmsg;
51 // Get the manager
53 if (sc.isFailure() || !m_manager) {
54 msg(MSG::FATAL) << "Could not find the Manager: "<< m_managerName << " !" << endmsg;
55 return StatusCode::FAILURE;
56 } else {
57 msg(MSG::DEBUG) << "Manager found" << endmsg;
58 }
59 // Get ID helper
60 if (detStore()->retrieve(m_idHelper, "TRT_ID").isFailure()) {
61 msg(MSG::FATAL) << "Could not get TRT ID helper" << endmsg;
62 return StatusCode::FAILURE;
63 }
65 return StatusCode::SUCCESS;
66}
static Double_t sc
const ServiceHandle< StoreGateSvc > & detStore() const
::StatusCode StatusCode
StatusCode definition for legacy code.
retrieve(aClass, aKey=None)
Definition PyKernel.py:110

◆ inputHandles()

virtual std::vector< Gaudi::DataHandle * > AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

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

◆ msgLvl()

bool AthCommonMsg< Algorithm >::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< Algorithm > >::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.

◆ printAllElements()

void ReadTRT_DetectorElements::printAllElements ( )

Definition at line 80 of file ReadTRT_DetectorElements.cxx.

80 {
81 // Retrieve GeoModel Detector Elements
82 // Get the id helper
83 const TRT_ID * idHelper = m_idHelper;
84 // Examples are shown below for accessing via index for barrel, then endcap and
85 // then accessing via hash
86 //
87 // Access via indices.
88 //
89 //
90 //
91 cout << "======================================" <<endl;
92 cout << " BARREL ELEMENTS - access via index" << endl;
93 cout << "======================================" <<endl;
94 cout << endl;
95 //cache numerology
96 const TRT_Numerology * numerology=m_manager->getNumerology();
97 //avoid getting these inside loops
98 const unsigned int nBarrelRings(numerology->getNBarrelRings());
99 const unsigned int nBarrelPhi(numerology->getNBarrelPhi());
100
101 for (int iSide = 0; iSide < 2; iSide++) {
102 for (unsigned int iLayer = 0; iLayer != nBarrelRings; iLayer++) {
103 const unsigned int nBarrelLayers(numerology->getNBarrelLayers(iLayer));
104 for (unsigned int iPhiModule = 0; iPhiModule != nBarrelPhi; iPhiModule++) {
105 for (unsigned int iStrawLayer = 0; iStrawLayer !=nBarrelLayers; iStrawLayer++) {
106 cout << "Barrel element " << iSide << ", " << iLayer << ", " << iPhiModule << ", "<< iStrawLayer << endl;
107 const TRT_BarrelElement *element = m_manager->getBarrelElement(iSide, iLayer, iPhiModule, iStrawLayer);
108 // Make identifier.
109 Identifier newId = idHelper->layer_id((iSide ? 1:-1), iPhiModule, iLayer, iStrawLayer);
110 idHelper->show(newId);
111 IdentifierHash idHash = idHelper->straw_layer_hash(newId);
112 cout << "idHash = " << idHash << endl;
113 if (element) {
114 Amg::Vector3D center = element->transform() * origin;
115 cout << " center = " << center << endl;
116 //cout << " strawDir = " << element->strawDirection() << endl;
117 cout << " number of straws = " << element->nStraws() << endl;
118 // Print out straw details of some elements
119 if ((iPhiModule == 0) || (iPhiModule == 1) || (iPhiModule == 7) || (iPhiModule == 31)) {
120 for (unsigned int istraw = 0; istraw < 15; istraw++) {
121 printStraw(element, istraw);
122 //printBarrelStraw(element, istraw);
123 }
124 }
125 // Compare methods
126 for (unsigned int istraw = 0; istraw < element->nStraws(); istraw++) {
127 compareBarrelStraw(element, istraw);
128 }
129 } else {
130 cout << "No Element found " << endl;
131 }
132 }
133 }
134 }
135 }
136
137 //
138 //
139 cout << "======================================" <<endl;
140 cout << " ENDCAP ELEMENTS - access via index" << endl;
141 cout << "======================================" <<endl;
142 cout << endl;
143 const unsigned int nWheels(numerology->getNEndcapWheels());
144 const unsigned int nEndcapPhi(numerology->getNEndcapPhi());
145 for (int iSide = 0; iSide < 2; iSide++) {
146 for (unsigned int iWheel = 0; iWheel !=nWheels ; iWheel++) {
147 const unsigned int nEndcapLayers(numerology->getNEndcapLayers(iWheel));
148 for (unsigned int iStrawLayer = 0; iStrawLayer != nEndcapLayers; iStrawLayer++){
149 for(unsigned int iPhi = 0; iPhi != nEndcapPhi; iPhi++){
150 cout << "Endcap element " << iSide << ", "<< iWheel << ", "<< iStrawLayer << ", "<< iPhi << endl;
151 const TRT_EndcapElement * element = m_manager->getEndcapElement(iSide, iWheel, iStrawLayer, iPhi);
152
153 // Make identifier.
154 Identifier newId = idHelper->layer_id((iSide ? 2:-2), iPhi, iWheel, iStrawLayer);
155 idHelper->show(newId);
156 IdentifierHash idHash = idHelper->straw_layer_hash(newId);
157 cout << "idHash = " << idHash << endl;
158
159 if (element) {
160 Amg::Vector3D center = element->transform() * origin;
161 cout << " center = " << center << endl;
162 cout << " number of straws = " << element->nStraws() << endl;
163 // Print out straw details of some elements
164 int iPhiModule = iPhi;
165 if ((iPhiModule == 0) || (iPhiModule == 1) || (iPhiModule == 7) || (iPhiModule == 31)) {
166 for (unsigned int istraw = 0; istraw < 15; istraw++) {
167 printStraw(element, istraw);
168 //printEndcapStraw(element, istraw);
169 }
170 }
171 // Compare methods
172 for (unsigned int istraw = 0; istraw < element->nStraws(); istraw++) {
173 compareEndcapStraw(element, istraw);
174 }
175 } else {
176 cout << "No Element found " << endl;
177 }
178 }
179 }
180 }
181 }
182
183
184
185 unsigned int maxHash = idHelper->straw_layer_hash_max();
186
187 //
188 // Try and iterate over all elements.
189 // There is no iterator but we can get the elements via the idHash.
190 //
191
192 cout << "======================================" <<endl;
193 cout << " ALL ELEMENTS - access via hash" << endl;
194 cout << "======================================" <<endl;
195 cout << endl;
196
197 cout << " maxHash = " << maxHash << endl;
198
199 for (unsigned int index = 0; index < maxHash; index++) {
200
201 IdentifierHash idHash = index;
202
203 Identifier id = idHelper->layer_id(idHash);
204 idHelper->show(id);
205
206 const TRT_BaseElement * element;
207
208 element = m_manager->getElement(idHash);
209
210 if (element) {
211 Amg::Vector3D center = element->transform() * origin;
212 cout << " center = " << center << endl;
213 } else {
214 cout << "No Element with id hash = " << idHash << endl;
215 }
216 }
217
218
219 cout << "======================================" <<endl;
220 cout << " ALL ELEMENTS - access via index from hash" << endl;
221 cout << " (no printout) " << endl;
222 cout << "======================================" <<endl;
223 cout << endl; for (unsigned int index = 0; index < maxHash; index++) {
224
225 IdentifierHash idHash = index;
226
227 Identifier id = idHelper->layer_id(idHash);
228 //idHelper->show(id);
229
230
231 int idBarrelEndcap = idHelper->barrel_ec(id);
232 int idSide = (idBarrelEndcap > 0);
233 int idLayerWheel = idHelper->layer_or_wheel(id);
234 int idPhiModule = idHelper->phi_module(id);
235 int idStrawLayer = idHelper->straw_layer(id);
236
237 // Make identifier again,
238 // Identifier newId = idHelper->layer_id(idBarrelEndcap, idPhiModule, idLayerWheel, idStrawLayer);
239 // idHelper->show(newId);
240
241
242 const TRT_BaseElement * element;
243
244
245 if (idHelper->is_barrel(id)) {
246 element = m_manager->getBarrelElement(idSide, idLayerWheel, idPhiModule, idStrawLayer);
247 } else {
248 element = m_manager->getEndcapElement(idSide, idLayerWheel, idStrawLayer, idPhiModule);
249 }
250
251 if (element) {
252 //nop
253 //Amg::Vector3D center = element->transform() * origin;
254 //cout << " center = " << center << endl;
255 } else {
256 cout << "No Element with id hash = " << idHash << endl;
257 }
258 }
259
260 cout << endl;
261
262 cout << "Max diff = " << m_maxdiff << endl;
263
264}
void show(Identifier id, const IdContext *context=0, char sep='.') const
Short print out of any identifier (optionally provide separation character - default is '.
unsigned int getNEndcapWheels() const
unsigned int getNEndcapPhi() const
unsigned int getNBarrelPhi() const
unsigned int getNBarrelRings() const
unsigned int getNBarrelLayers(unsigned int iMod) const
unsigned int getNEndcapLayers(unsigned int iWheel) const
void compareEndcapStraw(const InDetDD::TRT_EndcapElement *element, const unsigned int strawNum)
void compareBarrelStraw(const InDetDD::TRT_BarrelElement *element, const unsigned int strawNum)
int phi_module(const Identifier &id) const
Definition TRT_ID.h:806
Identifier layer_id(int barrel_ec, int phi_module, int layer_or_wheel, int straw_layer) const
For an individual straw layer.
Definition TRT_ID.h:494
size_type straw_layer_hash_max() const
Definition TRT_ID.h:851
bool is_barrel(const Identifier &id) const
Test for barrel.
Definition TRT_ID.h:788
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition TRT_ID.h:797
IdentifierHash straw_layer_hash(Identifier straw_layer_id) const
straw_layer hash from id - optimized
Definition TRT_ID.h:687
int layer_or_wheel(const Identifier &id) const
Definition TRT_ID.h:815
int straw_layer(const Identifier &id) const
Definition TRT_ID.h:824
str index
Definition DeMoScan.py:362
@ iPhi
Definition ParamDefs.h:47

◆ printBarrelStraw()

void ReadTRT_DetectorElements::printBarrelStraw ( const InDetDD::TRT_BarrelElement * element,
const unsigned int strawNum )

Definition at line 277 of file ReadTRT_DetectorElements.cxx.

277 {
278 // It is recommended to use the methods in printStraw() rather than the ones here
279 if (strawNum >= element->nStraws()) {
280 cout << "Straw number out of range:" << strawNum << " >= " << element->nStraws() << endl;
281 return;
282 }
283
284 double x = element->strawXPos(strawNum);
285 double y = element->strawYPos(strawNum);
286 double z = element->strawZPos(strawNum);
287 double r = sqrt(x*x+y*y);
288 double phi = atan2(y,x);
289 cout << "strawNum = " << strawNum << ", "
290 << "x = " << x << ", "
291 << "y = " << y << ", "
292 << "z = " << z << ", "
293 << "r = " << r << ", "
294 << "phi = " << phi << ", "
295 << "length = " << element->strawLength()
296 << endl;
297
298
299}
virtual const double & strawLength() const override final
Get the length of the straws (active length):

◆ printEndcapStraw()

void ReadTRT_DetectorElements::printEndcapStraw ( const InDetDD::TRT_EndcapElement * element,
const unsigned int strawNum )

Definition at line 302 of file ReadTRT_DetectorElements.cxx.

303{
304 // It is recommended to use the methods in printStraw() rather than the ones here
305
306 if (strawNum >= element->nStraws()) {
307 cout << "Straw number out of range:" << strawNum << " >= " << element->nStraws() << endl;
308 return;
309 }
310
311 double phiStart = element->getDescriptor()->startPhi();
312 double pitch = element->getDescriptor()->strawPitch();
313 double phi = phiStart + strawNum*pitch;
314 phi = atan2(sin(phi), cos(phi)); // Get phi b/n -pi and pi.
315 double z = (element->transform() * origin).z();
316 cout << "strawNum = " << strawNum << ", "
317 << "phiStart = " << phiStart << ", "
318 << "pitch = " << pitch << ", "
319 << "z = " << z << ", "
320 << "r = " << element->getDescriptor()->innerRadius() + 0.5 * element->getDescriptor()->strawLength() << ", "
321 << "phi = " << phi << ", "
322 << "length = " << element->getDescriptor()->strawLength()
323 << endl;
324
325}

◆ printStraw()

void ReadTRT_DetectorElements::printStraw ( const InDetDD::TRT_BaseElement * element,
const unsigned int strawNum )

Definition at line 330 of file ReadTRT_DetectorElements.cxx.

331{
332 if (strawNum >= element->nStraws()) {
333 cout << "Straw number out of range:" << strawNum << " >= " << element->nStraws() << endl;
334 return;
335 }
336
337 const Amg::Transform3D& transform = element->strawTransform(strawNum);
338 Amg::Vector3D strawCenter = transform * origin;
339 cout << "strawNum = " << strawNum << ", "
340 << "x = " << strawCenter.x() << ", "
341 << "y = " << strawCenter.y() << ", "
342 << "z = " << strawCenter.z() << ", "
343 << "r = " << strawCenter.perp() << ", "
344 << "phi = " << strawCenter.phi() << ", "
345 << "length = " << element->strawLength() << ", "
346 << "localAxis = " << transform * Amg::Vector3D(0,0,1)
347 << endl;
348}
virtual const double & strawLength() const =0
Active straw length.

◆ 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< Algorithm > >::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< Algorithm > >::renounceArray ( SG::VarHandleKeyArray & handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364 {
366 }

◆ sysInitialize()

StatusCode AthAlgorithm::sysInitialize ( )
overridevirtualinherited

Override sysInitialize.

Override sysInitialize from the base class.

Loop through all output handles, and if they're WriteCondHandles, automatically register them and this Algorithm with the CondSvc

Scan through all outputHandles, and if they're WriteCondHandles, register them with the CondSvc

Reimplemented from AthCommonDataStore< AthCommonMsg< Algorithm > >.

Reimplemented in AthAnalysisAlgorithm, AthFilterAlgorithm, AthHistogramAlgorithm, and PyAthena::Alg.

Definition at line 66 of file AthAlgorithm.cxx.

66 {
68
69 if (sc.isFailure()) {
70 return sc;
71 }
72 ServiceHandle<ICondSvc> cs("CondSvc",name());
73 for (auto h : outputHandles()) {
74 if (h->isCondition() && h->mode() == Gaudi::DataHandle::Writer) {
75 // do this inside the loop so we don't create the CondSvc until needed
76 if ( cs.retrieve().isFailure() ) {
77 ATH_MSG_WARNING("no CondSvc found: won't autoreg WriteCondHandles");
78 return StatusCode::SUCCESS;
79 }
80 if (cs->regHandle(this,*h).isFailure()) {
81 sc = StatusCode::FAILURE;
82 ATH_MSG_ERROR("unable to register WriteCondHandle " << h->fullKey()
83 << " with CondSvc");
84 }
85 }
86 }
87 return sc;
88}
#define ATH_MSG_ERROR(x)
#define ATH_MSG_WARNING(x)
virtual StatusCode sysInitialize() override
Override sysInitialize.
AthCommonDataStore(const std::string &name, T... args)
virtual std::vector< Gaudi::DataHandle * > outputHandles() const override

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< Algorithm > >::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< Algorithm > >::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< Algorithm > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_doExec

bool ReadTRT_DetectorElements::m_doExec
private

Definition at line 63 of file ReadTRT_DetectorElements.h.

◆ m_doInit

bool ReadTRT_DetectorElements::m_doInit
private

Definition at line 62 of file ReadTRT_DetectorElements.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< Algorithm > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_extendedExtraObjects

DataObjIDColl AthAlgorithm::m_extendedExtraObjects
privateinherited

Definition at line 79 of file AthAlgorithm.h.

◆ m_first

bool ReadTRT_DetectorElements::m_first
private

Definition at line 69 of file ReadTRT_DetectorElements.h.

◆ m_idHelper

const TRT_ID* ReadTRT_DetectorElements::m_idHelper
private

Definition at line 66 of file ReadTRT_DetectorElements.h.

◆ m_manager

const InDetDD::TRT_DetectorManager* ReadTRT_DetectorElements::m_manager
private

Definition at line 65 of file ReadTRT_DetectorElements.h.

◆ m_managerName

std::string ReadTRT_DetectorElements::m_managerName
private

Definition at line 61 of file ReadTRT_DetectorElements.h.

◆ m_maxdiff

double ReadTRT_DetectorElements::m_maxdiff
private

Definition at line 68 of file ReadTRT_DetectorElements.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< Algorithm > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< Algorithm > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


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