ATLAS Offline Software
Loading...
Searching...
No Matches
ToolsJoin.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
12
13#include <memory>
17
18//
19// method implementations
20//
21
22namespace SH
23{
24 void mergeSamples (SampleHandler& sh, const std::string& sampleName,
25 const std::string& pattern)
26 {
27 SampleHandler mysh;
28 auto mysample = std::make_shared<SampleLocal> (sampleName);
29
30 std::regex mypattern (pattern.c_str());
31 for (auto& sample : sh.samples())
32 {
33 if (RCU::match_expr (mypattern, sample->name()))
34 {
35 for (unsigned file = 0, end = sample->numFiles();
36 file != end; ++ file)
37 {
38 mysample->add (sample->fileName (file));
39 }
40 } else
41 {
42 mysh.add (sample);
43 }
44 }
45 mysh.add (mysample);
46 swap (mysh, sh);
47 }
48}
void swap(MetaObject &a, MetaObject &b)
standard swap
A class that manages a list of Sample objects.
void add(const Sample &sample)
add a copy of the sample to the handler
bool match_expr(const std::regex &expr, std::string_view str)
returns: whether we can match the entire string with the regular expression guarantee: strong failure...
This module provides a lot of global definitions, forward declarations and includes that are used by ...
Definition PrunDriver.h:15
void mergeSamples(SampleHandler &sh, const std::string &sampleName, const std::string &pattern)
effects: remove all samples matching the name pattern, and join them into a single sample named sampl...
Definition ToolsJoin.cxx:24
TFile * file