|
ATLAS Offline Software
|
#include <PunchThroughClassifier.h>
Definition at line 26 of file PunchThroughClassifier.h.
◆ PunchThroughClassifier()
ISF::PunchThroughClassifier::PunchThroughClassifier |
( |
const std::string & |
type, |
|
|
const std::string & |
name, |
|
|
const IInterface * |
parent |
|
) |
| |
◆ ~PunchThroughClassifier()
virtual ISF::PunchThroughClassifier::~PunchThroughClassifier |
( |
| ) |
|
|
virtualdefault |
◆ calibrateOutput()
double ISF::PunchThroughClassifier::calibrateOutput |
( |
double & |
networkOutput | ) |
const |
calibrate NN output using isotonic regressor
Definition at line 198 of file PunchThroughClassifier.cxx.
212 auto lower =
upper--;
215 double m = (
upper->second - lower->second)/(
upper->first - lower->first);
216 double c = lower->second -
m * lower->first;
217 double calibrated =
m * networkOutput +
c;
◆ computeInputs()
calcalate NN inputs based on isfp and simulstate
Definition at line 157 of file PunchThroughClassifier.cxx.
161 std::map<std::string, std::map<std::string, double> > networkInputs;
164 networkInputs[
"node_0"] = {
165 {
"variable_0", isfp.
momentum().mag() },
166 {
"variable_1", std::abs(isfp.
position().eta()) },
167 {
"variable_2", isfp.
position().phi() },
168 {
"variable_3", simulstate.
E()},
172 for (
unsigned int i = 0;
i < 24;
i++){
176 return networkInputs;
◆ computePunchThroughProbability()
interface method to return probability prediction of punch through
Definition at line 32 of file PunchThroughClassifier.cxx.
34 std::map<std::string, std::map<std::string, double> > networkInputs =
computeInputs(isfp, simulstate);
38 std::map<std::string, double> networkOutputs =
m_graph->compute(networkInputs);
42 return calibratedOutput;
◆ initialize()
StatusCode ISF::PunchThroughClassifier::initialize |
( |
| ) |
|
|
finaloverridevirtual |
AlgTool initialize method.
Definition at line 46 of file PunchThroughClassifier.cxx.
53 ATH_MSG_ERROR(
"[ punchthroughclassifier ] unable to load punchthroughclassifier input scaler");
59 ATH_MSG_ERROR(
"[ punchthroughclassifier ] unable to load punchthroughclassifier network");
65 ATH_MSG_ERROR(
"[ punchthroughclassifier ] unable to load punchthroughclassifier calibrator");
68 return StatusCode::SUCCESS;
◆ initializeCalibrator()
StatusCode ISF::PunchThroughClassifier::initializeCalibrator |
( |
const std::string & |
calibratorConfigFile | ) |
|
isotonic regressor calibrator initialize method
Definition at line 126 of file PunchThroughClassifier.cxx.
129 ATH_MSG_INFO(
"[ punchthroughclassifier ] Loading calibrator: " << calibratorConfigFile);
131 xmlDocPtr
doc = xmlParseFile( calibratorConfigFile.c_str() );
133 for( xmlNodePtr nodeRoot =
doc->children; nodeRoot !=
nullptr; nodeRoot = nodeRoot->next) {
135 if (xmlStrEqual( nodeRoot->name, BAD_CAST
"Transformations" )) {
136 for( xmlNodePtr nodeTransform = nodeRoot->children; nodeTransform !=
nullptr; nodeTransform = nodeTransform->next ) {
139 if (xmlStrEqual( nodeTransform->name, BAD_CAST
"LimitValues" )) {
145 if (xmlStrEqual( nodeTransform->name, BAD_CAST
"LinearNorm" )) {
146 double orig =
atof( (
const char*) xmlGetProp( nodeTransform, BAD_CAST
"orig" ) );
147 double norm =
atof( (
const char*) xmlGetProp( nodeTransform, BAD_CAST
"norm" ) );
154 return StatusCode::SUCCESS;
◆ initializeNetwork()
StatusCode ISF::PunchThroughClassifier::initializeNetwork |
( |
const std::string & |
networkConfigFile | ) |
|
neural network initialize method
Definition at line 105 of file PunchThroughClassifier.cxx.
107 ATH_MSG_INFO(
"[ punchthroughclassifier ] Loading classifier: " << networkConfigFile);
109 std::ifstream
input(networkConfigFile);
111 ATH_MSG_ERROR(
"Could not find json file " << networkConfigFile );
112 return StatusCode::FAILURE;
117 ATH_MSG_ERROR(
"Could not parse graph json file " << networkConfigFile );
118 return StatusCode::FAILURE;
122 return StatusCode::SUCCESS;
◆ initializeScaler()
StatusCode ISF::PunchThroughClassifier::initializeScaler |
( |
const std::string & |
scalerConfigFile | ) |
|
input variable MinMaxScaler initialize method
Definition at line 71 of file PunchThroughClassifier.cxx.
75 xmlDocPtr
doc = xmlParseFile( scalerConfigFile.c_str() );
77 ATH_MSG_INFO(
"[ punchthroughclassifier ] Loading scaler: " << scalerConfigFile);
79 for( xmlNodePtr nodeRoot =
doc->children; nodeRoot !=
nullptr; nodeRoot = nodeRoot->next) {
81 if (xmlStrEqual( nodeRoot->name, BAD_CAST
"Transformations" )) {
82 for( xmlNodePtr nodeTransform = nodeRoot->children; nodeTransform !=
nullptr; nodeTransform = nodeTransform->next ) {
85 if (xmlStrEqual( nodeTransform->name, BAD_CAST
"ScalerValues" )) {
86 m_scalerMin =
atof( (
const char*) xmlGetProp( nodeTransform, BAD_CAST
"min" ) );
87 m_scalerMax =
atof( (
const char*) xmlGetProp( nodeTransform, BAD_CAST
"max" ) );
91 if (xmlStrEqual( nodeTransform->name, BAD_CAST
"VarScales" )) {
92 std::string
name = (
const char*) xmlGetProp( nodeTransform, BAD_CAST
"name" );
93 double min =
atof( (
const char*) xmlGetProp( nodeTransform, BAD_CAST
"min" ) );
94 double max =
atof( (
const char*) xmlGetProp( nodeTransform, BAD_CAST
"max" ) );
102 return StatusCode::SUCCESS;
◆ scaleInputs()
std::map< std::string, std::map< std::string, double > > ISF::PunchThroughClassifier::scaleInputs |
( |
std::map< std::string, std::map< std::string, double > > & |
inputs | ) |
const |
◆ m_calibrationMap
std::map<double, double> ISF::PunchThroughClassifier::m_calibrationMap |
|
private |
◆ m_calibrationMax
double ISF::PunchThroughClassifier::m_calibrationMax {} |
|
private |
◆ m_calibrationMin
double ISF::PunchThroughClassifier::m_calibrationMin {} |
|
private |
◆ m_calibratorConfigFile
std::string ISF::PunchThroughClassifier::m_calibratorConfigFile |
|
private |
◆ m_calibratorConfigFileName
std::string ISF::PunchThroughClassifier::m_calibratorConfigFileName |
|
private |
◆ m_graph
std::unique_ptr<lwt::LightweightGraph> ISF::PunchThroughClassifier::m_graph {} |
|
private |
◆ m_networkConfigFileName
std::string ISF::PunchThroughClassifier::m_networkConfigFileName |
|
private |
◆ m_scalerConfigFileName
std::string ISF::PunchThroughClassifier::m_scalerConfigFileName |
|
private |
◆ m_scalerMax
double ISF::PunchThroughClassifier::m_scalerMax {} |
|
private |
◆ m_scalerMaxMap
std::map<std::string, double> ISF::PunchThroughClassifier::m_scalerMaxMap |
|
private |
◆ m_scalerMin
double ISF::PunchThroughClassifier::m_scalerMin {} |
|
private |
◆ m_scalerMinMap
std::map<std::string, double> ISF::PunchThroughClassifier::m_scalerMinMap |
|
private |
The documentation for this class was generated from the following files:
std::map< std::string, double > m_scalerMaxMap
std::unique_ptr< lwt::LightweightGraph > m_graph
NN graph.
std::map< double, double > m_calibrationMap
double calibrateOutput(double &networkOutput) const
calibrate NN output using isotonic regressor
double Efrac(int sample) const
StatusCode initializeScaler(const std::string &scalerConfigFile)
input variable MinMaxScaler initialize method
#define ATH_MSG_VERBOSE(x)
const Amg::Vector3D & position() const
The current position of the ISFParticle.
double m_scalerMin
input variable MinMaxScaler members
static std::map< std::string, std::map< std::string, double > > computeInputs(const ISF::ISFParticle &isfp, const TFCSSimulationState &simulstate)
calcalate NN inputs based on isfp and simulstate
std::map< std::string, std::map< std::string, double > > scaleInputs(std::map< std::string, std::map< std::string, double > > &inputs) const
scale NN inputs using MinMaxScaler
StatusCode initializeNetwork(const std::string &networkConfigFile)
neural network initialize method
double atof(std::string_view str)
Converts a string into a double / float.
std::string m_calibratorConfigFileName
std::string to_string(const DetectorType &type)
const Amg::Vector3D & momentum() const
The current momentum vector of the ISFParticle.
StatusCode initializeCalibrator(const std::string &calibratorConfigFile)
isotonic regressor calibrator initialize method
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
GraphConfig parse_json_graph(std::istream &json)
std::string m_scalerConfigFileName
std::string m_networkConfigFileName
std::map< std::string, double > m_scalerMinMap