1 #ifndef L1Trigger_TrackFindingTracklet_interface_Util_h
2 #define L1Trigger_TrackFindingTracklet_interface_Util_h
10 #include <sys/types.h>
22 unsigned int radix = 1,
value = 0;
23 for (
int i = binary.length() - 1;
i >= 0;
i--) {
24 if (binary.at(
i) !=
'0' && binary.at(
i) !=
'1')
26 value += (binary.at(
i) -
'0') * radix;
28 ss << std::hex <<
value;
35 ss << std::hex <<
value;
38 std::reverse(str.begin(), str.end());
43 constexpr
double dr = 0.18;
45 double bend = delta / stripPitch;
49 inline double rinv(
double phi1,
double phi2,
double r1,
double r2) {
54 double dphi = phi2 - phi1;
57 return 2.0 *
sin(dphi) / dr /
sqrt(1.0 + 2 * r1 * r2 * (1.0 -
cos(dphi)) / (dr * dr));
63 for (
char word : stubwordhex) {
99 << __FILE__ <<
" " << __LINE__ <<
" hex string format invalid: " << stubwordhex;
101 stubwordbin += hexword;
107 double power =
log(factor) /
log(2);
108 int ipower = round(power);
124 int statRC =
stat(path.c_str(), &
info);
126 if (errno == ENOENT) {
129 if (errno == ENOTDIR) {
135 return (info.st_mode & S_IFDIR) ? 1 : 0;
142 int fail = system((
std::string(
"mkdir -p ") + dir).c_str());
144 throw cms::Exception(
"BadDir") << file <<
" " << line <<
" could not create directory " <<
dir;
148 std::ofstream
out(dir +
"/" + fname);
151 throw cms::Exception(
"BadFile") << file <<
" " << line <<
" could not create file " << fname <<
" in " <<
dir;
163 int fail = system((
std::string(
"mkdir -p ") + dir).c_str());
165 throw cms::Exception(
"BadDir") << file <<
" " << line <<
" could not create directory " <<
dir;
172 out.open(fname, std::ofstream::app);
176 throw cms::Exception(
"BadFile") << file <<
" " << line <<
" could not create file " << fname <<
" in " <<
dir;
Log< level::Info, true > LogVerbatim
static std::vector< std::string > checklist log
Sin< T >::type sin(const T &t)
std::string hexFormat(const std::string &binary)
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
double rinv(double phi1, double phi2, double r1, double r2)
int dirExists(const std::string &path)
std::string convertHexToBin(const std::string &stubwordhex)
double bendstrip(double r, double rinv, double stripPitch)
std::ofstream openfile(const std::string &dir, const std::string &fname, const char *file, int line)