ATLAS Offline Software
Toggle main menu visibility
Loading...
Searching...
No Matches
PhysicsAnalysis
D3PDTools
SampleHandler
Root
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
11
#include <
SampleHandler/ToolsJoin.h
>
12
13
#include <memory>
14
#include <
RootCoreUtils/StringUtil.h
>
15
#include <
SampleHandler/SampleHandler.h
>
16
#include <
SampleHandler/SampleLocal.h
>
17
18
//
19
// method implementations
20
//
21
22
namespace
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
}
SampleHandler.h
SampleLocal.h
StringUtil.h
ToolsJoin.h
SH::MetaObject::swap
void swap(MetaObject &a, MetaObject &b)
standard swap
SH::SampleHandler
A class that manages a list of Sample objects.
Definition
SampleHandler.h:53
SH::SampleHandler::add
void add(const Sample &sample)
add a copy of the sample to the handler
RCU::Shell
Definition
ShellExec.cxx:26
RCU::match_expr
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...
Definition
StringUtil.cxx:30
SH
This module provides a lot of global definitions, forward declarations and includes that are used by ...
Definition
PrunDriver.h:15
SH::mergeSamples
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
file
TFile * file
Definition
tile_monitor.h:29
Generated on
for ATLAS Offline Software by
1.17.0