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 303 of file Control/AthContainers/Root/debug.cxx.

304{
305 if (!p) {
306 return "(null)";
307 }
308
309 std::ostringstream os;
310
312 const std::type_info* ti = r.getType(auxid);
313#define CONVERT(T) if (ti == &typeid(T) || strcmp(ti->name(), typeid(T).name())==0) convert (os, *reinterpret_cast<const T*>(p)); else
314#define CONVERT1(T) CONVERT(T) CONVERT(std::vector<T>)
315 CONVERT1 (int)
316 CONVERT1 (unsigned int)
317 CONVERT1 (short)
318 CONVERT1 (unsigned short)
319 CONVERT1 (char)
320 CONVERT1 (unsigned char)
321 CONVERT1 (long)
322 CONVERT1 (unsigned long)
323 CONVERT1 (long long)
324 CONVERT1 (unsigned long long)
325 CONVERT1 (float)
326 CONVERT1 (double)
327 CONVERT1 (bool)
328 CONVERT1 (std::string)
329 //else
330 {
331 std::string tiname = AthContainers_detail::typeinfoName(*ti);
332 if (tiname.starts_with ("SG::JaggedVecElt<")) {
333 convert (os, *reinterpret_cast<const SG::JaggedVecEltBase*>(p), i);
334 }
335 else if (tiname.starts_with ("DataLink<")) {
336 convert (os, *reinterpret_cast<const DataLinkBase*>(p));
337 }
338 else if (tiname.starts_with ("ElementLink<")) {
339 convert (os, *reinterpret_cast<const ElementLinkBase*>(p));
340 }
341 else if (tiname.starts_with ("SG::PackedLink<")) {
342 convert (os, *reinterpret_cast<const SG::PackedLinkBase*>(p));
343 }
344 else if (tiname.starts_with ("std::vector<SG::PackedLink<")) {
345 convert (os, *reinterpret_cast<const std::vector<SG::PackedLinkBase>*>(p));
346 }
347 else {
348 std::print (os, "<??? {}>", tiname);
349 }
350 }
351 return os.str();
352}
#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 39 of file Control/AthContainers/Root/debug.cxx.

40{
42 return reg.getClassName(id) + "::" + reg.getName(id);
43}

◆ 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 498 of file Control/AthContainers/Root/debug.cxx.

499{
500 const SG::AuxVectorData* cont = elt.container();
501 if (cont)
502 dump_aux_vars (*cont, elt.index());
503}
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 510 of file Control/AthContainers/Root/debug.cxx.

511{
512 dump_aux_vars (*elt);
513}

◆ 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 476 of file Control/AthContainers/Root/debug.cxx.

477{
478 const SG::IConstAuxStore* store = vec.getConstStore();
479 if (store)
480 dump_aux_vars (*store);
481}
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 453 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 488 of file Control/AthContainers/Root/debug.cxx.

489{
491}

◆ 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 466 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 428 of file Control/AthContainers/Root/debug.cxx.

429{
430 size_t sz = store.size();
431 for (size_t i = 0; i < sz; i++) {
432 std::println ("=== Element {}", i);
433 dump_aux_vars (store, i);
434 }
435}
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 407 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 442 of file Control/AthContainers/Root/debug.cxx.

443{
444 dump_aux_vars (*store);
445}

◆ 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 418 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 361 of file Control/AthContainers/Root/debug.cxx.

362{
363 if (i >= store.size()) return;
365 const SG::auxid_set_t& ids = store.getAuxIDs();
366 std::vector<AuxVarSort> vars (ids.begin(), ids.end());
367 std::sort (vars.begin(), vars.end());
368 for (const AuxVarSort& v : vars) {
369 if (reg.isLinked (v.id)) continue;
370 const void* pbeg = store.getData (v.id);
371 size_t eltsz = reg.getEltSize (v.id);
372 const char* p = reinterpret_cast<const char*>(pbeg) + eltsz*i;
373 std::println (os, "{} {}",
374 v.name, aux_var_as_string (v.id, p, i));
375 SG::auxid_t linked_id = reg.linkedVariable (v.id);
376 if (linked_id != SG::null_auxid) {
377 std::print (os, " linked: {} ", aux_var_name (linked_id));
378 const SG::IAuxTypeVector* lv = store.linkedVector (v.id);
379 if (!lv) {
380 std::println (os, "(missing linkedVector)");
381 continue;
382 }
383 size_t sz = lv->size();
384 const char* lbeg = reinterpret_cast<const char*>(lv->toPtr());
385 size_t leltsz = reg.getEltSize (linked_id);
386 std::print (os, "[");
387 bool first = true;
388 for (size_t j = 0; j < sz; j++) {
389 if (first)
390 first = false;
391 else
392 std::print (os, ", ");
393 const char* p = reinterpret_cast<const char*>(lbeg) + leltsz*j;
394 std::print (os, "{}", aux_var_as_string (linked_id, p, i));
395 }
396 std::println (os, "]");
397 }
398 }
399}
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 50 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 171 of file Control/AthContainers/Root/debug.cxx.

172{
173 print_aux_vars (elt.getAuxIDs(), elt.getDecorIDs(), std::cout);
174}
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 181 of file Control/AthContainers/Root/debug.cxx.

182{
183 print_aux_vars (*elt);
184}

◆ 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 99 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 67 of file Control/AthContainers/Root/debug.cxx.

70{
72 std::vector<SG::auxid_t> ids (auxids.begin(), auxids.end());
73 std::sort (ids.begin(), ids.end());
74
75 for (SG::auxid_t id : ids) {
76 std::print (os , "{} {}::{} [{}",
77 id, reg.getClassName(id), reg.getName(id), reg.getTypeName(id));
78
79 SG::AuxVarFlags flags = reg.getFlags(id);
80 if (flags & SG::AuxVarFlags::Atomic) {
81 std::print (os, " (atomic)");
82 }
83 if (flags & SG::AuxVarFlags::Linked) {
84 std::print (os, " (linked)");
85 }
86 if (decors.test (id)) {
87 std::print (os, " (decor)");
88 }
89
90 std::println (os, "]");
91 }
92}
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 151 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 141 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 161 of file Control/AthContainers/Root/debug.cxx.

162{
164}

◆ 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 120 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 110 of file Control/AthContainers/Root/debug.cxx.

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

◆ 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 130 of file Control/AthContainers/Root/debug.cxx.

131{
132 print_aux_vars (*store);
133}