test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
FFFNamingSchema.h
Go to the documentation of this file.
1 #ifndef FFFNAMINGSCHEMA_H_
2 #define FFFNAMINGSCHEMA_H_
3 
4 #include <iomanip>
5 #include <sstream>
6 
7 namespace fffnaming {
8 
9  inline std::string runLumiPrefix(const unsigned int run, const unsigned int ls) {
10  std::stringstream ss;
11  ss << "run" << std::setfill('0') << std::setw(6) << run << "_ls" << std::setfill('0') << std::setw(4) << ls;
12  return ss.str();
13  }
14 
15  inline void runLumiPrefixFill(std::stringstream & ss, const unsigned int run, const unsigned int ls) {
16  ss << "run" << std::setfill('0') << std::setw(6) << run << "_ls" << std::setfill('0') << std::setw(4) << ls;
17  }
18 
19  inline std::string eolsFileName(const unsigned int run, const unsigned int ls) {
20  std::stringstream ss;
21  runLumiPrefixFill(ss,run,ls);
22  ss << "_EoLS.jsn";
23  return ss.str();
24  }
25 
26  inline std::string eorFileName(const unsigned int run) {
27  std::stringstream ss;
28  ss << "run" << std::setfill('0') << std::setw(6) << run << "_ls0000" << "_EoR.jsn";
29  return ss.str();
30  }
31 
32  inline std::string inputJsonFileName(const unsigned int run, const unsigned int ls, const unsigned int index) {
33  std::stringstream ss;
34  runLumiPrefixFill(ss,run,ls);
35  ss << "_index" << std::setfill('0') << std::setw(6) << index << ".jsn";
36  return ss.str();
37  }
38 
39  inline std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index) {
40  std::stringstream ss;
41  runLumiPrefixFill(ss,run,ls);
42  ss << "_index" << std::setfill('0') << std::setw(6) << index << ".raw";
43  return ss.str();
44  }
45 
46  inline std::string initFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
47  std::stringstream ss;
48  runLumiPrefixFill(ss,run,ls);
49  ss << "_" << stream
50  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
51  << ".ini";
52  return ss.str();
53  }
54 
55  inline std::string initFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
56  std::stringstream ss;
57  runLumiPrefixFill(ss,run,ls);
58  ss << "_" << stream
59  << "_" << instance
60  << ".ini";
61  return ss.str();
62  }
63 
64  inline std::string streamerDataFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
65  std::stringstream ss;
66  runLumiPrefixFill(ss,run,ls);
67  ss << "_" << stream
68  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
69  << ".dat";
70  return ss.str();
71  }
72 
73  inline std::string streamerDataFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
74  std::stringstream ss;
75  runLumiPrefixFill(ss,run,ls);
76  ss << "_" << stream
77  << "_" << instance
78  << ".dat";
79  return ss.str();
80  }
81 
82  inline std::string streamerDataChecksumFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
83  std::stringstream ss;
84  runLumiPrefixFill(ss,run,ls);
85  ss << "_" << stream
86  << "_" << instance
87  << ".checksum";
88  return ss.str();
89  }
90 
91  inline std::string streamerJsonFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
92  std::stringstream ss;
93  runLumiPrefixFill(ss,run,ls);
94  ss << "_" << stream
95  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
96  << ".jsn";
97  return ss.str();
98  }
99 
100  inline std::string streamerJsonFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
101  std::stringstream ss;
102  runLumiPrefixFill(ss,run,ls);
103  ss << "_stream" << stream
104  << "_" << instance
105  << ".jsn";
106  return ss.str();
107  }
108 
109  inline std::string protocolBufferHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
110  std::stringstream ss;
111  runLumiPrefixFill(ss,run,ls);
112  ss << "_" << stream
113  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
114  << ".pb";
115  return ss.str();
116  }
117 
118  inline std::string protocolBufferHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
119  std::stringstream ss;
120  runLumiPrefixFill(ss,run,ls);
121  ss << "_" << stream
122  << "_" << instance
123  << ".pb";
124  return ss.str();
125  }
126 
127  inline std::string rootHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
128  std::stringstream ss;
129  runLumiPrefixFill(ss,run,ls);
130  ss << "_" << stream
131  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
132  << ".root";
133  return ss.str();
134  }
135 
136  inline std::string rootHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
137  std::stringstream ss;
138  runLumiPrefixFill(ss,run,ls);
139  ss << "_" << stream
140  << "_" << instance
141  << ".root";
142  return ss.str();
143  }
144 
145  inline std::string genericFileName(const unsigned int run, const unsigned int ls,
146  std::string const& typePrefix, std::string const& typeSuffix, unsigned int typeWidth,
147  std::string const& instancePrefix, std::string const& instanceSuffix, unsigned int instanceWidth,
148  std::string const& fileExtension)
149  {
150  std::stringstream ss;
151  runLumiPrefixFill(ss,run,ls);
152  ss << "_";
153  if (typePrefix.size())
154  ss << typePrefix;
155  if (typeWidth)
156  ss << std::setfill('0') << std::setw(typeWidth);
157  ss << typeSuffix;
158  if (instanceSuffix.size()) {
159  ss << "_";
160  if (instancePrefix.size())
161  ss << instancePrefix;
162  if (instanceWidth)
163  ss << std::setfill('0') << std::setw(instanceWidth);
164  ss << instanceSuffix;
165  }
166  if (fileExtension.size())
167  ss << "." << fileExtension;
168  return ss.str();
169  }
170 
171 };
172 #endif
std::string protocolBufferHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string streamerDataChecksumFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
static PFTauRenderPlugin instance
void runLumiPrefixFill(std::stringstream &ss, const unsigned int run, const unsigned int ls)
std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
std::string runLumiPrefix(const unsigned int run, const unsigned int ls)
std::string streamerDataFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string genericFileName(const unsigned int run, const unsigned int ls, std::string const &typePrefix, std::string const &typeSuffix, unsigned int typeWidth, std::string const &instancePrefix, std::string const &instanceSuffix, unsigned int instanceWidth, std::string const &fileExtension)
std::string streamerJsonFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string inputJsonFileName(const unsigned int run, const unsigned int ls, const unsigned int index)
std::string streamerJsonFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string eorFileName(const unsigned int run)
std::string initFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string rootHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string initFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string rootHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string protocolBufferHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)
std::string eolsFileName(const unsigned int run, const unsigned int ls)
std::string streamerDataFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const &stream)