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 lowq2 benchmarks #22

Open
wants to merge 43 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
18cd472
Added NN training script
simonge Aug 30, 2023
0c5ed31
updated training script for clarity
simonge Sep 21, 2023
82fefd9
added simple first benchmarks
simonge Oct 4, 2023
a61cfae
benchmark change
simonge Jan 9, 2024
1a259d5
Extended hit benchmarks
simonge Jan 25, 2024
83eed26
Added deeper directory structure for benchmarks
simonge Jan 25, 2024
5c13f13
Added directory structure and moved geometry id definitions to a sepa…
simonge Jan 25, 2024
ed0a7a5
Added acceptance plots
simonge Jan 25, 2024
132dfbc
Fixed memory and sumw2 issues
simonge Jan 26, 2024
72496d2
Added reconstruction and fixed some bugs
simonge Jan 26, 2024
58a034f
Formatting and range corrections
simonge Jan 29, 2024
77e327d
Added postprocessing script to create and format histograms into canv…
simonge Jan 29, 2024
0bc51e4
Fixed typo in dataframe string
simonge Jan 29, 2024
7c2adb0
Fixed some bugs, added some new resolution plots and sped things up
simonge Jan 31, 2024
80933e9
Added .gitignore and moved plots into directory
simonge Jan 31, 2024
48d7d1a
Added calibrations and fieldmaps to .gitignore
simonge Jan 31, 2024
c8f49b8
Removed excess text from histogram titles and cleaned up integrated a…
simonge Jan 31, 2024
ea6bd3e
Merge remote-tracking branch 'origin/master' into add_lowq2_benchmarks
simonge Jan 31, 2024
eacf3c8
Improved formatted historgams and fixed some inconsistencies
simonge Feb 1, 2024
1608444
Added primary-secondary hits example plot
simonge Feb 1, 2024
057570b
Added Low-Q2 benchmarks to CI, does nothing currently
simonge Apr 30, 2024
e13ff34
Some changes
simonge May 6, 2024
861c47b
Updated to remove training from branch
simonge May 16, 2024
8569cbe
Merge remote-tracking branch 'origin/master' into add_lowq2_benchmarks
simonge May 16, 2024
29374e0
removed some local paths and generalised
simonge May 16, 2024
e3475b1
Changes to for remote running
simonge May 16, 2024
5b972e4
Removed other tests while investigating CI
simonge May 16, 2024
bf1ab67
Included analysis config.yml
simonge May 16, 2024
27d9a43
Some more simplification
simonge May 16, 2024
90ff930
Merge remote-tracking branch 'origin/master' into add_lowq2_benchmarks
veprbl May 17, 2024
dbd39e2
.gitlab-ci.yml: fix syntax
veprbl May 17, 2024
9183d93
.gitlab-ci.yml: fix syntax
veprbl May 17, 2024
dd29b98
.gitlab-ci.yml: full include path
veprbl May 17, 2024
79ed678
config.yml: this is not a snakemake config
veprbl May 17, 2024
fe37ac8
.gitlab-ci.yml: enable zdc back
veprbl May 17, 2024
21bbf74
.gitlab-ci.yml: just comment needs instead
veprbl May 17, 2024
a27c89f
edited while epic-main isn't named right
simonge May 22, 2024
c796a3d
Merge branch 'add_lowq2_benchmarks' of github.com:eic/detector_benchm…
simonge May 22, 2024
117685e
removed config.yml file in LOWQ2 as analysis called directly
simonge May 22, 2024
6e6794e
Changed config path
simonge May 22, 2024
cc5e54c
Added gitignores for training directories
simonge May 22, 2024
ebe03d3
Added remote config from other branch, getting confused about what is…
simonge May 23, 2024
700be11
Changed Brem-Brems
simonge Jun 24, 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
Prev Previous commit
Next Next commit
Changes to for remote running
simonge committed May 16, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit e3475b1c608293bcb2eafe5829ca86e761738972
2 changes: 2 additions & 0 deletions benchmarks/LOWQ2/analysis/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
plots*
calibrations*
fieldmaps*
gdml*
.snakemake*
21 changes: 6 additions & 15 deletions benchmarks/LOWQ2/analysis/PostprocessLOWQ2.C
Original file line number Diff line number Diff line change
@@ -17,15 +17,7 @@ void SetStyle() {
gStyle->SetPadRightMargin(0.18);
gStyle->SetPadBottomMargin(0.12);
gStyle->SetTitleSize(0.04, "XYZ");

gStyle->SetTitleOffset(4.0, "Z");
// gStyle->SetTitleOffset(1.0, "Y");

// // Set global plot format variables
// int font = 42; //
// gStyle->SetTextFont(font); // Set the font for text
// gStyle->SetLabelFont(font, "XYZ"); // Set the font for axis labels
// gStyle->SetTitleFont(font, "XYZ"); // Set the font for titles

}

