ATLAS Offline Software
CommonSelector.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "./CommonSelector.h"
6 #include <sstream>
7 
8 namespace GlobalSim {
9 
10  using namespace GlobalSim::IOBitwise;
11 
12  CommonSelector::CommonSelector(const std::string& et_low,
13  const std::string& et_high,
14  const std::string& eta_low,
15  const std::string& eta_high,
16  const std::string& phi_low,
17  const std::string& phi_high):
18  m_et_low{std::stoul(et_low)},
19  m_eta_low{std::stoul(eta_low)},
20  m_phi_low{std::stoul(phi_low)} {
21 
22  if(et_high == "inf") {
23  m_et_high = ULONG_MAX;
24  } else {
25  m_et_high = std::stoul(et_high);
26  }
27 
28  if(eta_high == "inf") {
29  m_eta_high = ULONG_MAX;
30  } else {
31  m_eta_high = std::stoul(eta_high);
32  }
33 
34  if(eta_high == "inf") {
35  m_phi_high = ULONG_MAX;
36  } else {
37  m_phi_high = std::stoul(phi_high);
38  }
39  }
40 
41 
42  bool CommonSelector::select(const ICommonTOB& tob) const {
43  {
44  auto et = tob.et_bits().to_ulong();
45  if (et < m_et_low or et >= m_et_high) {return false;}
46  }
47 
48  {
49  auto eta = tob.eta_bits().to_ulong();
50  if (eta < m_eta_low or eta >= m_eta_high) {return false;}
51  }
52 
53  {
54  auto phi = tob.phi_bits().to_ulong();
55  if (phi < m_phi_low or phi >= m_phi_high) {return false;}
56  }
57 
58  return true;
59  };
60 
61  std::string CommonSelector::to_string() const {
62 
63  auto ss = std::stringstream();
64  ss << "et_low: " << m_et_low <<' '
65  << "et_high: " << m_et_high <<' '
66  << "eta_low: " << m_eta_low <<' '
67  << "eta_high: " << m_eta_high <<' '
68  << "phi_low: " << m_phi_low <<' '
69  << "phi_high: " << m_phi_high;
70 
71  return ss.str();
72  };
73 
74 }
GlobalSim::CommonSelector::select
virtual bool select(const ICommonTOB &) const override
Definition: CommonSelector.cxx:42
et
Extra patterns decribing particle interation process.
GlobalSim::CommonSelector::CommonSelector
CommonSelector()=default
Passes all.
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
GlobalSim::CommonSelector::m_et_low
ulong m_et_low
Definition: CommonSelector.h:44
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
CommonSelector.h
GlobalSim::IOBitwise::ICommonTOB
Class to hold common (eta/eta/phi) TOB bits.
Definition: ICommonTOB.h:27
GlobalSim
AlgTool that to test whether expected the TIP values generated by data supplied by eEmMultTestBench c...
Definition: CommonSelector.cxx:8
GlobalSim::CommonSelector::to_string
virtual std::string to_string() const override
Definition: CommonSelector.cxx:61
GlobalSim::IOBitwise
Definition: CommonSortSelectAlgTool.h:17
GlobalSim::IOBitwise::ICommonTOB::eta_bits
virtual std::bitset< s_eta_width > eta_bits() const =0
Returns the eta bits of this TOB.
GlobalSim::CommonSelector::m_et_high
ulong m_et_high
Definition: CommonSelector.h:45
GlobalSim::IOBitwise::ICommonTOB::et_bits
virtual std::bitset< s_et_width > et_bits() const =0
Returns the eT bits of this TOB.
GlobalSim::CommonSelector::m_eta_low
ulong m_eta_low
Definition: CommonSelector.h:47
GlobalSim::IOBitwise::ICommonTOB::phi_bits
virtual std::bitset< s_phi_width > phi_bits() const =0
Returns the phi bits of this TOB.
GlobalSim::CommonSelector::m_phi_low
ulong m_phi_low
Definition: CommonSelector.h:51
GlobalSim::CommonSelector::m_phi_high
ulong m_phi_high
Definition: CommonSelector.h:52
GlobalSim::CommonSelector::m_eta_high
ulong m_eta_high
Definition: CommonSelector.h:48