ATLAS Offline Software
Loading...
Searching...
No Matches
SGdebug Namespace Reference

Functions

std::string aux_var_name (SG::auxid_t id)
 Return the name corresponding to a given aux id.
void print_aux_var_name (SG::auxid_t id)
 Print the name corresponding to a given aux id.
void print_aux_vars (const SG::auxid_set_t &auxids, const SG::auxid_set_t &decors, std::ostream &os)
 Print the list of aux variables in a set.
void print_aux_vars (const SG::auxid_set_t &auxids)
 Print the list of aux variables in a set.
void print_aux_vars (const SG::IConstAuxStore &store, std::ostream &os)
 Print the list of aux variables handled by a store.
void print_aux_vars (const SG::IConstAuxStore &store)
 Print the list of aux variables handled by a store.
void print_aux_vars (const SG::IConstAuxStore *store)
 Print the list of aux variables handled by a store.
void print_aux_vars (const SG::AuxVectorData &vecvec, std::ostream &os)
 Print the list of aux variables associated with a container.
void print_aux_vars (const SG::AuxVectorData &vecvec)
 Print the list of aux variables associated with a container.
void print_aux_vars (const SG::AuxVectorData *vecvec)
 Print the list of aux variables associated with a container.
void print_aux_vars (const SG::AuxElement &elt)
 Print the list of aux variables associated with an element.
void print_aux_vars (const SG::AuxElement *elt)
 Print the list of aux variables associated with an element.
std::string aux_var_as_string (SG::auxid_t auxid, const void *p, size_t i)
 Convert an aux variable to a string.
void dump_aux_vars (std::ostream &os, const SG::IConstAuxStore &store, size_t i)
 Dump aux variables from a store for a single element.
void dump_aux_vars (const SG::IConstAuxStore &store, size_t i)
 Dump aux variables from a store for a single element (to cout).
void dump_aux_vars (const SG::IConstAuxStore *store, size_t i)
 Dump aux variables from a store for a single element.
void dump_aux_vars (const SG::IConstAuxStore &store)
 Dump aux variables from a store for all elements.
void dump_aux_vars (const SG::IConstAuxStore *store)
 Dump aux variables from a store for all elements.
void dump_aux_vars (const SG::AuxVectorData &vecvec, size_t i)
 Dump aux variables from a vector for a single element.
void dump_aux_vars (const SG::AuxVectorData *vecvec, size_t i)
 Dump aux variables from a vector for a single element.
void dump_aux_vars (const SG::AuxVectorData &vecvec)
 Dump aux variables from a vector for all elements.
void dump_aux_vars (const SG::AuxVectorData *vecvec)
 Dump aux variables from a vector for all elements.
void dump_aux_vars (const SG::AuxElement &elt)
 Dump aux variables for an element.
void dump_aux_vars (const SG::AuxElement *elt)
 Dump aux variables for an element.

Function Documentation

◆ aux_var_as_string()

std::string SGdebug::aux_var_as_string ( SG::auxid_t auxid,
const void * p,
size_t i )

Convert an aux variable to a string.

Parameters
auxidThe id of the variable.
pPointer to the location of the variable.
iIndex of the element being dumped.

Definition at line 302 of file Control/AthContainers/Root/debug.cxx.

303{
304 if (!p) {
305 return "(null)";
306 }
307
308 std::ostringstream os;
309
311 const std::type_info* ti = r.getType(auxid);
312#define CONVERT(T) if (ti == &typeid(T) || strcmp(ti->name(), typeid(T).name())==0) convert (os, *reinterpret_cast<const T*>(p)); else
313#define CONVERT1(T) CONVERT(T) CONVERT(std::vector<T>)
314 CONVERT1 (int)
315 CONVERT1 (unsigned int)
316 CONVERT1 (short)
317 CONVERT1 (unsigned short)
318 CONVERT1 (char)
319 CONVERT1 (unsigned char)
320 CONVERT1 (long)
321 CONVERT1 (unsigned long)
322 CONVERT1 (long long)
323 CONVERT1 (unsigned long long)
324 CONVERT1 (float)
325 CONVERT1 (double)
326 CONVERT1 (bool)
327 CONVERT1 (std::string)
328 //else
329 {
330 std::string tiname = AthContainers_detail::typeinfoName(*ti);
331 if (tiname.starts_with ("SG::JaggedVecElt<")) {
332 convert (os, *reinterpret_cast<const SG::JaggedVecEltBase*>(p), i);
333 }
334 else if (tiname.starts_with ("DataLink<")) {
335 convert (os, *reinterpret_cast<const DataLinkBase*>(p));
336 }
337 else if (tiname.starts_with ("ElementLink<")) {
338 convert (os, *reinterpret_cast<const ElementLinkBase*>(p));
339 }
340 else if (tiname.starts_with ("SG::PackedLink<")) {
341 convert (os, *reinterpret_cast<const SG::PackedLinkBase*>(p));
342 }
343 else if (tiname.starts_with ("std::vector<SG::PackedLink<")) {
344 convert (os, *reinterpret_cast<const std::vector<SG::PackedLinkBase>*>(p));
345 }
346 else {
347 std::print (os, "<??? {}>", tiname);
348 }
349 }
350 return os.str();
351}
#define CONVERT1(T)
Handle mappings between names and auxid_t.
static AuxTypeRegistry & instance()
Return the singleton registry instance.
Describe one element of a jagged vector (base class).
int r
Definition globals.cxx:22
std::unique_ptr< MVAUtils::BDT > convert(TMVA::MethodBDT *bdt, bool isRegression=true, bool useYesNoLeaf=false)

