Skip to content
Snippets Groups Projects
Unverified Commit 0a6a4816 authored by Shyam Kumar's avatar Shyam Kumar Committed by GitHub
Browse files

Merge pull request #35 from eic/pr/tracking_performance_campaigns

tracking_performance: enable running over campaigns
parents 45d83752 e815da28
No related branches found
No related tags found
No related merge requests found
Pipeline #98829 passed with warnings with stages
in 2 hours, 29 minutes, and 16 seconds
...@@ -121,6 +121,9 @@ get_data: ...@@ -121,6 +121,9 @@ get_data:
- mkdir "${DETECTOR_CONFIG}" - mkdir "${DETECTOR_CONFIG}"
- ln -s "${LOCAL_DATA_PATH}/sim_output" "${DETECTOR_CONFIG}/sim_output" - ln -s "${LOCAL_DATA_PATH}/sim_output" "${DETECTOR_CONFIG}/sim_output"
- ln -s "../results" "${DETECTOR_CONFIG}/results" - ln -s "../results" "${DETECTOR_CONFIG}/results"
# cache downloaded artifacts
- if [ -d /scratch ]; then mkdir -p /scratch/EPIC; ln -sf /scratch/EPIC ./EPIC; fi
- du -hs /scratch/EPIC
- ls -lrtha - ls -lrtha
retry: retry:
max: 2 max: 2
......
Shyam Kumar; INFN Bari, Italy; shyam055119@gmail.com Shyam Kumar; INFN Bari, Italy; shyam055119@gmail.com
Method to produce the tracking performances with ePIC tracker Method to produce the tracking performances with ePIC tracker
The scripts can be used to create the debug plots for the momentum resolutions. The scripts can be used to create the debug plots for the momentum resolutions.
In the first step enter inside eic-shell and create a directory (your preferred name) there and put all the script inside that.
Simply run the command source Script_widebin.sh To run a full simulation-reconstruction-analysis chain do:
```
snakemake -c2 results/tracking_performances/local
```
or, referencing it by the rule name:
```
snakemake --cores 1 tracking_performance_local
```
To process an individual campaign do:
```
snakemake -c2 results/tracking_performances/24.04.0
```
It will produce the results with truth/realistic seeding. It will produce the results with truth/realistic seeding.
...@@ -48,17 +48,26 @@ rule tracking_performance_at_momentum: ...@@ -48,17 +48,26 @@ rule tracking_performance_at_momentum:
input: input:
script="benchmarks/tracking_performances/Tracking_Performances.C", script="benchmarks/tracking_performances/Tracking_Performances.C",
# TODO pass as a file list? # TODO pass as a file list?
sim=lambda wildcards: expand( sim=lambda wildcards:
"sim_output/tracking_performance/{DETECTOR_CONFIG}/{{PARTICLE}}/{ENERGY}/{PHASE_SPACE}/{{PARTICLE}}_{ENERGY}_{PHASE_SPACE}.{INDEX:04d}.eicrecon.tree.edm4eic.root", expand(
DETECTOR_CONFIG="epic_craterlake_tracking_only", "sim_output/tracking_performance/{DETECTOR_CONFIG}/{{PARTICLE}}/{ENERGY}/{PHASE_SPACE}/{{PARTICLE}}_{ENERGY}_{PHASE_SPACE}.{INDEX:04d}.eicrecon.tree.edm4eic.root",
ENERGY=f"{float(wildcards.MOMENTUM):.0f}GeV" if float(wildcards.MOMENTUM) >= 1 else f"{float(wildcards.MOMENTUM) * 1000:.0f}MeV", DETECTOR_CONFIG="epic_craterlake_tracking_only",
PHASE_SPACE=["3to50deg", "45to135deg", "130to177deg"], ENERGY=f"{float(wildcards.MOMENTUM):.0f}GeV" if float(wildcards.MOMENTUM) >= 1 else f"{float(wildcards.MOMENTUM) * 1000:.0f}MeV",
INDEX=range(1), PHASE_SPACE=["3to50deg", "45to135deg", "130to177deg"],
), INDEX=range(1),
)
if wildcards.CAMPAIGN == "local" else
expand(
"EPIC/RECO/{{CAMPAIGN}}/epic_craterlake/SINGLE/{{PARTICLE}}/{ENERGY}/{PHASE_SPACE}/{{PARTICLE}}_{ENERGY}_{PHASE_SPACE}.{INDEX:04d}.eicrecon.tree.edm4eic.root",
DETECTOR_CONFIG="epic_craterlake",
ENERGY=f"{float(wildcards.MOMENTUM):.0f}GeV" if float(wildcards.MOMENTUM) >= 1 else f"{float(wildcards.MOMENTUM) * 1000:.0f}MeV",
PHASE_SPACE=["3to50deg", "45to135deg", "130to177deg"],
INDEX=range(1),
),
output: output:
"{SEEDING}/pi-/mom/Performances_mom_{MOMENTUM}_mom_resol_{SEEDING_IGNORE}_{PARTICLE}.root", "{CAMPAIGN}/{SEEDING}/pi-/mom/Performances_mom_{MOMENTUM}_mom_resol_{SEEDING_IGNORE}_{PARTICLE}.root",
"{SEEDING}/pi-/dca/Performances_dca_{MOMENTUM}_dca_resol_{SEEDING_IGNORE}_{PARTICLE}.root", "{CAMPAIGN}/{SEEDING}/pi-/dca/Performances_dca_{MOMENTUM}_dca_resol_{SEEDING_IGNORE}_{PARTICLE}.root",
combined_root=temp("sim_{SEEDING}_{MOMENTUM}_{SEEDING_IGNORE}_{PARTICLE}.root"), combined_root=temp("{CAMPAIGN}/sim_{SEEDING}_{MOMENTUM}_{SEEDING_IGNORE}_{PARTICLE}.root"),
shell: shell:
""" """
if [[ "{wildcards.SEEDING}" == "truthseed" ]]; then if [[ "{wildcards.SEEDING}" == "truthseed" ]]; then
...@@ -67,7 +76,8 @@ elif [[ "{wildcards.SEEDING}" == "realseed" ]]; then ...@@ -67,7 +76,8 @@ elif [[ "{wildcards.SEEDING}" == "realseed" ]]; then
SEEDING="Seeded" SEEDING="Seeded"
fi fi
hadd {output.combined_root} {input.sim} hadd {output.combined_root} {input.sim}
root -l -b -q {input.script}'("{output.combined_root}", "{wildcards.PARTICLE}", {wildcards.MOMENTUM}, 0.15, "'$SEEDING'")' cd {wildcards.CAMPAIGN}
root -l -b -q ../{input.script}'("../{output.combined_root}", "{wildcards.PARTICLE}", {wildcards.MOMENTUM}, 0.15, "'$SEEDING'")'
""" """
...@@ -75,31 +85,40 @@ rule tracking_performance_summary_at_eta: ...@@ -75,31 +85,40 @@ rule tracking_performance_summary_at_eta:
input: input:
expand( expand(
[ [
"truthseed/pi-/mom/Performances_mom_{MOMENTUM:.1f}_mom_resol_truth_pi-.root", "{{CAMPAIGN}}/truthseed/pi-/mom/Performances_mom_{MOMENTUM:.1f}_mom_resol_truth_pi-.root",
"truthseed/pi-/dca/Performances_dca_{MOMENTUM:.1f}_dca_resol_truth_pi-.root", "{{CAMPAIGN}}/truthseed/pi-/dca/Performances_dca_{MOMENTUM:.1f}_dca_resol_truth_pi-.root",
"realseed/pi-/mom/Performances_mom_{MOMENTUM:.1f}_mom_resol_realseed_pi-.root", "{{CAMPAIGN}}/realseed/pi-/mom/Performances_mom_{MOMENTUM:.1f}_mom_resol_realseed_pi-.root",
"realseed/pi-/dca/Performances_dca_{MOMENTUM:.1f}_dca_resol_realseed_pi-.root", "{{CAMPAIGN}}/realseed/pi-/dca/Performances_dca_{MOMENTUM:.1f}_dca_resol_realseed_pi-.root",
], ],
MOMENTUM=[0.5, 1.0, 2.0, 5.0, 10.0, 15.0], MOMENTUM=[0.5, 1.0, 2.0, 5.0, 10.0, 20.0],
), ),
script="benchmarks/tracking_performances/doCompare_truth_real_widebins_mom.C", script="benchmarks/tracking_performances/doCompare_truth_real_widebins_mom.C",
output: output:
expand( expand(
"Debug_Plots/{SEEDING}/pi-/mom/{SEEDING}_mom_resol_mom{MOMENTUM:.1f}_{{ETA_MIN}}_eta_{{ETA_MAX}}.png", "{{CAMPAIGN}}/Debug_Plots/{SEEDING}/pi-/mom/{SEEDING}_mom_resol_mom{MOMENTUM:.1f}_{{ETA_MIN}}_eta_{{ETA_MAX}}.png",
SEEDING=["real", "truth"], SEEDING=["real", "truth"],
MOMENTUM=[0.5, 1.0, 2.0, 5.0, 10.0, 15.0], MOMENTUM=[0.5, 1.0, 2.0, 5.0, 10.0, 20.0],
), ),
"Final_Results/pi-/mom/mom_resol_{ETA_MIN}_eta_{ETA_MAX}.png", "{CAMPAIGN}/Final_Results/pi-/mom/mom_resol_{ETA_MIN}_eta_{ETA_MAX}.png",
"Final_Results/pi-/mom/mom_resol_{ETA_MIN}_eta_{ETA_MAX}.root", "{CAMPAIGN}/Final_Results/pi-/mom/mom_resol_{ETA_MIN}_eta_{ETA_MAX}.root",
shell: shell:
""" """
set +e if [[ "{wildcards.CAMPAIGN}" == "local" ]]; then
EPIC_VERSION="$(echo $DETECTOR_PATH | sed -n -e 's/.*epic-\([^-]\+\).*/\\1/p')" set +e
EICRECON_VERSION="$(eicrecon -v | sed -n -e 's/.*\(v[0-9.]\+\).*/\\1/p')" EPIC_VERSION="${{DETECTOR_VERSION:-}}"
set -e EICRECON_VERSION="$(eicrecon -v | sed -n -e 's/.*\(v[0-9\.]\+\).*/\\1/p')"
echo "ePIC version: $EPIC_VERSION" # Legacy detection
echo "EICrecon version: $EICRECON_VERSION" : ${{EPIC_VERSION:="$(echo $DETECTOR_PATH | sed -n -e 's/.*epic-\([^-/]\+\).*/\\1/p')"}}
root -l -b -q {input.script}'("pi-", {wildcards.ETA_MIN}, {wildcards.ETA_MAX}, 1., true, "'$EPIC_VERSION'", "'$EICRECON_VERSION'")' set -e
echo "ePIC version: $EPIC_VERSION"
echo "EICrecon version: $EICRECON_VERSION"
EXTRA_LEGEND="ePIC $EPIC_VERSION / EICrecon $EICRECON_VERSION"
else
EXTRA_LEGEND="ePIC Simulation {wildcards.CAMPAIGN}"
fi
cd {wildcards.CAMPAIGN}
root -l -b -q ../{input.script}'("pi-", {wildcards.ETA_MIN}, {wildcards.ETA_MAX}, 1., true, "'"$EXTRA_LEGEND"'")'
""" """
...@@ -109,15 +128,34 @@ rule tracking_performance: ...@@ -109,15 +128,34 @@ rule tracking_performance:
input: input:
expand( expand(
[ [
"Final_Results/pi-/mom/mom_resol_{ETA_BIN}.png", "{{CAMPAIGN}}/Final_Results/pi-/mom/mom_resol_{ETA_BIN}.png",
"Final_Results/pi-/mom/mom_resol_{ETA_BIN}.root", "{{CAMPAIGN}}/Final_Results/pi-/mom/mom_resol_{ETA_BIN}.root",
], ],
ETA_BIN=[f"{eta_min:.1f}_eta_{eta_max:.1f}" for eta_min, eta_max in zip(TRACKING_PERFORMANCE_ETA_BINS[:-1], TRACKING_PERFORMANCE_ETA_BINS[1:])], ETA_BIN=[f"{eta_min:.1f}_eta_{eta_max:.1f}" for eta_min, eta_max in zip(TRACKING_PERFORMANCE_ETA_BINS[:-1], TRACKING_PERFORMANCE_ETA_BINS[1:])],
), ),
output: output:
directory("results/tracking_performances") directory("results/tracking_performances/{CAMPAIGN}/")
shell: shell:
""" """
mkdir {output} mkdir {output}
cp {input} {output} cp {input} {output}
""" """
rule tracking_performance_local:
input:
"results/tracking_performances/local",
rule tracking_performance_campaigns:
input:
expand(
"results/tracking_performances/{CAMPAIGN}",
CAMPAIGN=[
"23.10.0",
"23.11.0",
"23.12.0",
"24.03.1",
"24.04.0",
],
)
...@@ -34,11 +34,11 @@ void Tracking_Performances(TString filename="tracking_output",TString particle=" ...@@ -34,11 +34,11 @@ void Tracking_Performances(TString filename="tracking_output",TString particle="
int theta_val[nbins_eta+1] ={3,50,45,135,130,177}; int theta_val[nbins_eta+1] ={3,50,45,135,130,177};
int nfiles = 100; int nfiles = 100;
double eta[nbins_eta+1]={-3.5,-2.5,-1.0,1.0,2.5,3.5}; double eta[nbins_eta+1]={-3.5,-2.5,-1.0,1.0,2.5,3.5};
double pt[nbins_eta+1]={0.1,0.5,1.0,2.0,5.0,10.0}; double pt[nbins_eta+1]={0.5,1.0,2.0,5.0,10.0,20.1};
TH1D *histp[nbins_eta]; TH1D *histp[nbins_eta];
TH3D *h_d0xy_3d= new TH3D("h_d0xy_3d","Transverse Pointing Resolution",500,-0.1,0.1,70,-3.5,3.5,200,0.,20.); TH3D *h_d0xy_3d= new TH3D("h_d0xy_3d","Transverse Pointing Resolution",500,-0.1,0.1,70,-3.5,3.5,201,0.,20.1);
TH3D *h_d0z_3d= new TH3D("h_d0z_3d","Longitudinal Pointing Resolution",500,-0.1,0.1,70,-3.5,3.5,200,0.,20.); TH3D *h_d0z_3d= new TH3D("h_d0z_3d","Longitudinal Pointing Resolution",500,-0.1,0.1,70,-3.5,3.5,201,0.,20.1);
for (int i=0; i<nbins_eta; i++){ for (int i=0; i<nbins_eta; i++){
histp[i] = new TH1D(Form("hist_etabin%d",i),Form("hist_etabin%d",i),600,-0.3,0.3); histp[i] = new TH1D(Form("hist_etabin%d",i),Form("hist_etabin%d",i),600,-0.3,0.3);
...@@ -82,7 +82,7 @@ void Tracking_Performances(TString filename="tracking_output",TString particle=" ...@@ -82,7 +82,7 @@ void Tracking_Performances(TString filename="tracking_output",TString particle="
if (fabs(ptmc) < pTcut) continue; if (fabs(ptmc) < pTcut) continue;
Double_t pmc = charge[j]*sqrt(px_mc[j]*px_mc[j]+py_mc[j]*py_mc[j]+pz_mc[j]*pz_mc[j]); Double_t pmc = (1./charge[j])*sqrt(px_mc[j]*px_mc[j]+py_mc[j]*py_mc[j]+pz_mc[j]*pz_mc[j]); // 1./(q/p); similar to prec
Double_t prec = 1./qoverp[j]; Double_t prec = 1./qoverp[j];
Double_t pzrec = prec*TMath::Cos(theta[j]); Double_t pt_rec = sqrt(prec*prec-pzrec*pzrec); Double_t pzrec = prec*TMath::Cos(theta[j]); Double_t pt_rec = sqrt(prec*prec-pzrec*pzrec);
......
...@@ -18,7 +18,7 @@ bench:tracking_performance: ...@@ -18,7 +18,7 @@ bench:tracking_performance:
needs: needs:
- ["sim:tracking_performance"] - ["sim:tracking_performance"]
script: script:
- snakemake --cores 1 tracking_performance - snakemake --cores 1 tracking_performance_local
collect_results:tracking_performance: collect_results:tracking_performance:
extends: .det_benchmark extends: .det_benchmark
...@@ -27,3 +27,18 @@ collect_results:tracking_performance: ...@@ -27,3 +27,18 @@ collect_results:tracking_performance:
- "bench:tracking_performance" - "bench:tracking_performance"
script: script:
- ls -lrht - ls -lrht
bench:tracking_performance_campaigns:
extends: .det_benchmark
stage: benchmarks
#when: manual
script:
- snakemake --cores 1 tracking_performance_campaigns
collect_results:tracking_performance_campaigns:
extends: .det_benchmark
stage: collect
needs:
- "bench:tracking_performance_campaigns"
script:
- ls -lrht
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#define mpi 0.139 // 1.864 GeV/c^2 #define mpi 0.139 // 1.864 GeV/c^2
void draw_req_Mom(double etamin, double etamax, double xmin=0., double xmax=0.); void draw_req_Mom(double etamin, double etamax, double xmin=0., double xmax=0.);
void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1.0, double etamax=1.0, double range =0.3, Bool_t drawreq=1, TString epic ="", TString eicrecon = "") // name = p, pt for getting p or pt dependence fitted results void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1.0, double etamax=1.0, double range =0.3, Bool_t drawreq=1, TString extra_legend = "") // name = p, pt for getting p or pt dependence fitted results
{ {
//=== style of the plot========= //=== style of the plot=========
...@@ -24,7 +24,7 @@ void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1 ...@@ -24,7 +24,7 @@ void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1
gStyle->SetOptStat(1); gStyle->SetOptStat(1);
const Int_t nfiles = 6; const Int_t nfiles = 6;
double mom[nfiles] ={0.5,1.0,2.0,5.0,10.0,15.0}; double mom[nfiles] ={0.5,1.0,2.0,5.0,10.0,20.0};
std::vector<double> momV_truth, momV_real, momresolV_truth, err_momresolV_truth, momresolV_real, err_momresolV_real; std::vector<double> momV_truth, momV_real, momresolV_truth, err_momresolV_truth, momresolV_real, err_momresolV_real;
momV_truth.clear(); momV_real.clear(); momresolV_truth.clear(); err_momresolV_truth.clear(); momresolV_real.clear(); err_momresolV_real.clear(); momV_truth.clear(); momV_real.clear(); momresolV_truth.clear(); err_momresolV_truth.clear(); momresolV_real.clear(); err_momresolV_real.clear();
TString symbolname = ""; TString symbolname = "";
...@@ -52,7 +52,8 @@ void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1 ...@@ -52,7 +52,8 @@ void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1
lmom = new TLegend(0.65,0.80,0.90,0.93); lmom = new TLegend(0.65,0.80,0.90,0.93);
lmom->SetTextSize(0.03); lmom->SetTextSize(0.03);
lmom->SetBorderSize(0); lmom->SetBorderSize(0);
lmom->SetHeader(Form("%s ePIC(%s/%s): %1.1f < #eta < %1.1f",symbolname.Data(),epic.Data(),eicrecon.Data(),etamin,etamax),"C"); lmom->SetHeader(extra_legend.Data(), "C");
lmom->AddEntry((TObject*)0, Form("%s, %1.1f < #eta < %1.1f", symbolname.Data(), etamin, etamax), "C");
TF1 *func_truth = new TF1("func_truth","gaus",-0.5,0.5); TF1 *func_truth = new TF1("func_truth","gaus",-0.5,0.5);
TF1 *func_real = new TF1("func_real","gaus",-0.5,0.5); TF1 *func_real = new TF1("func_real","gaus",-0.5,0.5);
...@@ -155,8 +156,8 @@ void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1 ...@@ -155,8 +156,8 @@ void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1
mgMom->Add(gr1); mgMom->Add(gr1);
mgMom->Add(gr2); mgMom->Add(gr2);
c_mom->cd(); c_mom->cd();
mgMom->GetXaxis()->SetRangeUser(0.40,15.2); mgMom->GetXaxis()->SetRangeUser(0.40,20.2);
mgMom->GetYaxis()->SetRangeUser(0.,10.0); mgMom->GetYaxis()->SetRangeUser(0.0,1.50*TMath::MaxElement(gr2->GetN(),gr2->GetY())); // 50% more of the maximum value on yaxis
mgMom->Draw("AP"); mgMom->Draw("AP");
lmom->AddEntry(gr1,"Truth Seeding"); lmom->AddEntry(gr1,"Truth Seeding");
lmom->AddEntry(gr2,"Realistic Seeding"); lmom->AddEntry(gr2,"Realistic Seeding");
...@@ -165,7 +166,7 @@ void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1 ...@@ -165,7 +166,7 @@ void doCompare_truth_real_widebins_mom(TString particle = "pi-",double etamin=-1
c_mom->SaveAs(Form("Final_Results/%s/mom/mom_resol_%1.1f_eta_%1.1f.png",particle.Data(),etamin,etamax)); c_mom->SaveAs(Form("Final_Results/%s/mom/mom_resol_%1.1f_eta_%1.1f.png",particle.Data(),etamin,etamax));
// Write the numbers in output file for comparisons // Write the numbers in output file for comparisons
outfile<<"ePIC"<<setw(20)<<epic.Data()<<setw(20)<<"EICrecon"<<setw(20)<<eicrecon.Data()<<endl; outfile << extra_legend << endl;
outfile<<"Etamin"<<setw(20)<<"Etamax"<<setw(20)<<"p (GeV/c) \t"<<setw(20)<<"Resol #mum (Truth)"<<setw(20)<<"Resol #mum (Real)"<<endl; outfile<<"Etamin"<<setw(20)<<"Etamax"<<setw(20)<<"p (GeV/c) \t"<<setw(20)<<"Resol #mum (Truth)"<<setw(20)<<"Resol #mum (Real)"<<endl;
for (Int_t i = 0; i<gr1->GetN(); ++i){ for (Int_t i = 0; i<gr1->GetN(); ++i){
double x,ytrue, yreal; double x,ytrue, yreal;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment