Skip to content
Snippets Groups Projects
Commit 19de0a0a authored by Zhenyu Ye's avatar Zhenyu Ye
Browse files

Debug TOF

parent fd459df1
Branches
No related tags found
1 merge request!92Draft: Resolve "Add TOF benchmark"
...@@ -34,12 +34,12 @@ void gen_tof_hits(int n_events = 100, ...@@ -34,12 +34,12 @@ void gen_tof_hits(int n_events = 100,
// pdgid 11 - electron // pdgid 11 - electron
// pdgid 111 - pi0 // pdgid 111 - pi0
// pdgid 2212 - proton // pdgid 2212 - proton
Double_t p = r1->Uniform(0.2, 2);
for (int ip = 0; ip < n_parts; ip++) { for (int ip = 0; ip < n_parts; ip++) {
GenParticlePtr p1 = std::make_shared<GenParticle>(FourVector(0.0, 0.0, 10.0, 10.0), 11, 4); GenParticlePtr p1 = std::make_shared<GenParticle>(FourVector(0.0, 0.0, 10.0, 10.0), 11, 4);
GenParticlePtr p2 = std::make_shared<GenParticle>(FourVector(0.0, 0.0, 0.0, 0.938), 2212, 4); GenParticlePtr p2 = std::make_shared<GenParticle>(FourVector(0.0, 0.0, 0.0, 0.938), 2212, 4);
// Define momentum // Define momentum
Double_t p = r1->Uniform(0.2, 2);
Double_t phi = r1->Uniform(0.0, 2.0 * M_PI); Double_t phi = r1->Uniform(0.0, 2.0 * M_PI);
Double_t costh = 0; //r1->Uniform(cos_theta_min, cos_theta_max); Double_t costh = 0; //r1->Uniform(cos_theta_min, cos_theta_max);
Double_t th = std::acos(costh); Double_t th = std::acos(costh);
......
...@@ -96,7 +96,6 @@ int sim_tof_hits(const char* fname = "sim_tof_hits.root") ...@@ -96,7 +96,6 @@ int sim_tof_hits(const char* fname = "sim_tof_hits.root")
.Define("N_VertexBarrelHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"VertexBarrelHits"}) .Define("N_VertexBarrelHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"VertexBarrelHits"})
.Define("N_VertexEndcapHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"VertexEndcapHits"}) .Define("N_VertexEndcapHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"VertexEndcapHits"})
.Define("N_BarrelHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerBarrelHits"}) .Define("N_BarrelHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerBarrelHits"})
.Define("p_barrelhits", momentum, {"BarrelTOFHits.momentum"})
.Define("N_EndcapHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerEndcapHits"}) .Define("N_EndcapHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"TrackerEndcapHits"})
.Define("N_BarrelTOFHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"BarrelTOFHits"}) .Define("N_BarrelTOFHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"BarrelTOFHits"})
.Define("N_ForwardTOFHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"ForwardTOFHits"}) .Define("N_ForwardTOFHits", [](std::vector<dd4pod::TrackerHitData> hits) { return hits.size();}, {"ForwardTOFHits"})
...@@ -148,9 +147,9 @@ int sim_tof_hits(const char* fname = "sim_tof_hits.root") ...@@ -148,9 +147,9 @@ int sim_tof_hits(const char* fname = "sim_tof_hits.root")
auto hVertexEndcap_N_vs_theta = df0.Histo1D({"hVertexEndcap_N_vs_theta", "; #theta [deg.]", 20, 0, 180 }, "theta0", "N_VertexEndcapHits"); auto hVertexEndcap_N_vs_theta = df0.Histo1D({"hVertexEndcap_N_vs_theta", "; #theta [deg.]", 20, 0, 180 }, "theta0", "N_VertexEndcapHits");
auto hBarrelTof_time_vs_momentum = df0.Histo2D( auto hBarrelTof_time_vs_length = df0.Histo2D(
{"hBarrelTof_time_vs_momentum", "; time ; momentum ", 100, 0, 3, 100, 0, 5}, {"hBarrelTof_time_vs_length", "; time ; length ", 100, 0, 10, 100, 0, 1},
"BarrelTOFHits.truth.time", "p_barrelhits"); "BarrelTOFHits.truth.time", "BarrelTOFHits.length");
auto hBarrelTof_x_vs_y = df0.Histo2D( auto hBarrelTof_x_vs_y = df0.Histo2D(
{"hBarrelTof_x_vs_y", "; x ; y ", 100, -600, 600, 100, -600, 600}, {"hBarrelTof_x_vs_y", "; x ; y ", 100, -600, 600, 100, -600, 600},
...@@ -291,9 +290,9 @@ int sim_tof_hits(const char* fname = "sim_tof_hits.root") ...@@ -291,9 +290,9 @@ int sim_tof_hits(const char* fname = "sim_tof_hits.root")
c = new TCanvas(); c = new TCanvas();
hBarrelTof_time_vs_momentum->DrawCopy("colz"); hBarrelTof_time_vs_length->DrawCopy("colz");
c->SaveAs("results/tof/sim_tof_hits_tofBarrel_tp.png"); c->SaveAs("results/tof/sim_tof_hits_tofBarrel_tl.png");
c->SaveAs("results/tof/sim_tof_hits_tofBarrel_tp.pdf"); c->SaveAs("results/tof/sim_tof_hits_tofBarrel_tl.pdf");
c = new TCanvas(); c = new TCanvas();
hBarrelTof_x_vs_y->DrawCopy("colz"); hBarrelTof_x_vs_y->DrawCopy("colz");
c->SaveAs("results/tof/sim_tof_hits_tofBarrel_xy.png"); c->SaveAs("results/tof/sim_tof_hits_tofBarrel_xy.png");
......
...@@ -57,7 +57,7 @@ if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then ...@@ -57,7 +57,7 @@ if [[ ! -n "${JUGGLER_N_EVENTS}" ]] ; then
export JUGGLER_N_EVENTS=100 export JUGGLER_N_EVENTS=100
fi fi
export JUGGLER_N_EVENTS=5 export JUGGLER_N_EVENTS=100
export JUGGLER_FILE_NAME_TAG="tof_hits" export JUGGLER_FILE_NAME_TAG="tof_hits"
export JUGGLER_GEN_FILE="${LOCAL_DATA_PATH}/${JUGGLER_FILE_NAME_TAG}.hepmc" export JUGGLER_GEN_FILE="${LOCAL_DATA_PATH}/${JUGGLER_FILE_NAME_TAG}.hepmc"
...@@ -111,7 +111,7 @@ fi ...@@ -111,7 +111,7 @@ fi
root_filesize=$(stat --format=%s "${JUGGLER_SIM_FILE}") root_filesize=$(stat --format=%s "${JUGGLER_SIM_FILE}")
if [[ "${JUGGLER_N_EVENTS}" -lt "500" ]] ; then if [[ "${JUGGLER_N_EVENTS}" -lt "500" ]] ; then
# file must be less than 10 MB to upload # file must be less than 10 MB to upload
if [[ "${root_filesize}" -lt "10000000" ]] ; then if [[ "${root_filesize}" -lt "50000000" ]] ; then
cp ${JUGGLER_SIM_FILE} results/. cp ${JUGGLER_SIM_FILE} results/.
fi fi
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment