ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
SampleHandler
Root
SampleGrid.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2019 CERN for the benefit of the ATLAS collaboration
3
*/
4
6
7
//
8
// includes
9
//
10
11
#include <
SampleHandler/SampleGrid.h
>
12
13
#include <stdexcept>
14
#include <
RootCoreUtils/Assert.h
>
15
#include <
SampleHandler/GridTools.h
>
16
#include <
SampleHandler/MetaFields.h
>
17
#include <
SampleHandler/MetaObject.h
>
18
#include <
SampleHandler/SampleLocal.h
>
19
#include <memory>
20
21
//
22
// method implementations
23
//
24
25
ClassImp
(
SH::SampleGrid
)
26
27
namespace
SH
28
{
29
void
SampleGrid ::
30
testInvariant ()
const
31
{
32
}
33
34
35
36
SampleGrid ::
37
SampleGrid ()
38
: Sample (
"unnamed"
)
39
{
40
RCU_NEW_INVARIANT
(
this
);
41
}
42
43
44
45
SampleGrid ::
46
SampleGrid (
const
std::string& name)
47
: Sample (name)
48
{
49
RCU_NEW_INVARIANT
(
this
);
50
}
51
52
53
54
std::size_t SampleGrid ::
55
getNumFiles ()
const
56
{
57
RCU_READ_INVARIANT
(
this
);
58
throw
std::runtime_error (
"Sample::numFiles not supported for SampleGrid"
);
59
}
60
61
62
63
std::string SampleGrid ::
64
getFileName (
const
std::size_t
/*index*/
)
const
65
{
66
RCU_READ_INVARIANT
(
this
);
67
throw
std::runtime_error (
"Sample::fileName not supported for SampleGrid"
);
68
}
69
70
71
72
std::unique_ptr<SampleLocal> SampleGrid ::
73
doMakeLocal ()
const
74
{
75
RCU_READ_INVARIANT
(
this
);
76
77
std::unique_ptr<SampleLocal> result (
new
SampleLocal (name()));
78
for
(
auto
&
file
: makeFileList ())
79
result->add (
file
.c_str());
80
return
result;
81
}
82
83
84
85
std::vector<std::string> SampleGrid ::
86
doMakeFileList ()
const
87
{
88
RCU_READ_INVARIANT
(
this
);
89
using namespace
msgGridTools;
90
91
const
char
*downloadDir = getenv (
downloadStageEnvVar
().c_str());
92
93
const
std::string sampleName
94
=
meta
()->castString (
MetaFields::gridName
, name());
95
const
std::string fileFilter
96
=
meta
()->castString (
MetaFields::gridFilter
,
MetaFields::gridFilter_default
);
97
98
if
(downloadDir)
99
{
100
ANA_MSG_DEBUG
(
"download dir set, trying download"
);
101
if
(downloadDir[0] !=
'/'
)
102
throw
std::runtime_error (
"rucio download path in variable "
+
downloadStageEnvVar
() +
" should start with /"
);
103
return
rucioCacheDatasetGlob
(downloadDir, sampleName, fileFilter);
104
}
else
105
{
106
ANA_MSG_DEBUG
(
"download dir not set, trying direct access"
);
107
const
std::string sourceOptions
108
=
meta
()->castString (
MetaFields::gridSourceOptions
);
109
return
rucioDirectAccessGlob
(sampleName, fileFilter, sourceOptions);
110
}
111
}
112
}
Assert.h
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition
Assert.h:221
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition
Assert.h:217
ANA_MSG_DEBUG
#define ANA_MSG_DEBUG(xmsg)
Macro printing debug messages.
Definition
Control/AthToolSupport/AsgMessaging/AsgMessaging/MessageCheck.h:288
GridTools.h
MetaFields.h
MetaObject.h
ClassImp
ClassImp(SH::SampleGrid) namespace SH
Definition
SampleGrid.cxx:25
SampleGrid.h
SampleLocal.h
SH::SampleGrid
This class implements a Sample located on the grid.
Definition
SampleGrid.h:36
SH
This module provides a lot of global definitions, forward declarations and includes that are used by ...
Definition
PrunDriver.h:15
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
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
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
meta
-diff
SH::MetaFields::gridFilter
static const std::string gridFilter
the field containing the file filter for the dataset on the grid
Definition
MetaFields.h:30
SH::MetaFields::gridName
static const std::string gridName
the field containing the name of the dataset on the grid
Definition
MetaFields.h:26
SH::MetaFields::gridSourceOptions
static const std::string gridSourceOptions
the field containing the source options for datasets on the grid
Definition
MetaFields.h:37
SH::MetaFields::gridFilter_default
static const std::string gridFilter_default
the default value for gridFilter
Definition
MetaFields.h:33
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0