◆ aux_var_name()

std::string SGdebug::aux_var_name ( SG::auxid_t id)

Return the name corresponding to a given aux id.

Parameters
idThe aux id to look up.

Definition at line 38 of file Control/AthContainers/Root/debug.cxx.

39{
41 return reg.getClassName(id) + "::" + reg.getName(id);
42}

◆ dump_aux_vars() [1/11]

void SGdebug::dump_aux_vars ( const SG::AuxElement & elt)

Dump aux variables for an element.

Parameters
eltThe element from which to dump.

Definition at line 497 of file Control/AthContainers/Root/debug.cxx.

498{
499 const SG::AuxVectorData* cont = elt.container();
500 if (cont)
501 dump_aux_vars (*cont, elt.index());
502}
Manage lookup of vectors of auxiliary data.
void dump_aux_vars(std::ostream &os, const SG::IConstAuxStore &store, size_t i)
Dump aux variables from a store for a single element.

◆ dump_aux_vars() [2/11]

void SGdebug::dump_aux_vars ( const SG::AuxElement * elt)

Dump aux variables for an element.

Parameters
eltThe element from which to dump.

Definition at line 509 of file Control/AthContainers/Root/debug.cxx.

510{
511 dump_aux_vars (*elt);
512}

◆ dump_aux_vars() [3/11]

void SGdebug::dump_aux_vars ( const SG::AuxVectorData & vec)

Dump aux variables from a vector for all elements.

Parameters
vecThe vector from which to dump.

Definition at line 475 of file Control/AthContainers/Root/debug.cxx.

476{
477 const SG::IConstAuxStore* store = vec.getConstStore();
478 if (store)
479 dump_aux_vars (*store);
480}
std::vector< size_t > vec

◆ dump_aux_vars() [4/11]

void SGdebug::dump_aux_vars ( const SG::AuxVectorData & vec,
size_t i )

Dump aux variables from a vector for a single element.

Parameters
vecThe vector from which to dump.
iThe index of the element to dump.

Definition at line 452 of file Control/AthContainers/Root/debug.cxx.

453{
454 const SG::IConstAuxStore* store = vec.getConstStore();
455 if (store)
456 dump_aux_vars (*store, i);
457}

◆ dump_aux_vars() [5/11]

void SGdebug::dump_aux_vars ( const SG::AuxVectorData * vec)

Dump aux variables from a vector for all elements.

Parameters
vecThe vector from which to dump.

Definition at line 487 of file Control/AthContainers/Root/debug.cxx.

488{
490}

◆ dump_aux_vars() [6/11]

void SGdebug::dump_aux_vars ( const SG::AuxVectorData * vec,
size_t i )

Dump aux variables from a vector for a single element.

Parameters
vecThe vector from which to dump.
iThe index of the element to dump.

Definition at line 465 of file Control/AthContainers/Root/debug.cxx.

466{
467 dump_aux_vars (*vec, i);
468}

◆ dump_aux_vars() [7/11]

void SGdebug::dump_aux_vars ( const SG::IConstAuxStore & store)

Dump aux variables from a store for all elements.

Parameters
storeThe store from which to dump.

Definition at line 427 of file Control/AthContainers/Root/debug.cxx.

428{
429 size_t sz = store.size();
430 for (size_t i = 0; i < sz; i++) {
431 std::println ("=== Element {}", i);
432 dump_aux_vars (store, i);
433 }
434}
static Double_t sz

