ATLAS Offline Software
Functions
SampleComposite.cxx File Reference
#include <SampleHandler/SampleComposite.h>
#include <RootCoreUtils/Assert.h>
#include <RootCoreUtils/ThrowMsg.h>
#include <SampleHandler/SamplePtr.h>
Include dependency graph for SampleComposite.cxx:

Go to the source code of this file.

Functions

 ClassImp (SH::SampleComposite) namespace SH
 

Function Documentation

◆ ClassImp()

ClassImp ( SH::SampleComposite  )

Definition at line 28 of file SampleComposite.cxx.

31 {
32  void SampleComposite ::
33  testInvariant () const
34  {
35  for (SamplesIter sample = m_samples.begin(),
36  end = m_samples.end(); sample != end; ++ sample)
37  {
38  RCU_INVARIANT (!sample->empty());
39  };
40  }
41 
42 
43 
44  SampleComposite ::
45  SampleComposite ()
46  : Sample ("unnamed")
47  {
48  RCU_NEW_INVARIANT (this);
49  }
50 
51 
52 
53  SampleComposite ::
54  SampleComposite (const std::string& name)
55  : Sample (name)
56  {
57  RCU_NEW_INVARIANT (this);
58  }
59 
60 
61 
63  add (const SamplePtr& sample)
64  {
65  RCU_CHANGE_INVARIANT (this);
66  RCU_REQUIRE_SOFT (!sample.empty());
67  if (contains (sample->name()))
68  RCU_THROW_MSG ("trying to add sample " + sample->name() + " to sample " + name() + ", which already contains a sample " + sample->name());
69  m_samples.push_back (sample);
70  }
71 
72 
73 
74  std::size_t SampleComposite ::
75  getNumFiles () const
76  {
77  RCU_READ_INVARIANT (this);
78  RCU_THROW_MSG ("Sample::numFiles not supported for SampleComposite");
79  return 0; // compiler dummy
80  }
81 
82 
83 
84  std::string SampleComposite ::
85  getFileName (const std::size_t /*index*/) const
86  {
87  RCU_READ_INVARIANT (this);
88  RCU_THROW_MSG ("Sample::fileName not supported for SampleComposite");
89  return ""; // compiler dummy
90  }
91 
92 
93 
94  std::vector<std::string> SampleComposite ::
95  doMakeFileList () const
96  {
97  RCU_READ_INVARIANT (this);
98 
99  std::vector<std::string> result;
100  for (SamplesIter sample = m_samples.begin(),
101  end = m_samples.end(); sample != end; ++ sample)
102  {
103  std::vector<std::string> subresult = (*sample)->makeFileList();
104  result.insert (result.end(), subresult.begin(), subresult.end());
105  }
106  return result;
107  }
108 
109 
110 
111  SamplePtr SampleComposite ::
112  doMakeLocal () const
113  {
114  RCU_READ_INVARIANT (this);
115  RCU_THROW_MSG ("Sample::makeLocal not supported for SampleComposite");
116  return 0; // compiler dummy
117  }
118 
119 
120 
121  void SampleComposite ::
122  doUpdateLocation (const std::string& from, const std::string& to)
123  {
124  RCU_READ_INVARIANT (this);
125  for (std::vector<SamplePtr>::iterator sample = m_samples.begin(),
126  end = m_samples.end(); sample != end; ++ sample)
127  {
128  (*sample)->updateLocation (from, to);
129  }
130  }
131 
132 
133 
134  bool SampleComposite ::
135  getContains (const std::string& name) const
136  {
137  RCU_READ_INVARIANT (this);
138  for (SamplesIter sample = m_samples.begin(),
139  end = m_samples.end(); sample != end; ++ sample)
140  {
141  if ((*sample)->contains (name))
142  return true;
143  };
144  return false;
145  }
146 
147 
148 
149  void SampleComposite ::
150  doAddSamples (SampleHandler& result)
151  {
152  RCU_READ_INVARIANT (this);
153  for (std::vector<SamplePtr>::iterator sample = m_samples.begin(),
154  end = m_samples.end(); sample != end; ++ sample)
155  {
156  (*sample)->addSamples (result);
157  };
158  }
159 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
get_generator_info.result
result
Definition: get_generator_info.py:21
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
FullCPAlgorithmsTest_eljob.sample
sample
Definition: FullCPAlgorithmsTest_eljob.py:100
RCU_REQUIRE_SOFT
#define RCU_REQUIRE_SOFT(x)
Definition: Assert.h:153
contains
bool contains(const std::string &s, const std::string &regx)
does a string contain the substring
Definition: hcg.cxx:111
add
bool add(const std::string &hname, TKey *tobj)
Definition: fastadd.cxx:55
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition: Assert.h:201
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
CxxUtils::to
CONT to(RANGE &&r)
Definition: ranges.h:32
python.TrfUtils.getFileName
def getFileName(name, sep='#')
Definition: TrfUtils.py:45
RCU_CHANGE_INVARIANT
#define RCU_CHANGE_INVARIANT(x)
Definition: Assert.h:231
RCU_THROW_MSG
#define RCU_THROW_MSG(message)
Definition: PrintMsg.h:58
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition: Assert.h:229
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition: Assert.h:233