Skip to content

Commit bd00908

Browse files
authored
Making veawer example run on EDM4hep 1.0 files (#460)
* Making weaver example run on EDM4hep 1.0 files * Adjusting include headers
1 parent 632af19 commit bd00908

9 files changed

Lines changed: 30 additions & 34 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ include(GNUInstallDirs)
4949
set(INSTALL_LIB_DIR lib CACHE PATH "Installation directory for libraries")
5050
set(INSTALL_BIN_DIR bin CACHE PATH "Installation directory for executables")
5151
set(INSTALL_INCLUDE_DIR include CACHE PATH
52-
"Installation directory for header files")
52+
"Installation directory for header files")
53+
set(INSTALL_SHARE_DIR "${CMAKE_INSTALL_PREFIX}/share" CACHE PATH
54+
"Installation directory for shared resources")
5355

5456

5557
#--- Declare C++ Standard -----------------------------------------------------

analyzers/dataframe/FCCAnalyses/JetConstituentsUtils.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
#ifndef FCCAnalyses_JetConstituentsUtils_h
22
#define FCCAnalyses_JetConstituentsUtils_h
33

4+
// ROOT
45
#include "ROOT/RVec.hxx"
5-
#include "edm4hep/ReconstructedParticle.h"
6-
#include "edm4hep/MCParticle.h"
6+
#include "TLorentzVector.h"
7+
#include "TMath.h"
8+
#include "TRotation.h"
9+
#include "TVector3.h"
10+
// EDM4hep
11+
#include "edm4hep/CalorimeterHitData.h"
12+
#include "edm4hep/ClusterData.h"
13+
#include "edm4hep/MCParticleData.h"
714
#include "edm4hep/RecDqdxData.h"
15+
#include "edm4hep/ReconstructedParticleData.h"
816
#if __has_include("edm4hep/TrackerHit3DData.h")
917
#include "edm4hep/TrackerHit3DData.h"
1018
#else
@@ -13,14 +21,11 @@ namespace edm4hep {
1321
using TrackerHit3DData = edm4hep::TrackerHitData;
1422
}
1523
#endif
16-
24+
#include "edm4hep/TrackData.h"
25+
#include "edm4hep/TrackState.h"
26+
// FastJet
1727
#include "fastjet/JetDefinition.hh"
18-
19-
#include "TMath.h"
20-
#include "TVector3.h"
21-
#include "TRotation.h"
22-
#include "TLorentzVector.h"
23-
28+
// FCCAnalyses
2429
#include "FCCAnalyses/TrackUtils.h"
2530

