ATLAS Offline Software
Loading...
Searching...
No Matches
ArgStrToDouble.h
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3*/
4
5#ifndef TRIGHLTJETHYPO_ARGSTRINGTODOUBLE_H
6#define TRIGHLTJETHYPO_ARGSTRINGTODOUBLE_H
7
8#include <string>
9#include <vector>
10#include <algorithm>
11#include <limits>
12
14 public:
15
16 double operator() (const std::string& s){
17
18 double val{0};
19 if(std::find(m_posinf.begin(), m_posinf.end(), s) != m_posinf.end()){
20 val = std::numeric_limits<double>::max();}
21 else if (std::find(m_neginf.begin(), m_neginf.end(), s) != m_neginf.end()){
22 val = std::numeric_limits<double>::lowest();}
23 else {
24 val = std::stod(s);
25 }
26
27 return val;
28 }
29
30
31 private:
32 std::vector<std::string> m_posinf{"inf", "+inf", "pinf", "INF"};
33 std::vector<std::string> m_neginf{"-inf", "ninf", "-INF"};
34};
35
36#endif
double operator()(const std::string &s)
std::vector< std::string > m_neginf
std::vector< std::string > m_posinf