Skip to content

Commit

Permalink
Update Podio examples to only use mutable objs
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwbrei committed May 2, 2024
1 parent ba05cfa commit 40376ef
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
20 changes: 10 additions & 10 deletions src/examples/PodioExample/PodioExample.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@

void create_hits_file() {

EventInfo eventinfo1(7, 0, 22);
MutableEventInfo eventinfo1(7, 0, 22);
EventInfoCollection eventinfos1;
eventinfos1.push_back(eventinfo1);

ExampleHitCollection hits1;
hits1.push_back(ExampleHit(22, -1, -1, 0, 100, 0));
hits1.push_back(ExampleHit(49, 1, 1, 0, 15.5, 0));
hits1.push_back(ExampleHit(47, 1, 2, 0, 0.5, 0));
hits1.push_back(ExampleHit(42, 2, 1, 0, 4.0, 0));
hits1.push_back(MutableExampleHit(22, -1, -1, 0, 100, 0));
hits1.push_back(MutableExampleHit(49, 1, 1, 0, 15.5, 0));
hits1.push_back(MutableExampleHit(47, 1, 2, 0, 0.5, 0));
hits1.push_back(MutableExampleHit(42, 2, 1, 0, 4.0, 0));

podio::Frame event1;
event1.put(std::move(hits1), "hits");
Expand All @@ -38,15 +38,15 @@ void create_hits_file() {
podio::ROOTFrameWriter writer("hits.root");
writer.writeFrame(event1, "events");

EventInfo eventinfo2(8, 0, 22);
MutableEventInfo eventinfo2(8, 0, 22);
EventInfoCollection eventinfos2;
eventinfos2.push_back(eventinfo2);

ExampleHitCollection hits2;
hits2.push_back(ExampleHit(42, 5, -5, 5, 7.6, 0));
hits2.push_back(ExampleHit(618, -3, -5, 1, 99.9, 0));
hits2.push_back(ExampleHit(27, -10, 10, 10, 22.2, 0));
hits2.push_back(ExampleHit(28, -9, 11, 10, 7.8, 0));
hits2.push_back(MutableExampleHit(42, 5, -5, 5, 7.6, 0));
hits2.push_back(MutableExampleHit(618, -3, -5, 1, 99.9, 0));
hits2.push_back(MutableExampleHit(27, -10, 10, 10, 22.2, 0));
hits2.push_back(MutableExampleHit(28, -9, 11, 10, 7.8, 0));

podio::Frame event2;
event2.put(std::move(hits2), "hits");
Expand Down
10 changes: 5 additions & 5 deletions src/examples/TimesliceExample/MyFileReader.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ struct MyFileReader : public JEventSource {
auto hits_out = std::make_unique<ExampleHitCollection>();

// ExampleHit(unsigned long long cellID, double x, double y, double z, double energy, std::uint64_t time);
hits_out->push_back(ExampleHit(event_nr, 0, 22, 22, 22, 0));
hits_out->push_back(ExampleHit(event_nr, 0, 49, 49, 49, 1));
hits_out->push_back(ExampleHit(event_nr, 0, 7.6, 7.6, 7.6, 2));
hits_out->push_back(MutableExampleHit(event_nr, 0, 22, 22, 22, 0));
hits_out->push_back(MutableExampleHit(event_nr, 0, 49, 49, 49, 1));
hits_out->push_back(MutableExampleHit(event_nr, 0, 7.6, 7.6, 7.6, 2));

LOG_DEBUG(GetLogger()) << "MySource: Emitted " << GetLevel() << " " << event.GetEventNumber() << "\n"
<< TabulateHits(hits_out.get())
Expand All @@ -41,12 +41,12 @@ struct MyFileReader : public JEventSource {
// Furnish this event with info object
if (GetLevel() == JEventLevel::Timeslice) {
TimesliceInfoCollection info;
info.push_back(TimesliceInfo(event_nr, 0)); // event nr, run nr
info.push_back(MutableTimesliceInfo(event_nr, 0)); // event nr, run nr
event.InsertCollection<TimesliceInfo>(std::move(info), "ts_info");
}
else {
EventInfoCollection info;
info.push_back(EventInfo(event_nr, 0, 0)); // event nr, timeslice nr, run nr
info.push_back(MutableEventInfo(event_nr, 0, 0)); // event nr, timeslice nr, run nr
event.InsertCollection<EventInfo>(std::move(info), "evt_info");
}
return Result::Success;
Expand Down

0 comments on commit 40376ef

Please sign in to comment.