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" << "_EoR.jsn";
37  return ss.str();
38  }
39 
40  inline std::string inputJsonFileName(const unsigned int run, const unsigned int ls, const unsigned int index) {
41  std::stringstream ss;
42  runLumiPrefixFill(ss,run,ls);
43  ss << "_index" << std::setfill('0') << std::setw(6) << index << ".jsn";
44  return ss.str();
45  }
46 
47  inline std::string inputRawFileName(const unsigned int run, const unsigned int ls, const unsigned int index) {
48  std::stringstream ss;
49  runLumiPrefixFill(ss,run,ls);
50  ss << "_index" << std::setfill('0') << std::setw(6) << index << ".raw";
51  return ss.str();
52  }
53 
54  inline std::string initFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
55  std::stringstream ss;
56  runLumiPrefixFill(ss,run,ls);
57  ss << "_" << stream
58  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
59  << ".ini";
60  return ss.str();
61  }
62 
63  inline std::string initFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
64  std::stringstream ss;
65  runLumiPrefixFill(ss,run,ls);
66  ss << "_" << stream
67  << "_" << instance
68  << ".ini";
69  return ss.str();
70  }
71 
72  inline std::string streamerDataFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
73  std::stringstream ss;
74  runLumiPrefixFill(ss,run,ls);
75  ss << "_" << stream
76  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
77  << ".dat";
78  return ss.str();
79  }
80 
81  inline std::string streamerDataFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
82  std::stringstream ss;
83  runLumiPrefixFill(ss,run,ls);
84  ss << "_" << stream
85  << "_" << instance
86  << ".dat";
87  return ss.str();
88  }
89 
90  inline std::string streamerDataChecksumFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
91  std::stringstream ss;
92  runLumiPrefixFill(ss,run,ls);
93  ss << "_" << stream
94  << "_" << instance
95  << ".checksum";
96  return ss.str();
97  }
98 
99  inline std::string streamerJsonFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
100  std::stringstream ss;
101  runLumiPrefixFill(ss,run,ls);
102  ss << "_" << stream
103  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
104  << ".jsn";
105  return ss.str();
106  }
107 
108  inline std::string streamerJsonFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
109  std::stringstream ss;
110  runLumiPrefixFill(ss,run,ls);
111  ss << "_stream" << stream
112  << "_" << instance
113  << ".jsn";
114  return ss.str();
115  }
116 
117  inline std::string protocolBufferHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
118  std::stringstream ss;
119  runLumiPrefixFill(ss,run,ls);
120  ss << "_" << stream
121  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
122  << ".pb";
123  return ss.str();
124  }
125 
126  inline std::string protocolBufferHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
127  std::stringstream ss;
128  runLumiPrefixFill(ss,run,ls);
129  ss << "_" << stream
130  << "_" << instance
131  << ".pb";
132  return ss.str();
133  }
134 
135  inline std::string rootHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
136  std::stringstream ss;
137  runLumiPrefixFill(ss,run,ls);
138  ss << "_" << stream
139  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
140  << ".root";
141  return ss.str();
142  }
143 
144  inline std::string rootHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
145  std::stringstream ss;
146  runLumiPrefixFill(ss,run,ls);
147  ss << "_" << stream
148  << "_" << instance
149  << ".root";
150  return ss.str();
151  }
152 
153  inline std::string genericFileName(const unsigned int run, const unsigned int ls,
154  std::string const& typePrefix, std::string const& typeSuffix, unsigned int typeWidth,
155  std::string const& instancePrefix, std::string const& instanceSuffix, unsigned int instanceWidth,
156  std::string const& fileExtension)
157  {
158  std::stringstream ss;
159  runLumiPrefixFill(ss,run,ls);
160  ss << "_";
161  if (!typePrefix.empty())
162  ss << typePrefix;
163  if (typeWidth)
164  ss << std::setfill('0') << std::setw(typeWidth);
165  ss << typeSuffix;
166  if (!instanceSuffix.empty()) {
167  ss << "_";
168  if (!instancePrefix.empty())
169  ss << instancePrefix;
170  if (instanceWidth)
171  ss << std::setfill('0') << std::setw(instanceWidth);
172  ss << instanceSuffix;
173  }
174  if (!fileExtension.empty())
175  ss << "." << fileExtension;
176  return ss.str();
177  }
178 
179 };
180 #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:348
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)