ATLAS Offline Software
Loading...
Searching...
No Matches
AnomalyDetectionBDT.h
Go to the documentation of this file.
1/*
2Copyright (C) 2002-2025 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
11#include <iostream>
12#include <vector>
14#include "nlohmann/json.hpp"
15
16namespace TCS {
17 class Bin {
18 public:
19 // constructor
20 Bin(const nlohmann::json& obj, int nVars);
21
22 // check if input event is inside the bin
23 bool isInside(const std::vector<int64_t>& inputEvent) const;
24
25 // output streaming
26 friend std::ostream& operator<<(std::ostream& os, const Bin& bin);
27
28 int64_t score; // score of the bin
29
30 private:
31 int nVar; // dimension
32 std::vector<int64_t> minVals; // lower bin limit for each dimension
33 std::vector<int64_t> maxVals; // upper bin limit for each dimension
34 };
35
36 class Tree {
37 public:
38 // constructor
39 Tree(const nlohmann::json& obj, int nVars);
40
41 // score for input event (score of bin which contains the input event)
42 int64_t getTreeScore(const std::vector<int64_t>& inputEvent) const;
43
44 private:
45 std::vector<Bin> bins; // all bins of the tree
46 };
47
48
50 public:
51 AnomalyDetectionBDT(const std::string & name);
52 virtual ~AnomalyDetectionBDT();
53
54 virtual StatusCode initialize();
55
56 virtual StatusCode processBitCorrect(const std::vector<TCS::TOBArray const *> & input,
57 const std::vector<TCS::TOBArray *> & output,
58 Decision & decision);
59
60 virtual StatusCode process(const std::vector<TCS::TOBArray const *> & input,
61 const std::vector<TCS::TOBArray *> & output,
62 Decision & decision);
63
64 private:
65 std::vector<Tree> m_trees; // list of all trees
66 int m_nVar{0}; // dimension of the BDT
67 int64_t m_totalScore{0}; // score of the input event
68 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
69 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
70 std::string m_sim_mode; //Simulation mode. Can be "lut" (Look Up Table) or "math"
74 size_t p_MaxTob{3}; //Number of TOBs (e.g., 3 muon events)
75 };
76}
77
78#endif
79
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