Page MenuHomeHEPForge

EmptyAnalysis.cc
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

EmptyAnalysis.cc

/**
* \authors The HEJ collaboration (see AUTHORS for details)
* \date 2019
* \copyright GPLv2 or later
*/
#include "HEJ/EmptyAnalysis.hh"
#include <string>
#include <vector>
#include "yaml-cpp/yaml.h"
#include "HEJ/exceptions.hh"
namespace HEJ{
namespace{
std::vector<std::string> param_as_strings(YAML::Node const & parameters){
using YAML::NodeType;
switch(parameters.Type()){
case NodeType::Null:
case NodeType::Undefined:
return {};
case NodeType::Scalar:
return {parameters.as<std::string>()};
case NodeType::Sequence: {
std::vector<std::string> param_strings;
for(auto && param: parameters){
param_strings.emplace_back(param.as<std::string>());
}
return param_strings;
}
case NodeType::Map: {
std::vector<std::string> param_strings;
for(auto && param: parameters){
param_strings.emplace_back(param.first.as<std::string>());
}
return param_strings;
}
default:;
}
throw std::logic_error{"unreachable"};
}
}
std::unique_ptr<Analysis> EmptyAnalysis::create(
YAML::Node const & parameters
){
const auto param_strings = param_as_strings(parameters);
if(! param_strings.empty()){
std::string error{"Unknown analysis parameter(s):"};
for(auto && p: param_strings) error += " " + p;
throw unknown_option{error};
}
return std::unique_ptr<Analysis>{new EmptyAnalysis{}};
}
void EmptyAnalysis::fill(Event const &, Event const &){
// do nothing
}
bool EmptyAnalysis::pass_cuts(Event const &, Event const &){
return true;
}
void EmptyAnalysis::finalise(){
// do nothing
}
}

File Metadata

Mime Type
text/x-c
Expires
Tue, Sep 30, 5:46 AM (1 d, 10 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
6460615
Default Alt Text
EmptyAnalysis.cc (1 KB)

Event Timeline