Skip to content

Commit

Permalink
Merge branch 'HEP-FCC:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
bistapf authored Oct 4, 2024
2 parents a95fd03 + a303165 commit 519bdc8
Show file tree
Hide file tree
Showing 48 changed files with 2,038 additions and 189 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,5 @@ jobs:
run: |
docker exec CI_container /bin/bash -c 'cd ./Package; \
source /cvmfs/sw.hsf.org/key4hep/setup.sh;\
git clang-format --style=file $(git merge-base upstream/master HEAD)'
- name: Check cleanliness
run: |
docker exec CI_container /bin/bash -c 'cd ./Package; \
git diff'
git clang-format --diff --style=file $(git merge-base upstream/master HEAD)
git clang-format --diffstat --style=file $(git merge-base upstream/master HEAD)'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ __pycache__/
# Editors
*~
.vimlocal
.cache/

# Distribution / packaging
.Python
Expand Down
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.16.9)


project(FCCAnalyses VERSION 0.9.0
project(FCCAnalyses VERSION 0.10.0
LANGUAGES CXX
)

Expand Down Expand Up @@ -31,6 +31,9 @@ option(USE_EXTERNAL_CATCH2 "Link against an external Catch2 v3 static library, o

option(FCCANALYSES_DOCUMENTATION "Whether or not to create doxygen doc target." ON)

set(WITH_PODIO_DATASOURCE ON CACHE STRING "Enable PODIO DataSource")
set_property(CACHE WITH_PODIO_DATASOURCE PROPERTY STRINGS ON OFF)

#--- Export compile commands --------------------------------------------------
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

Expand Down
11 changes: 11 additions & 0 deletions analyzers/dataframe/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ if(NOT WITH_ACTS)
list(FILTER sources EXCLUDE REGEX "VertexFinderActs.cc")
endif()

if(NOT WITH_PODIO_DATASOURCE)
list(FILTER headers EXCLUDE REGEX "LinkSource.h")
list(FILTER headers EXCLUDE REGEX "ReconstructedParticleSource.h")
list(FILTER sources EXCLUDE REGEX "ReconstructedParticleSource.cc")
list(FILTER headers EXCLUDE REGEX "TrackSource.h")
list(FILTER sources EXCLUDE REGEX "TrackSource.cc")
endif()

message(STATUS "FCCAnalyses headers:\n ${headers}")
message(STATUS "FCCAnalyses sources:\n ${sources}")

Expand Down Expand Up @@ -59,7 +67,10 @@ target_link_libraries(FCCAnalyses PUBLIC
ROOT::ROOTDataFrame
EDM4HEP::edm4hep
EDM4HEP::edm4hepDict
EDM4HEP::utils
podio::podio
podio::podioRootIO
podio::podioDataSource
${ADDONS_LIBRARIES}
${DELPHES_LIBRARY}
gfortran # todo: why necessary?
Expand Down
6 changes: 0 additions & 6 deletions analyzers/dataframe/FCCAnalyses/Defines.h
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
#ifndef DEFINES_ANALYZERS_H
#define DEFINES_ANALYZERS_H

// std
#include <cmath>
#include <math.h>
#include <vector>

// ROOT
#include "ROOT/RVec.hxx"
#include "TLorentzVector.h"

// EDM4hep
#include "edm4hep/MCParticleData.h"
#include "edm4hep/ParticleIDData.h"
#include "edm4hep/ReconstructedParticleData.h"

/**
Expand Down
35 changes: 23 additions & 12 deletions analyzers/dataframe/FCCAnalyses/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,31 +8,42 @@

//Dictionaries for output objects
#pragma link C++ class std::vector<TLorentzVector>+;
#pragma link C++ class ROOT::VecOps::RVec < TLorentzVector> + ;
#pragma link C++ class ROOT::VecOps::RVec < ROOT::VecOps::RVec < \
TLorentzVector>> + \
;
#pragma link C++ class ROOT::VecOps::RVec < TVector3> + ;
#pragma link C++ class ROOT::VecOps::RVec < ROOT::VecOps::RVec < TVector3>> + ;

#pragma link C++ class std::vector<std::string>+;

#pragma link C++ class ROOT::VecOps::RVec<TLorentzVector>+;
#pragma link C++ class std::vector<std::vector<int>>+;
#pragma link C++ class std::vector<std::vector<float>>+;
#pragma link C++ class std::vector<std::vector<double>>+;
// EDM4hep
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::TrackState>+;
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::VertexData>+;
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>+;
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::CalorimeterHitData>+;
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::ClusterData>+;
#pragma link C++ class ROOT::VecOps::RVec<podio::ObjectID>+;
#pragma link C++ class ROOT::VecOps::RVec < edm4hep::ClusterData> + ;
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::Vector3d>+;
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::MCParticleData>+;
#pragma link C++ class ROOT::VecOps::RVec<TVector3>+;
#pragma link C++ class ROOT::VecOps::RVec < ROOT::VecOps::RVec < \
edm4hep::ReconstructedParticleData>> + \
;

// Vectors
#pragma link C++ class ROOT::VecOps::RVec < std::vector < int>> + ;
#pragma link C++ class ROOT::VecOps::RVec < std::vector < float>> + ;
#pragma link C++ class ROOT::VecOps::RVec < std::vector < double>> + ;
#pragma link C++ class ROOT::VecOps::RVec<ROOT::VecOps::RVec<int>>+;
#pragma link C++ class ROOT::VecOps::RVec<ROOT::VecOps::RVec<float>>+;
#pragma link C++ class ROOT::VecOps::RVec<ROOT::VecOps::RVec<double>>+;
#pragma link C++ class ROOT::VecOps::RVec<ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>>+;
#pragma link C++ class ROOT::VecOps::RVec<std::vector<float>>+;
#pragma link C++ class std::vector < std::vector < int>> + ;
#pragma link C++ class std::vector < std::vector < float>> + ;
#pragma link C++ class std::vector < std::vector < double>> + ;

#pragma link C++ class ROOT::VecOps::RVec<FCCAnalyses::VertexingUtils::FCCAnalysesVertex>+;
#pragma link C++ class ROOT::VecOps::RVec<ROOT::VecOps::RVec<FCCAnalyses::VertexingUtils::FCCAnalysesVertex>>+;
#pragma link C++ class ROOT::VecOps::RVec<ROOT::VecOps::RVec<TVector3>>+;
#pragma link C++ class ROOT::VecOps::RVec<ROOT::VecOps::RVec<TLorentzVector>>+;
#pragma link C++ class ROOT::VecOps::RVec < ROOT::VecOps::RVec < \
FCCAnalyses::VertexingUtils::FCCAnalysesVertex>> + \
;

//to load all other functions
#pragma link C++ function dummyLoader;
Expand Down
92 changes: 92 additions & 0 deletions analyzers/dataframe/FCCAnalyses/LinkSource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
#ifndef SOURCE_LINK_ANALYZERS_H
#define SOURCE_LINK_ANALYZERS_H

// EDM4hep
#include "edm4hep/RecoMCParticleLinkCollection.h"

namespace FCCAnalyses ::PodioSource ::Link {
/**
* \brief Analyzer to select links where the MC particle has a specified PDG
* ID.
*
* \param[in] pdg Desired PDG ID of the MC particle.
*/
struct selPDG {
const int m_pdg;

explicit selPDG(const int pdg) : m_pdg(pdg){};

template <typename T> T operator()(const T &inLinkColl) {
T result;
result.setSubsetCollection();

for (const auto &link : inLinkColl) {
const auto &particle = link.getTo();
if (particle.getPDG() == m_pdg) {
result.push_back(link);
}
}

return result;
}
};

/**
* \brief Analyzer to select links where MC particle has a specified absolute
* value of PDG ID.
*
* \param pdg[in] Desired absolute value of PDG ID of the MC particle.
*/
struct selAbsPDG {
const int m_pdg;

explicit selAbsPDG(const int pdg) : m_pdg(pdg) {
if (m_pdg < 0) {
throw std::invalid_argument("FCCAnalyses::PodioSource::Link::sel_absPDG: "
"Received negative value!");
}
};

template <typename T> auto operator()(const T &inLinkColl) {
T result;
result.setSubsetCollection();

for (const auto &link : inLinkColl) {
const auto &particle = link.getTo();
if (std::abs(particle.getPDG()) == m_pdg) {
result.push_back(link);
}
}

return result;
};
};

/**
* \brief Analyzer to select links where the MC particle has a specified
* generator status.
*
* \param status[in] Desired generator status of the particle.
*/
struct selGenStatus {
const int m_status;

explicit selGenStatus(const int status) : m_status(status){};

template <typename T> T operator()(const T &inLinkColl) {
T result;
result.setSubsetCollection();

for (const auto &link : inLinkColl) {
const auto &particle = link.getTo();
if (particle.getGeneratorStatus() == m_status) {
result.push_back(link);
}
}

return result;
}
};
} // namespace FCCAnalyses::PodioSource::Link

#endif /* SOURCE_LINK_ANALYZERS_H */
10 changes: 5 additions & 5 deletions analyzers/dataframe/FCCAnalyses/ReconstructedParticle.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@
#ifndef RECONSTRUCTEDPARTICLE_ANALYZERS_H
#define RECONSTRUCTEDPARTICLE_ANALYZERS_H

// STL
#include <cmath>
#include <vector>

// ROOT
#include "TLorentzVector.h"
#include "ROOT/RVec.hxx"

// EDM4hep
#include "edm4hep/ReconstructedParticleData.h"
#include "edm4hep/ParticleIDData.h"

Expand Down Expand Up @@ -97,9 +101,6 @@ namespace ReconstructedParticle{
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> operator() (ROOT::VecOps::RVec<bool> tags, ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in);
};




/// return reconstructed particles
ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> get(ROOT::VecOps::RVec<int> index, ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in);

Expand Down Expand Up @@ -151,7 +152,7 @@ namespace ReconstructedParticle{
/// return the TlorentzVector of the one input ReconstructedParticle
TLorentzVector get_tlv(edm4hep::ReconstructedParticleData in);

/// return visible 4-momentum vector
/// return visible 4-momentum vector
TLorentzVector get_P4vis(ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData> in);

/// concatenate both input vectors and return the resulting vector
Expand All @@ -168,7 +169,6 @@ namespace ReconstructedParticle{

/// get number of b-jets
int getJet_ntags(ROOT::VecOps::RVec<bool> in);

}//end NS ReconstructedParticle

}//end NS FCCAnalyses
Expand Down
Loading

0 comments on commit 519bdc8

Please sign in to comment.