ATLAS Offline Software
Loading...
Searching...
No Matches
LArMLencoding.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4
6#include <cmath>
7
8//input Et should be MeV/12.5 unit.
9//function to get ML code for eFEX
10int LArMLencoding::get_MultiLinearCode_eFEX(int Et, bool saturated, bool invalid, bool empty){
11 // for special codes
12 if (empty) return 0;
13 else if (invalid) return 1022;
14 else if (saturated) return 1023;
15
16 // for specific energies
17 else if (Et < -60) return 1;
18 else if (Et < 448) return (Et+60)/2 + 2;
19 else if (Et < 1472) return (Et/4) + 144;
20 else if (Et < 3520) return (Et/8) + 328;
21 else if (Et < 11584) return (Et/32) + 658;
22 else return 1020;
23}
24
25//function to get ML code for jFEX
26int LArMLencoding::get_MultiLinearCode_jFEX(int Et, bool invalid, bool empty){
27 // for special code
28 if (empty) return 0;
29 else if (invalid) return 4095;
30
31 // for specific energies
32 else if (Et < -252) return 1;
33 else if (Et < 512) return (Et+512)/2 + 2;
34 else if (Et < 64000)
35 {
36 const int pow = log(Et/512)/log(4);
37 return Et/(std::pow(2,pow+2))+256*std::pow(2,pow);
38 }
39 else return 4048;
40}
41
42//function to get ML code for gFEX
43int LArMLencoding::get_MultiLinearCode_gFEX(int Et, bool invalid, bool empty){
44 //for special codes
45 if (empty) return 0;
46 else if (invalid) return 4095;
47
48 //for specific codes
49 if (Et < -8096) return 1;
50 else if (Et < -4000) return (Et+8096)/1024 + 2;
51 else if (Et < -1024) return (Et+4000)/4 + 6;
52 else if (Et < 1024) return (Et+1024)/2 + 750;
53 else if (Et < 4096) return (Et-1024)/4 + 1774;
54 else if (Et < 16000) return (Et-4096)/8 + 2542;
55 else if (Et < 81536) return (Et-16000)/2048 + 4030;
56 else return 4062;
57}
static const Attributes_t empty
constexpr int pow(int base, int exp) noexcept
static int get_MultiLinearCode_eFEX(int Et, bool saturated=false, bool invalid=false, bool empty=false)
static int get_MultiLinearCode_gFEX(int Et, bool invalid=false, bool empty=false)
static int get_MultiLinearCode_jFEX(int Et, bool invalid=false, bool empty=false)