ATLAS Offline Software
Loading...
Searching...
No Matches
SampleGrid.cxx File Reference
Include dependency graph for SampleGrid.cxx:

Go to the source code of this file.

Functions

 ClassImp (SH::SampleGrid) namespace SH

Function Documentation

◆ ClassImp()

ClassImp ( SH::SampleGrid )

Definition at line 33 of file SampleGrid.cxx.

36{
37 void SampleGrid ::
38 testInvariant () const
39 {
40 }
41
42
43
44 SampleGrid ::
45 SampleGrid ()
46 : Sample ("unnamed")
47 {
48 RCU_NEW_INVARIANT (this);
49 }
50
51
52
53 SampleGrid ::
54 SampleGrid (const std::string& name)
55 : Sample (name)
56 {
57 RCU_NEW_INVARIANT (this);
58 }
59
60
61
62 std::size_t SampleGrid ::
63 getNumFiles () const
64 {
65 RCU_READ_INVARIANT (this);
66 RCU_THROW_MSG ("Sample::numFiles not supported for SampleGrid");
67 return 0; // compiler dummy
68 }
69
70
71
72 std::string SampleGrid ::
73 getFileName (const std::size_t /*index*/) const
74 {
75 RCU_READ_INVARIANT (this);
76 RCU_THROW_MSG ("Sample::fileName not supported for SampleGrid");
77 return ""; // compiler dummy
78 }
79
80
81
82 SamplePtr SampleGrid ::
83 doMakeLocal () const
84 {
85 RCU_READ_INVARIANT (this);
86
87 std::unique_ptr<SampleLocal> result (new SampleLocal (name()));
88 for (auto& file : makeFileList ())
89 result->add (file.c_str());
90 return SamplePtr (result.release());
91 }
92
93
94
95 std::vector<std::string> SampleGrid ::
96 doMakeFileList () const
97 {
98 RCU_READ_INVARIANT (this);
99 using namespace msgGridTools;
100
101 const char *downloadDir = getenv (downloadStageEnvVar().c_str());
102
103 const std::string sampleName
104 = meta()->castString (MetaFields::gridName, name());
105 const std::string fileFilter
106 = meta()->castString (MetaFields::gridFilter, MetaFields::gridFilter_default);
107
108 if (downloadDir)
109 {
110 ANA_MSG_DEBUG ("download dir set, trying download");
111 if (downloadDir[0] != '/')
112 throw std::runtime_error ("rucio download path in variable " + downloadStageEnvVar() + " should start with /");
113 return rucioCacheDatasetGlob (downloadDir, sampleName, fileFilter);
114 } else
115 {
116 ANA_MSG_DEBUG ("download dir not set, trying direct access");
117 const std::string sourceOptions
118 = meta()->castString (MetaFields::gridSourceOptions);
119 return rucioDirectAccessGlob (sampleName, fileFilter, sourceOptions);
120 }
121 }
122}
#define RCU_NEW_INVARIANT(x)
Definition Assert.h:233
#define RCU_READ_INVARIANT(x)
Definition Assert.h:229
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
#define RCU_THROW_MSG(message)
Definition PrintMsg.h:58
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 (...
-diff
TFile * file