ATLAS Offline Software
DiskOutputLocal.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 //
9 // includes
10 //
11 
13 
14 #include <sstream>
15 #include <RootCoreUtils/Assert.h>
17 
18 //
19 // method implementations
20 //
21 
23 
24 namespace SH
25 {
27  testInvariant () const
28  {
29  RCU_INVARIANT (!m_prefix.empty());
30  }
31 
32 
33 
36  : m_prefix ("/ThisIsANonExistantPath")
37  {
38  RCU_NEW_INVARIANT (this);
39  }
40 
41 
42 
44  DiskOutputLocal (const std::string& val_prefix)
45  : m_prefix (val_prefix)
46  {
47  RCU_NEW_INVARIANT (this);
48  }
49 
50 
51 
52  std::unique_ptr<DiskWriter> DiskOutputLocal ::
53  doMakeWriter (const std::string& sampleName,
54  const std::string& segmentName,
55  const std::string& suffix) const
56  {
57  RCU_READ_INVARIANT (this);
58  return std::make_unique<DiskWriterLocal>
59  (targetURL (sampleName, segmentName, suffix));
60  }
61 
62 
63 
64  std::string DiskOutputLocal ::
65  getTargetURL (const std::string& sampleName,
66  const std::string& segmentName,
67  const std::string& suffix) const
68  {
69  RCU_READ_INVARIANT (this);
70  std::ostringstream file;
71  file << m_prefix;
72  if (m_prefix.back() != '-')
73  file << "/";
74  file << sampleName;
75  if (!segmentName.empty())
76  file << "-" << segmentName;
77  file << suffix;
78  return file.str();
79  }
80 }
SH::DiskOutputLocal::m_prefix
std::string m_prefix
the prefix to apply when creating files
Definition: DiskOutputLocal.h:83
hotSpotInTAG.suffix
string suffix
Definition: hotSpotInTAG.py:186
DiskOutputLocal.h
ClassImp
ClassImp(SH::DiskOutputLocal) namespace SH
Definition: DiskOutputLocal.cxx:22
SH::DiskOutputLocal
an implementation of DiskOutput for local disks
Definition: DiskOutputLocal.h:23
SH::DiskOutputLocal::DiskOutputLocal
DiskOutputLocal()
standard default constructor
Assert.h
SH::DiskOutput::targetURL
std::string targetURL(const std::string &sampleName, const std::string &segmentName, const std::string &suffix) const
the final output location for the given segment
file
TFile * file
Definition: tile_monitor.h:29
DiskWriterLocal.h
RCU_INVARIANT
#define RCU_INVARIANT(x)
Definition: Assert.h:201
SH::DiskOutputLocal::getTargetURL
virtual std::string getTargetURL(const std::string &sampleName, const std::string &segmentName, const std::string &suffix) const
SH::DiskOutputLocal::doMakeWriter
virtual std::unique_ptr< DiskWriter > doMakeWriter(const std::string &sampleName, const std::string &segmentName, const std::string &suffix) const
create a DiskWriter object managing an output file
SH
This module provides a lot of global definitions, forward declarations and includes that are used by ...
Definition: PrunDriver.h:15
RCU_READ_INVARIANT
#define RCU_READ_INVARIANT(x)
Definition: Assert.h:229
SH::DiskOutputLocal::testInvariant
void testInvariant() const
test the invariant of this object
RCU_NEW_INVARIANT
#define RCU_NEW_INVARIANT(x)
Definition: Assert.h:233