Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix compiler warnings related to lossy conversion and new name for ROOTWriter #46

Merged
merged 3 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -672,10 +672,9 @@ namespace EDM4hep2LCIOConv {
lcio_mcp->setEndpoint(endpoint);
double momentum[3] = {edm_mcp.getMomentum()[0], edm_mcp.getMomentum()[1], edm_mcp.getMomentum()[2]};
lcio_mcp->setMomentum(momentum);
float momentumEndpoint[3] = {
double momentumEndpoint[3] = {
edm_mcp.getMomentumAtEndpoint()[0], edm_mcp.getMomentumAtEndpoint()[1], edm_mcp.getMomentumAtEndpoint()[2]};
lcio_mcp->setMomentumAtEndpoint(momentumEndpoint);
#warning "double to float"
lcio_mcp->setMass(edm_mcp.getMass());
lcio_mcp->setCharge(edm_mcp.getCharge());
float spin[3] = {edm_mcp.getSpin()[0], edm_mcp.getSpin()[1], edm_mcp.getSpin()[2]};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ namespace LCIO2EDM4hepConv {
lval.setColorFlow(edm4hep::Vector2i(rval->getColorFlow()));
lval.setVertex(edm4hep::Vector3d(rval->getVertex()));
lval.setEndpoint(edm4hep::Vector3d(rval->getEndpoint()));
lval.setMomentum(Vector3fFrom(rval->getMomentum()));
lval.setMomentumAtEndpoint(Vector3fFrom(rval->getMomentumAtEndpoint()));
lval.setMomentum(rval->getMomentum());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we also remove the Vector3fFrom now, or is that still in use in other places?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I saw it in use in another place so I didn't remove it

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, it looks like there are more overloads. I think this one should be removable now:

inline edm4hep::Vector3f Vector3fFrom(const double* v) { return edm4hep::Vector3f(v[0], v[1], v[2]); }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is actually not due to key4hep/EDM4hep#265

lval.setMomentumAtEndpoint(rval->getMomentumAtEndpoint());

const auto [iterator, inserted] = k4EDM4hep2LcioConv::detail::mapInsert(rval, lval, mcparticlesMap);
if (!inserted) {
Expand Down
10 changes: 9 additions & 1 deletion standalone/lcio2edm4hep.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,15 @@
#include <IOIMPL/LCFactory.h>
#include <UTIL/CheckCollections.h>

#include "podio/podioVersion.h"
#if PODIO_BUILD_VERSION >= PODIO_VERSION(0, 99, 0)
#include "podio/ROOTWriter.h"
#else
#include "podio/ROOTFrameWriter.h"
namespace podio {
using ROOTWriter = podio::ROOTFrameWriter;
}
#endif

#include <fstream>
#include <iostream>
Expand Down Expand Up @@ -156,7 +164,7 @@ int main(int argc, char* argv[])
std::cout << "Number of events in file: " << lcreader->getNumberOfEvents() << '\n';
std::cout << "Number of runs in file: " << lcreader->getNumberOfRuns() << '\n';

podio::ROOTFrameWriter writer(args.outputFile);
podio::ROOTWriter writer(args.outputFile);

for (auto j = 0u; j < lcreader->getNumberOfRuns(); ++j) {
if (j % 1 == 0) {
Expand Down
Loading