ATLAS Offline Software
Functions
PunchThroughTool.cxx File Reference
#include "PunchThroughTool.h"
#include <iostream>
#include <sstream>
#include <string>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string_view>
#include <charconv>
#include <cmath>
#include "AthContainers/DataVector.h"
#include "AtlasHepMC/SimpleVector.h"
#include "AtlasHepMC/GenVertex.h"
#include "AtlasHepMC/GenParticle.h"
#include "AtlasHepMC/GenEvent.h"
#include "HepPDT/ParticleDataTable.hh"
#include "TruthUtils/MagicNumbers.h"
#include "CLHEP/Random/RandFlat.h"
#include "TFile.h"
#include "TH2F.h"
#include "TAxis.h"
#include "TH1.h"
#include "TMath.h"
#include "TROOT.h"
#include "TKey.h"
#include "TClass.h"
#include "PathResolver/PathResolver.h"
#include "ISF_Event/ISFParticle.h"
#include "PDFcreator.h"
#include "PunchThroughParticle.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 741 of file PunchThroughTool.cxx.

742 {
743  constexpr char delimiters = ',';
744  std::vector<T> tokens;
745  // Skip delimiters at beginning.
746  std::string_view::size_type lastPos = str.find_first_not_of(delimiters, 0);
747  // Find first "non-delimiter".
748  std::string_view::size_type pos = str.find_first_of(delimiters, lastPos);
749 
750  while (std::string_view::npos != pos || std::string_view::npos != lastPos) {
751  // Found a token, add it to the vector.
752  std::string_view numbStr = str.substr(lastPos, pos - lastPos);
753  T num = -9999;
754  std::from_chars(numbStr.data(), numbStr.data() + numbStr.size(), num);
755  tokens.push_back(num);
756  // Skip delimiters. Note the "not_of"
757  lastPos = str.find_first_not_of(delimiters, pos);
758  // Find next "non-delimiter"
759  pos = str.find_first_of(delimiters, lastPos);
760  }
761  return tokens;
762 }
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