Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
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
2 changes: 1 addition & 1 deletion benchmarks/tracking_performances/NhitsvsEta_ePIC.C
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void NhitsvsEta_ePIC(TString filePath="", TString label="", TString output_prefi
hits->SetLineWidth(2);
hits->Draw("hist");
TPaveText *pt = new TPaveText(0.1, 0.95, 0.9, 1.0, "NDC");
pt->AddText(Form("p_{mc} = %1.1f GeV/c",pmc));
pt->AddText(Form("MC Truth-Level Hits; p_{mc} = %1.1f GeV/c",pmc));
pt->SetBorderSize(0);
pt->SetFillStyle(0);
pt->SetTextAlign(23);
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/tracking_performances/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -274,8 +274,8 @@ rule tracking_performance_campaigns:
expand(
"results/tracking_performances/{CAMPAIGN}",
CAMPAIGN=[
"24.10.1",
"25.07.0",
"25.08.0",
"25.10.4",
],
)
50 changes: 47 additions & 3 deletions benchmarks/tracking_performances/Tracking_Performances.C
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Code to extract the Tracking Performances
// Shyam Kumar; INFN Bari, Italy
// [email protected]; [email protected]
// Pull distributions: https://indico.bnl.gov/event/28544/contributions/109057/attachments/62799/108633/ePIC_Tracking_Meeting_30June2025_ShyamKumar.pdf

#include "TGraphErrors.h"
#include "TF1.h"
Expand Down Expand Up @@ -30,7 +31,7 @@ void Tracking_Performances(TString filename="tracking_output",TString particle="
int nfiles = 100;
double eta[nbins_eta+1]={-3.5,-2.5,-1.0,1.0,2.5,3.5};
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], *hpull_invp[nbins_eta], *hpull_d0xy[nbins_eta], *hpull_d0z[nbins_eta], *hpull_phi[nbins_eta], *hpull_theta[nbins_eta];

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,201,0.,20.1);
Expand All @@ -39,6 +40,26 @@ void Tracking_Performances(TString filename="tracking_output",TString particle="
histp[i] = new TH1D(Form("hist_etabin%d",i),Form("hist_etabin%d",i),600,-0.3,0.3);
histp[i]->SetTitle(Form("%1.1f < #eta < %1.1f && p = %1.1f ",eta[i],eta[i+1],mom));
histp[i]->SetName(Form("hist_mom_%1.1f_%1.1f_pmax_%1.1f",mom,eta[i],eta[i+1]));

hpull_invp[i] = new TH1D(Form("hpull_invp_etabin%d",i),Form("hist_etabin%d",i),100,-10.0,10.0);
hpull_invp[i]->SetTitle(Form("%1.1f < #eta < %1.1f && p = %1.1f (GeV/c);Pull (q/p);Entries (a.u.)",eta[i],eta[i+1],mom));
hpull_invp[i]->SetName(Form("hpull_invp_%1.1f_%1.1f_pmax_%1.1f",mom,eta[i],eta[i+1]));

hpull_d0xy[i] = new TH1D(Form("hpull_d0xy_etabin%d",i),Form("hist_etabin%d",i),100,-10.0,10.0);
hpull_d0xy[i]->SetTitle(Form("%1.1f < #eta < %1.1f && p = %1.1f (GeV/c);Pull (d0_{xy});Entries (a.u.)",eta[i],eta[i+1],mom));
hpull_d0xy[i]->SetName(Form("hpull_d0xy_%1.1f_%1.1f_pmax_%1.1f",mom,eta[i],eta[i+1]));

hpull_d0z[i] = new TH1D(Form("hpull_d0z_etabin%d",i),Form("hist_etabin%d",i),100,-10.0,10.0);
hpull_d0z[i]->SetTitle(Form("%1.1f < #eta < %1.1f && p = %1.1f (GeV/c);Pull (d0_{z});Entries (a.u.)",eta[i],eta[i+1],mom));
hpull_d0z[i]->SetName(Form("hpull_d0z_%1.1f_%1.1f_pmax_%1.1f",mom,eta[i],eta[i+1]));

hpull_phi[i] = new TH1D(Form("hpull_phi_etabin%d",i),Form("hist_etabin%d",i),100,-10.0,10.0);
hpull_phi[i]->SetTitle(Form("%1.1f < #eta < %1.1f && p = %1.1f (GeV/c);Pull (#phi);Entries (a.u.)",eta[i],eta[i+1],mom));
hpull_phi[i]->SetName(Form("hpull_phi_%1.1f_%1.1f_pmax_%1.1f",mom,eta[i],eta[i+1]));

hpull_theta[i] = new TH1D(Form("hpull_theta_etabin%d",i),Form("hist_etabin%d",i),100,-10.0,10.0);
hpull_theta[i]->SetTitle(Form("%1.1f < #eta < %1.1f && p = %1.1f (GeV/c);Pull (#theta);Entries (a.u.)",eta[i],eta[i+1],mom));
hpull_theta[i]->SetName(Form("hpull_theta_%1.1f_%1.1f_pmax_%1.1f",mom,eta[i],eta[i+1]));
}

