Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add benchmarks/u_rho #3

Draft
wants to merge 173 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
173 commits
Select commit Hold shift + click to select a range
4e084b5
add benchmarks/u_rho
Jan 13, 2024
0f6d327
Update config.yml for phy benchmark
zsweger Jan 13, 2024
6841030
Updated config.yml to include results task
zsweger Jan 13, 2024
91f2abe
Update config.yml
zsweger Jan 13, 2024
b622c99
Editing figures directory
Jan 13, 2024
33eaf51
Edited the compile rule in the Snakefile to actually compile the script
Jan 13, 2024
b35ecd8
Update config.yml
zsweger Jan 14, 2024
3890737
Update config.yml
zsweger Jan 14, 2024
543dc45
Update Snakefile
zsweger Jan 14, 2024
f44fd82
Update Snakefile
zsweger Jan 14, 2024
873a0ca
Update Snakefile
zsweger Jan 14, 2024
0c2496c
Update Snakefile
zsweger Jan 14, 2024
3f0bead
Snakefile: include benchmarks/u_rho/Snakefile
veprbl Jan 14, 2024
0d284a9
benchmarks/u_rho/Snakefile: change compile rule to use common definition
veprbl Jan 14, 2024
27c4c07
Added B0 reco QA plots
May 10, 2024
2781a08
Attempt at loading common_bench
zsweger May 10, 2024
1cf4d1a
Attempt at setting benchmark status flag
zsweger May 10, 2024
77901e3
Update json file name
zsweger May 10, 2024
72f7c11
changed benchmark status function from void to int
zsweger May 10, 2024
6024dd5
fixed benchmark status definition location
zsweger May 10, 2024
823a408
Update RiceStyle.h to include common_bench
zsweger May 10, 2024
1ed0eb9
Moved benchmark status flag to plotting macro
zsweger May 10, 2024
2d1d432
Removed status flag from analysis code
zsweger May 10, 2024
dcbb867
Removed unnecessary dependency from pleaseIncludeMe.h
zsweger May 10, 2024
593e736
Added pdf explaining various benchmark plots
zsweger May 11, 2024
fceba97
Copy to plot explainer to artifacts
zsweger May 11, 2024
42525a6
removed plot explainer from artifacts
zsweger May 11, 2024
a602994
Test reading produced json file
zsweger May 12, 2024
e9c1e49
Testing benchmark failure status
zsweger May 12, 2024
d77a9dc
Update plot_rho_physics_benchmark.C
zsweger May 12, 2024
71106b8
Copying json file to results directory
zsweger May 12, 2024
723d96f
Update .gitlab-ci.yml to include u_rho
zsweger May 12, 2024
2e2bb10
Update .gitlab-ci.yml
zsweger May 12, 2024
3151f34
Update .gitlab-ci.yml
zsweger May 12, 2024
25ca116
Update results collection in u_rho
zsweger May 12, 2024
709d1cc
Update snakefile json results
zsweger May 12, 2024
e279ac4
Test copying json from config.yml
zsweger May 12, 2024
b2ac92b
Update json filename
zsweger May 12, 2024
9b00d4f
Update .gitlab-ci.yml with u_rho results
zsweger May 13, 2024
7f95f8a
remove results task in config.yml
zsweger May 13, 2024
03059ff
Create benchmark.json
zsweger May 13, 2024
5dc6979
Update json file name
zsweger May 13, 2024
e087009
Update config.yml to have active results rule
zsweger May 13, 2024
dbc0b46
Update config.yml test
zsweger May 15, 2024
30d5860
Test commenting out diffractive_vm bench
zsweger May 15, 2024
8f30825
Dont copy json to results
zsweger May 15, 2024
9be9a1b
Move json to benchmark_outputs
zsweger May 15, 2024
84d3dc3
Update snakefile for json path
zsweger May 15, 2024
0e8988a
Update results path
zsweger May 16, 2024
be8ad9a
Move json file to results/u_rho
zsweger May 16, 2024
0126212
Update pipeline stages
zsweger May 16, 2024
12780d4
Trigger pipeline again
zsweger May 16, 2024
552c7cb
Trigger pipelines
zsweger May 16, 2024
7122355
Create setup.config
zsweger May 16, 2024
e4b74c8
Update pipelines with setup.config
zsweger May 16, 2024
bceed87
Update setup.config path
zsweger May 16, 2024
d0a2789
While testing dont simulate all benchmarks
zsweger May 16, 2024
a6f152b
Update config.yml steps
zsweger May 16, 2024
e83c355
Update config.yml test
zsweger May 16, 2024
6f4b747
Update Snakefile to get evgen files
zsweger May 16, 2024
66ae24b
Test grabbing evgen files from S3
zsweger May 16, 2024
37b2b05
Test not using simulation campaign
zsweger May 16, 2024
f78c710
Fix Snakefile get evgen
zsweger May 16, 2024
16ba69e
Fix Snakefile again
zsweger May 16, 2024
33949e9
Update Snakefile check
zsweger May 16, 2024
9bdc0fa
Fix snakefile check
zsweger May 16, 2024
47439f9
Test detector simulation response
zsweger May 16, 2024
511fa03
ddsim attempt 2
zsweger May 17, 2024
78cfaca
Create simulate.sh
zsweger May 17, 2024
f46baff
Update config.yml with simulate.sh
zsweger May 17, 2024
f6f2d81
Update setup.config
zsweger May 17, 2024
3369486
Fix simulate.sh
zsweger May 17, 2024
7a973b1
Update simulate.sh
zsweger May 17, 2024
0af915f
Update simulate.sh --inputFiles
zsweger May 17, 2024
fed7c8a
Update simulate.sh
zsweger May 17, 2024
28f548d
Update config.yml to require common:detector
zsweger May 17, 2024
ae4318e
Test update config.yml
zsweger May 17, 2024
8a8bcfd
Test update config.yml again
zsweger May 17, 2024
79886ae
Update config.yml
zsweger May 17, 2024
f225f83
Update Snakefile input path
zsweger May 17, 2024
ce5f8eb
Update setup.config input path
zsweger May 17, 2024
77954ba
Update config.yml tasks
zsweger May 17, 2024
e28b7c0
Add simulate rule in Snakefile
zsweger May 17, 2024
a3ea2ab
Update config.yml with snakemake simulate rule
zsweger May 17, 2024
a405c87
Fix Snakefile
zsweger May 17, 2024
7b3541c
Update Snakefile to refer to simulate.sh
zsweger May 17, 2024
d93ccaf
Update simulate.sh
zsweger May 17, 2024
21fdaa3
Update setup.config
zsweger May 17, 2024
c71d1fa
Update config.yml reconstruction
zsweger May 17, 2024
b2c8cd9
Create reconstruct.sh
zsweger May 17, 2024
ca99ad4
Update setup.config
zsweger May 17, 2024
787da25
Update config.yml
zsweger May 17, 2024
f0233f0
Update simulate.sh
zsweger May 17, 2024
27989e6
Update config.yml
zsweger May 17, 2024
0e70fb1
Update reconstruct.sh
zsweger May 17, 2024
bff2401
Update setup.config
zsweger May 17, 2024
079078a
Update analyze rule
zsweger May 17, 2024
26d9035
Update setup.config
zsweger May 17, 2024
3d36c7f
Update setup.config
zsweger May 18, 2024
e5e1db8
Create analyze.sh
zsweger May 18, 2024
85e85f3
Test getting mirrored file from XRootD
zsweger May 18, 2024
3da8ee3
Update setup.config with sim_output
zsweger May 19, 2024
6b82b2d
Update plot_rho_physics_benchmark.C with sim_output
zsweger May 19, 2024
007b14a
Update Snakefile with sim_output
zsweger May 21, 2024
2377170
Update config.yml with sim_output
zsweger May 21, 2024
024bf75
Trigger pipelines
zsweger May 21, 2024
9883e1f
Trigger pipelines again
zsweger May 21, 2024
091e603
Update analyze.sh with sim_output
zsweger May 21, 2024
844145b
Update config.yml with sim_output pdf path
zsweger May 21, 2024
3fc00d3
Trigger pipelines
zsweger May 23, 2024
2deb74d
Update Snakefile paths test
zsweger May 24, 2024
5a814c4
Change config.yml with updated snakefile arg
zsweger May 24, 2024
7722e27
Update reconstruct.sh rec file
zsweger May 25, 2024
d94a8eb
Update `mkdir` to `mkdir -p` to avoid errors
zsweger May 25, 2024
a684cd0
Fix quotes in analyze.sh
zsweger May 25, 2024
59a88ab
Update quotes again in analyze.sh
zsweger May 25, 2024
244cfcb
Update figures path
zsweger May 28, 2024
811cf93
Update config.yml figures path
zsweger May 28, 2024
ed04459
Test using simulation campaign
zsweger May 30, 2024
003369e
Update Snakefile paths
zsweger May 30, 2024
11140d1
Update config.yml paths
zsweger May 30, 2024
b19dd56
Update Snakefile paths
zsweger May 30, 2024
abaf607
Update config.yml json path
zsweger May 30, 2024
67a943a
Update Snakefile
zsweger May 30, 2024
315548e
Update plot_rho_physics_benchmark.C
zsweger May 30, 2024
70bedee
Update Snakefile
zsweger May 30, 2024
d92fac0
Update config.yml paths
zsweger May 30, 2024
3f72be7
Update config.yml
zsweger May 30, 2024
23f8594
Update config.yml path
zsweger May 30, 2024
72d9573
Update config.yml test
zsweger May 30, 2024
bc0f334
Delete flake.lock
zsweger May 30, 2024
204c208
Delete flake.nix
zsweger May 30, 2024
4783623
Delete benchmarks/u_rho/benchmark_output/README
zsweger May 30, 2024
6d201d1
Test dynamic simulations again
zsweger May 31, 2024
80bc118
Update analyze.sh json path
zsweger May 31, 2024
5eef385
Add latex files to explain the benchmark plots
zsweger May 31, 2024
9b51d72
Add format file for latex file
zsweger May 31, 2024
e441e0a
compile manual with tectonic
veprbl Jun 3, 2024
47cfb7c
use time from any path
veprbl Jun 3, 2024
86e0c09
Change location of latex compilation
zsweger Jun 3, 2024
f22669e
Test 10k events
zsweger Jun 3, 2024
2180676
Update config.yml with May sim campaign
zsweger Jun 7, 2024
af2f2f9
Update Snakefile with May sim campaign
zsweger Jun 7, 2024
43dea4f
Test use May sim campaign
zsweger Jun 7, 2024
fa91afe
Update config.yml with April campaign
zsweger Jun 7, 2024
ec78fcf
Test April campaign
zsweger Jun 7, 2024
66fc5f1
Test ReconstructedChargedRealPIDParticles
zsweger Jul 1, 2024
95b18da
Test on live data
zsweger Jul 1, 2024
09db4a9
Test truth PID using chargedParticleAssociations
zsweger Jul 2, 2024
c141582
Test on 100 samples
zsweger Jul 2, 2024
ae61bc9
Saeahram's fix to uchannelrho.cxx
zsweger Aug 8, 2024
17c9415
Try 1000 events
zsweger Aug 8, 2024
102f7b8
Test simulation campaign
zsweger Aug 8, 2024
fe4daee
Update to July sim campaign
zsweger Aug 8, 2024
cb83559
Update Snakefile to July campaign
zsweger Aug 8, 2024
e939bc5
Update z axis label sizes
zsweger Aug 8, 2024
ad0641f
July campaign has fewer files. Reduce to 45
zsweger Aug 9, 2024
a98485e
Editing benchmark plot labels
zsweger Aug 9, 2024
46d8e3f
Update EPIC label
zsweger Aug 9, 2024
b4a6f2d
Get rid of dN/dt plot
zsweger Aug 9, 2024
3338459
Test proton reco fix
zsweger Aug 9, 2024
72d7324
Get rid of dN/dt plot second attempt
zsweger Aug 9, 2024
73064ef
Update bench status test
zsweger Aug 9, 2024
37a62d1
Update bench plot labels
zsweger Aug 9, 2024
2fc026d
Update plots top margin
zsweger Aug 9, 2024
1700b77
Final top margin fix
zsweger Aug 9, 2024
2a7aa70
Test bench with 5k events
zsweger Aug 9, 2024
4cd11cd
Hello California! (and John!)
zsweger Aug 13, 2024
4e5830f
Hello tutorial attendees!
zsweger Sep 17, 2024
2dc2aed
Hello tutorial attendees! :)
zsweger Sep 19, 2024
69e8fc4
Hello tutorial attendees!
zsweger Sep 19, 2024
10644c4
Try to trigger pipelines
zsweger Oct 1, 2024
9f28e0c
Trigger pipelines again
zsweger Oct 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ include:
- local: 'benchmarks/dvcs/config.yml'
- local: 'benchmarks/tcs/config.yml'
- local: 'benchmarks/u_omega/config.yml'
- local: 'benchmarks/u_rho/config.yml'
- local: 'benchmarks/single/config.yml'
- local: 'benchmarks/backgrounds/config.yml'