◆ dump_aux_vars() [8/11]

void SGdebug::dump_aux_vars ( const SG::IConstAuxStore & store,
size_t i )

Dump aux variables from a store for a single element (to cout).

Parameters
storeThe store from which to dump.
iThe index of the element to dump.

Definition at line 406 of file Control/AthContainers/Root/debug.cxx.

407{
408 dump_aux_vars (std::cout, store, i);
409}

◆ dump_aux_vars() [9/11]

void SGdebug::dump_aux_vars ( const SG::IConstAuxStore * store)

Dump aux variables from a store for all elements.

Parameters
storeThe store from which to dump.

Definition at line 441 of file Control/AthContainers/Root/debug.cxx.

442{
443 dump_aux_vars (*store);
444}

◆ dump_aux_vars() [10/11]

void SGdebug::dump_aux_vars ( const SG::IConstAuxStore * store,
size_t i )

Dump aux variables from a store for a single element.

Parameters
storeThe store from which to dump.
iThe index of the element to dump.

Definition at line 417 of file Control/AthContainers/Root/debug.cxx.

418{
419 dump_aux_vars (*store, i);
420}

◆ dump_aux_vars() [11/11]

void SGdebug::dump_aux_vars ( std::ostream & os,
const SG::IConstAuxStore & store,
size_t i )

Dump aux variables from a store for a single element.

Parameters
osThe stream to which to write.
storeThe store from which to dump.
iThe index of the element to dump.

Definition at line 360 of file Control/AthContainers/Root/debug.cxx.

361{
362 if (i >= store.size()) return;
364 const SG::auxid_set_t& ids = store.getAuxIDs();
365 std::vector<AuxVarSort> vars (ids.begin(), ids.end());
366 std::sort (vars.begin(), vars.end());
367 for (const AuxVarSort& v : vars) {
368 if (reg.isLinked (v.id)) continue;
369 const void* pbeg = store.getData (v.id);
370 size_t eltsz = reg.getEltSize (v.id);
371 const char* p = reinterpret_cast<const char*>(pbeg) + eltsz*i;
372 std::println (os, "{} {}",
373 v.name, aux_var_as_string (v.id, p, i));
374 SG::auxid_t linked_id = reg.linkedVariable (v.id);
375 if (linked_id != SG::null_auxid) {
376 std::print (os, " linked: {} ", aux_var_name (linked_id));
377 const SG::IAuxTypeVector* lv = store.linkedVector (v.id);
378 if (!lv) {
379 std::println (os, "(missing linkedVector)");
380 continue;
381 }
382 size_t sz = lv->size();
383 const char* lbeg = reinterpret_cast<const char*>(lv->toPtr());
384 size_t leltsz = reg.getEltSize (linked_id);
385 std::print (os, "[");
386 bool first = true;
387 for (size_t j = 0; j < sz; j++) {
388 if (first)
389 first = false;
390 else
391 std::print (os, ", ");
392 const char* p = reinterpret_cast<const char*>(lbeg) + leltsz*j;
393 std::print (os, "{}", aux_var_as_string (linked_id, p, i));
394 }
395 std::println (os, "]");
396 }
397 }
398}
Abstract interface for manipulating vectors of arbitrary types.
virtual void * toPtr()=0
Return a pointer to the start of the vector's data.
virtual size_t size() const =0
Return the size of the vector.
A set of aux data identifiers.
Definition AuxTypes.h:47
static const auxid_t null_auxid
To signal no aux data item.
Definition AuxTypes.h:30
size_t auxid_t
Identifier for a particular aux data item.
Definition AuxTypes.h:27
std::string aux_var_name(SG::auxid_t id)
Return the name corresponding to a given aux id.
std::string aux_var_as_string(SG::auxid_t auxid, const void *p, size_t i)
Convert an aux variable to a string.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.

◆ print_aux_var_name()

void SGdebug::print_aux_var_name ( SG::auxid_t id)

Print the name corresponding to a given aux id.

Parameters
idThe aux id to print.

Definition at line 49 of file Control/AthContainers/Root/debug.cxx.

50{
51 std::println ("{}", aux_var_name(id));
52}

◆ print_aux_vars() [1/10]

void SGdebug::print_aux_vars ( const SG::AuxElement & elt)

Print the list of aux variables associated with an element.

Parameters
eltThe element to dump.

Definition at line 170 of file Control/AthContainers/Root/debug.cxx.

