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

test: impact on M_X from boost patch #35

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all 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
19 changes: 19 additions & 0 deletions draw_mx.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// ninja && clas-stringspinner --seed 29877 --trig 10000 --cut-inclusive 11,211,-211|grep M_X| awk '{print $2}' > output.dat
void draw_mx(TString file_name = "output.dat", TString title = "m_x") {
auto tr = new TTree();
tr->ReadFile(file_name, "mx/D");
// new TCanvas();
// tr->Draw("mx");
auto c = new TCanvas("c", "c", 800, 600);
auto mx_dist = new TH1D("mx_dist",title,100,0.9,1.5);
tr->Project("mx_dist", "mx");
mx_dist->Draw();
auto peak = mx_dist->GetBinCenter(mx_dist->GetMaximumBin());
auto dev = 0.03;
// mx_dist->Fit("gaus","","",peak-dev,peak+dev);
auto delta = new TLine(1.232, 0, 1.232, mx_dist->GetMaximum());
delta->SetLineColor(kRed);
delta->SetLineWidth(3);
delta->Draw();
c->SaveAs(file_name+".png");
}
25 changes: 25 additions & 0 deletions draw_mx_2.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ninja && clas-stringspinner --seed 29877 --trig 10000 --cut-inclusive 11,211,-211|grep M_X| awk '{print $2}' > output.dat
void draw_mx_2(TString file_name = "output.both.dat") {
gStyle->SetOptStat(0);
auto tr = new TTree();
tr->ReadFile(file_name, "mx_before/D:mx_after/D");
// new TCanvas();
// tr->Draw("mx");
auto c = new TCanvas("c", "c", 800, 600);
auto mx_dist_before = new TH1D("mx_dist_before", "M_{X} distribution", 60, 1.0, 1.35);
auto mx_dist_after = new TH1D("mx_dist_after", "M_{X} distribution", 60, 1.0, 1.35);
tr->Project("mx_dist_before", "mx_before");
tr->Project("mx_dist_after", "mx_after");
mx_dist_before->SetLineColor(kBlue);
mx_dist_after->SetLineColor(kRed);
mx_dist_after->SetLineStyle(kDashed);
mx_dist_after->SetLineWidth(2);
mx_dist_before->SetLineWidth(2);
mx_dist_before->Draw();
mx_dist_after->Draw("same");
auto delta = new TLine(1.232, 0, 1.232, mx_dist_before->GetMaximum());
delta->SetLineColor(kGreen+1);
delta->SetLineWidth(3);
delta->Draw();
c->SaveAs(file_name+".png");
}
54 changes: 54 additions & 0 deletions src/clas-stringspinner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -694,6 +694,60 @@ int main(int argc, char** argv)
lund_particle.vz
);

// make sure we have a delta
bool delta_found = false;
for(auto const& par : *evt.particles()) {
if(par.id() == 2214) {
delta_found = true;
break;
}
}
if(!delta_found) continue;

// find the scattered electron
int ele_idx = -1;
double ele_p = -10000;
for(int idx = 0; idx < evt.size(); ++idx) {
auto const& par = evt[idx];
if(par.isFinal() && par.id() == 11) {
auto this_p = std::hypot(par.px(), par.py(), par.pz());
if(this_p > ele_p) {
ele_p = par.e();
ele_idx = idx;
}
}
}
// fmt::print("ele_idx = {}\n", ele_idx);
if(ele_idx < 0) continue;

// loop over pi+ pi- dihadrons
for(int idxA = 0; idxA < evt.size(); ++idxA) {
auto const& parA = evt[idxA];
if(parA.isFinal() && parA.id() == 211) {
for(int idxB = 0; idxB < evt.size(); ++idxB) {
auto const& parB = evt[idxB];
if(parB.isFinal() && parB.id() == -211) {

Pythia8::Vec4 p_beam(0.0, 0.0, 10.6040999877, 10.6041);
Pythia8::Vec4 p_target(0.0, 0.0, 0.0, 0.93827);

auto p_ele = evt[ele_idx].p();
auto p_pip = parA.p();
auto p_pim = parB.p();

// calculate missing mass
auto vecW = p_beam + p_target - p_ele;
auto vecPh = p_pip + p_pim;
auto M_X = (vecW - vecPh).mCalc();
fmt::print("M_X {}\n", M_X);
}
}
}
}

// if(evnum < 1000)
// evt.list(false, false, 10);

// finalize
if(!enable_count_before_cuts) {
if(++evnum >= num_events)
Expand Down
2 changes: 1 addition & 1 deletion src/config/clas12.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,6 @@ inline void config_clas12(Pythia8::Pythia& pyth) {
// handle event printouts
set_config(pyth, "Next:numberShowInfo = 0");
set_config(pyth, "Next:numberShowProcess = 0");
set_config(pyth, "Next:numberShowEvent = 1");
set_config(pyth, "Next:numberShowEvent = 0");

}
Loading