Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kjvbrt committed Sep 19, 2023
1 parent 3483548 commit 813303d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
6 changes: 4 additions & 2 deletions analyzers/dataframe/FCCAnalyses/ReconstructedParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,17 @@ namespace ReconstructedParticle{
struct sel_type {
sel_type(const int type);
const int m_type;
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> operator() (ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in);
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>
operator()(ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in);
};

/// select ReconstructedParticles by type absolute value
/// Note: type might not correspond to PDG ID
struct sel_absType {
sel_absType(const int type);
const int m_type;
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> operator() (ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in);
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>
operator()(ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in);
};

/// select ReconstructedParticles with transverse momentum greater than a minimum value [GeV]
Expand Down
15 changes: 7 additions & 8 deletions analyzers/dataframe/src/ReconstructedParticle.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#include "FCCAnalyses/ReconstructedParticle.h"

// std
#include <iostream>
#include <cstdlib>
#include <iostream>
#include <stdexcept>

namespace FCCAnalyses{
Expand All @@ -12,8 +12,8 @@ namespace ReconstructedParticle{
/// sel_type
sel_type::sel_type(const int type) : m_type(type) {}

ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>
sel_type::operator() (ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in) {
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> sel_type::operator()(
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in) {
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> result;
result.reserve(in.size());
for (size_t i = 0; i < in.size(); ++i) {
Expand All @@ -24,16 +24,16 @@ sel_type::operator() (ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in)
return result;
}


/// sel_absType
sel_absType::sel_absType(const int type) : m_type(type) {
if (m_type < 0) {
throw std::invalid_argument("ReconstructedParticle::sel_absType: Received negative value!");
throw std::invalid_argument(
"ReconstructedParticle::sel_absType: Received negative value!");
}
}

ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>
sel_absType::operator() (ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in) {
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> sel_absType::operator()(
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in) {
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> result;
result.reserve(in.size());
for (size_t i = 0; i < in.size(); ++i) {
Expand All @@ -44,7 +44,6 @@ sel_absType::operator() (ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>
return result;
}


/// sel_pt
sel_pt::sel_pt(float arg_min_pt) : m_min_pt(arg_min_pt) {};
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> sel_pt::operator() (ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in) {
Expand Down
3 changes: 0 additions & 3 deletions tests/unittest/ReconstructedParticle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "catch2/catch_test_macros.hpp"
#include <catch2/catch_approx.hpp>


TEST_CASE("sel_type", "[ReconstructedParticle]") {
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> pVec;
edm4hep::ReconstructedParticleData p1;
Expand All @@ -25,7 +24,6 @@ TEST_CASE("sel_type", "[ReconstructedParticle]") {
REQUIRE(res[0].type == 11);
}


TEST_CASE("sel_absType", "[ReconstructedParticle]") {
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> pVec;
edm4hep::ReconstructedParticleData p1;
Expand All @@ -47,7 +45,6 @@ TEST_CASE("sel_absType", "[ReconstructedParticle]") {
REQUIRE(res[1].type == -11);
}


TEST_CASE("sel_absType__neg_type", "[ReconstructedParticle]") {
REQUIRE_THROWS_AS(FCCAnalyses::ReconstructedParticle::sel_absType(-17),
std::invalid_argument);
Expand Down

0 comments on commit 813303d

Please sign in to comment.