CMS 3D CMS Logo

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 #include <unistd.h>
7 
8 namespace fffnaming {
9 
10  inline std::string runLumiPrefix(const unsigned int run, const unsigned int ls) {
11  std::stringstream ss;
12  ss << "run" << std::setfill('0') << std::setw(6) << run << "_ls" << std::setfill('0') << std::setw(4) << ls;
13  return ss.str();
14  }
15 
16  inline void runLumiPrefixFill(std::stringstream& ss, const unsigned int run, const unsigned int ls) {
17  ss << "run" << std::setfill('0') << std::setw(6) << run << "_ls" << std::setfill('0') << std::setw(4) << ls;
18  }
19 
20  inline std::string eolsFileName(const unsigned int run, const unsigned int ls) {
21  std::stringstream ss;
22  runLumiPrefixFill(ss, run, ls);
23  ss << "_EoLS.jsn";
24  return ss.str();
25  }
26 
27  inline std::string bolsFileName(const unsigned int run, const unsigned int ls) {
28  std::stringstream ss;
29  runLumiPrefixFill(ss, run, ls);
30  ss << "_BoLS.jsn";
31  return ss.str();
32  }
33 
34  inline std::string eorFileName(const unsigned int run) {
35  std::stringstream ss;
36  ss << "run" << std::setfill('0') << std::setw(6) << run << "_ls0000"
37  << "_EoR.jsn";
38  return ss.str();
39  }
40 
41  inline std::string inputJsonFileName(const unsigned int run, const unsigned int ls, const unsigned int index) {
42  std::stringstream ss;
43  runLumiPrefixFill(ss, run, ls);
44  ss << "_index" << std::setfill('0') << std::setw(6) << index << ".jsn";
45  return ss.str();
46  }
47 
48  inline std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index) {
49  std::stringstream ss;
50  runLumiPrefixFill(ss, run, ls);
51  ss << "_index" << std::setfill('0') << std::setw(6) << index << ".raw";
52  return ss.str();
53  }
54 
55  inline std::string initFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
56  std::stringstream ss;
57  runLumiPrefixFill(ss, run, ls);
58  ss << "_" << stream << "_pid" << std::setfill('0') << std::setw(5) << getpid() << ".ini";
59  return ss.str();
60  }
61 
62  inline std::string initFileNameWithInstance(const unsigned int run,
63  const unsigned int ls,
64  std::string const& stream,
65  std::string const& instance) {
66  std::stringstream ss;
67  runLumiPrefixFill(ss, run, ls);
68  ss << "_" << stream << "_" << instance << ".ini";
69  return ss.str();
70  }
71 
72  inline std::string streamerDataFileNameWithPid(const unsigned int run,
73  const unsigned int ls,
74  std::string const& stream) {
75  std::stringstream ss;
76  runLumiPrefixFill(ss, run, ls);
77  ss << "_" << stream << "_pid" << std::setfill('0') << std::setw(5) << getpid() << ".dat";
78  return ss.str();
79  }
80 
82  const unsigned int ls,
83  std::string const& stream,
84  std::string const& instance) {
85  std::stringstream ss;
86  runLumiPrefixFill(ss, run, ls);
87  ss << "_" << stream << "_" << instance << ".dat";
88  return ss.str();
89  }
90 
92  const unsigned int ls,
93  std::string const& stream,
94  std::string const& instance) {
95  std::stringstream ss;
96  runLumiPrefixFill(ss, run, ls);
97  ss << "_" << stream << "_" << instance << ".checksum";
98  return ss.str();
99  }
100 
101  inline std::string streamerJsonFileNameWithPid(const unsigned int run,
102  const unsigned int ls,
103  std::string const& stream) {
104  std::stringstream ss;
105  runLumiPrefixFill(ss, run, ls);
106  ss << "_" << stream << "_pid" << std::setfill('0') << std::setw(5) << getpid() << ".jsn";
107  return ss.str();
108  }
109 
111  const unsigned int ls,
112  std::string const& stream,
113  std::string const& instance) {
114  std::stringstream ss;
115  runLumiPrefixFill(ss, run, ls);
116  ss << "_stream" << stream << "_" << instance << ".jsn";
117  return ss.str();
118  }
119 
121  const unsigned int ls,
122  std::string const& stream) {
123  std::stringstream ss;
124  runLumiPrefixFill(ss, run, ls);
125  ss << "_" << stream << "_pid" << std::setfill('0') << std::setw(5) << getpid() << ".pb";
126  return ss.str();
127  }
128 
130  const unsigned int ls,
131  std::string const& stream,
132  std::string const& instance) {
133  std::stringstream ss;
134  runLumiPrefixFill(ss, run, ls);
135  ss << "_" << stream << "_" << instance << ".pb";
136  return ss.str();
137  }
138 
139  inline std::string rootHistogramFileNameWithPid(const unsigned int run,
140  const unsigned int ls,
141  std::string const& stream) {
142  std::stringstream ss;
143  runLumiPrefixFill(ss, run, ls);
144  ss << "_" << stream << "_pid" << std::setfill('0') << std::setw(5) << getpid() << ".root";
145  return ss.str();
146  }
147 
149  const unsigned int ls,
150  std::string const& stream,
151  std::string const& instance) {
152  std::stringstream ss;
153  runLumiPrefixFill(ss, run, ls);
154  ss << "_" << stream << "_" << instance << ".root";
155  return ss.str();
156  }
157 
158  inline std::string genericFileName(const unsigned int run,
159  const unsigned int ls,
160  std::string const& typePrefix,
161  std::string const& typeSuffix,
162  unsigned int typeWidth,
163  std::string const& instancePrefix,
164  std::string const& instanceSuffix,
165  unsigned int instanceWidth,
166  std::string const& fileExtension) {
167  std::stringstream ss;
168  runLumiPrefixFill(ss, run, ls);
169  ss << "_";
170  if (!typePrefix.empty())
171  ss << typePrefix;
172  if (typeWidth)
173  ss << std::setfill('0') << std::setw(typeWidth);
174  ss << typeSuffix;
175  if (!instanceSuffix.empty()) {
176  ss << "_";
177  if (!instancePrefix.empty())
178  ss << instancePrefix;
179  if (instanceWidth)
180  ss << std::setfill('0') << std::setw(instanceWidth);
181  ss << instanceSuffix;
182  }
183  if (!fileExtension.empty())
184  ss << "." << fileExtension;
185  return ss.str();
186  }
187 
188 }; // namespace fffnaming
189 #endif
std::string protocolBufferHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const &stream, std::string const &instance)
std::string bolsFileName(const unsigned int run, const unsigned int ls)
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)
def ls(path, rec=False)
Definition: eostools.py:349
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)