Skip to content

Commit

Permalink
CalorimetrySyst aborts in case of missing template files
Browse files Browse the repository at this point in the history
  • Loading branch information
PetrilloAtWork committed Jan 22, 2025
1 parent ed19c79 commit e53ce89
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions sbnana/CAFAna/Systs/CalorimetrySysts.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include "cetlib/search_path.h"
#include <cmath>
#include <iostream>
#include <cstdlib> // std::abort()
#include "TMath.h"

namespace ana {
Expand All @@ -21,14 +22,22 @@ namespace ana {

std::string kdEdXUncTemplateFileName = "template_dEdXUncertainty.root";
std::string kdEdXUncTemplateFullFilePath;
sp.find_file(kdEdXUncTemplateFileName, kdEdXUncTemplateFullFilePath);
if (!sp.find_file(kdEdXUncTemplateFileName, kdEdXUncTemplateFullFilePath)) {
std::cerr << "\nana::CalorimetrySyst: failed to locate dE/dx template file '"
<< kdEdXUncTemplateFileName << "'" << std::endl;
std::abort();
}

TFile* file_dEdXUncTemplate = TFile::Open(kdEdXUncTemplateFullFilePath.c_str());
dedx_unc_template = (TGraph2D*)file_dEdXUncTemplate->Get("dEdXRelUncertainty_dEdX_vs_phi");

std::string kChi2TemplateFileName = "dEdxrestemplates.root";
std::string kChi2TemplateFullFilePath;
sp.find_file(kChi2TemplateFileName, kChi2TemplateFullFilePath);
if (!sp.find_file(kChi2TemplateFileName, kChi2TemplateFullFilePath)) {
std::cerr << "\nana::CalorimetrySyst: failed to locate dE/dx template file '"
<< kChi2TemplateFileName << "'" << std::endl;
std::abort();
}

TFile *file_Chi2Template = TFile::Open(kChi2TemplateFullFilePath.c_str());
dedx_range_pro = (TProfile*)file_Chi2Template->Get("dedx_range_pro");
Expand Down

0 comments on commit e53ce89

Please sign in to comment.