2 #include "St_spline3C.h"
4 #include "TInterpreter.h"
7 St_spline3 *St_spline3C::Open(
const Char_t *path) {
10 TString Dir(gSystem->DirName(PATH));
11 TString File(gSystem->BaseName(PATH));
13 TString pathF(
".:./StarDb/"); pathF += Dir +
":$STAR/StarDb/" + Dir;
14 Char_t *file = gSystem->Which(pathF,File,kReadPermission);
16 std::cout << Form(
"Fatal::St_spline3C::Open \tFile %s has not been found in path %s",File.Data(),pathF.Data()) << std::endl;
19 std::cout << Form(
"Warning::St_spline3C::Open \tFile %s has been found as %s",File.Data(),file) << std::endl;
21 TString command(
".L "); command += file; TInterpreter::EErrorCode ee;
22 gInterpreter->ProcessLine(command,&ee);
24 std::cout << Form(
"Fatal::St_spline3C::Open has failed to read \tFile %s",file) << std::endl;
28 table = (
St_spline3 *) gInterpreter->Calc(
"CreateTable()",&ee);
30 std::cout << Form(
"Fatal::St_spline3C::Open has failed to load \tFile %s",file) << std::endl;
35 command.ReplaceAll(
".L ",
".U ");
36 gInterpreter->ProcessLine(command,&ee);
38 std::cout << Form(
"Fatal::St_spline3C::Open has failed to unload \tFile %s",file) << std::endl;
46 St_spline3C::St_spline3C(
St_spline3 *table) :
TChair(table), fSpline(0), fFunc(0), fValid(kTRUE) {
48 fSpline =
new TSpline3(
"Spline3", Xknots(), Yknots(), nknots(), option(), ValBeg(), ValEnd());
49 fSpline->SetLineColor(2);
50 fXmin = Xknots()[0] - 0.1;
51 fXmax = Xknots()[nknots()-1] + 0.1;
52 fFunc =
new TF1(GetName(),
this, fXmin, fXmax, 0,
"St_spline3C");
54 fFunc->Save(Xknots()[0], Xknots()[nknots()-1], 0., 0., 0., 0.);
59 #define MakeChairInstance3(CLASS,PATH) \
61 CLASS *CLASS::fgInstance = 0; \
62 CLASS *CLASS::instance() { \
63 if (fgInstance && ! fgInstance->IsValid()) return 0; \
64 if (fgInstance) return fgInstance; \
65 St_spline3 *table = St_spline3C::Open(# PATH); \
66 fgInstance = new CLASS(table); \
C++ wrapper for <spline3> StAF table.
virtual Char_t * Print(Char_t *buf, Int_t n) const
Create IDL table defintion (to be used for XDF I/O)