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