ATLAS Offline Software
JetConstituentIterator.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
19 
20 #ifndef JETEVENT_JETCONSTITUENTITERATOR_H
21 #define JETEVENT_JETCONSTITUENTITERATOR_H
22 
23 
24 #include "FourMom/P4PxPyPzE.h"
25 
27 
28 #include "JetEvent/Jet.h"
29 
30 
32  public:
33 
35 
37  {
38  m_end.end();
39  update_hlv();
40  }
41 
43  { m_end.end(); update_hlv();}
44 
45  // operators ------------------------------------------------
47  m_actual++;
48  update_hlv();
49  return *this;
50  }
51 
53  m_actual--;
54  update_hlv();
55  return *this;
56  }
57 
58  // for python, we alias operator++/--
59  void inc(){ this->operator++();}
60  void dec(){ this->operator--();}
61 
62  const JetConstituentIterator * operator*() const { return this; }
63 
64  bool operator== (const JetConstituentIterator& other) const { return (m_actual == other.m_actual) ; }
65 
66  bool operator!= (const JetConstituentIterator& other) const { return (m_actual != other.m_actual) ; }
67  // ------------------------------------------------------------
68 
71 
72 
77 
78 
79  // Static functions -------------------------------------------
82  Jet::const_iterator begin = jet->begin();
83  if( begin == jet->end() ) return JetConstituentIterator(begin);
84  P4SignalState::State constituentDef = getSignalState(*begin);
85  if( (constituentDef == jet->constituentSignalState()) || // if default state is same as the one in jet
86  (constituentDef == P4SignalState::UNKNOWN ) ) // or has no sigstate
87  return JetConstituentIterator(begin); // -> use the fast version
88  else
89  return JetConstituentIterator(begin, jet->constituentSignalState()); // else default to state in jet
90  }
93  return JetConstituentIterator(jet->begin(), s);
94  }
97  return JetConstituentIterator(jet->end());
98  }
101  // -------------------------------------------------------------
102 
103  protected:
104 
111 
112  void update_hlv();
113 
114 };
115 #endif
JetConstituentIterator::operator!=
bool operator!=(const JetConstituentIterator &other) const
Definition: JetConstituentIterator.h:66
JetConstituentIterator::dec
void dec()
Definition: JetConstituentIterator.h:60
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
JetConstituentIterator::first
static JetConstituentIterator first(const Jet *jet)
get a default iterator
Definition: JetConstituentIterator.h:81
Jet
Basic data class defines behavior for all Jet objects The Jet class is the principal data class for...
Definition: Reconstruction/Jet/JetEvent/JetEvent/Jet.h:47
PlotCalibFromCool.begin
begin
Definition: PlotCalibFromCool.py:94
JetConstituentIterator::operator*
const JetConstituentIterator * operator*() const
Definition: JetConstituentIterator.h:62
JetConstituentIterator::JetConstituentIterator
JetConstituentIterator(base_it b)
Definition: JetConstituentIterator.h:36
JetConstituentIterator::JetConstituentIterator
JetConstituentIterator(base_it b, P4SignalState::State s)
Definition: JetConstituentIterator.h:42
P4SignalState::UNKNOWN
@ UNKNOWN
Definition: ISignalState.h:29
JetConstituentIterator::first
static JetConstituentIterator first(const Jet *jet, P4SignalState::State s)
get an iterator on constituent with Sig State
Definition: JetConstituentIterator.h:92
Jet::const_iterator
navigable_t::object_iter const_iterator
Definition: Reconstruction/Jet/JetEvent/JetEvent/Jet.h:108
JetConstituentIterator::m_curState
P4SignalState::State m_curState
Definition: JetConstituentIterator.h:110
P4SignalState
Definition: ISignalState.h:26
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
JetConstituentIterator::m_defState
P4SignalState::State m_defState
Definition: JetConstituentIterator.h:109
JetConstituentIterator::base_it
Jet::const_iterator base_it
Definition: JetConstituentIterator.h:34
JetConstituentIterator::getSignalState
P4SignalState::State getSignalState()
get current signal state of the iterator
Definition: JetConstituentIterator.cxx:43
INavigable4MomentumCollection.h
JetConstituentIterator::m_hlv
Jet::hlv_t m_hlv
Definition: JetConstituentIterator.h:107
JetConstituentIterator::operator--
JetConstituentIterator & operator--()
Definition: JetConstituentIterator.h:52
JetConstituentIterator::m_end
base_it m_end
Definition: JetConstituentIterator.h:106
JetConstituentIterator::setSignalState
void setSignalState(P4SignalState::State s)
set current signal state of the iterator
Definition: JetConstituentIterator.cxx:48
I4Momentum::UNKNOWN
@ UNKNOWN
Definition: I4Momentum.h:33
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
JetConstituentIterator::inc
void inc()
Definition: JetConstituentIterator.h:59
Jet::hlv_t
CLHEP::HepLorentzVector hlv_t
Definition: Reconstruction/Jet/JetEvent/JetEvent/Jet.h:133
JetConstituentIterator::operator++
JetConstituentIterator & operator++()
Definition: JetConstituentIterator.h:46
JetConstituentIterator::get_real_constit
const Jet::constituent_t * get_real_constit()
access to the real constituent pointer
Definition: JetConstituentIterator.h:70
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
P4PxPyPzE
Definition: P4PxPyPzE.h:29
JetConstituentIterator
A safe iterator on jet constituents.
Definition: JetConstituentIterator.h:31
JetConstituentIterator::update_hlv
void update_hlv()
Definition: JetConstituentIterator.cxx:14
P4SignalState::State
State
Definition: ISignalState.h:28
INavigable4Momentum
Definition: INavigable4Momentum.h:21
JetConstituentIterator::m_actual
base_it m_actual
Definition: JetConstituentIterator.h:105
JetConstituentIterator::m_use_signal_state
bool m_use_signal_state
Definition: JetConstituentIterator.h:108
JetConstituentIterator::last
static JetConstituentIterator last(const Jet *jet)
get the end iterator
Definition: JetConstituentIterator.h:96
Jet.h
JetConstituentIterator::operator==
bool operator==(const JetConstituentIterator &other) const
Definition: JetConstituentIterator.h:64
P4PxPyPzE.h