Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
Functions
PunchThroughG4Tool.cxx File Reference
#include "PunchThroughPDFCreator.h"
#include "PunchThroughParticle.h"
#include "PunchThroughG4Tool.h"
#include "PathResolver/PathResolver.h"
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string_view>
#include <charconv>
#include <cmath>
#include "CLHEP/Random/RandFlat.h"
#include "TFile.h"
#include "TH2F.h"
#include "TH1.h"
#include "TMath.h"
#include "TKey.h"
#include "GeoPrimitives/GeoPrimitivesHelpers.h"

Go to the source code of this file.

Functions

template<typename T >
std::vector< T > str_to_list (const std::string_view str)
 

Function Documentation

◆ str_to_list()

template<typename T >
std::vector<T> str_to_list ( const std::string_view  str)

Definition at line 849 of file PunchThroughG4Tool.cxx.

850 {
851  constexpr char delimiters = ',';
852  std::vector<T> tokens;
853  // Skip delimiters at beginning.
854  std::string_view::size_type lastPos = str.find_first_not_of(delimiters, 0);
855  // Find first "non-delimiter".
856  std::string_view::size_type pos = str.find_first_of(delimiters, lastPos);
857 
858  while (std::string_view::npos != pos || std::string_view::npos != lastPos) {
859  // Found a token, add it to the vector.
860  std::string_view numbStr = str.substr(lastPos, pos - lastPos);
861  T num = -9999;
862  std::from_chars(numbStr.data(), numbStr.data() + numbStr.size(), num);
863  tokens.push_back(num);
864  // Skip delimiters. Note the "not_of"
865  lastPos = str.find_first_not_of(delimiters, pos);
866  // Find next "non-delimiter"
867  pos = str.find_first_of(delimiters, lastPos);
868  }
869  return tokens;
870 }
beamspotman.tokens
tokens
Definition: beamspotman.py:1284
trigbs_pickEvents.num
num
Definition: trigbs_pickEvents.py:76
python.LumiBlobConversion.pos
pos
Definition: LumiBlobConversion.py:18
str
Definition: BTagTrackIpAccessor.cxx:11
TSU::T
unsigned long long T
Definition: L1TopoDataTypes.h:35