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 streamerJsonFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
83  std::stringstream ss;
84  runLumiPrefixFill(ss,run,ls);
85  ss << "_" << stream
86  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
87  << ".jsn";
88  return ss.str();
89  }
90 
91  inline std::string streamerJsonFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
92  std::stringstream ss;
93  runLumiPrefixFill(ss,run,ls);
94  ss << "_stream" << stream
95  << "_" << instance
96  << ".jsn";
97  return ss.str();
98  }
99 
100  inline std::string protocolBufferHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
101  std::stringstream ss;
102  runLumiPrefixFill(ss,run,ls);
103  ss << "_" << stream
104  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
105  << ".pb";
106  return ss.str();
107  }
108 
109  inline std::string protocolBufferHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
110  std::stringstream ss;
111  runLumiPrefixFill(ss,run,ls);
112  ss << "_" << stream
113  << "_" << instance
114  << ".pb";
115  return ss.str();
116  }
117 
118  inline std::string rootHistogramFileNameWithPid(const unsigned int run, const unsigned int ls, std::string const& stream) {
119  std::stringstream ss;
120  runLumiPrefixFill(ss,run,ls);
121  ss << "_" << stream
122  << "_pid" << std::setfill('0') << std::setw(5) << getpid()
123  << ".root";
124  return ss.str();
125  }
126 
127  inline std::string rootHistogramFileNameWithInstance(const unsigned int run, const unsigned int ls, std::string const& stream, std::string const& instance) {
128  std::stringstream ss;
129  runLumiPrefixFill(ss,run,ls);
130  ss << "_" << stream
131  << "_" << instance
132  << ".root";
133  return ss.str();
134  }
135 
136  inline std::string genericFileName(const unsigned int run, const unsigned int ls,
137  std::string const& typePrefix, std::string const& typeSuffix, unsigned int typeWidth,
138  std::string const& instancePrefix, std::string const& instanceSuffix, unsigned int instanceWidth,
139  std::string const& fileExtension)
140  {
141  std::stringstream ss;
142  runLumiPrefixFill(ss,run,ls);
143  ss << "_";
144  if (typePrefix.size())
145  ss << typePrefix;
146  if (typeWidth)
147  ss << std::setfill('0') << std::setw(typeWidth);
148  ss << typeSuffix;
149  if (instanceSuffix.size()) {
150  ss << "_";
151  if (instancePrefix.size())
152  ss << instancePrefix;
153  if (instanceWidth)
154  ss << std::setfill('0') << std::setw(instanceWidth);
155  ss << instanceSuffix;
156  }
157  if (fileExtension.size())
158  ss << "." << fileExtension;
159  return ss.str();
160  }
161 
162 };
163 #endif
std::string protocolBufferHistogramFileNameWithInstance(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)