ATLAS Offline Software
Functions
SampleGrid.cxx File Reference
#include <SampleHandler/SampleGrid.h>
#include <RootCoreUtils/Assert.h>
#include <RootCoreUtils/ThrowMsg.h>
#include <SampleHandler/GridTools.h>
#include <SampleHandler/MetaFields.h>
#include <SampleHandler/MetaObject.h>
#include <SampleHandler/SampleLocal.h>
#include <SampleHandler/SamplePtr.h>
#include <memory>
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 }
get_generator_info.result
result
Definition: get_generator_info.py:21
SH::rucioDirectAccessGlob
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 (...
Definition: GridTools.cxx:281
file
TFile * file
Definition: tile_monitor.h:29
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
SH::rucioCacheDatasetGlob
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
Definition: GridTools.cxx:535
SCT_ConditionsAlgorithms::CoveritySafe::getenv
std::string getenv(const std::string &variableName)
get an environment variable
Definition: SCT_ConditionsUtilities.cxx:17
python.TrfUtils.getFileName
def getFileName(name, sep='#')
Definition: TrfUtils.py:45
SH::downloadStageEnvVar
const std::string & downloadStageEnvVar()
the name of the environment variable containing the directory for staging files from the grid
Definition: GridTools.cxx:198
RCU_THROW_MSG
#define RCU_THROW_MSG(message)
Definition: PrintMsg.h:58
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition: Assert.h:229
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition: Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition: Assert.h:233