TFile* file = TFile::Open(filename.Data());
Expand Down Expand Up @@ -88,6 +109,7 @@ void Tracking_Performances(TString filename="tracking_output",TString particle="
TTreeReaderArray<Float_t> theta(myReader, Form("CentralCKF%sTrackParameters.theta",tag.Data()));
TTreeReaderArray<Float_t> phi(myReader, Form("CentralCKF%sTrackParameters.phi",tag.Data()));
TTreeReaderArray<Float_t> qoverp(myReader, Form("CentralCKF%sTrackParameters.qOverP",tag.Data()));
TTreeReaderArray<std::array<float, 21>> rcTrkCov(myReader, Form("CentralCKF%sTrackParameters.covariance.covariance[21]",tag.Data()));

int count =0;
int matchId = 1; // Always matched track assigned the index 0
Expand All @@ -111,9 +133,24 @@ void Tracking_Performances(TString filename="tracking_output",TString particle="

Double_t etamc = -1.0*TMath::Log(TMath::Tan((TMath::ACos(pzmc/fabs(pmc)))/2));
Double_t p_resol = (prec-pmc)/pmc;
// Accessing the pull distributions
std::array<float, 21>& cov = rcTrkCov.At(j); // access covariance
Double_t pull_invmom = (fabs(1./prec)-fabs(1./pmc))/sqrt(cov[14]); // cov[14] = sigma_1/p^2
Double_t pull_dcaxy = d0xy[j]/sqrt(cov[0]); // cov[0] = sigma_l0^2
Double_t pull_dcaz = d0z[j]/sqrt(cov[2]); // cov[2] = sigma_l1^2
Double_t pull_phi = (phi[j]-phi_mc)/sqrt(cov[5]);
Double_t pull_theta = (theta[j]-theta_mc)/sqrt(cov[9]);


for (int ibin=0; ibin<nbins_eta; ++ibin){
if(etamc>eta[ibin] && etamc<eta[ibin+1]) histp[ibin]->Fill(p_resol);
if(etamc>eta[ibin] && etamc<eta[ibin+1]){
histp[ibin]->Fill(p_resol);
hpull_invp[ibin]->Fill(pull_invmom);
hpull_d0xy[ibin]->Fill(pull_dcaxy);
hpull_d0z[ibin]->Fill(pull_dcaz);
hpull_phi[ibin]->Fill(pull_phi);
hpull_theta[ibin]->Fill(pull_theta);
}
}
h_d0xy_3d->Fill(d0xy[j]*0.1, etamc, ptmc); // cm
h_d0z_3d->Fill(d0z[j]*0.1, etamc, ptmc); // cm
Expand All @@ -124,7 +161,14 @@ void Tracking_Performances(TString filename="tracking_output",TString particle="

TFile *fout_mom = new TFile(Form("%s/%s/mom/Performances_mom_%1.1f_%s_%s.root",dir.Data(),particle.Data(),mom,dist_dir_mom.Data(),particle.Data()),"recreate");
fout_mom->cd();
for (int ibin=0; ibin<nbins_eta; ++ibin) histp[ibin]->Write();
for (int ibin=0; ibin<nbins_eta; ++ibin){
histp[ibin]->Write();
hpull_invp[ibin]->Write();
hpull_d0xy[ibin]->Write();
hpull_d0z[ibin]->Write();
hpull_phi[ibin]->Write();
hpull_theta[ibin]->Write();
}
fout_mom->Close();

TFile *fout_dca = new TFile(Form("%s/%s/dca/Performances_dca_%1.1f_%s_%s.root",dir.Data(),particle.Data(),mom,dist_dir_dca.Data(),particle.Data()),"recreate");
Expand Down
75 changes: 75 additions & 0 deletions benchmarks/tracking_performances/draw_Pulls.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
// Macro to draw the pulls of the track parameters
// Shyam Kumar; INFN Bari, [email protected]

void draw_Pulls(TString particle = "pi-", double etamin = -1.0, double etamax = 1.0){

gStyle->SetPalette(kRainBow);
gStyle->SetTitleSize(0.045,"XY");
gStyle->SetTitleSize(0.04,"XY");
gStyle->SetLabelSize(0.04,"XY");
gStyle->SetTitleOffset(1.0,"XY");
gStyle->SetOptStat(1);
gStyle->SetOptFit(1);
gStyle->SetOptTitle(1);
gStyle->SetGridColor(kBlack);
gStyle->SetGridWidth(2);
gStyle->SetGridStyle(2);

const Int_t nfiles = 6;
double mom[nfiles] ={0.5,1.0,2.0,5.0,10.0,20.0};
TFile *fmom_real[nfiles];

for (int i =0; i<nfiles; ++i){

TCanvas *can = new TCanvas("can","can",1400,1000);
can->SetMargin(0.10, 0.05 ,0.1,0.07);

fmom_real[i] = TFile::Open(Form("./realseed/pi-/mom/Performances_mom_%1.1f_mom_resol_realseed_%s.root",mom[i],particle.Data()));
TH1D *hpull_invp = (TH1D*) fmom_real[i]->Get(Form("hpull_invp_%1.1f_%1.1f_pmax_%1.1f",mom[i],etamin,etamax));
TH1D *hpull_d0xy = (TH1D*) fmom_real[i]->Get(Form("hpull_d0xy_%1.1f_%1.1f_pmax_%1.1f",mom[i],etamin,etamax));
TH1D *hpull_d0z = (TH1D*) fmom_real[i]->Get(Form("hpull_d0z_%1.1f_%1.1f_pmax_%1.1f",mom[i],etamin,etamax));
TH1D *hpull_phi = (TH1D*) fmom_real[i]->Get(Form("hpull_phi_%1.1f_%1.1f_pmax_%1.1f",mom[i],etamin,etamax));
TH1D *hpull_theta = (TH1D*) fmom_real[i]->Get(Form("hpull_theta_%1.1f_%1.1f_pmax_%1.1f",mom[i],etamin,etamax));

can->cd();
hpull_invp->Draw("hist")
can->SaveAs(Form("Final_Results/%s/mom/hpull_invp_%1.1f_%1.1f_pmax_%1.1f",particle.Data(),etamin,etamax,mom[i]));
Copy link
Member

Choose a reason for hiding this comment

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

Need to add these paths to output of tracking_performance_summary_at_eta rule and input of the tracking_performance rule

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks. I did it.


can->Clear(); can->cd();
hpull_d0xy->Draw("hist")
can->SaveAs(Form("Final_Results/%s/mom/hpull_d0xy_%1.1f_%1.1f_pmax_%1.1f",particle.Data(),etamin,etamax,mom[i]));

can->Clear(); can->cd();
hpull_d0z->Draw("hist")
can->SaveAs(Form("Final_Results/%s/mom/hpull_d0z_%1.1f_%1.1f_pmax_%1.1f",particle.Data(),etamin,etamax,mom[i]));

can->Clear(); can->cd();
hpull_phi->Draw("hist")
can->SaveAs(Form("Final_Results/%s/mom/hpull_phi_%1.1f_%1.1f_pmax_%1.1f",particle.Data(),etamin,etamax,mom[i]));

can->Clear(); can->cd();
hpull_theta->Draw("hist")
can->SaveAs(Form("Final_Results/%s/mom/hpull_theta_%1.1f_%1.1f_pmax_%1.1f",particle.Data(),etamin,etamax,mom[i]));

}

}