Expand Down
1 change: 1 addition & 0 deletions Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ root -l -b -q -e '.L {input}+'
"""

include: "benchmarks/diffractive_vm/Snakefile"
include: "benchmarks/u_rho/Snakefile"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, include the tex file for benchmarks/u_rho/BenchmarkPlotsExplained.pdf, maybe we can generate PDF on CI and store it artifacts along with the plots.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay I've now updated the latex file! I've tried the pdflatex command in eicshell to compile it and that didn't work. How can we generate the PDF on CI?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've pushed a hacky solution. Perhaps, we need to request some small latex engine to be added to the container.

Binary file added benchmarks/u_rho/BenchmarkPlotsExplained.pdf
Binary file not shown.
91 changes: 91 additions & 0 deletions benchmarks/u_rho/Snakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import os

from snakemake.remote.S3 import RemoteProvider as S3RemoteProvider


S3 = S3RemoteProvider(
endpoint_url="https://dtn01.sdcc.bnl.gov:9000",
access_key_id=os.environ["S3_ACCESS_KEY"],
secret_access_key=os.environ["S3_SECRET_KEY"],
)


rule uchannelrho_compile:
input:
ROOT_BUILD_DIR_PREFIX + "benchmarks/u_rho/analysis/uchannelrho_cxx.so",


rule uchannelrho_campaign_reco_get:
input:
lambda wildcards: S3.remote(f"eictest/EPIC/RECO/23.12.0/epic_craterlake/EXCLUSIVE/UCHANNEL_RHO/10x100/rho_10x100_uChannel_Q2of0to10_hiDiv.{wildcards.INDEX}.eicrecon.tree.edm4eic.root"),
output:
"benchmark_output/campaign_23.12.0_rho_10x100_uChannel_Q2of0to10_hiDiv_{INDEX}_eicrecon.edm4eic.root",
shell:
"""
echo "Getting file for INDEX {wildcards.INDEX}"
ln {input} {output}
"""


rule uchannelrho_analysis:
input:
script="benchmarks/u_rho/analysis/uchannelrho.cxx",
#script_compiled=ROOT_BUILD_DIR_PREFIX + "benchmarks/u_rho/analysis/uchannelrho_cxx.so",
data="benchmark_output/campaign_23.12.0_rho_10x100_uChannel_Q2of0to10_hiDiv_{INDEX}_eicrecon.edm4eic.root",
output:
plots="benchmark_output/campaign_23.12.0_{INDEX}_eicrecon.edm4eic/plots.root",
shell:
"""
mkdir -p $(dirname "{output.plots}")
root -l -b -q '{input.script}+("{input.data}","{output.plots}")'
"""


rule uchannelrho_combine:
input:
#lambda wildcards: [f"benchmark_output/campaign_23.12.0_{ix:04d}_eicrecon.edm4eic/plots.root" for ix in range(int(wildcards.NUM_FILES))],
lambda wildcards: expand(
"benchmark_output/campaign_23.12.0_{INDEX:04d}_eicrecon.edm4eic/plots.root",
zsweger marked this conversation as resolved.
Show resolved Hide resolved
INDEX=range(int(wildcards.N)),
),
wildcard_constraints:
N="\d+",
output:
"benchmark_output/campaign_23.12.0_combined_{N}files_eicrecon.edm4eic.plots.root",
shell:
"""
hadd {output} {input}
"""


ruleorder: uchannelrho_combine > uchannelrho_analysis


rule uchannelrho_plots:
input:
script="benchmarks/u_rho/macros/plot_rho_physics_benchmark.C",
plots="benchmark_output/campaign_23.12.0_combined_{N}files_eicrecon.edm4eic.plots.root",
output:
"benchmark_output/campaign_23.12.0_combined_{N}files_eicrecon.edm4eic.plots_figures/benchmark_rho_mass.pdf",
shell:
"""
if [ ! -d "{input.plots}_figures" ]; then
mkdir "{input.plots}_figures"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Snakemake will pre-create all the directories for files you list in the output. I see there is a minor discrepancy between edm4eic.plots.root_plots_figures and edm4eic.plots_figures.