2631
namespace FCCAnalyses {

analyzers/dataframe/FCCAnalyses/LinkDef.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::MCParticleData>+;
3030
#pragma link C++ class ROOT::VecOps::RVec<ROOT::VecOps::RVec<edm4hep::ReconstructedParticleData>>+;
3131
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::TrackData>+;
32+
#pragma link C++ class ROOT::VecOps::RVec<edm4hep::RecDqdxData>+;
3233

3334
// Vectors
3435
#pragma link C++ class ROOT::VecOps::RVec<std::vector<int>>+;

analyzers/dataframe/src/JetConstituentsUtils.cc

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
#include "FCCAnalyses/JetConstituentsUtils.h"
22

3-
// FCCAnalyses
4-
#include "FCCAnalyses/JetClusteringUtils.h"
5-
#include "FCCAnalyses/ReconstructedParticle.h"
6-
#include "FCCAnalyses/ReconstructedParticle2MC.h"
7-
#include "FCCAnalyses/ReconstructedParticle2Track.h"
8-
#include "FCCAnalyses/ReconstructedTrack.h"
93
// EDM4hep
10-
#include "edm4hep/MCParticleData.h"
11-
#include "edm4hep/Track.h"
12-
#include "edm4hep/TrackData.h"
13-
#include "edm4hep/Cluster.h"
14-
#include "edm4hep/ClusterData.h"
15-
#include "edm4hep/CalorimeterHitData.h"
16-
#include "edm4hep/ReconstructedParticleData.h"
174
#include "edm4hep/EDM4hepVersion.h"
185
// FastJet
196
#include "fastjet/JetDefinition.hh"
207
#include "fastjet/PseudoJet.hh"
218
#include "fastjet/Selector.hh"
9+
// FCCAnalyses
10+
#include "FCCAnalyses/JetClusteringUtils.h"
11+
#include "FCCAnalyses/ReconstructedParticle.h"
12+
#include "FCCAnalyses/ReconstructedParticle2MC.h"
13+
#include "FCCAnalyses/ReconstructedParticle2Track.h"
14+
#include "FCCAnalyses/TrackUtils.h"
2215

2316
/* *************************
2417
//COMMENTS

analyzers/dataframe/src/SmearObjects.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -319,9 +319,6 @@ ROOT::VecOps::RVec<edm4hep::RecDqdxData> SmearedTracksdNdx::operator()(
319319
TrkUtil tu;
320320

321321
for (int itrack = 0; itrack < ntracks; itrack++) {
322-
// auto dNdxObject =
323-
// ReconstructedTrack::get_dNdxObject(itrack, dNdxColl,
324-
// dNdxTrackIndexes);
325322
auto dNdxSmeared = edm4hep::RecDqdxData{};
326323
dNdxSmeared.dQdx.value = 0.;
327324
dNdxSmeared.dQdx.type = 0;

cmake/FCCAnalysesFunctions.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function(add_integration_test _testname)
3939
)
4040
set_property(TEST fccanalysisrun_${_testname} APPEND PROPERTY ENVIRONMENT
4141
LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/analyzers/dataframe:$ENV{LD_LIBRARY_PATH}
42-
PYTHONPATH=${CMAKE_SOURCE_DIR}/python:${CMAKE_BINARY_DIR}:$ENV{PYTHONPATH}
42+
PYTHONPATH=${CMAKE_SOURCE_DIR}/python:${INSTALL_SHARE_DIR}/examples:${CMAKE_BINARY_DIR}:$ENV{PYTHONPATH}
4343
PATH=${CMAKE_SOURCE_DIR}/bin:${CMAKE_BINARY_DIR}:$ENV{PATH}
4444
ROOT_INCLUDE_PATH=${CMAKE_SOURCE_DIR}/analyzers/dataframe:$ENV{ROOT_INCLUDE_PATH}
4545
TEST_INPUT_DATA_DIR=${TEST_INPUT_DATA_DIR}

examples/FCCee/weaver/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@
1515
"PFTracks": "EFlowTrack",
1616
"PFPhotons": "EFlowPhoton",
1717
"PFNeutralHadrons": "EFlowNeutralHadron",
18-
"TrackState": "EFlowTrack_1",
18+
"TrackState": "_EFlowTrack_trackStates",
1919
"TrackerHits": "TrackerHits",
2020
"CalorimeterHits": "CalorimeterHits",
21-
"dNdx": "EFlowTrack_2",
21+
"dNdx": "EFlowTrack_dNdx",
2222
"PathLength": "EFlowTrack_L",
2323
"Bz": "magFieldBz",
2424
}

examples/FCCee/weaver/stage1.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@
77
from addons.ONNXRuntime.jetFlavourHelper import JetFlavourHelper
88
from addons.FastJet.jetClusteringHelper import ExclusiveJetClusteringHelper
99

10-
jetFlavourHelper = None
11-
jetClusteringHelper = None
10+
testFile = 'https://fccsw.web.cern.ch/fccsw/analysis/test-samples/' \
11+
'edm4hep099/wzp6_ee_nunuH_Hss_ecm240.root'
1212

1313
# Mandatory: RDFanalysis class where the use defines the operations on the TTree
1414
class RDFanalysis:
1515
# __________________________________________________________
1616
# Mandatory: analysers funtion to define the analysers to process, please make sure you return the last dataframe, in this example it is df2
1717
def analysers(df):
18-
global jetClusteringHelper
19-
global jetFlavourHelper
20-
2118
from examples.FCCee.weaver.config import collections, njets
2219

2320
## define jet clustering parameters

tests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ add_integration_test("examples/FCCee/higgs/mH-recoil/mumu/analysis_stage1.py")
88
add_integration_test("examples/FCCee/flavour/Bc2TauNu/analysis_B2TauNu_truth.py")
99
add_integration_test("examples/FCCee/test/jet_constituents.py")
1010
add_integration_test("examples/FCCee/vertex_lcfiplus/analysis_V0.py")
11+
add_integration_test("examples/FCCee/weaver/stage1.py")
1112

1213
add_standalone_test("examples/FCCee/fullSim/caloNtupleizer/analysis.py")
1314

0 commit comments

Comments
 (0)