ATLAS Offline Software
Functions
interpretSeeds.cxx File Reference
#include <boost/lexical_cast.hpp>
#include <boost/tokenizer.hpp>
#include "interpretSeeds.h"
Include dependency graph for interpretSeeds.cxx:

Go to the source code of this file.

Functions

void getLuxury (boost::tokenizer< boost::char_separator< char > >::iterator &token, short &luxLevel)
 
void getOffset (boost::tokenizer< boost::char_separator< char > >::iterator &token, uint32_t &offset)
 
bool interpretSeeds (const std::string &buffer, std::string &stream, uint32_t &seed1, uint32_t &seed2, short &luxury, uint32_t &offset)
 
bool interpretSeeds (const std::string &buffer, std::string &stream, std::vector< uint32_t > &seeds)
 

Function Documentation

◆ getLuxury()

void getLuxury ( boost::tokenizer< boost::char_separator< char > >::iterator &  token,
short &  luxLevel 
)
inline

Definition at line 12 of file interpretSeeds.cxx.

12  {
13  if ((*token) == "LUXURY") {
14  luxLevel = boost::lexical_cast<uint32_t>(*(++token));
15  ++token;
16  }
17 }

◆ getOffset()

void getOffset ( boost::tokenizer< boost::char_separator< char > >::iterator &  token,
uint32_t &  offset 
)
inline

Definition at line 21 of file interpretSeeds.cxx.

21  {
22  if ((*token) == "OFFSET") {
23  offset = boost::lexical_cast<uint32_t>(*(++token));
24  ++token;
25  }
26 }

◆ interpretSeeds() [1/2]

bool interpretSeeds ( const std::string &  buffer,
std::string &  stream,
std::vector< uint32_t > &  seeds 
)

Definition at line 62 of file interpretSeeds.cxx.

64 {
65  //split the space-separated string in 31 or 33 words:
66  typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
67  boost::char_separator<char> sep(" ");
68  tokenizer tokens(buffer, sep);
69  int nToks(distance(tokens.begin(), tokens.end()));
70  bool status = (nToks == 31 || nToks == 33 || nToks == 771);
71  if (status) {
72  tokenizer::iterator token(tokens.begin());
73  stream = *token++;
74  --nToks;
75  try {
76  if (nToks == 32) nToks=30; //ranlux (FIXME NEEDED?)
77  for (int i=0; i<nToks; i++) {
78 #if defined(__GNUC__) && !defined(__clang__)
79 #pragma GCC diagnostic push
80 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
81 #endif
82  seeds.push_back(boost::lexical_cast<uint32_t>(*token++));
83 #if defined(__GNUC__) && !defined(__clang__)
84 #pragma GCC diagnostic pop
85 #endif
86  }
87  } catch (const boost::bad_lexical_cast& e) {
88  status = false;
89  }
90  }
91  return status;
92 }

◆ interpretSeeds() [2/2]

bool interpretSeeds ( const std::string &  buffer,
std::string &  stream,
uint32_t &  seed1,
uint32_t &  seed2,
short &  luxury,
uint32_t &  offset 
)

Definition at line 28 of file interpretSeeds.cxx.

30 {
31  //split the space-separated string in 3 or 5 or 7 words:
32  typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
33  boost::char_separator<char> sep(" ");
34  tokenizer tokens(buffer, sep);
35  int nToks(distance(tokens.begin(), tokens.end()));
36  bool status = (nToks == 3 || nToks == 5 || nToks == 7);
37  if (status) {
38  tokenizer::iterator token(tokens.begin());
39  stream = *token++;
40  //FIXME, try permutations by hand. With more than two we'd need a parser
41  getOffset(token, offset);
42  getLuxury(token, luxury);
43  getOffset(token, offset);
44 
45  try {
46 #if defined(__GNUC__) && !defined(__clang__)
47 #pragma GCC diagnostic push
48 #pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
49 #endif
50  seed1 = boost::lexical_cast<uint32_t>(*token++);
51  seed2 = boost::lexical_cast<uint32_t>(*token++);
52 #if defined(__GNUC__) && !defined(__clang__)
53 #pragma GCC diagnostic pop
54 #endif
55  } catch (const boost::bad_lexical_cast& e) {
56  status = false;
57  }
58  }
59  return status;
60 }
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
getLuxury
void getLuxury(boost::tokenizer< boost::char_separator< char > >::iterator &token, short &luxLevel)
Definition: interpretSeeds.cxx:12
beamspotman.tokens
tokens
Definition: beamspotman.py:1284
AthenaPoolTestWrite.stream
string stream
Definition: AthenaPoolTestWrite.py:12
genPbPbJobOpt.seed2
seed2
Definition: genPbPbJobOpt.py:57
createCoolChannelIdFile.buffer
buffer
Definition: createCoolChannelIdFile.py:12
lumiFormat.i
int i
Definition: lumiFormat.py:85
grepfile.sep
sep
Definition: grepfile.py:38
genPbPbJobOpt.seed1
seed1
Definition: genPbPbJobOpt.py:56
convertTimingResiduals.offset
offset
Definition: convertTimingResiduals.py:71
merge.status
status
Definition: merge.py:17
Amg::distance
float distance(const Amg::Vector3D &p1, const Amg::Vector3D &p2)
calculates the distance between two point in 3D space
Definition: GeoPrimitivesHelpers.h:54
getOffset
void getOffset(boost::tokenizer< boost::char_separator< char > >::iterator &token, uint32_t &offset)
Definition: interpretSeeds.cxx:21