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 19 of file AnomalyDetectionBDT.h.

Constructor & Destructor Documentation

◆ Bin()

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

Definition at line 340 of file AnomalyDetectionBDT.cxx.

341: score(obj["score"]), nVar(nVars) {
342 for (auto &[name, val] : obj["ranges"]["min"].items()) {
343 // this works for vectors [a,b,c] and dictionary values {"0": a, "1": b, "2": c}
344 minVals.push_back(val);
345 }
346 for (auto &[name, val] : obj["ranges"]["max"].items()) {
347 maxVals.push_back(val);
348 }
349}
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 352 of file AnomalyDetectionBDT.cxx.

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

◆ operator<<

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

Definition at line 49 of file AnomalyDetectionBDT.cxx.

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

Member Data Documentation

◆ maxVals

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

Definition at line 35 of file AnomalyDetectionBDT.h.

◆ minVals

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

Definition at line 34 of file AnomalyDetectionBDT.h.

◆ nVar

int TCS::Bin::nVar
private

Definition at line 33 of file AnomalyDetectionBDT.h.

◆ score

int64_t TCS::Bin::score

Definition at line 30 of file AnomalyDetectionBDT.h.


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