Skip to content

Commit

Permalink
Fix compiler warnings related to lossy conversion and new name for RO…
Browse files Browse the repository at this point in the history
…OTWriter (#46)

* Fix compiler warnings related to double - float

* Remove warning that no longer applies

* Switch to ROOTWriter from deprecated ROOTFrameWriter

---------

Co-authored-by: jmcarcell <[email protected]>
Co-authored-by: tmadlener <[email protected]>
  • Loading branch information
3 people authored Feb 7, 2024
1 parent f2805f4 commit c4e9c76
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
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());
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

0 comments on commit c4e9c76

Please sign in to comment.