29 #include "AthLinks/ElementLink.h"
32 #include "GaudiKernel/System.h"
46 ISvcLocator *pSvcLocator)
59 return StatusCode::SUCCESS;
66 void dumpAuxItem (std::ostream&
ost,
71 const std::type_info* ti =
r.getType(auxid);
72 std::string
head =
r.getName(auxid) +
": ";
73 if (ti == &
typeid(
int))
74 ost <<
head <<
c.getData<
int> (auxid,
i) <<
"; ";
75 else if (ti == &
typeid(
unsigned int))
76 ost <<
head <<
c.getData<
unsigned int> (auxid,
i) <<
"; ";
77 else if (ti == &
typeid(
float))
82 ost <<
head <<
el.dataID() <<
"[" <<
el.index() <<
"]; ";
85 else if (ti == &
typeid(SG::PackedElement<unsigned int>))
86 ost <<
head <<
c.getData<SG::PackedElement<unsigned int> > (auxid,
i) <<
"; ";
87 else if (ti == &
typeid(SG::PackedElement<float>))
88 ost <<
head <<
c.getData<SG::PackedElement<float> > (auxid,
i) <<
"; ";
90 else if (ti == &
typeid(std::vector<unsigned int>)) {
92 for (
auto ii :
c.getData<std::vector<unsigned int> > (auxid,
i))
96 else if (ti == &
typeid(std::vector<int>)) {
98 for (
auto ii :
c.getData<std::vector<int> > (auxid,
i))
102 else if (ti == &
typeid(std::vector<float>) ||
103 strcmp (ti->name(),
typeid(std::vector<float>).name()) == 0)
106 for (
auto ii :
c.getData<std::vector<float> > (auxid,
i))
111 else if (ti == &
typeid(SG::PackedElement<std::vector<unsigned int> >)) {
113 for (
auto ii :
c.getData<SG::PackedElement<std::vector<unsigned int> > > (auxid,
i))
117 else if (ti == &
typeid(SG::PackedElement<std::vector<int> >)) {
119 for (
auto ii :
c.getData<SG::PackedElement<std::vector<int> > > (auxid,
i))
123 else if (ti == &
typeid(SG::PackedElement<std::vector<float> >)) {
125 for (
auto ii :
c.getData<SG::PackedElement<std::vector<float> > > (auxid,
i))
131 ost <<
head <<
"xxx " << ti->name() <<
"; ";
140 std::map<std::string, SG::auxid_t> auxid_map;
142 auxid_map[
r.getName(auxid)] = auxid;
148 std::map<std::string, SG::auxid_t> get_map (
const SG::AuxElement* elt)
154 void dumpelt (std::ostream&
ost,
157 const std::map<std::string, SG::auxid_t>& auxid_map)
159 for (
const auto&
m : auxid_map)
160 dumpAuxItem (
ost,
m.second, *cont,
index);
166 void dumpobj (std::ostream&
ost,
168 const std::map<std::string, SG::auxid_t>& auxid_map)
170 for (
size_t i = 0;
i <
obj->size();
i++) {
172 if (!
obj->hasStore()) {
174 const auto* elt =
obj->at(
i);
175 dumpelt (
ost, elt->container(), elt->index(), auxid_map);
178 dumpelt (
ost,
obj,
i, auxid_map);
183 void dumpobj (std::ostream&
ost,
185 const std::map<std::string, SG::auxid_t>& auxid_map)
188 dumpelt (
ost, cont, 0, auxid_map);
194 for (
size_t i = 0;
i < from.
size();
i++) {
195 to.push_back (
new C);
196 *
to.back() = *from[
i];
203 for (
size_t i = 0;
i < from.
size();
i++) {
204 to.push_back (
new H);
205 *
to.back() = *from[
i];
227 template <
class OBJ,
class AUX>
231 const OBJ*
obj =
nullptr;
236 std::map<std::string, SG::auxid_t> auxid_map = get_map (
obj);
237 std::ostringstream ost1;
238 ost1 <<
key <<
" types: ";
239 for (
const auto&
m : auxid_map)
240 ost1 <<
r.getName(
m.second) <<
"/"
241 << System::typeinfoName (*
r.getType(
m.second)) <<
" ";
244 std::ostringstream ost2;
245 dumpobj (ost2,
obj, auxid_map);
252 auto objnew = std::make_unique<OBJ>();
253 auto store = std::make_unique<AUX>();
254 objnew->setStore (
store.get());
259 return StatusCode::SUCCESS;
267 const OBJ*
obj =
nullptr;
271 std::map<std::string, SG::auxid_t> auxid_map = get_map (
obj->front());
273 std::ostringstream
ost;
274 dumpobj (
ost,
obj, auxid_map);
282 return StatusCode::SUCCESS;
294 CHECK(( testit<CVec, CAuxContainer> (
"cvec") ));
295 CHECK(( testit<C, CInfoAuxContainer> (
"cinfo") ));
296 CHECK(( testit<CVec, CTrigAuxContainer> (
"ctrig") ));
297 CHECK(( testit<CVecWithData, CAuxContainer> (
"cvecWD") ));
298 CHECK(( testit_view<CView> (
"cview") ));
299 CHECK(( testit<HVec, HAuxContainer> (
"hvec") ));
300 CHECK(( testit_view<HView> (
"hview") ));
302 return StatusCode::SUCCESS;
311 return StatusCode::SUCCESS;