ATLAS Offline Software
Loading...
Searching...
No Matches
TCS::Bin Class Reference

#include <AnomalyDetectionBDT.h>

Collaboration diagram for TCS::Bin:

Public Member Functions

 Bin (const nlohmann::json &obj, int nVars)
bool isInside (const std::vector< int64_t > &inputEvent) const

Public Attributes

int64_t score

Private Attributes

int nVar
std::vector< int64_t > minVals
std::vector< int64_t > maxVals

Friends

std::ostream & operator<< (std::ostream &os, const Bin &bin)

Detailed Description

Definition at line 17 of file AnomalyDetectionBDT.h.

Constructor & Destructor Documentation

◆ Bin()

TCS::Bin::Bin ( const nlohmann::json & obj,
int nVars )

Definition at line 339 of file AnomalyDetectionBDT.cxx.

340: score(obj["score"]), nVar(nVars) {
341 for (auto &[name, val] : obj["ranges"]["min"].items()) {
342 // this works for vectors [a,b,c] and dictionary values {"0": a, "1": b, "2": c}
343 minVals.push_back(val);
344 }
345 for (auto &[name, val] : obj["ranges"]["max"].items()) {
346 maxVals.push_back(val);
347 }
348}
std::vector< int64_t > minVals
std::vector< int64_t > maxVals

Member Function Documentation

◆ isInside()

bool TCS::Bin::isInside ( const std::vector< int64_t > & inputEvent) const

Definition at line 351 of file AnomalyDetectionBDT.cxx.

351 {
352 for (size_t i = 0; i < inputEvent.size(); ++i) {
353 if (inputEvent[i] <= minVals[i]) {
354 return false;
355 }
356 else if (inputEvent[i] > maxVals[i]) {
357 return false;
358 }
359 }
360 return true;
361}

◆ operator<<

std::ostream & operator<< ( std::ostream & os,
const Bin & bin )
friend

Definition at line 48 of file AnomalyDetectionBDT.cxx.

49 {
50 os << "Bin(score=" << bin.score << ", nVar=" << bin.nVar
51 << ", minVals=" << vectorToString(bin.minVals)
52 << ", maxVals=" << vectorToString(bin.maxVals) << ")";
53 return os;
54 }
std::string vectorToString(const std::vector< T > &vec)

Member Data Documentation

◆ maxVals

std::vector<int64_t> TCS::Bin::maxVals
private

Definition at line 33 of file AnomalyDetectionBDT.h.

◆ minVals

std::vector<int64_t> TCS::Bin::minVals
private

Definition at line 32 of file AnomalyDetectionBDT.h.

◆ nVar

int TCS::Bin::nVar
private

Definition at line 31 of file AnomalyDetectionBDT.h.

◆ score

int64_t TCS::Bin::score

Definition at line 28 of file AnomalyDetectionBDT.h.


The documentation for this class was generated from the following files: