36{
37 void SampleGrid ::
38 testInvariant () const
39 {
40 }
41
42
43
44 SampleGrid ::
45 SampleGrid ()
46 : Sample ("unnamed")
47 {
49 }
50
51
52
53 SampleGrid ::
54 SampleGrid (const std::string& name)
56 {
58 }
59
60
61
62 std::size_t SampleGrid ::
63 getNumFiles () const
64 {
66 RCU_THROW_MSG (
"Sample::numFiles not supported for SampleGrid");
67 return 0;
68 }
69
70
71
72 std::string SampleGrid ::
73 getFileName (const std::size_t ) const
74 {
76 RCU_THROW_MSG (
"Sample::fileName not supported for SampleGrid");
77 return "";
78 }
79
80
81
82 SamplePtr SampleGrid ::
83 doMakeLocal () const
84 {
86
87 std::unique_ptr<SampleLocal>
result (
new SampleLocal (
name()));
88 for (
auto&
file : makeFileList ())
90 return SamplePtr (
result.release());
91 }
92
93
94
95 std::vector<std::string> SampleGrid ::
96 doMakeFileList () const
97 {
99 using namespace msgGridTools;
100
102
104 =
meta()->castString (MetaFields::gridName,
name());
105 const std::string fileFilter
106 =
meta()->castString (MetaFields::gridFilter, MetaFields::gridFilter_default);
107
108 if (downloadDir)
109 {
111 if (downloadDir[0] != '/')
112 throw std::runtime_error (
"rucio download path in variable " +
downloadStageEnvVar() +
" should start with /");
114 } else
115 {
116 ANA_MSG_DEBUG (
"download dir not set, trying direct access");
117 const std::string sourceOptions
118 =
meta()->castString (MetaFields::gridSourceOptions);
120 }
121 }
122}
#define RCU_NEW_INVARIANT(x)
#define RCU_READ_INVARIANT(x)
#define RCU_THROW_MSG(message)
std::string getenv(const std::string &variableName)
get an environment variable
const std::string & downloadStageEnvVar()
the name of the environment variable containing the directory for staging files from the grid
std::vector< std::string > rucioCacheDatasetGlob(const std::string &location, const std::string &dataset, const std::string &fileGlob)
download the dataset, and return a list matching the pattern
std::vector< std::string > rucioDirectAccessGlob(const std::string &name, const std::string &filter, const std::string &selectOptions)
list the rucio URLs for all the files in the dataset or dataset container matching the given filter (...