echo "{input.plots}_figures directory created successfully."
else
echo "{input.plots}_figures directory already exists."
fi
root -l -b -q '{input.script}("{input.plots}")'
cat *.json
#cp {input.plots}_figures/*.pdf figures/
"""


# Couple examples of invocation:

rule uchannelrho_run_over_a_campaign:
input:
"benchmark_output/figures/plots_benchmark_rho_dsigmadt.pdf",
message:
"See output in {input[0]}"

116 changes: 116 additions & 0 deletions benchmarks/u_rho/analysis/pleaseIncludeMe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#include <cmath>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>

#include "ROOT/RDataFrame.hxx"
#include <TH1D.h>
#include <TFitResult.h>
#include <TRandom3.h>
#include <TCanvas.h>
#include <TSystem.h>

#include "TFile.h"
#include "TLorentzVector.h"

#include "TLorentzRotation.h"
#include "TVector2.h"
#include "TVector3.h"

#include "fmt/color.h"
#include "fmt/core.h"

// #include "nlohmann/json.hpp"
#include "edm4eic/InclusiveKinematicsData.h"
#include "edm4eic/ReconstructedParticleData.h"
#include "edm4hep/MCParticleData.h"

#define PI 3.1415926
#define MASS_ELECTRON 0.00051
#define MASS_PROTON 0.93827
#define MASS_PION 0.13957
#define MASS_KAON 0.493667
#define MASS_AU197 183.45406466643374

auto getNtrk(const std::vector<edm4eic::ReconstructedParticleData>& parts)
{
std::vector<int> mult;
int n=0;
for(auto& i1 : parts){
if(i1.charge!=0) n++;
}
mult.push_back( n );
return mult;
}
auto getNtrkMC(const std::vector<edm4hep::MCParticleData>& parts)
{
std::vector<int> mult;
int n=0;
for(auto& i1 : parts){
if(i1.charge!=0 && i1.generatorStatus==1) n++;
}
mult.push_back( n );
return mult;
}
auto momenta_from_chargedparticles(const std::vector<edm4eic::ReconstructedParticleData>& parts) {
std::vector<TVector3> momenta;
for(auto& i1 : parts){
TVector3 trk(i1.momentum.x,i1.momentum.y,i1.momentum.z);
if(i1.charge!=0) momenta.push_back(trk);
}
return momenta;
}
auto momenta_from_mcparticles(const std::vector<edm4hep::MCParticleData>& parts) {
std::vector<TVector3> momenta;
for(auto& i1 : parts){
TVector3 trk(i1.momentum.x,i1.momentum.y,i1.momentum.z);
if(i1.charge!=0 && i1.generatorStatus==1) momenta.push_back(trk);
}
return momenta;
}
auto pt_resolution(const std::vector<edm4hep::MCParticleData>& mcs,
const std::vector<edm4eic::ReconstructedParticleData>& recos){

std::vector<double> resolution;
for(auto& i1: recos){
TVector3 trk(i1.momentum.x,i1.momentum.y,i1.momentum.z);
if(i1.charge==0) continue;
double minR=99;
TVector3 matchMCtrk(-99,-99,-99);
for(auto& i2 : mcs){
TVector3 trkMC(i2.momentum.x,i2.momentum.y,i2.momentum.z);
if(i2.charge!=0 && i2.generatorStatus==1){
if(trk.DeltaR(trkMC) < minR ){
minR=trk.DeltaR(trkMC);
matchMCtrk=trkMC;
}
}
}
double res= (matchMCtrk.Perp()-trk.Perp()) / matchMCtrk.Perp();
resolution.push_back( res );

}

return resolution;
}
auto getPt(const std::vector<TVector3>& tracks)
{
std::vector<double> Pt;
for(auto& i1 : tracks){Pt.push_back(i1.Perp());}
return Pt;
}
auto getEta(const std::vector<TVector3>& tracks)
{
std::vector<double> eta;
for(auto& i1 : tracks){eta.push_back(i1.Eta());}
return eta;
}
auto getPhi(const std::vector<TVector3>& tracks)
{
std::vector<double> Phi;
for(auto& i1 : tracks){Phi.push_back(i1.Phi());}
return Phi;
}
Loading