ATLAS Offline Software
Loading...
Searching...
No Matches
jXESort.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
3*/
4// jXESort.cxx
5
10#include <algorithm>
11#include <cmath>
12
13// Bitwise implementation utils
15
16REGISTER_ALG_TCS(jXESort)
17
18
19// constructor
21
22 defineParameter( "InputWidth", 2 ); // for FW
23 defineParameter( "OutputWidth", 2 ); // for FW
24
25}
26
27// destructor
29
30
35
38
39 if(input.size()!=1) {
40 TCS_EXCEPTION("jXE sort alg expects exactly single jXE TOB, got " << input.size());
41 }
42
43 const jXETOBArray & mets = dynamic_cast<const jXETOBArray&>(input);
44 int missingEx = std::clamp(std::abs(mets[0].Ex()), 0, (1<<13) - 1 );
45 int missingEy = std::clamp(std::abs(mets[0].Ey()), 0, (1<<13) - 1 );
46 int missingET = quadraticSumBW(missingEx,missingEy);
47 //clamp missingET value as in FW since GenericTOBs only use 13 bits for ET values
48 //"sorted" missingET is thus far the only exception that can exceed this based on
49 //the corresponding input TOBs' possible value ranges
50 missingET = std::clamp(missingET, 0, (1<<13) - 1 );
51
52 int metphi = TSU::Trigo::atan2(mets[0].Ex(),mets[0].Ey());
53 TRG_MSG_DEBUG("MET phi values " << metphi << " from x/y = " << mets[0].Ex() << "/" << mets[0].Ey() << "( ET = " << missingET << ")" );
54 output.push_back( GenericTOB( missingET, 0, metphi ) );
55
57
58}
59
61TCS::jXESort::sort(const InputTOBArray & input, TOBArray & output) {
62 //we have a bitCorrect version, so use it
63 return this->sortBitCorrect(input, output);
64
65}
66
#define REGISTER_ALG_TCS(CLASS)
Definition AlgFactory.h:62
const std::string & name() const
unsigned long quadraticSumBW(int i1, int i2)
void defineParameter(const std::string &name, TCS::parType_t value)
SortingAlg(const std::string &name)
Definition SortingAlg.h:21
jXESort(const std::string &name)
Definition jXESort.cxx:20
virtual TCS::StatusCode sortBitCorrect(const InputTOBArray &input, TOBArray &output)
Definition jXESort.cxx:37
virtual StatusCode initialize()
Definition jXESort.cxx:32
virtual ~jXESort()
Definition jXESort.cxx:28
virtual TCS::StatusCode sort(const InputTOBArray &input, TOBArray &output)
Definition jXESort.cxx:61
STL namespace.
static int atan2(TSU::L1TopoDataTypes< 16, 0 > x, TSU::L1TopoDataTypes< 16, 0 > y)
Definition Trigo.cxx:512