CMS 3D CMS Logo

Functions
XGBooster.cc File Reference
#include "PhysicsTools/PatAlgos/interface/XGBooster.h"
#include <algorithm>
#include <cassert>
#include <cmath>
#include <stdexcept>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>

Go to the source code of this file.

Functions

std::vector< std::string > read_features (const std::string &content)
 

Function Documentation

◆ read_features()

std::vector<std::string> read_features ( const std::string &  content)

Definition at line 15 of file XGBooster.cc.

References Skims_PA_cff::content, mps_fire::result, cms::cuda::stream, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by pat::XGBooster::XGBooster().

15  {
16  std::vector<std::string> result;
17 
18  std::istringstream stream(content);
19  char ch;
20 
21  // Expect opening '['
22  stream >> ch;
23  if (ch != '[') {
24  throw std::runtime_error("Expected '[' at the beginning of the JSON array!");
25  }
26 
27  while (stream) {
28  stream >> ch;
29 
30  if (ch == ']') {
31  break;
32  } else if (ch == ',') {
33  continue;
34  } else if (ch == '"') {
35  std::string feature;
36  std::getline(stream, feature, '"');
37  result.push_back(feature);
38  } else {
39  throw std::runtime_error("Unexpected character in the JSON array!");
40  }
41  }
42 
43  return result;
44 }
uint32_t T const *__restrict__ uint32_t const *__restrict__ int32_t int Histo::index_type cudaStream_t stream