ATLAS Offline Software
Loading...
Searching...
No Matches
RegionLogicalOperation.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <cstdlib>
8
9#include "iostream"
10
11namespace MuonCalib {
12
13 bool RegionLogicalOperation::AddRegion(std::unique_ptr<RegionSelectorBase> region, bool invert) {
14 if (m_regions.size() > m_operator.size()) return false;
15 m_regions.emplace_back(std::move(region));
16 m_inverse.push_back(invert);
17 return true;
18 }
19
21 if ((m_regions.size() <= m_operator.size())) return false;
22 m_operator.push_back(op);
23 return true;
24 }
25
27 if (m_regions.size() == 0) return true;
28 bool ret(m_inverse[0] xor m_regions[0]->Result(id));
29 for (unsigned int i = 0; i < m_operator.size(); i++) {
30 bool this_region_result(m_inverse[i + 1] xor m_regions[i + 1]->Result(id));
31 if (m_operator[i]) {
32 ret = ret || this_region_result;
33 } else {
34 ret = ret && this_region_result;
35 }
36 }
37 return ret;
38 }
39
40 void RegionLogicalOperation::Print(std::ostream &os) const {
41 os << "(";
42 for (unsigned int i = 0; i < m_regions.size(); i++) {
43 if (m_inverse[i]) os << "!";
44 m_regions[i]->Print(os);
45 if (i < m_operator.size()) {
46 if (m_operator[i])
47 os << " | ";
48 else
49 os << " & ";
50 }
51 }
52 os << ")";
53 }
54
55} // namespace MuonCalib
ICscStripFitter::Result Result
Implements fixed identifiers not dependent upon Athena Identifier for internal use in the calibration...
Definition MuonFixedId.h:50
std::vector< bool > m_operator
region operator - true=or false=and
bool AddRegion(std::unique_ptr< RegionSelectorBase > region, bool invert=false)
Add a region to the operation.
void Print(std::ostream &os) const
character output of region
std::vector< std::unique_ptr< RegionSelectorBase > > m_regions
region data
bool AddOperator(bool op)
Set next operator.
std::vector< bool > m_inverse
inverse region selection
bool Result(const MuonFixedId &region) const
return the reslut of the logical operation
CscCalcPed - algorithm that finds the Cathode Strip Chamber pedestals from an RDO.