|
||||
File indexing completed on 2025-01-18 10:10:35
0001 // Author: Ivan Kabadzhov CERN 11/2022 0002 0003 /************************************************************************* 0004 * Copyright (C) 1995-2022, Rene Brun and Fons Rademakers. * 0005 * All rights reserved. * 0006 * * 0007 * For the licensing terms see $ROOTSYS/LICENSE. * 0008 * For the list of contributors see $ROOTSYS/README/CREDITS. * 0009 *************************************************************************/ 0010 0011 #ifndef ROOT_RDF_RSAMPLE 0012 #define ROOT_RDF_RSAMPLE 0013 0014 #include <ROOT/RDF/RMetaData.hxx> 0015 0016 #include <string> 0017 #include <vector> 0018 0019 namespace ROOT { 0020 namespace RDF { 0021 namespace Experimental { 0022 0023 /** 0024 \ingroup dataframe 0025 \brief Class representing a sample which is a grouping of trees and their fileglobs, and, optionally, the sample's 0026 metadata information via the RMetaData object. 0027 0028 The class is passed to an RDatasetSpec object in order to build an RDataFrame. 0029 0030 For example, an RSample object can be built as follows: 0031 ~~~{.cpp} 0032 // First, create the RMetaData object (to, optionally, add to the sample) 0033 ROOT::RDF::Experimental::RMetaData meta; 0034 meta.Add("sample_name", "name""); 0035 // Create an RSample with metadata information 0036 ROOT::RDF::Experimental::RSample mySample("mySampleName", "outputTree1", "outputFile.root", meta); 0037 ~~~ 0038 */ 0039 class RSample { 0040 /// Name of the sample. 0041 std::string fSampleName; 0042 /** 0043 * A list of names of trees. 0044 * This list should go in lockstep with fFileNameGlobs, only in case this dataset is a TChain where each file 0045 * contains its own tree with a different name from the global name of the dataset. 0046 * Otherwise, fTreeNames contains 1 treename, that is common for all file globs. 0047 */ 0048 std::vector<std::string> fTreeNames; 0049 /** 0050 * A list of file names. 0051 * They can contain the globbing characters supported by TChain. See TChain::Add for more information. 0052 */ 0053 std::vector<std::string> fFileNameGlobs; 0054 /// An instance of the RMetaData class. 0055 RMetaData fMetaData; 0056 0057 /// Global sample index, set inside of the RDatasetSpec. 0058 unsigned int fSampleId{0}; 0059 0060 public: 0061 RSample(RSample &&) = default; 0062 RSample &operator=(RSample &&) = default; 0063 RSample(const RSample &) = default; 0064 RSample &operator=(const RSample &) = default; 0065 RSample() = delete; 0066 0067 RSample(const std::string &sampleName, const std::string &treeName, const std::string &fileNameGlob, 0068 const RMetaData &metaData = {}); 0069 0070 RSample(const std::string &sampleName, const std::string &treeName, const std::vector<std::string> &fileNameGlobs, 0071 const RMetaData &metaData = {}); 0072 0073 RSample(const std::string &sampleName, const std::vector<std::pair<std::string, std::string>> &treeAndFileNameGlobs, 0074 const RMetaData &metaData = {}); 0075 0076 RSample(const std::string &sampleName, const std::vector<std::string> &treeNames, 0077 const std::vector<std::string> &fileNameGlobs, const RMetaData &metaData = {}); 0078 0079 const std::string &GetSampleName() const; 0080 const std::vector<std::string> &GetTreeNames() const; 0081 const std::vector<std::string> &GetFileNameGlobs() const; 0082 const RMetaData &GetMetaData() const; 0083 0084 /// \cond HIDDEN_SYMBOLS 0085 unsigned int GetSampleId() const; // intended to be used only after the RDataSpec is build, otherwise is 0 0086 void SetSampleId(unsigned int id); 0087 /// \endcond 0088 }; 0089 0090 } // namespace Experimental 0091 } // namespace RDF 0092 } // namespace ROOT 0093 0094 #endif // ROOT_RDF_RSAMPLE
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |