ATLAS Offline Software
TimingCondition.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 "./TimingCondition.h"
7 #include <sstream>
8 #include <stdexcept>
9 #include <TLorentzVector.h>
10 #include <limits>
11 #include <memory>
12 
14  double t_max):
15  m_min(t_min), m_max(t_max) {
16 }
17 
18 
19 bool TimingCondition::isSatisfied(const HypoJetVector& ips, const std::unique_ptr<ITrigJetHypoInfoCollector>& collector) const{
20 
21  if(ips.size() != 1){
22  std::stringstream ss;
23  ss << "TimingCondition::isSatisfied must see exactly 1 particle, but received "
24  << ips.size()
25  << '\n';
26  throw std::runtime_error(ss.str());
27  }
28 
29  auto jet = ips[0];
30 
31  float timing {0.};
32  if(!(jet->getAttribute("Timing",timing))){
33  throw std::runtime_error("ERROR: TimingCondition cannot retrieve jet moment 'Timing'");
34  }
35  bool pass = timing >= m_min and timing < m_max;
36 
37  if(collector){
38  std::stringstream ss0;
39  const void* address = static_cast<const void*>(this);
40  ss0 << "TimingCondition: (" << address
41  << ") timing[" << m_min << ", " << m_max << "]"
42  << " pass: " <<std::boolalpha << pass << '\n';
43 
44 
45  auto j_addr = static_cast<const void*>(jet.get());
46  std::stringstream ss1;
47 
48  ss1 << " jet : " << j_addr << ") timing " << timing << '\n';
49  collector -> collect(ss0.str(), ss1.str());
50  }
51  return pass;
52 
53 }
54 
55 std::string TimingCondition::toString() const {
56 
57  std::stringstream ss;
58 
59  const void* address = static_cast<const void*>(this);
60  ss << "TimingCondition: (" << address << ") Capacity: " << s_capacity
61  << " timingMin "<< m_min
62  << " timingMax " << m_max
63  <<'\n';
64 
65  return ss.str();
66 }
TimingCondition::m_max
double m_max
Definition: TimingCondition.h:37
TimingCondition::toString
std::string toString() const override
Definition: TimingCondition.cxx:55
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
TimingCondition::isSatisfied
bool isSatisfied(const HypoJetVector &, const std::unique_ptr< ITrigJetHypoInfoCollector > &) const override
Definition: TimingCondition.cxx:19
TimingCondition::m_min
double m_min
Definition: TimingCondition.h:36
TimingCondition::s_capacity
static const unsigned int s_capacity
Definition: TimingCondition.h:38
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
trigDumpTimers.timing
def timing(hist)
Definition: trigDumpTimers.py:13
TimingCondition.h
HypoJetVector
std::vector< pHypoJet > HypoJetVector
Definition: HypoJetDefs.h:27
RTTAlgmain.address
address
Definition: RTTAlgmain.py:55
ITrigJetHypoInfoCollector.h
TimingCondition::TimingCondition
TimingCondition(double t_min, double t_max)
Definition: TimingCondition.cxx:13
Trig::FeatureAccessImpl::collect
void collect(const HLT::TriggerElement *te, std::vector< Trig::Feature< T > > &data, const std::string &label, unsigned int condition, const std::string &teName, const HLT::TrigNavStructure *navstructure)
actual feature acceess implementation It has (thanks to the ClassTraits) functionality to flatten con...
Definition: FeatureCollectAthena.h:299