Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JPDFTypes.hh
Go to the documentation of this file.
1#ifndef __JPHYSICS__JPDFTYPES__
2#define __JPHYSICS__JPDFTYPES__
3
4#include <string>
5#include <sstream>
6
7#include "Jeep/JeepToolkit.hh"
8
9/**
10 * \file
11 *
12 * Numbering scheme for PDF types.
13 * \author mdejong
14 */
15namespace JPHYSICS {}
16namespace JPP { using namespace JPHYSICS; }
17
18namespace JPHYSICS {
19
20
21 /**
22 * PDF types
23 */
25
26 DIRECT_LIGHT_FROM_MUON = 1, //!< direct light from muon
27 SCATTERED_LIGHT_FROM_MUON = 2, //!< scattered light from muon
28
29 DIRECT_LIGHT_FROM_EMSHOWERS = 3, //!< direct light from EM showers
30 SCATTERED_LIGHT_FROM_EMSHOWERS = 4, //!< scattered light from EM showers
31
32 DIRECT_LIGHT_FROM_DELTARAYS = 5, //!< direct light from delta-rays
33 SCATTERED_LIGHT_FROM_DELTARAYS = 6, //!< scattered light from delta-rays
34
35 SCATTERED_LIGHT_FROM_MUON_5D = 12, //!< scattered light from muon
36
37 DIRECT_LIGHT_FROM_EMSHOWER = 13, //!< direct light from EM shower
38 SCATTERED_LIGHT_FROM_EMSHOWER = 14, //!< scattered light from EM shower
39
40 //DIRECT_LIGHT_FROM_SHOWER = 15, //!< direct + scattered light from HADRONIC shower
41
42 DIRECT_LIGHT_FROM_BRIGHT_POINT = 23, //!< direct light from bright point
43 SCATTERED_LIGHT_FROM_BRIGHT_POINT = 24, //!< scattered light from bright point
44
45 LIGHT_FROM_ELONGATED_EMSHOWER = 113, //!< light from elongated EM shower
46
47 LIGHT_FROM_MUON = 1001, //!< direct and scattered light from muon
48 LIGHT_FROM_EMSHOWERS = 1003, //!< direct and scattered light from EM showers
49 LIGHT_FROM_DELTARAYS = 1005, //!< direct and scattered light from delta-rays
50 LIGHT_FROM_EMSHOWER = 1013, //!< direct and scattered light from EM shower
51 LIGHT_FROM_BRIGTH_POINT = 1023 //!< direct and scattered light from brigth point
52 };
53
54
55 /**
56 * Get PDF label.
57 *
58 * \param pdf PDF type
59 * \return PDF label
60 */
61 inline std::string getLabel(const JPDFType_t pdf)
62 {
63 std::ostringstream os;
64
65 os << pdf;
66
67 return os.str();
68 }
69
70
71 /**
72 * Get PDF type.
73 *
74 * \param file_name file name
75 * \return PDF type (-1 in case of error)
76 */
77 inline int getPDFType(const std::string& file_name)
78 {
79 using namespace std;
80
81 static const char* digits = "0123456789";
82
83 int type = -1;
84
85 string buffer = JEEP::getFilename(file_name);
86
87 string::size_type pos = buffer.find_first_of(digits);
88
89 if (pos != string::npos) {
90
91 string::size_type len = buffer.substr(pos).find_first_not_of(digits);
92
93 istringstream(buffer.substr(pos, len)) >> type;
94 }
95
96 return type;
97 }
98
99
100 /**
101 * Get PDF file name.
102 *
103 * The input file name should contain the wild card character JEEP::FILENAME_WILDCARD
104 * which will be replaced by the label corresponding to the given PDF type.
105 *
106 * \param file_name input file name
107 * \param pdf PDF type
108 * \return output file name
109 */
110 inline std::string getFilename(const std::string& file_name,
111 const JPDFType_t pdf)
112 {
113 return JEEP::setWildCard(file_name, getLabel(pdf));
114 }
115
116
117 /**
118 * Test if given PDF type corresponds to Cherenkov light from muon.
119 *
120 * \param pdf PDF type
121 * \return true if PDF corresponds to muon; else false
122 */
123 inline bool is_muon(const int pdf)
124 {
125 return (pdf == DIRECT_LIGHT_FROM_MUON ||
126 pdf == SCATTERED_LIGHT_FROM_MUON ||
127 pdf == LIGHT_FROM_MUON);
128 }
129
130
131 /**
132 * Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
133 *
134 * \param pdf PDF type
135 * \return true if PDF corresponds to Bremsstrahlung; else false
136 */
137 inline bool is_bremsstrahlung(const int pdf)
138 {
139 return (pdf == DIRECT_LIGHT_FROM_EMSHOWERS ||
140 pdf == SCATTERED_LIGHT_FROM_EMSHOWERS ||
141 pdf == LIGHT_FROM_EMSHOWERS);
142 }
143
144
145 /**
146 * Test if given PDF type corresponds to Cherenkov light from delta-rays.
147 *
148 * \param pdf PDF type
149 * \return true if PDF corresponds to delta-rays; else false
150 */
151 inline bool is_deltarays(const int pdf)
152 {
153 return (pdf == DIRECT_LIGHT_FROM_DELTARAYS ||
154 pdf == SCATTERED_LIGHT_FROM_DELTARAYS ||
155 pdf == LIGHT_FROM_DELTARAYS);
156 }
157
158
159 /**
160 * Test if given PDF type corresponds to scattered light.
161 *
162 * \param pdf PDF type
163 * \return true if PDF corresponds to scattered light; else false
164 */
165 inline bool is_scattered(const int pdf)
166 {
167 return (pdf == SCATTERED_LIGHT_FROM_MUON ||
168 pdf == SCATTERED_LIGHT_FROM_EMSHOWERS ||
169 pdf == SCATTERED_LIGHT_FROM_DELTARAYS ||
171 pdf == SCATTERED_LIGHT_FROM_EMSHOWER);
172 }
173}
174
175#endif
Auxiliary methods for handling file names, type names and environment.
std::string getFilename(const std::string &file_name)
Get file name part, i.e. part after last JEEP::PATHNAME_SEPARATOR if any.
std::string setWildCard(const std::string &file_name, const std::string &value)
Get file name by setting wild card to given value.
Auxiliary methods for light properties of deep-sea water.
bool is_deltarays(const int pdf)
Test if given PDF type corresponds to Cherenkov light from delta-rays.
Definition JPDFTypes.hh:151
std::string getFilename(const std::string &file_name, const JPDFType_t pdf)
Get PDF file name.
Definition JPDFTypes.hh:110
bool is_bremsstrahlung(const int pdf)
Test if given PDF type corresponds to Cherenkov light from Bremsstrahlung.
Definition JPDFTypes.hh:137
bool is_muon(const int pdf)
Test if given PDF type corresponds to Cherenkov light from muon.
Definition JPDFTypes.hh:123
bool is_scattered(const int pdf)
Test if given PDF type corresponds to scattered light.
Definition JPDFTypes.hh:165
JPDFType_t
PDF types.
Definition JPDFTypes.hh:24
@ LIGHT_FROM_EMSHOWERS
direct and scattered light from EM showers
Definition JPDFTypes.hh:48
@ LIGHT_FROM_ELONGATED_EMSHOWER
light from elongated EM shower
Definition JPDFTypes.hh:45
@ LIGHT_FROM_EMSHOWER
direct and scattered light from EM shower
Definition JPDFTypes.hh:50
@ LIGHT_FROM_DELTARAYS
direct and scattered light from delta-rays
Definition JPDFTypes.hh:49
@ SCATTERED_LIGHT_FROM_MUON_5D
scattered light from muon
Definition JPDFTypes.hh:35
@ LIGHT_FROM_BRIGTH_POINT
direct and scattered light from brigth point
Definition JPDFTypes.hh:51
@ LIGHT_FROM_MUON
direct and scattered light from muon
Definition JPDFTypes.hh:47
std::string getLabel(const JPDFType_t pdf)
Get PDF label.
Definition JPDFTypes.hh:61
int getPDFType(const std::string &file_name)
Get PDF type.
Definition JPDFTypes.hh:77
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).