IExperiment.cxx
Go to the documentation of this file.
2 
5 
6 #include "TFile.h"
7 #include "TObjString.h"
8 
9 #include <cassert>
10 #include <iostream>
11 
12 namespace ana
13 {
14  //----------------------------------------------------------------------
15  // Definition to satisfy declaration in Core/LoadFromFile.h
16  template<> std::unique_ptr<IExperiment> LoadFrom<IExperiment>(TDirectory* dir, const std::string& name)
17  {
18  TObjString* ptag = (TObjString*)dir->Get((name+"/type").c_str());
19  assert(ptag);
20 
21  const TString tag = ptag->GetString();
22  delete ptag;
23 
24  const auto func = LoadFromRegistry<IExperiment>::Get(tag.Data());
25  if(func) return func(dir, name);
26 
27  std::cerr << "Unknown Experiment type '" << tag << "'" << std::endl;
28  abort();
29  }
30 
31  //----------------------------------------------------------------------
32  void IExperiment::SaveTo(TDirectory* dir, const std::string& name) const
33  {
34  assert(0 && "Not implemented");
35  }
36 }
const XML_Char * name
Definition: expat.h:151
Cuts and Vars for the 2020 FD DiF Study.
Definition: vars.h:6
OStream cerr
Definition: OStream.cxx:7
static Func_t Get(const std::string &tag)
virtual void SaveTo(TDirectory *dir, const std::string &name) const
Definition: IExperiment.cxx:32
double func(double x, double y)
TDirectory * dir
Definition: macro.C:5
assert(nhit_max >=nhit_nbins)
std::unique_ptr< IExperiment > LoadFrom< IExperiment >(TDirectory *dir, const std::string &label)
Definition: IExperiment.cxx:16
enum BeamMode string