Skip to content
Snippets Groups Projects
Commit 982bac53 authored by Whitney Armstrong's avatar Whitney Armstrong
Browse files

Added number of tracking hits vs theta plot

	modified:   tracking/scripts/rec_central_electrons.cxx
parent f9ceed71
No related branches found
No related tags found
1 merge request!48Added number of tracking hits vs theta plot
......@@ -17,8 +17,8 @@ using namespace HepMC3;
void gen_central_electrons(int n_events = 100,
const char* out_fname = "central_electrons.hepmc")
{
double cos_theta_min = std::cos( 50.0*(M_PI/180.0));
double cos_theta_max = std::cos(130.0*(M_PI/180.0));
double cos_theta_min = std::cos( 20.0*(M_PI/180.0));
double cos_theta_max = std::cos(160.0*(M_PI/180.0));
WriterAscii hepmc_output(out_fname);
int events_parsed = 0;
......
......@@ -2,6 +2,7 @@
#include "TCanvas.h"
#include "TLegend.h"
#include "TH1D.h"
#include "TProfile.h"
#include <iostream>
......@@ -11,6 +12,7 @@ R__LOAD_LIBRARY(libDD4pod.so)
#include "eicd/TrackParametersCollection.h"
#include "eicd/ClusterCollection.h"
#include "eicd/ClusterData.h"
#include "eicd/TrackerHitCollection.h"
using ROOT::RDataFrame;
using namespace ROOT::VecOps;
......@@ -86,6 +88,8 @@ int rec_central_electrons(const char* fname = "topside/rec_central_electrons.roo
.Define("thrownParticles", "mcparticles2[isThrown]")
.Define("thrownP", fourvec, {"thrownParticles"})
.Define("p_thrown", momentum, {"thrownP"})
.Define("theta_thrown", theta, {"thrownP"})
.Define("theta0", "theta_thrown[0]")
.Define("nTracks", "outputTrackParameters.size()")
.Define("p_track", p_track, {"outputTrackParameters"})
.Define("p_track1", p_track, {"outputTrackParameters1"})
......@@ -95,7 +99,11 @@ int rec_central_electrons(const char* fname = "topside/rec_central_electrons.roo
.Define("delta_p2",delta_p, {"p_track2", "p_thrown"})
.Define("delta_p_over_p0",delta_p_over_p, {"p_track", "p_thrown"})
.Define("delta_p_over_p1",delta_p_over_p, {"p_track1", "p_thrown"})
.Define("delta_p_over_p2",delta_p_over_p, {"p_track2", "p_thrown"});
.Define("delta_p_over_p2",delta_p_over_p, {"p_track2", "p_thrown"})
.Define("N_VtxBarrelHits",[](std::vector<eic::TrackerHitData> hits) { return hits.size();},{"VertexBarrelRecHits"})
.Define("N_SiBarrelHits", [](std::vector<eic::TrackerHitData> hits) { return hits.size();}, {"TrackerBarrelRecHits"})
.Define("N_SiEndcapHits", [](std::vector<eic::TrackerHitData> hits) { return hits.size();}, {"TrackerEndcapRecHits"})
;
auto h_nTracks = df0.Histo1D({"h_nTracks", "; N tracks ", 10, 0, 10}, "nTracks");
auto h_pTracks = df0.Histo1D({"h_pTracks", "; GeV/c ", 100, 0, 10}, "p_track");
......@@ -108,6 +116,18 @@ int rec_central_electrons(const char* fname = "topside/rec_central_electrons.roo
auto h_delta_p1_over_p = df0.Histo1D({"h_delta_p1_over_p", "Ecal Cluster Init; delta p/p ", 100, -0.1, 0.1}, "delta_p_over_p1");
auto h_delta_p2_over_p = df0.Histo1D({"h_delta_p2_over_p", "Ecal Cluster, innner vtx hit Init; delta p/p ", 100, -0.1, 0.1}, "delta_p_over_p2");
auto hSiBarrel_N_vs_theta = df0.Histo1D({"hSiBarrel_N_vs_theta", "; #theta [deg.]", 20, 0, 180 }, "theta0", "N_SiBarrelHits");
auto hSiEndcap_N_vs_theta = df0.Histo1D({"hSiEndcap_N_vs_theta", "; #theta [deg.]", 20, 0, 180 }, "theta0", "N_SiEndcapHits");
auto hVtxBarrel_N_vs_theta = df0.Histo1D({"hVtxBarrel_N_vs_theta", "; #theta [deg.]", 20, 0, 180 }, "theta0", "N_VtxBarrelHits");
auto hSiBarrel_Nhits = df0.Histo1D({"hSiBarrel_Nhits", "; #theta [deg.]", 20, 0, 20 }, "N_SiBarrelHits");
auto hSiEndcap_Nhits = df0.Histo1D({"hSiEndcap_Nhits", "; #theta [deg.]", 20, 0, 20 }, "N_SiEndcapHits");
auto hVtxBarrel_Nhits = df0.Histo1D({"hVtxBarrel_Nhits", "; #theta [deg.]", 20, 0, 20 }, "N_VtxBarrelHits");
auto hSiBarrel_Ntheta = df0.Histo1D({"hSiBarrel_Ntheta", "; #theta [deg.]", 20, 0, 180 }, "theta0");
auto hSiEndcap_Ntheta = df0.Histo1D({"hSiEndcap_Ntheta", "; #theta [deg.]", 20, 0, 180 }, "theta0");
auto hVtxBarrel_Ntheta = df0.Histo1D({"hVtxBarrel_Ntheta", "; #theta [deg.]", 20, 0, 180 }, "theta0");
auto c = new TCanvas();
h_nTracks->DrawCopy();
......@@ -152,5 +172,67 @@ int rec_central_electrons(const char* fname = "topside/rec_central_electrons.roo
c->SaveAs("results/tracking/rec_central_electrons_delta_p_over_p.png");
c->SaveAs("results/tracking/rec_central_electrons_delta_p_over_p.pdf");
c = new TCanvas();
hs = new THStack("n_hits","; #theta ");
h1 = (TH1D*) hSiBarrel_N_vs_theta->Clone();
auto h2 = (TH1D*) hSiBarrel_Ntheta->Clone();
h1->Divide(h2);
hs->Add(h1);
h1 = (TH1D*) hSiEndcap_N_vs_theta->Clone();
h2 = (TH1D*) hSiEndcap_Ntheta->Clone();
h1->Divide(h2);
h1->SetLineColor(2);
hs->Add(h1);
//h1 = (TH1D*) hVtxBarrel_vs_theta->Clone();
//h1->SetLineColor(4);
//h1->SetFillStyle(3001);
//h1->SetFillColor(4);
//hs->Add(h1);
hs->Draw("nostack, hist");
c->BuildLegend();
c->SaveAs("results/tracking/rec_central_electrons_n_hits_vs_theta.png");
c->SaveAs("results/tracking/rec_central_electrons_n_hits_vs_theta.pdf");
c = new TCanvas();
hs = new THStack("theta","; #theta ");
h1 = (TH1D*) hSiBarrel_N_vs_theta->Clone();
h2 = (TH1D*) hSiBarrel_Ntheta->Clone();
//h1->Divide(h2);
hs->Add(h2);
h1 = (TH1D*) hSiEndcap_N_vs_theta->Clone();
h2 = (TH1D*) hSiEndcap_Ntheta->Clone();
//h1->Divide(h2);
h1->SetLineColor(2);
h2->SetLineColor(2);
hs->Add(h2);
//h1 = (TH1D*) hVtxBarrel_vs_theta->Clone();
//h1->SetLineColor(4);
//h1->SetFillStyle(3001);
//h1->SetFillColor(4);
//hs->Add(h1);
hs->Draw("nostack hist");
c->BuildLegend();
c->SaveAs("results/tracking/rec_central_electrons_theta.png");
c->SaveAs("results/tracking/rec_central_electrons_theta.pdf");
c = new TCanvas();
hs = new THStack("hits","; hits ");
h1 = (TH1D*) hSiBarrel_Nhits->Clone();
hs->Add(h1);
h1 = (TH1D*) hSiEndcap_Nhits->Clone();
h1->SetLineColor(2);
h2->SetLineColor(2);
hs->Add(h2);
h1 = (TH1D*) hVtxBarrel_Nhits->Clone();
h1->SetLineColor(4);
h1->SetFillStyle(3001);
h1->SetFillColor(4);
hs->Add(h1);
hs->Draw("nostack hist");
c->BuildLegend();
c->SaveAs("results/tracking/rec_central_electrons_nhits.png");
c->SaveAs("results/tracking/rec_central_electrons_nhits.pdf");
return 0;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment