Skip to content
Snippets Groups Projects
Commit 69f0dffb authored by Ziyue Zhang's avatar Ziyue Zhang
Browse files

WIP: debug - test def

parent 271d0bc3
Branches
No related tags found
1 merge request!42Add y, Q2, x, t resolution tests
...@@ -44,7 +44,7 @@ int vm_invar(const std::string& config_name) ...@@ -44,7 +44,7 @@ int vm_invar(const std::string& config_name)
std::string VarName[4] = {"y", "Q2", "x", "t"}; std::string VarName[4] = {"y", "Q2", "x", "t"};
double width_target[4] = {.4, .09, .35, .07}; double width_target[4] = {.4, .09, .35, .07};
// create our test definition //============================== test definition ==============================
std::vector<eic::util::Test> Tests; std::vector<eic::util::Test> Tests;
for(int i = 0 ; i < 4 ; i++){ for(int i = 0 ; i < 4 ; i++){
eic::util::Test resolution_test_tmp{ eic::util::Test resolution_test_tmp{
...@@ -56,6 +56,7 @@ int vm_invar(const std::string& config_name) ...@@ -56,6 +56,7 @@ int vm_invar(const std::string& config_name)
{"target", fmt::format("{}", width_target[i])}}}; {"target", fmt::format("{}", width_target[i])}}};
Tests.push_back(resolution_test_tmp); Tests.push_back(resolution_test_tmp);
} }
//============================== test definition ==============================
/* /*
eic::util::Test y_resolution_test{ eic::util::Test y_resolution_test{
{{"name", fmt::format("{}_y_resolution", test_tag)}, {{"name", fmt::format("{}_y_resolution", test_tag)},
...@@ -92,12 +93,13 @@ int vm_invar(const std::string& config_name) ...@@ -92,12 +93,13 @@ int vm_invar(const std::string& config_name)
{"quantity", "resolution"}, {"quantity", "resolution"},
{"target", ".07"}}}; {"target", ".07"}}};
Tests.push_back(t_resolution_test);*/ Tests.push_back(t_resolution_test);*/
TH1::SetDefaultSumw2();
//==============================general settings==============================
// Run this in multi-threaded mode if desired // Run this in multi-threaded mode if desired
ROOT::EnableImplicitMT(kNumThreads); ROOT::EnableImplicitMT(kNumThreads);
TH1::SetDefaultSumw2();
// The particles we are looking for. E.g. J/psi decaying into e+e- // The particles we are looking for. E.g. J/psi decaying into e+e-
const double vm_mass = util::get_pdg_mass(vm_name); const double vm_mass = util::get_pdg_mass(vm_name);
const double decay_mass = util::get_pdg_mass(decay_name); const double decay_mass = util::get_pdg_mass(decay_name);
...@@ -109,17 +111,16 @@ int vm_invar(const std::string& config_name) ...@@ -109,17 +111,16 @@ int vm_invar(const std::string& config_name)
// Open our input file file as a dataframe // Open our input file file as a dataframe
ROOT::RDataFrame d{"events", rec_file}; ROOT::RDataFrame d{"events", rec_file};
//==============================general settings==============================
// utility lambda functions to bind the vector meson and decay particle
// types
//==============================redef function==============================
auto momenta_sort_sim = [vm_name, decay_name](const std::vector<dd4pod::Geant4ParticleData>& parts){ auto momenta_sort_sim = [vm_name, decay_name](const std::vector<dd4pod::Geant4ParticleData>& parts){
return util::momenta_sort_sim(parts, vm_name, decay_name); return util::momenta_sort_sim(parts, vm_name, decay_name);
}; };
auto momenta_sort_rec = [vm_name, decay_name](const std::vector<eic::ReconstructedParticleData>& parts){ auto momenta_sort_rec = [vm_name, decay_name](const std::vector<eic::ReconstructedParticleData>& parts){
return util::momenta_sort_rec(parts, vm_name, decay_name); return util::momenta_sort_rec(parts, vm_name, decay_name);
}; };
//==================================================================== //==============================redef function==============================
// Define analysis flow // Define analysis flow
auto d_im = d.Define("p_rec_sorted", momenta_sort_rec, {"DummyReconstructedParticles"}) auto d_im = d.Define("p_rec_sorted", momenta_sort_rec, {"DummyReconstructedParticles"})
...@@ -144,18 +145,17 @@ int vm_invar(const std::string& config_name) ...@@ -144,18 +145,17 @@ int vm_invar(const std::string& config_name)
.Define("x_rdf", "(x_rec - x_sim)/x_sim") .Define("x_rdf", "(x_rec - x_sim)/x_sim")
.Define("t_rdf", "(t_rec - t_sim)/t_sim"); .Define("t_rdf", "(t_rec - t_sim)/t_sim");
//================================================================ //ranges
//Factorizeation
double range_l[4][4] = {{0., 0., -2., -1.5}, { 0., 0., -0.3, -30.}, {0.0, 0.0, -0.2, -1.}, {-1., -1., -2., -0.5}}; double range_l[4][4] = {{0., 0., -2., -1.5}, { 0., 0., -0.3, -30.}, {0.0, 0.0, -0.2, -1.}, {-1., -1., -2., -0.5}};
double range_h[4][4] = {{1., 1., 2., 1.5}, {15., 15., 0.3, 30.}, {0.1, 0.1, 0.2, 1.}, { 0., 0., 2., 0.5}}; double range_h[4][4] = {{1., 1., 2., 1.5}, {15., 15., 0.3, 30.}, {0.1, 0.1, 0.2, 1.}, { 0., 0., 2., 0.5}};
std::string VarCate[4] = {"sim", "rec", "dif", "rdf"}; std::string VarCate[4] = {"sim", "rec", "dif", "rdf"};
std::string histName[4][4]; std::string histName[4][4];
std::string histTitles[4][4]; std::string histTitles[4][4];
std::string RawhistName[4][4]; std::string RawhistName[4][4];
TH1D* h_Var1D[4][4]; //==============================hist def==============================
/*TH1D* h_Var1D[4][4];
for(int i = 0 ; i < 4 ; i++){ for(int i = 0 ; i < 4 ; i++){
for(int j = 0 ; j < 4 ; j++){ for(int j = 0 ; j < 4 ; j++){
//construct histName //construct histName
...@@ -186,8 +186,8 @@ int vm_invar(const std::string& config_name) ...@@ -186,8 +186,8 @@ int vm_invar(const std::string& config_name)
delete hptr_tmp; delete hptr_tmp;
} }
} }
double nEvents = h_Var1D[0][0]->Integral(0, -1); double nEvents = h_Var1D[0][0]->Integral(0, -1);*/
//================================================================== //==============================hist def==============================
// Define output histograms // Define output histograms
//auto h_nu_sim = d_im.Histo1D({"h_nu_sim", ";#nu/1000;#", 100, 0., 2.}, "nu_sim"); //auto h_nu_sim = d_im.Histo1D({"h_nu_sim", ";#nu/1000;#", 100, 0., 2.}, "nu_sim");
...@@ -207,11 +207,11 @@ int vm_invar(const std::string& config_name) ...@@ -207,11 +207,11 @@ int vm_invar(const std::string& config_name)
auto h_x_dif = d_im.Histo1D({"h_x_dif", ";#Deltax/x;#", 50, -1., 1.}, "x_dif"); auto h_x_dif = d_im.Histo1D({"h_x_dif", ";#Deltax/x;#", 50, -1., 1.}, "x_dif");
auto h_t_dif = d_im.Histo1D({"h_t_dif", ";#Deltat/t;#", 50, -0.5, 0.5}, "t_dif");*/ auto h_t_dif = d_im.Histo1D({"h_t_dif", ";#Deltat/t;#", 50, -0.5, 0.5}, "t_dif");*/
TFitResultPtr myFitPtr[4][2]; //==============================fit and plot==============================
/*TFitResultPtr myFitPtr[4][2];
TF1* myf[4][2]; TF1* myf[4][2];
TText* tptr[4][4]; TText* tptr[4][4];
TPaveText* t[4][4]; TPaveText* t[4][4];
for(int i = 0 ; i < 4 ; i++){ for(int i = 0 ; i < 4 ; i++){
TCanvas* ctmp = new TCanvas("ctmp", "ctmp", 1200, 900); TCanvas* ctmp = new TCanvas("ctmp", "ctmp", 1200, 900);
ctmp->Divide(2, 2, 0.001, 0.001); ctmp->Divide(2, 2, 0.001, 0.001);
...@@ -296,6 +296,8 @@ int vm_invar(const std::string& config_name) ...@@ -296,6 +296,8 @@ int vm_invar(const std::string& config_name)
ctmp->Print(fmt::format("{}{}.png", output_prefix, VarName[i]).c_str()); ctmp->Print(fmt::format("{}{}.png", output_prefix, VarName[i]).c_str());
delete ctmp; delete ctmp;
} }
*/
//==============================fit and plot==============================
/* /*
// Plot our histograms. // Plot our histograms.
...@@ -416,17 +418,16 @@ int vm_invar(const std::string& config_name) ...@@ -416,17 +418,16 @@ int vm_invar(const std::string& config_name)
//============================================================================ //============================================================================
c.Print(fmt::format("{}InvariantQuantities.png", output_prefix).c_str());*/ c.Print(fmt::format("{}InvariantQuantities.png", output_prefix).c_str());*/
//Before factorizing==========================================================================================
for(int i = 0 ; i < 4 ; i++){ for(int i = 0 ; i < 4 ; i++){
double width = myf[i][1]->GetParameter(1); //double width = myf[i][1]->GetParameter(1);
if(myFitPtr[i][1]->Status()!=0){ //if(myFitPtr[i][1]->Status()!=0){
Tests[i].error(-1); Tests[i].error(-1);
}else if(width > width_target[i]){ //}else if(width > width_target[i]){
Tests[i].fail(width); // Tests[i].fail(width);
}else{ //}else{
Tests[i].pass(width); // Tests[i].pass(width);
} //}
} }
// write out our test data // write out our test data
......
...@@ -126,11 +126,11 @@ EOF ...@@ -126,11 +126,11 @@ EOF
#cat ${CONFIG} #cat ${CONFIG}
## run the analysis script with this configuration ## run the analysis script with this configuration
root -b -q "benchmarks/dvmp/analysis/vm_mass.cxx+(\"${CONFIG}\")" #root -b -q "benchmarks/dvmp/analysis/vm_mass.cxx+(\"${CONFIG}\")"
if [ "$?" -ne "0" ] ; then #if [ "$?" -ne "0" ] ; then
echo "ERROR running vm_mass script" # echo "ERROR running vm_mass script"
exit 1 # exit 1
fi #fi
root -b -q "benchmarks/dvmp/analysis/vm_invar.cxx+(\"${CONFIG}\")" root -b -q "benchmarks/dvmp/analysis/vm_invar.cxx+(\"${CONFIG}\")"
if [ "$?" -ne "0" ] ; then if [ "$?" -ne "0" ] ; then
echo "ERROR running vm_invar script" echo "ERROR running vm_invar script"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment