ATLAS Offline Software
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()){
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
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
max
#define max(a, b)
Definition: cfImp.cxx:41
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
ArgStrToDouble
Definition: ArgStrToDouble.h:13
ArgStrToDouble::m_posinf
std::vector< std::string > m_posinf
Definition: ArgStrToDouble.h:32
ArgStrToDouble::m_neginf
std::vector< std::string > m_neginf
Definition: ArgStrToDouble.h:33
ArgStrToDouble::operator()
double operator()(const std::string &s)
Definition: ArgStrToDouble.h:16
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14