Skip to content

Commit ca84fb5

Browse files
authored
Updated pipeline to run on the **pre_summer2026** production (#524)
1 parent c35e411 commit ca84fb5

15 files changed

Lines changed: 311 additions & 573 deletions

analyzers/dataframe/src/JetClusteringUtils.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ std::vector<float> exclusive_dmerge(fastjet::ClusterSequence &cs,
258258
}
259259

260260
bool check(unsigned int n, int exclusive, float cut) {
261-
if (exclusive > 0 && n <= int(cut))
261+
if (exclusive > 0 && n < int(cut))
262262
return false;
263263
return true;
264264
}

analyzers/dataframe/src/JetConstituentsUtils.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -817,11 +817,11 @@ namespace FCCAnalyses
817817

818818
if (ct.at(j).tracks_begin < trackdata.size())
819819
{
820-
if (abs(ct.at(j).charge) > 0 and abs(ct.at(j).mass - 0.000510999) < 1.e-05)
820+
if (std::abs(ct.at(j).charge) > 0 and std::abs(ct.at(j).mass - 0.000510999) < 1.e-05)
821821
{
822822
tmp.push_back(0.000510999);
823823
}
824-
else if (abs(ct.at(j).charge) > 0 and abs(ct.at(j).mass - 0.105658) < 1.e-03)
824+
else if (std::abs(ct.at(j).charge) > 0 and std::abs(ct.at(j).mass - 0.105658) < 1.e-03)
825825
{
826826
tmp.push_back(0.105658);
827827
}
@@ -1094,7 +1094,7 @@ namespace FCCAnalyses
10941094
FCCAnalysesJetConstituents ct = jcs.at(i);
10951095
for (int j = 0; j < ct.size(); ++j)
10961096
{
1097-
if (abs(ct.at(j).charge) > 0 and abs(ct.at(j).mass - 0.000510999) < 1.e-05)
1097+
if (std::abs(ct.at(j).charge) > 0 and std::abs(ct.at(j).mass - 0.000510999) < 1.e-05)
10981098
{
10991099
is_El.push_back(1.);
11001100
}
@@ -1118,7 +1118,7 @@ namespace FCCAnalyses
11181118
FCCAnalysesJetConstituents ct = jcs.at(i);
11191119
for (int j = 0; j < ct.size(); ++j)
11201120
{
1121-
if (abs(ct.at(j).charge) > 0 and abs(ct.at(j).mass - 0.105658) < 1.e-03)
1121+
if (std::abs(ct.at(j).charge) > 0 and std::abs(ct.at(j).mass - 0.105658) < 1.e-03)
11221122
{
11231123
is_Mu.push_back(1.);
11241124
}
@@ -1142,7 +1142,7 @@ namespace FCCAnalyses
11421142
FCCAnalysesJetConstituents ct = jcs.at(i);
11431143
for (int j = 0; j < ct.size(); ++j)
11441144
{
1145-
if (abs(ct.at(j).charge) > 0 and abs(ct.at(j).mass - 0.13957) < 1.e-03)
1145+
if (std::abs(ct.at(j).charge) > 0 and std::abs(ct.at(j).mass - 0.13957) < 1.e-03)
11461146
{
11471147
is_ChargedHad.push_back(1.);
11481148
}

analyzers/dataframe/src/MCParticle.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ get_EventPrimaryVertexP4::get_EventPrimaryVertexP4() {};
103103
TLorentzVector get_EventPrimaryVertexP4::operator() ( ROOT::VecOps::RVec<edm4hep::MCParticleData> in ) {
104104
TLorentzVector result(-1e12,-1e12,-1e12,-1e12);
105105
Bool_t found_py8 = false;
106+
Bool_t found_beam = false;
106107
//std::cout<<"-------------------------------------------"<<std::endl;
107108
// first try pythia8 gen status == 21 code;
108109
for (auto & p: in) {
@@ -117,8 +118,19 @@ TLorentzVector get_EventPrimaryVertexP4::operator() ( ROOT::VecOps::RVec<edm4hep
117118

118119
if (!found_py8) {
119120
for (auto & p: in) {
120-
// std::cout<< p.generatorStatus<<", "<<p.PDG<<", "<<p.momentum.x<<", "<<p.momentum.y<<", "<< p.vertex.y<<", "<< p.vertex.z<<", "<< p.time * 1.0e3 * 2.99792458e+8<<std::endl;
121-
if ( p.generatorStatus == 2 and abs(p.vertex.z) > 1.e-12 ) { // generator status code for the incoming particles of the hardest subprocess
121+
if ( p.generatorStatus == 4 ) { // HepMC beam particles (Herwig, Sherpa, ...)
122+
// vertex.time is in s, convert in mm here.
123+
TLorentzVector res( p.vertex.x, p.vertex.y, p.vertex.z, p.time * 1.0e3 * 2.99792458e+8);
124+
result = res;
125+
found_beam = true;
126+
break;
127+
}
128+
}
129+
}
130+
131+
if (!found_py8 && !found_beam) {
132+
for (auto & p: in) {
133+
if ( p.parents_begin == p.parents_end ) { // generators with neither convention (Whizard/STDHEP has only status 1 and 2): the beam particles are the only parentless particles
122134
// vertex.time is in s, convert in mm here.
123135
TLorentzVector res( p.vertex.x, p.vertex.y, p.vertex.z, p.time * 1.0e3 * 2.99792458e+8);
124136
result = res;

examples/FCCee/weaver/README.md

Lines changed: 59 additions & 169 deletions
Large diffs are not rendered by default.

examples/FCCee/weaver/analysis_inference.py

Lines changed: 5 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,15 @@
1-
import os
2-
import urllib.request
3-
4-
# ____________________________________________________________
5-
def get_file_path(url, filename):
6-
if os.path.exists(filename):
7-
return os.path.abspath(filename)
8-
else:
9-
urllib.request.urlretrieve(url, os.path.basename(url))
10-
return os.path.basename(url)
11-
12-
# ____________________________________________________________
13-
141
## input file needed for unit test in CI
152
testFile = "https://fccsw.web.cern.ch/fccsw/testsamples/wzp6_ee_nunuH_Hss_ecm240.root"
163

174
## output directory
185
outputDir = "outputs/inference"
196

20-
## latest particle transformer model, trainied on 9M jets in winter2023 samples
21-
model_name = "fccee_flavtagging_edm4hep_wc_v1"
22-
23-
## model files needed for unit testing in CI
24-
url_model_dir = "https://fccsw.web.cern.ch/fccsw/testsamples/jet_flavour_tagging/winter2023/wc_pt_13_01_2022/"
25-
url_preproc = "{}/{}.json".format(url_model_dir, model_name)
26-
url_model = "{}/{}.onnx".format(url_model_dir, model_name)
27-
28-
## model files locally stored on /eos
29-
model_dir = "/eos/experiment/fcc/ee/jet_flavour_tagging/winter2023/wc_pt_13_01_2022/"
30-
local_preproc = "{}/{}.json".format(model_dir, model_name)
31-
local_model = "{}/{}.onnx".format(model_dir, model_name)
7+
## pre_summer2026 7-class (G/U/D/S/C/B/TAU) particle transformer, 70M jets
8+
model_dir = "/eos/experiment/fcc/ee/jet_flavour_tagging/pre_summer2026/models/IDEA_240_andrea_30_06_2026/TRAINING_70M_7labels_4GPUs_newKey4Hep_LongJob2"
9+
model_name = "TRAINING_70M_7labels_4GPUs_newKey4Hep_LongJob2"
3210

33-
## get local file, else download from url
34-
weaver_preproc = get_file_path(url_preproc, local_preproc)
35-
weaver_model = get_file_path(url_model, local_model)
11+
weaver_preproc = "{}/{}_preprocess.json".format(model_dir, model_name)
12+
weaver_model = "{}/{}_best_epoch_state.onnx".format(model_dir, model_name)
3613

3714
from addons.ONNXRuntime.jetFlavourHelper import JetFlavourHelper
3815
from addons.FastJet.jetClusteringHelper import ExclusiveJetClusteringHelper

examples/FCCee/weaver/config.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,9 @@
2323
"Bz": "magFieldBz",
2424
}
2525

26-
#### list of flavors f = g, q, c, s, ...(will look for input file name ccontaining "[Hff]")
27-
flavors = ["g", "q", "s", "c", "b", "tau"]
26+
#### list of flavors (7 classes, matching the G/U/D/S/C/B/TAU tagger outputs);
27+
#### the jet label is inferred from the input file name ("Hff" or "_ee_ff_")
28+
flavors = ["g", "u", "d", "s", "c", "b", "tau"]
2829

2930
## define here the branches to be stored in the output root files in addition to the predefined one
3031
## only the name of the var is used here, the metadata is used in stage_plots

0 commit comments

Comments
 (0)