Go to the source code of this file.
◆ ClassImp()
Definition at line 38 of file Sample.cxx.
46 if (
dynamic_cast<const SampleGrid*
>(&
obj))
50 result +=
"\n " + MetaFields::gridName +
"="+
obj.meta()->castString(MetaFields::gridName);
51 result +=
"\n " + MetaFields::gridFilter +
"="+
obj.meta()->castString(MetaFields::gridFilter);
60 for (std::size_t iter = 0,
end =
obj.numFiles();
71 testInvariant ()
const
98 name (std::string val_name)
101 if (m_references > 0)
103 m_meta->setString (MetaNames::sampleName(), val_name);
104 m_name = std::move (val_name);
114 return getNumFiles();
137 return doMakeLocal ();
161 addTag (
const std::string&
tag)
170 updateLocation (
const std::string& from,
const std::string&
to)
173 doUpdateLocation (from,
to);
178 MetaObject *Sample ::
187 const MetaObject *Sample ::
196 std::vector<std::string> Sample ::
197 makeFileList ()
const
200 return doMakeFileList ();
210 std::vector<std::string>
files = makeFileList ();
216 for (std::vector<std::string>::const_iterator
file =
files.begin(),
225 doUpdateLocation (
const std::string& ,
const std::string& )
233 readHist (
const std::string&
name)
const
236 return doReadHist (
name);
253 addSamples (SampleHandler&
result)
265 std::cout <<
dbg (*
this, 9999) << std::endl;
271 printContent ()
const
280 getNumEntries ()
const
287 std::vector<std::string>
fileList = makeFileList();
291 std::unique_ptr<TFile>
file (TFile::Open (
fileName->c_str(),
"READ"));
303 TCollection *Sample ::
312 const TCollection *Sample ::
313 metaDataList ()
const
322 removeMeta (
const std::string&
name)
325 meta()->remove (
name);
331 addReplaceMeta (TNamed *meta_swallow)
333 std::unique_ptr<TNamed> mymeta (meta_swallow);
338 meta()->addReplace (mymeta.release());
344 getMeta (
const std::string&
name)
347 return meta()->get (
name);
352 const TObject *Sample ::
353 getMeta (
const std::string&
name)
const
356 return meta()->get (
name);
362 getMetaDouble (
const std::string&
name,
double def_val)
const
365 return meta()->castDouble (
name, def_val, MetaObject::CAST_NOCAST_DEFAULT);
370 std::string Sample ::
371 getMetaString (
const std::string&
name,
const std::string& def_val)
const
374 return meta()->castString (
name, def_val, MetaObject::CAST_NOCAST_DEFAULT);
380 setMetaDouble (
const std::string&
name,
double value)
389 setMetaString (
const std::string&
name,
const std::string&
value)
398 fetchMeta (
const Sample&
source)
401 meta()->fetch (*
source.meta());
407 Sample (
const std::string&
name)
408 : m_name (
name), m_meta (
new MetaObject),
411 m_meta->setString (MetaNames::sampleName(),
name);
419 doReadHist (
const std::string&
name)
const
422 std::vector<std::string>
fileList (makeFileList());
424 RCU_THROW_MSG (
"reading histgrams from samples with multiple files is not (yet) implemented");
427 std::unique_ptr<TFile>
file (TFile::Open (
fileList[0].c_str(),
"READ"));
431 TObject *
object =
file->Get (
name.c_str());
432 if (
object !=
nullptr)
440 getContains (
const std::string& )
const
449 doAddSamples (SampleHandler&
result)
472 unsigned refs = -- m_references;