ATLAS Offline Software
CompoundCondition.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3 */
4 #
5 #include "./CompoundCondition.h"
8 
9 #include <sstream>
10 #include <cmath>
11 #include <TLorentzVector.h>
12 
13 CompoundCondition::CompoundCondition(std::vector<Condition>& elements){
14 
15  for(auto& el : elements){
16  if(el != nullptr) {
17  m_elements.push_back(std::move(el));
18  }
19  }
20  unsigned int capacity{0};
21 
22  // mis-configuration of elemental Conditions with differing capacities
23  // not caught...
24  if(!m_elements.empty()){
25  capacity = (m_elements.front())->capacity();
26  }
28 }
29 
30 
32  const std::unique_ptr<ITrigJetHypoInfoCollector>& collector) const {
33 
34  bool pass{true};
35  for(const auto& el : m_elements){
36  pass = pass and (el->isSatisfied(ips, collector));
37  if(!pass){break;}
38  }
39 
40 
41  if(collector){
42  const void* address = static_cast<const void*>(this);
43 
44  std::stringstream ss0;
45  ss0 << "CompoundCondition: (" << address << ") "
46  << " pass: " << std::boolalpha << pass << '\n';
47 
48  std::stringstream ss1;
49  for(const auto& ip : ips){
50  auto j_addr = static_cast<const void*>(ip.get());
51  ss1 << " jet : ("<< j_addr << ")\n";
52  }
53  collector->collect(ss0.str(), ss1.str());
54  }
55  return pass;
56 }
57 
58 
59 std::string CompoundCondition::toString() const {
60  std::stringstream ss;
61  ss << "CompoundCondition (" << this << ") Capacity: " << m_capacity << '\n';
62  for(const auto& el :m_elements){
63  ss << el->toString() + '\n';
64  }
65  return ss.str();
66 }
CompoundCondition::m_elements
std::vector< Condition > m_elements
Definition: CompoundCondition.h:37
CompoundCondition.h
CompoundCondition::toString
std::string toString() const override
Definition: CompoundCondition.cxx:59
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
IJet.h
ITrigJetHypoInfoCollector::collect
virtual void collect(const std::string &, const std::string &)=0
CompoundCondition::m_capacity
unsigned int m_capacity
Definition: CompoundCondition.h:39
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
find_tgc_unfilled_channelids.ip
ip
Definition: find_tgc_unfilled_channelids.py:3
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition: HypoJetDefs.h:27
CompoundCondition::CompoundCondition
CompoundCondition(std::vector< Condition > &elements)
Definition: CompoundCondition.cxx:13
CompoundCondition::capacity
virtual unsigned int capacity() const override
Definition: CompoundCondition.h:31
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
ITrigJetHypoInfoCollector.h
CompoundCondition::isSatisfied
virtual bool isSatisfied(const HypoJetVector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
Definition: CompoundCondition.cxx:31