|
ATLAS Offline Software
|
Go to the documentation of this file.
28 #include <TObjString.h>
41 std::vector<std::string>
43 const std::string& branchName)
45 std::vector<std::string>
result;
47 TString *
var =
nullptr;
50 std::unique_ptr<TFile>
file (TFile::Open (
fileName.c_str(),
"READ"));
76 shInput.
load (submitdir +
"/input");
80 shHist.
load (submitdir +
"/hist");
90 std::vector<std::string> filesUsedVector
91 = readVectorFromTree (sampleHist,
"EventLoop_FileExecuted",
"file");
92 std::set<std::string> filesUsed
93 (filesUsedVector.begin(), filesUsedVector.end());
94 RCU_ASSERT (filesUsed.size() == filesUsedVector.size());
96 std::unique_ptr<SH::SampleLocal> sampleReprocess;
97 std::vector<std::string> filesInput (sampleInput->makeFileList ());
99 for (
auto fileInput : filesInput)
103 if (
split != std::string::npos)
106 if (filesUsed.find (
fileName) == filesUsed.end())
108 if (sampleReprocess ==
nullptr)
111 *sampleReprocess->
meta() = *sampleInput->meta();
113 sampleReprocess->
add (fileInput);
116 if (filesInput.empty())
119 *sampleReprocess->
meta() = *sampleInput->meta();
121 if (sampleReprocess !=
nullptr)
124 shReprocess.
add (sampleReprocess.release());
132 void mergeHists (
const std::string& mainDir,
133 const std::string& extraDir,
136 for (
auto&
sample : samples)
138 std::string
tmp = extraDir +
"/hist2-" +
sample->name() +
".root";
139 std::string
target = mainDir +
"/hist-" +
sample->name() +
".root";
148 void mergeNtuple (
const std::string& mainDir,
149 const std::string& extraDir)
152 mainSH.
load (mainDir);
154 extraSH.
load (extraDir);
161 std::unique_ptr<SH::SampleLocal> newSample
163 *newSample->meta() = *mainSample->
meta();
166 newSample->add (
file);
167 for (
auto&
file : extraSample->makeFileList())
168 newSample->add (
file);
169 newSH.
add (newSample.release());
174 if (newSH.
get (mainSample->
name()) ==
nullptr)
175 newSH.
add (mainSample);
178 mainSH.save (mainDir);
187 if (shReprocess.
size() > 0)
189 std::string mysubmitdir = submitdir +
"/emptyFiles";
194 driver.submit (myjob, mysubmitdir);
196 mergeHists (submitdir, mysubmitdir, shReprocess);
200 mergeNtuple (submitdir +
"/output-" +
output->label(),
201 mysubmitdir +
"/output-" +
output->label());
void add(Sample *sample)
add a sample to the handler
std::size_t size() const
the number of samples contained
void hadd(const std::string &output_file, const std::vector< std::string > &input_files, unsigned max_files)
effects: perform the hadd functionality guarantee: basic failures: out of memory III failures: i/o er...
void processEmptyFiles(const std::string &submitdir, const Job &job)
check the output of the given (completed) job, rerun all (empty) files that did not get a fileExecute...
std::vector< std::string > makeFileList() const
make a list of all files, prestaging them if necessary
This module defines the arguments passed from the BATCH driver to the BATCH worker.
MetaObject * meta()
the meta-information for this sample
const std::string & name() const
the name of the sample we are using
a base class that manages a set of files belonging to a particular data set and the associated meta-d...
void load(const std::string &directory)
load all the samples from the given directory
a Driver that runs directly inside the submission job itself
void setMetaString(const std::string &name, const std::string &value)
set the meta-data string with the given name for all samples.
void exec(const std::string &cmd)
effects: execute the given command guarantee: strong failures: out of memory II failures: system fail...
A Sample based on a simple file list.
const SH::SampleHandler & sampleHandler() const
description: the sample handler used guarantee: no-fail / strong failures: out of memory II
A class that manages a list of Sample objects.
#define RCU_THROW_MSG(message)
Sample * get(const std::string &name)
get the sample with the given name
void add(const std::string &file)
add a file to the list
std::string quote(const std::string &name)
effects: quote the given name to protect it from the shell returns: the quoted name guarantee: strong...