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
5//
6// Distributed under the Boost Software License, Version 1.0.
7// (See accompanying file LICENSE_1_0.txt or copy at
8// http://www.boost.org/LICENSE_1_0.txt)
9
10// Please feel free to contact me (krumnack@iastate.edu) for bug
11// reports, feature suggestions, praise and complaints.
12
13
14//
15// includes
16//
17
19
20#include <memory>
24
25//
26// method implementations
27//
28
29namespace SH
30{
31 void mergeSamples (SampleHandler& sh, const std::string& sampleName,
32 const std::string& pattern)
33 {
34 SampleHandler mysh;
35 std::unique_ptr<SampleLocal> mysample (new SampleLocal (sampleName));
36
37 std::regex mypattern (pattern.c_str());
38 for (SampleHandler::iterator sample = sh.begin(),
39 end = sh.end(); sample != end; ++ sample)
40 {
41 if (RCU::match_expr (mypattern, (*sample)->name()))
42 {
43 for (unsigned file = 0, end = (*sample)->numFiles();
44 file != end; ++ file)
45 {
46 mysample->add ((*sample)->fileName (file));
47 }
48 } else
49 {
50 mysh.add (*sample);
51 }
52 }
53 mysh.add (mysample.release());
54 swap (mysh, sh);
55 }
56}
void swap(MetaObject &a, MetaObject &b)
standard swap
A class that manages a list of Sample objects.
std::vector< Sample * >::const_iterator iterator
the iterator to use
void add(Sample *sample)
add a sample to the handler
A Sample based on a simple file list.
Definition SampleLocal.h:38
bool match_expr(const std::regex &expr, const std::string &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:31
TFile * file