@@ -71,7 +63,6 @@ TH2* RatePlot(TDirectory* inputDir, int Module, int Layer, TString Tag="Quasi-Re
RatePlot->Rebin2D(rebin,rebin);
RatePlot->Scale(1.0/(rebin*rebin));
TString title = "Tagger module "+std::to_string(Module)+", layer "+std::to_string(Layer)+" - Mean "+Tag+" rate per "+std::to_string(rebin)+"x"+std::to_string(rebin)+" pixel group";
// TString title = "Tagger module 2, layer 0 rate, integrated over "+std::to_string(rebin)+"x"+std::to_string(rebin)+" pixel group";
RatePlot->SetTitle(title);
RatePlot->GetXaxis()->SetTitle("x pixel");
RatePlot->GetYaxis()->SetTitle("y pixel");
@@ -485,9 +476,9 @@ void FormatReconstructionPlots(TDirectory* inputDir, TFile* outputFile, TString
}

//----------------------------------------------------------------------
// This function is called by the benchmarking script maybe
// This function is called by the benchmarking script
//----------------------------------------------------------------------
void Postprocess(TString inName="LOWQ2QRRates3.root", TString outName="LOWQ2Plots.root", TString Tag="Quasi-Real") {
void PostprocessLOWQ2(TString inName, TString outName, TString Tag) {

SetStyle();

@@ -536,7 +527,7 @@ void Postprocess(TString inName="LOWQ2QRRates3.root", TString outName="LOWQ2Plot
//----------------------------------------------------------------------
// Main function to create canvases
//----------------------------------------------------------------------
void PostprocessLOWQ2() {
// Postprocess("plots/LOWQ2QRRecon2.root", "plots/LOWQ2QR_FormattedPlots.root", "Quasi-Real");
Postprocess("plots/LOWQ2BremsRecon3.root", "plots/LOWQ2Brems_FormattedPlots3.root", "Bremsstrahlung");
}
// void PostprocessLOWQ2() {
// // Postprocess("plots/LOWQ2QRRecon2.root", "plots/LOWQ2QR_FormattedPlots.root", "Quasi-Real");
// Postprocess("plots/LOWQ2BremsRecon3.root", "plots/LOWQ2Brems_FormattedPlots3.root", "Bremsstrahlung");
// }
2 changes: 1 addition & 1 deletion benchmarks/LOWQ2/analysis/RunLOWQ2.C
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ void RunLOWQ2( std::string inputFileName = "Brems_input.root",
bool inputIsTimeBased = false, // true if the event sample is time-based, false if it is event-based
double timeWindow = 10.15*1e-9, //[s]
double eventCrossSection = 0.0551, // [mb]
double luminosity = 1e34, // [cm^-2 s^-1]
double luminosity = 1e34 // [cm^-2 s^-1]
) {

//Set implicit multi-threading
79 changes: 73 additions & 6 deletions benchmarks/LOWQ2/analysis/Snakefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,88 @@
# Possible tags for local/remote running
tag_params = {
"QR": {"timeBased": 0, "timeWindow": 0, "eventCrossSection": 0.0551, "tagName": "Quasi-Real"},
"Brem": {"timeBased": 1, "timeWindow": 10.15*1e-9, "eventCrossSection": 0, "tagName": "Bremsstrahlung"},
"pythia6": {"timeBased": 0, "timeWindow": 0, "eventCrossSection": 0.054, "tagName": "Deep Inelastic Scattering"},
# Add more mappings here if needed
}

EVENT_EXTENSION = ".ab.hepmc3.tree.root"
SIM_EXTENSION = ".edm4hep.root"
RECO_EXTENSION = ".eicrecon.tree.edm4eic.root"

REMOTE_EVENTS_DIRECTORY = "root://dtn-eic.jlab.org//work/eic2/EPIC/EVGEN/SIDIS/pythia6-eic/1.0.0/10x100/q2_0to1/"
FILE_BASE = "pythia_ep_noradcor_10x100_q2_0.000000001_1.0_run"

BEAM_ENERGY = "10"
XML_FILE = "/opt/detector/epic-main/share/epic/epic.xml",

# Function to check if the remote file exists
def remote_file_exists(server,url):
try:
subprocess.check_output(['xrdfs', server, 'stat', url])
return url
except subprocess.CalledProcessError:
return None

rule run_simulation_remote:
params:
XML=XML_FILE,
input=remote_file_exists(REMOTE_EVENTS_DIRECTORY+FILE_BASE+wildcards.index+EVENT_EXTENSION),
output:
config["SIM_DIRECTORY"]+FILE_BASE+"{index}_tagger"+SIM_EXTENSION,
shell: """
npsim \
--inputFiles {params.input} \
--outputFile {output[0]} \
--compactFile {params.XML} \
--runType run \
--numberOfEvents 100 \
--physics.list FTFP_BERT \
--field.eps_min 5e-06 \
--field.eps_max 1e-04 \
--physics.rangecut 50 \
"""

rule run_reconstruction:
params:
XML=XML_FILE,
beam_energy=BEAM_ENERGY,
collections="TaggerTrackerProjectedTracks,MCScatteredElectrons,MCParticles,EventHeader",
input:
expand(
config["SIM_DIRECTORY"]+FILE_BASE+"{index}_tagger"+SIM_EXTENSION,
index=range(1,4),
),
output:
config["RECO_DIRECTORY"]+FILE_BASE+".tagger_recon"+RECO_EXTENSION,
shell: """
eicrecon {input} -Pdd4hep:xml_files={params.XML} -Ppodio:output_include_collections={params.collections} -Ppodio:output_file={output} -PLOWQ2:LowQ2Trajectories:electron_beamE={params.beam_energy}
"""

rule run_benchmarks:
input:
"/scratch/EIC/ReconOut/{tag}_new.root"
params:
crossSection = 0.0551,
xmlName=XMLFILE,
timeBased = lambda wildcards: tag_params[wildcards.tag]["timeBased"],
timeWindow = lambda wildcards: tag_params[wildcards.tag]["timeWindow"],
eventCrossSection = lambda wildcards: tag_params[wildcards.tag]["eventCrossSection"]

output:
"plots/LOWQ2{tag}_Recon.root"
"{dir}/results/LOWQ2/LOWQ2{tag}_Plots.root"
shell:
"""
root -l -b -q 'RunLOWQ2.C++("{input}", "{output}", {params.crossSection})'
root -l -b -q 'RunLOWQ2.C++("{input}", "{output}", "{params.xmlName}", {params.timeBased}, {params.timeWindow}, {params.eventCrossSection})'
"""

rule run_plots:
input:
"plots/LOWQ2{tag}_Recon.root"
"{dir}/results/LOWQ2/LOWQ2{tag}_Plots.root"
params:
tagName = lambda wildcards: tag_params[wildcards.tag]["tagName"],
output:
"plots/LOWQ2{tag}_FormattedPlots2.root"
"{dir}/results/LOWQ2/LOWQ2{tag}_FormattedPlots.root"
shell:
"""
root -l -b -q 'PostprocessLOWQ2.C("{input}", "{output}","{wildcards.tag}")'
root -l -b -q 'PostprocessLOWQ2.C("{input}", "{output}","{params.tagName}")'
"""
7 changes: 2 additions & 5 deletions benchmarks/LOWQ2/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
training:
# Training configuration goes here

analysis:
# Analysis configuration goes here
include:
- local: 'analysis/config.yml'