2#include "datamodel/EventInfoCollection.h"
3#include "datamodel/ExampleClusterCollection.h"
4#include "datamodel/ExampleHitCollection.h"
5#include "datamodel/ExampleMCCollection.h"
6#include "datamodel/ExampleReferencingTypeCollection.h"
7#include "datamodel/ExampleWithARelationCollection.h"
8#include "datamodel/ExampleWithComponentCollection.h"
9#include "datamodel/ExampleWithNamespaceCollection.h"
10#include "datamodel/ExampleWithOneRelationCollection.h"
11#include "datamodel/ExampleWithVectorMemberCollection.h"
23 std::cout <<
"start processing" << std::endl;
28 auto& info = store.create<EventInfoCollection>(
"info");
29 auto& mcps = store.create<ExampleMCCollection>(
"mcparticles");
30 auto& hits = store.create<ExampleHitCollection>(
"hits");
31 auto& clusters = store.create<ExampleClusterCollection>(
"clusters");
32 auto& refs = store.create<ExampleReferencingTypeCollection>(
"refs");
33 auto& refs2 = store.create<ExampleReferencingTypeCollection>(
"refs2");
34 auto& comps = store.create<ExampleWithComponentCollection>(
"Component");
35 auto& oneRels = store.create<ExampleWithOneRelationCollection>(
"OneRelation");
36 auto& vecs = store.create<ExampleWithVectorMemberCollection>(
"WithVectorMember");
37 auto& namesps = store.create<ex42::ExampleWithNamespaceCollection>(
"WithNamespaceMember");
38 auto& namesprels = store.create<ex42::ExampleWithARelationCollection>(
"WithNamespaceRelation");
39 writer.registerForWrite<EventInfoCollection>(
"info");
40 writer.registerForWrite<ExampleMCCollection>(
"mcparticles");
41 writer.registerForWrite<ExampleHitCollection>(
"hits");
42 writer.registerForWrite<ExampleClusterCollection>(
"clusters");
43 writer.registerForWrite<ExampleReferencingTypeCollection>(
"refs");
44 writer.registerForWrite<ExampleReferencingTypeCollection>(
"refs2");
45 writer.registerForWrite<ExampleWithComponentCollection>(
"Component");
46 writer.registerForWrite<ExampleWithOneRelationCollection>(
"OneRelation");
47 writer.registerForWrite<ExampleWithVectorMemberCollection>(
"WithVectorMember");
48 writer.registerForWrite<ex42::ExampleWithNamespaceCollection>(
"WithNamespaceMember");
49 writer.registerForWrite<ex42::ExampleWithARelationCollection>(
"WithNamespaceRelation");
53 for (
unsigned i = 0; i < nevents; ++i) {
55 std::cout <<
"processing event " << i << std::endl;
58 auto item1 = MutableEventInfo();
60 info.push_back(item1);
61 auto hit1 = ExampleHit(0xbad, 0., 0., 0., 23. + i);
62 auto hit2 = ExampleHit(0xcaffee, 1., 0., 0., 12. + i);
68 auto mcp0 = ExampleMC();
69 auto mcp1 = ExampleMC();
70 auto mcp2 = ExampleMC();
71 auto mcp3 = ExampleMC();
72 auto mcp4 = ExampleMC();
73 auto mcp5 = ExampleMC();
74 auto mcp6 = ExampleMC();
75 auto mcp7 = ExampleMC();
76 auto mcp8 = ExampleMC();
77 auto mcp9 = ExampleMC();
93 p.adddaughters(mcps[2]);
94 p.adddaughters(mcps[3]);
95 p.adddaughters(mcps[4]);
96 p.adddaughters(mcps[5]);
98 p.adddaughters(mcps[2]);
99 p.adddaughters(mcps[3]);
100 p.adddaughters(mcps[4]);
101 p.adddaughters(mcps[5]);
103 p.adddaughters(mcps[6]);
104 p.adddaughters(mcps[7]);
105 p.adddaughters(mcps[8]);
106 p.adddaughters(mcps[9]);
108 p.adddaughters(mcps[6]);
109 p.adddaughters(mcps[7]);
110 p.adddaughters(mcps[8]);
111 p.adddaughters(mcps[9]);
114 for (
unsigned j = 0, N = mcps.size(); j < N; ++j) {
116 for (
auto it = p.daughters_begin(), end = p.daughters_end(); it != end; ++it) {
117 int dIndex = it->getObjectID().index;
118 auto d = mcps[dIndex];
123 for (
auto _p : mcps) {
124 std::cout <<
" particle " << _p.getObjectID().index <<
" has daughters: ";
125 for (
auto it = _p.daughters_begin(), end = _p.daughters_end(); it != end; ++it) {
126 std::cout <<
" " << it->getObjectID().index;
128 std::cout <<
" and parents: ";
129 for (
auto it = _p.parents_begin(), end = _p.parents_end(); it != end; ++it) {
130 std::cout <<
" " << it->getObjectID().index;
132 std::cout << std::endl;
136 auto cluster = MutableExampleCluster();
137 auto clu0 = MutableExampleCluster();
138 auto clu1 = MutableExampleCluster();
141 clu0.energy(hit1.energy());
143 clu1.energy(hit2.energy());
144 cluster.addHits(hit1);
145 cluster.addHits(hit2);
146 cluster.energy(hit1.energy() + hit2.energy());
147 cluster.addClusters(clu0);
148 cluster.addClusters(clu1);
150 clusters.push_back(clu0);
151 clusters.push_back(clu1);
152 clusters.push_back(cluster);
154 auto ref = MutableExampleReferencingType();
157 auto ref2 = ExampleReferencingType();
158 refs2.push_back(ref2);
160 ref.addClusters(cluster);
163 auto comp = MutableExampleWithComponent();
164 comp.component().data.x = 0;
165 comp.component().data.y = 1;
166 comp.component().data.z = i;
167 comps.push_back(comp);
169 auto cyclic = MutableExampleReferencingType();
170 cyclic.addRefs(cyclic);
171 refs.push_back(cyclic);
173 auto oneRel = MutableExampleWithOneRelation();
174 oneRel.cluster(cluster);
175 oneRels.push_back(oneRel);
178 auto oneRelEmpty = ExampleWithOneRelation();
179 oneRels.push_back(oneRelEmpty);
181 auto vec = MutableExampleWithVectorMember();
186 auto namesp = ex42::MutableExampleWithNamespace();
187 namesp.component().x = 1;
188 namesp.component().y = i;
189 namesps.push_back(namesp);
191 auto rel = ex42::MutableExampleWithARelation();
193 namesprels.push_back(rel);
196 store.clearCollections();