ATLAS Offline Software
Loading...
Searching...
No Matches
AnomalyDetectionBDT.h
Go to the documentation of this file.
1/*
2Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
3
4// AnomalyDetectionBDT.h
5// Created by Santiago Cané on 4/15/2025
6*/
7
8#ifndef __TopoCore__AnomalyDetectionBDT__
9#define __TopoCore__AnomalyDetectionBDT__
10
12#include "nlohmann/json.hpp"
13#include <iosfwd>
14#include <vector>
15#include <cstdint>
16
17
18namespace TCS {
19 class Bin {
20 public:
21 // constructor
22 Bin(const nlohmann::json& obj, int nVars);
23
24 // check if input event is inside the bin
25 bool isInside(const std::vector<int64_t>& inputEvent) const;
26
27 // output streaming
28 friend std::ostream& operator<<(std::ostream& os, const Bin& bin);
29
30 int64_t score; // score of the bin
31
32 private:
33 int nVar; // dimension
34 std::vector<int64_t> minVals; // lower bin limit for each dimension
35 std::vector<int64_t> maxVals; // upper bin limit for each dimension
36 };
37
38 class Tree {
39 public:
40 // constructor
41 Tree(const nlohmann::json& obj, int nVars);
42
43 // score for input event (score of bin which contains the input event)
44 int64_t getTreeScore(const std::vector<int64_t>& inputEvent) const;
45
46 private:
47 std::vector<Bin> bins; // all bins of the tree
48 };
49
50
52 public:
53 AnomalyDetectionBDT(const std::string & name);
54 virtual ~AnomalyDetectionBDT();
55
56 virtual StatusCode initialize();
57
58 virtual StatusCode processBitCorrect(const std::vector<TCS::TOBArray const *> & input,
59 const std::vector<TCS::TOBArray *> & output,
60 Decision & decision);
61
62 virtual StatusCode process(const std::vector<TCS::TOBArray const *> & input,
63 const std::vector<TCS::TOBArray *> & output,
64 Decision & decision);
65
66 private:
67 std::vector<Tree> m_trees; // list of all trees
68 int m_nVar{0}; // dimension of the BDT
69 int64_t m_totalScore{0}; // score of the input event
70 float m_mu1_ptmin{0}, m_mu1_ptmax{0}, m_mu1_etamin{0}, m_mu1_etamax{0}, m_mu1_phimin{0}, m_mu1_phimax{0}; // range of the first muon
71 float m_mu2_ptmin{0}, m_mu2_ptmax{0}, m_mu2_etamin{0}, m_mu2_etamax{0}, m_mu2_phimin{0}, m_mu2_phimax{0}; // range of the second muon
72 std::string m_sim_mode; //Simulation mode. Can be "lut" (Look Up Table) or "math"
76 size_t p_MaxTob{3}; //Number of TOBs (e.g., 3 muon events)
77 };
78}
79
80#endif
81
virtual StatusCode processBitCorrect(const std::vector< TCS::TOBArray const * > &input, const std::vector< TCS::TOBArray * > &output, Decision &decision)
AnomalyDetectionBDT(const std::string &name)
std::vector< Tree > m_trees
virtual StatusCode initialize()
std::vector< int64_t > minVals
std::vector< int64_t > maxVals
bool isInside(const std::vector< int64_t > &inputEvent) const
friend std::ostream & operator<<(std::ostream &os, const Bin &bin)
Bin(const nlohmann::json &obj, int nVars)
const std::string & name() const
DecisionAlg(const std::string &name)
Definition DecisionAlg.h:25
Tree(const nlohmann::json &obj, int nVars)
std::vector< Bin > bins
int64_t getTreeScore(const std::vector< int64_t > &inputEvent) const
const std::string process
uint32_t parType_t
Definition Parameter.h:22