171{
172 print_aux_vars (elt.getAuxIDs(), elt.getDecorIDs(), std::cout);
173}
void print_aux_vars(const SG::auxid_set_t &auxids, const SG::auxid_set_t &decors, std::ostream &os)
Print the list of aux variables in a set.

◆ print_aux_vars() [2/10]

void SGdebug::print_aux_vars ( const SG::AuxElement * elt)

Print the list of aux variables associated with an element.

Parameters
eltThe element to dump.

Definition at line 180 of file Control/AthContainers/Root/debug.cxx.

181{
182 print_aux_vars (*elt);
183}

◆ print_aux_vars() [3/10]

void SGdebug::print_aux_vars ( const SG::auxid_set_t & auxids)

Print the list of aux variables in a set.

Parameters
auxidsThe set to print.

Definition at line 98 of file Control/AthContainers/Root/debug.cxx.

99{
100 print_aux_vars (auxids, SG::auxid_set_t(), std::cout);
101}

◆ print_aux_vars() [4/10]

void SGdebug::print_aux_vars ( const SG::auxid_set_t & auxids,
const SG::auxid_set_t & decors,
std::ostream & os )

Print the list of aux variables in a set.

Parameters
auxidsThe set to print.
decorsSet of decorations.
osStream to which to print.

Definition at line 66 of file Control/AthContainers/Root/debug.cxx.

69{
71 std::vector<SG::auxid_t> ids (auxids.begin(), auxids.end());
72 std::sort (ids.begin(), ids.end());
73
74 for (SG::auxid_t id : ids) {
75 std::print (os , "{} {}::{} [{}",
76 id, reg.getClassName(id), reg.getName(id), reg.getTypeName(id));
77
78 SG::AuxVarFlags flags = reg.getFlags(id);
79 if (flags & SG::AuxVarFlags::Atomic) {
80 std::print (os, " (atomic)");
81 }
82 if (flags & SG::AuxVarFlags::Linked) {
83 std::print (os, " (linked)");
84 }
85 if (decors.test (id)) {
86 std::print (os, " (decor)");
87 }
88
89 std::println (os, "]");
90 }
91}
AuxVarFlags
Additional flags to qualify an auxiliary variable.
Definition AuxTypes.h:58
@ Atomic
Mark that this variable should only be accessed atomically.
Definition AuxTypes.h:70

◆ print_aux_vars() [5/10]

void SGdebug::print_aux_vars ( const SG::AuxVectorData & vec)

Print the list of aux variables associated with a container.

Parameters
vecThe container to dump.

Definition at line 150 of file Control/AthContainers/Root/debug.cxx.

151{
152 print_aux_vars (vec, std::cout);
153}

◆ print_aux_vars() [6/10]

void SGdebug::print_aux_vars ( const SG::AuxVectorData & vec,
std::ostream & os )

Print the list of aux variables associated with a container.

Parameters
vecThe container to dump.
osStream to which to print.

Definition at line 140 of file Control/AthContainers/Root/debug.cxx.

141{
142 print_aux_vars (vec.getAuxIDs(), vec.getDecorIDs(), os);
143}

◆ print_aux_vars() [7/10]

void SGdebug::print_aux_vars ( const SG::AuxVectorData * vec)

Print the list of aux variables associated with a container.

Parameters
vecThe container to dump.

Definition at line 160 of file Control/AthContainers/Root/debug.cxx.

161{
163}

◆ print_aux_vars() [8/10]

void SGdebug::print_aux_vars ( const SG::IConstAuxStore & store)

Print the list of aux variables handled by a store.

Parameters
storeThe store to dump.

Definition at line 119 of file Control/AthContainers/Root/debug.cxx.

120{
121 print_aux_vars (store, std::cout);
122}

◆ print_aux_vars() [9/10]

void SGdebug::print_aux_vars ( const SG::IConstAuxStore & store,
std::ostream & os )

Print the list of aux variables handled by a store.

Parameters
storeThe store to dump.
osStream to which to print.
storeThe store to dump.
auxidsThe set to print.

Definition at line 109 of file Control/AthContainers/Root/debug.cxx.

110{
111 print_aux_vars (store.getAuxIDs(), store.getDecorIDs(), os);
112}

◆ print_aux_vars() [10/10]

void SGdebug::print_aux_vars ( const SG::IConstAuxStore * store)

Print the list of aux variables handled by a store.

Parameters
storeThe store to dump.

Definition at line 129 of file Control/AthContainers/Root/debug.cxx.

130{
131 print_aux_vars (*store);
132}